content
stringlengths
1
15.9M
\section{Introduction} Geometry frustration and competing interactions in quantum magnets can lead to many novel phenomena~\cite{Lacroix2011}, in which the quantum spin liquid (QSL) states~\cite{XGWen1991, *Balents2010, *XGWen2002, *Kitaev2006, *Savary2016, *Norman2016, *ZYi2017, *Broholm2020} have gained much research interests in recent years. A QSL is an exotic quantum state beyond the Landau-Ginzburg-Wilson (LGW) paradigm, in which the conventional magnetic order and dimer order are prevented to be developed even at zero temperature. More interestingly, QSL states have long-range entanglement and emergent fractionalized excitations such as the neutral spinon, which obey the anyon statistics~\cite{XGWen1991, *Balents2010, *XGWen2002, *Kitaev2006, *Savary2016, *Norman2016, *ZYi2017, *Broholm2020}. Therefore, while the absent conventional orders provide a necessary condition for detecting a QSL, the magnetic excitations that can be probed by inelastic neutron scattering experiment are playing a more important role in the identification of QSL states in both models and materials. One of the most important models to search and study QSL is the square-lattice Heisenberg model with competiting interactions. Due to the close relation with the parent compound of high temperature superconductors~\cite{Anderson1987, XGWen2006}, the $J_1$--$J_2$ square-lattice Heisenberg model has attracted a lot of studies on both the ground-state phase diagram and the excitation spectrum, by various methods such as exact diagonalization (ED)~\cite{Dagotto1989, Schulz1996, Capriotti2000, Mambrini2006, Richter2010}, density matrix renormalization group (DMRG)~\cite{HChJiang2012, SSGong2014, LWang2018}, tensor network (TN)~\cite{Murg2009, JFYu2012, LWang2013, LWang2016, Haghshenas2018, WYLiu2018, Didier2019, WYLiu2021tri2}, variational Monte Carlo (VMC)~\cite{Capriotti2001, TLi2012, Mezzacapo2012, WJHu2013, YQi2014, Morita2015, Ferrari2018, Ferrari2020} and many other methods~\cite{Chandra1988, Gelfand1989, Read1991, Singh1999, GMZhang2003, Darradi2008, YRen2014, ShLYu2018, Nomura2021tri2, Shackleton2021}. These studies have proposed different candidate states for the intermediate paramagnetic region. Up to now, the consensus is that below the stripe magnetic phase the system is in a weak valence-bond solid (VBS) phase, although its nature is still under debate between a plaquette VBS (PVBS) and a columnar VBS (CVBS). Between the N\'eel and the VBS phase, some new results support a gapless QSL phase~\cite{LWang2018, WYLiu2021tri2, Morita2015, Ferrari2020, Nomura2021tri2} but its nature is far from clear. Meanwhile, due to the limit of system size in these studies, a direct N\'eel-VBS transition may not be excluded. For the magnetic excitation, a cluster perturbation theory (CPT) study~\cite{ShLYu2018} and a VMC study~\cite{Ferrari2018} both supported the existence of a gapless Z$_2$ spin liquid and found that the spectrum of this phase is characterized by a broad continuum. In experiment, there are many compound materials which may be effectively described by the $J_1$--$J_2$ Heisenberg model, such as Li$_2$VOMO$_4$ (M = Si, Ge)~\cite{Melzi2000, Bombardi2004}, VOMoO$_4$~\cite{Carretta2002, Bombardi2005}, PbVO$_3$~\cite{Tsirlin2008}, Sr$_2$CuTe$_{1-x}$W$_x$O$_6$~\cite{Babkevich2016, Koga2016, Mustonen2018tri1, Mustonen2018tri2, Katukuri2020, WShHong2021}. QSL-like behaviors have been reported in some of these compounds~\cite{Mustonen2018tri1, Mustonen2018tri2, Katukuri2020, WShHong2021}. To establish a better understanding on the competing phases in the square-lattice Heisenberg model, the $J_1$--$J_3$ model has also been extensively studied in the past three decades~\cite{Gelfand1989, Locher1990, Moreo1990, Chubukov1991tri2, Rastelli1992, Ferrer1993, Leung1996, Capriotti2004tri1, Capriotti2004tri2, Mambrini2006, Murg2009, Sindzingre2010, Reuther2011, WYLiu2021tri3, Daniel2021}. In the classical limit, the model has a N\'eel antiferromagnetic (NAF) phase and a spiral order phase, which are separated at $J_3 / J_1$ = 0.25~\cite{Gelfand1989, Locher1990, Moreo1990, Chubukov1991tri2, Rastelli1992, Ferrer1993}. After considering quantum fluctuations, a paramagnetic region also emerges near $J_3 / J_1$ = 0.5. An early DMRG study~\cite{Capriotti2004tri1} on the ladder with open boundary conditions suggested that the dimer order would vanish with the increase of the leg number and the ground state near $J_3$ = 0.5 may be a QSL. In contrast, an ED study~\cite{Mambrini2006} and a projected entangled pair state (PEPS) study~\cite{Murg2009} found that the ground state is likely to be a PVBS state, which was also supported by the series expansion (SE), coupled cluster method (CCM) and dynamical functional renormalization group (FRG) calculations~\cite{Reuther2011}. A newly TN study further claimed that this PVBS state belongs to a higher-order symmetry-protected topological phase~\cite{Daniel2021}. Very recently, a large-scale PEPS study~\cite{WYLiu2021tri3} showed that there is a remarkable QSL phase (0.28 $\lesssim J_3 / J_1 \lesssim$ 0.38) between the N\'eel and the VBS phase, which is inherited from the QSL in the $J_1$--$J_2$ model. This new picture of phase diagram provides a fascinating perspective to understand the emergent QSL phase from the neighbor deconfined quantum critical point (DQCP)~\cite{Senthil2004tri1, Senthil2004tri2, Sandvik2007}. However, the nature of the VBS state was not determined in this large-scale simulation and the existence of the QSL phase was only probed by static properties. Therefore, in this paper, we reexamine the phase diagram of this model by combining the ED and DMRG calculations. We also explore the magnetic excitations in the VBS and the possible QSL phase, which are compared with the results of the $J_1 - J_2$ model as well. The rest of this paper is organized as follows. In Sec.~\ref{Sec:Model}, we introduce the model Hamiltonian and define the order parameters as well as the observations that we will calculate. In Sec.~\ref{Sec:PhaseDiagram}, we show the phase diagram obtained by our DMRG and ED results. As shown in Fig.~\ref{fig:PhaseDiagram}, we identify that the paramagnetic region actually includes two phases: a QSL phase and a PVBS phase based on the calculation of the order parameters, energy spectrum and entanglement spectrum. More importantly, in Sec.~\ref{Sec:Excitation}, we show the dynamical spin structure factor for different phases by CPT and ED. In the QSL phase, we find signals of some weak continua around the $M$ and $X$ points. And our study of the magnetic excitation in the PVBS phase will provide more theoretical understanding of the PVBS phase with spontaneously translational symmetry breaking. Finally, we provide a summary and discussion in Sec.~\ref{Sec:Summary}. \section{Model and Method} \label{Sec:Model} The Hamiltonian of the spin-$1/2$ $J_1$--$J_3$ Heisenberg model on the square lattice reads \begin{equation*} \begin{split}\begin{array}{l} H = J_1 \sum\limits_{\left\langle {i,j} \right\rangle} {\hat{\mathbf{S}}_{i} \cdot \hat{\mathbf{S}}_{j}} + J_3 \sum\limits_{\left\langle\left\langle\left\langle {i,j} \right\rangle\right\rangle\right\rangle} {\hat{\mathbf{S}}_{i} \cdot \hat{\mathbf{S}}_{j}}. \end{array} \label{Eq:Hmlt} \end{split} \end{equation*} In the following calculation we set $J_1 = 1$ as the energy unit. We use SU(2) DMRG~\cite{SRWhite1992, McCulloch2002} and ED to study the ground state phase diagram. For the magnetic excitation, we employ the ED and CPT~\cite{Gros1993, Senechal2000, ShLYu2018} methods. The finite-size clusters with the periodic boundary conditions (torus geometry) used in the ED calculation are shown in Appendix~\ref{App:FSClusters}. The cylinder geometry we used in the DMRG calculation is the rectangular cylinder with the periodic boundary conditions in the $y$ direction and the open boundary conditions in the $x$ direction. To reduce the boundary effects, we choose the lattice size with $L_x \geq 2 L_y$ ($L_x$ and $L_y$ represent the numbers of sites in the $x$ and $y$ directions, respectively) and take the correlations of the middle $L_y \times L_y$ sites to calculate the order parameters~\cite{SRWhite2007, HChJiang2012, SSGong2014}. \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{PhaseDiagram.pdf} \caption{Phase diagram of the spin-$1/2$ $J_1$--$J_3$ Heisenberg model on the square lattice. When $J_3$ is small, the model is in the N\'eel antiferromagnetic (NAF) phase. With growing $J_3$, it enters into a quantum spin liquid (QSL) phase for 0.3 $\lesssim J_3/J_1 \lesssim 0.375$. In larger $J_3$, there is a region of plaquette valence bond solid (PVBS) phase. Around $J_3/J_1 \simeq$ 0.7, a phase transition between the PVBS phase and the spiral magnetic order phase occurs.} \label{fig:PhaseDiagram} \end{figure} In order to determine the phase boundaries and detect possible dimer order in the intermediate paramagnetic phase, we calculate three kinds of order parameters. The first one is the N\'eel order parameter, \begin{equation*} m_{s}^{2} = \frac{1}{N} S(\mathbf{M}), \quad S(\mathbf{q}) = \frac{1}{N}\sum_{i,j} \left\langle \hat{\mathbf{S}}_{i} \cdot \hat{\mathbf{S}}_{j} \right\rangle e^{i \vec{q} \cdot \left( \vec{r}_i - \vec{r}_j \right)}, \end{equation*} where $\mathbf{M} = \left(\pi, \pi\right)$. The other two kinds of the order parameters are the dimer order parameters~\cite{Mambrini2006}, \begin{equation*} m_{\lambda}^{2} = \frac{1}{N_b} S_{\lambda}, \quad S_{\lambda} = \sum_{\left(k,l\right)}\epsilon_{\lambda} \left(k,l\right) C_{ijkl}, \end{equation*} where $\lambda$ is either ``VBC" or ``Col", and $N_b$ is the number of the bonds used in the calculation of $m_{\lambda}^{2}$. These two dimer order parameters can be analyzed together to distinguish the CVBS and the s-wave PVBS state whose symmetry breaking state adiabatically connects to the direct product of $|\varphi_0 \rangle$ shown in Fig.~\ref{fig:App_Plaquette} of Appendix~\ref{App:Checkerboard}. For both the two VBS states, $m_{\textrm{VBC}}^{2}$ would be finite in the thermodynamic limit, while $m_{\textrm{Col}}^{2}$ would be finite only for the CVBS state and would be zero for the s-wave PVBS state~\cite{Mambrini2006}. The phase factors $\epsilon_{\lambda}$ of these two dimer order parameters are chosen as shown in the insets of the Figs.~\ref{fig:MagneticOrders}(c) and \ref{fig:MagneticOrders}(d), where the reference bond $(i,j)$ locates in the middle of the cylinders, either along the $x$ (horizontal) direction or the $y$ (vertical) direction. The dimer-dimer correlation function $C_{ijkl}$ is defined as \begin{equation*} C_{ijkl} = 4\left[ \left\langle \left( \hat{\mathbf{S}}_{i} \cdot \hat{\mathbf{S}}_{j} \right) \left( \hat{\mathbf{S}}_{k} \cdot \hat{\mathbf{S}}_{l} \right) \right\rangle - \left\langle \hat{\mathbf{S}}_{i} \cdot \hat{\mathbf{S}}_{j} \right\rangle \left\langle \hat{\mathbf{S}}_{k} \cdot \hat{\mathbf{S}}_{l} \right\rangle \right]. \end{equation*} We have also calculated the dimer structure factor \begin{equation*} D(\mathbf{q}) = \frac{1}{2N}\sum\limits_{\left\langle i, j\right\rangle}\sum\limits_{\left\langle k, l\right\rangle}e^{-i\mathbf{q}\mathbf{r}_{ij,kl}}C_{ijkl}, \end{equation*} where $\mathbf{r}_{ij,kl}$ means the displacement between the centers of two bonds which connect two pairs of nearest-neighbor sites, $\left\langle i, j\right\rangle$ and $\left\langle k, l\right\rangle$. To study the magnetic excitation, we calculate the dynamical spin structure factor defined as \begin{equation*} \begin{split} S^{+-}(\mathbf{q},\omega)&=\sum_{n}\left\{|\langle \psi_n | \hat{S}^+_{\bf q} | \psi_0 \rangle|^2 \delta\left[\omega-(E_n-E_0)\right]\right\}, \end{split} \end{equation*} where $\hat{S}_{\mathbf{q}}^+ = \frac{1}{N} \sum_i{e^{-\mathbf{q}\mathbf{r_i}} \hat{S}_{i}^+}$ is the Fourier transform of the spin operator $\hat{S}_{i}^+$, and $| \psi_n \rangle$ is the eigenstate of the Hamiltonian with energy $E_n$. Using ED, we calculate the dynamical spin structure factor $S^{+-}(\mathbf{q},\omega)$ on the 36-site cluster under the periodic boundary conditions, and a small Lorentz broadening factor $\eta$ = 0.05 is used in order to observe the prominent excitation peaks more clearly. We also calculate the dynamical spin structure factor by using the bosonic version of the CPT method which maps the spin operators to hard-core boson operators~\cite{ShLYu2018}. By using the ED to do exact calculation of a cluster under the open boundary conditions and treating the inter-cluster interactions as perturbations, CPT method can get the dynamical spin structure factor $S^{+-}(\mathbf{q},\omega)$ in the thermodynamic limit, which has been successfully applied to the $J_1$--$J_2$ Heisenberg model on the square lattice~\cite{ShLYu2018}. In this paper, we use the 6$\times$4 cluster and set $\eta$ = 0.15 in the CPT calculation. \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{MagneticOrders.pdf} \caption{Finite-size extrapolation of (a) the N\'eel order parameter $m_{s}^{2}$ and (b) the dimer order parameter $m_{\textrm{VBC}}^{2}$. (c) and (d) are the extrapolation of the dimer order parameters $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$ at $J_3$ = 0.4 obtained with a horizontal reference bond, a vertical reference bond and the averaged results of these two kinds of reference bonds. The lines in (a)--(c) are the second-order polynomial fits for the data. And the dashed lines in (d) are guides to the eye. The insets in (c) and (d) show the phase factors $\epsilon_{\lambda}$ for $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$, respectively~\cite{Mambrini2006}. The bold bonds in the center of the insets represent the reference bond $(i, j)$ in the calculation of the dimer order parameters $m_{\lambda}^{2}$. (e) shows the logarithmic-linear plot of the hDOP with different $J_3$. $d$ is the distance measured from the boundary. The fitting of the exponential decay of the hDOP gives the decay length $\xi_x$. The hDOP at $J_3$ = 0.5, 0.6 are calculated on the cylinder geometry with $L_y$ = 10, and the other data are obtained on the cylinder geometry with $L_y$ = 12. (f) shows the decay length $\xi_x$ of the horizontal dimer order versus $L_y$ obtained by DMRG on the cylinder geometry.} \label{fig:MagneticOrders} \end{figure} \section{Numerical Results} \subsection{Phase Diagram} \label{Sec:PhaseDiagram} First of all, we consider the N\'eel order parameter $m_{s}^{2}$ which is shown in Fig.~\ref{fig:MagneticOrders}(a). By keeping up to 8000 SU(2) states to obtain convergent data in DMRG calculation (the DMRG truncation errors are smaller than $1\times 10^{-5}$), we calculate $m_{s}^{2}$ on cylinders with $L_y$ = 6 - 12. We exclude $L_y$ = 4 because $J_3$ interaction along the $y$ direction would be doubly counted. The second-order polynomial fitting of $m_{s}^{2}$ suggests that the N\'eel order vanishes at $J_3 \simeq 0.3$, instead of $J_3$ = 0.25 in the classical limit~\cite{Gelfand1989, Locher1990, Moreo1990, Chubukov1991tri2, Rastelli1992, Ferrer1993}. The smooth vanishing of the extrapolated $m_{s}^{2}$ suggests a continuous phase transition. Next, we use DMRG to calculate the dimer order parameters $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$. Compared with the N\'eel order parameter $m_{s}^{2}$, the dimer order parameters for large $J_3$ and large $L_y$ are more difficult to converge in DMRG calculation, especially for $J_3 \gtrsim $ 0.4 and $L_y$ = 12. Therefore we extrapolate $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$ versus $1/m$ ($m$ is the number of the SU(2) states kept in DMRG calculation), which is shown in Fig.~\ref{fig:App_Fit}(a). In Figs.~\ref{fig:MagneticOrders}(c) and \ref{fig:MagneticOrders}(d), we show $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$ at $J_3$ = 0.4, which are obtained by choosing different reference bonds. The results obtained with a horizontal and a vertical reference bond are almost the same at $J_3$ = 0.4. By a second-order polynomial fitting, $m_{\textrm{VBC}}^{2}$ is extrapolated to finite, while the values of $m_{\textrm{Col}}^{2}$ are always very small and approach zero in the thermodynamic limit. For a CVBS state both $m_{\textrm{VBC}}^{2}$ and $m_{\textrm{Col}}^{2}$ would be finite, but for a s-wave PVBS state only $m_{\textrm{VBC}}^{2}$ would be finite~\cite{Mambrini2006}. Therefore, our results indicate that the ground state at $J_3$ = 0.4 would be a s-wave PVBS, although some other kinds of VBS state still cannot be fully ruled out~\cite{Takahashi2020}. And the proposal of the PVBS state is further confirmed by the clear plaquette pattern of the nearest-neighbor bond energy obtained on the 8$\times$8 cluster with the fully open boundary conditions, which is shown in Figs.~\ref{fig:APP_BondEnergy}(b)--\ref{fig:APP_BondEnergy}(d) of Appendix~\ref{App:DMRG}. To determine the phase region of this s-wave PVBS, we calculate $m_{\textrm{VBC}}^{2}$ with different reference bonds, and the finite-size extrapolation of the averaged $m_{\textrm{VBC}}^{2}$ at different $J_3$ is shown in Fig.~\ref{fig:MagneticOrders}(b). For $J_3 \lesssim$ 0.35, the extrapolated $m_{\textrm{VBC}}^{2}$ is nearly zero, and it is clearly nonzero at $J_3$ = 0.4. In order to determine the critical $J_3$ where the PVBS order develops more accurately, we also study the decay length of the horizontal dimer order parameter (hDOP)~\cite{HChJiang2012, Sandvik2012, SSGong2014} on the cylinders with $L_x \geq$ 3 $L_y$. The hDOP is defined as the difference between the bond energies of two adjacent horizontal nearest-neighbor bonds, which is more easily to converge in DMRG calculation compared with dimer correlation function and the calculated dimer order parameters. The hDOPs for different $J_3$ with $L_y \geq$ 10 are shown in Fig.~\ref{fig:MagneticOrders}(e). The hDOPs are nearly linear curves in the logarithmic-linear plot, meaning that the hDOPs decay exponentially with distance $d$ from the boundary to the bulk. Then we use a function hDOP $\sim e^{-d/\xi_x}$ to fit the data and get the decay lengths $\xi_x$ of the horizontal dimer order parameter, which are shown in Fig.~\ref{fig:MagneticOrders}(f). For $J_3 \lesssim$ 0.375, $\xi_x$ grows slowly and seems to be finite in large-size limit. For $J_3 \gtrsim$ 0.375, $\xi_x$ grows faster than linear especially for $L_y \geq$ 10, indicating the existence of the dimer order. At $J_3 \simeq$ 0.375, $\xi_x$ increases almost linearly with $L_y$. Therefore, we take $J_3 \simeq$ 0.375 as the critical $J_3$ where the system enters to the PVBS phase, which is very close to $J_3$ = 0.38 obtained by the PEPS simulation~\cite{WYLiu2021tri3}. With further growing $J_3$, one can see that even on the cylinder with $L_y$ = 10, the hDOP at $J_3$ = 0.5 and 0.6 are almost flat with distance $d$, which indicates the tendency of an increasing dimer order at $J_3$ = 0.5 and 0.6. Besides order parameters, energy level crossing in the low-energy spectrum may also help to determine phase boundaries, which has been applied to the $J$--$Q$ model~\cite{Suwa2016} and the $J_1$--$J_2$ Heisenberg model on the square lattice~\cite{LWang2018, Nomura2021tri2}. We also calculate the energy spectra for the $J_1$--$J_3$ Heisenberg model with 32 and 36 sites, which are shown in Figs.~\ref{fig:Spectrum}(a) and \ref{fig:Spectrum}(b), respectively. When $J_3$ is small, the ground state is the N\'eel state and the lowest-energy states in the sectors with different total spin $S$ form the Anderson tower of states (TOS)~\cite{Anderson1952, Claire2005, Wietek2017}. In the thermodynamic limit, these states are degenerate and the ground state will spontaneously break spin SU(2) symmetry; otherwise on finite-size lattice, they are non-degenerate and the finite-size excitation gaps increase with growing quantum number $S$. In our ED calculations, for both the 32- and 36-site clusters, the ground states are in the singlet sector due to the Lieb-Schultz-Mattis theorem~\cite{Lieb1961}. With increasing $J_3$, the triplet ($S$ = 1) and quintuplet ($S$ = 2) gaps gradually increase. At $J_3 \simeq$ 0.275, the lowest-excited singlet state ($S$ = 0) and the lowest quintuplet state cross, and the crossing point is close to the transition point obtained by the vanishing N\'eel order determined by the scaling of order parameter in Fig.~\ref{fig:MagneticOrders}(a). At $J_3 \simeq$ 0.4, the lowest excited singlet state further crosses with the lowest triplet state. Despite there is finite-size effect, the AFM-QSL and QSL-PVBS transition points obtained from the level crossings in the low-energy spectra agree with those from the extrapolations of order parameters. \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{Spectrum.pdf} \caption{The low-energy spectra obtained on the (a) 32-site and (b) 36-site clusters. (c) shows the linear extrapolation of the singlet and triplet gap obtained on the torus geometry versus 1/$N$ at $J_3$ = 0.5. (d) is the entanglement spectrum obtained on the cylinder geometry with $L_y = 8, L_x = 24$ by DMRG, in which the eigenvalues of the reduced density matrix $\lambda_i$ with different total spin $S = 0, 1, 2$ and $S > 2$ are represented by red, green, blue and purple bars, respectively.} \label{fig:Spectrum} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{SpinDimerCorr.pdf} \caption{The contour plots of [(a1)--(a4)] spin structure factor $S(\mathbf{q})$ obtained on the cylinder geometry with $L_y$ = 8 by DMRG and [(b1), (b2)] dimer structure factor $D(\mathbf{q})$ obtained on the 36-site cluster by ED. The solid lines are the Brillouin zone edge of the original square lattice and the dashed lines in (b1) and (b2) are the Brillouin zone edge of the new square lattice formed by the centers of all the nearest-neighbor bonds in the original lattice.} \label{fig:SpinDimerCorr} \end{figure} In the PVBS phase, the ground state is a spin singlet state and has a four-fold degeneracy which can be lifted by spontaneously translational symmetry breaking in the thermodynamic limit, and the triplet excitation would be gapped. However, due to the finite-size effect in ED calculation, we can only identify three singlet states of the four-fold degeneracy as shown in Figs.~\ref{fig:Spectrum}(a) and \ref{fig:Spectrum}(b), which are located in the translational momentum sectors with $k$ = (0, 0), ($\pi$, 0) and (0, $\pi$), respectively. To determine the low-energy gaps in the PVBS phase, we calculate the energy gaps at $J_3$ = 0.5 obtained on the torus geometry with different lattice sizes, as shown in Fig.~\ref{fig:Spectrum}(c). The energy gaps of the 32- and 36-site clusters are calculated by ED (see the details in Fig.~\ref{fig:App_Energy_0p5}). The results of the 8$\times$8 lattice are obtained by DMRG and have been extrapolated with the number of the SU(2) states to get the convergent results. As shown in Fig.~\ref{fig:Spectrum}(c), the singlet gap [$E_1$($S$ = 0) - $E_0$($S$ = 0)] is extrapolated to zero and the triplet gap [$E_0$($S$ = 1) - $E_0$($S$ = 0)] is extrapolated to a finite value, which are consistent with the PVBS state. With the further increase of $J_3$, another (avoided) energy level crossing occurs at $J_3\simeq$ 0.725 for the 32--site cluster and at $J_3\simeq$ 0.65 for the 36--site cluster, which indicate the phase transition from the PVBS phase to the spiral order phase. In Fig.~\ref{fig:Spectrum}(d), we also show the entanglement spectrum obtained by DMRG on the 24$\times$8 cylinder geometry. From $J_3$ = 0.0 to $J_3$ = 1.0, the lowest spectrum level keeps only one-fold degeneracy in the $S$ = 0 sector, which has a gap from the higher spectra. For the higher spectra above the lowest level, there are crossings between the spectra with $S$ = 0 and $S$ = 1 at $J_3 \simeq $ 0.3 and 0.45, which are close to the phase transition points and may also be taken as the signal of phase transitions. Moreover, the level crossing also occurs at $J_3 \simeq $ 0.7, which combined with the results of the energy spectra strongly suggest that the phase boundary between the PVBS and the spiral phase locates at $J_3 \simeq $ 0.7. However, due to the change of the ordering momentum in the spiral phase with growing $J_3$, it is difficult to obtain this transition point from the extrapolations of spiral order parameter. \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{CPT-6p4.pdf} \caption{Dynamical spin structure factors $S^{+-}(\mathbf{q},\omega)$ at different $J_3$ calculated by the CPT method with 6 $\times$ 4 cluster tiling. The inset of (a) shows the momentum path in the Brillouin zone. In order to show some high-energy spectra with weaker intensity more clearly, we show $S^{+-}(\mathbf{q},\omega)$ with different mapping to the color bar for the low- and high-intensity excitation spectra. Above the boundary value $U_0$ = 0.4 which is labeled by a black line on the color bar, a logarithmic mapping is used, $U$ = $U_0$ + log$_{10}$[$S^{+-}(\mathbf{q},\omega)$] - log$_{10}$[$U_0$] and $U$ = $S^{+-}(\mathbf{q},\omega)$ while below the boundary value. The Lorentz broadening factor we use for this figure is $\eta$ = 0.15. The dashed lines in (e)-(g) demonstrate the separation between the lower-energy and higher-energy excitations in the PVBS phase.} \label{fig:CPT-6p4} \end{figure*} To further characterize the different phases, we also show the static spin structure factor $S(\mathbf{q})$ and the dimer structure factor $D(\mathbf{q})$ at different couplings in Fig.~\ref{fig:SpinDimerCorr}. At both $J_3$ = 0.3 and 0.5, the static spin structure factors $S(\mathbf{q})$ show broad peaks around the $M$ point, which come from the short-range spin correlation inherited from the N\'eel order and become weaker with the increase of $J_3$. In the spiral phase, the wave vector ($Q$, $Q$) of the bragg peak should keep approaching to ($\pi$/2, $\pi$/2) with increasing $J_3$. As shown in Figs.~\ref{fig:SpinDimerCorr}(a3) and \ref{fig:SpinDimerCorr}(a4), although the 24$\times$8 cylinder may not have ($Q$, $Q$) in the momentum space, the broadened peaks near ($\pi$/2, $\pi$/2) are consistent with the spiral order on such a finite cluster. For the dimer structure factor $D(\mathbf{q})$ of the 36-site cluster obtained by ED, there are wide range of broad continua around the original and new Brillouin zone edge at $J_3$ = 0.3. On the other hand, $D(\mathbf{q})$ has sharp peaks at the $\Sigma$ momentum point of the new Brillouin zone at $J_3$ = 0.5, which agrees with the emergent VBS order. \subsection{Magnetic Excitation} \label{Sec:Excitation} In this subsection, we study the dynamical spin structure factor by using the CPT and ED methods. In Fig.~\ref{fig:CPT-6p4}, we show $S^{+-}(\mathbf{q},\omega)$ obtained by the CPT method along the high-symmetry path $\Gamma (0, 0) \rightarrow X (\pi, 0) \rightarrow M (\pi, \pi) \rightarrow \Gamma (0, 0)$ of the Brillouin zone [see the inset of Fig.~\ref{fig:CPT-6p4}(a)]. In the N\'eel phase, the spontaneous breaking of spin SU(2) symmetry contributes a gapless Goldstone mode at the $M$ point as shown in Figs.~\ref{fig:CPT-6p4}(a) and \ref{fig:CPT-6p4}(b). For $J_3$ = 0.0 in Fig.~\ref{fig:CPT-6p4}(a), our CPT data are consistent with the previous CPT results~\cite{ShLYu2018}. With growing $J_3$, the high-energy excitation at the $X$ point becomes weaker and splits into two branches. Meanwhile, the intensity of the excitation tail slightly enhances. As shown in Fig.~\ref{fig:TD_J3_X}(b), these features can also be observed in the ED results obtained on the 36-site cluster, although the ED results have the sharper peaks due to stronger finite-size effect and small Lorentz broadening factor $\eta$. With growing $J_3$, for example at $J_3$ = 0.2, there is another branch of the excitation around the $M$ point emerging at the energy scale $\omega \approx$ 2.0. Meanwhile, the excitation mode at around point ($\pi$/2, $\pi$/2) shifts to lower energy. For the N\'eel phase in the $J_1$--$J_2$ Heisenberg model, the gapless Goldstone mode remains at around the $M$ point~\cite{ShLYu2018}. With growing $J_2$, the excitation mode at around the $X$ point gradually reduces to lower energy without visible splitting and finally the whole spectrum turns into a broad continuum in the QSL phase~\cite{ShLYu2018}. In the QSL phase of the $J_1$--$J_3$ model, the strongest intensity still locates at around the $M$ point as shown in Figs.~\ref{fig:CPT-6p4}(c) and \ref{fig:CPT-6p4}(d). At $J_3$ = 0.3, the lower branch of excitations at the $X$ point becomes weaker and the corresponding excitation gap is smaller, compared with the spetra in the N\'eel phase. For the higher branch at the $X$ point, it turns into some broad continua with only slightly weakened spectral intensity. As shown in Fig.~\ref{fig:SpmTD-6p6}(a) and Fig.~\ref{fig:TD_J3_X}(b), these dispersive excitations can also be seen in the ED results for $\omega \gtrsim$ 2.25 and are formed by many weak excitation peaks. These continua may attribute to the deconfined spinons in the QSL phase. At $J_3$ = 0.35, a weak signal of a small gap is found in the low-energy spectrum and one can also see some weak continua in high energy around the $M$ point. However, by using ED as a solver for the CPT method, we calculate the clusters up to 24 sites, which may still hard to identify the gapped or gapless nature of the QSL phase. For the QSL phase in the $J_1$--$J_2$ Heisenberg model, the spectrum is characterized by a broad continuum~\cite{ShLYu2018}, while in the $J_1$--$J_3$ model, there are only some weak continua in the low-energy spectrum around the $X$ point when $J_3$ = 0.3 and 0.35. \begin{figure}[b] \centering \includegraphics[width=0.49\textwidth]{SpmTD-6p6.pdf} \caption{Dynamical spin structure factors $S^{+-}(\mathbf{q},\omega)$ at different $J_3$ calculated by ED. The results are shown in the similar way to Fig.~\ref{fig:CPT-6p4} and the boundary value $U_0$ = 0.4 is labeled by a black line on the color bar. The Lorentz broadening factor we use for this figure is $\eta$ = 0.05. The dotted lines indicate the momentum points contained in the momentum space of the 36-site cluster.} \label{fig:SpmTD-6p6} \end{figure} Figures~\ref{fig:CPT-6p4}(e)--\ref{fig:CPT-6p4}(g) show the dynamical spin structure factors $S^{+-}(\mathbf{q},\omega)$ obtained by CPT in the PVBS phase, which have the gapped spin-triplet excitation. Interestingly, it seems that there is another excitation with residual broad continua above $\omega \sim 1.5 J_1$, which is separated from the lower-energy excitation by a gap [see the dashed lines in Figs.~\ref{fig:CPT-6p4}(e)--\ref{fig:CPT-6p4}(g)]. Such a similar feature has also been observed in the quantum Monte Carlo results of the $2 \times 2$ checkerboard model~\cite{YXu2019}. And we also show our CPT results of the same model in Fig.~\ref{fig:App_Checkerboard} of Appendix~\ref{App:Checkerboard} to do the comparison. In that model, caused by the nonuniform interactions, the translational symmetry is already broken in the Hamiltonian and its ground state is in the plaquette phase when the ratio of the inter- to the intra-plaquette interaction is smaller than 0.548524(3)~\cite{XRan2019}. The plaquette state can adiabatically connect to a state which is formed by the direct product of the 4-site plaquettes. In the plaquette phase, the two excitations locating at the low and high energy are owing to two different kinds of triplet excitations originating from the 4-site plaquette which are shown in Fig.~\ref{fig:App_Plaquette}. In the $2 \times 2$ checkerboard model, without inter-plaquette interaction, these two kinds of excitations are localized. After adding a weak inter-plaquette interaction which can be seen as perturbation, the quasi-particle of the local excitations can move in the whole lattice and the lower-energy branch turns into a dispersive excitation. Compared with the lower-energy branch, the high-energy branch is more localized due to the much larger excitation gap and the effective interactions are very weak, which cause the high-energy branch is nearly flat. In the $J_1$--$J_3$ model, we can also ascribe the two excitations observed in Figs.~\ref{fig:CPT-6p4}(e)--\ref{fig:CPT-6p4}(g) to these two kinds of triplet excitations. Nevertheless, there are still some differences between the spectra of the two models. As shown in Fig.~\ref{fig:CPT-6p4}(e), the low-energy excitation at $J_3$ = 0.4 is a gapped triplon excitation around the $M$ point, which is very similar to the one in the $2 \times 2$ checkerboard model. But for $\omega \gtrsim 1.5 J_1$, the high-energy branch is a dispersive excitation with weaker intensity. In $J_1$--$J_3$ model, the PVBS phase is formed by spontaneously breaking the translational symmetry and the local excitations at high energy have higher mobility due to the uniform $J_1$ and $J_3$ interactions. And these lead to the differences between the spetra of two models. As shown in Fig.~\ref{fig:SpmTD-6p6}(c) and \ref{fig:SpmTD-6p6}(d), two triplet excitations can also be seen in the ED results, although the high-energy dispersion is not so clear due to the finite-size effect. Because the PVBS ground state is a singlet state with the translational wave vector at $\Gamma$ point and $S^{+-}(\mathbf{q},\omega)$ mainly captures the excitation with $\Delta S$ = 1, the low-energy excitations shown in Fig.~\ref{fig:SpmTD-6p6}(c) correspond to the triplet excitations, especially around the $M$ point in Fig.~\ref{fig:App_Energy_0p5}(b) of Appendix~\ref{App:EDSpectrum}. With growing $J_3$ in the PVBS phase, the excitation gap at the $M$ point is enlarged and the minimum gap of the whole Brillouin zone gradually transform from the $M$ point to another wave vector along the $M \rightarrow \Gamma$ path. As shown in Fig.~\ref{fig:CPT-6p4}(h), when the spiral order is established at $J_3$ = 0.7, a new gapless magnon mode develops around ($Q$, $Q$) which is located between the $M$ and $\Gamma$ point. And the small excitation gap of the ED result in Fig.~\ref{fig:SpmTD-6p6}(d) is caused by the finite-size effect. \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{TD_J3_X.pdf} \caption{Dynamical spin structure factors $S^{+-}(\mathbf{q},\omega)$ at the $X$ momentum point with different $J_3$, which are calculated by (a) CPT and (b) ED.} \label{fig:TD_J3_X} \end{figure} \section{Summary and Discussion} \label{Sec:Summary} By using the DMRG and ED methods, we calculate the order parameters and the low-lying energy and entanglement spectra of the spin-$1/2$ $J_1$--$J_3$ Heisenberg model on the square lattice. We obtain the phase diagram of this model and find a paramagnetic region ($0.3 \lesssim J_3/J_1 \lesssim 0.7$) sandwiched between the N\'eel and the spiral order phase. For $0.375 \lesssim J_3/J_1 \lesssim 0.7$, a PVBS phase is characterized by our numerical calculation, including the extrapolated results of the dimer order parameters $m_{\textrm{VBC}} \neq 0$ and $m_{\textrm{Col}} = 0$ as well as the vanished (finite) spin singlet gap (spin triplet gap) in the thermodynamic limit. For $0.3 \lesssim J_3/J_1 \lesssim 0.375$, we find absent N\'eel and dimer order, which agree with a QSL phase. Furthermore, we use the CPT and ED methods to study the dynamical spin structure factor $S^{+-}(\mathbf{q},\omega)$. While a Goldstone mode appears at the $M$ point in the N\'eel phase, a new gapless magnon mode developing around ($Q$, $Q$) is found in the spiral order phase, which approaches to ($\pi/2, \pi/2$) with growing $J_3$. In the QSL phase, some dispersive weak excitations around the $X$ and $M$ points are captured by our results. By comparing with the dynamical spin structure factor of the 2$\times$2 checkerboard model, the CPT method is able to capture most of the characteristics of the PVBS phase. Similar to the plaquette phase of the 2$\times$2 checkerboard model, except for the triplet excitation around the $M$ point at low energy, there are another triplet excitation surrounding with some continua at high energy. The difference between the excitation spectra of these two models may be owing to the spontaneously translational symmetry breaking of the PVBS phase and the uniform interactions in the $J_1$--$J_3$ Heisenberg model. In addition, except for the $J$--$Q_6$ model~\cite{Takahashi2020} and the $J_1$--$J_2$--$J_3$ Heisenberg model~\cite{Capriotti2000, Mambrini2006, SSGong2014, Murg2009, JFYu2012, Reuther2011, Daniel2021}, the four-fold degenerate PVBS phase for the square lattice have been rarely found in models without the explicit translational symmetry breaking in the Hamiltonian. The magnetic excitation of such a PVBS phase has also been rarely studied and our results will provide more theoretical understanding on that phase. \begin{acknowledgments} M.W. thanks Shun-Li Yu for helpful discussions and Caiyuan Ye for helping to improve the ED codes. This work is supported by NKRDPC-2017YFA0206203, NKRDPC-2018YFA0306001, NSFC-11804401, NSFC-11974432, NSFC-11832019, NSFC-11874078, NSFC-11834014, NSFC-92165204, GBABRF-2019A1515011337, Leading Talent Program of Guangdong Special Projects (201626003), Shenzhen International Quantum Academy (SIQA202102), and Guangzhou Basic and Applied Basic Research Foundation. \end{acknowledgments}
\section{Introduction} \input{figures/splash} Well-established computer vision tasks such as localization and segmentation are aimed at understanding the structure of images at a fine level of detail. The modern approach to these tasks, which consists of training deep neural networks in an end-to-end fashion, has shown strong performance given large quantities of human-labeled data. However, obtaining labeled data for these dense tasks can be difficult and expensive. Whereas vast quantities of (weak) image labels and descriptions may be obtained from the Internet \cite{radford2021learning,mahajan2018exploring,jia2021scaling}, dense image annotations cannot be easily sourced from it, and creating them manually is a labor-intensive process. Moreover, in many specialized fields such as medical imaging, where detection and segmentation tasks are particularly important, data labeling must be manually performed by a domain expert. As a result, performing dense vision tasks without labeled data is an important open problem. Numerous existing methods perform dense visual tasks with weak annotations, such as image-level labels, captions, spoken narratives, scribbles, and points \cite{khoreva_CVPR17,huang2018deep,chan2019comprehensive,ke2021spml}. However, fully-unsupervised dense image understanding remains challenging and under-explored. Current approaches involve clustering dense features (\eg, IIC~\cite{ji2018invariant}), contrastive learning with saliency masks (\eg, MaskContrast~\cite{vangansbeke2020unsupervised}), and GAN-based object discovery (\eg, ReDo~\cite{chen_unsupervised_2019}). Others segment images of a given object category into a number of semantic regions (parts)~\cite{hung2019scops,choudhury2021unsupervised,collins2018deep}. However, these approaches tend to struggle with complex images, and most of them can only identify a single object per image. In this paper, we take inspiration from image segmentation methods from the pre-deep learning era, which framed the segmentation problem as one of graph partitioning. Whereas existing unsupervised segmentation methods are based primarily on deep learning, we show the benefits of combining deep learning with traditional graph-theoretic methods. Our method first utilizes a self-supervised network to extract dense features corresponding to image patches. We then construct a weighted graph over patches, where edge weights give the semantic affinity of pairs of patches, and we consider the eigendecomposition of this graph’s Laplacian matrix. We find that without imposing any additional structure, the eigenvectors of the Laplacian of this graph directly correspond to semantically meaningful image regions. Notably, the eigenvector with the smallest nonzero eigenvalue generally corresponds to the most prominent object in the scene. We show that, surprisingly, simply extracting bounding boxes or masks from this eigenvector surpasses the current state of the art on unsupervised object localization/segmentation across numerous benchmarks. % Next, we propose a pipeline for semantic segmentation. We first convert the eigensegments into discrete image regions by thresholding and associate each region with a semantic feature vector from the network. We consider all image regions in a large dataset of images and jointly cluster these regions, yielding semantic (pseudo-)labels that are consistent across the dataset. Lastly, we perform self-training using these labels to refine our results, and we evaluate against the ground truth segmentations. Different from prior self-supervised semantic segmentation methods, our method performs well on complex images without fine-tuning. Importantly, while recent GAN-based and saliency-based methods are limited to finding a single semantic region per image, our method can segment multiple semantic regions and outperforms prior methods on PASCAL VOC 2012, re-surfacing spectral methods as a strong baseline for future work. Finally, we show that a slight variant of our method is well-suited to the task of soft image decomposition (\ie, image matting), or breaking down an (RGB) image into multiple (RGB-A) layers with soft boundaries. This decomposition dramatically simplifies real-world image editing and compositing tasks such as background replacement. \section{Related work}\label{s:related} In this section, we discuss the different fields related to our approach along with the relatively new tasks of unsupervised localization and segmentation. \paragraph{Self-Supervised Visual Representation Learning} The past five years have seen tremendous progress in self-supervised visual representation learning. Early research in this area was based on solving pretext tasks such as rotation, jigsaw puzzles, colorization, and inpainting \cite{doersch2015unsupervised,noroozi2016unsupervised,pathak2016context,oord2018representation,hnaff2019dataefficient,zhang2016colorful,zhang2017split,gidaris2018unsupervised}. Recent methods mostly consist of contrastive learning with heavy data augmentation~\cite{gutmann2010noise,oord2018representation,wu2018unsupervised,chen2020simple,kalantidis2020hard,he2019moco,chen2020improved,henaff19data-efficient,tian19contrastive,tian2020makes}. Others distinguish themselves by removing the dependency on negative examples~\cite{zbontar2021barlow,chen2021exploring,grill2020byol}, the use of clustering~\cite{caron2020unsupervised,li2021prototypical}, and most recently, the extension to transformer architectures~\cite{caron2021emerging,chen2021mocov3}. As these methods primarily focused on the downstream task of image classification, they were designed to produce a single global feature vector for each input image. Although numerous specialized methods have been proposed for dense contrastive learning \cite{xie2020propagate,wang2020DenseCL,pinheiro2020unsupervised}, they require fine-tuning for application on tasks such as detection or segmentation. Recently, however, the emergence of self-supervised vision transformers has made it possible to extract dense (patch-wise) feature vectors without the need for specialized dense contrastive learning methods. \paragraph{Vision Transformers} The past year in computer vision research has been marked by the emergence of the vision transformer (ViT) architecture, a variant of the transformer model popular in sequence modeling and NLP \cite{vaswani17attention}. Vision transformers reshape an image into a sequence of small patches and apply layers of self-attention before aggregating the result into an additional global token, usually denoted \texttt{[CLS]}. Numerous variants of the vision transformer have been proposed, such as Deit~\cite{touvron2020deit}, Token-to-Token ViT~\cite{yuan2021tokens}, DeepViT~\cite{zhou2021deepvit}, CrossViT~\cite{chen2021crossvit}, PiT~\cite{heo2021rethinking}, CaiT~\cite{touvron2021cait}, LeViT~\cite{graham2021levit}, CvT~\cite{wu2021cvt}, and Swin/Twins~\cite{liu2021swin,chu2021twins}. Nonetheless, the defining aspect of this class of models is the use of self-attention to process information throughout the network. Since self-attention involves self-comparisons of image patch features, it is natural to construct a semantic affinity matrix over patches, as we do in our approach. Numerous recent works \cite{chen2021mocov3,caron2021emerging,atito2021sit} have observed that vision transformers perform exceptionally well relative to convolutional architectures in the self-supervised setting. In particular, Caron \etal~\cite{caron2021emerging} train a self-supervised ViT using multi-crop training and a momentum encoder, and argue that it learns better-localized features than supervised ViTs or ResNets. They show that the self-attention layer of the last \texttt{[CLS]} token has heads that localize foreground objects in the scene. This is a baseline in our object localization experiments, upon which we improve substantially. \paragraph{Unsupervised Localization} Unsupervised localization refers to the task of finding the location of an object in the form of a bounding box. Most approaches to localization find objects by identifying co-occurring patterns across image collections \cite{cho2015unsupervised,vo2019unsupervised,vo2020toward}. However, due to inter-image comparisons, these approaches are generally slow, memory-intensive, and have trouble scaling to large datasets. Recently, some works have begun to eschew this paradigm by finding objects purely from the features of pretrained deep networks. \cite{collins2018deep} perform co-localization through deep feature factorization. \cite{zhang2020object} mines patterns from pretrained convolutional network features. Most recently, LOST~\cite{LOST} extracts localization information from the attention features of a self-supervised vision transformer. LOST uses the same features as we do in our approach, but extracts bounding boxes using seed selection and expansion based on the number of patch correlations. By contrast, our approach localizes objects through spectral bipartitioning, which is more principled and more performant than \cite{LOST}. \paragraph{Unsupervised Segmentation} Whereas a plethora of methods have tackled segmentation in semi- and weakly-supervised settings~\cite{khoreva_CVPR17,huang2018deep,chan2019comprehensive,ke2021spml}, the unsupervised setting remains a relatively nascent area of research. Current methods can broadly be characterized as either generative or discriminative. Generative methods use unlabeled images to train special-purpose image generators \cite{chen_unsupervised_2019,arandjelovic2019object,abdal2021labels4free}, or directly extract segmentations from pretrained generators \cite{voynov2021object,melas2021finding}; discriminative methods are primarily based on clustering and contrastive learning ~\cite{ji2018invariant,hwang2019segsort,zhang2020self,vangansbeke2020unsupervised}. MaskContrast~\cite{vangansbeke2020unsupervised}, the current state of the art in unsupervised semantic segmentation, uses saliency detection to find object segments (\ie, the foreground) and then learns pixel-wise embeddings via a contrastive objective. However, MaskContrast relies heavily on a saliency network which is initialized with a pretrained (fully-supervised) network. Moreover, it heavily relies on the assumption that all foreground pixels in a given image belong to the same object category, which fails to hold for most images containing multiple objects. \paragraph{Spectral Methods} Spectral graph theory emerged from the study of continuous operators on Riemannian manifolds~\cite{cheeger1969alower}. Subsequent works brought this line of research to the discrete setting of graphs, with numerous results connecting global properties of graphs to the eigenvalues and eigenvectors of their Laplacian matrices. % Two of these results are essential for understanding our work. First, \cite{fiedler1973algebraic} showed that the second-smallest eigenvalue of a graph, now called the algebraic connectivity or the Fiedler eigenvalue, quantifies the connectivity of a graph. In our work, we use the Fiedler eigenvector for object localization. Second, \cite{fiedler1973algebraic,donath1973lower} showed that the eigenvectors of graph Laplacians yield minimum-energy graph partitions. In our work, we use this idea to extract semantic segmentations from a patch-wise \emph{semantic} affinity matrix. Spectral graph methods were popularized within the machine learning and computer vision communities by \cite{shi2000normalized, ng01on-spectral}. Shi and Malik~\cite{shi2000normalized} framed image segmentation in the language of graph cuts, that is finding a partition of the graph (\ie the image) to minimize the similarity of the partitions. They noted that finding the minimum cut generally leads to smaller-than-desired partitions, so they normalized by the total weight of all edges connected to each partition. Ng \etal~\cite{ng01on-spectral} also performed spectral decomposition, and then stacked and clustered the eigenvectors along the eigenvector dimension in order to obtain a fixed number of partitions. Numerous follow-up works have extended these ideas to new settings such as co-segmentation \cite{wu2013unsupervised}. \section{Method}\label{s:method} Our method is rooted in ideas from spectral graph theory, the study of analyzing properties of graphs by looking at their spectra (\ie their eigenvalues). We begin with a general overview of spectral methods. \subsection{Background}\label{s:background} Let $G = (V, E)$ be a weighted undirected graph with adjacency matrix $W = \{ w(u, v) : (u, v) \in E \}$. The Laplacian matrix $L$ of this graph is given by $L = D - W$ or in the normalized case $L = D^{-1/2}(D - W)D^{-1/2}$, where $D$ is the diagonal matrix whose entries contain the row-wise sum of $W$. The Laplacian is particularly interesting because it corresponds to a quadratic form \[ x^T L x = \sum_{(u,v) \in E} w(u,v) \cdot (x(u) - x(v))^{2} \] for $x \in \mathbb{R}^{n}$ with $n = |V|$. Intuitively, this quadratic form measures the smoothness of a function $x$ defined on the graph $G$. If $x$ is smooth with respect to $G$, then $x(u)$ is similar to $x(v)$ whenever $u$ is similar to $v$ (where similarity is quantified by the weight $w(u,v)$). The eigenvectors and eigenvalues of $L$ are the central objects of study in spectral graph theory. The eigenvectors $y_{i}$ span an orthogonal basis for functions on $G$ that is, in the sense described above, the \textit{smoothest} possible orthogonal basis: \[ y_{i} = \text{argmin}_{\|x\|=1, x \perp y_{<i}} x^T L x \] with $y_0 = \mathbf{1} \in \mathbb{R}^{n}$. The eigenvalues $\lambda_{i}$, with $0=\lambda_{0} \leq \lambda_{1} \leq \dots \leq \lambda_{n-1}$, are the values of the right-hand side of the above expression (which is known as the Courant-Fischer theorem in the spectral graph theory community). Thus, it is natural to express functions on $G$ in the basis of the eigenvectors of the graph Laplacian. In the context of classical image segmentation, the nodes of $G$ correspond to the pixels of an image $I\!\in\!\mathbb{R}^{MN}$, and the edge weights $W\!\in\!\mathbb{R}^{MN \times MN}$ correspond to the affinities between pairs of pixels. The eigenvectors $y \in \mathbb{R}^{MN}$ can be thought of as soft image segments. Discrete graph partitions are often called graph cuts, where the value of cut with two partitions $A$ and $B$ ($A \cup B = V$, $A \cap B = \emptyset$) is given by \[ \operatorname{cut}(A, B) = \sum_{u \in A, v \in B} w(u, v) \] \ie, the total weight of edges that have been removed by partitioning. A normalized version of graph cuts \cite{shi00normalized} is particularly useful in practice, and emerges naturally from the eigenvectors of the normalized Laplacian; the optimal (continuous) bi-partitioning in this case reduces to finding the Laplacian eigenvectors. \paragraph{The choice of W} The most important aspect of spectral methods for image segmentation is the construction of the adjacency matrix $W$, which encodes the similarities of each pair of pixels. To take the spatial neighborhood and color information into account, some works (especially for image matting \cite{chen2013knn,lee2011nonlocal}) use a nearest neighbor formulation. KNN-matting converts an image to the HSV color space, and defines for each pixel a vector $\psi(u) = (\cos(c_H), \sin(c_H), c_S, c_V, p_x, p_y) \in \mathbb{R}^5$ containing both color information (the $c_H, c_S, c_V$ values) and spatial information (the $p_x, p_y$ values). They then construct a sparse affinity matrix from pixel-wise nearest neighbors based on $\psi$: \begin{equation} \label{eq:w_knn} W_\mathrm{knn}(u, v) = \begin{cases} 1 - \| \psi(u) - \psi(v) \|, & u \in \text{KNN}_{\psi}(v), \\ 0, & \text{otherwise}, \end{cases} \end{equation} where $u \in \text{KNN}_{\psi}(v)$ are the $k$-nearest neighbors of $v$ under the distance defined by $\psi$. This affinity matrix typically yields sharp object boundaries, but since it is designed for the image matting setting, in which a trimap is given, it does not take semantic information into account. While some recent works have explored the idea of semantic matting~\cite{sun2021sim,aksoy2018semanticsoft}, they tackle a different problem from us and are limited by their use of large labeled datasets. Our work combines the benefits of this classical spectral decomposition with the benefits of deep self-supervised features for the purpose of unsupervised object and scene understanding. \subsection{Semantic Spectral Decomposition} In this section we will describe our formulation of deep spectral decomposition and its direct application to the down-stream tasks of object localization and semantic segmentation. An overview is shown in \cref{fig:method_diagram}. Let $I \in \mathbb{R}^{3 \times M \times N}$ be an image. We will first decompose $I$ into semantically consistent regions using features of a neural network. These regions can then be processed into bounding boxes for object localization or clustered across a collection of images for semantic segmentation. We begin by extracting deep features $f = \phi(I) \in \mathbb{R}^{C \times M/P \times N/P}$ using a network $\phi$. As the feature maps of a network are usually computed at a lower resolution than the image, we introduce $P$ for this downsampling factor. In the case where $\phi$ is a transformer architecture, $P$ represents the patch size. These features may be extracted from any part of the network and can even be a combination of different layers, \ie, hyper-columns~\cite{hariharan2015hypercolumns}. In our experiments with transformers, we find, similarly to \cite{LOST}, that features from the keys of the last attention layer work especially well, as they are inherently meant for self-aggregation of similar features. We then construct an affinity matrix from the patchwise feature correlations. Additionally, we threshold the affinities at $0$, because the features are designed for aggregating similar features rather than anti-correlated features: \begin{equation} W_\mathrm{feat} = ff^{T} \odot (ff^{T} > 0)\in \mathbb{R}^{\frac{MN}{P^2} \times \frac{MN}{P^2}} \end{equation} These feature affinities contain rich semantic information at a coarse resolution. To gain back low-level details, we fuse them with traditional color-level information which can be seen as features from the 0-th layer of the network. To perform the fusion, we bilinearly upsample the features and downsample the image to an intermediate resolution $M'\times N'$. Empirically, we find that using $M' = M/8$ and $N' = N/8$ yields good low-level details while maintaining a fast runtime. As our color affinity matrix, we use the sparse KNN-matting matrix (\cref{eq:w_knn}), although any traditional similarity matrix can also be used. Our final affinity matrix is the weighed sum of the feature and color matrices: \begin{equation} W = W_\mathrm{feat} + \lambda_\mathrm{knn} W_\mathrm{knn} \end{equation} where $\lambda_\mathrm{knn}$ is a user-defined parameter that trades off semantic and color consistency. Given $W$, we take the eigenvectors of its Laplacian $L = D^{-1/2}(D - W)D^{-1/2}$ to decompose an image into soft segments: $\{y_0, \cdots, y_{n-1}\} = \mathrm{eigs}(L)$. Since the first eigenvector $y_0$, is a constant vector corresponding to $\lambda_0 = 0$, for our purposes we use only $y_{>0}$. In \cref{fig:eig_examples}, we show qualitative examples of our eigendecomposition. We find that the eigensegments correspond to semantically meaningful image regions and have well-delineated boundaries. As such, localization and segmentations tasks arise as natural immediate applications of this approach. Importantly, if the choice of $\phi$ is a model trained with self-supervision on unlabeled data, then it is possible to address these tasks without supervision and without the need for finetuning. \input{figures/eig_examples.tex} \subsection{Object Localization} Object localization is the task of identifying, in the form of a bounding box, the location of the primary object in an image. To localize the main object, we simply follow the standard spectral bisection approach. We examine the Fiedler eigenvector $y_1$ of $L$ and discretize it by taking its sign to obtain a binary segmentation of an image. We then take a bounding box around the smaller of the two regions, which is more likely to correspond to any foreground object rather than the background. \subsection{Object Segmentation} Object segmentation, also called foreground-background segmentation, is a binary segmentation task that is very closely related to object localization; it consists of densely segmenting the foreground object in an image. We approach this task in the same manner as object localization, by using the Fiedler eigenvector $y_1$ to first find a coarse object segmentation. However, rather than taking a bounding box around our coarse segment, we apply a simple pairwise CRF to increase the resolution of our segmentation from $M'\times N'$ to $M\times N$. \subsection{Semantic Segmentation} Semantic segmentation is the task of categorizing each pixel in an image with a label that is semantically consistent across an entire dataset. Ideally, we would approach this problem by constructing a Laplacian matrix $L$ of size $MNT \times MNT$ containing the pairwise affinities of all pixels in an entire dataset of size $T$, but this is computationally infeasible. As a result, we perform a three-step process in which we: (1) break each image into segments, (2) compute a feature vector for each segment, and (3) cluster these segments across a collection of images. For step (1), we discretize the first $m$ eigenvectors $\{y_1, \cdots, y_m\}$ of $L$ by clustering them across the eigenvector dimension using $K$-means clustering (for every image separately). Since we do not know a-priori the number of meaningful segments for an image, we find empirically that it is preferable to over-cluster the image into regions. For step (2), we take a crop around each segment, and compute its feature vector $f_{s}$ using our self-supervised transformer. For step (3), we cluster the set of all feature vectors $\{ f_{s} \}$ across all images using $K$-means clustering with $k$ clusters. The second clustering step assigns a label to each segment of each image; adjacent regions with the same label are merged together, effectively reducing the number of segments found per image as needed. At the end of this process, we arrive at a set of semantic image segmentations consistent across the entire dataset. Finally, we apply a self-training step to further improve segmentation quality. We train a standard segmentation model with a self-supervised backbone using the segmentations obtained above as pseudolabels. As shown in \cref{fig:seg_comparison}, this distillation process improves segmentation quality and inter-image consistency. \section{Experiments}\label{s:experiments} To evaluate the effectiveness of spectral methods for unsupervised tasks, we perform experiments on unsupervised object localization, object segmentation, semantic segmentation and image matting. We use DINO-ViT-Base~\cite{caron2021emerging} as our self-supervised transformer for feature extraction unless otherwise noted. Further implementation details are discussed in the supplementary material. \subsection{Object Localization} We compare our unsupervised object localization method to prior work on three benchmarks: PASCAL VOC 2007, PASCAL VOC 2012, and COCO-20k (a subset of 20k images from the MS-COCO dataset~\cite{lin2014microsoft}, introduced in \cite{vo2020toward}). We evaluate following the same procedure as \cite{Vo20rOSD,LOST}. As is standard practice, we evaluate on the \emph{trainval} sets of these datasets. Results are measured in terms of the Correct Localization (CorLoc) metric, which measures the percentage of images on which an object is correctly localized. Since the images typically contain multiple objects, a prediction bounding box is considered to have correctly identified an object if it has greater than 50\% intersection-over-union with \textit{any} ground truth bounding box. \input{tables/loc_comparison.tex} We give quantitative results in \Cref{table:loc_main_comparison}. Compared to older methods based on identifying co-occurances across image collections, our method delivers dramatically improved performance. Relative to the state-of-the-art, LOST~\cite{LOST}, which uses the same self-supervised features, our method still meaningfully outperforms across all datasets. In \cref{table:loc_ablation_model} we ablate the influence of the architecture on the localization performance and find that transformer-based models score significantly higher than ResNets, with larger models performing better. \cref{fig:loc_examples} shows qualitative examples of our method. In the supplementary material, we conduct a series of ablation studies to better understand our proposed method. Our ablations generally support the idea that the spatial attention mechanism in vision transformers results in the learning of well-localized intermediate features. Concretely, we find that the most effective features for our tasks are those extracted from the attention keys in the later blocks of vision transformers. \input{tables/loc_ablation_model.tex} \subsection{Object Segmentation} For single-object segmentation, we evaluate on four challenging benchmarks: CUB~\cite{wah11the-caltech-ucsd}, DUTS~\cite{wang2017learning}, DUT-OMRON~\cite{yang2013saliency}, and ECSSD~\cite{shi2015hierarchical}. We evaluate in the same manner as \cite{voynov2021object,melas2021finding}, using the standard mean intersection-over-union (mIoU) metric to measure performance. Quantitative results are shown in \cref{table:appendix_obj_seg}. Our approach generally outperforms highly-tuned methods based on layerwise GAN learning (\ie, PertGAN~\cite{bielski_emergence_2019}, ReDO~\cite{chen_unsupervised_2019}, OneGAN~\cite{benny_onegan_2020}), extracting segmentations from GANs (\ie \cite{voynov2021object,melas2021finding}), and dense contrastive training (\eg IIC~\cite{ji19invariant}). Qualitative results are shown in the supplement. \subsection{Semantic Segmentation} \input{tables/obj_seg_comparison.tex} \input{tables/seg_comparison.tex} We now consider the challenging setting of unsupervised semantic segmentation, which differs from object segmentation in that it involves identifying multiple semantic masks per image and associating these masks across images. We evaluate our approach on the PASCAL VOC 2012 dataset, which contains 21 semantic classes (20 classes and a background class). For the segmentation phase, we start by clustering the eigenvectors into 15 segments per image. We then compute a feature vector for each of these segments, and cluster these across the dataset using $K$-means with $k = 21$ clusters. For the self-training stage, we train a DeepLab~\cite{deeplab} model with a ResNet-50~\cite{resnet} backbone that is pre-trained with self-supervision using DINO. We freeze the first two layers of the ResNet backbone and train the rest using the AdamW~\cite{kingma14adam:} optimizer with learning rate of 0.005 for 3000 steps. We perform self-training on the training set with a standard cross-entropy loss. Finally, we evaluate the outputs of the final self-trained model on the validation set using mIoU. Since clustering results in pseudo-labeling of image segments, Hungarian matching~\cite{kuhn1955hungarian} is used to optimally match clusters to ground truth labels. In \cref{table:seg_comparison}, we compare to prior methods, including the state-of-the-art MaskContrast~\cite{vangansbeke2020unsupervised}. We note that MaskContrast uses saliency masks from Deep-USPS~\cite{nguyen_deepusps_2019}, which was pre-trained with supervision using labeled data (Cityscapes~\cite{cordts2016cityscapes}). For a fairer comparison, we also train a version of MaskContrast based on a DINO-pretrained model (MaskContrast-DINO-ViT-B). Additionally, we give results for directly clustering DINO-pretrained features masked with Deep-USPS saliency maps (Saliency-DINO-ViT-B), \ie, without the additional dense training; this alone almost reaches the performance of MaskContrast. Finally, we compare to two additional clustering-based baselines. The first baseline (Cluster-Patch) is to directly cluster the self-supervised image features for all patches across the entire dataset. That is, we extract $\frac{MN}{P^2} \cdot T$ features from all $T$ images and assign them to clusters via $K$-means with 21 clusters. The second baseline (Cluster-Seg) uses $K$-means (in feature space) for each image individually to obtain class-agnostic segments, then computes the average feature within each segment, and finally clusters segments over the entire dataset (by using $K$-means with $K=21$, as above). Qualitative results are shown in \cref{fig:seg_comparison}. Most notably, in contrast to \cite{vangansbeke2020unsupervised}, we are able to segment multiple different semantic regions in the same image. For example, in the third row of the figure, our method correctly segments an image containing both a dog and a cat, whereas MaskContrast is limited to a single label (cat) for both regions. \input{figures/seg_comparison.tex} \subsection{Image Matting} Finally, we show that with a slight modification, our method can be used for real-world image editing tasks. The only modification we make is that we perform the spectral clustering at full resolution rather than at a reduced intermediate resolution. We sparsify the feature affinity matrix $W_\mathrm{feat}$ by randomly subsampling $\frac{1}{16^2} \approx 0.4\%$ of its entries. Note that despite the sparsity of $W$, computing its eigenvalues at full $(MN \times MN)$ resolution is still too slow to be performed on an entire dataset,\footnote{Computing the eigenvectors of $W$ takes around 1 min on 100 CPUs, which corresponds to $\approx$ 10 days for all of PASCAL VOC 2012.} which is why we use a lower resolution for the other experiments. However, if we are only concerned with editing a small number of images, then computing at full resolution is perfectly feasible. In \cref{fig:matting_examples}, we show examples of our mattes, with and without the feature affinity term. We see that the mattes are significantly more useful for editing with our feature affinity term, as they better correspond to objects in the scene. These mattes can then be used as primitives for further computer graphics operations, such as foreground extraction, selective colorization, or background replacement. \input{figures/matting_examples.tex} \section{Conclusions}\label{s:conclusions} In this paper we introduced a method for unsupervised localization, segmentation and matting based on spectral graph theory and deep features. Despite the simple formulation, it achieves state-of-the-art unsupervised performance for these tasks. It is interesting to note that this performance is only achieved with features from transformer architectures and not with CNNs, which we attribute to the inherent functionality of self-attention in transformers that aligns well with dense localization tasks. While spectral graph theory has been relegated to a minor role in the age of deep learning, we find that the inductive biases on which it is built can be very useful in the unsupervised setting. \section{Implementation Details} \label{s:appendix} Here, we present full implementations details for reproducing our results. \paragraph{Spectral Decomposition} We operate on images at their full resolution. For the spectral decomposition step, we start by extracting the key features $f \in \mathbb{R}^{C \times M/P \times N/P}$ from the final layer of the vision transformer. We then normalize these features along the embedding dimension and compute the affinity matrix $W_\mathrm{feat}$. Next, we calculate color features $W_\mathrm{knn}$ by first downsampling the image to the intermediate resolution resolution $M' \times N'$ and then calculating the sparse KNN affinity matrix using the implementation from PyMatting~\cite{germer2020pymatting}. We use $M' = M/8$ and $N' = N/8$ for all experiments. Next we perform the fusion of color and feature information. If $P = 8$, then $\frac{MN}{P^2} = M' \cdot N'$, so the feature affinities above are already at the intermediate resolution. If $P = 16$, the feature affinities are upscaled $2 \times$ to size $M' \times N'$. The affinities are summed, weighted by $\lambda_\mathrm{knn}$ and the eigenvectors of the Laplacian $L$ are calculated using the Lanczos algorithm. We also need to address the fact that vision transformers only operates on images whose size is a multiple of the patch size $P$. Since we operate on images at their full resolution, which is not always a multiple of $P$, this presents a small complication. To resolve this, we simply crop images to the nearest multiple of $P$ by truncating the right and top edges. For object localization, this means that we do not predict bounding box coordinates in the cropped edge regions. For the segmentation task, we compute segmentations on the cropped image and then simply replicate the right and bottom edges until the segmentation matches the original image. Fortunately, since the patch size is quite small relative to the image resolution, this cropping is not a large issue for the vast majority of images. \paragraph{Object Localization} For the object segmentation task, we consider the smallest eigenvector $y_1 \in \mathbb{R}^{\frac{MN}{P^2}}$ of $L$ with nonzero eigenvalue. We reshape $y_1$ to size $\frac{M}{P} \times \frac{N}{P}$ and compute its largest fully-connected component. We then draw a bounding box $(x_1, y_1, x_2, y_2)$ around this component and multiply its coordinates by $P$ to obtain the bounding box in the scale of the original image. \paragraph{Unsupervised single-object segmentation} Single-object segmentation is a natural extension of our localization pipeline. As above, we first using the Fiedler eigenvector to find a coarse object segmentation. We then apply a pairwise CRF to increase the resolution of our segmentations back to the original image resolution $(M, N)$. For the CRF, we use the implementation from \cite{krahenbuhl11efficient} and leave all parameters on their default settings. \paragraph{Semantic Segmentation} For the semantic segmentation task, we consider the $n$ smallest eigenvectors $\{y_i: i < K\}$ of $L$, reshaped into a tensor of size $n \times \frac{M}{P} \times \frac{N}{P}$. All experiments use $n = 15$. We cluster these eigenvectors using $k$-means clustering with $k = 15$ to obtain a discrete (non-semantic) segmentation of size $\frac{M}{P} \times \frac{N}{P}$ for each image; this breaks the image into $k$ separate segments/regions. In each image, the largest segment is considered to be the background region. We then compute a feature vector for each of the $(k - 1) \times T$ non-background segments in our dataset of size $T$. This feature vector is computed by taking a bounding box around each segment, expanding this bounding box by $2$ patches, cropping this region of the image, and applying the self-supervised transformer to this cropped image. These segment features are clustered over the dataset via $K$-means clustering with $K=20$ (which is the number of non-background classes in PASCAL VOC). Finally, associating each segment in each image with its cluster produces (low-resolution) semantic segmentations. We carry out the above steps on the \texttt{train\_aug} set of PASCAL VOC. For the self-training stage, we begin by upscaling each (low-resolution) semantic segmentation obtained in the previous step to the original image resolution. We train a ResNet-50 with a pretrained DINO~\cite{caron2021emerging} backbone and a DeepLab~\cite{deeplab} head. We train for 2000 steps with the Adam~\cite{kingma14adam:} optimizer, learning rate $1\cdot10^{-4}$, batch size $144$, and random crops of size $224$. We decay the learning rate to zero linearly over the course of training. This setup was not extensively tuned and could likely be improved with a comprehensive hyperparameter sweep. Finally, we evaluate this model on the \texttt{val} set of PASCAL VOC. \paragraph{Computational Requirements} All experiments are performed on a single NVidia GPU with $16$GB of memory. The eigenvector computation is performed on the CPU and takes approximately $0.5$s for an image of size $512$px at intermediate resolution $H' = W' = H/8 = W/8 = 32$px. Training the semantic segmentation network from the pseudolabeled images takes approximately $2$ hours to finish $2000$ steps. These low computational requirements are one of the strengths of our method, and make it a sensible baseline for future work. \section{Additional Qualitative Examples} We show additional qualitative examples of our method, including the extracted eigenvectors (\cref{fig:more_examples_eig}) and results on single-object localization (\cref{fig:more_examples_loc}) and single-object segmentation (\cref{fig:more_examples_obj}). Finally, for the semantic segmentation task, we show the classes discovered by our approach. It is important to note that, since our approach is fully unsupervised and uses self-supervised features, eigensegment clusters do not necessarily align with the semantic categories annotated in the dataset (in this case, PASCAL VOC). In \cref{fig:more_examples_semantic_classes} we show the $K=21$ categories found in the DINO feature space by our method and observe that, while some align with the ground truth label set (e.g., bus, dog, airplane, train), others do not (e.g., cluster 2 seems to be `animal heads` instead of a species-specific cluster). \section{Additional Experiments and Ablations} In this section, we perform additional experiments and ablations in order to better understand the strengths and weaknesses of our method. \paragraph{Ablation: Color Information} To understand the importance of adding color information to the features we evaluate the performance for different values of $\lambda_\mathrm{knn}$ in \cref{table:loc_ablation_lambda_color}. When $\lambda_\mathrm{knn} = 0$, the normalized Laplacian matrix $L$ is composed purely of semantic information. When $\lambda_\mathrm{knn} \to \infty$, the normalized Laplacian matrix $L$ is composed purely of color information. Larger models and variants with smaller patches benefit less from additional color information as their features likely inherently contain more local image information. Using color features alone is ineffective. \paragraph{Ablation: Feature Type} In \cref{table:loc_ablation_feature}, we present results when features are extracted from different parts of a self-attention layer. Features from attention \emph{keys} perform best by a large margin, in line with the intuition that the key projection layer should align keys into a shared space for subsequent comparison with query vectors. \paragraph{Ablation: Feature Depth} In \cref{table:rebuttal_block_ablation}, we present results when features are extracted from different blocks of a ViT network. We find that features from later blocks perform better; they contain semantic information which is both spatially-localized and easy to extract with spectral methods. \paragraph{Ablation: Network Architecture} In \cref{table:rebuttal_arch_ablation}, we present results when features are extracted from three new architectures: ResNet-50, ConvNext~\cite{liu2022convnet}, and XCit~\cite{el-nouby2021xcit}. ConvNext is a purely-convolutional network pretrained (in a supervised manner) on ImageNet, and it may be thought of as an improved ResNet. XCiT is a transformer with cross-covariance attention (i.e. attention over features rather than spatial locations) pretrained using DINO. ConvNext substantially outperforms ResNet-50 under this setup, demonstrating a link between classification performance and unsupervised object localization performance. Nonetheless, both ConvNext and XCiT lag behind the strong performance of the standard ViT, suggesting that the well-localized nature of \textit{spatial self-attention} is one of the keys to the success of our deep spectral segmentation approach. \paragraph{Ablation: Semantic Segmentation Pipeline} In \cref{table:rebuttal_eig_semseg_ablation} and \cref{table:rebuttal_k_semseg_ablation}, we present ablation results for varying two aspects of our semantic segmentation pipeline: the number of eigenvectors used in the first stage, and the number of clusters $K$ used in the second stage. We see that our method is fairly robust to the number of eigenvectors used in the first stage, unless one uses a very small number of eigenvectors (i.e. fewer than three). For the number of clusters $K$, we first note that the value used in the main paper is not chosen empirically, but rather set to the number of classes (incl.\ background) in the PASCAL VOC dataset, as is common for evaluation purposes. In the ablation, for $K > 20$ (i.e. over-clustering), we compute the optimal matching between our predictions and the ground-truth classes. Thus, larger $K$ yields superior mIoU scores. \paragraph{Additional Experiment: Class-Agnostic Detection} In \cref{table:rebuttal_detection_ablation}, we give results for a slightly modified detection setting previously explored in \cite{LOST}. In this setting, denoted class-agnostic detection, we train a class-agnostic object detection model by using the bounding boxes obtained from our method as pseudo-labels. For fair comparison, we follow the same training and evaluation procedure as LOST, including all hyperparameters. We see that our method outperforms LOST despite not tuning any hyperparameters for this task. \input{tables/loc_ablation_feature.tex} \input{tables/loc_ablation_lambda.tex} \input{tables/loc_ablation_fromrebuttal.tex} \section{Discussion of Failure Cases} Here, we show examples of failure cases and discuss their potential causes, with the goal of fascilitating future research into unsupervised segmentation. \paragraph{Spectral Decomposition} Although the notion of a failure case for eigenvectors is not well-defined, we will characterize a failure case as one in which the vectors produced by our method do not match up with our human intuition about the major objects in the scene. We show examples in \cref{fig:eig_failure_cases}. These failure cases often occur when a very small object in the foreground lies in the plane of the image, for example in the last row of the figure. In these cases, the first eigensegment will usually segment this small region. Another failure case in PASCAL VOC occurs when images have borders or frames (these images are present due to the web-scraped nature of the dataset). In these cases, the model nearly always identifies the frame in its first eigenvector. \paragraph{Object Localization} We show examples of failure cases for the object localization task in \cref{fig:eig_failure_cases}. When our spectral segmentation method fails, it is usually the result of locating a group of semantically related objects (\eg a group of people) rather than a single entity (\eg an individual person). We note, however, that in many cases these instances are indeed separated by the latter eigenvalues (see Fig. 3 in the main paper); utilizing this information to separate object instances could be an interesting avenue for future research. \paragraph{Semantic Segmentation} We show examples of failure cases for the semantic segmentation task in \cref{fig:eig_failure_cases}. We see that the network sometimes fails to detect multiple distinct semantic regions in the same image. Qualitatively, we have observed that this failure mode is actually more common after self-training. In other words, self-training seems to improve performance overall by improving the quality of individual masks, but also seems to hurts the models' ability to segment multiple regions in the same image. There are also some failure cases in which our network should have sharper object boundaries, as is the case with most segmentation networks. \section{Additional Related Work} Here, we discuss relevant work that could not be included in the main paper due to space constraints. \paragraph{Unsupervised Segmentation} Current methods for unsupervised semantic segmentation can broadly be characterized as either generative or discriminative approaches. For single-object segmentation, generative methods currently rank as the most active research direction, with numerous works having been proposed in the last two years \cite{bielski_emergence_2019,chen_unsupervised_2019,xia2017wnet,kanezaki_unsupervised_2018,ji19invariant,benny_onegan_2020,voynov20big-gans,melas2021finding}. Most commonly, these methods work by generating images in a layerwise fashion and compositing the results. For example, ReDO~\cite{chen_unsupervised_2019} uses a GAN to re-draw new objects on top of existing objects/regions, and Copy-Paste GAN~\cite{arandjelovic2019object} copies part of one image onto the other. Labels4Free~\cite{abdal2021labels4free} trains a StyleGAN to generate images in a layer-wise fashion, from which a segmentation may easily be extracted. \cite{voynov20big-gans,melas2021finding} extract segmentations from pretrained generative models such as BigBiGAN. However, these generative approaches are severely limited in that they only perform foreground-background segmentation: they can only segment a \emph{single} object in each image, and most involve training new GANs. As a result, they are not well-suited to segmenting complex scenes nor to assigning semantic labels to objects. Another family of methods, most of which adopt a variational approach~\cite{KingmaW13}, focus on unsupervised scene decomposition, effectively segmenting multiple objects in an image~\cite{burgess2019monet, engelcke2019genesis,greff2019multiobject,locatello2020object,emami2021Efficient,lin2020space,crawford2019spatially,monnier2021unsupervised}. However, these methods cannot assign semantic categories to objects and struggle significantly on complex real-world data~\cite{greff2019multiobject,karazija2021clevrtex}. Discriminative approaches are primarily based on clustering and contrastive learning. Invariant Information Clustering (IIC)~\cite{ji2018invariant} predicts pixel-wise class assignments and maximizes the mutual information between different views of the same image. SegSort~\cite{hwang2019segsort} maximizes within-segment similarity and minimizes cross-segment similarity by sorting and clustering pixel embeddings. Hierarchical Grouping~\cite{zhang2020self} performs contour detection, recursively merges segments, and then performs contrastive learning. MaskContrast~\cite{vangansbeke2020unsupervised}, the current state of the art in unsupervised semantic segmentation, uses saliency detection to find object segments (\ie the foreground) and then learns pixel-wise embeddings via a contrastive objective. However, MaskContrast relies heavily on a saliency network which is initialized with a pretrained (fully-supervised) network. However, it relies on the assumption that all foreground pixels belong to the same object category, which is not necessarily the case. As a result, it is limited to predicting a single class per image without further finetuning. Finally, DFF~\cite{collins2018deep} uses pre-trained features and performs non-negative matrix factorization for co-segmentation. \section{Further Description of the Laplacian} In this section, we present a slightly extended description of the spectral graph theoretic methods that underly our paper. Consider a connected, undirected graph $G = (V,E)$ with edges $E$ and vertices $V$. We denote by $W = (w_{ij})$ the edge weights between vertices $i$ and $j$. In our case, $G$ corresponds to an image $I$, where the vertices $V$ are image patches and the edge weights $W$ are defined by the semantic affinities of patches. Let $f: V \to \mathbb{R}$ be a real-valued function defined on the vertices of $G$. Note that these functions are synonymous with vectors of length $V$, and are thus also synonymous with segmentation maps. We begin by asking the question: what does it mean for a function $f$ to be \textit{smooth} with respect to the graph $G$? Intuitively, $f$ is smooth when its value at a vertex is similar to its value at each of the vertex's neighbors. If we quantify this similarity using the sum of squared errors, we obtain: \begin{equation} \label{eq:graph_quadratic_form} \sum_{(i,j)\in E} (f(i) - f(j))^2 \end{equation} which is a symmetric quadratic form. This means that there exists a symmetric matrix $\lapg$ such that \[ x^T \lapg x = \sum_{(i,j)\in E} (x_i - x_j)^2 \] for $x \in \mathbb{R}^n$ with $n = |V|$. This matrix $\lapg$ is the called Laplacian of $G$. While there are many ways to define $\lapg$, we present this definition because we believe it gives the greatest insight into the success of our method. The standard way of defining $\lapg$ is by the formula $\lapg = D - W$, where $D_{ii} = \deg(i)$ is the diagonal matrix of row-wise sums of $W$. The quadratic form definition makes clear some of the fundamental properties of the Laplacian: $\lapg$ is symmetric and positive semi-definite, since $x^T \lapg x \ge 0$ for any $x$. Additionally, its the smallest eigenvalue is $0$, corresponding to a (non-zero) constant eigenfunction. To gain intuition for the Laplacian, we present a very simple example from the domain of physics, adapted from \cite{melaskyriazi2020mathematical}. Consider modeling a fluid which flows between a set of reservoirs (vertices) through pipes (edges) with different capacities. Physically, the fluid flow through an edge is proportional to the difference in pressure between its vertices, $x_i - x_j$. Since the total flow into each vertex equals the total flow out, the sum of the flows along a vertex $i$ is $0$: \begin{align*} 0 &= \sum_{j \in N(i) } x_j - \sum_{ j \in N(i)} x_i = \text{deg}(i) x_i - \sum_{j \in N(i)} x_j \\ &= ((D - W)x)_i = (\lapg x)_i \end{align*} This is known as the Laplace equation $\lapg x = 0$, and it is the simplest special case of Poisson's equation $\lapg x = h$. The Laplacian spectrum is the centerpiece of our method. As described in the main paper, the eigenfunctions of $\lapg$ are orthonormal and form a basis for the space of bounded functions on $G$. The Laplacian spectrum does not fully determine the underlying graph, but it nonetheless contains a plethora of information about its structure. Our paper leverages this information for a variety of unsupervised dense computer vision tasks. For further reading in spectral graph theory, we encourage the reader to look into the following resources: \cite{spielman2007spectral,chung1996lectures,spielman2012spectral,melaskyriazi2020mathematical}. \section{Broader Impact} It is important to discuss the broader impact of our work with respect to methodological and ethical considerations. From an ethical perspective, models trained on large-scale datasets\,---\,even the ones considered in our work which are trained without supervision\,---\,might reflect biases and stereotypes introduced during the image collection process~\cite{prabhu2020large,shankar2017no,steed2021image,stock2018convnets}. In addition, datasets such as ImageNet (used to train the models) and PASCAL VOC (used in our evaluations) contain images from the web (e.g., Flickr). This data is collected without consent and might also contain inappropriate content~\cite{prabhu2020large}, which raises ethical and legal issues. Our method discovers concepts existing in the data through the lens of self-supervised pre-training and, as such, it may be implicitly affected by underlying biases. For this reason, our method should only be used for research purposes and not in any critical or production applications. From a methodological perspective, our approach reflects the degree to which different object categories are encoded in the feature space of self-supervised learners. Since we do not fine-tune models on a specific dataset for a specific task (e.g., semantic segmentation), these predicted categories may differ from the pre-defined set of categories which are (somewhat arbitrarily) annotated in a given benchmark. For example, the categories found by the decomposition and clustering of DINO features, might not necessarily align with the ones annotated in PASCAL VOC; in fact, there is little reason why that should be besides some commonly occurring objects. Therefore, how to properly and fairly evaluate fully unsupervised algorithms remains an open question. \input{figures/appendix_more_examples} \clearpage \input{figures/eig_failure_cases} \input{figures/loc_failure_cases} \input{figures/seg_failure_cases} \clearpage \clearpage { \small \bibliographystyle{ieee_fullname} \section*{Acknowledgements}\label{s:acknowledgements} L.\ M.\ K.\ is supported by the Rhodes Trust. C.\ R.\ is supported by Innovate UK (project 71653) on behalf of UK Research and Innovation (UKRI) and by the Department of Engineering Science at Oxford. I.\ L.\ and A.\ V.\ are supported by the VisualAI EPSRC programme grant (EP/T028572/1).
\section{Introduction}\label{sec:introduction}} \else \section{Introduction} \label{sec:introduction} \fi \IEEEPARstart{L}{earning} predictive models in new domains that lack enough training data has arisen as a challenge in supervised learning. This forms a strong motivation for transferring knowledge from common domains (source) to unknown domains (target), often known as Domain Adaptation (DA) \cite{cao_partial_2018,Ghifary2017,Zhong2020}. DA requires less supervision since it often operates with few labeled samples in the target domain. A practical example would be utilizing labeled user-generated content in legal e-commerce platforms (e.g., Amazon, eBay) to recognize unseen content in a new market and improve product search and indexing \cite{li_supervised_2018}. The same scenario applies to dark web e-commerce platforms (e.g., Dream Market and Russian Silk Road) in cybersecurity applications.\\ DA is a branch of transfer learning (TL) addressing two major issues: distribution divergence and feature discrepancy \cite{li_heterogeneous_2018}. The former arises because source domain samples admit a different distribution than that of the target domain. The latter occurs when source and target samples are expressed in different feature spaces. Most studies focus on the first issue, in which data distributions of source and target are different while samples are in the same feature space. Also known as homogeneous domain adaptation, this approach is not sufficient to address real-world scenarios. Addressing both issues is significantly challenging and has emerged as a new field called Heterogeneous Domain Adaptation (HDA). In most HDA scenarios, labeled datasets are available from a known source, while the target domain suffers from a lack of labeled data (Figure \ref{fig_intro}) \cite{hoffman_cycada:_2018,li_deep_2018}. \begin{figure}[!t] \centering \setlength\abovecaptionskip{-0.2\baselineskip} \includegraphics[scale=0.5]{intro} \caption{Illustrating HDA with Distribution Divergence and Feature Discrepancy. Three product categories are represented by different features and distributions in the source and target domains.} \label{fig_intro} \end{figure} Most HDA methods use mathematical optimization (e.g., convex optimization) or linear methods (e.g., linear discriminant analysis) to find common underlying representations from source and target \cite{fang_discriminative_2018,li_heterogeneous_2018,yao_low-resolution_2019}. These representations could be less transferable for DA \cite{ren_factorized_2018}. Neural representations have shown promise in DA due to their ability to automatically extract transferable features \cite{long_transferable_2018}. Transferable features are intermediate representations that are domain invariant \cite{Ganin2016,tzeng_adversarial_2017} and, thus, instrumental to successful DA \cite{li_deep_2018}. Adversarial Neural Domain Adaptation (ANDA) is a promising direction to obtain domain-invariant representations \cite{tzeng_adversarial_2017}, which leverages a game theory-based learning scheme \cite{goodfellow_generative_2014} to obtain high-quality representations. As a subcategory of DA, existing ANDA methods often address homogeneous domain adaptation \cite{li_heterogeneous_2018}. However, heterogeneous sources of user-generated content are very common on e-commerce platforms (e.g., multilingual text or product images with different representations). We present a novel ANDA framework to extract transferable domain-invariant representations from heterogeneous domains. This framework extends ANDA to heterogeneous domains by employing an inverse problem-solving method known as dictionary learning to mitigate the feature discrepancy. It also alleviates the distribution divergence between source and target in an adversarial manner. Our proposed method significantly improves the performance of text classification and image recognition in e-commerce applications. \selectlanguage{english} \section{Related Work} DA is a special case of TL. The goal of TL is to use the knowledge obtained from a resource-rich domain or task (i.e., source) to help a task or domain with insufficient training data (i.e., target) \cite{Weiss2016}. The domain consists of feature space and data probability distribution \cite{Pan2010}. The task is a function that can be learned on a domain to map the data to a corresponding label space. In many practical cases, the source and target tasks are often the same, while the domains vary. Hence, the source domain model often needs to be adapted to the target domain. For instance, in cybersecurity applications, a task could be determining if a dark net market product is cybersecurity-related when the domains are English (source) and Russian (target) product descriptions in the dark web. DA aims to transfer the knowledge to perform the same task in different source and target domains \cite{bengio_representation_2013}. This requires reducing the distribution divergence and feature discrepancy in the source and target domains \cite{bengio_representation_2013,li_heterogeneous_2018}. Most DA methods only focus on alleviating the distribution divergence (i.e., homogeneous DA) \cite{long_transferable_2018,long_transfer_2013,pan_domain_2011,wang_flexible_2014}. Homogenous DA does not apply to heterogeneous domains where the data dimensions and features are different. In contrast, Heterogeneous DA (HDA) is intended to reduce both feature discrepancy and distribution divergence. \subsection{Heterogeneous Domain Adaptation (HDA)}\label{sec_hda} HDA aims to perform the adaptation when the source and target domains are in different feature spaces. HDA methods often map features in the source and target to a common space using mathematical objective function optimization or a linear projection from source to target domain \cite{fang_discriminative_2018,hsieh_recognizing_2016,li_heterogeneous_2018,yao_low-resolution_2019,herath_learning_2017,tsai_learning_2016,xiao_feature_2015,zhou_heterogeneous_2014,li_learning_2014,hoffman_efficient_2013}. These features tend to be less transferable than representations obtained from neural networks for domain adaptation \cite{chen_transfer_2016,wang_heterogeneous_2018}. A taxonomy of selected major HDA methods is provided in Table \ref{table_hda}. \begin{table*}[!t] \setlength\abovecaptionskip{-0.2\baselineskip} \setlength{\textfloatsep}{10pt plus 1.0pt minus 2.0pt} \centering \caption{A Taxonomy of Major HDA Methods} \label{table_hda} \begin{tabular}{|M{0.25\linewidth}|M{0.25\linewidth}|M{0.25\linewidth}|M{0.25\linewidth}|M{0.2\linewidth}|} \hline \textbf{Method} & \textbf{Method Category} & \textbf{Task} & \textbf{Testbed}\\ \hline Discriminative Joint Distribution Adaptation (DJDA) \cite{yao_low-resolution_2019} & Objective function optimization & Low-resolution image recognition & Face images \\ \hline HDA Network based on Autoencoder (HDANA) \cite{wang_heterogeneous_2018} & Stacked autoencoder & Image recognition & Newswire articles, product images \\ \hline Progressive Alignment (PA) \cite{li_heterogeneous_2018} & Objective function optimization & Multilingual text and image recognition & Newswire articles, product images \\ \hline Cross-Domain Mapping (CDM) \cite{fang_discriminative_2018} & Linear discriminant analysis & Multilingual text and image recognition & Newswire articles, product images\\ \hline Invariant Latent Space (ILS) \cite{herath_learning_2017} & Kernel matching and optimization & Image and face recognition & Product and face images \\ \hline Cross-Domain Landmark Selection (CDLS) \cite{tsai_learning_2016} & Objective function optimization & Image recognition & Product images \\ \hline Transfer Neural Trees (TNT) \cite{chen_transfer_2016} & Neural decision forest & Image recognition & Product images \\ \hline Generalized Joint Distribution Adaptation (G-JDA) \cite{hsieh_recognizing_2016} & Objective function optimization & Image recognition and multilingual text classification & Newswire articles, product images \\ \hline Supervised Kernel Matching (SSKM) \cite{xiao_feature_2015} & Kernel matching and optimization & Text and sentiment classification & Product reviews, newswire articles \\ \hline Sparse Heterogeneous Feature Representation (SHFR) \cite{zhou_heterogeneous_2014} & Objective function optimization & Text and sentiment classification & Newswire articles \\ \hline Semi-supervised Heterogeneous Feature Augmentation (SHFA) \cite{li_learning_2014} & Convex function optimization & Text and sentiment classification, Image recognition & Product reviews, newswire articles \\ \hline Max-Margin Domain Transforms (MMDT) \cite{hoffman_efficient_2013} & Objective function optimization & Image recognition & Product images \\ \hline \end{tabular} \end{table*} As seen in the taxonomy, most HDA approaches obtain feature representations based on mathematical optimization and linear mapping, and few studies utilize neural network-based representations to accomplish HDA. Most extant methods cast the HDA objective into an optimization problem aimed at mapping source and target to a common feature space without promoting domain invariance between source and target, resulting in limited improvement in the transferability of the source model to the target domain. Next, we review the effective methods to attain domain invariance and position our study within the body of the related work. \selectlanguage{english} \subsection{Adversarial Neural Domain Adaptation (ANDA)} One promising direction to achieve domain invariance in DA is to map source and target samples into a ‘common latent space,’ in which source and target representations of the same class are close to each other \cite{Chen2012,long_deep_2016}. Recently, adversarial learning has shown promise in providing domain-invariant representations without ‘pair alignment,’ eliminating the need for manually establishing sample correspondence in source and target \cite{hoffman_cycada:_2018,ren_factorized_2018}. Adversarial learning is a game-theoretic approach for simultaneously training two competing components, generator and discriminator \cite{Goodfellow2016}, which yields state-of-the-art performance in homogeneous DA \cite{long_transferable_2018}. When utilized in DA, the generator is trained to create representations that mimic both source and target distribution, and the discriminator is tasked to distinguish the source data from the target data created by the generator. ANDA generates adversarially learned domain-invariant representations from source and target that are suitable for domain adaptation \cite{tzeng_adversarial_2017}. These representations are useful in tasks such as text classification \cite{Ganin2016,liu_adversarial_2017,zhao_adversarial_2018}, character recognition \cite{hoffman_cycada:_2018,li_deep_2018,luo_label_2017,ren_factorized_2018,russo_source_2018}, or image classification \cite{liu_coupled_2016,long_transferable_2018,sankaranarayanan_generate_2018,zhang_domain-symmetric_2019,tzeng_adversarial_2017} on a variety of datasets such as English Amazon reviews, handwritten digits, and face images. However, existing ANDA methods mostly operate on sources and targets with homogeneous feature spaces and do not address heterogeneous domain adaptation. This restricts the applicability of DA in real-world applications where the source and target domains are both relevant to a task but do not share the same feature representation. \selectlanguage{english} \subsection{Research Positioning} While ANDA can address the transferability issue, most ANDA frameworks consider homogeneous feature spaces. Given the heterogeneity of user-generated content (e.g., multilingual text, diverse image representations), these issues undermine the applicability of DA to emerging applications such as e-commerece or cybersecurity. To highlight the position of our proposed method, we categorize major DA work in two dimensions (Table {\ref{table_positioning}}). The horizontal dimension differentiates DA methods supporting heterogeneous features. The vertical dimension distinguishes between DA methods that generate neural representations and the others. Among homogeneous studies, methods relying on mathematical optimization include Support and Model Shift (SMS) \cite{wang_flexible_2014}, Joint Distribution Adaptation (JDA) \cite{long_transfer_2013}, and Transfer Component Analysis (TCA) \cite{pan_domain_2011}. Recent homogeneous methods such as Symmetric Networks (SymNets) \cite{zhang_domain-symmetric_2019}, Domain Adaptation Network (DAN) \cite{long_transferable_2018}, Symmetric Bi-directional ADAptive GAN (SBADA-GAN) \cite{russo_source_2018}, Auxiliary Classifier GAN (AC-GAN) \cite{sankaranarayanan_generate_2018}, Adversarial Discriminative Domain Adaptation (ADDA), and Cycle Consistent Adversarial Domain Adaptation (CYCADA) \cite{hoffman_cycada:_2018} support neural representations (the bottom left quadrant). Heterogeneous methods (the top right and bottom right quadrants) were recognized in Section {\ref{sec_hda}}. Little has been done to provide a solution that yields neural representations from heterogeneous domains (the bottom right quadrant). \begin{table}[!b] \setlength\abovecaptionskip{-0.2\baselineskip} \renewcommand{\arraystretch}{1.3} \caption{Positioning Our Proposed Method in DA Research} \label{table_positioning} \centering \begin{tabular}{|M{0.2\linewidth}|M{0.35\linewidth}|M{0.28\linewidth}|} \hline & \textbf{Homogeneous} & \textbf{Heterogeneous}\\ \hline \textbf{Mathematical Optimization} & SMS \cite{wang_flexible_2014}, JDA \cite{long_transfer_2013}, TCA \cite{pan_domain_2011} & PA \cite{li_heterogeneous_2018}, CDM \cite{fang_discriminative_2018}, G-JDA \cite{hsieh_recognizing_2016}, CDLS \cite{tsai_learning_2016}, SHFA \cite{li_learning_2014}, MMDT \cite{hoffman_efficient_2013}\\ \hline \textbf{Neural Representation} & SymNets \cite{zhang_domain-symmetric_2019}, DAN \cite{long_transferable_2018}, CYCADA \cite{hoffman_cycada:_2018}, AC-GAN \cite{sankaranarayanan_generate_2018}, SBADA-GAN \cite{russo_source_2018}, ADDA \cite{tzeng_adversarial_2017}& HDANA \cite{wang_heterogeneous_2018}, TNT \cite{chen_transfer_2016}, Our proposed model \\ \hline \end{tabular} \end{table} Two extant neural representation-based HDA methods are recognized as alternatives for our proposed model: Transfer Neural Trees (TNT) \cite{chen_transfer_2016} and Heterogeneous Domain Adaptation Network based on Autoencoder (HDANA) \cite{wang_heterogeneous_2018}. TNT is a tree-based neural network architecture focused on conducting HDA via obtaining corresponding pairs in source and target domains and does not offer distribution alignment. HDANA is a deep autoencoder architecture addressing the distribution alignment with a fixed distribution divergence kernel, which may result in lack of domain invariance. Both these issues can lead to performance loss. To remedy these issues, our model introduces a novel HDA framework that enables both feature and distribution alignment in a unified neural network architecture with enhanced domain invariance. It utilizes dictionary learning and nonparametric adversarial kernel matching to achieve these goals without relying on a fixed kernel for distribution matching. Our model contributes to obtaining high-quality representations from heterogeneous domains, which are useful in downstream tasks such as multilingual text classification and image recognition. \selectlanguage{english} \section{Background for Proposed Model} \selectlanguage{english} \subsection{Model Preliminaries} Let $\mathcal{D}^s=\{ \mathcal{X}^s,P(X^s,y^s)\}$ and $\mathcal{D}^t =\{ \mathcal{X}^t,Q(X^t,y^t)\}$ denote the source and target domains, each comprises feature spaces $\mathcal{X}^s$ and $\mathcal{X}^t$ and distributions $P$, $Q$ over the source and target samples, respectively. The source data $X^s=\{x_i^s,y_i^s\}_{i=1}^{n_s}$ includes labeled data sampled from distribution $P$. The target data $X^t=\{x_i^t\}_{i=1}^{n_t}$ is sampled from distribution $Q$ and contains both labeled data $\{(x_i^L,y_i^L)\}^{n_L}_{i=1} \sim {Q}$ and unlabeled data $\{(x_i^U)\}^{n_U}_{i=1} \sim {Q}$. HDA aims to help a classification task in the target domain by using the source domain data when not only is $P\ne{Q}$, but $\mathcal{X}^s\ne{\mathcal{X}^t}$. To achieve this, we present a neural network architecture to approximate a hypothesis $h(x)$ that not only minimizes the discrepancy between \(X^s\) and \(X^t\) as well as the divergence between distributions $P$ and $Q$, but also minimizes the error of assigning target labels $\epsilon_t(h(x))$, using source domain data and only a small number of labeled target data. DA models need to be generalizable to unseen domains in order to reduce the target generalization error $\epsilon_t(h)$ \cite{long_transferable_2018}. Accordingly, we draw on the domain adaptation theory to identify the generalization error bound of the target \cite{ben-david_theory_2010,ben-david_analysis_2007} and inform the components of our proposed model. For any hypothesis space $\mathcal{H}$ and a fixed representation function the expected target error is bounded by Theorem 1.\\ \textbf{Theorem 1 \cite{ben-david_analysis_2007}:} Let ${X}^s$ and ${X}^t$ represent samples drawn from $P$ and $Q$, the source and target domain distributions, respectively. For any $\delta\in(0, 1)$, with probability at least $1-\delta$ (over the choice of the samples), for every hypothesis $h\in\mathcal{H}$: \begin{equation} \epsilon_t (h) \leq {\hat{\epsilon}}_s(h) + \hat{d}_\mathcal{H} ({X}^s,{X}^t )+\epsilon_s (h^*)+\epsilon_t (h^*)+C \label{eq_1} \end{equation} where ${\hat{\epsilon}}_s (h)$ is the empirical source training error, $\epsilon_s (h^* )+\epsilon_t (h^* )$ is the combined error of the ideal hypothesis in both domains, and $C$ is a constant given in (\ref{eq_c}): \begin{equation} \begin{aligned} C = \frac{4}{m}\sqrt{d\log\left(\frac{2em}{d}\right)+\log\left(\frac{4}{\delta}\right)} + 4\sqrt{\frac{d\log(2m')+log(\frac{4}{\delta})}{m'}} \label{eq_c} \end{aligned} \end{equation} where $e$ is the base for the natural logarithm, $d$ is the VC-dimension of the hypothesis space, $m$ denotes labeled sample size in source, and $m'$ is the unlabeled sample size. As seen in (\ref{eq_c}), $C$ only depends on the properties of the hypothesis space (i.e., VC-dimension and sample sizes), rather than the choice of samples. Assuming that the combined error of the ideal hypothesis $\epsilon_s (h^* )+\epsilon_t (h^* )$ is small for a reasonable representation, the bound in Theorem 1 depends on the first and second terms in the RHS of (\ref{eq_1}). It is expected that an effective DA model reduces these two terms and, thus, the target generalization error $\epsilon_t (h)$. The first error term ${\hat{\epsilon}}_s (h)$ can be reduced by learning shared representations from source and target \cite{ben-david_analysis_2007}, which requires aligning feature representations when the domains are heterogeneous. The second term denotes the empirical $\mathcal{H}$-divergence between the source and target distributions \cite{ben-david_theory_2010}: \begin{equation} \begin{aligned} \hat{d}_\mathcal{H}({X}^s,{X}^t )\triangleq 2(1-\underset{ {h\in{\mathcal{H}}} }{\text{min}} \{\frac{1}{m'}\sum_{{x}:h({x})=0}\mathbbm{1}[{x}\in{{X}^s} ]\\ +\frac{1}{m'}\sum_{{x}:h({x})=1}\mathbbm{1}[{x}\in{{X}^t} ] \}) \end{aligned} \label{eq_2} \end{equation} where $\mathbbm{1}$ is an indicator function that returns 1 when its argument is true and 0 otherwise. Long et al. \cite{long_transferable_2018} show that the minimization term in (\ref{eq_2}) is bounded by the Maximum Mean Discrepancy (MMD) distance under kernel $k$ \cite{smola_hilbert_2007}. Thus, (\ref{eq_1}) can be re-written as: \begin{equation} \begin{aligned} \epsilon_t (h)\leq{\hat{\epsilon}}_s (h)+2(1+D_k (X^s,X^t ))+\lambda+C \end{aligned} \label{eq_3} \end{equation} where $D_k (.)$ denotes the MMD distance in a Reproducing Kernel Hilbert Space (RKHS) with kernel $k$ \cite{smola_hilbert_2007}. The second term in (\ref{eq_3}) can be reduced by distribution kernel matching, aiming to minimize the distance of the source and target distribution. To minimize these two terms, next we discuss dictionary learning as a promising approach to reduce ${\hat{\epsilon}}_s(h)$, which addresses feature discrepancy by translating source and target features to a common space. Subsequently, to reduce the $\mathcal{H}$-divergence between the source and target, we discuss distribution kernel matching and adversarial kernel learning. \selectlanguage{english} \subsection{Dictionary Learning: Reducing $\bm{{\hat{\epsilon}}_s(h)}$ } A viable approach to align representations can be devised based on dictionary learning \cite{li_heterogeneous_2018}. Dictionary learning is an inverse problem that aims to decompose a given data matrix $X$ into a dictionary space $D$ and a coefficient matrix $R$, which denotes the representation of $X$ under $D$, by optimizing (\ref{eq_4}): \begin{equation} \begin{aligned} \underset{D,R}{\text{min}}\left\| X-DR\right\|_F^2 + \lambda\left\|R\right\|_1;\\ \text{s.t.} \left\|d_i\right\|_2\leq 1; \forall i \in 1,\ldots,k \end{aligned} \label{eq_4} \end{equation} where $F$ denotes the Frobenius norm measuring reconstruction error and $d_i$ is the $i^th$ column in $D$. Unlike other matrix factorization methods dictionary learning can promote sparsity in the coefficient matrix, resulting in extracting only salient features from the input. Dictionary learning has been successfully applied to signal \cite{garcia-cardona_convolutional_2018} and image \cite{li_heterogeneous_2018} processing, contributing to reducing the dimensionality of the input data while preserving the salient features. Sharing the dictionary $D$ between the source ($X^s$) and the target domain ($X^t$) forces the new representations to be projected to ] space \cite{li_heterogeneous_2018}. \begin{equation} \begin{aligned} &\underset{D,R^s,R^t}{\text{min}}\left\| X^s-DR^s\right\|_F^2 + \left\| X^t-DR^t\right\|_F^2 + \lambda\left\|R\right\|_1\\ &\text{s.t.} \left\|d_i\right\|_2\leq 1; \quad R=[R^s,R^t] \end{aligned} \label{eq_5} \end{equation} While this is useful in DA for aligning features, traditional dictionary learning ignores label information since it is not naturally designed for classification tasks often encountered in e-commerce applications. We are motivated to incorporate the dictionary learning objective function in a neural network architecture that can jointly learn a classification task such that it is possible to take advantage of labeled data in both the source and target domains. \selectlanguage{english} \subsection{Distribution Kernel Matching and Adversarial Kernel Learning: Reducing $\bm{\hat{d}_\mathcal{H}({X}^s,{X}^t )$}} DA requires measuring the distribution divergence between source and target. This could be successfully achieved by defining a two-sample test statistic on source and target \cite{li_mmd_2017}. Two types of test statistics for DA are parametric and nonparametric. Parametric statistics measure the similarity of the density functions in source and target (e.g., Kullback-Leibler divergence) \cite{glorot_domain_2011,titov_domain_2011}. Nonparametric statistics measure the distance of kernels rather than the actual densities. This requires the distributions to be treated as functions in RKHS \cite{smola_hilbert_2007}. Nonparametric distribution kernel matching methods are often preferred for DA since they circumvent intractable density estimation \cite{long_transferable_2018}. Among nonparametric kernel matching methods, Maximum Mean Discrepancy (MMD) is the most widely used for DA \cite{chen_domain_2018,wang_heterogeneous_2018}. MMD measures the divergence based on the distance ${\rm D}$ between source and target domain data $X^s\sim{P}$ and $X^t\sim{Q}$. \begin{equation} \begin{aligned} {\rm D}_k(X^s,X^t) \triangleq \left\| \mathbb{E}_{x^s}[\phi_{k}(x^s)] - \mathbb{E}_{x^t}[\phi_{k}(x^t)] \right\|_{\mathcal{H}_k}^2 \end{aligned} \label{eq_6} \end{equation} where $\phi_k (.)$ is a feature mapping from inputs to an embedding in the Hilbert space $\mathcal{H}_k$ characterized by kernel $k$. MMD’s test power is extremely sensitive to the choice of mapping $\phi_k$ \cite{gretton_kernel_2012,sriperumbudur_kernel_2009}, which could negatively affect the distribution alignment performance. Adversarial kernel learning can address this issue by facilitating finding the proper kernel that maximizes the test power of MMD \cite{li_mmd_2017}. Such a kernel helps align the distributions in source and target without establishing sample correspondence. To this end, the mapping $\phi$ in MMD can be optimized via adversarial kernel learning \cite{li_mmd_2017}. However, extant adversarial kernel learning methods are not designed for heterogeneous domains. Inspired by the recent advances, we employ adversarial kernel learning for HDA. This enables benefiting from the nonparametric property of MMD while improving the test power via adversarial learning. \selectlanguage{english} \section{Proposed Model: Heterogenous Adversarial Neural Domain Adaptation (HANDA)} Informed by the effect of ${\hat{\epsilon}}_s(h)$ and $\hat{d}_\mathcal{H}(\tilde{X}^s,\tilde{X}^t )$ on reducing $\epsilon_t (h)$, we incorporate dictionary learning and adversarial kernel matching in a unified architecture that reduces the generalization error bound on any given domain adaptation problem. Accordingly, our proposed model integrates three components, each targeting an adaptation challenge in HDA. Figure \ref{fig_model} shows the integration of these three components in our model, Heterogeneous Adversarial Neural Domain Adaptation (HANDA). The first component is a shared dictionary learning (SDL) approach that targets alleviating feature discrepancy via projecting heterogeneous features into a common latent space and is associated with minimizing a reconstruction loss $\mathcal{L}_{SDL}$. The second component is a nonparametric adversarial kernel matching method, which aims to reduce the distribution divergence by combining the nonparametric benefits of MMD and flexibility of kernel choices in adversarial learning. This component is associated with minimizing an adversarial loss denoted by $\mathcal{L}_{Adv}$. Finally, the third HANDA’s component is a shared classifier in source and target that targets limited labeled data in the target domain by exploiting labeled samples in both the source and target domain. This component yields the classifier $h(x)$ as the ultimate goal of HDA and is associated with minimizing the classification loss $\mathcal{L}_C$. \begin{figure*}[!ht] \centering \setlength\abovecaptionskip{-0.2\baselineskip} \includegraphics[scale=0.6]{HANDA_Final_2} \caption{HANDA Architecture. The Shared Dictionary Learning (left) and Nonparametric Adversarial Kernel Matching (middle) components operate on the heterogeneous representations of source and target domain to reduce feature discrepancy via minimizing $\mathcal{L}_{SDL}$ and to reduce distribution divergence via minimizing $\mathcal{L}_{Adv}$, simultaneously. The Shared Classifier (right) component operates on the resultant representations via minimizing the shared classification loss $\mathcal{L}_{C}$.} \label{fig_model} \end{figure*} While shared dictionary learning aligns heterogeneous features in a common latent space and yields a new embedding, nonparametric adversarial kernel matching reduces the distribution divergence in the obtained embedding. After feature and distribution alignment, a shared classifier conducts the downstream tasks (e.g., text or image classification). HANDA’s novelty is threefold. First, it extends ANDA to heterogeneous domains. Second, it enhances dictionary learning to take advantage of labeled data in the source and target, and third, it enables joint feature and distribution alignment in a unified neural network architecture. We describe each HANDA component next. \subsection{Component \#1: Shared Dictionary Learning (SDL)} To minimize feature discrepancy, the source and target need to be mapped into the same subspace by domain-specific projections $P^s$ and $P^t$. This can be achieved by modifying (\ref{eq_5}) to get: \begin{equation} \begin{aligned} \underset{P^s,P^t,D,R^s,R^t}{\text{min}} \left\| P^sX^s-DR^s\right\|_F^2 + &\left\| P^tX^t-DR^t\right\|_F^2 \\ + \lambda\left\|R\right\|_1;\\ \text{s.t.} \left\|d_i\right\|_2\leq 1; \quad R=[R^s,R^t] \end{aligned} \label{eq_7} \end{equation} where $P_{k \times m_s}^s$ and $P_{k \times m_t}^t$ are projections. $X_{m_s \times n_s}^s$ and $X_{m_t \times n_t}^t$ are the source and target data. $D_{k \times k}$ is the shared dictionary, and $R_{k \times n_s}^s$ and $R_{k \times n_t}^t$ denote the aligned representations. To avoid degenerate solutions, $P^s$ and $P^t$ are often constrained to be orthogonal \cite{shekhar_generalized_2013}. The minimization in (7) yields data representations $R^s$ and $R^t$ that are in the same feature space. \subsection{Component \#2: Nonparametric Adversarial Kernel Matching} Even though the obtained representations $R^s$ and $R^t$ are in the same space, their distributions are different. Thus, minimizing distribution divergence is crucial for successful DA. MMD measures the distribution divergence of source and target via a ‘two-sample test,’ in which the source and target distributions are the same under the null hypothesis. The distribution divergence can be minimized by learning a model $\phi_\theta (.)$ parameterized by $\theta$ that minimizes the MMD distance: \begin{equation} \begin{aligned} \underset{\theta}{\text{min}} \quad {\rm D}_k(\phi_k(\phi_\theta(R^s)), \phi_k(\phi_\theta(R^t)))\\ \end{aligned} \label{eq_8} \end{equation} where ${\rm D}_k (.)$ is the MMD distance with a mapping function of some kernel $k$. The explicit computation can be avoided by applying the kernel trick $k(x,x' )= \langle\phi(x),\phi(x')\rangle_\mathcal{H}$ \cite{gretton_kernel_2012}, which gives: \begin{equation} \begin{aligned} {\rm D}_k(X^s,X^t) \triangleq \mathbb{E}_{x^s,x'^s}[k(x^s,x'^s)]&-2\mathbb{E}_{x^s,x^t}[k(x^s,x^t)]\\ & + \mathbb{E}_{x^t,x'^t}[k(x^t,x'^t)] \end{aligned} \label{eq_9} \end{equation} The test power of $D_k (.)$ in (9) heavily relies on the choice of the kernel $k$ \cite{li_mmd_2017}. Low test power can preclude correctly distinguishing unlike source and target domains. To increase the test power in DA, it is natural to search for the kernel that maximizes the distance between source and target. Thus, (\ref{eq_8}) can be re-written as: \begin{equation} \begin{aligned} \underset{\theta}{\text{min}} \quad \underset{k}{\text{max}} \quad {\rm D}_k(\phi_k(\phi_\theta(R^s)), \phi_k(\phi_\theta(R^t)))\\ \end{aligned} \label{eq_10} \end{equation} To cover a wide range of kernels (as opposed to a fixed one), we parameterize the kernel using neural network $M$ and search for the optimal kernel by learning the network parameters: \begin{equation} \begin{aligned} \underset{\theta}{\text{min}} \quad \underset{\theta_M}{\text{max}} \quad {\rm D}_{\theta_M}(\phi_{\theta_M}(\phi_\theta(R^s)), \phi_{\theta_M}(\phi_\theta(R^t)))\\ \end{aligned} \label{eq_11} \end{equation} Inspired by the idea of adversarial kernel learning \cite{li_mmd_2017}, we suggest minimizing (\ref{eq_11}) via another neural network $N$ in a GAN-like fashion \cite{goodfellow_generative_2014}. These two neural networks can be trained in an adversarial manner to solve the minimax problem in (\ref{eq_12}). \begin{equation} \begin{aligned} \underset{\theta_N}{\text{min}} \quad \underset{\theta_M}{\text{max}} \quad {\rm D}_{\theta_M}(\phi_{\theta_M}(\phi_{\theta_N}(R^s)), \phi_{\theta_M}(\phi_{\theta_N}(R^t)))\\ \end{aligned} \label{eq_12} \end{equation} Figure \ref{fig_minimax} illustrates the abstract view of the adversarial game defined in (\ref{eq_12}). Transformed features obtained from dictionary learning in the source and target domains participate in an adversarial setup in which they are aligned via network $N$ to minimize the MMD distance between the domains, while network $M$ aims to maximize MMD, searching for the kernel with maximal test power. \subsection{Component \#3: Shared Classifier for Source and Target} With the aligned features and distributions, a shared neural network $h_C$ can be applied to output the class probability of each sample in the source and target, respectively. Given the suitability of hinge loss \cite{cai_multi-class_2011} in multi-class problems, the source and target classification losses are defined as $\mathcal{L}_s=L(h_C (\phi_{\theta_N} (R^s )),Y^s)$ and $\mathcal{L}_t=L(h_C (\phi_{\theta_N} (R^t )),Y^t)$, where $L(.)$ denotes the multi-class hinge loss. We obtain the objective function for the shared classification hypothesis $h_C$ by minimizing a convex combination of $L_s$ and $L_t$ \cite{ben-david_theory_2010,long_transferable_2018}, as given in (\ref{eq_13}): \begin{equation} \begin{aligned} \underset{\theta_C}{\text{min}} \quad \frac{1}{2}(L(h_C (\phi_{\theta_N} (R^s )),Y^s)+L(h_C (\phi_{\theta_N} (R^t )),Y^t))\\ \end{aligned} \label{eq_13} \end{equation} Finally, the total objective function of HANDA is obtained by aggregating the three losses in an adversarial manner: shared dictionary loss $(\mathcal{L}_{SDL})$ obtained from (\ref{eq_7}), MMD distance loss calculated via adversarial kernel matching $(\mathcal{L}_{Adv})$ from (\ref{eq_12}), and combined classification losses in source and target $(\mathcal{L}_C)$ from (\ref{eq_13}). Thus, the total objective function for our proposed method is given by (\ref{eq_14}): \begin{equation} \begin{aligned} \underset{\theta_N,\theta_C,\Theta_{SDL}}{\text{min}} \quad \underset{\theta_M}{\text{max}} \quad \beta\mathcal{L}_{SDL}+ \gamma\mathcal{L}_{Adv} + \mathcal{L}_C\\ \end{aligned} \label{eq_14} \end{equation} where $\Theta_{SDL} =\{P^s,P^t,D, R^s,R^t\}$ is the set of parameters for dictionary learning. $\theta_N$ and $\theta_M$ denote the parameters of adversarial networks for kernel matching, and $\theta_C$ is the classifier network’s parameters. $\beta$ and $\gamma$ are the trade-off parameters for the penalty incurred by corresponding losses. In Section 5, we demonstrate that these trade-off parameters can be empirically tuned via grid search. \begin{figure*}[!t] \centering \setlength\abovecaptionskip{-0.2\baselineskip} \includegraphics[scale=0.6]{adv_ker_matching} \caption{Abstract View of Adversarial Kernel Matching. Network $N$ aligns the distributions to fool Network $M$ via minimizing MMD between the source and target representations while network $M$ aims to yield the kernel with maximal test power between two distributions via maximizing MMD.} \label{fig_minimax} \end{figure*} \subsection {Learning Algorithm} Past research has attempted to design DA algorithms that reduce target generalization error. Li et al. \cite{li_heterogeneous_2018} offer a representation learning algorithm based on objective function optimization with a ‘fixed’ MMD kernel without kernel learning. Long et al. \cite{long_transferable_2018} propose a deep representation learning algorithm with adversarial kernel learning. However, their algorithm is designed for homogeneous DA. As shown in model preliminaries, SDL and adversarial kernel learning can reduce HDA target generalization errors. Hence, we are motivated to incorporate SDL and nonparametric adversarial kernel matching in our algorithm to reduce the target error more effectively. We develop an algorithm to solve the optimization problems for SDL in (\ref{eq_7}), nonparametric adversarial kernel matching in (\ref{eq_12}), and classification in (\ref{eq_13}) via a unified architecture. To achieve this, we incorporate SDL into our model. In the SDL formulation in (\ref{eq_7}), if $D$ is a low-rank matrix, the $\ell_1$ regularization term can be removed without lack of generalization: \begin{equation} \begin{aligned} &\underset{P^s,P^t,D,R^s,R^t}{\text{min}} \left\| P^sX^s-DR^s\right\|_F^2 + \left\| P^tX^t-DR^t\right\|_F^2 \\ &\text{s.t.} \left\|d_i\right\|_2\leq 1; \quad P^s{P^s}^T = I; P^t{P^t}^T=I \end{aligned} \label{eq_15} \end{equation} where $I$ denotes the identity matrix and the last two constraints ensure orthogonality. Ideally, the reconstruction errors are reasonably close to 0, and the source and target representations are expressed as ${\hat{R}}^s =D^{-1}P^s X^s$ and ${\hat{R}}^t=D^{-1}P^t X^t$. Accordingly, we express $R^s$ and $R^t$ in the form of products of three matrices where the first matrix is shared. Specifically, we denote $R^s\approxeq{AB^s X^s}$ and $R^t\approxeq{AB^t X^t}$, where $B^s$ and $B^t$ approximate the domain-specific projections and $A$ approximates the shared projection. To approximate $R^s$ and $R^t$, we parameterize $D^{-1}$, $P^s$, and $P^t$ by fully connected layers $A$, $B^s$, and $B^t$, respectively. Such approximation enables us to integrate shared dictionary learning into our neural network architecture. As a result, (\ref{eq_15}) can be written as: \begin{equation} \begin{aligned} \underset{P^s,P^t,D,A,B^s,B^t}{\text{min}} \left\| P^sX^s-DAB^sX^s\right\|_F^2 + &\left\| P^tX^t-DAB^tX^t\right\|_F^2 \\ \text{s.t.} \left\|d_i\right\|_2\leq 1; \quad P^s{P^s}^T = I; P^t{P^t}^T = I \end{aligned} \label{eq_16} \end{equation} To satisfy the orthogonality constraints on $P^s$ and $P^t$ in (\ref{eq_16}), we enforce the weights of $B^s$ and $B^t$ to be orthogonal after each gradient update. We also normalize the weights of $D$ and $A$ to the unit vector. Since $R^s$ and $R^t$ are restricted to be a function of $X^s$ and $X^t$, the result of the optimization in (\ref{eq_16}) is an upper bound for shared dictionary learning loss: \begin{equation} \begin{aligned} \mathcal{L}_{SDL^{up}} = \left\| P^sX^s-DAB^sX^s\right\|_F^2 + \left\| P^tX^t-DAB^tX^t\right\|_F^2 \\ \end{aligned} \label{eq_17} \end{equation} Given the approximated representations of $R^s$ and $R^t$, the other loss functions in objective (\ref{eq_14}) are re-written as in (\ref{eq_18}) and (\ref{eq_19}): \begin{equation} \begin{aligned} \mathcal{L}_{Adv} = D_{\theta_M}(\phi_{M}(\phi_{N}(AB^sX^s)), \phi_{M}(\phi_{N}(AB^tX^t)))\\ \end{aligned} \label{eq_18} \end{equation} \begin{equation} \begin{aligned} \mathcal{L}_C = \frac{1}{2}( L(h_C (\phi_{\theta_N} (AB^sX^s )),Y^s)+\\L(h_C (\phi_{\theta_N} (AB^tX^t)),Y^t)) \end{aligned} \label{eq_19} \end{equation} \begin{algorithm}[!h] \caption{HANDA Learning Procedure} \label{Algo} \begin{algorithmic}[1] \State \textbf{Input}: trade-off parameters $\gamma$ and $\beta$; batch size for source data, target labeled data, and target unlabeled data: $b_s$, $b_L$, and $b_U$; \# of updates of dictionary learning $n_d$; \# of updates of adversarial kernel matching $n_a$; \# of updates of classification hinge loss $n_c$. \State \textbf{Output}: Parameters $A$ ,$B^s$, $B^t$, $D$, $P^s$, $P^t$, $\theta_N$, $\theta_M$, $\theta_C$. \State Initialize parameters $A,B^s,B^t,D,P^s,P^t,\theta_N,\theta_M$, $\theta_C$. \While{$\mathcal{L}_{SDL^{up}}$, $\mathcal{L}_{Adv}$, and $\mathcal{L}_{C}$ have not converged} \State Randomly sample a minibatch of source data \par $\{(x_i^s,y_i^s)\}^{b_s}_{i=1}$. \State Randomly sample a minibatch of target data \par $\{(x_i^L,y_i^L)\}^{b_L}_{i=1}$ and $\{(x_i^U)\}^{b_U}_{i=1}$. \State Compute $R^s=AB^sX^s$ and $R^t=AB^tX^t$. \For {$t = 1,2,...,n_{d}$} \State Compute shared dictionary learning loss $\mathcal{L}_{SDL}$\par \hskip\algorithmicindent using (\ref{eq_17}). \State Update $A, B^s, B^t, D, P^s, P^t$ using stochastic \par \hskip\algorithmicindent gradient descent to minimize $\mathcal{L}_{SDL}$. \State {\textbackslash\textbackslash Normalize weights to unit norm} \State $D \leftarrow $clip$(D, 1)$, $A \leftarrow $clip$(A, 1)$ \State {\textbackslash\textbackslash Enforce orthogonality constraint} \State $P^s, P^t, B^s, B^t \leftarrow $Orth$(P^s,P^t, B^s, B^t)$ \EndFor \For {$t = 1,2,...,n_{a}$} \State Compute adversarial loss for distribution \par \hskip\algorithmicindent alignment $\mathcal{L}_{Adv}$ using (\ref{eq_18}). \State Update parameters $\theta_M$ using stochastic gradient \par \hskip\algorithmicindent descent to maximize $\mathcal{L}_{Adv}$. \State Update parameters $\theta_N, A, B^s, B^t$ via stochastic \par \hskip\algorithmicindent gradient descent to minimize $\mathcal{L}_{Adv}$. \EndFor \For {$t = 1,2,...,n_{c}$} \State Compute classification loss $\mathcal{L}_{C}$ using (\ref{eq_19}). \State Update $\theta_C,\theta_N,A, B^s, B^t, D, P^s, P^t$ using \par \hskip\algorithmicindent stochastic gradient descent to minimize $\mathcal{L}_{C}$. \EndFor \EndWhile \State \Return $A$ ,$B^s$, $B^t$, $D$, $P^s$, $P^t$, $\theta_N$, $\theta_M$, $\theta_C$. \end{algorithmic} \end{algorithm} All three losses can be minimized simultaneously via stochastic gradient descent \cite{li_mmd_2017} in a unified neural network architecture introduced by HANDA. Algorithm 1 summarizes HANDA’s learning procedure to minimize these losses simultaneously. Algorithm 1 alternates between minimizing the feature discrepancy and minimizing the distribution divergence until some convergence criterion is met or for a number of iterations. Code and datasets are available at https://github.com/mohammadrezaebrahimi/HANDA. Our algorithm differs from the heterogeneous method proposed in \cite{li_heterogeneous_2018} in two aspects. First, we incorporate SDL in a unified neural network architecture that allows utilizing the supervised loss to improve the quality of dictionary learning. The dictionary learning in \cite{li_heterogeneous_2018} is unsupervised and does not account for the class variable in feature alignment, which could result in lack of discriminative properties in the projected space. Second, our proposed neural network architecture offers an effective alternative for the mathematical optimization based on Lagrange multipliers in \cite{li_heterogeneous_2018} via a numerical optimization (stochastic gradient-based) method that reduces distribution and feature mismatch simultaneously. Later in the evaluation section we show the performance benefit gained from this property. Our method also differs from the homogeneous method offered in \cite{tzeng_adversarial_2017} in that HANDA does not use GAN. While GAN implements a minimax setting between a generator and discriminator, the minimax optimization in our approach is formulated for adversarial kernel matching between source and target distributions, as given in (19), to achieve domain invariance. \selectlanguage{english} \section{Evaluation} For a comprehensive evaluation, we measure both HANDA’s performance and its practical utility. We construct a large testbed with three e-commerce datasets. To evaluate the performance, we use two widely used e-commerce benchmarks for image and multilingual text: Reuters Multilingual Collection and Office31 – Caltech256. To evaluate the practical utility, we use a real-world e-commerce dataset from dark web online markets with multilingual product descriptions. This practical evaluation encompasses a real-world cybersecurity case study, which is of value for cybersecurity applications. Reuters Multilingual Collection contains $111,740$ online newswire articles with commercial themes in five languages: English, French, German, Italian, and Spanish, across six topics: Economics, Equity Markets, Finance, Industry, Social, and Performance \cite{amini_learning_2009}. Consistent with other studies \cite{fang_discriminative_2018,tsai_learning_2016}, we used Spanish as the target language and the other four languages as sources. This dataset is used for performing multi-class text classification task. Office31 – Caltech256 is an extension of the original dataset created by Gong et al. \cite{gong_connecting_2013}, and contains two popular heterogeneous image representations: Speeded Up Robust Features (SURF) with $800$ dimensions \cite{fang_discriminative_2018} and Deep Convolutional Activation Features (DeCAF) with $4,096$ dimensions \cite{donahue_decaf:_2014}. The dataset consists of $2,533$ online images in 10 categories in four domains: Amazon (A), downloaded from the Amazon website; Webcam (W), taken by a low-resolution camera; DSLR (D), taken by a high-resolution DSLR camera; and Caltech(C), selected from the Caltech-256 dataset. Following other studies \cite{fang_discriminative_2018,tsai_learning_2016}, three labeled samples from each category within the source domain were used in training. This dataset is associated with multi-class product image recognition task. In addition to widely accepted benchmark e-commerce datasets, it is useful to evaluate the practical utility of our model in a real-world setting. To this end, given the recent rise of illegal online markets on the dark web, we developed crawlers for obtaining data from nine illegal e-commerce platforms. Our new dark web online markets dataset is an extension of the dataset proposed in \cite{ebrahimi_detecting_2018}, which contains {$94,175$} product descriptions (from seven English markets), {$4,600$} Russian, and {$1,512$} French product descriptions (Table \ref{table_darkweb}). The dataset has been labeled by three native speakers and two cybersecurity experts and is publicly available from our GitHub repository. To construct the training set, we randomly sampled product descriptions in each language (2,584 products; 706 cyber threats, 1,878 benign products). Since more English labeled data is available, English markets are used as the source, and Russian and French markets are used as the targets. Each language was manually labeled by a cybersecurity expert and a native speaker. This dataset is used for cyber threat detection, which is viewed as a binary classification task. \begin{table}[t] \renewcommand{\arraystretch}{1.3} \setlength\abovecaptionskip{-0.3\baselineskip} \caption{Testbed for Cybersecurity Case Study } \label{table_darkweb} \centering \begin{tabular}{|p{0.25\linewidth}|p{0.15\linewidth}|p{0.2\linewidth}|p{0.15\linewidth}|} \hline \multicolumn{1}{|c|}{Online Market} & \multicolumn{1}{c|}{\# of listings} & \multicolumn{1}{c|}{Language} & \multicolumn{1}{c|}{\# of labeled products}\\ \hline Dream Market & 39,473 & \multirow{7}{*}{English} & \multirow{7}{*}{1,821}\\\cline{1-2} AlphaBay & 25,118 & & \\\cline{1-2} Hansa & 14,149 & & \\\cline{1-2} Silk Road 3 & 1,683 & & \\\cline{1-2} Minerva & 683 & &\\\cline{1-2} Apple Market & 877 & & \\\cline{1-2} Valhalla & 12,192 & & \\ \hline Russian Silk Road & 4,600 & Russian & 552 \\ \hline French Deep Web & 1,512 & French & 211\\ \hline \textbf{Total:} & \textbf{100,287} & - & \textbf{2,584}\\ \hline \end{tabular} \footnotetext{SMS: Support and Model Shift, JDA: Joint Distribution Adaptation, TCA: Transfer Component Analysis; SymNets: Symmetric Networks; SBADA-GAN: Symmetric Bi-directional ADAptive GAN; AC-GAN: Auxiliary Classifier GAN; DAN: Domain Adaptation Networks; CyCADA: Cycle Consistent Adversarial Domain Adaptation.} \end{table} The current body of HDA research widely uses average accuracy and standard deviation for performance evaluation \cite{li_heterogeneous_2018,wang_heterogeneous_2018,yao_low-resolution_2019}. The average accuracy $Acc_{avg}$ is defined as follows: \begin{equation} \begin{aligned} Acc_{avg} = \frac{1}{n} \sum_{i=1}^n \frac{| x^t:x^t\in X^t, {\hat{y}}^t=y^t |} {| x^t:x^t \in X^t |} \end{aligned} \label{eq_20} \end{equation} where $x$ is a target instance, ${\hat{y}}^t$ is the predicted class, $y^t$ is the true class label, $|.|$ denotes the cardinality of the corresponding set, and $n$ is the number of runs. Standard deviation is also averaged over multiple runs of each model (often 10 times). Consistent with past HDA research, we use average accuracy and average standard deviation as evaluation metrics for comparing HANDA with the benchmark methods. Higher average accuracy and lower standard deviation suggest higher predictive performance. Note that since both benchmark datasets are not class imbalanced, accuracy is a sufficient measure for benchmark evaluations. However, for class imbalanced cybersecurity datasets, the Area Under receiver operating characteristic Curve (AUC) is the recommended performance measure since it emphasizes both threat and non-threat classes \cite{wheelus_tackling_2018} by establishing a trade-off between Type I and Type II errors \cite{Hastie2017}. Given the class imbalance in our case study, we use AUC as the performance metric. Higher AUC suggests higher predictive performance.\\ We evaluate HANDA through three sets of experiments and one case study. Experiment \#1 is aimed at evaluating HANDA against alternative state-of-the-art HDA methods (the top right and bottom right quadrants, shown in Table \ref{table_positioning}). This experiment compares HANDA’s performance to seven HDA methods, including HDA Network based on Autoencoder (HDANA) \cite{wang_heterogeneous_2018}, Cross-Domain Mapping (CDM) \cite{fang_discriminative_2018}, Generalized Joint Distribution Adaptation (G-JDA) \cite{hsieh_recognizing_2016}, Transfer Neural Trees (TNT) \cite{chen_transfer_2016}, Cross-Domain Landmark Selection (CDLS) \cite{tsai_learning_2016}, Semi-supervised Heterogeneous Feature Augmentation (SHFA) \cite{li_learning_2014}, and Max-Margin Domain Transforms (MMDT) \cite{hoffman_efficient_2013}. This experiment involves two reputable e-commerce datasets: Office31 – Caltech256 and Reuters Multilingual Collection. Experiment \#2 focuses on the qualitative evaluation of DA \cite{chen_transfer_2016} to verify its effectiveness by comparing the linear separability of target samples before and after DA through visualizing the intermediate representations on both Office31 – Caltech256 and Reuters Multilingual Collection. Experiment \#3 targets convergence analysis \cite{arjovsky_wasserstein_2017} to investigate the convergence property of the objective functions corresponding to each HANDA component by assessing the stabilization of loss values during model training on the Office31 – Caltech256 benchmark dataset. Finally, a case study is conducted to verify practical utility on real-world products advertised in dark web online markets as an emerging cybersecurity application. \begin{table*}[!t] \setlength\abovecaptionskip{-0.3\baselineskip} \centering \caption{Comparison of State-of-the-Art HDA Methods with HANDA on Multilingual Text Classification (Accuracy and Standard Deviation); P-values significant at 0.05:*} \label{table_result1} \begin{tabular}{|M{0.15\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|} \hline \multirow{2}{*}{HDA Method}& \multicolumn{4}{c|}{10 Labeled Samples per Target Class} & \multicolumn{4}{c|}{20 Labeled Samples per Target Class}\\\cline{2-9} & $EN\rightarrow SP$ & $FR\rightarrow SP$ & $GR\rightarrow SP$ & $IT\rightarrow SP$ & $EN\rightarrow SP$ & $FR\rightarrow SP$ & $GR\rightarrow SP$ & $IT\rightarrow SP$\\ \hline MMDT & $68.9\pm0.6$ & $69.1\pm0.7$ & $68.3\pm0.6$ & $67.5\pm0.5$ & $74.5\pm0.7$ & $74.9\pm0.7$ & $75.1\pm0.8$ & $74.9\pm0.8$ \\ \hline CDM & - & - & - & - & $75.1\pm2.8$ & $75.2\pm2.8$ & $75.3\pm2.7$ & $75.2\pm2.7$ \\ \hline SHFA & $67.8\pm0.7$ & $68.1\pm0.6$ & $68.4\pm0.7$ & $68.0\pm0.7$ & $74.1\pm0.4$ & $74.5\pm0.6$ & $74.7\pm0.5$ & $74.5\pm0.5$\\ \hline G-JDA & $69.4\pm0.8$ & $70.5\pm0.7$ & $69.6\pm1.0$ & $70.1\pm1.0$ & $76.0\pm0.7$ & $76.8\pm0.8$ & $76.8\pm0.7$ & $76.6\pm0.7$\\ \hline TNT & $70.0\pm1.0$ & $70.9\pm0.8$ & $69.9\pm0.9$ & $71.0\pm0.9$ & $76.1\pm0.7$ & $77.5\pm0.8$ & $77.1\pm1.1$ & $76.8\pm0.9$\\ \hline CDLS & $70.8\pm0.7$ & $71.2\pm0.8$ & $71.0\pm0.8$ & $71.7\pm0.8$ & $77.4\pm0.7$ & $77.6\pm0.7$ & $78\pm0.6$ & $77.5\pm0.7$\\ \hline HDANA & $72.1\pm0.3$ & $72.7\pm0.4$ & $71.8\pm0.4$ & $72.3\pm0.3$ & $78.3\pm0.5$ & $79.2\pm0.5$ & $80.1\pm0.6$ & $78.5\pm0.3$\\ \hline \hline HANDA (No SDL)& $23.4\pm8.2$ & $16.8\pm9.0$ & $21.3\pm9.8$ & $18.0\pm6.7$ & $29.1\pm12.4$ & $34.0\pm8.9$ & $39.5\pm8.8$ & $32.0\pm10.9$\\ \hline HANDA (No Adv)& $68.0\pm0.6$ & $69.1\pm0.6$ & $67.9\pm0.8$ & $69.8\pm0.7$ & $75.7\pm0.5$ & $75.4\pm0.5$ & $75.0\pm0.6$ & $76.7\pm0.6$\\ \hline HANDA (Entropy)& $73.7\pm0.3$ & $72.6\pm0.5$ & $73.4\pm0.2$ & $72.4\pm0.5$ & $79.0\pm0.4$ & $79.1\pm0.3$ & $79.5\pm0.4$ & $78.1\pm0.2$\\ \hline \textbf{HANDA (ours)} & \bm{$74.5}\pm\bm{0.4^{\ast}$} & \bm{$74.2}\pm\bm{0.4^{\ast}$} & \bm{$73.8}\pm\bm{0.5^{\ast}$} & \bm{$74.0}\pm\bm{0.6^{\ast}$} & \bm{$79.8}\pm\bm{0.3^{\ast}$} & \bm{$80.0}\pm\bm{0.4^{\ast}$} & \bm{$80.5}\pm\bm{0.2^{\ast}$} & \bm{$79.2}\pm\bm{0.5^{\ast}$}\\ \hline \end{tabular} \end{table*} \selectlanguage{english} \subsection{Experiment \#1: {Performance Evaluation}} Experiment \#1 aims to evaluate HANDA’s performance against the state-of-the-art HDA methods in two relevant applications in international e-commerce platforms: multilingual text classification and cross-domain product image recognition. For multilingual text classification, following the settings in \cite{wang_heterogeneous_2018}, we summarize the results of domain adaptation when Spanish is the target and English, French, German, and Italian are the source languages, with 10 and 20 labeled target samples per class (Table \ref{table_result1}). The average accuracy is obtained by running each experiment 10 times and precedes the average standard deviation in Table \ref{table_result1} (separated by $\pm$). To see the effect of shared dictionary learning and adversarial kernel matching in isolation, we also conducted two baseline experiments with eliminating the shared dictionary learning component (No SDL) and eliminating the adversarial kernel matching component (No Adv). We further compared the performance of the proposed adversarial kernel matching alignment loss in HANDA with the entropy-based alignment loss proposed in \cite{morerio2018minimalentropy}, denoted by HANDA (Entropy) in Table {\ref{table_result1}}. $\beta$ and $\gamma$ were obtained via a small gird search as described in Experiment \#1.1. The higher performance of the proposed method is statistically significant when compared to the second-best method, as suggested by the paired $t$-test \cite{demsar_statistical_2006}. HANDA improves the classification performance by approximately 2\% across different source-target language pairs with statistically significant margins. Additionally, the baseline experiments show that both shared dictionary learning and adversarial kernel matching contribute to achieving the state-of-the-art performance. For cross-domain product image recognition, consistent with \cite{wang_heterogeneous_2018}, due to the lack of labeled data in the DSLR domain, we choose the Amazon (A), Webcam(W), and Caltech(C) domains as the source, and DSLR (D) as the target domain. HANDA improves the average accuracy in all domains by 1.1\% on average (Table \ref{table_result2}). \begin{table}[!h] \setlength\abovecaptionskip{-0.3\baselineskip} \centering \caption{Cross-Features and Cross-Domain Comparison of State-of-the-Art HDA Methods with HANDA on Product Image Recognition; P-values significant at 0.05:*} \label{table_result2} \begin{tabular}{|M{0.15\linewidth}|M{0.2\linewidth}|M{0.2\linewidth}|M{0.2\linewidth}|M{0.16\linewidth}|} \hline HDA & \multicolumn{4}{c|}{SURF to DeCAF} \\\cline{2-5} Method & $A\rightarrow D$ & $C\rightarrow D$ & $W\rightarrow D$ & $Average$ \\ \hline MMDT & $90.5\pm0.6$ & $91.2\pm0.6$ & $90.8\pm0.6$ & $90.8\pm0.6$ \\ \hline TNT & $90.6\pm0.9$ & $92.7\pm1.1$ & $95.5\pm1.0$ & $92.9\pm1.0$ \\ \hline SHFA & $93.4\pm1.1$ & $93.8\pm1.0$ & $92.4\pm0.9$ & $93.2\pm1.0$\\ \hline G-JDA & $94.3\pm0.7$ & $92.8\pm0.8$ & $95.0\pm0.4$ & $94.0\pm0.6$\\ \hline CDLS & $96.1\pm0.7$ & $94.9\pm1.5$ & $95.1\pm0.8$ & $95.4\pm1.5$ \\ \hline HDANA & $96.1\pm0.5$ & $95.3\pm0.6$ & $96.9\pm0.3$ & $96.1\pm0.5$\\ \hline\hline HANDA \par (No SDL) & $20.6\pm4.5$ & $24.2\pm3.8$ & $26.1\pm5.1$ & $23.6\pm4.5$\\ \hline HANDA \par (No Adv) & $92.8\pm0.5$ & $93.2\pm0.6$ & $93.3\pm0.5$ & $93.1\pm0.5$\\ \hline HANDA \par(Entropy) & $96.5\pm0.6$ & $95.8\pm0.4$ & $96.6\pm0.5$ & $96.3\pm0.5$\\ \hline \textbf{HANDA (ours)} & \bm{$97.1}\pm\bm{0.4^{\ast}$} & \bm{$96.9}\pm\bm{0.5 ^{\ast}$} & \bm{$97.6}\pm\bm{0.5^{\ast}$} & \textbf{97.2}$\pm$\textbf{0.4}$\bm{^{\ast}}$ \\ \hline \end{tabular} \end{table} Overall, HANDA outperforms mathematical optimization-based HDA methods in text classification and product image recognition (the top right quadrant in Table \ref{table_positioning}). Moreover, HANDA outperforms the neural representation-based HDA alternatives (the bottom right quadrant in \ref{table_positioning}) in both text classification and product image recognition tasks. Outperforming HDANA suggests that domain invariance through adversarial learning can lead to better HDA. Outperforming TNT, in the image classification task by a significant margin suggests that simultaneous distribution and feature alignment are necessary for successful HDA. \selectlanguage{english} \subsubsection{Experiment \#1.1: Sensitivity to Parameters $\beta$ and $\gamma$} \label{sensitivity} As noted in Section 4, to empirically search the parameter space induced by $\beta$ and $\gamma$ in {({\ref{eq_14}})}, we conducted a grid search with four $\beta$ values selected from \{$1e-2,1e-3,1e-4,1e-5$\} and four $\gamma$ values selected from \{$1e-2,1e-1,1,10$\}. Following \cite{Ganin2016}, reverse cross-validation \cite{zhong2010cross} is adopted for hyperparameter tuning to ensure that validation is not conducted on labeled target data. Table {\ref{table_gridsearch}} shows the parameter values associated with the best performance during the empirical parameter tuning for $\beta$ and $\gamma$ in {({\ref{eq_14}})} on multilingual text dataset (with 10 and 20 labeled data in the source domain) and product image dataset (with three labeled data in the source domain). \begin{table}[H] \setlength\abovecaptionskip{-0.3\baselineskip} \renewcommand{\arraystretch}{1.2} \caption{Results of Empirical Parameter Tuning for $\beta$ and $\gamma$ in {(\ref{eq_14})} on Multilingual Text Dataset and Image Product Recognition Dataset} \label{table_gridsearch} \centering \begin{tabular}{|M{0.2\linewidth}|M{0.15\linewidth}|M{0.15\linewidth}|M{0.15\linewidth}|M{0.15\linewidth}|} \hline \multirow{2}{*}{HDA Task}& \multicolumn{2}{c|}{10 Labels / 3 Labels} & \multicolumn{2}{c|}{20 Labels}\\\cline{2-5} & $\beta (SDL)$ & $\gamma (Adv)$ & $\beta (SDL)$ & $\gamma (Adv)$ \\ \hline $EN\rightarrow SP$ & $1e-5$ & $1$ & $1e-2$ & $1e-4$ \\ \hline $FR\rightarrow SP$ & $1e-4$ & $1$ & $1e-5$ & $1$ \\ \hline $GR\rightarrow SP$ & $1e-4$ & $1$ & $1e-1$ & $1e-4$ \\ \hline $IT\rightarrow SP$ & $1e-4$ & $1$ & $1e-4$ & $1$ \\ \hline $A\rightarrow D$ & $1e-1$ & $1e-4$ & $-$ & $-$ \\ \hline $C\rightarrow D$ & $1e-4$ & $1$ & $-$ & $-$ \\ \hline $W\rightarrow D$ & $1e-4$ & $1$ & $-$ & $-$ \\ \hline \end{tabular} \end{table} As seen, a sparse search in the parameter space induced by $\beta$ and $\gamma$ yields the state-of-the-art performance reported in Table {\ref{table_result1}}. Additionally, the fact that $\beta=1e-4$ and $\gamma=1$ yields the best performance in the majority of domain adaptation experiments for both benchmark datasets signifies that {({\ref{eq_14}})} is not unreasonably sensitive to parameter setting. \selectlanguage{english} \subsubsection{Experiment \#1.2: Ablation analysis} To further analyze the effect of the internal components of HANDA architecture, we conducted two sets of ablation experiments. The first set examines the effect of the depth of the feature extractor. Best performances are shown in bold face. As seen in Table \ref{table_ablation}, the results show performance improvement with multiple hidden layers for both datasets. \begin{table*}[b] \setlength\abovecaptionskip{-0.3\baselineskip} \centering \caption{Ablation Analysis of the Depth of Feature Extractor in Multilingual Text Classification Dataset and Product Image Recognition Dataset} \label{table_ablation} \begin{tabular}{|M{0.17\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|M{0.1\linewidth}|} \hline \multirow{2}{*}{Model}& \multicolumn{4}{c|}{10 Labeled Samples per Target Class} & \multicolumn{4}{c|}{20 Labeled Samples per Target Class}\\\cline{2-9} & $EN\rightarrow SP$ & $FR\rightarrow SP$ & $GR\rightarrow SP$ & $IT\rightarrow SP$ & $EN\rightarrow SP$ & $FR\rightarrow SP$ & $GR\rightarrow SP$ & $IT\rightarrow SP$\\ \hline 1-layer & $73.0\pm0.4$ & $72.7\pm0.5$ & $71.6\pm0.6$ & $72.2\pm0.5$ & $77.5\pm0.2$ & $77.9\pm0.5$ & $79.6\pm0.3$ & $78.4\pm0.4$ \\ \hline 2-layer & $\bm{74.5}\pm\bm{0.4}$ & $74.2\pm0.4$ & $\bm{73.8}\pm\bm{0.5}$ & $74.0\pm0.6$ & $79.8\pm0.3$ & $\bm{80.0}\pm\bm{0.4}$ & $\bm{80.5}\pm\bm{0.2}$ & $\bm{79.2}\pm\bm{0.5}$ \\ \hline 3-layer & $74.4\pm0.3$ & $\bm{74.7}\pm\bm{0.6}$ & $72.2\pm0.7$ & $\bm{74.3}\pm\bm{0.7}$ & $80.0\pm0.4$ & $79.3\pm0.3$ & $80.1\pm0.4$ & $79.1\pm0.5$\\ \hline 4-layer & $74.2\pm0.5$ & $74.0\pm0.5$ & $72.5\pm0.5$ & $73.5\pm0.6$ & $\bm{80.2}\pm\bm{0.4}$ & $79.3\pm0.4$ & $79.5\pm0.3$ & $78.3\pm0.6$\\ \hline 5-layer & $72.3\pm0.7$ & $72.5\pm0.7$ & $72.0\pm0.8$ & $72.1\pm0.9$ & $79.5\pm0.5$ & $78.6\pm0.5$ & $78.2\pm0.5$ & $77.9\pm0.6$\\ \hline SDL+Adv (Sequential) & $71.1\pm0.4$ & $71.2\pm0.5$ & $70.4\pm0.5$ & $69.9\pm0.6$ & $76.6\pm0.4$ & $76.2\pm0.5$ & $75.8\pm0.5$ & $75.2\pm0.5$ \\ \hline \end{tabular} \end{table*} It is observed that having three (and rarely four) hidden layers adds marginal improvements compared to two hidden layers. That is, the majority of best performances are attained with two hidden layers. As such, to promote a parsimonious architecture that yields the best performance in most heterogeneous domain adaptation tasks, we used a neural net with two hidden layers as the feature extractor of HANDA. The second set of experiments examines the contribution of simultaneous learning of the shared dictionary and adversarial kernel matching in the HANDA's unified framework versus the sequential learning of these two components. In the sequential case, denoted by (SDL+Adv) in Table \ref{table_ablation}, we conducted a two-step learning process, in which we first optimized HANDA's shared dictionary learning loss (without involving adversarial kernel matching loss). Subsequently, we applied the adversarial kernel learning on the projected space obtained from the shared dictionary learning. The results suggest that simultaneous learning of the shared dictionary and adversarial kernel matching in HANDA's unified architecture outperforms sequential learning on multilingual text classification dataset. \selectlanguage{english} \subsection {Experiment \#2: Qualitative Analysis} In domain adaptation research, the quality of generated representations can be assessed via visualizing the obtained representations before and after DA \cite{chen_transfer_2016}. The target representation from HANDA is visualized in 2-D space by $t$-distributed Stochastic Neighbor Embedding ($t$-SNE) \cite{maaten_visualizing_2008} (Figure \ref{fig_svm_lang}). The decision boundaries are obtained by linear SVM. \begin{figure}[!h] \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_lang_a \label{fig_svm_lang_a}} \hfil \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_lang_b \label{fig_svm_lang_b}} \hfil \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_lang_c \label{fig_svm_lang_c}} \hfil \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_lang_d \label{fig_svm_lang_d}} \caption{Qualitative Comparison of HANDA Before and After Domain Adaptationin in Multilingual Text Classification. Target samples have been visualized in 2-D before and after domain adaptation from Italian (b), French (c), and English (d) to Spanish.} \label{fig_svm_lang} \end{figure} As seen in Figure \ref{fig_svm_lang_a}, target documents are not linearly separable before DA. The new representations obtained from HANDA lead to more linearly separable samples after domain adaptation from Italian (Figure \ref{fig_svm_lang_b}), French (Figure \ref{fig_svm_lang_b}), and English (Figure \ref{fig_svm_lang_d}). The majority of documents in the ‘Economics,’ ‘Social,’ and ‘Performance’ classes are distinguished via light blue, light green, and dark red hyperplanes, respectively. The same effect is observed in the cross-domain product image recognition task as a result of DA (Figure \ref{fig_svm_image}). \begin{figure}[!h] \centering \setlength\abovecaptionskip{0.1\baselineskip} \setlength\belowcaptionskip{-0.5\baselineskip} \setlength\dbltextfloatsep{-0.5\baselineskip} \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_image_a \label{fig_svm_image_a}} \hfil \subfloat[]{\includegraphics[width=0.2\textwidth]{svm_image_b \label{fig_svm_image_b}} \hfil \captionsetup[subfigure]{labelformat=empty} \subfloat[]{\includegraphics[width=0.25\textwidth]{svm_image_legend \label{fig_svm_image_legend}} \hfil \vspace{-10pt} \caption{Qualitative Comparison of HANDA Before and After Domain Adaptation in Cross-Domain Product Image Recognition. Target samples are visualized in 2-D before (a) and after (b) domain adaptationfrom Caltech to DSLR domain.} \label{fig_svm_image} \end{figure} Similarly, target images are not linearly separable before DA (Figure \ref{fig_svm_image_a}). A considerable number of product images in ‘mouse’ (light red), ‘headphone’ (orange), ‘backpack’ (dark purple), ‘mug’ (light purple), and ‘keyboard’ (light green) cannot be distinguished (shown with a red circle). HANDA representations lead to more linearly separable samples after adaptation from Caltech to DSLR (Figure \ref{fig_svm_image_b}) compared to before adaptation (Figure \ref{fig_svm_image_a}). Almost all product images are classified correctly except the ‘laptop’ (light blue) and ‘calculator’ (dark green) that have excessive visual similarity (both have a display and keypad). \selectlanguage{english} \subsection{Experiment \#3: Convergence Analysis} The quality of adversarial training is often empirically verified by investigating the convergence property of the losses \cite{arjovsky_wasserstein_2017}. We monitor adversarial kernel learning, shared dictionary learning, and classification loss on Office31 – Caltech256. All three losses stabilize after 1,000 training batches (red markers in Figure \ref{fig_loss}). Although both dictionary learning and adversarial kernel learning have non-convex objective functions, they both converge in all three domains (Amazon (Figure \ref{fig_loss_a}), Caltech (Figure \ref{fig_loss_b}), and Webcam (Figure \ref{fig_loss_c})). \begin{figure}[!h] \setlength\abovecaptionskip{0.2\baselineskip} \setlength\belowcaptionskip{-0.5\baselineskip} \setlength\dbltextfloatsep{-0.5\baselineskip} \centering \subfloat[]{\includegraphics[width=0.31\linewidth]{loss_a \label{fig_loss_a}} \hfil \subfloat[]{\includegraphics[width=0.3\linewidth]{loss_b \label{fig_loss_b}} \hfil \subfloat[]{\includegraphics[width=0.3\linewidth]{loss_c \label{fig_loss_c}} \hfil \caption{Convergence Analysis of HANDA on Amazon (a), Caltech (b), and Webcam (c) Domains for Image Recognition Task on Office31-Caltech256 Dataset. Loss variations stabilize after a certain number of iterations in all domains.} \label{fig_loss} \end{figure} In sum, with our feature and distribution alignment approaches, HANDA is able to outperform extant HDA methods in image recognition and text classification tasks. Specifically, outperforming HANDA alternatives, HDANA and TNT, shows that simultaneous feature and distribution alignment with a focus on domain invariance can lead to better HDA. HANDA can alleviate the lack of training data in e-commerce applications and improve product search and indexing in online markets. Furthermore, HANDA shows loss convergence property during the adversarial training process. This suggests that HANDA can be robust and generalizable to unknown domains. Finally, the domain-invariant representations obtained from HANDA are of high quality and can increase the performance of downstream text and image classification tasks. \selectlanguage{english} \subsection{Cybersecurity Case Study} It is useful to assess the utility of HDA models in real-world applications, in addition to common benchmark evaluations. Monitoring products sold on dark web markets is an emerging area in cybersecurity that can highly benefit from HDA in providing actionable cyber threat intelligence. We demonstrate the practical utility of the HANDA framework on a real-world cybersecurity dataset obtained from English, Russian, and French dark web markets. This case study has two main purposes. First, it aims to assess if a model that is trained by Algorithm 1 on English markets can aid the detection of cyber threats in Russian and French markets in practice. Second, it is meant to show examples of cyber threats that are recognized by HANDA but would be missed in the absence of DA. To gauge the performance improvement offered by HANDA, we compare the AUC to a neural network without DA (Figure \ref{fig_auc}). \begin{figure}[!h] \centering \setlength\abovecaptionskip{0.2\baselineskip} \setlength\belowcaptionskip{-0.5\baselineskip} \setlength\dbltextfloatsep{-0.5\baselineskip} \includegraphics[scale=0.5]{auc} \caption{HANDA’s AUC on Russian and French Dark Web Online Markets. Note: Softmax function was applied to all network outputs to obtain the probabilities for AUC calculation. } \label{fig_auc} \end{figure} To this end, a feedforward neural network (NN) trained on Russian and French markets serves as a baseline. HANDA was trained on English markets as the source, while Russian and French were the targets. HANDA increases the AUC in Russian markets by 3\% (from 0.96 to 0.98). Similarly, HANDA results in a 4\% AUC increase in French markets (from 0.85 to 0.89). Table \ref{table_threat} shows the examples of products that HANDA identifies in Russian and French as cyber threats, but are missed by the baseline NN without DA. By juxtaposing the training samples, testing samples, and model’s output, we discovered that there were no instances of “Trojan” in the French training set. Nevertheless, HANDA was able to identify the Trojan as a cyber threat in the French testing set, showing that our model is able to learn from Trojan instances in the source (English) dataset. This implies that the domain adaptation from English to French allows HANDA to distinguish the ‘unseen’ examples in the target language that are not present in the training set. As a result, HANDA can significantly increase the cyber threat intelligence performance in dark web markets with limited training data. \begin{table*}[t] \setlength\abovecaptionskip{-0.2\baselineskip} \centering \caption{Russian and French Product Descriptions Correctly Identified as Cyber Threats by HANDA while Missed by the Baseline Method.} \label{table_threat} \begin{tabular}{|M{0.1\linewidth}|M{0.07\linewidth}|M{0.27\linewidth}|M{0.28\linewidth}|M{0.09\linewidth}|M{0.08\linewidth}|} \hline & Language & Product Description Excerpt & Translation by Native Speaker & Cyber Threat Category & HANDA Confidence Score\\ \hline \raisebox{-.3\height}{\includegraphics[scale=.9]{cell_1}} & Russian & ‘‘\begin{otherlanguage*}{russian}банковской карты без физического носителя.После покупки вы получите данные в следующем формате:[…]. \end{otherlanguage*}’’ & Bank card data without physical media. After the purchase, you will receive data in the following format: […]. & Stolen financial credentials & 0.9\\ \hline \raisebox{-.3\height}{\includegraphics[scale=1]{cell_2}} & Russian & ‘‘\begin{otherlanguage*}{russian}Взлом GMAIL.COM-Клиент сообщает предмет взлома|ID жертвы и.т.п[…] После взлома, клиент получает доказательства проделанной работы.-Оплата заказа […].\end{otherlanguage*}’’ & Hacking GMAIL.COM-The client reports the subject of hacking | victim ID, etc.[…]-After hacking, the client receives evidence of the work done […]. & E-mail hacking service & 0.9 \\ \hline \raisebox{-.3\height}{\includegraphics[scale=1]{cell_3}} & French & ‘‘\begin{otherlanguage*}{french}Ce logiciel vous permet de checker vos logs pour trouver ceux qui ont un accés à la boite email. Une fois un email:pass valide trouver une option vous permet de télécharger tous les documents de cette boite email […].\end{otherlanguage*}’’ & This software allows you to check your logs to find those who have access to the mailbox. Once you have found a valid email: pass, there will be an option that will let you download all the documents from that mailbox […]. & E-mail hacking tool & 0.7 \\ \hline \raisebox{-.3\height}{\includegraphics[scale=0.9]{cell_4}} & French & ‘‘\begin{otherlanguage*}{french}Un pack de 3 différents botnet rare avec 5 RAT et trojan, pour vos intrusions les plus importantes. Des centaines de pc victimes obéïssant à tous vos ordres […] .\end{otherlanguage*}’’ & A pack of 3 different rare botnets with 5 RAT and Trojan, for your most important intrusions. Hundreds of pc victims obeying all your orders […]. & Trojan & 0.6 \\ \hline \end{tabular} \end{table*} \selectlanguage{english} \section{Conclusion and Future Directions} Given the growing adoption of machine learning models to analyze novel online markets, adapting previously learned models to unseen domains is a promising strategy. The adaptation process is challenging when dealing with heterogeneous domains where the source and target domains differ in both feature space and data distribution. This poses a significant problem in e-commerce and emerging fields such as cybersecurity. HDA is a crucial approach to address this emerging challenge. However, most extant HDA methods focus on minimizing the distance via non-neural representations, which may suffer from a lack of transferability. Adversarially learned representations have been shown to yield more transferrable representations. Nonetheless, they are not designed for HDA problems. To address this gap, we developed a novel framework for Heterogeneous Adversarial Neural Domain Adaptation (HANDA), a neural network architecture that employs dictionary learning and nonparametric adversarial kernel matching to jointly minimize the feature space discrepancy and distribution divergence in a unified architecture. HANDA extends adversarial domain adaptation for heterogeneous domains and incorporates shared dictionary learning in a neural network architecture to benefit from labeled data. We conducted in-depth evaluations to evaluate HANDA’s performance against state-of-the-art HDA methods in two benchmark learning tasks in common e-commerce applications (i.e., product image recognition and multilingual text classification). HANDA improves the classification performance on the benchmark datasets with statistically significant results. HANDA can be employed to improve product search and indexing in online markets. We also showed the advantage of utilizing HANDA in emerging dark web online markets. HANDA is able to better identify cyber threats among the products sold on dark web online markets. Two promising future directions are envisioned. First, improving the interpretability of the model by incorporating components such as attention mechanism can shed light on the DA process in HANDA. Second, given the prevalence of sequence data in e-commerce applications, extending HANDA to account for the temporal factor in sequential inputs is another promising area in HDA research. \selectlanguage{english} \ifCLASSOPTIONcompsoc \section*{Acknowledgments} \else \section*{Acknowledgment} \fi This material is based upon work supported by the National Science Foundation (NSF) under grants CNS-1936370 (SaTC CORE) and OAC-1917117 (CICI). Yidong Chai was supported in part by the NSFC (91846201, 72101079), Shanghai Data Exchange Cooperative Program (W2021JSZX0052), and is the corresponding author. \ifCLASSOPTIONcaptionsoff \newpage \fi \selectlanguage{english} \bibliographystyle{IEEEtran}
\section*{Accessibility} \newpage \section{Introduction}\label{sec:intro} To tackle the issue of expensive labeling processes, few-shot learning (FSL) paradigm was proposed\,\citep{fink2004object, fei2006one}. FSL aims to recognize \emph{novel} classes using few samples in the target data. Novel classes are disjoint from \emph{base} classes in the source data but similar to base classes. However, in real-world scenarios, it is hard to obtain labeled target data from certain domains such as X-ray images, which inevitably leads to using dissimilar labeled source data for pre-training\,\citep{guo2020broader, oh2022understanding}. Cross-domain few-shot learning (CD-FSL) has recently been studied to address this practicality, which is more challenging than traditional FSL due to the distributional gap between the source and target data. There are two main approaches for (CD-)FSL: meta-learning and transfer learning. Meta-learning approaches optimize a generalized model that adapts to new tasks quickly\,\citep{koch2015siamese, vinyals2016matching, snell2017prototypical, finn2017model}. In contrast, transfer learning approaches aim to transfer knowledge from general source tasks to few-shot target tasks, based on the capacity of deep networks\,\citep{chen2019closer, dhillon2019baseline, wang2019simpleshot}. Recently, \citet{guo2020broader} proposed a new benchmark for CD-FSL, Broader Study of CD-FSL (BSCD-FSL), and showed that transfer learning approaches outshine meta-learning ones. Based on these observations, CD-FSL algorithms have focused on the pre-training phase to extract improved and universal representation by exploiting unlabeled target data under a transfer learning framework\,\citep{phoo2020self, islam2021dynamic}. However, despite the recent attention in (CD-)FSL \citep{phoo2020self, liang2021boosting, hu2022switch}, most of the prior works follow a conventional updating strategy, which updates a new classifier using few samples without data augmentation. Only few studies have addressed how to update a pre-trained model for FSL. For instance, \citet{guo2020broader} provided few-shot performance according to the updating parts, but they did not include extreme few-shot cases. \citet{ni2021data} highlighted that flipping on few target samples could improve the performance, but they did not consider augmentation methods other than flipping and cropping. In this paper, we focus on \emph{how to maximally leverage a pre-trained model with few target samples}. Therefore, we pose two fundamental questions: under (CD-)FSL, (1) between fine-tuning (i.e., updating the entire network, FT) and linear probing (i.e., updating only the linear classifier, LP), which is better and why? (2) can data augmentation techniques overcome the challenge of target data shortage? Our answers are as follows: (1) FT is a better strategy than LP as the number of samples increases, and the trend is reversed because FT with extremely few samples can distort representation. (2) Most of the existing augmentation techniques decrease the few-shot performance. \section{Related Works}\label{sec:related} Additional related works about few-shot learning and data augmentations are provided in Appendix \ref{appx:related}. \textbf{Fine-tuning vs. Linear Probing.} Most of the works on updating pre-trained models have been mainly studied for language tasks\,\citep{dodge2020fine, zhao2021closer, zhou2021closer}. In general computer vision setting, transfer learning and updating methods gained much attention\,\citep{zhai2019large, kornblith2019better, ericsson2021well, kumar2022finetuning}. \citet{kornblith2019better} show that FT outperforms both updating a classifier\,(i.e., LP) and training from scratch, by investigation on many-shot target datasets using different backbone models. Meanwhile, \citet{kumar2022finetuning} demonstrate that FT can distort pre-trained representation on out-of-distribution (OOD) tasks, where datasets for updating and evaluation are different. They further show that LP $\rightarrow$ FT updates can remedy this distortion. \textbf{Data Augmentation in FSL.} Many studies have been conducted to remedy the lack of target samples by data generation\,\citep{yang2021free, kumar2022gdc} or augmentation\,\citep{mangla2020charting, ni2021data}. Generation-based algorithms sample target representation from the calibrated target distribution based on source distribution. S2M2\,\citep{mangla2020charting} utilizes Manifold MixUp loss\,\citep{verma2019manifold} that works as a feature-level augmentation in pre-training. \citet{ni2021data} analyze the effectiveness of data augmentation in the meta-learning pipeline and propose Meta-MaxUp for pre-training. However, for few samples augmentation (``shot augmentation'' in their paper), only RCrop and Hflip are considered. Unlike prior works, we investigate the efficacy of various data augmentation for few samples, considering the distribution shift challenge. \section{Preliminaries}\label{sec:preliminaries} \subsection{Problem Setup} We explain the training (pre-training and updating) and evaluation procedure of transfer learning approaches. Formally, a model $h_{\sf 1} \circ f$ is trained on labeled source data $\mathcal{D}_{B}$ in the pre-training phase, where $f$ is a feature extractor (i.e., backbone) and $h_{\sf 1}$ is a linear classifier for pre-training. The pre-trained classifier $h_{\sf 1}$ is then replaced with a randomly initialized linear classifier $h_{\sf 2}$ to recognize novel classes $\mathcal{C}_{N}$. Finally, (1) $h_{\sf 2} \circ f$ is updated (i.e., fine-tuning) or (2) only $h_{\sf 2}$ is updated (i.e., linear probing) on few labeled target data $\mathcal{D}_{S}$ and evaluated on $\mathcal{D}_{Q}$. Here, $(\mathcal{D}_{S}, \mathcal{D}_{Q})$ is sampled from labeled target data $\mathcal{D}_{N}$ in an episodic way. Namely, $n$ classes are sampled from novel classes $\mathcal{C}_{N}$, while $k$ and $k_q$ examples per class are sampled to form $\mathcal{D}_{S}$ and $\mathcal{D}_{Q}$, respectively. Thus, $\mathcal{D}_{S}$ and $\mathcal{D}_{Q}$ are defined as $\{(x_i^s,y_i^s)\}_{i=1}^{n \times k}$ and $\{(x_i^q,y_i^q)\}_{i=1}^{n \times k_q}$, and each is called a support set and a query set. This problem setting is referred to as the $n$-way $k$-shot classification problem, where $n=5$ and $k \in \{1,5,20\}$ in general. The reported few-shot performance is averaged over 600 episodes. We pre-train ResNet10 on miniImageNet (miniIN) and ResNet18 on tieredImageNet (tieredIN), and then update them on ten target datasets: miniIN, tieredIN, four non-BSCD-FSL (Places, Plantae, Cars, and CUB), and four BSCD-FSL (CropDiseases, EuroSAT, ISIC, and ChestX). We follow the detailed setup of datasets and implementations from prior works\,\citep{guo2020broader, oh2022understanding}, which is described in Appendix \ref{appx:setup}. \subsection{Data Augmentation Techniques} For our study, we exploit the two types of data augmentation techniques: basic image manipulation and data-mixing. The former includes horizontal flipping, random cropping, and color jittering, and the latter includes MixUp\,\citep{zhang2017mixup} and CutMix\,\citep{yun2019cutmix}. The details of augmentation methods are explained in Appendix \ref{appx:DA}. \section{Fine-tuning vs. Linear Probing for CD-FSL}\label{sec:analysis1} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figure/why_full/why_full1.pdf} \includegraphics[width=\linewidth]{figure/why_full/why_full2.pdf} \caption{5-way $k$-shot performance difference of FT with LP on various target datasets. ResNet10 pre-trained on miniIN is updated. The detailed values are reported in Appendix \ref{appx:FT_LP_tiered}.} \label{fig:why_full} \end{figure} \begin{figure}[t] \centering \begin{subfigure}[h]{0.34\linewidth} \includegraphics[width=\linewidth]{figure/v_score/cub_01shot_main.pdf} \caption{CUB ($k=1$)} \end{subfigure} \begin{subfigure}[h]{0.31\linewidth} \includegraphics[width=\linewidth]{figure/v_score/cub_05shot_main.pdf} \caption{CUB ($k=5$)} \end{subfigure} \begin{subfigure}[h]{0.31\linewidth} \includegraphics[width=\linewidth]{figure/v_score/cub_20shot_main.pdf} \caption{CUB ($k=20$)} \end{subfigure} \caption{Feature extractor's clustering ability by V-measure and performance differences between LP and FT. Each dot indicates an episode. The color denotes $Acc_{\sf FT}-Acc_{\sf LP}$. Red means FT outperforms LP, whereas blue means LP outperforms FT.} \label{fig:v_measure_main} \end{figure} We compare popular updating methods, FT and LP, under different distributional gaps. Figure \ref{fig:why_full} describes the performance difference of FT and LP (i.e., $Acc_{\sf FT}-Acc_{\sf LP}$) on various target datasets, according to the number of samples for updating a pre-trained model. Note that non-BSCD-FSL datasets are more similar to the source data than BSCD-FSL datasets\,\citep{ericsson2021well}. It is observed that shot is a more critical factor than distributional difference to decide how to update the pre-trained model. In line with the observation that FT is a better strategy than LP\,\citep{kornblith2019better, zhai2019large, kumar2022finetuning}, our results support that it even holds for few-shot. The results of ResNet18 pre-trained on tieredIN show the same trend, which is reported in Appendix \ref{appx:FT_LP_tiered}. However, LP is better than FT when there is only one sample for each class (i.e., $1$-shot) in most target datasets. This is because FT with extremely few samples can distort the representation of a query set for evaluation, weakening the extractor's clustering ability. To understand the effectiveness of FT for learning representation, we analyze the V-measurement cluster score\,\citep{rosenberg2007v} before and after FT. Figure \ref{fig:v_measure_main} describes the relationship between changes in performance and V-measure over 600 episodes. Each dot indicates a query set of an episode, and the x-axis and y-axis indicate the V-measure of the updated model through LP and FT, respectively. Note that LP keeps the same extractor of the pre-trained model, while FT updates the pre-trained extractor using few target data. The red color means FT outperforms LP, whereas the blue color means LP outperforms FT. V-measure is defined by 1) K-Means clustering on representations of a query set using a pre-trained extractor\,(i.e., LP) and an updated extractor\,(i.e., FT), then 2) calculating the agreement between the ground-truth and predicted K-Means clusters. The higher the V-measure score, the better the clustering ability of the feature extractor. Note that values of 0 and 1 indicate no agreement and maximum agreement, respectively. Figure \ref{fig:v_measure_main}a, \ref{fig:v_measure_main}b, and \ref{fig:v_measure_main}c describe $1$-, $5$-, and $20$-shot cases on CUB, respectively. For the 1-shot case, most episodes are located below $y=x$ (the gray region in Figure \ref{fig:v_measure_main}), which means that the V-measure decreases by FT. This implies updating a pre-trained extractor with one sample per class distorts the representation of a query set for clustering. In this context, most episodes have a color close to blue because LP's performance is higher than FT's performance. On the contrary, for the 5-shot case, most episodes are located above $y=x$ (the white region in Figure \ref{fig:v_measure_main}) and have a color close to red. For the 20-shot case, the increase in V-measure and performance is more significant, implying that FT forms even better clusters than LP as the shot increases. Therefore, \emph{``FT is better than LP'' holds even with few samples}. Few samples can improve the clustering ability of a pre-trained extractor, and this improvement has a greater effect with more samples. The results on other datasets are depicted in Appendix \ref{appx:v_measure_other}. \section{Data Augmentation for CD-FSL}\label{sec:analysis2} Based on the observations in Section \ref{sec:analysis1}, we conclude that FT with \emph{few samples} (e.g., 20-shot on most datasets) could improve few-shot performance. To generate more samples, we can use data augmentation, which is known to prevent overfitting caused by the lack of variations of data\,\citep{perez2017effectiveness}. In this section, we study data augmentation techniques for CD-FSL during fine-tuning.~\footnote{The result of LP with data augmentation is reported in Appendix \ref{appx:DA_LP}.} \subsection{FT with Data Augmentation}\label{subsec:ft_da} \begin{table}[t] \centering \caption{5-way 20-shot performance according to data augmentation techniques. The pre-trained ResNet10 on miniIN is fine-tuned.}\label{tab:miniIN_20_shot_da} \vskip 0.10in \scriptsize\addtolength{\tabcolsep}{-2.8pt} \begin{tabular}{lccccc} \toprule Aug. & miniIN & \!\!\!tieredIN\!\!\! & Places & Plantae & Cars \\ \midrule - & 87.38{\fontsize{6pt}{6pt}\selectfont$\pm$.41} & 84.40{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 81.88{\fontsize{6pt}{6pt}\selectfont$\pm$.53} & 69.35{\fontsize{6pt}{6pt}\selectfont$\pm$.71} & 71.10{\fontsize{6pt}{6pt}\selectfont$\pm$.65} \\ $+$ HFlip & 87.55{\fontsize{6pt}{6pt}\selectfont$\pm$.41} & 84.61{\fontsize{6pt}{6pt}\selectfont$\pm$.57} & 82.20{\fontsize{6pt}{6pt}\selectfont$\pm$.53} & 70.21{\fontsize{6pt}{6pt}\selectfont$\pm$.73} & 73.42{\fontsize{6pt}{6pt}\selectfont$\pm$.65} \\ $+$ RCrop & 84.70{\fontsize{6pt}{6pt}\selectfont$\pm$.46} & 82.98{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 81.39{\fontsize{6pt}{6pt}\selectfont$\pm$.54} & 70.84{\fontsize{6pt}{6pt}\selectfont$\pm$.72} & 69.96{\fontsize{6pt}{6pt}\selectfont$\pm$.63} \\ $+$ CJitter & 87.14{\fontsize{6pt}{6pt}\selectfont$\pm$.43} & 84.46{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 82.09{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 70.20{\fontsize{6pt}{6pt}\selectfont$\pm$.75} & 71.12{\fontsize{6pt}{6pt}\selectfont$\pm$.66} \\ $+$ Base aug. & 85.83{\fontsize{6pt}{6pt}\selectfont$\pm$.43} & 83.49{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 81.77{\fontsize{6pt}{6pt}\selectfont$\pm$.52} & 71.69{\fontsize{6pt}{6pt}\selectfont$\pm$.70} & 71.62{\fontsize{6pt}{6pt}\selectfont$\pm$.61} \\ $+$ MixUp & 81.34{\fontsize{6pt}{6pt}\selectfont$\pm$.49} & 82.44{\fontsize{6pt}{6pt}\selectfont$\pm$.61} & 78.78{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 67.62{\fontsize{6pt}{6pt}\selectfont$\pm$.76} & 69.98{\fontsize{6pt}{6pt}\selectfont$\pm$.65} \\ $+$ CutMix & 84.51{\fontsize{6pt}{6pt}\selectfont$\pm$.47} & 82.99{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 80.86{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 68.22{\fontsize{6pt}{6pt}\selectfont$\pm$.71} & 69.28{\fontsize{6pt}{6pt}\selectfont$\pm$.65} \\ \midrule Aug. & CUB & CropDiseases & EuroSAT & ISIC & ChestX \\ \midrule - & 76.08{\fontsize{6pt}{6pt}\selectfont$\pm$.69} & 97.89{\fontsize{6pt}{6pt}\selectfont$\pm$.22} & 92.88{\fontsize{6pt}{6pt}\selectfont$\pm$.35} & 62.98{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 32.98{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ $+$ HFlip & 77.77{\fontsize{6pt}{6pt}\selectfont$\pm$.67} & 98.15{\fontsize{6pt}{6pt}\selectfont$\pm$.21} & 93.35{\fontsize{6pt}{6pt}\selectfont$\pm$.32} & 63.48{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 31.52{\fontsize{6pt}{6pt}\selectfont$\pm$.44} \\ $+$ RCrop & 76.33{\fontsize{6pt}{6pt}\selectfont$\pm$.63} & 97.55{\fontsize{6pt}{6pt}\selectfont$\pm$.22} & 90.81{\fontsize{6pt}{6pt}\selectfont$\pm$.39} & 60.11{\fontsize{6pt}{6pt}\selectfont$\pm$.65} & 34.24{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ $+$ CJitter & 76.41{\fontsize{6pt}{6pt}\selectfont$\pm$.68} & 97.73{\fontsize{6pt}{6pt}\selectfont$\pm$.22} & 92.64{\fontsize{6pt}{6pt}\selectfont$\pm$.34} & 60.32{\fontsize{6pt}{6pt}\selectfont$\pm$.61} & 33.06{\fontsize{6pt}{6pt}\selectfont$\pm$.45} \\ $+$ Base aug. & 78.21{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 97.47{\fontsize{6pt}{6pt}\selectfont$\pm$.22} & 91.74{\fontsize{6pt}{6pt}\selectfont$\pm$.35} & 60.12{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 34.37{\fontsize{6pt}{6pt}\selectfont$\pm$.47} \\ $+$ MixUp & 75.18{\fontsize{6pt}{6pt}\selectfont$\pm$.66} & 96.32{\fontsize{6pt}{6pt}\selectfont$\pm$.29} & 85.43{\fontsize{6pt}{6pt}\selectfont$\pm$.50} & 61.33{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 31.62{\fontsize{6pt}{6pt}\selectfont$\pm$.47} \\ $+$ CutMix & 72.25{\fontsize{6pt}{6pt}\selectfont$\pm$.68} & 97.75{\fontsize{6pt}{6pt}\selectfont$\pm$.23} & 91.84{\fontsize{6pt}{6pt}\selectfont$\pm$.38} & 56.75{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 32.04{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ \bottomrule \end{tabular} \vspace{-20pt} \end{table} Although data augmentation generally leads to performance improvement, no significant performance gain occurs overall, and it rather has a negative effect under (CD-)FSL. Table \ref{tab:miniIN_20_shot_da} describes 5-way 20-shot performance of FT with data augmentation, including basic image manipulations and data-mixing methods. Base augmentation\,(Base aug.) simultaneously applies horizontal flip\,(HFlip), random crop\,(RCrop), and color jitter\,(CJitter). Among the augmentation techniques, only HFlip consistently improves performance under (CD-)FSL except for ChestX, which is also observed in \citet{ni2021data}. However, other simple image manipulation methods and data-mixing augmentation methods can decrease the performance under few-shot settings. We thought that under FSL, small transformation spaces of HFlip (i.e., only two original or flipped images) can increase the performance. The results of other shot are reported in Appendix \ref{appx:few_shot_da}. \subsection{Performance Degradation of MixUp}\label{subsec:mixup} \begin{figure}[t] \centering \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/v_score/20shot_mini_test_mixup.pdf} \caption{miniIN ($k=20$)} \end{subfigure} \hspace{4pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/v_score/20shot_euro_mixup.pdf} \caption{EuroSAT ($k=20$)} \end{subfigure} \vspace{-5pt} \caption{Feature extractor's clustering ability by V-measure and performance differences between FT and FT(MixUp). Each dot indicates an episode. The color denotes $Acc_{\sf FT(MixUp)}-Acc_{\sf FT}$. Red means FT(MixUp) outperforms FT, whereas blue means FT outperforms FT(MixUp).} \label{fig:v_measure_aug} \vspace{-12pt} \end{figure} \begin{table}[t] \caption{5-way $k$-shot performance according to decomposition of MixUp. W and B indicate MixUp within the same class (for $k>1$) and MixUp between different classes, respectively.}\label{tab:mixup_decomp} \vskip 0.05in \centering \footnotesize\addtolength{\tabcolsep}{-2pt} \resizebox{\linewidth}{!}{ \begin{tabular}{ccccccc} \toprule $k$ & MixUp & miniIN & \!\!\!CropDiseases\!\!\! & EuroSAT & ISIC & ChestX \\ \midrule \multirow{2}{*}{1} & - & 49.57{\scriptsize$\pm$.79} & 66.78{\scriptsize$\pm$.91} & 56.45{\scriptsize$\pm$.84} & 31.03{\scriptsize$\pm$.55} & 22.35{\scriptsize$\pm$.38} \\ & B & 46.50{\scriptsize$\pm$.79} & 64.62{\scriptsize$\pm$.93} & 50.12{\scriptsize$\pm$.78} & 30.42{\scriptsize$\pm$.55} & 22.16{\scriptsize$\pm$.38} \\ \midrule \multirow{4}{*}{5} & - & 75.67{\scriptsize$\pm$.65} & 92.14{\scriptsize$\pm$.49} & 82.58{\scriptsize$\pm$.60} & 48.35{\scriptsize$\pm$.62} & 26.30{\scriptsize$\pm$.24} \\ & W+B & 71.61{\scriptsize$\pm$.67} & 90.54{\scriptsize$\pm$.54} & 75.42{\scriptsize$\pm$.68} & 47.92{\scriptsize$\pm$.62} & 26.08{\scriptsize$\pm$.41} \\ & W & 74.30{\scriptsize$\pm$.66} & 91.88{\scriptsize$\pm$.53} & 81.79{\scriptsize$\pm$.62} & 49.04{\scriptsize$\pm$.63} & 26.47{\scriptsize$\pm$.42} \\ & B & 70.89{\scriptsize$\pm$.67} & 90.07{\scriptsize$\pm$.55} & 73.27{\scriptsize$\pm$.68} & 47.46{\scriptsize$\pm$.62} & 26.31{\scriptsize$\pm$.43} \\ \midrule \multirow{4}{*}{20} & - & 87.38{\scriptsize$\pm$.41} & 97.89{\scriptsize$\pm$.22} & 92.88{\scriptsize$\pm$.35} & 62.98{\scriptsize$\pm$.60} & 32.98{\scriptsize$\pm$.46} \\ & W+B & 81.34{\scriptsize$\pm$.49} & 96.32{\scriptsize$\pm$.29} & 85.43{\scriptsize$\pm$.50} & 61.33{\scriptsize$\pm$.58} & 31.62{\scriptsize$\pm$.47} \\ & W & 85.98{\scriptsize$\pm$.44} & 97.19{\scriptsize$\pm$.26} & 91.65{\scriptsize$\pm$.40} & 62.56{\scriptsize$\pm$.58} & 33.23{\scriptsize$\pm$.48} \\ & B & 84.18{\scriptsize$\pm$.46} & 96.58{\scriptsize$\pm$.29} & 87.98{\scriptsize$\pm$.47} & 61.40{\scriptsize$\pm$.61} & 32.07{\scriptsize$\pm$.45} \\ \bottomrule \end{tabular}} \vspace{-12pt} \end{table} In Table \ref{tab:miniIN_20_shot_da}, MixUp has the most significant performance degradation regardless of distribution shifts. This is explained by Figure \ref{fig:v_measure_aug}, which is similar to Figure \ref{fig:v_measure_main} by replacing LP with FT and FT with FT(MixUp). FT(MixUp) denotes FT with MixUp. Figure \ref{fig:v_measure_aug}a represents a 20-shot case on miniIN, which is the same as the source domain, whereas Figure \ref{fig:v_measure_aug}b represents a 5-shot case on EuroSAT, which is dissimilar to the source domain. For both datasets, it is shown that FT with MixUp can distort the representation of a query set more than FT without MixUp. The results on different datasets are reported in Appendix \ref{appx:v_measure_other_mixup}. To determine which factor causes performance degradation, we decompose MixUp into MixUp within the same class (W in Table \ref{tab:mixup_decomp}) and MixUp between different classes (B in Table \ref{tab:mixup_decomp}). Table \ref{tab:mixup_decomp} shows the performance according to the decomposition of MixUp. In the original MixUp paper\,\citep{zhang2017mixup}, it is demonstrated that MixUp between different classes (B in Table \ref{tab:mixup_decomp}) is the key factor in improving performance. However, under the few-shot setting, this factor deteriorates performance, which contradicts the belief in the standard setting. It implies that the benefit from interpolating different classes arises based on many samples. \subsection{Scheduling Data Augmentation}\label{subsec:scheduling} \begin{table}[t] \caption{5-way $k$-shot performance according to the data augmentation scheduler. The pre-trained ResNet10 on miniIN is fine-tuned. ``-'' and ``1-100'' indicate no augmentation and augmentation during all epochs, respectively.}\label{tab:scheduling} \vskip 0.05in \centering \scriptsize\addtolength{\tabcolsep}{-3.2pt} \resizebox{\linewidth}{!}{ \begin{tabular}{ccccccc} \toprule $k$ & Aug. epochs & miniIN & \!\!\!CropDiseases\!\!\! & EuroSAT & ISIC & ChestX \\ \midrule \multirow{5}{*}{1} & \!\!- & 49.57{\fontsize{6pt}{6pt}\selectfont$\pm$.79} & 66.78{\fontsize{6pt}{6pt}\selectfont$\pm$.91} & 56.45{\fontsize{6pt}{6pt}\selectfont$\pm$.84} & 31.03{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 22.35{\fontsize{6pt}{6pt}\selectfont$\pm$.38} \\ & \,\,\,\,1-100 & 46.50{\fontsize{6pt}{6pt}\selectfont$\pm$.79} & 64.62{\fontsize{6pt}{6pt}\selectfont$\pm$.93} & 50.12{\fontsize{6pt}{6pt}\selectfont$\pm$.78} & 30.42{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 22.16{\fontsize{6pt}{6pt}\selectfont$\pm$.38} \\ & \,31-100 & 46.61{\fontsize{6pt}{6pt}\selectfont$\pm$.77} & 64.44{\fontsize{6pt}{6pt}\selectfont$\pm$.91} & 50.60{\fontsize{6pt}{6pt}\selectfont$\pm$.84} & 30.64{\fontsize{6pt}{6pt}\selectfont$\pm$.53} & 22.20{\fontsize{6pt}{6pt}\selectfont$\pm$.38} \\ & \,1-70 & 47.16{\fontsize{6pt}{6pt}\selectfont$\pm$.81} & 64.64{\fontsize{6pt}{6pt}\selectfont$\pm$.95} & 54.66{\fontsize{6pt}{6pt}\selectfont$\pm$.83} & 30.96{\fontsize{6pt}{6pt}\selectfont$\pm$.56} & 22.13{\fontsize{6pt}{6pt}\selectfont$\pm$.37} \\ & \,31-70\,\,\, & 48.54{\fontsize{6pt}{6pt}\selectfont$\pm$.81} & 65.44{\fontsize{6pt}{6pt}\selectfont$\pm$.90} & 55.60{\fontsize{6pt}{6pt}\selectfont$\pm$.84} & 30.88{\fontsize{6pt}{6pt}\selectfont$\pm$.57} & 22.14{\fontsize{6pt}{6pt}\selectfont$\pm$.38} \\ \midrule \multirow{5}{*}{5} & \!\!- & 75.67{\fontsize{6pt}{6pt}\selectfont$\pm$.65} & 92.14{\fontsize{6pt}{6pt}\selectfont$\pm$.49} & 82.58{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 48.35{\fontsize{6pt}{6pt}\selectfont$\pm$.62} & 26.30{\fontsize{6pt}{6pt}\selectfont$\pm$.24} \\ & \,\,\,\,1-100 & 71.61{\fontsize{6pt}{6pt}\selectfont$\pm$.67} & 90.54{\fontsize{6pt}{6pt}\selectfont$\pm$.54} & 75.42{\fontsize{6pt}{6pt}\selectfont$\pm$.68} & 47.92{\fontsize{6pt}{6pt}\selectfont$\pm$.62} & 26.08{\fontsize{6pt}{6pt}\selectfont$\pm$.41} \\ & \,31-100 & 71.93{\fontsize{6pt}{6pt}\selectfont$\pm$.66} & 90.47{\fontsize{6pt}{6pt}\selectfont$\pm$.55} & 74.76{\fontsize{6pt}{6pt}\selectfont$\pm$.67} & 47.49{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 24.99{\fontsize{6pt}{6pt}\selectfont$\pm$.41} \\ & \,1-70 & 74.16{\fontsize{6pt}{6pt}\selectfont$\pm$.66} & 91.69{\fontsize{6pt}{6pt}\selectfont$\pm$.52} & 81.38{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 48.99{\fontsize{6pt}{6pt}\selectfont$\pm$.63} & 26.25{\fontsize{6pt}{6pt}\selectfont$\pm$.43} \\ & \,31-70\,\,\, & 74.80{\fontsize{6pt}{6pt}\selectfont$\pm$.65} & 91.58{\fontsize{6pt}{6pt}\selectfont$\pm$.53} & 81.35{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 48.00{\fontsize{6pt}{6pt}\selectfont$\pm$.63} & 26.12{\fontsize{6pt}{6pt}\selectfont$\pm$.40} \\ \midrule \multirow{5}{*}{20} & \!\!- & 87.38{\fontsize{6pt}{6pt}\selectfont$\pm$.41} & 97.89{\fontsize{6pt}{6pt}\selectfont$\pm$.22} & 92.88{\fontsize{6pt}{6pt}\selectfont$\pm$.35} & 62.98{\fontsize{6pt}{6pt}\selectfont$\pm$.60} & 32.98{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ & \,\,\,\,1-100 & 81.34{\fontsize{6pt}{6pt}\selectfont$\pm$.49} & 96.32{\fontsize{6pt}{6pt}\selectfont$\pm$.29} & 85.43{\fontsize{6pt}{6pt}\selectfont$\pm$.50} & 61.33{\fontsize{6pt}{6pt}\selectfont$\pm$.58} & 31.62{\fontsize{6pt}{6pt}\selectfont$\pm$.47} \\ & \,31-100 & 84.30{\fontsize{6pt}{6pt}\selectfont$\pm$.46} & 96.79{\fontsize{6pt}{6pt}\selectfont$\pm$.28} & 88.77{\fontsize{6pt}{6pt}\selectfont$\pm$.46} & 61.44{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 32.32{\fontsize{6pt}{6pt}\selectfont$\pm$.47} \\ & \,1-70 & 86.84{\fontsize{6pt}{6pt}\selectfont$\pm$.42} & 97.54{\fontsize{6pt}{6pt}\selectfont$\pm$.25} & 92.67{\fontsize{6pt}{6pt}\selectfont$\pm$.35} & 63.18{\fontsize{6pt}{6pt}\selectfont$\pm$.61} & 32.94{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ & \,31-70\,\,\, & 87.04{\fontsize{6pt}{6pt}\selectfont$\pm$.42} & 97.63{\fontsize{6pt}{6pt}\selectfont$\pm$.23} & 92.73{\fontsize{6pt}{6pt}\selectfont$\pm$.35} & 62.64{\fontsize{6pt}{6pt}\selectfont$\pm$.59} & 32.93{\fontsize{6pt}{6pt}\selectfont$\pm$.46} \\ \bottomrule \end{tabular}} \end{table} Furthermore, we investigate whether scheduling data augmentation affects few-shot performance because a fine-tuned model with data augmentation distorts the representation of a query set. In other words, a model is fine-tuned with an augmented support set $D_S$, however, evaluated on a clean (i.e., non-augmented) query set $D_Q$, in our MixUp experiments. This \emph{support-query distribution shift} can potentially decrease performance. To alleviate this problem, we propose an augmentation scheduler that applies data augmentation to a certain range of epochs. Table \ref{tab:scheduling} shows the few-shot performance according to the augmentation scheduler with MixUp augmentation during FT. In the original setting, a pre-trained model is updated for 100 epochs. It is observed that an augmentation scheduler without augmentation at later epochs\,(i.e., 1-70 and 31-70 in Table \ref{tab:scheduling}) outperforms an augmentation scheduler including augmentation at later epochs\,(i.e., 1-100 and 31-100 in Table \ref{tab:scheduling}). This demonstrates the significance of learning non-augmented data before evaluating on a query set to remedy support-query distribution shift. Therefore, we conclude that for FSL, both methods and scheduling of data augmentation cannot be easily applied based on general rules. \section{Conclusion and Future Works}\label{sec:conclusion} We focused on maximally leveraging pre-trained models with few target samples. We showed that FT is a better strategy than LP as the shot increases, even in 5-shot; however, FT can distort representation in the extreme case (i.e., 1-shot). In this context, we investigated data augmentation for few samples and concluded that data augmentation in general settings could not be directly applied for FSL. For future works, we further provide many discussions on the updatable model for (CD-)FSL in Appendix \ref{appx:discussion}, such as the instability within an episode or layer difference by FT. In addition, we believe that there is a connection between FT with extremely few samples (e.g., 1-shot) and FT on OOD studied in \citet{kumar2022finetuning} because FT distorts pre-trained representation in both cases. We hope that our observations will inspire updatable methods such as augmentation techniques or scheduling for (CD-)FSL. \section{Setup Details}\label{appx:setup} \subsection{Dataset Details} We employ two source datasets and ten target datasets (including two source datasets) for cross-domain scenario, following the same dataset setting with \citet{oh2022understanding}. \begin{itemize} \item We use miniImageNet\,\citep{vinyals2016matching} and tieredImageNet\,\citep{ren2018meta} as source datasets which are disjoint portions of ImageNet-1k\,\citep{deng2009imagenet}. MiniImageNet includes 64 classes for source data for pre-training and 20 classes for target data for updating. % Likewise, tieredImageNet has 351 classes and 160 classes for source and target data, respectively. % Cases when a model is pre-trained and updated by one of these datasets\,(e.g., tieredIN$\rightarrow$miniIN), are regarded as a single-domain scenario, where there is no domain shift between source and target data. \item We use BSCD-FSL\,\citep{guo2020broader} and non-BSCD-FSL datasets as target data. BSCD-FSL benchmark proposed by \citet{guo2020broader} includes CropDiseases, EuroSAT, ISIC, and ChestX\,(arranged in the order of similarity to source domain). CropDiseases\,\citep{mohanty2016using} is a plant disease dataset and EuroSAT\,\citep{helber2019eurosat} is a satellite image dataset. In addition, ISIC\,\citep{codella2019skin} and ChestX\,\citep{wang2017chestx} each include images of skin lesion and X-ray. % Similarly, non-BSCD-FSL includes Places\,\citep{zhou2017places}, Plantae\,\citep{van2018inaturalist}, Cars\,\citep{krause20133d} and CUB\,\citep{wah2011caltech} as target data. Each dataset contains images of different scene categories, plant species, car models and bird species, respectively. \end{itemize} \subsection{Implementation Details} We utilize the pre-training and updating setup from \citet{guo2020broader}. For pre-training, we utilize SGD optimizer with learning rate 0.01, momentum 0.9, and weight decay 0.0001, For ResNet10 pre-trained on miniIN, we train for 1000 epochs with batch size 64. For ResNet18 pre-trained on tieredIN, we train for 90 epochs with batch size 256. For updating, we use SGD optimizer with learning rate 0.01, momentum 0.9, and weight decay 0.001. Over 600 episodes, linear classifier alone\,(i.e., LP) or together with pre-trained extractor\,(i.e., FT) is updated for 100 epochs with batch size 4. We use $k$-shot settings where $k\in\{1, 5, 20\}$, and for 20-shot setting, batch size 16 is particularly used to match the number of iterations. \section{Data Augmentation}\label{appx:DA} We consider five commonly used data augmentation methods. \begin{itemize} \item Random Horizontal Flip\,(HFlip) flips an image horizontally with probability of 0.5. \item Random Resized Crop\,(RCrop) crops an image with a random ratio, and resize it to 224$\times$224. \item Color Jittering\,(CJitter) changes properties of an image including brightness, contrast, saturation and hue with probability of 1.0. \item MixUp\,\citep{zhang2017mixup} linearly interpolates each pixel of two images with a ratio of $\lambda \sim \beta(1, 1)$, which is sampled every epoch. The labels are mixed correspondingly. \item CutMix\,\citep{yun2019cutmix} crops one image with a ratio of $\lambda \sim \beta(1, 1)$, and pastes the cropped image onto the other image. $\lambda$ is sampled every epoch, and the labels are mixed with the ratio of areas between the cropped image and the original image. \end{itemize} Note that Base augmentation method\,(Base aug.) applies Hflip, RCrop, and CJitter simultaneously. \newpage \section{Detailed Results of FT and LP}\label{appx:FT_LP_tiered} To provide detailed results on Section \ref{sec:analysis1}, we provide the performance of FT and LP according to target dataset and the number of shots. Table \ref{tab:miniIN_perf} and Table \ref{tab:tieredIN_perf} show the performance of FT and LP using miniImageNet and tieredImageNet for pre-training, respectively. The better performance values between LP and FT are boldfaced. The results are also visualized in Figure \ref{fig:why_full_tiered}, performance difference of FT and LP (i.e., $Acc_{\sf FT}-Acc_{\sf LP}$) with ResNet18 pre-trained on tieredIN. As explained in Section \ref{sec:analysis1}, FT becomes better than LP as shot increases in most cases. Even in some cases where LP outperforms FT for all $k\in\{1, 5, 20\}$, the gap between accuracy of LP and FT decreases as shot increases. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{figure/why_full/why_full2_tiered.pdf} \caption{Performance difference of FT with LP on target datasets according to the shot $k$. ResNet18 is pre-trained on tieredIN.}\label{fig:why_full_tiered} \end{figure} \begin{table}[h] \caption{5-way $k$-shot performance according to target dataset. The backbone is ResNet10 pre-trained on miniIN.}\label{tab:miniIN_perf} \vskip 0.10in \centering \footnotesize\addtolength{\tabcolsep}{-3.2pt} \begin{tabular}{cccccccccccc} \toprule $k$ & Update & miniIN & tieredIN & Places & Plantae & Cars & CUB & CropDiseases & EuroSAT & ISIC & ChestX \\ \midrule \multirow{2}{*}{1} & LP & \textbf{56.47}{\scriptsize$\pm$.80} & \textbf{55.89}{\scriptsize$\pm$.96} & \textbf{52.23}{\scriptsize$\pm$.80} & \textbf{36.87}{\scriptsize$\pm$.67} & 29.11{\scriptsize$\pm$.54} & \textbf{40.42}{\scriptsize$\pm$.76} & \textbf{73.12}{\scriptsize$\pm$.88} & \textbf{64.72}{\scriptsize$\pm$.88} & 29.39{\scriptsize$\pm$.35} & \textbf{22.56}{\scriptsize$\pm$.40} \\ & {FT} & 49.57{\scriptsize$\pm$.79} & 49.10{\scriptsize$\pm$.90} & 45.44{\scriptsize$\pm$.79} & 33.35{\scriptsize$\pm$.59} & \textbf{29.49}{\scriptsize$\pm$.54} & 37.54{\scriptsize$\pm$.71} & 66.78{\scriptsize$\pm$.91} & 56.45{\scriptsize$\pm$.84} & \textbf{31.03}{\scriptsize$\pm$.55} & 22.35{\scriptsize$\pm$.38} \\ \midrule \multirow{2}{*}{5} & LP & \textbf{77.95}{\scriptsize$\pm$.61} & \textbf{74.79}{\scriptsize$\pm$.76} & \textbf{73.01}{\scriptsize$\pm$.67} & \textbf{53.85}{\scriptsize$\pm$.74} & 44.64{\scriptsize$\pm$.67} & 57.51{\scriptsize$\pm$.79} & 91.50{\scriptsize$\pm$.49} & \textbf{84.08}{\scriptsize$\pm$.60} & 40.39{\scriptsize$\pm$.55} & \textbf{26.56}{\scriptsize$\pm$.43} \\ & {FT} & 75.67{\scriptsize$\pm$.65} & 73.60{\scriptsize$\pm$.78} & 70.05{\scriptsize$\pm$.71} & 53.19{\scriptsize$\pm$.73} & \textbf{49.26}{\scriptsize$\pm$.70} & \textbf{59.35}{\scriptsize$\pm$.80} & \textbf{92.14}{\scriptsize$\pm$.49} & 82.58{\scriptsize$\pm$.60} & \textbf{48.35}{\scriptsize$\pm$.62} & 26.30{\scriptsize$\pm$.24} \\ \midrule \multirow{2}{*}{20} & LP & 86.64{\scriptsize$\pm$.43} & 83.27{\scriptsize$\pm$.60} & \textbf{81.90}{\scriptsize$\pm$.52} & 66.65{\scriptsize$\pm$.72} & 60.98{\scriptsize$\pm$.67} & 71.00{\scriptsize$\pm$.71} & 96.20{\scriptsize$\pm$.29} & 91.17{\scriptsize$\pm$.39} & 50.89{\scriptsize$\pm$.54} & 31.16{\scriptsize$\pm$.44} \\ & {FT} & \textbf{87.38}{\scriptsize$\pm$.41} & \textbf{84.40}{\scriptsize$\pm$.58} & 81.88{\scriptsize$\pm$.53} & \textbf{69.35}{\scriptsize$\pm$.71} & \textbf{71.10}{\scriptsize$\pm$.65} & \textbf{76.08}{\scriptsize$\pm$.69} & \textbf{97.89}{\scriptsize$\pm$.22} & \textbf{92.88}{\scriptsize$\pm$.35} & \textbf{62.98}{\scriptsize$\pm$.60} & \textbf{32.98}{\scriptsize$\pm$.46} \\ \bottomrule \end{tabular} \end{table} \begin{table}[h] \caption{5-way $k$-shot performance according to target dataset. The backbone is ResNet18 pre-trained on tieredIN. }\label{tab:tieredIN_perf} \vskip 0.10in \centering \footnotesize\addtolength{\tabcolsep}{-3.2pt} \begin{tabular}{cccccccccccc} \toprule $k$ & Update & miniIN & tieredIN & Places & Plantae & Cars & CUB & CropDiseases & EuroSAT & ISIC & ChestX\\ \midrule \multirow{2}{*}{1} & LP & \textbf{63.37}{\scriptsize$\pm$.80} & \textbf{61.03}{\scriptsize$\pm$.93} & \textbf{52.10}{\scriptsize$\pm$.87} & \textbf{38.51}{\scriptsize$\pm$.74} & \textbf{31.25}{\scriptsize$\pm$.61} & \textbf{58.00}{\scriptsize$\pm$.94} & \textbf{66.24}{\scriptsize$\pm$.90} & \textbf{61.91}{\scriptsize$\pm$.88} & 30.38{\scriptsize$\pm$.58} & \textbf{22.29}{\scriptsize$\pm$.39}\\ & \multirow{1}{*}{FT} & 53.34{\scriptsize$\pm$.82} & 52.76{\scriptsize$\pm$.88} & 43.66{\scriptsize$\pm$.76} & 33.06{\scriptsize$\pm$.63} & 30.64 {\scriptsize$\pm$.59} & 48.12{\scriptsize$\pm$.80} & 63.60{\scriptsize$\pm$.84} & 53.25{\scriptsize$\pm$.82} & \textbf{31.28}{\scriptsize$\pm$.59} & 22.08{\scriptsize$\pm$.39}\\ \midrule \multirow{2}{*}{5} & LP & \textbf{82.92}{\scriptsize$\pm$.52} & \textbf{78.97}{\scriptsize$\pm$.69} & \textbf{72.41}{\scriptsize$\pm$.69} & \textbf{55.08}{\scriptsize$\pm$.82} & 45.76{\scriptsize$\pm$.67} & \textbf{76.91}{\scriptsize$\pm$.79} & 86.82{\scriptsize$\pm$.59} & \textbf{79.72}{\scriptsize$\pm$.68} & 41.58{\scriptsize$\pm$.54} & 24.96{\scriptsize$\pm$.44}\\ & \multirow{1}{*}{FT} & 79.83{\scriptsize$\pm$.54} & 76.98{\scriptsize$\pm$.70} & 68.43{\scriptsize$\pm$74} & 52.50{\scriptsize$\pm$.80} & \textbf{47.58}{\scriptsize$\pm$.67} & 73.50{\scriptsize$\pm$.79} & \textbf{89.68}{\scriptsize$\pm$.53} & 79.09{\scriptsize$\pm$.63} & \textbf{48.08}{\scriptsize$\pm$.64} & \textbf{25.58}{\scriptsize$\pm$.44} \\ \midrule \multirow{2}{*}{20} & LP & \textbf{89.31}{\scriptsize$\pm$.36} & 85.64{\scriptsize$\pm$.56} & \textbf{81.00}{\scriptsize$\pm$.53} & 65.46{\scriptsize$\pm$.77} & 59.11{\scriptsize$\pm$.67} & \textbf{85.10}{\scriptsize$\pm$.59} & 92.77{\scriptsize$\pm$.40} & 86.50{\scriptsize$\pm$.49} & 49.98{\scriptsize$\pm$.51} & 28.62{\scriptsize$\pm$.40}\\ & \multirow{1}{*}{FT} & 88.92{\scriptsize$\pm$.38} & \textbf{85.85}{\scriptsize$\pm$.55} & 79.71{\scriptsize$\pm$.57} & \textbf{66.08}{\scriptsize$\pm$.79} & \textbf{63.04}{\scriptsize$\pm$.70} & 84.11{\scriptsize$\pm$.62} & \textbf{96.45}{\scriptsize$\pm$.28} & \textbf{90.24}{\scriptsize$\pm$.42} & \textbf{60.78}{\scriptsize$\pm$.60} & \textbf{30.26}{\scriptsize$\pm$.45}\\ \bottomrule \end{tabular} \end{table} \newpage \section{V-measurement Cluster Score on Other Datasets}\label{appx:v_measure_other} We provide extended results of Figure \ref{fig:v_measure_main} on both BSCD-FSL and non-BSCD-FSL datasets. In Figure \ref{fig:v_measure_miniIN} and \ref{fig:v_measure_tiered}, the results are based on ResNet10 pre-trained on miniImageNet and ResNet18 pre-trained on tieredImageNet, respectively. The trend of the results as shot increases is the same for all target datasets; more red dots are placed above the $y=x$ line. This shows that clustering ability of the feature extractor improves by more samples for FT. \begin{figure}[ht!] \centering \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_cars.pdf} \end{subfigure} \vspace{2pt} \hrulefill \vspace{2pt} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_chest.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_chest.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/20shot_chest.pdf} \end{subfigure} \caption{Feature extractor’s clustering ability by V-measure and performance differences between LP and FT. The pre-trained model is ResNet10 on miniIN.} \label{fig:v_measure_miniIN} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/1shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/1shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/1shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/1shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/1shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/5shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/5shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/5shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/5shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/5shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_cars.pdf} \end{subfigure} \vspace{2pt} \hrulefill \vspace{2pt} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/1shot_chest.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mini/5shot_chest.pdf} \end{subfigure} \begin{subfigure}[h]{0.218\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/v_score/tiered/20shot_chest.pdf} \end{subfigure} \caption{Feature extractor’s clustering ability by V-measure and performance differences between LP and FT. The pre-trained model is ResNet18 on tieredIN.}\label{fig:v_measure_tiered} \end{figure} \clearpage \newpage \section{Few-shot Performance according to Data Augmentation Techniques}\label{appx:few_shot_da} We analyze performance according to data augmentation techniques in $k$=1 and $k$=5 setting, which is shown in Table \ref{tab:miniIN_1_shot_da} and Table \ref{tab:miniIN_few_shot_da}. MixUp degrades the few-shot performance the most, and HFlip improves the performance, which is in line with the results on $k$=20 in Table \ref{tab:miniIN_20_shot_da}. \begin{table}[!h] \centering \caption{5-way 1-shot performance according to data augmentation techniques. The pre-trained ResNet10 on miniIN is fine-tuned.}\label{tab:miniIN_1_shot_da} \vskip 0.10in \begin{tabular}{lccccc} \toprule Aug. & miniIN & \!\!\!tieredIN\!\!\! & Places & Plantae & Cars \\ \midrule - & 49.57{\scriptsize$\pm$.79} & 49.10{\scriptsize$\pm$.90} & 45.44{\scriptsize$\pm$.79} & 33.35{\scriptsize$\pm$.59} & 29.49{\scriptsize$\pm$.54} \\ $+$ HFlip & 49.75{\scriptsize$\pm$.80} & 49.67{\scriptsize$\pm$.91} & 45.82{\scriptsize$\pm$.77} & 33.62{\scriptsize$\pm$.62} & 29.88{\scriptsize$\pm$.54} \\ $+$ RCrop & 51.08{\scriptsize$\pm$.79} & 48.52{\scriptsize$\pm$.89} & 45.82{\scriptsize$\pm$.80} & 34.62{\scriptsize$\pm$.62} & 29.99{\scriptsize$\pm$.56} \\ $+$ CJitter & 49.29{\scriptsize$\pm$.82} & 48.74{\scriptsize$\pm$.87} & 45.60{\scriptsize$\pm$.76} & 33.69{\scriptsize$\pm$.63} & 29.39{\scriptsize$\pm$.52} \\ $+$ Base aug. & 52.02{\scriptsize$\pm$.79} & 49.12{\scriptsize$\pm$.89} & 46.75{\scriptsize$\pm$.80} & 34.93{\scriptsize$\pm$.62} & 30.38{\scriptsize$\pm$.55} \\ $+$ MixUp & 46.50{\scriptsize$\pm$.79} & 46.45{\scriptsize$\pm$.88} & 42.11{\scriptsize$\pm$.76} & 32.16{\scriptsize$\pm$.59} & 28.53{\scriptsize$\pm$.52} \\ $+$ CutMix & 49.00{\scriptsize$\pm$.79} & 48.20{\scriptsize$\pm$.87} & 44.78{\scriptsize$\pm$.80} & 33.04{\scriptsize$\pm$.57} & 28.81{\scriptsize$\pm$.49} \\ \midrule Aug. & CUB & CropDiseases & EuroSAT & ISIC & ChestX \\ \midrule - & 37.54{\scriptsize$\pm$.71} & 66.78{\scriptsize$\pm$.91} & 56.45{\scriptsize$\pm$.84} & 31.03{\scriptsize$\pm$.55} & 22.35{\scriptsize$\pm$.38} \\ $+$ HFlip & 37.62{\scriptsize$\pm$.70} & 68.48{\scriptsize$\pm$.91} & 58.37{\scriptsize$\pm$.82} & 31.10{\scriptsize$\pm$.57} & 22.30{\scriptsize$\pm$.37} \\ $+$ RCrop & 38.62{\scriptsize$\pm$.73} & 63.24{\scriptsize$\pm$.95} & 55.52{\scriptsize$\pm$.84} & 32.56{\scriptsize$\pm$.56} & 21.91{\scriptsize$\pm$.36} \\ $+$ CJitter & 37.68{\scriptsize$\pm$.71} & 67.77{\scriptsize$\pm$.90} & 56.86{\scriptsize$\pm$.85} & 31.42{\scriptsize$\pm$.53} & 22.38{\scriptsize$\pm$.37} \\ $+$ Base aug. & 39.06{\scriptsize$\pm$.75} & 64.84{\scriptsize$\pm$.93} & 56.40{\scriptsize$\pm$.84} & 32.12{\scriptsize$\pm$.59} & 22.06{\scriptsize$\pm$.38} \\ $+$ MixUp & 35.72{\scriptsize$\pm$.66} & 64.62{\scriptsize$\pm$.93} & 50.12{\scriptsize$\pm$.78} & 30.42{\scriptsize$\pm$.55} & 22.16{\scriptsize$\pm$.38} \\ $+$ CutMix & 36.68{\scriptsize$\pm$.71} & 67.85{\scriptsize$\pm$.92} & 59.23{\scriptsize$\pm$.86} & 31.07{\scriptsize$\pm$.56} & 22.12{\scriptsize$\pm$.37} \\ \bottomrule \end{tabular} \end{table} \begin{table}[h] \caption{5-way 5-shot performance according to data augmentation techniques. The pre-trained ResNet10 on miniIN is fine-tuned.}\label{tab:miniIN_few_shot_da} \vskip 0.05in \centering \begin{tabular}{lccccc} \toprule Aug. & miniIN & tieredIN & Places & Plantae & Cars \\ \midrule - & 75.67{\scriptsize$\pm$.65} & 73.60{\scriptsize$\pm$.78} & 70.05{\scriptsize$\pm$.71} & 53.19{\scriptsize$\pm$.73} & 49.26{\scriptsize$\pm$.70} \\ $+$ HFlip & 76.30{\scriptsize$\pm$.63} & 74.06{\scriptsize$\pm$.77} & 70.74{\scriptsize$\pm$.68} & 54.00{\scriptsize$\pm$.75} & 51.06{\scriptsize$\pm$.72} \\ $+$ RCrop & 74.30{\scriptsize$\pm$.64} & 71.37{\scriptsize$\pm$.76} & 69.04{\scriptsize$\pm$.69} & 55.24{\scriptsize$\pm$.74} & 49.22{\scriptsize$\pm$.68} \\ $+$ CJitter & 75.66{\scriptsize$\pm$.64} & 73.68{\scriptsize$\pm$.75} & 70.20{\scriptsize$\pm$.71} & 53.56{\scriptsize$\pm$.75} & 49.17{\scriptsize$\pm$.71} \\ $+$ Base aug. & 74.55{\scriptsize$\pm$.65} & 72.16{\scriptsize$\pm$.73} & 69.54{\scriptsize$\pm$.70} & 55.90{\scriptsize$\pm$.76} & 50.88{\scriptsize$\pm$.70} \\ $+$ MixUp & 71.61{\scriptsize$\pm$.67} & 70.50{\scriptsize$\pm$.76} & 65.90{\scriptsize$\pm$.74} & 51.64{\scriptsize$\pm$.73} & 47.72{\scriptsize$\pm$.68} \\ $+$ CutMix & 74.00{\scriptsize$\pm$.67} & 72.19{\scriptsize$\pm$.77} & 69.51{\scriptsize$\pm$.70} & 52.71{\scriptsize$\pm$.71} & 48.00{\scriptsize$\pm$.70} \\ \midrule Aug. & CUB & CropDiseases & EuroSAT & ISIC & ChestX \\ \midrule - & 59.35{\scriptsize$\pm$.80} & 92.14{\scriptsize$\pm$.49} & 82.58{\scriptsize$\pm$.60} & 48.35{\scriptsize$\pm$.62} & 26.30{\scriptsize$\pm$.24} \\ $+$ HFlip & 61.14{\scriptsize$\pm$.80} & 93.02{\scriptsize$\pm$.47} & 83.62{\scriptsize$\pm$.59} & 49.79{\scriptsize$\pm$.65} & 26.48{\scriptsize$\pm$.40} \\ $+$ RCrop & 59.88{\scriptsize$\pm$.76} & 91.11{\scriptsize$\pm$.48} & 78.76{\scriptsize$\pm$.63} & 47.90{\scriptsize$\pm$.58} & 27.22{\scriptsize$\pm$.44} \\ $+$ CJitter & 59.68{\scriptsize$\pm$.81} & 92.41{\scriptsize$\pm$.49} & 81.85{\scriptsize$\pm$.60} & 47.94{\scriptsize$\pm$.67} & 26.72{\scriptsize$\pm$.41} \\ $+$ Base aug. & 61.61{\scriptsize$\pm$.76} & 90.69{\scriptsize$\pm$.50} & 77.40{\scriptsize$\pm$.63} & 46.96{\scriptsize$\pm$.66} & 26.55{\scriptsize$\pm$.42} \\ $+$ MixUp & 57.87{\scriptsize$\pm$.78} & 90.54{\scriptsize$\pm$.54} & 75.42{\scriptsize$\pm$.68} & 47.92{\scriptsize$\pm$.62} & 26.08{\scriptsize$\pm$.41} \\ $+$ CutMix & 56.46{\scriptsize$\pm$.78} & 92.01{\scriptsize$\pm$.50} & 82.87{\scriptsize$\pm$.58} & 45.63{\scriptsize$\pm$.59} & 26.50{\scriptsize$\pm$.44} \\ \bottomrule \end{tabular} \end{table} \clearpage \newpage \section{V-measurement Cluster Score of with and without MixUp on Other Datasets}\label{appx:v_measure_other_mixup} We analyze FT with and without MixUp by comparing V-measure of FT and LP on $k \in \{1,5,20\}$. The trend is the opposite of Section \ref{sec:analysis1} and Appendix \ref{appx:v_measure_other}. Even though the number of shots increases from $k$=1 to $k$=20, many dots indicating a change in V-measure of each episode are placed under $y=x$ line, and more of them are colored blue. This means that MixUp rather deteriorates the effectiveness of more shots, degrading the ability of the updated feature extractor by learning augmented images. \begin{figure}[h!] \centering \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_mini_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_tiered_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_places_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_plantae_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_cars_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_mini_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_tiered_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_places_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_plantae_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_cars_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_mini_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_tiered_test_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_places_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_plantae_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_cars_mixup.pdf} \end{subfigure} \vspace{2pt} \hrulefill \vspace{2pt} \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_cub_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_crop_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_euro_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_isic_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/1shot_chest_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_cub_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_crop_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_euro_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_isic_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/5shot_chest_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.222\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_cub_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_crop_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_euro_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_isic_mixup.pdf} \end{subfigure} \begin{subfigure}[h]{0.187\linewidth} \includegraphics[width=\linewidth]{figure/v_score/mixup/20shot_chest_mixup.pdf} \end{subfigure} \caption{Feature extractor’s clustering ability by V-measure and performance differences between FT and FT(MixUp). The pre-trained model is ResNet10 on miniIN.}\label{v_measure_mixup} \end{figure} \newpage \section{Performance of LP with Data Augmentation}\label{appx:DA_LP} We provide extended results on performance of LP with data augmentation. Table \ref{fig:DA_LP} shows how performance changes when different basic image manipulation methods are applied in LP. This experiment is conducted for $k$=1 and $k$=5 on BSCD-FSL datasets, using ResNet10 pre-trained on miniIN. Unlike the general wisdom that data augmentation improves performance, the performance of LP with data augmentation drops significantly. The result shows that basic image manipulation methods rather negatively affect the ability of the classifier, and this effect is larger in $1$-shot setting, where the performance degrades more than $5$-shot. This demonstrates that the linear classifier trained with fewer samples is more sensitive to image transformations. \begin{table}[h!] \caption{5-way $k$-shot performance according to data augmentation techniques. The pre-trained ResNet10 on miniIN is updated.}\label{fig:DA_LP} \vskip 0.10in \centering \begin{tabular}{clccccc} \toprule {$k$} & {Aug.} & {miniIN} & \!\!\!{CropDiseases}\!\!\! & {EuroSAT} & {ISIC} & {ChestX} \\ \midrule \multirow{6}{*}{1} & {-} & 56.47{\scriptsize$\pm$.80} & 73.12{\scriptsize$\pm$.88} & 64.72{\scriptsize$\pm$.88} & 29.39{\scriptsize$\pm$.53} & 21.45{\scriptsize$\pm$.31}\\ & {$+$ HFlip} & 48.06{\scriptsize$\pm$.84} & 62.39{\scriptsize$\pm$.96} & 56.03{\scriptsize$\pm$.84} & 29.61{\scriptsize$\pm$.51} & 21.78{\scriptsize$\pm$.35}\\ & {$+$ RCrop} & 50.48{\scriptsize$\pm$.81} & 59.08{\scriptsize$\pm$.97} & 55.08{\scriptsize$\pm$.86} & 30.56{\scriptsize$\pm$.53} & 21.90{\scriptsize$\pm$.30}\\ & {$+$ CJitter} & 56.10{\scriptsize$\pm$.81} & 59.28{\scriptsize$\pm$.94} & 64.87{\scriptsize$\pm$.88} & 29.47{\scriptsize$\pm$.56} & 22.85{\scriptsize$\pm$.41}\\ & {$+$ MixUp} & 41.53{\scriptsize$\pm$.78} & 58.46{\scriptsize$\pm$1.10} & 58.39{\scriptsize$\pm$.97} & 28.11{\scriptsize$\pm$.52} & 22.16{\scriptsize$\pm$.38}\\ & {$+$ CutMix} & 48.51{\scriptsize$\pm$.76} & 67.96{\scriptsize$\pm$.90} & 61.99{\scriptsize$\pm$.89} & 28.92{\scriptsize$\pm$.52} & 22.39{\scriptsize$\pm$.39}\\ \midrule \multirow{6}{*}{5} & {-} & 77.95{\scriptsize$\pm$.61} & 91.50{\scriptsize$\pm$.49} & 84.08{\scriptsize$\pm$.60} & 40.39{\scriptsize$\pm$.55} & 26.75{\scriptsize$\pm$.43}\\ & {$+$ HFlip} & 74.89{\scriptsize$\pm$.64} & 90.64{\scriptsize$\pm$.52} & 82.09{\scriptsize$\pm$.59} & 44.94{\scriptsize$\pm$.60} & 25.94{\scriptsize$\pm$.40}\\ & {$+$ RCrop} & 75.08{\scriptsize$\pm$.63} & 87.55{\scriptsize$\pm$.56} & 79.48{\scriptsize$\pm$.61} & 44.55{\scriptsize$\pm$.58} & 25.62{\scriptsize$\pm$.41}\\ & {$+$ CJitter} & 76.45{\scriptsize$\pm$.66} & {89.21}{\scriptsize$\pm$.56} & 59.70{\scriptsize$\pm$.90} & 40.56{\scriptsize$\pm$.56} & 26.89{\scriptsize$\pm$.43}\\ & {$+$ MixUp} & 69.02{\scriptsize$\pm$.72} & 87.30{\scriptsize$\pm$.58} & 81.29{\scriptsize$\pm$.65} & 39.08{\scriptsize$\pm$.55} & 26.98{\scriptsize$\pm$.42}\\ & {$+$ CutMix} & 73.83{\scriptsize$\pm$.66} & 90.55{\scriptsize$\pm$.51} & 83.68{\scriptsize$\pm$.58} & 40.82{\scriptsize$\pm$.56} & 26.11{\scriptsize$\pm$.41}\\ \bottomrule \end{tabular} \end{table} \section{Additional Related Works}\label{appx:related} \textbf{Few-Shot Learning (FSL)} focuses on underlying problems of deep learning where there are few training samples available. There are two dominant approaches for FSL, meta-learning-based and transfer learning-based. To predict class, the former uses prior knowledge which is generalized across tasks, while the latter uses transferred knowledge learned from large source data. Meta-learning aims to design a generalized model that adapts to new tasks quickly, by learning a good initialization\,\citep{finn2017model, li2017meta, lee2018gradient, rajeswaran2019meta, oh2021boil}, learning the metrics\,\citep{koch2015siamese, vinyals2016matching, snell2017prototypical, sung2018learning}, or learning generative models to augment few-shot data\,\citep{antoniou2017data, hariharan2017low}. In contrast, transfer learning aims to transfer knowledge from source tasks to few-shot tasks. By the capacity of deep backbones learned on ImageNet\,\citep{deng2009imagenet}, pre-trained knowledge is effectively transferred to different target datasets and target tasks\,\citep{luo2017label, azadi2018multi, liu2018feature, chen2019closer, dhillon2019baseline, luo2021rectifying}. For more realistic FSL, cross-domain few-shot learning (CD-FSL), where there is a large distributional shift from source to target domain, has gained increased attention. \citet{guo2020broader} provided CD-FSL benchmark and demonstrated that transfer-based models achieved higher performances than existing meta-learning approaches. Therefore, to address a distribution shift challenge, prior works have focused on transfer-learning based approaches by utilizing semi-supervised methods\,\citep{phoo2020self,islam2021dynamic} or unsupervised methods\,\citet{luo2017label, phoo2020self, das2021confess}. \textbf{Data Augmentation (DA)} is a general technique to prevent overfitting on training distribution and increase generalization performance\,\citep{simard2003best, krizhevsky2012imagenet}. Basic image manipulation such as flipping, rotating, and cropping is the most generic and prevalent practice in computer vision tasks. Data-mixing includes MixUp\,\citep{zhang2017mixup}, CutMix\,\citep{yun2019cutmix} and PuzzleMix\,\citep{kim2020puzzle}, which mix two images while mixing corresponding class labels. In addition, there are deep learning approaches for data augmentation. These approaches include generating images which is similar\,\citep{mirza2014conditional}, style-transferred\,\citep{gatys2016image} and domain-transferred\,\citep{zhu2017unpaired}. In our study, we focus on basic image manipulation and data-mixing because there is no sufficient data to train generative models during fine-tuning. \newpage \section{Discussions}\label{appx:discussion} In this section, we cover additional discussions on updating the model for few-shot learning. \subsection{Performance Variance between Episodes}\label{appx:instab_with} The general evaluation method in few-shot learning averages accuracy of 600 episodes\,(i.e., $(D_S, D_Q)$ sampled in an episodic way). However, the performance difference between these episodes is substantial. For example, the performance of LP model updated by tieredIN varies from 18.67$\%$ to 93.33$\%$. In Figure \ref{fig:between_instab}, we visualize this variation according to target datasets and updating methods\,(i.e., FT or LP). Figure \ref{fig:1shot_btw}, \ref{fig:5shot_btw} and \ref{fig:20shot_btw} describe 1, 5, and 20-shot cases using ResNet10 pre-trained on miniIN. The green and orange colors indicate performance through LP and FT, respectively. It is observed that the degrees of performance difference of LP and FT are similar, which means that performance difference does not come from updating methods. We believe that this difference comes from many factors such as classifier initialization, data ordering for updating (similar to \citep{dodge2020fine}), and combinations of support and target sets. This will motivate the researchers about the accurate evaluation of few-shot models. \begin{figure}[h!] \centering \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/between/1shot_mini.pdf} \caption{$k=1$} \label{fig:1shot_btw} \end{subfigure} \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/between/5shot_mini.pdf} \caption{$k=5$} \label{fig:5shot_btw} \end{subfigure} \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/between/20shot_mini.pdf} \caption{$k=20$} \label{fig:20shot_btw} \end{subfigure} \caption{5-way $k$-shot performance of LP and FT over 600 episodes according to different target dataset. The pre-trained ResNet10 on miniIN is used as the feature extractor.} \label{fig:between_instab} \end{figure} \clearpage \newpage \subsection{Instability within an Episode}\label{appx:instab_btw} For transfer-based few-shot learning, the last updated model is used for evaluation without early stopping using the validation set. This is because \emph{it is difficult to construct the validation set} due to scarcity of the training set (i.e., $nk$ samples under $n$-way $k$-shot classification tasks) Figure \ref{fig:within_instab} describes the expected performance gain over 600 episodes according to the dataset. The expected performance gain is defined by the ratio between accuracy at the best epoch and accuracy at the last epoch, i.e., $ {\rm Acc}_{\sf best} / {\rm Acc}_{\sf last} $. Note that the value of 1 indicates that the updated model has the best performance at the last epoch. The expected performance gain is amplified when the sample size is smaller (i.e., $k$=1) and when the similarity between the source and target data is smaller (i.e., ISIC and ChestX). Figure \ref{fig:best_hist} illustrates histogram of best epochs over 600 episodes, considering different shots and target datasets. The green- and the orange-colored histograms indicate the result by LP and FT, respectively. For LP, the best performance appears in the early- to mid-epochs, but for FT, the distribution of best epochs are generally skewed left or distributed uniformly. It seems that LP is prone to overfitting than FT. \begin{figure}[h!] \centering \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/within/1shot_mini.pdf} \caption{$k=1$} \end{subfigure} \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/within/5shot_mini.pdf} \caption{$k=5$} \end{subfigure} \begin{subfigure}[h]{\linewidth} \includegraphics[width=\linewidth]{figure/instab/within/20shot_mini.pdf} \caption{$k=20$} \end{subfigure} \caption{5-way $k$-shot expected performance gain ($ {\rm Acc}_{\sf best} / {\rm Acc}_{\sf last} $) over 600 episodes.} \label{fig:within_instab} \end{figure} \newpage \begin{figure}[h!] \centering \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/01shot_chest.pdf} \end{subfigure} \vspace{2pt} \hrulefill \vspace{2pt} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/05shot_chest.pdf} \end{subfigure} \vspace{2pt} \hrulefill \vspace{2pt} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_mini_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_tiered_test.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_places.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_plantae.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_cars.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_cub.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_crop.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_euro.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_isic.pdf} \end{subfigure} \begin{subfigure}[h]{0.19\linewidth} \includegraphics[width=\linewidth]{figure/best_epoch/20shot_chest.pdf} \end{subfigure} \caption{Histogram of best epoch during updating over 600 episodes. ResNet10 is pre-trained on miniIN. Green and orange colors indicate LP and FT, respectively.} \label{fig:best_hist} \end{figure} \clearpage \subsection{Layer Difference through FT}\label{appx:layer_diff} We analyze how layers of the model is updated by FT. For each layer, we evaluate \emph{layer difference}, which is L1 distance between parameters of LP and FT divided by the number of elements of the parameters in a layer. Figure \ref{fig:layer_diff mini} illustrates the layer differences of each layer, which is averaged over 600 episodes. X-ticks are as follows in order: Stem[Conv.weight, BN.scale, BN.shift] - Stage1[Conv1.weight, BN1.scale, BN1.shift, Conv2.weight, BN2.scale, BN2.shift] - Stage2[Conv1.weight, BN1.scale, BN1.shift, Conv2.weight, BN2.scale, BN2.shift, ShortCutConv.weight, ShortCutBN.scale, ShortCutBN.shift] - Stage3[Conv1.weight, BN1.scale, BN1.shift, Conv2.weight, BN2.scale, BN2.shift, ShortCutConv.weight, ShortCutBN.scale, ShortCutBN.shift] - Stage4[Conv1.weight, BN1.scale, BN1.shift, Conv2.weight, BN2.scale, BN2.shift, ShortCutConv.weight, ShortCutBN.scale, ShortCutBN.shift] - Classifier[weight, bias]. Conv-related, BN-related, and Classifier-related are marked as circle, star, and triangle, respectively. It is observed that layers change a lot in the order of Classifier-related, BN-related, and Conv-related. Because a classifier is randomly initialized before FT, it is reasonable that the change in a classifier is large. Surprisingly, BN-related layers change more than Conv-related layers when fine-tuning a pre-trained extractor, which demonstrates that batch normalization is an important factor for FT. This can be explained that the fine-tuned model utilizes pre-trained convolution layers, but considerably changes shift and scale of the distribution of intermediate features, which seems to be related to FWT\,\citep{tseng2020cross}. Furthermore, the changes of original path is larger than those of shortcut path. \begin{figure}[h!] \centering \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/mini_test.pdf} \caption{miniIN} \end{subfigure} \hspace{10pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/tiered_test.pdf} \caption{tieredIN} \end{subfigure} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/places.pdf} \caption{Places} \end{subfigure} \hspace{10pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/plantae.pdf} \caption{Plantae} \end{subfigure} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/cars.pdf} \caption{Cars} \end{subfigure} \hspace{10pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/cub.pdf} \caption{CUB} \end{subfigure} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/crop.pdf} \caption{CropDiseases} \end{subfigure} \hspace{10pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/euro.pdf} \caption{EuroSAT} \end{subfigure} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/isic.pdf} \caption{ISIC} \end{subfigure} \hspace{10pt} \begin{subfigure}[h]{0.38\linewidth} \includegraphics[width=\linewidth]{figure/layer_diff/mini/chest.pdf} \caption{ChestX} \end{subfigure} \caption{Layer difference through FT according to target dataset using ResNet10 pre-trained on miniIN.} \label{fig:layer_diff mini} \end{figure}
\section{Introduction} \label{sec:intro} Stars with initial masses $\gtrsim$ 8 M$_\odot$ end their lives as core-collapse supernovae \citep[SNe; e.g.;][]{Janka2012}. While single stars in the mass range 8 $\lesssim$ M$_{\text{ZAMS}}$ $\lesssim$ 25 M$_\odot$ are thought to explode as Type II SNe \citep{Smartt2009}, the fate of stars more massive than $\approx$ 25 M$_\odot$ is uncertain \citep{Smartt2015}. These stars are expected to lose their outer H envelopes, either through line-driven stellar winds \citep{Castor1975,Abbott1982,Vink2000} or stripping due to binary companion interaction \citep{Yoon2010,Sana2012}, and appear as Wolf-Rayet (WR) stars \citep{Crowther2007}. WR stars may explode as stripped-envelope SNe (SESNe) of Types Ib and Ic \citep[SNe Ibc;][]{Sukhbold2016}, or the most massive may collapse directly to a black hole, producing little or no optical emission \citep{MacFadyen1999}. However, recent evidence has suggested that WR stars are unlikely to be the progenitors of all SNe Ibc. Searches for WR stars at the locations of SNe Ibc in pre-explosion images have had mixed success \citep{Cao2013,Eldridge2013,Kilpatrick2021}, and ejecta masses estimated from SNe Ibc light curves are well below the pre-SN masses of WR stars \citep[e.g.,][]{Lyman2016,Taddia2018}. Instead, it is possible that less massive stars undergoing binary interaction may lose their H envelopes and explode as SESNe \citep{Podsiadlowski1992}. Some SNe that show signs of extreme binary interaction have been discovered \citep{Drout2013,De2018,Yao2020}. Classified as ultra-stripped SNe (USSNe), these objects show diverse photometric and spectral evolution. Some may have powering sources such as shock-cooling emission \citep{Kleiser2014} instead of or in addition to radioactive decay of $^{56}$Ni at early times. Many are located in regions devoid of star formation within their host galaxies \citep[e.g.,][]{Drout2013,De2018}. Spectroscopically they resemble SNe Ibc but have lower explosion energies, ejecta masses, and produce less $^{56}$Ni. Based on their small ejecta and $^{56}$Ni masses as well as their local environments, they are thought to originate from stars with initial masses of 8--20 M$_\odot$ that have undergone extensive binary companion stripping and explode as bare, low-mass ($\approx$1--3 M$_\odot$, \citealt{Tauris2015}) cores. Occasionally, SESNe show evidence for circumstellar interaction (CSI) between the SN ejecta and circumstellar material (CSM), consisting of the stripped outer layers of the progenitor. Quickly after explosion the CSI drives forward and reverse shocks into the CSM and ejecta, which converts some of the kinetic energy of the explosion to thermal energy and leads to a rapid rise in luminosity. As the CSM cools it emits narrow emission lines of highly-ionized species. SNe that interact with H-poor, He-rich CSM have spectra dominated by narrow He lines and are classified as Type Ibn SNe \cite[SNe Ibn;][]{Pastorello2007}. CSI powers their early-time light curves, which rise and decline in luminosity much faster than those of other SNe classes. Because of this rapid evolution, SNe Ibn make up part of the ``fast transient'' population \citep{Ho2021,Pellegrino2022}. WR stars are commonly proposed as the progenitors to SNe Ibn \citep{Pastorello2007,Foley2007}, but some evidence shows that these objects may not all be the explosions of massive stars \citep{Hosseinzadeh2019}. Highly efficient WR winds, eruptive mass-loss episodes, and binary interaction have all been proposed as mechanisms to strip the progenitor stars of their H and He layers. Recently, an even more extreme subtype of interacting SESN has been discovered. These objects are classified as Type Icn SNe (SNe Icn) due to their narrow spectral lines indicative of interaction with a H- and He-poor CSM. Despite being theoretically predicted \citep{Smith2017,Woosley2017}, only two such objects have been published in the literature to date \citep{Fraser2021,Gal-Yam2022,Perley2022}. Their early-time spectra are blue with narrow emission lines, similar to those of SNe Ibn, but the features are produced by highly-ionized C and O, rather than He. Their light curves rise rapidly to peak luminosities comparable to those of most SNe Ibn (M $\approx$ -19). After maximum, as the SN ejecta becomes optically thin, their spectra appear more similar to normal SNe Ibc in one case \citep{Gal-Yam2022}, or similar to peculiar broad-lined SNe Ic (SNe Ic-BL) in another \citep{Fraser2021}. The overall photometric and spectroscopic similarities between SNe Ibn and SNe Icn suggest that their progenitors may be similar. It has been proposed that both SNe Ibn and SNe Icn are the explosions of WR stars, with different spectral features due to different WR star subtype progenitors, different amounts of mass loss, or both \citep{Gal-Yam2022,Perley2022}. On the other hand, their progenitors or explosion mechanisms may differ. It is not clear whether the core-collapse of a WR star should completely eject the entirety of the stellar material or if a substantial fraction may fall back onto the compact remnant\citep[e.g.,][]{MacFadyen1999}, perhaps driven by a strong reverse shock generated by CSI \citep{Chevalier1989,Kleiser2018}. Furthermore, even if these two classes have different explosion or progenitor properties, the observable signatures of these differences may be masked by the dominant CSI at early times. Therefore, it is crucial to study a collection of these objects throughout their evolution in order to better understand their inherent differences. In this work, we analyze a sample of four SNe Icn\textemdash SN\,2019jc, SN\,2019hgp, SN\,2021ckj, and SN\,2021csp. This is the largest sample of SNe Icn analyzed to date and doubles the number of these objects published in the literature. These SNe were all extensively observed photometrically and spectroscopically with Las Cumbres Observatory \citep[LCO;][]{Brown2013} through the Global Supernova Project. The SNe Icn display a range of peak luminosities, light-curve properties, and late-time spectral evolution. In an effort to better understand their progenitor channels, explosion mechanisms, and relationships to other SESNe, we model their bolometric light curves with luminosity inputs from CSI and $^{56}$Ni decay \citep{Chatzopoulos2012}. We also examine the host galaxy properties at the explosion site of the closest SN Icn, SN\,2019jc, in order to constrain its progenitor mass. This paper is organized as follows. In Section \ref{sec:sample}, we describe the objects in our sample and the process of collecting and reducing our data. In Section \ref{sec:phot}, we analyze the light-curve and blackbody properties of these objects. We discuss their prominent spectral features and spectral evolution in Section \ref{sec:spec}. In Section \ref{sec:progenitor}, we attempt to fit their bolometric light curves with CSI and $^{56}$Ni decay models and study their host galaxies. We discuss possible progenitor systems and explosion mechanisms in Section \ref{sec:discussion}, and conclude in Section \ref{sec:conclusions}. \section{Sample Description and Observations} \label{sec:sample} \begin{deluxetable*}{lllccc}[t] \tablecaption{SNe Icn Discovery Information \label{tab:icnsample}} \tablehead{ \colhead{Object Name} & \colhead{Redshift} & \colhead{Coordinates} & \colhead{Last Nondetection (MJD)} & \colhead{First Detection (MJD)} & \colhead{Discovery Group}} \startdata SN\,2019jc & 0.01948 & 328.920804 +24.905742 & 58489.27 & 58491.21 & ATLAS \\ SN\,2019hgp & 0.0641 & 234.053625 +39.73350 & 58641.32 & 58642.24 & ZTF \\ SN\,2021ckj & 0.143 & 136.462846 -8.585437 & 59252.36 & 59254.29 & ZTF \\ SN\,2021csp & 0.083 & 216.592167 +5.859214 & 59254.53 & 59256.51 & ZTF \\ \enddata \end{deluxetable*} In this work we present and analyze observations of four SNe Icn. Because the sample size of these objects is still small, with only a handful classified to date, any data is crucial to better understanding their progenitor systems and explosion mechanisms. Two objects in our sample\textemdash SN\,2019hgp and SN 2021csp\textemdash have been closely studied in previous works \citep{Fraser2021,Gal-Yam2022,Perley2022}. We add observations of two other SNe Icn, primarily obtained with LCO. One of the objects (SN\,2021ckj) was classified on the Transient Name Server\footnote{https://www.wis-tns.org/} as a SN Icn \citep{Pastorello2021}, while the other (SN\,2019jc) was identified as a SN Icn during a retroactive search of our archival data after this subclass was more rigorously defined \citep{Gal-Yam2021,Pellegrino2022b}. \subsection{SNe Icn Sample Description} Discovery information for the four SNe Icn in our sample is summarized in Table \ref{tab:icnsample}. SN\,2019jc was discovered by the Asteroid Terrestrial-impact Last Alert System \citep[ATLAS;][]{Tonry2018} in UGC 11849 on MJD 58491.21 (UTC 2019 January 8) with a two day non-detection. SN\,2019hgp, SN\,2021ckj, and SN\,2021csp were discovered by the Zwicky Transient Facility \citep[ZTF;][]{Bellm2019,Graham2019} on MJD 58642.24 (UTC 2019 June 8), MJD 59254.29 (UTC 2021 February 9) and MJD 59256.51 (UTC 2021 February 11) with non-detections approximately one day, two days, and two days prior, respectively. We assume a cosmology with H$_0$ = 73 km s$^{-1}$ Mpc$^{-1}$, $\Omega_m$ = 0.27, and $\Omega_\Lambda$ = 0.73 to derive luminosity distances. We use the dust maps of \cite{Schlafly2011} to estimate Galactic reddening. We assume no host galaxy extinction for SN\,2019hgp and SN\,2021csp to be consistent with the analyses of \citet{Fraser2021}, \citet{Gal-Yam2022}, and \citet{Perley2022}. We also assume negligible host extinction for SN\,2019jc due to its large projected offset from its host galaxy and for SN\,2021ckj due to its early-time colors that are similar to the other SNe Icn (Figure \ref{fig:grcolors}). LCO follow-up observations commenced soon after the discovery of each of these objects. Early observations have proved to be crucial in studying SNe Icn, as a rapid rise to peak brightness is a signature of these objects \citep{Fraser2021,Gal-Yam2022,Perley2022}. Light-curve parameters for each object measured from our early-time observations are given in Table \ref{tab:photproperties}. For SN\,2021csp, we use the light curve parameters given in \citet{Fraser2021} and fit for those of the remainder of our objects. We estimate the time of explosion as halfway between the times of last non-detection and first detection for each object. LCO photometry was obtained during the rising portion of the light curve of SN\,2019jc, allowing us to better estimate its rapid rise time and peak brightness. By fitting a quadratic spline to our \textit{g}-band data points around maximum brightness, we measure a rise time of 4.1 $\pm$ 1.0 days and peak \textit{g}-band apparent magnitude of 17.3 $\pm$ 0.1 mag. LCO observations of SN\,2019hgp and SN\,2021ckj did not begin until around the time of maximum light. However, we supplement these photometric data with publicly-available data from ZTF and ATLAS. Fitting the combined ZTF and LCO \textit{g}-band light curves for SN\,2019hgp and SN\,2021ckj with a quadratic spline gives rise times of 5.6 $\pm$ 0.4 and 4.3 $\pm$ 1.0 days and \textit{g}-band peak apparent magnitudes of 18.67 $\pm$ 0.02 mag and 19.03 $\pm$ 0.03 mag, respectively. \subsection{Optical Photometry} LCO \textit{UBgVri}-band images were obtained using the SBIG and Sinistro cameras on LCO 0.4m and 1.0m telescopes, respectively. Data reduction was performed using the \texttt{lcogtsnpipe} pipeline \citep{Valenti2016}, which extracts point-spread-function magnitudes after calculating zeropoints and color terms \citep{Stetson1987}. \textit{UBV}-band photometry was calibrated to Vega magnitudes using Landolt standard fields \citep{Landolt1992} and \textit{gri}-band photometry was calibrated to AB magnitudes \citep{Smith2002} using Sloan Digital Sky Survey (SDSS) catalogs. Three of the SNe Icn (SN\,2019hgp, SN\,2021ckj, and SN\,2021csp) were contaminated by host galaxy light; therefore, background subtraction was performed using the HOTPANTS \citep{Becker2015} image subtraction algorithm with template images obtained after the SNe had faded. LCO photometry is presented in Table \ref{tab:opticalphot}. \subsection{Ultraviolet Photometry} Ultraviolet (UV) and optical photometry were obtained with the Ultraviolet and Optical Telescope \citep[UVOT;][]{Roming2005} on the Neil Gehrels Swift observatory \citep{Gehrels2004}. \textit{Swift} photometry for SN\,2019hgp and SN\,2021csp have already been published \citep{Fraser2021,Gal-Yam2022,Perley2022}. We use those data throughout this paper, calibrated to Vega magnitudes. Data were reduced using the \textit{Swift} Optical/Ultraviolet Supernova Archive \citep{Brown2014} pipeline with the most recent calibration files and the zeropoints of \citet{Breeveld2011}. In both cases images from the final epochs were used to background-subtract the host galaxy light. Although Swift also observed SN\,2021ckj, only non-constraining upper limits on the flux at each epoch were recoverable during the data reduction process. Therefore we do not include these data in our analysis. UV follow-up was not triggered for SN\,2019jc. \subsection{Spectroscopy} \begin{figure*} \centering \subfigure[SN 2019jc]{\includegraphics[width=0.48\textwidth]{sn2019jc_lc.pdf}}\label{fig:sn2019jclc} \subfigure[SN 2019hgp]{\includegraphics[width=0.48\textwidth]{sn2019hgp_lc.pdf}}\label{fig:sn2019hgplc} \newline \subfigure[SN 2021ckj]{\includegraphics[width=0.48\textwidth]{sn2021ckj_lc.pdf}}\label{fig:sn2021ckjlc} \subfigure[SN 2021csp]{\includegraphics[width=0.48\textwidth]{sn2021csp_lc.pdf}}\label{fig:sn2021csplc} \caption{Multiband light curves of four SNe Icn. MJD and phases with respect to the estimated explosion dates are given, and photometry is given in apparent and absolute magnitudes. \textit{uvw2, uvm2, uvw1, U, B,} and \textit{V}-band photometry are calibrated to Vega magnitudes while other bands are calibrated to AB magnitudes. LCO photometry is marked by circles, ZTF photometry by squares, ATLAS photometry by pentagons, and Swift photometry by stars. The photometry of all the objects except SN\,2019jc has been template subtracted; as SN\,2019jc is at the outskirts of its host galaxy, it should not suffer from significant host contamination. Dashed lines show the quadratic splines used to estimate the rise times and peak magnitudes of SN\,2019jc, SN\,2019hgp, and SN\,2021ckj.} \label{fig:alllcs} \end{figure*} LCO spectra were obtained using the FLOYDS spectrographs on the 2.0m Faulkes Telescope North and Faulkes Telescope South. Spectra cover a wavelength range of 3500--10,000 \AA{} at a resolution R $\approx$ 300-600. Data were reduced using the \texttt{floydsspec} pipeline\footnote{https://github.com/svalenti/FLOYDS$\_$pipeline/}, which performs cosmic ray removal, spectrum extraction, and wavelength and flux calibration. A spectrum of SN\,2019jc around maximum light was obtained using the blue and red arms of the Low Resolution Imaging Spectrometer on the Keck I 10m telescope \citep{Oke1995} using the 600/4000 grism and 400/8500 grating. Data cover the wavelength range 3200--10,000 \AA{}. The spectrum was observed with a 1$\farcs$5 longslit at the parallactic angle and reduced in a standard way using the \texttt{LPIPE} pipeline \citep{PerleyLPipe}. Additionally, spectra of SN\,2021ckj and SN\,2021csp were obtained using the Goodman High Throughput Spectrograph on the Southern Astrophysical Research (SOAR) 4.1m telescope. All data were taken with the red camera covering the wavelength range 5000--9000 \AA{} using a one arcsecond slit and the 400 mm$^{-1}$ line grating. Reductions were performed via the Goodman Spectroscopic Data Reduction Pipeline\footnote{https://github.com/soar-telescope/goodman$\_$pipeline} which performs bias and flat corrections, cosmic ray removal, spectrum extraction, and wavelength calibration. Fluxes were calibrated to a standard star observed on the same nights with the same instrumental setup. Details of all the spectra presented in this work are given in Table \ref{tab:speclog}. \section{Photometric Properties} \label{sec:phot} \begin{deluxetable}{ccccc}[t] \tablecaption{SNe Icn Light Curve Properties \label{tab:photproperties}} \tablehead{ \colhead{Object} & \colhead{$t_{rise}$} & \colhead{$t_{max,g}$} & \colhead{$M_{peak,g}$} & \colhead{$t_{1/2,decl}$} \\ Name & (days) & (MJD) & & (days)} \startdata SN\,2019jc & 4.1$\pm$1.0 & 58494.4$\pm$0.1 & -17.2$\pm$0.1 & 3.1$\pm$0.1\\ SN\,2019hgp & 5.6$\pm$0.4 & 58647.4$\pm$0.2 & -18.5$\pm$0.1 & 8.0$\pm$0.2 \\ SN\,2021ckj & 4.3$\pm$1.0 & 59257.6$\pm$0.2 & -19.8$\pm$0.1 & 4.7$\pm$0.2 \\ SN\,2021csp & 2.3$\pm$0.4\tablenotemark{a} & 59257.7$\pm$0.5\tablenotemark{a} & -20.3$\pm$0.1\tablenotemark{a} & 8.3$\pm$1.0\tablenotemark{b} \\ \enddata \tablenotetext{a}{\citet{Fraser2021}} \tablenotetext{b}{\citet{Perley2022}} \end{deluxetable} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{g_and_r_lightcurves.pdf} \caption{Extinction-corrected LCO \textit{g}-(top) and \textit{r}-band (bottom) absolute magnitudes of the four SNe Icn. Time is given relative to \textit{g}-band maximum light. We also include the \textit{R}-band SN Ibn light curve template from \citet[shaded green region]{Hosseinzadeh2017}. Solid lines show weighted-average magnitudes at each epoch. The SNe Icn display a range of peak luminosities, rise times, and decline rates.} \label{fig:grlcs} \end{figure} The UV and optical light curves of the four SNe Icn are shown in Figure \ref{fig:alllcs}. All objects besides SN\,2019jc have been template corrected to subtract background galaxy light. SN\,2019jc, on the other hand, exploded at the outskirts of its host galaxy and therefore should not suffer from significant host contamination. All data have been corrected for Galactic extinction. Early-time LCO photometric coverage is most extensive for SN\,2019jc and SN\,2019hgp, with multiple observations occurring before maximum light. All the objects rise to maximum brightness within a week of the estimated explosion date. The rise time of SN\,2021csp is the most extreme, reaching its peak luminosity in fewer than three days. This rapid rise to peak brightness is also seen in other interaction-powered SESNe such as SNe Ibn, which have some of the fastest-evolving light curves of any SN subtype \citep{Ho2021}. Interaction-powered objects also tend to be UV-bright at early times, as shown by the light curves of SN\,2019hgp and SN\,2021csp for which there was extensive Swift coverage of the light-curve peak. Both the fast rise and luminous UV emission are characteristic of CSI, which can generate a rapid rise in luminosity as the SN shocks sweep up the CSM and ejecta. Early-time multiband observations of these objects are crucial to capturing the rapidly-evolving CSI-powered emission. The \textit{g}- and \textit{r}-band absolute magnitude light curves are shown in Figure \ref{fig:grlcs}. Overlaid is the \textit{R}-band SNe Ibn light curve template from \citet{Hosseinzadeh2017}. There is a wide range ( $\gtrsim$ 3 mag) in the peak absolute magnitudes, with the \textit{g}-band brightness of SN\,2021csp approaching that of super-luminous SNe \citep[see e.g.,][for a review]{Howell2017}. On the other hand, SN\,2019jc is faint relative to both the other SNe Icn and a sample of SNe Ibn \citep{Hosseinzadeh2017}. The overall light curve shapes are comparable to the SNe Ibn light curve template. Although the SNe Icn absolute magnitudes have a greater spread than the template, \citet{Hosseinzadeh2017} note that the template is biased by brighter, longer-rising objects and therefore does not replicate well the fainter, faster-evolving objects. We plot the \textit{g-r} color evolution of the SNe Icn compared with the colors of a sample of SNe Ibc \citep{Taddia2015} and SNe Ibn \citep{Pellegrino2022} in Figure \ref{fig:grcolors}. The photometry of all the SNe Icn except SN\,2019jc has been \textit{K}-corrected due to the high redshifts of these objects. For each object we calculate \textit{K}-corrections using spectra roughly coeval with the photometry \citep{Hogg2002}. In most cases we find that this correction is small ($\lesssim$ 0.1 mag). The SNe Ibc and SNe Ibn colors have not been \textit{K}-corrected due to their low average redshift. We find that the colors of the SNe Icn are bluer on average than those of the SNe Ibc at the same phase. This is not surprising, as the spectral energy distribution (SED) of other objects powered by CSI tends to peak at bluer wavelengths \citep{Ho2021}. Roughly 10 days after \textit{g}-band maximum the SNe Icn colors evolve redward, with the exception of SN\,2021csp, which maintains a constant blue color out to 40 days after peak brightness. This constant color evolution is also seen among SNe Ibn and other fast transients from \citet{Ho2021}, which may be indicative of a long-lasting CSI powering source \citep[e.g.,][]{Ho2021,Pellegrino2022}. \subsection{Blackbody Fits} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{g_r_color_with_kcorr.pdf} \caption{\textit{g-r} colors of the four SNe Icn compared to those of SNe Ibn \citep{Pellegrino2022} and a sample of ordinary SNe Ibc \citep{Taddia2015}. The colors of the SNe Icn except for SN\,2019jc have been $K$-corrected due to their high redshifts.} \label{fig:grcolors} \end{figure} For our objects with extensive multiband coverage we are able to estimate bolometric luminosities and blackbody properties. As the spectra of these objects appear blue and mostly featureless (besides the narrow emission lines), their SEDs are well fit by a blackbody function. The bolometric luminosities we estimate from our blackbody fits are used to model the mechanisms powering the light curves of these objects in Section \ref{sec:progenitor}. Because the SEDs of these objects peak in the UV at early times, full multi-wavelength observations are crucial for well-estimated bolometric light curves. SN\,2019hgp and SN\,2021csp have well-sampled UV light curves from Swift \citep{Fraser2021,Gal-Yam2022,Perley2022}. For these objects, we use \texttt{Superbol} \citep{Nicholl2018} to estimate bolometric luminosities from their UV and optical light curves after correcting for Milky Way extinction and cosmological redshifts. The flux blueward and redward of our filters is extrapolated to estimate true bolometric luminosities. On the other hand, only \textit{BgVri}-band data were obtained for SN\,2019jc. In order to estimate its bolometric light curve, we fit a blackbody function to extinction-corrected photometry for each epoch with observations in three or more filters. These fits are shown in Figure \ref{fig:19jcbbfits}. Although the true UV luminosity is uncertain due to the optical photometry lying on the Rayleigh-Jeans tail of the blackbody function, the fits are able to give rough estimates of the bolometric luminosity at each phase. To check, we verify that blackbody fits to our spectra of SN\,2019jc produce similar results to the photometric fits at the same epochs. Since multiband data is missing during the rising part of the light curve of SN\,2021ckj, we do not attempt to fit a blackbody to its photometry. The blackbody radius and temperature evolution of each object we fit are shown in Figure \ref{fig:bbvalues}. Also shown are the radii and temperatures of a sample of SNe Ibn \citep{Pellegrino2022} as well as the fast transient AT\,2018cow \citep{Perley2019,Margutti2019}. We choose these objects for comparison because they also have well-studied multiband light curves, are classified as fast transients, and may represent exotic core-collapse scenarios of massive stars. The temperature and radius evolution of the SNe Icn closely match those of the SNe Ibn. We find similar early-time temperatures between the two classes of objects. Both also have expanding blackbody radii until roughly a week after maximum, after which the radii stay constant or recede. AT\,2018cow, on the other hand, has a much higher early-time temperature and a blackbody radius that begins to recede earlier than the other objects. This may suggest that the ejecta composition and circumstellar environment of the SNe Icn and SNe Ibn are more similar to each other than to AT\,2018cow. \begin{figure} \centering \includegraphics[width=0.47\textwidth]{blackbody_values.pdf} \caption{A comparison of the estimated blackbody temperatures (top) and radii (bottom) of the SNe Icn, a sample of SNe Ibn \citep{Pellegrino2022}, and the fast transient AT\,2018cow \citep{Perley2019}. The radius and temperature evolution of the SNe Icn follow those of the SNe Ibn, but are different than that of AT\,2018cow.} \label{fig:bbvalues} \end{figure} \section{Spectroscopic Features} \label{sec:spec} Spectroscopic observations of the SNe Icn obtained with the Global Supernova Project range from several days before maximum to over three weeks after maximum, allowing us to observe the evolution of these objects over a variety of phases. The spectra of all the objects in our sample, in order of phase, are shown in Figure \ref{fig:specbyphase}. Our observations of SN\,2019jc during the rising phase of the light curve gives only the second spectroscopic time series of a SN Icn before maximum, after SN\,2019hgp \citep{Gal-Yam2022}, allowing us to study the early spectral features of these objects in greater detail. Before maximum (Figure \ref{fig:specbyphase} (a)), the SNe Icn spectra are blue and superimposed with strong, narrow lines of C III and C IV. These spectra are distinct from any other class of SNe. They are qualitatively closest in appearance to the early-time spectra of SNe Ibn, which have narrow emission lines of He that are photoionized by the radiation from the forward shock \citep{Smith2017}, but the narrow lines in the SNe Icn are stronger than those seen in SNe Ibn. Several of the lines, including C IV $\lambda$5812 and C III $\lambda$4650, show narrow absorption components in addition to the strong emission lines. The absorption components have velocities, measured from the minima of the absorption troughs, of $\approx 500$ \textemdash 1000 km s$^{-1}$. These absorption features measure the velocity of the pre-shocked CSM. If we assume this velocity corresponds to the wind velocity of the progenitor star, then high velocities upwards of 1000 km s$^{-1}$ can constrain the possible progenitor channels of these events to luminous blue variables, WR stars, and stripped low-mass He stars \citep{Crowther2007,Vink2017}. Several days before maximum light the spectra of SN\,2019jc and SN\,2019hgp display a forest of narrow P Cygni features blueward of 5000 \AA{}. Our Keck spectrum of SN\,2019jc allows us to study these lines in greater detail. A closer look at this spectrum is shown in Figure \ref{fig:specbyphase} (d). We identify a complicated blend of highly ionized species of elements, including C II, C III, C IV, He II, Ca II, O II, O III, Mg I, Mg II, and Ne II. Of particular interest is the He II $\lambda$4686 feature, which suggests that the CSM surrounding SN\,2019jc is not completely devoid of He. Previous studies have noted that the spectra of SN\,2019hgp and SN\,2021csp closely match the H- and N-depleted spectra of the WC-subtype of WR stars \citep{Gal-Yam2022,Perley2022}. We also do not identify any H or N lines in the SN\,2019jc spectrum; an emission line close to 4600 \AA{} could be N V $\lambda$4604, but we do not detect other N lines. It is more likely that this emission line can be attributed to Ne II $\lambda$4607. Several other Ne II P Cygni features are identified in the spectrum with comparable line widths and velocities. Ne II is rarely, if ever, seen in the spectra of core-collapse SNe, yet both SN\,2019jc and SN\,2019hgp \citep{Gal-Yam2022} have early-time spectra with considerable Ne features. This Ne likely formed during C burning and therefore was stripped from the inner layers of the progenitor star. The observed Ne abundance in the CSM may help place constraints on potential progenitor channels, as Ne emission is weak in the spectra of WC-type WR stars \citep{Crowther2007}. A more thorough discussion of a WR progenitor of these objects is given in Section \ref{subsubsec:comparesneicn}. After maximum, the strong C III and C IV emission lines that dominated the spectra fade. They are replaced by weaker emission and P-Cygni lines of C II and O III. The spectra all maintain their blue continua until roughly ten days after peak brightness. At this phase, their characteristics begin to diverge. A break in the continuum develops blueward of 6000 \AA{} in the spectra of the luminous Icn SN\,2021ckj and SN\,2021csp. This sharp rise in the continua has been attributed to Fe II fluorescence due to ongoing CSI \citep{Perley2022}. By three weeks after maximum light the narrow lines have mostly faded and broad features with velocities $\approx$10,000 km s$^{-1}$ at $\approx$5000 \AA{} have developed in the spectra of these objects. On the other hand, SN\,2019hgp retains its P-Cygni features for a longer time. At this phase SN\,2019hgp more closely resembles more normal SNe Ic \citep{Gal-Yam2022}. A possible explanation for the differences in late-time spectral features observed in the SNe Icn sample is if SN\,2021ckj and SN\,2021csp had a strong asymmetric outflow, possibly caused by a jet or an aspherical CSM, in which a fraction of the ejecta expanded at high velocities. An asymmetric, high-velocity outflow could create broad features in the spectra. \citet{Fraser2021} notice similarities between the late-time spectra of SN\,2021csp and those of peculiar SNe Ic-BL such as iPTF16asu \citep{Whitesides2017,Wang2021} and SN\,2018gep \citep{Ho2019,Pritchard2021,Leung2021}, both of which were fast-evolving and had evidence for CSI at early times. SNe Ic-BL have been associated with gamma-ray bursts (GRBs) powered by jets launched during the explosion \citep[see e.g.,][]{MacFadyen2001,Stanek2003}. Although no associated GRBs were found for iPTF16asu and SN\,2018gep, this could be due to the jet failing to break out from the CSM or a viewing angle effect. In this picture, the differences between the late time SNe Icn spectra could be due to different explosion mechanisms or different viewing angles. A more thorough discussion of the differences in late-time spectral features is given in Section \ref{sec:discussion}. \begin{figure*} \begin{center} \includegraphics[width=0.8\textwidth]{allspec_allphase.pdf}\label{fig:allspec} \end{center} \centering \includegraphics[width=0.74\textwidth]{sn2019jc_keck.pdf}\label{fig:keck} \caption{The spectral evolution of the four SNe Icn before maximum light (a), up to ten days after maximum (b), and roughly three weeks after maximum (c). All wavelengths have been shifted to the rest frame and fluxes have been normalized and shifted for display. Prominent absorption and emission features of ionized C have been marked by vertical dashed lines. (d) The Keck LRIS spectrum of SN\,2019jc at maximum light in the region blueward of 5300\AA{}. A number of narrow absorption and emission features have been identified.} \label{fig:specbyphase} \end{figure*} \section{Progenitor Analysis} \label{sec:progenitor} \begin{figure*} \centering \includegraphics[width=0.48\textwidth]{19jc_bestfit.pdf}\label{fig:19jcbestfit} \includegraphics[width=0.48\textwidth]{19hgp_bestfit.pdf}\label{fig:19hgpbestfit} \newline \centering \includegraphics[width=0.48\textwidth]{21csp_bestfit.pdf}\label{fig:21cspbestfit} \caption{Model CSI and $^{56}$Ni decay light curves compared to the bolometric light curves of (a) SN\,2019jc, (b) SN\,2019hgp, and (c) SN\,2021csp. The CSI components are shown with a solid line and the radioactive decay components are shown with a dashed-dotted line. Different fits assuming a shell-like and wind-like CSM are shown in red and blue, respectively. We find few differences between the different CSM structures. The $^{56}$Ni decay component is estimated assuming the latest photometric epoch for each object is powered solely by radioactive decay. Our early-time observations of each object are compatible with only a CSI component, with conservative upper limits on the $^{56}$Ni mass from late-time photometry ($M_{\text{Ni}}$ $\leq$ 0.04 M$_\odot$).} \label{fig:lcfits} \end{figure*} \subsection{Circumstellar Interaction Models}\label{subsec:csmmodels} Their rapid evolution, high peak luminosities, blue colors, and narrow spectral features indicate that SNe Icn are primarily powered by CSI at early times. In order to estimate the physical parameters of the SN ejecta and CSM, we attempt to fit the bolometric light curves of our SNe Icn sample using a CSI model \citep{Chatzopoulos2012}. CSI can reproduce the optical behavior of many different fast-evolving SNe \citep[e.g.,][]{Rest2018,Pritchard2021,Xiang2021} at early phases, while radioactive decay of $^{56}$Ni is often needed to match the late-time light curve evolution. The model, which uses the semi-analytical formalism described in \citet{Chevalier1982} and \citet{Chevalier1994}, has already been used to fit the light curves of interaction-powered SNe \citep{Jiang2020}, including SNe Ibn and other fast transients \citep{Pellegrino2022}. Although this analytical modeling makes several simplifying assumptions, such as spherical symmetry and a centrally-located powering source, it is a useful tool for obtaining rough estimates of the explosion and progenitor properties. CSI drives forward and reverse shocks into the CSM and SN ejecta, respectively, which sweeps up the material and converts kinetic energy into radiation. To calculate the luminosity input from these shocks the model assumes the CSM begins directly outside the progenitor radius. The SN ejecta distribution is modeled with a steeper density gradient in the outer ejecta ($\rho \propto r^{-n}$) and a shallower gradient in the inner ejecta ($\rho \propto r^{-\delta}$). We assume as fixed parameters the ejecta density power laws, n = 10 and $\delta$ = 1, as well as the optical opacity, $\kappa_{\text{opt}} = 0.04$ g cm$^{-2}$, appropriate for mixtures of C and O \citep{Rabinak2011}. We test both a shell-like ($\rho_{\text{CSM}} \propto \text{constant}$) and wind-like ($\rho_{\text{CSM}} \propto r^{-2}$) CSM distribution. We then fit for the remaining ejecta and CSM parameters, including: \begin{enumerate} \item $M_{\text{ej}}$, the ejecta mass; \item $v_{\text{ej}}$, the ejecta velocity; \item $M_{\text{CSM}}$, the CSM mass; \item $R_0$, the inner CSM radius; \item $\rho_0$, the CSM density at R$_0$; and \item $\epsilon$, the efficiency in converting kinetic to thermal energy; \end{enumerate} \begin{deluxetable*}{lcccccccc}[t!] \tablecaption{CSI Plus $^{56}$Ni Decay Model Parameters\label{tab:modelparams}} \tablehead{ \colhead{Object} & \colhead{$M_{\text{ej}}$ ($M_\odot$)} & \colhead{$v_{\text{ej}}$ (10$^3$ km s$^{-1}$)} & \colhead{$M_{\text{CSM}}$ ($M_\odot$)} & \colhead{$R_0$ (10$^{14}$ cm)} & \colhead{log$_{10}$($\rho_0$) (g cm$^{-3}$)} & \colhead{$\epsilon$} & \colhead{$M_{\text{Ni}}$\tablenotemark{a} ($M_\odot$)}} \startdata SN\,2019jc (s=0) & 0.67$^{+0.55}_{-0.37}$ &8.43$^{+3.06}_{-2.51}$ & 0.41$^{+0.25}_{-0.14}$ & 3.38$^{+2.19}_{-1.24}$ & -9.65$^{+0.81}_{-0.80}$ & 0.03$^{+0.02}_{-0.01}$ & $\leq$ 0.04 \\ SN\,2019jc (s=2) & 1.09$^{+1.31}_{-0.67}$ & 7.03$^{+2.50}_{-1.99}$ & 0.58$^{+0.24}_{-0.21}$ & 4.04$^{+2.33}_{-1.72}$ & -10.41$^{+1.05}_{-0.72}$ & 0.03$^{+0.02}_{-0.01}$ & $\leq$ 0.04 \\ \hline SN\,2019hgp (s=0) & 1.34$^{+1.15}_{-0.73}$ & 14.63$^{+3.61}_{-3.10}$ & 1.65$^{+0.49}_{-0.53}$ & 4.66$^{+1.62}_{-1.72}$ & -9.76$^{+0.90}_{-0.80}$ & 0.02$^{+0.01}_{-0.01}$ & $\leq$ 0.03 \\ SN\,2019hgp (s=2) & 1.95$^{+1.37}_{-0.96}$ & 13.38$^{+3.50}_{-2.76}$ & 1.76$^{+0.47}_{-0.56}$ & 4.83$^{+1.58}_{-1.69}$ & -9.96$^{+0.58}_{-0.70}$ & 0.02$^{+0.01}_{-0.01}$ & $\leq$ 0.03 \\ \hline SN\,2021csp (s=0) & 1.90$^{+1.28}_{-0.75}$ & 20.24$^{+3.34}_{-2.97}$ & 1.68$^{+0.49}_{-0.43}$ & 2.74$^{+0.88}_{-0.75}$ & -9.35$^{+0.61}_{-0.63}$ & 0.02$^{+0.01}_{-0.01}$ & $\leq$ 0.03\\ SN\,2021csp (s=2) & 1.64$^{+1.03}_{-0.71}$ & 18.20$^{+3.95}_{-2.98}$ & 1.72$^{+0.46}_{-0.45}$ & 2.63$^{+0.89}_{-0.72}$ & -9.72$^{+0.56}_{-0.41}$ & 0.03$^{+0.01}_{-0.01}$ & $\leq$ 0.03 \\ \enddata \tablenotetext{a}{Upper limits from late-time photometry} \end{deluxetable*} Best-fit model light curves compared with measured bolometric luminosities are shown in Figure \ref{fig:lcfits} and best-fit parameters are given in Table \ref{tab:modelparams}. We find that both a CSM shell and wind fit all the objects well. Therefore we are unable to make conclusions about the structure of the CSM. For all our objects we find that CSI alone reproduces the early-time luminosity evolution, with very little ejecta ($M_{\text{ej}}$ $\lesssim$ 2 M$_\odot$) needed to reproduce the light curves. The mass of $^{56}$Ni produced in the explosion, $M_{\text{Ni}}$, is not well-constrained by our early-time data, particularly for the luminous SN\,2021csp. To find a conservative upper limit on the $M_{\text{Ni}}$ for each object, we assume that the entirety of the luminosity at the latest photometric epoch is due to radioactive decay and calculate the necessary $M_{\text{Ni}}$ using our best-fit ejecta masses and velocities. For SN\,2019hgp, we use late-time (50 days after peak) photometry from \citet{Gal-Yam2022} to estimate the bolometric luminosity at this epoch. Because SN\,2019jc was only observed up to $\approx$ 10 days after explosion, when CSI is almost certainly still the dominant powering mechanism, our $M_{\text{Ni}}$ upper limit is particularly conservative for this object. A similar procedure was performed by \citet{Perley2022}, who use late-time non-detections of SN\,2021csp to put limits on the amount of $^{56}$Ni synthesized in the explosion. From their non-detection roughly 80 days after maximum, they estimate L $<$ 6 $\times$ 10$^{40}$ erg s$^{-1}$ at this phase. To estimate $M_{\text{Ni}}$ using this late-time luminosity upper limit, we follow the formalism of \citet{Hamuy2003} and account for varying gamma-ray optical depth \citep{Clocchiatti1997,Sollerman1998}. We use our best-fit $M_{\text{ej}}$ and $v_{\text{ej}}$ values to estimate an explosion energy and assume a gamma-ray opacity $\kappa_\gamma$ = 0.08 cm$^2$ g$^{-1}$ (varying this parameter has a negligible effect on our estimates). From this procedure we find that $M_{\text{Ni}} \leq 0.03$ M$_\odot$ is permitted by the late-time photometry of SN\,2021csp \citep{Perley2022}. Following a similar procedure, we find comparable upper limits for SN\,2019jc ($M_{\text{Ni}}$ $\leq$ 0.04 M$_\odot$) and SN\,2019hgp ($M_{\text{Ni}}$ $\leq$ 0.03 M$_\odot$) from the last photometric epochs of these objects. Figure \ref{fig:ejectaandnimasses} compares the ejecta and $^{56}$Ni mass parameters for our SNe Icn sample to those of SNe Ibc and SNe Ic-BL in literature \citep{Taddia2018,Taddia2019}. We find that the ejecta and $^{56}$Ni masses of the SNe Icn differ by a factor of several from those of the SESNe. Most striking is the differences in estimated $^{56}$Ni masses between the SNe Icn and the SNe Ic-BL, which are off by an order of magnitude in many cases. These discrepancies suggest that normal SNe Ibc or SN Ic-BL explosions within a dense CSM cannot be the underlying explosion mechanisms powering SNe Icn. \begin{figure*} \centering \includegraphics[width=0.8\textwidth]{compare_ejecta_ni_masses.pdf} \caption{The $^{56}$Ni mass versus the ejecta mass of the SNe Icn (orange) fit with a CSI model, assuming a shell-like CSM structure. For comparison we plot ejecta and radioactive mass values from a sample of SESNe \citep[blue and purple]{Taddia2018,Taddia2019} and USSNe from the literature \citep[green]{Drout2013,De2018,Yao2020}. The SNe Icn $^{56}$Ni masses are upper limits derived from late-time photometry; even so, they are at odds with estimates of the SESNe but are in agreement with some USSNe.} \label{fig:ejectaandnimasses} \end{figure*} Additionally, the best-fit ejecta mass estimates are in conflict with the pre-SN masses of observed WC-type WR stars, which are $\gtrsim 10$ $M_\odot$ \citep[e.g.;][]{Crowther2002,Sander2019}. This assumes the entirety of the star's mass is ejected during the explosion; if instead a significant portion of the star's mass directly collapses to a black hole or falls back onto the newly-formed compact object, this could alleviate some of the discrepancy \citep{Moriya2010}. Another possible explanation for the discrepancy could be if a significant fraction of the ejecta is ``dark'' and does not interact with the CSM, in which case the ejecta mass estimates from our light curve fitting would be an underestimate of the true mass \citep{Gal-Yam2022}. On the other hand, the combination of best-fit ejecta and $^{56}$Ni masses are more consistent with USSNe such as iPTF14gqr \citep{De2018}, SN\,2005ek \citep{Drout2013}, and SN\,2019dge \citep{Yao2020}. These objects are plotted with green symbols in Figure \ref{fig:ejectaandnimasses}. In particular, the ejecta and $^{56}$Ni masses of SN\,2019jc fall in the same region of parameter space as the USSNe candidates. \begin{figure*} \centering \includegraphics[width=0.9\textwidth]{icn_thalf_gmax.pdf} \caption{The \textit{g}-band peak absolute magnitude versus time above half the peak luminosity of the three SNe Icn with well-sampled light curve peaks compared with the fast transient gold samples from \citet[gray squares]{Drout2014} and \citet[other symbols]{Ho2021}. The SNe Icn, as well as the ultra-stripped Type Ib SN\,2019dge \citep{Yao2020}, are labeled. SN\,2021csp and SN\,2019hgp occupy similar regions of parameter space as rapidly-evolving SNe Ibn, but SN\,2019jc is remarkably fainter and faster-evolving.} \label{fig:thalfs} \end{figure*} In Figure \ref{fig:thalfs} we plot the \textit{g}-band absolute magnitude versus time above half the maximum luminosity of our SNe Icn sample compared with the fast transient samples from \citet{Drout2014} and \citet{Ho2021}. \citet{Ho2021} found that the luminous fast transients are primarily SNe powered by CSI. Two of the SNe Icn (SN\,2019hgp and SN\,2021csp) also fall within the same region of parameter space as SNe Ibn. SN\,2019jc, on the other hand, is unique in that it is the least luminous and fastest-evolving SN Icn, occupying the same region of parameter space as SNe IIb with light curves that are dominated by rapidly-evolving shock cooling emission. Despite its location in this phase space, we instead favor circumstellar interaction as the primary mechanism powering the light curve of SN\,2019jc due to its early-time spectral features. We also note that the USSN 2019dge has a similar light-curve timescale and peak luminosity to SN\,2019jc. We explore other similarities between SNe Icn and USSNe in Section \ref{subsubsec:ussnediscussion}. \begin{figure*} \centering \includegraphics[width=0.48\textwidth]{sn2019jc_snloc_sfr.pdf}\label{fig:19jchost} \includegraphics[width=0.48\textwidth]{sesne_sfrdensity.pdf}\label{fig:sfrhist} \caption{(left) \textit{u'}-band SDSS image of the host galaxy of SN\,2019jc. The SN location is marked by a 10$\times$10 px ($\approx$ 1.5 kpc$\times$1.5 kpc) aperture. (right) A histogram comparing the estimated SFR density at the location of SN\,2019jc (orange) with SFR densities at the locations of SESNe from \citet[][blue]{Galbany2018} and USSNe (green). The value we measure at the location of iPTF14gqr is an upper limit, marked by a dashed green line and leftward facing arrow. SN\,2019jc lies at the lower edge of the SESNe distribution but is comparable to the USSNe.} \label{fig:sfrdensity} \end{figure*} \subsection{Host Galaxy Analysis}\label{subsec:hostanalysis} The host galaxies of SN\,2019hgp and SN\,2021csp have previously been studied \citep{Gal-Yam2022,Perley2022}. Their hosts were found to be similar in star formation rate (SFR) and stellar mass to hosts of normal SNe Ibn and SN Ic-BL (see e.g., Figure 18 of \citealt{Perley2022}). This implies a similar progenitor environment between these classes of objects, as SESNe are more frequently associated with regions of higher star formation that produce high-mass stars \citep{Anderson2012}. The SNe Icn studied in the literature have been at higher redshifts, which makes studying their host properties at the explosion site difficult. Instead, only the global properties of their host galaxies have been estimated. These objects exploded at low projected offsets from their star-forming host centers \citep{Gal-Yam2022,Perley2022}. SN\,2019jc, on the other hand, exploded on the outskirts of a nearby ($z$ = 0.0195), face-on spiral galaxy with pre-explosion SDSS images. This affords us the opportunity to study the location of this SN Icn in greater detail. SN\,2019jc exploded relatively far from its star-forming host galaxy, at a projected distance of 11.2 kpc from the center of its host. Following the procedure of \citet{Hosseinzadeh2019}, we use an archival SDSS \textit{u'}-band image of the host galaxy to estimate the SFR density at the SN location. First, we find the flux in a 10 px $\times$ 10 px ($\approx$ 1.5 kpc $\times$ 1.5 kpc) aperture centered on the SN location and estimate errors following the SDSS Frame Data Model\footnote{https://data.sdss.org/datamodel/files/BOSS4$\_$PHOTOOBJ\\/frames/RERUN/RUN/CAMCOL/frame.html}. We measure an AB magnitude within this aperture of 22.14 $\pm$ 0.03, consistent with the median 5$\sigma$ limiting magnitude of SDSS \textit{u'}-band images. After correcting for Galactic reddening, this magnitude upper limit gives a SFR density upper limit $\Sigma_{\text{SFR}} \leq 2.9\times10^{-3}$ M$_\odot$ yr$^{-1}$ kpc$^{-2}$ \citep{Kennicutt1998}. In Figure \ref{fig:sfrdensity} we compare this SFR density limit to values in the literature for a sample of SESNe \citep{Galbany2018}. We also estimate the SFR densities at the locations of USSNe \citep{Drout2013,De2018,Yao2020} in the same way as for SN\,2019jc. In all these cases the values we estimate roughly agree with those in the literature. SN\,2019jc lies at the very lowest end of the SESNe distribution. However, the SFR density at the SN location is more consistent with values we measure for the USSNe. These low SFR densities have been used to argue against progenitors with high zero-age main sequence masses for USSNe. While the upper limit does not completely rule out a more massive star as the progenitor of SN\,2019jc, it is intriguing that the SN Icn with the best host galaxy observations to date would be at the lower end of the SFR density distribution for SESNe. This tension is heightened if one assumes that the progenitors of all SNe Icn are WR stars, in which case the zero-age main sequence masses of these objects would be equally or more massive than the progenitors of SESNe. Instead, SN\,2019jc may be the result of a different progenitor channel than other SNe Icn. Studying the field distribution of O- and B-type stars in the local universe reveals that \textit{in situ} formation is rare for these populations \citep[e.g.,][]{DorigoJones2020}. Instead, these stars are hypothesized to travel from their places of birth to their explosion sites due to either supernova kicks from a binary companion or dynamical interactions within a stellar cluster. We consider whether these scenarios are consistent with a high-mass star at the location of SN\,2019jc. We estimate that the nearest region of high SFR density lies approximately 2.7 kpc from SN\,2019jc (Figure \ref{fig:sfrdensity}). Conservatively estimating the time from formation to core collapse as $\approx$ 10 Myr, a massive star progenitor would need a runaway velocity of $\approx$ 250 km s$^{-1}$ to reach the SN location in its lifetime. It is unlikely that a WR star could be ejected from its binary system with this velocity by a companion SN, as typical kick velocities from companion SNe are an order of magnitude below this estimated velocity \citep{Renzo2019}, and most massive stars only travel tens or hundreds of parsecs before core-collapse \citep{Cantiello2007,Eldridge2011,Renzo2019}. On the other hand, it is possible to achieve this runaway velocity through dynamical interaction in stellar clusters \citep{Perets2012,Andersson2021}, although it still lies on the higher end of the simulated runaway velocity distribution \citep{Oh2016}. If instead the progenitor of SN\,2019jc were less massive than a WR star and in a close binary, the lifetime of the primary star could be longer, which would either lower the high runaway velocity needed to reach the SN location to a more reasonable value or reduce the tension in allowing the progenitor to be formed \textit{in situ}. In such a case the large amounts of CSM around the SN progenitor would be formed due to binary stripping rather than stellar winds occurring towards the end of a massive star's lifetime, which have mass-loss rates that are orders of magnitude lower than those estimated for SNe Ibn and SNe Icn \citep{Chevalier2006,Crowther2007,Gal-Yam2022,Maeda2022}, but are more similar to those observed for SNe Ibc progenitors \citep{Wellons2012}. The $M_{\text{ej}}$ and $M_{\text{Ni}}$ values inferred from our bolometric modeling permit a progenitor with a lower mass than a WR star while also ruling out traditional thermonuclear explosions of white dwarfs. The SFR density estimate is an upper limit due to the shallow limiting magnitude of the SDSS survey in the \textit{u'}-band. Additionally, the \textit{u'}-band is not blue enough to capture the majority of the UV flux. Unfortunately, the \textit{Swift} UVOT limiting magnitudes are comparable to those of the SDSS survey and therefore are unable to place tighter constraints of the SFR density. Without deeper images that extend further into the UV we cannot determine the true SFR at the location of SN\,2019jc. Even so, this upper limit on the SFR, along with the low ejecta and $^{56}$Ni mass estimates inferred from SNe Icn light curve modeling, lead us to question the assumption of a WR progenitor of all these objects. \section{Discussion} \label{sec:discussion} Observations of their photometric and spectral evolution reveal that SNe Icn are interesting objects at the cross-section of SESNe, SNe Ibn, and fast transients. Their rapid light curve evolution, diverse peak luminosities, and narrow spectral lines at early times resemble the interaction-powered early phases of SNe Ibn and other fast transients, but their spectra two weeks after maximum can also resemble other SESNe. Additionally, the ejecta and $^{56}$Ni masses inferred from modeling their light curves are often an order of magnitude smaller than those of typical SESNe. In this section we search for progenitor systems and explosion mechanisms that can explain the combination of these characteristics. \subsection{Possible Progenitor Channels}\label{subsec:progenitors} \subsubsection{A WR Star Progenitor?}\label{subsubsec:comparesneicn} The defining characteristic of SNe Icn is their interaction with H- and He-poor CSM. This is most similar to SNe Ibn, which have early-time light curves and spectra that are dominated by interaction with H-poor CSM. Based on these CSM environments we explore whether SNe Ibn and SNe Icn could share a progenitor channel. Although our sample is small, most of the SNe Icn we study have \textit{g-r} colors (Figure \ref{fig:grcolors}), blackbody properties (Figure \ref{fig:bbvalues}), and rise times and peak luminosities (Figure \ref{fig:thalfs}) that are consistent with those of SNe Ibn. SNe Ibn are also a rare class of SNe; although not as rare as SNe Icn, only tens of SNe Ibn have been discovered to date \citep{Hosseinzadeh2017}. WR stars are commonly thought to be the progenitors of SNe Ibn \citep{Foley2007,Pastorello2007,Hosseinzadeh2017}. Several observational pieces of evidence support this. Perhaps the strongest such piece of evidence is the Type Ibn SN\,2006jc, the archetype of its class, for which a pre-explosion outburst was noted roughly two years before the terminal explosion \citep{Pastorello2007}. Only late-stage massive stars have been observed to undergo such explosive outbursts during LBV stages \citep{Smith2006}, before transitioning into WR stars. This, along with the CSM composition and velocity inferred from the narrow features in the spectra of SN\,2006jc \citep{Foley2007}, supports the notion that these progenitors are massive stars. Additionally, SNe Ibn are almost exclusively found in spiral galaxies \citep[][but see also \citealt{Sanders2013}]{Pastorello2015} and at locations with high SFR densities \citep{Hosseinzadeh2019}, implying a younger stellar population. Both SNe Ibn and SNe Icn have spectral features consistent with a WR stellar wind \citep{Gal-Yam2014}, specifically with highly ionized species of He, N, C, and O. \citet{Gal-Yam2022} propose that the differences between SNe Ibn and SNe Icn spectral features\textemdash mainly the lack of He and N in SNe Icn\textemdash mirrors the differences in WN and WC subtypes of WR stars. The lack of H, He and N, and the presence of Ne, in the CSM around SN\,2019hgp matches the chemical composition of WC stars \citep{Gal-Yam2022} and the yields expected from the triple-alpha process \citep{Perley2022}, indicating that the composition of the material stripped from the progenitor must be similar to that of a WR star. WR stars have also been theoretically predicted to be the progenitors of at least some normal SESNe as well \citep{Sukhbold2016}. Some early-time observations of SESNe support this \citep[e.g.,][]{Cao2013,Gal-Yam2014}, but other studies have found that SESNe are unlikely to originate exclusively from WR stars \citep{Eldridge2013,Smith2014,Taddia2018}. \citet{Gal-Yam2022} notice similarities between the late-time spectra of SN\,2019hgp and the Type Ic SN\,2007gr, possibly showing that the explosion of SN\,2019hgp is similar to that of SN\,2007gr but is concealed by a dense CSM. However, \citet{Mazzali2010} find M$_{\text{Ni}}$ = 0.076 $M_\odot$ for SN\,2007gr which is incompatible with the light curve evolution of SN\,2019hgp, as noted by \citet{Gal-Yam2022} and supported by our light curve modeling. We also find that the explosion energies and ejecta and $^{56}$Ni masses of the SNe Icn in our sample are broadly inconsistent with estimates for SESNe from the literature. Therefore it seems unlikely that the explosion mechanism of normal SESNe\textemdash possibly the successful core-collapse of a WR star\textemdash can reproduce both SESNe and SNe Icn observables. \subsubsection{A New Type of Ultra-Stripped Envelope Supernovae?}\label{subsubsec:ussnediscussion} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{comparison_spectra.pdf} \caption{A spectrum of SN\,2019hgp compared with the USSN model spectrum at maximum light from \citet{Moriya2017}, the ultra-stripped SN\,2005ek \citep{Drout2013}, the prototypical Type Ibn SN\,2006jc, and the normal Type Ic SN\,2007gr. Spectra of SN\,2006jc, SN\,2005ek, and SN\,2007gr were obtained from WiseRep \citep{Yaron2012}. Phases are denoted to the right of each spectrum. Possible spectral features are marked with dashed lines. SN\,2019hgp shares several features with the USSNe at these phases.} \label{fig:comparisonspectra} \end{figure} Based on the similar spectral features between SNe Ibn and SNe Icn, \citet{Gal-Yam2022} and \citet{Perley2022} suggest that the distinction between SNe Ibn and SNe Icn follows the differences in WN and WC subtypes of WR stars. However, several problems exist with assuming WR stars as the progenitors to all SNe Ibn. Estimates of the rates of WR explosions \citep{Smith2014,Perley2022} are often orders of magnitude higher than the rates of SNe Ibn \citep{Maeda2022}. Furthermore, observations of Galactic WR stars have not found evidence for high mass loss rates necessary to produce the large amounts of CSM estimated from SNe Ibn light curve modeling \citep{Crowther2007}. These discrepancies may be resolved if not one but several progenitor systems lead to H-poor interaction-powered SNe. There is evidence that a WR or other high mass progenitor is in tension with observations of the Type Ibn PS1-12sk. \citet{Hosseinzadeh2019} showed that PS1-12sk was unusual in that the SN exploded in a region devoid of star formation. Deep \textit{Hubble Space Telescope} upper limits placed strong constraints on the SFR density at the SN location, all but ruling out a massive star progenitor of this SN. Similarly, we find that the location of SN\,2019jc has relatively little ongoing star formation. Estimating the SFR density at the SN location places SN\,2019jc at the lower edge of the SESNe host environment distribution, at odds with a WR progenitor of this object. Interestingly, SN\,2019jc has a relatively similar host galaxy offset and SFR density to several USSNe, including iPTF14gqr \citep{De2018} and SN\,2005ek \citep{Drout2013}. Figure \ref{fig:sfrdensity} shows that the environments of these SNe are all comparable. \citet{De2018} and \citet{Drout2013} both favor a binary system consisting of a low mass evolved star and a compact degenerate object, such as a neutron star, for these SNe largely because of the SFRs of their local environments. Assuming a lower mass star in a close binary system for SN\,2019jc would alleviate the problem of finding unlikely methods for a WR star to travel far from regions of higher star formation. In addition, the ejecta and $^{56}$Ni masses inferred from our SNe Icn light curve modeling are strongly at odds with those of typical SESNe. Our upper limit on the $^{56}$Ni mass for SN\,2021csp agrees with the value from \citet{Perley2022}, which places strong limits on the type of explosion that could power these objects. The discrepancy in ejecta parameters is most extreme between the SNe Icn and samples of SNe Ic-BL. SNe Ic-BL have been suggested to be related to SNe Icn \citep{Fraser2021,Perley2022}, yet Figure \ref{fig:ejectaandnimasses} show that the SNe Icn ejecta and $^{56}$Ni masses differ from those of the SNe Ic-BL by up to an order of magnitude. However, they are similar to those of USSNe in the literature \citep{Drout2013,De2018,Yao2020}. The combination of low ($\lesssim$ 1 M$_\odot$) ejecta mass and $^{56}$Ni mass is found in observations and theoretical models \citep{Tauris2013,Moriya2017} of these objects. We compare spectra of SNe Icn, models and observations of USSNe, and prototypical SESNe in Figure \ref{fig:comparisonspectra}. SNe Icn spectra are dominated by signatures of CSI at early times, masking the underlying ejecta features. Unfortunately spectra of SN\,2019jc were only obtained during this time. However, our spectrum of SN\,2019jc at maximum appears most similar to SN\,2019hgp (Figure \ref{fig:specbyphase}), for which there is ample spectroscopic coverage at later phases. Therefore, we include a spectrum of SN\,2019hgp 15 days after maximum instead of SN\,2019jc, assuming they have similar late time evolution despite differences in peak brightness and decline rates. The spectrum of SN\,2019hgp appears to match that of SN\,2006jc at first glance, but on closer inspection we find that the dominant He\,I $\lambda$4472 and $\lambda$5876 features in the latter are instead replaced by Mg\,II $\lambda$4481 and C\,II $\lambda$5890 lines in the former. We notice more qualitative similarities between SN\,2019hgp and the USSNe than any of the other objects, particularly blueward of 5000 \AA{} where we identify Mg II and Ca II absorption features not seen in the other objects, as well as similar O I absorption features around 7775 \AA{}. SN\,2005ek quickly transitioned to its optically thin phase roughly 10 days after maximum. However, this transition does not occur until weeks later in the case of the SNe Icn. It is possible that the sustained CSI we see in the SNe Icn maintains a higher opacity until later times, leading to better agreement between the late-time spectrum of SN\,2019hgp and the USSNe spectra at maximum light. The spectrum of the normal Type Ic SN\,2007gr has a different continuum shape and absorption features than SN\,2019hgp at a similar phase, again providing evidence that SNe Icn are not normal SESN explosions. We find some discrepancies between theoretical models of USSNe \citep{Moriya2017} and the SNe Icn in our sample, especially in terms of peak luminosity and early-time spectral features. However, these differences can easily be explained by the addition of CSI, which masks the spectral signatures of the underlying ejecta at early times and provides an additional power source that can increase the peak luminosity by several orders of magnitude. For several of the USSNe \citep{De2018,Yao2020} shock-cooling was instead modeled as an additional mechanism powering the early-time light curves. We suggest that some SNe Icn could be USSNe that have completely lost their outer layers due to extreme binary stripping, whereas others studied in the literature have still retained an extended envelope. This could explain how both shock-breakout and CSI are observed in objects of this class. \subsection{Possible Explosion Mechanisms}\label{subsec:explosion} If SNe Icn have a diverse set of progenitor systems, then their explosion mechanisms may vary as well. Differing explosion mechanisms between these objects can explain some of the observed diversity in light curve and spectral properties. Any proposed explosion scenario must reproduce the ejecta velocities, ejecta masses, and $^{56}$Ni masses estimated from light-curve fits. A normal SESN explosion interacting with CSM is ruled out by our $^{56}$Ni upper limits; therefore, we search for more exotic scenarios. SN\,2019jc is unique in having a light curve that is both faster-evolving and fainter than those of the other SNe Icn (Figure \ref{fig:thalfs}). Our light curve modeling shows that SN\,2019jc has a low explosion energy ($\approx$ 4 $\times$ 10$^{50}$ erg) and ejecta mass ($\approx$ 0.7 M$_\odot$), both of which are lower than those of more normal SESNe but are consistent with theoretical models and observations of USSNe. The core-collapse of an ultra-stripped, lower mass progenitor to SN\,2019jc is also consistent with its location far from regions of active star formation. Interestingly, the explosion energy, ejecta and $^{56}$Ni masses, rapid light-curve evolution, and explosion site properties of SN\,2019jc are also consistent with theoretical models of stripped-envelope electron-capture (EC) SNe \citep{Moriya2016}. Stars with initial masses $\approx$ 8 M$_\odot$ are predicted to explode when their O-Ne-Mg degenerate cores undergo electron capture, triggering core-collapse \citep[e.g.;][]{Miyaji1980,Nomoto1984,Nomoto1987}. Normally in single star evolutionary models the EC SN progenitor retains its H envelope and is observed as a Type II SN. However, if the progenitor is stripped of its outer layers through binary interaction \citep{Moriya2016} or enhanced mass loss due to episodic burning \citep{Woosley2015}, a H-poor EC SN would be observed. Some theoretical models of ultra-stripped He stars also explode as EC SNe \citep{Tauris2015}. While an EC explosion mechanism has been proposed for the Type II SN\,2018zd \citep{Hiramatsu2021}, to date the possibility of an EC origin of interaction-powered SESNe has not been explored. On the other hand, modeling the light curve of SN\,2021csp gives ejecta masses and explosion energies that are higher than those predicted for and observed in USSNe. This object may have an explosion mechanism that is different than that of SN\,2019jc. SN\,2021csp could be similar to other SNe Ibc that interact with dense CSM \citep{Whitesides2017,Ho2019,Pritchard2021}, as noted by \citet{Fraser2021}. The ejecta masses inferred from modeling this CSI could be underestimated if only a fraction of the ejecta interacts with the CSM. However, stringent limits on the amount of $^{56}$Ni produced in the explosion of SN\,2021csp are strongly at odds with the amounts estimated for normal SNe Ibc and SNe Ic-BL (Figure \ref{fig:ejectaandnimasses}), which can be up to an order of magnitude larger. Therefore, the explosion of SN\,2021csp must eject more mass at higher velocities than USSNe but produce less $^{56}$Ni than normal SESNe. \citet{Perley2022} proposed that a jet launched during the partial or failed explosion of a massive star could meet these criteria \citep{Woosley1993,Moriya2010}. The high ejecta velocities observed for SN\,2021csp could be due to a small amount of material being launched by a jet. Jets have been suggested as the powering mechanism behind long GRBs \citep{Khokhlov1999,MacFadyen1999,MacFadyen2001}, some of which are associated with SNe Ic-BL \citep[e.g.,][]{Reichart1999,Stanek2003}. Indeed \citet{Fraser2021} notice spectral similarities between SN\,2021csp and SNe Ic-BL at later phases, when signatures of the CSI have faded. However, the ejecta parameters (in particular, the $^{56}$Ni masses) we infer from our light-curve fits are still at odds with those of normal SNe Ic-BL explosions. To explain both the low amount of $^{56}$Ni produced during the explosion and the presence of a jet, a substantial amount of the inner ejecta must have remained gravitationally bound and collapsed after the explosion. These so-called fallback SNe are predicted to occur when the core collapse of a stripped massive star is not energetic enough to unbind the entire star. As a result, only the outermost material is ejected and the rest falls back onto the central remnant. The amount of $^{56}$Ni that remains unbound after the fallback is variable and subject to the explosion parameters, such as the amount of mixing during the explosion, but is orders of magnitude smaller than in normal SESNe. Although fallback SNe have been used to explain the faintest SNe \citep[e.g.,][]{Valenti2009,Moriya2010}, some models reproduce the range of explosion energies and ejecta masses we estimate for SN\,2021csp and the other SNe Icn \citep[see Table 1 of][]{Moriya2010}. These models originate from massive (25--40 M$_\odot$) main sequence stars, which are at odds with the progenitor masses inferred from our host galaxy analysis of SN\,2019jc but are potentially allowed for the locations of the other objects in our sample. The presence of a jet launched during a fallback SN has been used to explain long GRBs not associated with visible SNe \citep{DellaValle2006,Gal-Yam2006,Fynbo2006}. If a jet was launched during the explosion of SN\,2021csp, it could explain the large ejecta velocities measured and possibly mix some of the $^{56}$Ni out into the ejecta that becomes unbound. Recently, \citet{Metzger2022} proposed an alternate scenario in which the rapid evolution, multiband emission, and spectral features of SNe Ibn, SNe Icn, and AT\,2018cow-like fast transients can all be reproduced by the merger of a WR star and a compact object. The differences in observed spectral features and luminosities between these classes is primarily due to the timescales on which the WR star and its compact companion merge. This scenario has the benefit of explaining the similar ejecta velocities, peak luminosities, and rise times of AT\,2018cow and SN\,2021csp \citep{Fraser2021}. Although any explosion mechanism involving a high-mass star appears unlikely for SN\,2019jc, we cannot rule out this scenario for the other objects in our sample. More detailed comparisons between observations of SNe Icn and other rapidly-evolving objects are needed to test this model. Therefore it is possible that different underlying explosions and progenitors are responsible for the diversity in SNe Icn light curve properties, late-time spectral features, and host environments we observe. A higher mass progenitor star is compatible with the location of SN\,2021csp, but a normal SESN explosion within a dense CSM is ruled out based on the $M_{\text{ej}}$ and $M_{\text{Ni}}$ values inferred from its light curve. Instead, a more exotic explosion mechanism, such as a partially successful or fallback explosion, is needed to explain its high ejecta velocities, low $^{56}$Ni mass, bright light curve, and similar late-time spectral features to SNe Ic-BL. On the other hand, models of USSNe, which necessarily involve lower explosion energies and ejecta masses, match the photometric properties, spectral features, and explosion site of SN\,2019jc. In both cases, the observable photometric and spectroscopic signatures of these different explosions are masked by the dominant CSI at early times, making all SNe Icn appear similar at first glance. \section{Conclusions} \label{sec:conclusions} We have analyzed the photometric and spectral properties of the largest sample of SNe Icn to date. Photometrically the SNe Icn all display rapid evolution, blue colors, and heterogeneous peak magnitudes. Their spectra, which are all dominated by narrow emission lines of highly ionized C at early times, are evidence for the SN ejecta interacting with a H- and He-poor CSM. At later phases diverse spectral features are observed, with some objects resembling peculiar SNe Ic-BL and others showing similarities to USSNe. In order to better understand their progenitor systems and explosion mechanisms, we model the bolometric light curves of the well-observed objects in our sample with luminosity inputs from CSI and $^{56}$Ni decay. We find that their rapid evolution and peak luminosities can all be explained by $\lesssim$ 2 M$_\odot$ of ejecta interacting with $\approx$ 1 M$_\odot$ of CSM, with very little ($\leq$ 0.04 M$_\odot$) $^{56}$Ni permitted by our observations. These values are in tension with the ejecta and $^{56}$Ni masses inferred from the light curves of normal SNe Ibc and SNe Ic-BL, but are similar to those of USSNe \citep{Drout2013,De2018,Yao2020}. Additionally, the lowest-redshift SN Icn in our sample (SN\,2019jc) exploded in the outskirts of its host galaxy, with a SFR density at the SN location that is on the extreme low end of the SNe Ibc distribution but is similar to the SFR densities at the locations of USSNe in literature \citep{Drout2013,De2018}. Based on the low estimated ejecta and $^{56}$Ni masses, late-time spectral features, and local SFR densities, we conclude that the explosion of an ultra-stripped low-mass star can explain the observed properties of some SNe Icn. In particular, the spectra and inferred light-curve parameters of SN\,2019jc and SN\,2019hgp, as well as the SN location of SN\,2019jc, favor an ultra-stripped progenitor of these objects. On the other hand, the other two objects in our sample\textemdash SN\,2021ckj and SN\,2021csp\textemdash may have a different progenitor system. A SN explosion with substantial fallback onto a compact remnant formed by the collapse of a WR star could produce these objects, which have slightly higher peak luminosities, smaller host galaxy separations, and show different late-time spectral evolution. In addition, a jet launched during the fallback explosion may be necessary to reproduce the ejecta velocities we measure and explain the spectroscopic similarities between these objects and peculiar SNe Ic-BL \citep[e.g.,][]{Whitesides2017,Pritchard2021}. In terms of their light curve properties and spectral features, SNe Icn most resemble SNe Ibn, which are also powered by ejecta interacting with H-poor CSM. Therefore, it is natural to wonder if SNe Ibn and SNe Icn may be a continuum of objects with the same (or similar) progenitors. This could be the case if both SNe Ibn and SNe Icn are the core-collapse of WR stars, or He stars that have been stripped of their outer layers by close binary interaction \citep{Tauris2013}, with SNe Icn undergoing more stripping than SNe Ibn. The latter has been suggested as the progenitor of the fast-evolving Type Ic SN\,1994I \citep{Nomoto1994}. Although a WR progenitor of SNe Ibn has been suggested \citep{Foley2007}, it is difficult to reconcile a high-mass progenitor with the location of at least one SN Ibn \citep{Hosseinzadeh2019}. It may be that any explosion within a H- (and He-) poor CSM produces properties that are consistent with SNe Ibn (and SNe Icn), in which case multiple progenitor channels are possible for these objects. More systematic studies of the locations of SNe Ibn, as well as their ejecta and CSM properties, are necessary to better constrain their possible progenitors. If some SNe Icn are the explosions of low mass stars stripped by interaction with a compact binary companion, these objects may have important implications for the formation of binary neutron star and neutron star-black hole systems. USSNe have been proposed as the origins of possibly all merging binary neutron stars \citep{Tauris2015}. If this is the case, then better understanding the rates and host galaxy environments of these objects would have important implications for gravitational wave and multimessenger astrophysics. \begin{acknowledgments} This work made use of data from the Las Cumbres Observatory network. The LCO group is supported by AST-1911151 and AST-1911225. I.A. is a CIFAR Azrieli Global Scholar in the Gravity and the Extreme Universe Program and acknowledges support from that program, from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (grant agreement number 852097), from the Israel Science Foundation (grant number 2752/19), from the United States - Israel Binational Science Foundation (BSF), and from the Israeli Council for Higher Education Alon Fellowship. K.A.B. acknowledges support from the DIRAC Institute in the Department of Astronomy at the University of Washington. The DIRAC Institute is supported through generous gifts from the Charles and Lisa Simonyi Fund for Arts and Sciences, and the Washington Research Foundation. Time domain research by the University of Arizona team and D.J.S.\ is supported by NSF grants AST-1821987, 1813466, 1908972, \& 2108032, and by the Heising-Simons Foundation under grant \#2020-1864. Research by S.V. and Y.D. is supported by NSF grants AST-1813176 and AST-2008108. \\ Some of the data presented herein were obtained at the W. M. Keck Observatory, which is operated as a scientific partnership among the California Institute of Technology, the University of California, and NASA; the Observatory was made possible by the generous financial support of the W. M. Keck Foundation. The authors wish to recognize and acknowledge the very significant cultural role and reverence that the summit of Maunakea has always had within the indigenous Hawaiian community. We are most fortunate to have the opportunity to conduct observations from this mountain. This research made use of Astropy, a community-developed core Python package for Astronomy \citep{Astropy2018}, as well as the NASA/IPAC Extragalactic Database (NED), which is operated by the Jet Propulsion Laboratory, California Institute of Technology, under contract with NASA. \end{acknowledgments} \software{\texttt{Astropy} \citep{Astropy2018}, \texttt{DCR} \citep{Pych2004}, \texttt{emcee} \citep{ForemanMackey2013}, \texttt{lcogtsnpipe} \citep{Valenti2016}, Matplotlib \citep{Hunter2007}, Numpy \citep{Harris2020}, \texttt{SSS-CSM} \citep{Jiang2020}, \texttt{Superbol} \citep{Nicholl2018}} \subsubsection*{#1}} \pagestyle{headings} \markright{Reference sheet: \texttt{natbib}} \usepackage{shortvrb} \MakeShortVerb{\|} \begin{document} \thispagestyle{plain} \newcommand{\textsc{Bib}\TeX}{\textsc{Bib}\TeX} \newcommand{\texttt{#1}\def\filedate{#2}\def\fileversion{#3}}}{\texttt{#1}\def\filedate{#2}\def\fileversion{#3}}} \begin{center}{\bfseries\Large Reference sheet for \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ usage}\\ \large(Describing version \fileversion\ from \filedate) \end{center} \begin{quote}\slshape For a more detailed description of the \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ package, \LaTeX\ the source file \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\texttt{.dtx}. \end{quote} \head{Overview} The \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ package is a reimplementation of the \LaTeX\ |\cite| command, to work with both author--year and numerical citations. It is compatible with the standard bibliographic style files, such as \texttt{plain.bst}, as well as with those for \texttt{harvard}, \texttt{apalike}, \texttt{chicago}, \texttt{astron}, \texttt{authordate}, and of course \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}. \head{Loading} Load with |\usepackage[|\emph{options}|]{|\texttt{#1}\def\filedate{#2}\def\fileversion{#3}}|}|. See list of \emph{options} at the end. \head{Replacement bibliography styles} I provide three new \texttt{.bst} files to replace the standard \LaTeX\ numerical ones: \begin{quote}\ttfamily plainnat.bst \qquad abbrvnat.bst \qquad unsrtnat.bst \end{quote} \head{Basic commands} The \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ package has two basic citation commands, |\citet| and |\citep| for \emph{textual} and \emph{parenthetical} citations, respectively. There also exist the starred versions |\citet*| and |\citep*| that print the full author list, and not just the abbreviated one. All of these may take one or two optional arguments to add some text before and after the citation. \begin{quote} \begin{tabular}{l@{\quad$\Rightarrow$\quad}l} |\citet{jon90}| & Jones et al. (1990)\\ |\citet[chap.~2]{jon90}| & Jones et al. (1990, chap.~2)\\[0.5ex] |\citep{jon90}| & (Jones et al., 1990)\\ |\citep[chap.~2]{jon90}| & (Jones et al., 1990, chap.~2)\\ |\citep[see][]{jon90}| & (see Jones et al., 1990)\\ |\citep[see][chap.~2]{jon90}| & (see Jones et al., 1990, chap.~2)\\[0.5ex] |\citet*{jon90}| & Jones, Baker, and Williams (1990)\\ |\citep*{jon90}| & (Jones, Baker, and Williams, 1990) \end{tabular} \end{quote} \head{Multiple citations} Multiple citations may be made by including more than one citation key in the |\cite| command argument. \begin{quote} \begin{tabular}{l@{\quad$\Rightarrow$\quad}l} |\citet{jon90,jam91}| & Jones et al. (1990); James et al. (1991)\\ |\citep{jon90,jam91}| & (Jones et al., 1990; James et al. 1991)\\ |\citep{jon90,jon91}| & (Jones et al., 1990, 1991)\\ |\citep{jon90a,jon90b}| & (Jones et al., 1990a,b) \end{tabular} \end{quote} \head{Numerical mode} These examples are for author--year citation mode. In numerical mode, the results are different. \begin{quote} \begin{tabular}{l@{\quad$\Rightarrow$\quad}l} |\citet{jon90}| & Jones et al. [21]\\ |\citet[chap.~2]{jon90}| & Jones et al. [21, chap.~2]\\[0.5ex] |\citep{jon90}| & [21]\\ |\citep[chap.~2]{jon90}| & [21, chap.~2]\\ |\citep[see][]{jon90}| & [see 21]\\ |\citep[see][chap.~2]{jon90}| & [see 21, chap.~2]\\[0.5ex] |\citep{jon90a,jon90b}| & [21, 32] \end{tabular} \end{quote} \head{Suppressed parentheses} As an alternative form of citation, |\citealt| is the same as |\citet| but \emph{without parentheses}. Similarly, |\citealp| is |\citep| without parentheses. Multiple references, notes, and the starred variants also exist. \begin{quote} \begin{tabular}{l@{\quad$\Rightarrow$\quad}l} |\citealt{jon90}| & Jones et al.\ 1990\\ |\citealt*{jon90}| & Jones, Baker, and Williams 1990\\ |\citealp{jon90}| & Jones et al., 1990\\ |\citealp*{jon90}| & Jones, Baker, and Williams, 1990\\ |\citealp{jon90,jam91}| & Jones et al., 1990; James et al., 1991\\ |\citealp[pg.~32]{jon90}| & Jones et al., 1990, pg.~32\\ |\citetext{priv.\ comm.}| & (priv.\ comm.) \end{tabular} \end{quote} The |\citetext| command allows arbitrary text to be placed in the current citation parentheses. This may be used in combination with |\citealp|. \head{Partial citations} In author--year schemes, it is sometimes desirable to be able to refer to the authors without the year, or vice versa. This is provided with the extra commands \begin{quote} \begin{tabular}{l@{\quad$\Rightarrow$\quad}l} |\citeauthor{jon90}| & Jones et al.\\ |\citeauthor*{jon90}| & Jones, Baker, and Williams\\ |\citeyear{jon90}| & 1990\\ |\citeyearpar{jon90}| & (1990) \end{tabular} \end{quote} \head{Forcing upper cased names} If the first author's name contains a \textsl{von} part, such as ``della Robbia'', then |\citet{dRob98}| produces ``della Robbia (1998)'', even at the beginning of a sentence. One can force the first letter to be in upper case with the command |\Citet| instead. Other upper case commands also exist. \begin{quote} \begin{tabular}{rl@{\quad$\Rightarrow$\quad}l} when & |\citet{dRob98}| & della Robbia (1998) \\ then & |\Citet{dRob98}| & Della Robbia (1998) \\ & |\Citep{dRob98}| & (Della Robbia, 1998) \\ & |\Citealt{dRob98}| & Della Robbia 1998 \\ & |\Citealp{dRob98}| & Della Robbia, 1998 \\ & |\Citeauthor{dRob98}| & Della Robbia \end{tabular} \end{quote} These commands also exist in starred versions for full author names. \head{Citation aliasing} Sometimes one wants to refer to a reference with a special designation, rather than by the authors, i.e. as Paper~I, Paper~II. Such aliases can be defined and used, textual and/or parenthetical with: \begin{quote} \begin{tabular}{lcl} |\defcitealias{jon90}{Paper~I}|\\ |\citetalias{jon90}| & $\Rightarrow$ & Paper~I\\ |\citepalias{jon90}| & $\Rightarrow$ & (Paper~I) \end{tabular} \end{quote} These citation commands function much like |\citet| and |\citep|: they may take multiple keys in the argument, may contain notes, and are marked as hyperlinks. \head{Selecting citation style and punctuation} Use the command |\bibpunct| with one optional and 6 mandatory arguments: \begin{enumerate} \item the opening bracket symbol, default = ( \item the closing bracket symbol, default = ) \item the punctuation between multiple citations, default = ; \item the letter `n' for numerical style, or `s' for numerical superscript style, any other letter for author--year, default = author--year; \item the punctuation that comes between the author names and the year \item the punctuation that comes between years or numbers when common author lists are suppressed (default = ,); \end{enumerate} The optional argument is the character preceding a post-note, default is a comma plus space. In redefining this character, one must include a space if one is wanted. Example~1, |\bibpunct{[}{]}{,}{a}{}{;}| changes the output of \begin{quote} |\citep{jon90,jon91,jam92}| \end{quote} into [Jones et al. 1990; 1991, James et al. 1992]. Example~2, |\bibpunct[; ]{(}{)}{,}{a}{}{;}| changes the output of \begin{quote} |\citep[and references therein]{jon90}| \end{quote} into (Jones et al. 1990; and references therein). \head{Other formatting options} Redefine |\bibsection| to the desired sectioning command for introducing the list of references. This is normally |\section*| or |\chapter*|. Define |\bibpreamble| to be any text that is to be printed after the heading but before the actual list of references. Define |\bibfont| to be a font declaration, e.g.\ |\small| to apply to the list of references. Define |\citenumfont| to be a font declaration or command like |\itshape| or |\textit|. Redefine |\bibnumfmt| as a command with an argument to format the numbers in the list of references. The default definition is |[#1]|. The indentation after the first line of each reference is given by |\bibhang|; change this with the |\setlength| command. The vertical spacing between references is set by |\bibsep|; change this with the |\setlength| command. \head{Automatic indexing of citations} If one wishes to have the citations entered in the \texttt{.idx} indexing file, it is only necessary to issue |\citeindextrue| at any point in the document. All following |\cite| commands, of all variations, then insert the corresponding entry to that file. With |\citeindexfalse|, these entries will no longer be made. \head{Use with \texttt{chapterbib} package} The \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ package is compatible with the \texttt{chapterbib} package which makes it possible to have several bibliographies in one document. The package makes use of the |\include| command, and each |\include|d file has its own bibliography. The order in which the \texttt{chapterbib} and \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ packages are loaded is unimportant. The \texttt{chapterbib} package provides an option \texttt{sectionbib} that puts the bibliography in a |\section*| instead of |\chapter*|, something that makes sense if there is a bibliography in each chapter. This option will not work when \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\ is also loaded; instead, add the option to \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}. Every |\include|d file must contain its own |\bibliography| command where the bibliography is to appear. The database files listed as arguments to this command can be different in each file, of course. However, what is not so obvious, is that each file must also contain a |\bibliographystyle| command, \emph{preferably with the same style argument}. \head{Sorting and compressing citations} Do not use the \texttt{cite} package with \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}; rather use one of the options \texttt{sort} or \texttt{sort\&compress}. These also work with author--year citations, making multiple citations appear in their order in the reference list. \head{Long author list on first citation} Use option \texttt{longnamesfirst} to have first citation automatically give the full list of authors. Suppress this for certain citations with |\shortcites{|\emph{key-list}|}|, given before the first citation. \head{Local configuration} Any local recoding or definitions can be put in \texttt{#1}\def\filedate{#2}\def\fileversion{#3}}\texttt{.cfg} which is read in after the main package file. \head{Options that can be added to \texttt{\char`\\ usepackage}} \begin{description} \item[\ttfamily round] (default) for round parentheses; \item[\ttfamily square] for square brackets; \item[\ttfamily curly] for curly braces; \item[\ttfamily angle] for angle brackets; \item[\ttfamily colon] (default) to separate multiple citations with colons; \item[\ttfamily comma] to use commas as separaters; \item[\ttfamily authoryear] (default) for author--year citations; \item[\ttfamily numbers] for numerical citations; \item[\ttfamily super] for superscripted numerical citations, as in \textsl{Nature}; \item[\ttfamily sort] orders multiple citations into the sequence in which they appear in the list of references; \item[\ttfamily sort\&compress] as \texttt{sort} but in addition multiple numerical citations are compressed if possible (as 3--6, 15); \item[\ttfamily longnamesfirst] makes the first citation of any reference the equivalent of the starred variant (full author list) and subsequent citations normal (abbreviated list); \item[\ttfamily sectionbib] redefines |\thebibliography| to issue |\section*| instead of |\chapter*|; valid only for classes with a |\chapter| command; to be used with the \texttt{chapterbib} package; \item[\ttfamily nonamebreak] keeps all the authors' names in a citation on one line; causes overfull hboxes but helps with some \texttt{hyperref} problems. \end{description} \end{document}
\section{Introduction} \label{sec:Intro} District heating systems (DHS) are widely used in North-Western Europe to deliver heat and hot water to households. A DHS is often a cogeneration system or combined heat power (CHP), when heat is also used to generate electric energy. The amount of electric energy that can be produced is directly related to the amount of produced heat. Moreover, it is a legal demand in Poland that district heating systems sell only electric energy cogenerated with heat, i.e., it is forbidden to produce electricity and dispose of heat. Hence, \textbf{for CHP systems, prediction of heat demand is essential} to submit bids for electric energy in the priciest hours in an energy market. Constructing computationally efficient intelligent systems faces a number of challenges in industrial applications in which data is collected in extensive sensor networks. Often, such raw data is incomplete and of low quality. In this paper, we report on our experience from an R\&D project in designing algorithms for heat demand prediction for Kogeneracja Zach\'od\footnote{\url{https://kogeneracjazachod.pl/}}, a company running a cogeneration system in Poland. We evaluate the algorithms w.r.t. prediction quality and computational cost, both in the training and testing phases. The trade-off between prediction error and computational cost is interesting from the research point of view. Yet, it is essential in the edge/fog systems, if IoT devices (e.g. energy counters) with low computational resources were supposed to not only measure but also predict energy consumption and incrementally train models with new arriving data. This is a potential use-case for future smart grids, when IoT devices could optimize energy consumption plan of the consumer and energy supply to the grid. Two types of algorithms for predicting thermal energy usage are proposed. The first one includes novel extensions of the algorithm originally proposed by E. Dotzauer in \cite{Dotz02}. The second type is based on the hour-of-week adjusted linear regression on moving averages of energy consumption and is a type of autoregressive predictor. These algorithms are compared against two state-of-the art artificial neural networks. The evaluation is conducted on real-world data which is made public for research purposes, cf. \cite{KZData}. This paper is organized as follows. Section \ref{sec:lietrature} outlines existing literature on predicting energy consumption. In Section \ref{sec:formul} the goals in energy prediction of the R\&D project are formulated. The prediction algorithms we contribute are presented in Section \ref{sec:alg}. The test dataset is outlined in Section \ref{sec:dataset}. The prediction algorithms are evaluated in Section \ref{sec:eval}. Section \ref{sec:Concl} concludes the paper. \section{Related Work} \label{sec:lietrature} The most frequently used methods on predicting energy consumption, both electrical and thermal, can be roughly classified as: (1) regression, among them linear or piecewise linear methods, (2) statistical, e.g., based on autoregressive methods, (3) machine learning, e.g., neural networks, and (4) mixed ones. In \cite{KF11}, 12 linear and Gaussian process regression models of energy consumption were developed for residential and commercial buildings. Gaussian mixtures were also applied in \cite{MLSWYS14} to fit two-dimensional distributions of heat demand and outdoor temperature. In \cite{Dotz02} the heat demand was split into components depending on outdoor temperature and a seasonal inhabitant behavior, cf. Section \ref{sec:Dotzauer}. Heat demand for two localities in Czechia were predicted using a similar method \cite{ChrBr10}. The social component was represented by Seasonal Autoregressive Integrated Moving Average (SARIMA) model. A Support Vector Machine model was build in \cite{DCL05} to predict a building monthly energy usage. Input parameters included monthly mean outdoor temperature, relative humidity, and global solar radiation. The model outputs an aggregated monthly prediction of energy usage. In \cite{ENP12}, 7 machine learning techniques predicting electrical energy consumption in residential buildings are compared: linear regression, Feed Forward Neural Networks (FFNN), Support Vector Regression, Least Squares Support Vector Machines (LS-SVM), Hierarchical Mixture of Experts (HME), HME-FFNN, Fuzzy C-Means with FFNN. The experiments were run on synthetic datasets, showing that LS-SVM offered a better prediction model. An FFNN with 1 hidden layer was used in \cite{BMHS08} to predict heat demand of households. In \cite{KCBR16} a Radial-Basis Function Neural Network (RBFNN) was used to model energy consumption in a large building. The goal was to minimize prediction errors in the training and validation datasets, as well as, to minimize the RBFNN size. A hybrid genetic algorithm-adaptive network-based fuzzy inference system was proposed in \cite{LSC11}, which was a 5-layer rule-based structure. The first 3 layers calculated the strength of the rule firings while the other 2 layers calculated a weighted sum of linear functions of the input parameters. RBFNN was used also to predict heat demand on a university campus \cite{WoK14}. Conversely, to represent energy demand on another campus \cite{JSZ15}, a 3-layer FFNN, an RBFNN, and the Adaptive Neuro-Fuzzy Inference System were used. In other studies on a DHS in Sweden, 3 methods were compared in \cite{RCCA15}: linear regression, support vector regression (SVR), and context vector regression (CVR). Energy demand for DHS in Riga was analyzed in \cite{PBSS17}, based on a nonlinear autoregressive neural network with external factors fed with data on the historical energy consumption and outdoor temperature. A hybrid statistical-machine learning method was proposed in \cite{XGM18}. It combined 3 methods. A chain of Seasonal Trend decomposition using LOESS \cite{CCMT90} with different season lengths was used to model heat demand. Its output, together with weather data were fed to Elman neural network. Finally, the ARIMA model was used to represent the residuum from seasonal decomposition. We end this section with some \textbf{observations}. First, comparing the heat demand prediction methods reported in the literature is hard because: (1) these methods were tested in different experiment design settings, e.g. different prediction windows and temporal resolutions, (2) the test datasets were different. Consequently, some helpful, or obstructing, phenomena present in one dataset may be absent in another. Second, real datasets are often subject to cleaning procedures which are scarcely reported. Finally, the reported quality scores use different measures of error, e.g., MAPE or MSE. Hence, the reported numerical values of prediction quality should be taken with caution. \section{Problem Formulation} \label{sec:formul} Energy distribution and measurement in the DHS has a tree structure. In selected nodes, energy counters are installed. There are two types of energy counters, related to two types of energy usage: (1) hot water energy (HW) counters (e.g., used for washing, bathing, showering) and (2) heat energy (HE) counters (for heating buildings and adsorption cooling). A sum of the whole network energy usage is recorded in the tree root. Prediction of the energy "sum" in the tree root is required to plan selling electricity on day-ahead markets. Past energy readings, exogenous weather factors, e.g., atmospheric temperature, humidity, and wind speed are known in equally spaced 1 hour resolution. A three-day weather forecast is also known with 1 hour resolution. Thus, these values are treated like time series. All the past data may be used to develop, i.e. train, a forecasting algorithm. It is required to forecast any counter readings in the next three days. Notice that our goal is slightly different than in many publications on DHS forecasting, because we need to forecast energy consumption for each counter (not only the "sum" counter) and for relatively short intervals. Formally, given past energy readings of a certain counter ${\cal Y}=(Y_1,\dots,Y_t)$ ($Y_i$ are scalars), past values of exogenous variable values ${\cal W}=(W_1,\dots,W_t)$ (where $W_i$ are vectors), and their forecast ${\cal W}'=(W_{t+1},\dots,W_{t+72})$ it is required to forecast energy demands ${\cal F}=(Y_{t+1},\dots,Y_{t+72})$. \section{Algorithms} \label{sec:alg} \subsection{Dotzauer Method} \label{sec:Dotzauer} In \cite{Dotz02} heat demand $Y_i$ for hour $i$ is modeled as a sum of two components: \begin{equation} Y_i=f(T_i)+g(i).\label{eq:Dotz1} \end{equation} The first component is a function of the atmospheric temperature $T_i$ at hour $i$. The second one is an array of corrections calculated for hours in a week. $f(T_i)$ is a piecewise linear function with five segments. $g(i)$ is referred to as {\em social component} because it accounts for customers habits. In \cite{Dotz02} hourly corrections $g(i)$, segment levels and slopes in function $f$ were chosen by minimizing the squared error between the model and the past observations. For a future hour $j$ and temperature forecast $T_j$, heat demand can be computed from (\ref{eq:Dotz1}). In our implementation also five segments were used in the atmospheric temperature model. Temperature positions of the break-points in the piecewise linear function $f$ were chosen such that the past temperature readings were divided into five equicardinal subsets. A shorthand notation DPLW (for Dotzauer method with Piecewise Linear temperature model and Weekly corrections) will be used to refer to this algorithm. Example components $f$ and $g$ from (\ref{eq:Dotz1}) are shown in Fig.\ref{fig:Dotz-g-f-exmp-heat}. Let us observe that range of $g(i)$ is roughly one tenth of $f$ range in Fig.\ref{fig:Dotz-g-f-exmp-heat}. \begin{figure}[t] \setlength{\unitlength}{1cm} \begin{picture}(12,5.5) \put(-.6,0.3){\includegraphics[width=6.8cm]{DPLW-F-heat-temp.pdf} \put(5.7,0.3){\includegraphics[width=6.8cm]{DPLW-gcors-heat.pdf} \put(3,-0.){a)} \put(9,-0.){b)} \end{picture} \caption{Examples of heat energy counter model equation (\ref{eq:Dotz1}) components. a) Temperature component $f(T)$. b) Social component $g(i)$.} \label{fig:Dotz-g-f-exmp-heat} \end{figure} \subsection{Dotzauer Method Extensions} \label{sec:Dotz-ext} In this section we propose new variants of Dotzauer method that differ in the social and temperature components construction. \smallskip \noindent {\bf Social Component Models.} Two versions of component $g(i)$ were studied: \noindent {\em Weekly corrections:} Function $g(i)$ is a sequence of 168 hourly values for each hour $i$ of a week. It was calculated as an average difference $Y_i-f(T_i)$ for all week hours in the training dataset. \noindent {\em Yearly corrections:} $g(i)$ is calculated analogously, but for each hour of the year. \smallskip \noindent {\bf Temperature Component Models.} The following temperature component models were implemented: \noindent {\em Linear Temperature Model:} $f(T_i)$ is linear, which is a simplification of DPLW. \noindent {\em Spline Temperature Model:} $f(T_i)$ is a cubic spline with four internal knots, i.e. a function that is a sequence of five piecewise cubic polynomials and is twice continuously differentiable. Temperature positions of the four knots in the spline were determined as in DPLW. Similarly to DPLW, parameters of the spline polynomials were chosen to minimize the squared error between the model and the past observations. \noindent {\em Isotonic Regression Model:} $f(T_i)$ is constructed by applying isotonic regression. This method fits a free-form piecewise line of non-increasing heat energy consumption into a sequence of given temperature-heat points for minimum square error. Pool adjacent violators algorithm is used for this purpose. \noindent {\em Multivariate Temperature Model:} The temperature component is a multivariate linear function of exogenous variables related to weather conditions. The combinations of weather conditions applied are listed in Tab.\ref{tab:a0-4} in appendix \ref{sec:exo-weather}. \smallskip \noindent The following versions of the Dotzauer method were used in the further studies:\\ $\bullet$ Linear Temperature Model Weekly/Yearly Corrections (DLW/DLY),\\ $\bullet$ Piecewise Linear Temperature Weekly/Yearly Corrections (DPLW/DPLY),\\ $\bullet$ Spline Temperature Model Weekly/Yearly Corrections (DSW/DSY),\\ $\bullet$ Isotonic Temperature Model Weekly/Yearly Corrections (DIW/DIY),\\ $\bullet$ Multivariate Temperature Model Weekly/Yearly Corrections (DMW/DMY). \subsection{W-Regressors} W-regressors are a set of methods building independent linear-regression models for each hour of the prediction interval. Since the linear regression is built on the past observations of the energy consumption, W-regressors can be considered as auto-regressive methods. \smallskip \noindent {\bf WRNH} builds independent prediction models for each hour of the week. Consequently, to predict in 72-hour window, a subset of 72 out of 168 models will be used. For each hour $i$ of the week a moving average of the last week energy consumption is calculated (168 samples). In order to construct a linear regression fit for hour $i$ tuples $(a_j,W_j,Y_j)$ are used as input data points, where: $a_j$ is energy consumption 168-hour moving average at hour $j$, $W_j$ are weather conditions at hour $j$, $Y_j$ is the actual energy consumption at hour $j$, for hours $j:j \bmod 168=i$ in the past. We applied various combinations of atmospheric conditions in vector $W_j$. This resulted in five versions WRNH0,$\dots$,WRNH4 of this algorithm. Used weather-related components of $W_j$ are listed Tab.\ref{tab:a0-4}. Tuples $(a_j,W_j,Y_j)$ are used to fit linear regression $Y_i=\overline{k_i}\times [a,W]^T +l_i$, where $a$ is a moving average, $W$ is a vector of weather conditions, $[a,W]$ is a vector of independent variables, $\overline{k_i}$ is a vector of directional coefficients, and $Y_i$ is the modeled energy consumption. When predicting energy consumption for future hour $t+p$, for $p=1,\dots,72$, at the current hour $t$, the energy prediction is calculated as $Y_{t+p}=\overline{k}_{(t+p)\bmod 168}\times [a_t,W_{t+p}]^T+l_{(t+p)\bmod 168}$, where $a_t$ is the moving average of energy consumption at prediction moment $t$, $W_{t+p}$ is a forecast of weather conditions for hour $t+p$. The nickname of these methods comes W-Regressor No History (WRNH). \smallskip \noindent {\bf WRWH.} While predicting energy demand, the previous method assumed that at future hour $t+p$ moving average $a_t$ is used independently of the location of hour $t$ in the week. An advantage is that only 168 models are needed. A disadvantage is that the current hours $t$ may correspond to very different social conditions in a week. It is reasonable to correlate the prediction for the future hour $t+p$ with the moving average for each particular hour of the week $t$. Thus, WRWH regressors (short for W-Regresor With History) build $168 \times 72=12096$ linear models. 72 of them are used to build a 72-hour prediction at the current hour $t$. In order to develop a model for future hour $i+p$, where $i=t \bmod 168$ were the hours of the week of the current moment $t$, tuples $(a_j,W_j,Y_q)$ for $j:j\bmod 168=i$ and $q:q=j+p$, were used. Future hour $t+p$ energy consumption is calculated as $Y_{t+p}=\overline{k}_{(t\bmod 168),p}\times [a_t,W_{t+p}]^T+l_{(t\bmod 168),p}$, where $\overline{k}_{i,p}$ is a vector of directional coefficients for the current hour of the week $i$ and energy consumption shifted $p$ hours into the future. As in the previous case there are five versions WRWH0,\dots,WRWH4 of this method differing in the set of used weather features, cf. Tab.\ref{tab:a0-4} appendix \ref{sec:exo-weather}. \subsection{Neural Networks} \noindent {\bf Feed-Forward Neural Network.} Following the recent popularity of deep learning, we decided to also use a deep neural network to calculate forecasts $\mathcal{F}$. We used a feed-forward neural network (FFNN for short) implemented in PyTorch. Optuna, a hyperparameter optimization framework \cite{optuna_2019}, was applied to set up hyperparameters of the model. We randomly selected one of the counters, and optimized the following hyperparameters over the span of 500 trials:\\ -- number of hidden layers, considering the range from 1 to 5,\\ -- sizes of hidden layers, from the range 10 to 200 neurons,\\\ -- the dropout probability, from the range 0 to 0.5,\\ -- which past energy readings to use, for hourly back-shift $i\in\{0,1,\ldots,143\}$. \\ We used MSE as the optimization criterion for Optuna and arrived at the architecture presented in Tab.\ref{tab:deep-architecture}. The indices $i$ of the past energy reading used as the inputs of FFNN are given in appendix \ref{sec:inp-ffnn}. Beyond the past energy readings also all weather attributes mentioned in appendix \ref{sec:exo-weather}, for the current time $t$ were inputs to FFNN. The network had 72 outputs to forecast for the 72 hours. \begin{table}[t] \caption{\label{tab:deep-architecture}% Architecture of the FFNN. If not specified, the defaults of PyTorch were used.} \centering \begin{tabular}{lll} layer & component & class from \texttt{torch.nn} \\ \hline Input & Batch normalization & \texttt{BatchNorm1d} \\ \hline Hidden 1 & Linear $99\times 10$ & \texttt{Linear} \\ & Batch normalization & \texttt{BatchNorm1d} \\ & Leaky ReLU & \texttt{LeakyReLU} \\ & Dropout $p=0.406$ & \texttt{Dropout} \\ \hline Hidden 2 & Linear $10\times 46$ & \texttt{Linear} \\ & Batch normalization & \texttt{BatchNorm1d} \\ & Leaky ReLU & \texttt{LeakyReLU} \\ & Dropout $p=0.406$ & \texttt{Dropout} \\ \hline Output & Linear $46\times 72$ & \texttt{Linear} \\ \hline \end{tabular} \end{table} A separate neural network using the same architecture was trained for each counter. MSE was applied as the loss function and optimized using the Adam optimizer. Given the relatively small amount of training data, we employed the following techniques to avoid overfitting:\\ -- From the training set, we removed the most recent 10\% of observations and used them as the validation set to enable early stopping after 20 epochs without MSE improvement on the validation set. \\ -- We used the dropout with $p=0.406$ at the end of each hidden layer \cite{DBLP:journals/corr/abs-1207-0580}.\\ -- Within each hidden layer, we used batch normalization to avoid problems with exploding and vanishing gradients \cite{DBLP:conf/icml/IoffeS15}. Batch normalization in the input of the neural network was applied to ensure that the input data is normalized.\\ \noindent {\bf Radial Basis Function Neural Network.} As reported in Section \ref{sec:lietrature} neural networks with radial basis functions (RBFNN) were successful in energy usage prediction. To see how they fare with our data, we used the framework developed for FFNN, but used a single hidden layer consisting solely of RBF neurons. To decide on the number of neurons in this layer and the input features we used Optuna, as previously described, and arrived at 16 neurons. The indices of past energy readings used as the inputs are shown in appendix \ref{sec:inp-rbfnn}. For the output layer, we used a linear layer with 72 neurons, optimized using the same procedure as for FFNN. \bigskip \noindent A moving average of the last 100 hours was used as a reference prediction algorithm. It is denoted as algorithm C-100. \section{DHS Dataset} \label{sec:dataset} The test dataset comprises heat measurements from 28 hot water and 83 heat energy counters in the DHS operated by Kogeneracja Zach\'od, in a town of about 30000 inhabitants. The records cover the period since the 1st of September 2015 at 00:00 (start of day) until 28th of February 2019 at 23:00 (the last hour of a day). The dataset includes the following values: measurement timestamp, measured energy consumption, weather conditions, type of day, season (cf. \cite{KZData}). The measurements were collected for billing purposes, rather than for heat demand prediction and optimization, so they have several drawbacks from the datamining perspective:\\ $\bullet$ Since clients join and leave the DHS, the covered interval is different for particular counters.\\ $\bullet$ A measurement of zero energy consumption may mean that either a customer left the DHS, malfunctioning of the counter, or maintenance time. Hence, there is a large fraction of 0-measurements, which need special handling.\\ $\bullet$ There are intervals when no energy use is recorded for the whole DHS.\\ $\bullet$ The majority of heat energy consumption happens between the beginning of October and the beginning of May.\\ $\bullet$ It is known that to economize on energy, hot water supply was occasionally shut down at night hours by property owners. This process had random nature and it is not known to which counters and on what days it happened.\\ $\bullet$ In a large part of weather records only 0 values are present. Since such values (e.g., temperature in $^\circ$C, wind speed) are admissible, it was not possible to distinguish missing and correct data. In order to deal with the missing and dubious data the following cleaning procedures were applied:\\ $\bullet$ zero energy readings are valid if preceded and succeeded by a non-zero reading (to eliminate zeros before switching a counter on and after switching it off);\\ $\bullet$ at the considered time, at least one counter has non-zero recording (this eliminates, e.g., maintenance periods and intervals where data was missing globally);\\ $\bullet$ only readings with non-zero humidity are accepted (this eliminates readings with dubious weather recordings). It was observed that customers significantly differ because the ratios of the smallest to the largest average hourly energy usage in kWh were 7:57 for HW and 4:125 for HE counters. A strong correlation between atmospheric temperature and HE recordings was observed because correlation coefficient was in range $[-0.922,-0.706]$, depending on the counter. For hot water correlation coefficient was in range $[-0.164,0]$. \section{Experimental analysis of prediction algorithms} \label{sec:eval} \begin{figure}[t] \setlength{\unitlength}{1cm} \begin{picture}(12,5.5) \put(-.6,0.3){\includegraphics[width=6.6cm]{Val-vs-ti-5006-374.pdf}}% \put(5.7,0.3){\includegraphics[width=6.6cm]{Val-vs-ti-suma-543.pdf}}% \put(3,-0.){a)} \put(9,-0.){b)} \end{picture} \caption{Examples of heat demand prediction vs time in 72-hour window. a) One of the heat counters. b) "Sum" counter.} \label{fig:ValvsTi} \end{figure} Prediction algorithms were subjected to the following test framework: Data from interval 2016-01-01 00:00:00 until 2017-12-31 23:00:00 was used as the training dataset. Interval from 2019-01-02 00:00:00 until 2019-02-25 23:00:00 was used for testing. For other combinations of training and testing intervals similar results were obtained so we do not report them. In the testing interval, each of the algorithms calculated a 72-hour energy consumption forecast starting at each hour of the testing interval (1320$\times$72 prediction points). The training and testing were conducted for each energy counter. All the codes were written in Python 3.7.4 and tested on a PC with Windows 10 and Intel i7-8550U CPU @ 1.80GHz (no GPU acceleration). \subsection{Basic evaluation} Representative examples of predictions over 72-hour interval are visualized in Fig.\ref{fig:ValvsTi}. Only a subset of nondominated methods is shown to avoid cluttering the picture (the nondominated methods will be explained in the next section). Fig.\ref{fig:ValvsTi}a presents results for one of the counters, while Fig.\ref{fig:ValvsTi}b for the "sum" counter. Note that the vertical axes start at values greater than 0. It can be verified that visually these algorithms follow the real energy consumption. Quality of the predictions aggregated over all 1320$\times$72 prediction points are presented quantitatively in Tab.\ref{tab-Sum} and Tab.\ref{tab-best-dev}. In Tab.\ref{tab-Sum}, 8 best algorithms for the "sum" counter with respect to MAPE and MSE measures are shown. It can be seen that RBFNN and simple Dotzauer model variants with weekly corrections provided the best predictions of the "sum" of consumed energy for MAPE. For MSE quality measure RBFNN, FFNN are the best algorithm whereas C-100 and DLW (which is the best Dotzauer-like algorithm) have MSE three times worse than FFNN (not shown in Tab.\ref{tab-Sum}). Thus, RBFNN, FFNN are the best for "sum" counter. In Tab.\ref{tab-best-dev} the best MAPE obtained on any heat counter is given for each prediction algorithm. In a sense, this table shows the limitations of the prediction algorithms on the available data. Surprisingly, moving average (C-100) used as a reference algorithm is capable of obtaining good results in comparison with other methods. Only WRNH0 and WRWH0 were able to compete. Yet, the distribution of algorithm MAPEs across counters is more complex, and the fact that C-100 is good on one counter does not imply that it is good overall. This will be further discussed in the next section. Furthermore, such a result rises reservations about quality of the data. \begin{table}[t] \caption{8 best algorithms on "Sum" counter}\label{tab-Sum}% \centering {\scriptsize \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|l|} \hline \multicolumn{9}{|c|}{MAPE}\\ \hline method & RBFNN & DLW & DMW & DPLW & DIW & WRWH0 & FFNN & DSW \\ \hline MAPE [\%] & 16.45 & 16.49 & 16.49 & 16.96 & 17.1 & 17.7 & 18.43 & 18.45 \\ \hline \multicolumn{9}{|c|}{MSE}\\ \hline algo. & FFNN & RBFNN & WRWH0 & WRWH1 & WRNH0 & WRNH1 & WRNH2 & WRWH2 \\ \hline MSE & 217884 & 237987 & 437482 & 452190 & 463599 & 477858 & 568191 & 575916 \\ \hline \end{tabular}% } \end{table} \begin{table}[t] \caption{Best results for the prediction algorithms}\label{tab-best-dev}% \centering {\scriptsize \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|l|} \hline method &C-100 &DIW &DIY &DLW &DLY &DMW &DMY &DPLW\\ \hline MAPE [\%] &8.3 &10.2 &11.0 &10.0 &11.5 &10.0 &11.5 &10.1\\ \hline method &DPLY &DSW &DSY &FFNN &RBFNN &WRNH0 &WRNH1 &WRNH2\\ \hline MAPE [\%] &11.0 &10.0 &11.5 &9.8 &16.5 &8.1 &9.6 &15.5\\ \hline method &WRNH3 &WRNH4 &WRWH0 &WRWH1 &WRWH2 &WRWH3 &WRWH4&\\ \hline MAPE [\%] &17.5 &8.4 &7.9 &9.7 &17.2 &18.1 &8.5&\\ \hline \end{tabular}% } \end{table} \subsection{Time-Quality Trade-off} \begin{figure}[t] \setlength{\unitlength}{1cm} \begin{picture}(12,5.5) \put(-.5,0.3){\includegraphics[width=6.6cm]{MAPEvsTraining-KZ1.pdf} \put(5.8,0.3){\includegraphics[width=6.6cm]{MAPEvsTesting-KZ1.pdf} \put(3,-0.){a)} \put(9,-0.){b)} \end{picture} \caption{Prediction quality (MAPE) vs computational cost. a) Prediction quality vs training time. b) Prediction quality vs predicting time.} \label{fig:QvsT} \end{figure} Time performance of the prediction algorithms is important when these algorithms are supposed to be used in low-power IoT or embedded devices. In Fig.\ref{fig:QvsT} run-time vs quality trade-off is shown. On the horizontal axis run-time is shown, on the vertical axis prediction quality (MAPE) is presented. Results for each algorithm are presented as interquartile boxes aggregated over all counters. That is, a box for each algorithm spans between Q1 and Q3 in time and prediction quality. Median of quality and run-time is also marked. This way of visualizing mutual algorithm performance has three-fold advantages: 1) it is possible to recognize algorithm differences with respect to prediction quality, 2) differences in time efficiency are visible, 3) it is possible to analyze how these algorithms trade run-time for prediction error. In Fig.\ref{fig:QvsT}a training time is shown, in Fig.\ref{fig:QvsT}b time of calculating a single 72-hour forecast is shown. In Fig.\ref{fig:QvsT}a moving average C-100 algorithm is not presented because it is not trained. For the training time the algorithms form clusters resulting from the computational complexity of the training procedure. RBFNN are the slowest methods, then WRWH, FFNN, WRNH, and Dotzauer algorithms are gradually faster. The algorithms with isotonic and spline temperature components are the fastest. WRNH and WRWH algorithms have very tight run-time distributions, while WRWH methods are apparently slower because 72 times more linear models must be computed. As far as training these algorithms in low-power computers, Dotzauer-like and WRNH algorithms are feasible choices, whereas using RBFNN or WRWH algorithms seems disputable. Conversely, calculating one 72-hour prediction is far less costly computationally and all the considered algorithms managed it in less than 1ms. Considering prediction quality, most of the interquartile ranges overlap, so it is rather hard to draw sharp conclusions on algorithm superiority, but still, some tendencies can be observed. The RBFNN accuracy is the worst, which can be attributed to great irregularity of energy readings. In WRNH and WRWH methods various weather attributes were used. WRNH4 and WRWH4 can be taken as a reference because in this pair no weather data was used (see Tab.\ref{tab:a0-4}). Algorithms WRNH0, WRWH0 using only atmospheric temperature and day length are the best among WRNH/WRWH methods. Using an extensive set of weather attributes, impedes rather than helps obtaining good energy predictions. Among Dotzauer-like algorithms the weekly social corrections are generally better than yearly corrections, which is not surprising because there were only two years in the training dataset, and the weekly pattern in energy usage is strong (cf. Fig.\ref{fig:Dotz-g-f-exmp-heat}). It can be also verified in Fig.\ref{fig:QvsT} that C-100 method is not the best overall and it has apparent competitors (e.g. WRWH0). This contrasts with the result in Tab.\ref{tab-best-dev}, confirming that accuracy distributions of the algorithms across energy counters are different. Fig.\ref{fig:QvsT} allows also to identify algorithms that are nondominated. We used median run-time and median accuracy as indicators of algorithm position on the run-time vs quality space. The set of nondominated methods comprises the algorithms for which no other algorithm has both better accuracy and run-time. For better exposition, the nondominated algorithms for MAPE and MSE quality measures are collected in Tab.\ref{tab-pareto} in Section \ref{sec:app:nondominated}. Depending on the setting, C-100, various versions of Dotzauer method and WRWH0 are chosen to the Pareto-front. In all settings C-100 is selected as the fastest method. Among the algorithms that are present in all Pareto-front settings DLY and DIW are the second and third fastest algorithms, while DLW and WRWH0 are the slowest pair. These methods can be recommended as candidates for low-power computer systems. \section{Conclusions} \label{sec:Concl} In this paper algorithms for DHS energy consumption prediction were analyzed. The goal of this study was to verify the utility of a set of algorithms in predicting energy consumption every hour, in 72-hour intervals, both total and for each energy counter separately. Another aspect, important in the use on low-power devices, was the computational complexity of the algorithms. It turned out that simple methods offer the best run-time quality trade-off. Machine learning methods, FFNN, RBFNN, have low potential for training on low-power devices. However, a more detailed inspection revealed that accuracy of energy consumption prediction depends very much on the energy counter and accuracy measure. For example, RBFNN, FFNN are the best at total energy prediction. Future work may involve examining other machine learning methods from the literature, comparing them with the algorithms presented here in the run-time quality setting. Online updating of the models with new data should be also examined. \\ \\ \textbf{Acknowledgements}. This research was partially supported by Kogeneracja Zach\'od S.A. \bibliographystyle{abbrv}
\section{Introduction} Accurate localization is a critical capability for automated driving \cite{luettel2012autonomous,badue2021self,rana2017attack,chan2020framework}. Existing solutions are based on sensor fusion techniques that utilize inputs from cameras, radars, global navigation satellite system (GNSS) receivers, and inertial measurement units (IMUs) \cite{gustafsson2002particle,mikov2021stereo,farrell2008aided}. However, some environments, like indoor parking lots and dense urban areas, remain challenging to localize in. Cameras and radars require line-of-sight toward the object of interest and GNSS receivers can not operate indoor. IMU sensors, on the other hand, are immune to those problems and remain available in all settings. The shortcoming of IMUs for localization is that existing integration methods accumulate error rapidly over time \cite{liu2021bias,guerrier2016theoretical}. In this work, a deep neural network (DNN) \cite{lecun2015deep} model is trained to predict the speed of a car from IMU measurements which may then be used for localization (by an additional integration) or used as speedometer. This work is aimed at creating a high-frequency real-time speed estimator using a single low-cost IMU sensor. For that, we establish a data-driven approach that consists of two steps: (1) collecting data of IMU signals from multiple car drives with corresponding speed measurements as labels, using a real time kinematic (RTK)-GNSS device, and (2) applying supervised learning to train a DNN-based model to estimate the car speed in real-time. The proposed approach may improve existing dead reckoning (DR) techniques in GNSS-denied areas \cite{luo2018geographical} and enable localization based only on a single IMU sensor for longer time periods while maintaining an acceptable positioning error. Previous attempts to apply supervised learning in estimation problems with localization applications were focused on learning the sensor noise models. Mahdi et al. used low-cost sensors as input together with expensive sensors to generate the true labels for the measurement noise \cite{mahdi2022}. Azzam et al. trained long short-term memory (LSTM) models to improve the trajectory accuracy obtained using a simultaneous localization and mapping (SLAM) algorithm \cite{azzam2021}. However, they used the pose estimated by the SLAM algorithm as input and not direct sensor measurements. Srinivasan et al. \cite{srinivasan2020} learned speed estimation for an autonomous racing car. The true label for the speed was produced using a specially developed mixed Kalman Filter (KF) \cite{welch1995introduction} to fuse inputs from multiple sensors of different types. In \cite{Reina2018DEEPLB}, Reina et al. used a convolutional neural network (CNN)-based architecture to train a regressor to predict speed. However, this approach is not able to create memory between samples. Also, the large window size of the input makes the model unfit for high-frequency real-time applications. Yanlei et al. used a similar approach to estimate speed with low-cost IMU as input \cite{yanlei2019}. Their solution was based on position measurements from a common GNSS receiver to calculate the true speed which suffers from relatively low accuracy and low sampling rate. In addition, the input was IMU signal sampled at the low frequency of 10 Hz and a window size of $4 \, [s]$ which is not sufficient for most real-time applications. Karlsson et al. also used a CNN-based architecture to train a regressor to predict speed from an accelerometer and the yaw rate \cite{karlsson2021speed}. They also considered a large input time window (more than 2 seconds) and an architecture which is not able to establish memory between samples. This work aims to address the shortcomings of previous work and apply the trained model in an inertial localization scheme. Previous works on DR techniques emphasize the importance of accurate speed updates to reduce the positioning error. Brossard et al. proposed special speed updates when specific events are detected using machine learning or other methods \cite{brossard2019rinsw}. Key example is the zero velocity update (ZUPT) when a full stop is detected. Other examples include nullifying the vertical and horizontal components of the velocity of a four wheeled vehicle when no slip is detected. The detection of special events with respective corrections to the velocity vector are used to nullify the accumulated integration error and maintain the DR localization accuracy within acceptable boundaries for longer time periods. The approach proposed in this work is a generalization of this idea because the trained model can learn all possible detectable events with their respective speed updates to automatically reset accumulated errors. The rest of the paper is organized as follows: Section II defines the DR problem with speed as input, Section III presents the learning approach, including a highly accurate data collection method and DNN architecture. Section IV presents the model training results with hold-out set evaluation and application as input for DR localization, Section V gives the conclusions. \section{Dead Reckoning with Speed Input} Classical DR methods, like the strap-down INS \cite{farrell2008aided}, use acceleration and angular velocity sensors fused with low-frequency updates from other, more accurate, sensors to obtain the position and orientation of a moving body. The following is a simplified two-dimensional scheme in which the speed and the heading angle of the car are used in a single integration to obtain the position of the car. Consider the following two-dimensional linear kinematic equation of motion for the car position \begin{equation} \left( {\begin{array}{*{20}{c}} {p_x^n}\\ {p_y^n} \end{array}} \right)\left[ k \right] = \left( {\begin{array}{*{20}{c}} {p_x^n}\\ {p_y^n} \end{array}} \right)\left[ {k - 1} \right] + \Delta t\left( {\begin{array}{*{20}{c}} {v_x^n}\\ {v_y^n} \end{array}} \right)\left[ k \right] \label{eq:pos} \end{equation} where $p_i^n\left[ k \right]$ is the car position and $v_i^n\left[ k \right]$ is the car velocity in the $i \in \left\{ {x,y} \right\}$ axis, at time step $k$. The $n$ denotes the navigation coordinate frame and $\Delta t$ is the time step size. The car velocity is provided by \begin{equation} \left( {\begin{array}{*{20}{c}} {v_x^n}\\ {v_y^n} \end{array}} \right)\left[ k \right] = \left( {\begin{array}{*{20}{c}} {\cos \psi }\\ {\sin \psi } \end{array}} \right)\left[ k \right] s^b\left[ k \right] \label{eq:vel} \end{equation} where $\psi\left[ k \right]$ is the car heading angle and $s^b \left[ k \right]$ is the car speed at time step $k$ in the body frame. The car heading angle $\psi\left[ k \right]$ is obtained using an attitude estimation algorithm \cite{farrell2008aided} which also provides the roll and pitch angles used to transform IMU measurements from the body to navigation frame. The car speed $ s^b\left[ k \right]$ can be obtained in two ways: (1) from the output of the trained DNN model and (2) by direct integration of the noisy acceleration signal (in navigation frame). \section{Learning Approach} \subsection{Motivation} It is widely known that the direct integration of acceleration measured with a low-cost IMU sensor to obtain speed (or velocity) results in rapid divergence due to measurement noise \cite{farrell2008aided}. This section describes the development of a DNN-based car speed estimator with noisy IMU measurements as input. A supervised learning approach is presented where the IMU measurements are labeled with highly accurate speed measurement, using the RTK-GNSS device, which the DNN model is trained to predict. \subsection{Dataset collection and generation} Data was collected with a WitMotion BWT901CL IMU sensor and a STONEX RTK-GNSS device connected to a Windows PC through serial port connections (Figure \ref{fig:RTKIMU}). Data was recorded at $50 \, [Hz]$ and $100 \, [Hz]$ rates with the RTK-GNSS and IMU sensors, respectively. The sensors were synchronized to a single clock. Accurate ground truth labels are critical in supervised learning tasks. The RTK-GNSS STONEX device provides position measurements with a $2 \, [cm]$ average positioning error in contrast to the common GNSS receiver which has an average error on the order of meters \cite{farrell2008aided}. A total of $180$ minutes of driving was recorded in Ashdod, Israel. The recordings were split into train and validation sets with a ratio of 85:15. Figure \ref{fig:datacollection} shows the trajectories of the recorded drives for the train and validation sets (without overlap). The data includes diverse driving with numerous turns and roundabouts at speeds typical to city driving. Speed was obtained from the position measurements by taking the derivative with respect to time for each component and then calculating the vector norm as shown in Figure \ref{fig:training_diagram}. Then, the 50 [Hz] speed signal was upsampled to match the 100 [Hz] rate of the IMU. Train and validation samples were created by matching windows of 20 measurements of the 6 channel IMU with their respective window of 20 samples of speed. Acceleration measurements were rotated to navigation frame to remove the gravity component and then rotated back to body frame. \begin{figure}[h!] \centering {\includegraphics[width=0.5\textwidth]{RTKIMU.png}} \caption{WitMotion BWT901CL IMU sensor and a STONEX RTK-GNSS device.} \label{fig:RTKIMU} \end{figure} \begin{figure}[h!] \centering {\includegraphics[width=0.5\textwidth]{fig_ashdod_area_map.png}} \caption{Car trajectory for the train and validation sets in an urban area (Ashdod, Israel). No overlap between the train and validation data sets.} \label{fig:datacollection} \end{figure} \begin{figure} \centering {\includegraphics[width=0.48\textwidth]{diag1.jpg}} \caption{Car speed regressor training diagram. The IMU and GNSS-RTK signals are input to the loss function where the first goes trough the DNN and the later used to derive the car speed.} \label{fig:training_diagram} \end{figure} \subsection{LSTM based-model architecture} A DNN architecture was selected comprising one LSTM layer with 7,520 parameters, two bi-directional LSTM layer with 4,080 and 1,040 parameters each, and a single dense layer with 220 parameters. The model contains a total of 12,860 trainable parameters. The model is of type "many-to-many", i.e., each prediction expects 20 samples of a 6 channel IMU as input and returns 20 samples of speed prediction. The architecture and input dimensions are summarized in Figure \ref{fig:fig_dnn}. The LSTM layers were configured to pass the hidden state between samples to allow long term memory learning between predictions. \begin{figure}[h!] \centering {\includegraphics[width=0.5\textwidth]{Archt.jpg}} \caption{DNN architecture with many-to-many input-output relation, receives 20 samples of 6 IMU measurement channels as input and returns 20 samples of speed prediction.} \label{fig:fig_dnn} \end{figure} \subsection{Loss function and training} The following mean square error (MSE) loss function was minimized in the training stage \begin{equation} {\cal L} = \frac{1}{{2N}}\sum\limits_{j = 1}^N {{{\left( {{\bf s}_j^{GT} - {{{\bf \hat s}}_j}\left( {{\bf{a}},{\bf{\omega }};{\bf{W}}} \right)} \right)}^2}} \label{eq:loss} \end{equation} Here, $\bf \hat s$ is a function of ${\bf{a}}$, ${\bf{\omega}}$, and the network weights $\bf W$. ${\bf{a}}$ and ${\bf{\omega}}$ are the accelerometer and gyroscope batch readings. The training data was divided into 4 drives each about 40 minutes long. Each drive was broken into batches ordered by acquisition time to allow the model learn long term memory. Each training batch consisted of 4 windows of $6 \times 20$ IMU measurements (with the gravity component subtracted) that followed the previous batch and passed forward the LSTM hidden states. Shorter drives were padded with zeros (which the loss function was modified to ignore) to match the drive time. At the start of each epoch the LSTM hidden states were reset to zeros. \section{Results} \subsection{Training results} The model was trained until convergence for 200 epochs. The root MSE (RMSE) reached a value of $0.83 \, [m/s]$ on the train set and $1.21 \, [m/s]$ on the validation set. Figures \ref{fig:fig_speed_train} and \ref{fig:fig_speed_val} show representative examples of speed prediction from the train and validation sets, respectively. The above RMSE on the validation set may be interpreted as a 12 meter positioning error during a $10 \, [s]$ drive. For a drive at an average speed of $15 \, [m/s]$, the car passes a total $150 \pm 12\left[ m \right]$. In this case the positioning error is $8\%$ of the driven distance. \begin{figure}[h!] \hspace*{-1cm}\centering \includegraphics[scale=.21]{fig_speed_train.png} \caption{Estimated (DNN model) and true car speed vs. time for a single drive from the train set (RMSE = $0.94[m/s]$)} \label{fig:fig_speed_train} \end{figure} \begin{figure}[h!] \hspace*{-1cm} \centering \includegraphics[scale=.21]{fig_speed_val.png} \caption{Estimated (DNN model) and true car speed vs. time for a single drive from the validation set (RMSE = $0.90[m/s]$)} \label{fig:fig_speed_val} \end{figure} \subsection{Model application in aided DR navigation} The trained DNN model is tested on a two-dimensional navigation problem using a hold-out dataset. A 4 minute drive in the Matam high-tech park, Haifa was recorded using the same equipment and car. The train/validation and the hold-out sets were recorded in relatively flat urban areas. Position is obtained by integrating the car speed after decomposition to velocity vector using the heading angle as shown in Equations \ref{eq:pos} and \ref{eq:vel}. For the integration, speed was obtained in two ways: (1) using the trained model and (2) by direct integration of the acceleration in navigation frame (used as reference). Figure \ref{fig:speed_comparison} shows the speed of the car versus time obtained by direct integration of acceleration (in navigation frame), DNN prediction, and the ground truth (RTK-GNSS). The car starts stationary and the DNN prediction takes several seconds to nullify despite starting with hidden states set to zero. The first acceleration starts near $t = 10 \, [s]$ and DR curve diverges rapidly from the ground truth. The DNN curve follows the ground truth with good agreement until $t = 120 \, [s]$. At that point the road quality was observed to be low and significant external vibrations were introduced to the signal. At $t = 150 \, [s]$ the car finished a roundabout and returned to the higher quality asphalt which resulted in better speed prediction accuracy. \begin{figure}[h!] \centering {\includegraphics[width=0.5\textwidth]{fig_speed_comparison.png}} \caption{Car speed vs. time (test set): dead reckoning (DR), trained DNN model, and ground truth (GT)} \label{fig:speed_comparison} \end{figure} Figure \ref{fig:fig_trajectory} shows the car trajectory obtained using the two different methods and the ground truth. The plain (without DNN aid) DR fails to follow the car true trajectory at the drive start, which was expected due to the speed curve in Figure \ref{fig:speed_comparison}. At later time steps the shape of the DR curve becomes more like the ground truth. However, this is mainly because of the heading angle accuracy which defines the shape but not the length of the segments. The aided DR (DL-DNN aided) shows good agreement with the ground truth and a substantial improvement over plain DR. The significant deviation from true speed is observed near the roundabout located at the southern point of the trajectory. Figure \ref{fig:fig_error} shows the error versus time for the two position solutions. The error is defined as the distance between the position solution and the ground truth. The plain DR diverges rapidly over time while the DNN aided scheme maintains less than $20 \, [m]$ error for more than a minute and within reasonable boundaries during the 4 minute drive. \begin{figure}[htp] \centering {\includegraphics[width=0.5\textwidth]{fig_trajectory.png}} \caption{Car trajectory calculated using plain and aided DR vs. ground truth} \label{fig:fig_trajectory} \end{figure} \begin{figure}[h!] \centering {\includegraphics[width=0.5\textwidth]{fig_error.png}} \caption{Position error vs. time using plain and aided DR} \label{fig:fig_error} \end{figure} \section{Conclusions} A deep neural network model was trained to estimate the speed of a car from noisy IMU measurements. A new method for collecting accurate speed measurements at high frequency was presented using an RTK-GNSS device. The trained model is light and suitable for real-time applications. A simplified aided dead reckoning localization scheme was used to asses the performance of the trained model. The DNN provided speed pseudo-measurements which substantially improved the positioning accuracy over the direction integration approach. The proposed methodology can be adapted and extended to other ground vehicle and pedestrians as well as aerial and water vehicles. In future work, more data will be collected to introduce additional driving scenarios, rich terrain properties, and non-flat roads. Additionally, real-time implementation for GNSS-free navigation is currently under development. \normalsize \bibliographystyle{IEEEtran}
\chapter{Distribution Based ethods} \section{Kernel Density and Bayesian Uncertainty Estimates} \hspace{10mm}Assuming that adversarial examples are from a different distribution than the normal examples i.e. they do not lie inside the non-adversarial data manifold, Feinman et al \cite{feinman2017detecting} proposed 2 methods namely Kernel Density Estimates(KDE), where the objective is to identify a data point being in class manifold and Bayesian Uncertainty Estimates (BUE), where the objective is to find the data points in the low confidence region where the KDE is not effective. KDE works on using the logit vector distribution of clean examples to find the density estimate. The mathematical formulation of KDE is given below :- $KDE(x) = \frac{\sum_{x_t \in X_t} e^{\frac{-||Z(x)-Z(x_i)||^2}{\sigma ^2}}}{|X_t|}$ where Z(x) denotes the logits vector given x as the input, $X_t$ is a set of data with output class t and $\sigma$ is the bandwidth or the variance of the kernel. Note that the kernel function used is the Gaussian kernel is evaluated from the logits vecor instead of the input vector. The use of the logits is inspired from the work by Bengio et al. \cite{pmlr-v28-bengio13} and Gardner et al. \cite{gardner2016deep}, which demonstrated how the manifold learned by the network becomes increasingly linear and flatter which makes it easier to work with the logit space than the input space. An adversarial example x' will have low KDE value if x' is far from the target class manifold in the logits space, and thus can be detected using threshold based or similar approach. Later, the author suggested that this method fail to work when $x'$ is near the target class manifold. They proposed another similar method using dropout at inference time to measure uncertainty. They mathematically quantify the uncertainty U(x) of the network by performing N stochastic passes by applying dropouts with the same setting, and using the average value of the logits as the estimate. The intuition here is that for the adversarial examples, the dependence on some specific features is quite high, hence if by dropout those deep features are dropped, a high change in value of the output is caused leading to more variance, hence a threshold can be kept on this variance to differentiate between normal and adversarial examples. Mathematically :- $U(x) = \frac{1}{N} \sum^{N}_{i=1}f(x)_i^Tf(x)_i - (\frac{1}{N}\sum^{N}_{i=1}f(x)_i)^T(\frac{1}{N}\sum^{N}_{i=1}f(x)_i)$ where $f(x)_i$ denotes the i-t stochastic prediction. Intuitively, this uncertainty measure should be large for adversaries. The author showed that the ratio $\frac{U(x')}{U(x)}$ was significantly more than 1 in most case when evaluated against MNIST, CIFAR10 datasets with FGSM, BIM, JSMA and also with complex adversaries from C\&W attacks. The ratio can be used to identify adversaries by putting up a simple threshold. KDE was also shown to be able to detect adversaries, but especially indicative when evaluated against a variant of BIM that stops the attack process following a fixed number of iterations. This is indicated by the ratio being less than 1 in most cases. Based on these findings, the authors proposed a combined threshold based detection method, using both metrics to perform adversarial detection. This is done by putting threshold values on the uncertainty measurement and on the negative log of the kernel density estimates of a sample. The combined method was shown to be superior than both methods individually against FGSM, BIM, JSMA, and C\&W on MNIST, CIFAR10, and SVHN. Carlini and Wagner \cite{carlini2017evaluating} evaluated this method and concluded that the KDE method alone does not work well on CIFAR10 and can be fooled with modified C\&W attacks by including an additional objective term defined by max(-log(KDE(x'))-$\epsilon$, 0) both in whitebox and blackbox settings. They also showed that BUE can be circumvented by C\&W attacks on the expectation values of different models sampled during dropout. However, they noted that the distortions required to generate adversarial examples that fool BUE are quite larger compared to other detection methods that they evaluated. As a result, Carlini and Wagner \cite{carlini2017evaluating} concluded that BUE was the hardest detection method to fool compared to the other methods known to it so far. It is also relatively straightforward and easy to implement as an add-on to an existing network architecture. \section{Maximum Mean Discrepancy} This particular work [x] argued that the adversaries form a different characteristic distribution as per the input samples. Hence the adversaries can be detected by finding the prior mean and variance of the cluster formed on input by the adversaries and non adversaries and using these to identify the new input sample as an adversary or non adversary. The max distance along all dimensions in the means of these 2 clusters denotes the statistical difference in the distributions of adversaries from non adversaries. This is called the Maximum Mean Discrepancy (MMD), mathematically expressed as :- $MMD_b(F,X_1,X_2) = sup_{f\in F} (\frac{\sum_{i=1}^{N}f(x_{1i})}{N} - \frac{\sum_{i=1}^{M}f(x_{2i})}{M})$ \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig7.png} \caption{Clusters formed by normal samples and adversaries} \label{fig7} \end{figure} \section{Using Distribution from Deep Layers} \hspace{10mm} PixelDefend was proposed which considered the deep layers of a pretrained network for Bayesian inference instead of input or output logit vectors. The original work is a defense technique but is related to finding a distribution for train samples and then bringing the input sample closer to that distribution for defense, hence it can be used for detection as well with the same idea using thresholding on the obtained probability value. It uses the deep representations of PixelCNN which is used for classification of images for deriving the distribution of the train samples. The probability of the sample to be non adversarial is obtained using Bayesian inference from the obtained distribution assuming it to be Gaussian. Mathematically, probability is expressed as :- $p_{CNN}(X) = \Pi_i p_{CNN}(x_i|x_{1:(i-1)})$ To normalize the value for thresholding, Bits Per Dimension (BPD) is used which is obtained by scaling the negative of log of probability values by the dimension, as follows :- $BPD(X) = \frac{-log p_{CNN}(X)}{I.J.K.log(2)}$ The BPD values were consistently different and characteristic for different adversaries, normal examples had less values, adversaries have higher values, strong adversaries like C\&W and DeepFool had less difference in the values, hence had higher error rates as shown in fig 4.2 \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig8.png} \caption{(a) BPD values obtained for different adversaries (b) Percentage error in results if differentiation is done on the basis of BPD threshold} \label{fig8} \end{figure} \section{Feature Squeezing} \hspace{10mm} Xu et al. \cite{Xu_2018} argued that the with the large dimensionality of input features, yields a large attack surface. They proposed a detection strategy in which they compare the predictions of squeezed i.e. scaled down input for eg downscaled input image and unsqueezed inputs. As the name suggests, the goal of feature squeezing is to remove unnecessary features from an input by reducing the dimensionality. Two feature squeezing methods were evaluated: color bit-depth reduction and spatial smoothing, both with local and non-local smoothing. The input is labelled as adversarial if the L1 difference (absolute difference) between the model’s prediction on squeezed and unsqueezed inputs is larger than a certain threshold value T. Different levels of squeezing can be combined by bagging i.e. taking the max of L1 difference from all of them. Figure 4.3 illustrates this method. \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig9.png} \caption{Procedure for squeezing model} \label{fig9} \end{figure} For color depth reduction, The author experimented with various i-bit depth where 1 $\leq$ i $\leq$ 8. For local smoothing, median filtering was found to be more effective than Gaussian and mean smoothing. In the case of non-local smoothing, non-local means denoising was used. There is no strong motivation for this choice of squeezers as mentioned by the authors, future work on the most effective squeezers is still needed. They also suggested using multiple feature squeezing methods as part of the detection model, since different squeezers are more effective on certain types of adversaries than others and taking the max of the difference outputs given by each of them. Given n squeezers the output of the detector is defined as follows :- \[ Detector(x)= \begin{cases} Adversarial,& \text{if } max(||f(x)-f(s_1(x)||_1,...,||f(x)-f(s_n(x)||_1)>T\\ Benign, & \text{otherwise} \end{cases} \] where f(x) is the output vector given by the softmax layer of a deep neural network The author also showed that feature squeezing can also be used to increase robustness along adversaries.This is similar to the work from Chuan Guo \cite{guo2018countering} which also attempted to enhance adversarial robustness through various through various input transformations. Furthermore, the author also argued that the robustness can be increased by coupling feature squeezing with adversarial training. Feature squeezing demonstrated excellent results in detecting FGSM, DeepFool, JSMA and C\&W attacks on MNIST, CIFAR10 and ImageNet datasetswhen the attacker is not aware of the strategy used. The author found that this technique does well for $L_2$ and $L_{\inf}$ based attacks and gave poor results on $L_0$ derived attacks. Intuitively, $L_0$ attacks cause perturbations that can be thought of as salt-and-pepper noise, in which median filtering has often been used to remove this type of noise. These findings support the need of using joint squeezers configuration to take into account different types of adversarial examples. The author also considered a case where the attacker is aware of the detection model. In this setting, the attacker would typically find adversaries that fool the classifier and minimize the L1 score between squeezed and unsqueezed according to the squeezing model used. To avoid these type of whitebox attacks, the author suggested to introduce randomness for eg randomizing the threshold value as T $\pm$ rand($\delta T$). \chapter{Introduction} \section{Adversaries} \hspace{10mm}A deep learning model is trained on certain training examples for various tasks such as classification, regression etc. By training, weights are adjusted such that the model performs the task well not only on training examples judged by a certain metric but has an excellent ability to generalize on other unseen examples as well which are typically called the test data. Despite the huge success of machine learning models on a wide range of tasks, security has received a lot less attention along the years. Robustness along various potential cyber attacks also should be a metric for the accuracy of the machine learning models. These cyber attacks can potentially lead to a variety of negative impacts in the real world sensitive applications for which machine learning is used such as medical and transportation systems. Hence, it is a necessity to secure the system from such attacks. Int this report, I focus on a class of these cyber attacks called the adversarial attacks in which the original input sample is modified by small perturbations such that they still look visually the same to human beings but the machine learning models are fooled by such inputs. These modified input examples are called adversarial examples or adversaries. This has become an active research topic since the first adversarial example was suspected by Amodei et al. \cite{amodei2016concrete} \section{Adversarial attacks} \hspace{10mm}These are a special category of potential cyber attacks that can be made in which the attacker modifies the input examples such that they visually look the same ad appealing to the human being but the machine learning model gets fooled into mis-classifying it or mis-predicting the output value by a higher margin that too with very high probability. These attacks can be divided into white box and black box attacks. In the white box attacks, the attacker has the access to the machine learning model and its weights. In the following case, the attacks are mostly derived from using the model weights for back propagation and getting a small perturbation along the gradient direction to get the desired change in output. The second class of attacks are called black box attacks in which the attacker doesn't have access to the model but only the sample inputs and outputs to the model. These attacks typically use some characteristic properties to modify input that drives it considerably away from the input distribution or use the input and output data to construct the approximate parameters of the model and then devise a white box attack for it. \section{Adversarial Attack Models and Methods} \label{sec:background} For a test example $X$, an attacking method tries to find a perturbation, $\Delta X$ such that $|\Delta X|_k \leq \epsilon_{atk}$ where $\epsilon_{atk}$ is the perturbation threshold and $k$ is the appropriate order, generally selected as $2$ or $\infty$ so that the newly formed perturbed image, $X_{adv} = X + \Delta X$. Here, each pixel in the image is represented by the ${\tt \langle R,G,B \rangle}$ tuple, where ${\tt R,G,B} \in [0, 1]$. In this paper, we consider only white-box attacks, i.e. the attack methods which have access to the weights of the target classifier model. However, we believe that our method should work much better for black-box attacks as they need more perturbation to attack and hence should be more easily detected by our framework. For generating the attacks, we use the library by \cite{li2020deeprobust}. \subsection{Random Perturbation (RANDOM)} Random perturbations are simply unbiased random values added to each pixel ranging in between $-\epsilon_{atk}$ to $\epsilon_{atk}$. Formally, the randomly perturbed image is given by, \begin{equation} X_{rand} = X + \mathcal{U}(-\epsilon_{atk},\epsilon_{atk}) \end{equation} where, $\mathcal{U}(a,b)$ denote a continuous uniform distribution in the range $[a,b]$. \subsection{Fast Gradient Sign Method (FGSM)} Earlier works by~\cite{goodfellow2014explaining} introduced the generation of malicious biased perturbations at each pixel of the input image in the direction of the loss gradient $\Delta_X L(X,y)$, where $L(X,y)$ is the loss function with which the target classifier model was trained. Formally, the adversarial examples with with $l_\infty$ norm for $\epsilon_{atk}$ are computed by, \begin{equation} X_{adv} = X + \epsilon_{atk} . sign(\Delta_X L(X,y)) \end{equation} FGSM perturbations with $l_2$ norm on attack bound are calculated as, \begin{equation} X_{adv} = X + \epsilon_{atk} . \frac{\Delta_X L(X,y)}{|\Delta_X L(X,y)|_2} \end{equation} \subsection{Projected Gradient Descent (PGD)} Earlier works by~\cite{Kurakin2017AdversarialML} propose a simple variant of the FGSM method by applying it multiple times with a rather smaller step size than $\epsilon_{atk}$. However, as we need the overall perturbation after all the iterations to be within $\epsilon_{atk}$-ball of $X$, we clip the modified $X$ at each step within the $\epsilon_{atk}$ ball with $l_\infty$ norm. \begin{subequations} \begin{flalign} & X_{adv,0} = X,\\ & X_{adv,n+1} = {\tt Clip}_X^{\epsilon_{atk}}\Big{\{}X_{adv,n} + \alpha.sign(\Delta_X L(X_{adv,n},y))\Big{\}} \end{flalign} \end{subequations} Given $\alpha$, we take the no of iterations, $n$ to be $\lfloor \frac{2 \epsilon_{atk}}{\alpha}+2 \rfloor$. This attacking method has also been named as Basic Iterative Method (BIM) in some works. \subsection{Carlini-Wagner (CW) Method} \cite{carlini2017towards} proposed a more sophisticated way of generating adversarial examples by solving an optimization objective as shown in Equation~\ref{carlini_eq}. Value of $c$ is chosen by an efficient binary search. We use the same parameters as set in \cite{li2020deeprobust} to make the attack. \begin{equation} \label{carlini_eq} X_{adv} = {\tt Clip}_X^{\epsilon_{atk}}\Big{\{}\min\limits_{\epsilon} \left\Vert\epsilon\right\Vert_2 + c . f(x+\epsilon)\Big{\}} \end{equation} \subsection{DeepFool method} DeepFool \cite{moosavidezfooli2016deepfool} is an even more sophisticated and efficient way of generating adversaries. It works by making the perturbation iteratively towards the decision boundary so as to achieve the adversary with minimum perturbation. We use the default parameters set in \cite{li2020deeprobust} to make the attack. \section{Detection of adversaries} \hspace{10mm}There has been an active research in the direction of adversaries and the ways to avoid them. There are many statistical, as well as machine learning based algorithms which have been put forth for the systematic detection as well as fixing them so that they get classified into the right class or give the desired output. However, mostly the literature and study has been into the adversaries in classification neural networks. This report will specifically focus on the detection of the adversaries for the classification neural networks. In other words, the ocus of this report is to briefly discuss and review the state of the art methods which are used to classify the adversaries from a pool of input examples \chapter{Some special methods} \section{Reverse Cross Entropy} Pang et al. \cite{pang2018robust} proposed a novel detection method by introducing a new objective function called the Reverse Cross-Entropy (RCE). For C no of classes, RCE loss is defined as :- $L_{RCE} = -y_rlog f(x)$ Where $y_r$ is called the reversed label and is defined as :- \[ y_{r(i)} = \begin{cases} 0,& \text{if } i = y (true label) \\ \frac{1}{C-1}, & \text{otherwise} \end{cases} \] On training a model, to minimize $L_{RCE}$ will produce a special type of classifier called reverse classifier which will output logits such the the one with lowest value will be the predicted class. Thus, Pang et al. \cite{pang2018robust} suggested to negate the logits such that f(x) = softmax(-Z(x)). After the model is trained, adversarial detection on the model can be performed based on threshold for some measures like Kernel density estimate (as discussed in section 4.1). They also introduced a new metric called the non maximum element (non-ME) defined as :- $non-ME(x) = -\sum_{i\neq \hat{y}} \hat{f}(x)_i log(\hat{f}(x)_i $ where $\hat{f}(x)_i$ denotes the normalized on-max elements in f(x), For detection, the value is compared by a threshold T. If the value is less than threshold, it is classified as an adversary else as a normal valid example This method was demonstrated to be robust when evaluated on MNIST and CIFAR10 datasets against FGSM, BIM/ILLCM \cite{kurakin2017adversarial}, JSMA \cite{buckman2018thermometer}, C\&W \cite{carlini2017evaluating} and modified C\&W that takes into account the use of KDE; which is referred to as MCW. Furthermore, this method was also evaluated in blackbox settings against MCW-SBA \cite{papernot2017practical} and showcased how the adversarial examples generated by SBA suffer from poor transferability. Even when adversarial examples that fool both detector and classifier models were found, the adversarial examples usually exhibit larger distortions which are visually perceptible to a human. Finally, the author argued that the use of RCE not only allows one to perform adversarial detection, but also increases robustness of a model in general compared to using standard cross-entropy as the objective function. They also did the comparison of t-SNE embeddings between a model trained with RCE and non-RCE objectives, and showed how the t-SNE \cite{JMLR:v9:vandermaaten08a} visualization of the model that was trained with RCE objective achieved higher separability. The use of new objective functions such as RCE which constrains the ability of attacker to generate adversarial examples making it robust seems to be an interesting research area to be explored in the future. \section{Adversarial Examples Detection in Features Distance Spaces} The authors for this work \cite{inbook} put forth a very interesting way to detect adversaries. The authors argued that the adversaries trace a certain path when considered in the feature space through all the deep layers of network. These paths can be used as a criteria to determine whether the input is an adversary is not. The set of all paths taken by the normal examples are used to determine the mean paths. The mean vector values are pre-calculated at each layer to get a 2D vector of the mean feature vectors for each sample class. Using these means at each layer, an M dimensional vector is obtained at each layer where M is the no of classes as the L2 distance from these M mean vectors at each layer. These N distance vectors are passed through sequential neural networks like LSTM or MLP. The output of this sequential network is used to predict whether the input is an adversary or not \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig10.png} \caption{Intuition on distance feature paths followed by normal samples and adversaries} \label{fig10} \end{figure} Basically, this method tries to find patterns in the sequential inference through deep layers to detect the presence of adversarial example. It tries to encode sequential flow of inference within layers into training an LSTM network which outputs the probability. Hence the trained LSTM network tries to find similarities in the inference patterns which it fails to in case of adversarial examples, hence able to detect them. The basic procedure can be described as :- 1. Calculate the principle centers for each class for each layer as the centroid of all the examples:- $p_c^l = \frac{\sum_{j=1}{K_c} o_{c,j}^l}{K_c}$ 2. For the input, derive C neuron embedding for each layer by taking L2 distance from each of the principal centre :- $e^l = (d(o^l,p_1^l),d(o^l,p_2^l).....d(o^l,p_C^l))$ 3. Feed the L layer embedding to train a time series network like LSTM to find patterns in the sequential embedding \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig11.png} \caption{Network architecture} \label{fig11} \end{figure} The model demonstrated excellent results on large no of adversary attacks including L-BFGS, FGSM, BIM, PGD, MI-FGSM. Also it was observed that using LSTM yielded better results than MLP due to the inherent sequential nature of the patterns which are better recorded by the LSTM. True Positive Rate (TPR) and False Positive Rate (FPR) ratio results can be seen from fig 5.3 \begin{figure}[ht] \centering \includegraphics[width=0.5\textwidth]{Images/fig12.png} \caption{True positive and false positive rates for adversaries and normal samples} \label{fig12} \end{figure} \chapter{Network Based Methods} \section{Adversary detector network} \hspace{10mm}Metzen et al. \cite{metzen2017detecting} proposed augmenting a pretrained neural network with a binary detector network at each layer of the network. The detector network D is a binary classifier network that is trained to classify an example real and adversarial example. It takes the output neurons of the pre-trained network at a certain layer as an input and outputs the probability of an input being adversarial (i.e., $D(f_l(x))$ = $y_{adv}$ or $y_{clean}$, where $f_l(x)$ denotes the output of classifier f at the l-th layer). For the training, adversary eamples are generated from the pretrained model and augmented to the dataset. In order to account for future attacks with the assumption that attacker have access to both the classifier and detector networks, The author generated examples which specifically attempted to fool the detector. They generated adversarial examples according to the following eqn(1) :- $x'_{i+1} = Clip_\epsilon{x'_i + \sigma[(1-\alpha)sign(\delta_xL_{classifier}(x'_i,y)) + \alpha sign(\delta_xL_{classifier}(x'_i,y_{adv}))]}$ where $x'_0$ = x, and $\alpha$ denotes the weight factor that controls whether the attacker’s objective is to attack the classifier or the detector, chosen randomly at every iteration. The training is first done for normal examples, the adversarial training This method was found to be giving satisfactory results against FGSM, DeepFooland BIM attacks tested on CIFAR10 and 10-class Imagenet. Placing the detector network at different depths of the network gave different results for different attacks demonstrating the characteristic difference of the attacks. The author further proposed booging of detector networks at each of the individual layer \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig4.png} \caption{Detector network configuration} \label{fig4} \end{figure} Gong et al. \cite{gong2017adversarial} proposed a similar method by training a binary classifier network to differentiate between adversarial and clean examples. However, the binary classifier here is a completely separate network from the main classifier. However, rather than generating adversarial examples against the detector, they generate adversarial examples for a pretrained classifier, and augment these adversarial examples to the original training data to train explicitly the binary classifier freezing the weights of the model. The author observed several limitations on the generalization of this method. First, they found that the detector network is sensitive to the $\epsilon$ value used to generate FGSM and BIM adversaries, in the sense that detector trained on adversarial examples with $\epsilon_2$ cannot detect adversarial examples with $\epsilon_2$, especially when $\epsilon_2$ < $\epsilon_1$. They also discovered that training a detector was even not able to generalize on other adversaries noting that adversaries generated by different methods have different characteristics. For example, a detector trained on FGSM adversaries was found to not be able to detect JSMA adversaries correctly. \section{Additional Class Node} Another similar method was proposed by Grosse et al. \cite{gong2017adversarial}, a detection method that works by augmenting a classifier network with an additional class node that represents adversarial class. Given a pretrained model, a new model with an extra class node is trained on clean examples and adversarial examples generated for the pre-trained model itself and setting the ground truth for the newly created adversaries as the new additional node. Grosse et al. showed that this method can be used to detect adversaries generated by FGSM and JSMA robustly on MNIST. They also showed how this method can reliably detect SBA , particularly FGSM-SBA and JSMA-SBA variants also. \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig5.png} \caption{Example test case labels of additional class node} \label{fig5} \end{figure} Concurrent work from Hosseini et al. proposed a very similar method with slight difference in the detail of the training procedure where the classifier is alternatively trained on clean and adversarial examples (i.e., via adversarial training). Furthermore, the labels used for training the model were carefully assigned by performing label smoothing. Label smoothing sets a probability value to the correct class and distributes the rest uniformly to the other classes. Having a slightly different goal than Grosse et al. \cite{gong2017adversarial}, Hosseini et al. \cite{hosseini2017blocking} evaluated their method in the blackbox settings and showed how their method is especially helpful to reduce the transferability rate of adversarial examples. Although the detection method proposed by Hosseini et al. was not evaluated by Carlini and Wagner, the method appears to be similar with the method proposed by Grosse et al. Since the evaluation of this method was only done on MNIST and grayscaled GTSRB, it is doubtful whether this method will also exhibit high false positive rate when tested on CIFAR10 or other datasets with higher complexity and on other whitebox attacks. See the fig 6 for the visual diagram showing the algorithm \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig6.png} \caption{Training procedure} \label{fig6} \end{figure} \section{Limitations} First of all, detector networks are differentiable, hence if their weights are accessible to the attacker in a whitebox attack, the constraint problem can be changed accordingly to bypass them. Laater, Carlini and Wagner found out that these methods have a high false positive rate against complex attacks C\&W. Also, these methods are highly sensitive to the $\epsilon$ values, if they are adversarially trained to avoid attacks for a particular value of $\epsilon$, they fail to give similar results for a slightly higher value of $\epsilon$. Also, Carlini and Wagner \cite{carlini2017evaluating} showed that similar results are not replicable on other complex datasets like CIFAR10 as on simple datasets like MNIST, hence authenticity of these methods is questionable. \chapter{Early Statistical Methods} Some of the early works in this domain which mark the starting of research are from Hendrys \cite{hendrycks2017early} and Gimpel \cite{hendrycks2018baseline}. They investigated 3 statistical methods which can be used to characterize adversaries from non-adversaries and hence based on these statistics identify adversaries based on threshold or machine learning techniques \section{Using PCA} \hspace{10mm}The first method proposed was to analyze the principal components using the SGD decomposition of the co-variance matrix to get the matrix U which can be used for finding the PCA components given the input. This modified input is called the PCA whitened input. The author proposes that for the adversaries, the magnitude of the larger PCA coefficients is very less as compared to the non adversaries. Hence by putting a threshold or some other statistical adaptive measure on the variance of the last PCA coefficients, the adversaries can be identified. This was tested for the MNIST dataset. The PCA component value variations can be seen from fig 1. The threshold based technique demonstrated the identification of FGSM \cite{goodfellow2015explaining}, BIM \cite{kurakin2017adversarial} adversaries on MNIST, Tiny-ImageNet datasets when the attacker is not aware of the defense strategy \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig1.png} \caption{Magnitudes of PCA components for normal and adversarial examples} \label{fig1} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/table1.png} \caption{Percentage of adversaries correctly identified using PCA method} \label{table1} \end{figure} An extension to this work \cite{li2017adversarial} used the PCA components of deep layers instead of the input. In this work, a deep learning classifier was used for each layer of the architecture with the inputs as the PCA coefficients, max and min values and 25\%, 50\% and 75\% medians of the PCA coefficient values. For combining the result from each layer, they used a cascaded boosting. With this setup, for a sample to be identified as a non adversary, it has to be identified as non adversary at each stage. The algorithm for the following is given in fig 2. \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig2.png} \caption{Algorithm for training process of a cascade classifier} \label{fig2} \end{figure} \section{Using Softmax Distribution} \hspace{10mm}Further, Hendrycks and Gimpel \cite{hendrycks2017early} \cite{hendrycks2018baseline} proposed that the distribution after softmax on logits are different between clean and adversarial inputs, and thus can be analyzed to perform adversarial detection. The analysis measure can be done from the Kullback-Leibler divergence between uniform distribution and the softmax distribution. Then threshold-based detection or similar statistical differentiation can be made on it. It was found that the softmax distribution of normal examples are usually further away from uniform distribution compared to adversarial examples. This can be understood as a model tends to predict an input with a high confidence tend to have a uniform distribution as they essentially have equal no of training samples and thus do not differentiate on any dimension, while for adversaries generated by attack methods, do not care about the output distribution hence there is a high chance that they form a non uniform biased distribution This method seems to only applicable to specific class of attacks that stop as soon as an input becomes adversarial such as the JSMA \cite{papernot2015limitations} , which may be predicted by the model with a low confidence score. Furthermore, evaluation on ImageNet models is needed which is currently incomplete since the softmax probability on ImageNet dataset usually is less confident due to the large number of classes. However, it is also not clear whether or not this strategy would work against adversarial attacks that also target specific confidence score such as the C\&W attack \cite{carlini2017evaluating} \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/table2.png} \caption{Constraints degrade the pathology of fooling images. Value $\sigma$ is standard deviation} \label{table2} \end{figure} \section{Using Input Reconstructions From logits} Finally, Hendrycks and Gimpel proposed that by analyzing the input reconstructions obtained by adding an auxiliary decoder [233] to the classifier model that takes the logits as an input, adversarial examples can be detected . The decoder and classifier are jointly trained only on clean examples. The detection can be done by creating a detector network which takes as input the reconstruction, logits, and confidence score, and outputs a probability of an input being adversarial or not. Here, the detector network is trained on both clean and adversarial examples. They evaluated this method on MNIST model and demonstrated that this method is successful in detecting adversarial examples generated by FGSM and BIM. They showed qualitatively how reconstruction of adversarial examples are noisier compared to normal inputs (see fig 3), allowing one to compute the differences as a way to detect adversarial examples. The differences can be calculated using smootheness loss between input and reconstructed image. \begin{figure}[ht] \centering \includegraphics[width=0.7\textwidth]{Images/fig3.png} \caption{Adversarial image reconstruction are of lower quality then clean image reconstructions} \label{fig3} \end{figure} \section{Limitations} \hspace{10mm}Carlini and Wagner \cite{DBLP:journals/corr/CarliniW17} in their work showed that all of these methods are not robust and ineffective against strong attacks and also inconsistent with other datasets. For the PCA method, they found that it can be bypassed easily if the attacker knows the defense strategy by setting a constraint on the magnitude of the magnitude of last PCA components. This can be achieved using C\&W attacks by adding this constraint to the adversary generation process. Also, they showed that the PCA method was effective on MNIST as most of the pixels are black on all images for eg the corner points but in adversaries they are changed resulting into larger magnitudes at higher PCA components. However, they argued that this was due to the aforementioned artifact in the dataset itself which made it to succeed on the MNIST dataset but however showed poor performance on the Cifar10 dataset. The decoder and classifier networks are fully differentiable, hence can be used to pose a white box attack bypassing them. To summarize, these methods did show good result for some specific datasets against FGSM and BIM adversaries but however fail to identify complex adversary attacks like C\&W \chapter{Use of conditional Variational AutoEncoder (CVAE)} \section{Introduction} \label{sec:introduction} Many recent works have presented effective ways in which adversarial attacks can be avoided as we discussed in earlier chapters. To re-iterate, adversarial attacks can be classified into whitebox and blackbox attacks. White-box attacks~\cite{akhtar2018threat} assume access to the neural network weights and architecture, which are used for classification, and thereby specifically targeted to fool the neural network. Hence, they are more accurate than blackbox attacks~\cite{akhtar2018threat} which do not assume access the model parameters. Methods for detection of adversarial attacks can be broadly categorized as -- (i) statistical methods, (ii) network based methods, and (iii) distribution based methods. Statistical methods~\cite{hendrycks2016early} \cite{li2017adversarial} focus on exploiting certain characteristics of the input images or the final logistic-unit layer of the classifier network and try to identify adversaries through their statistical inference. A certain drawback of such methods as pointed by~\cite{carlini2017towards} is that the statistics derived may be dataset specific and same techniques are not generalized across other datasets and also fail against strong attacks like CW-attack. Network based methods~\cite{metzen2017detecting} \cite{gong2017adversarial} aim at specifically training a binary classification neural network to identify the adversaries. These methods are restricted since they do not generalize well across unknown attacks on which these networks are not trained, also they are sensitive to change with the amount of perturbation values such that a small increase in these values makes this attacks unsuccessful. Also, potential whitebox attacks can be designed as shown by~\cite{carlini2017towards} which fool both the detection network as well as the adversary classifier networks. Distribution based methods~\cite{feinman2017detecting} \cite{gao2021maximum} \cite{song2017pixeldefend} \cite{xu2017feature} \cite{jha2018detecting} aim at finding the probability distribution from the clean examples and try to find the probability of the input example to quantify how much they fall within the same distribution. However, some of the methods do not guarantee robust separation of randomly perturbed and adversarial perturbed images. Hence there is a high chance that all these methods tend to get confused with random noises in the image, treating them as adversaries. To overcome this drawback so that the learned models are robust with respect to both adversarial perturbations as well as sensitivity to random noises, we propose the use of Conditional Variational AutoEncoder (CVAE) trained over a clean image set. At the time of inference, we empirically establish that the input example falls within a low probability region of the clean examples of the predicted class from the target classifier network. It is important to note here that, this method uses both the input image as well as the predicted class to detect whether the input is an adversary as opposed to some distribution based methods which use only the distribution from the input images. On the contrary, random perturbations activate the target classifier network in such a way that the predicted output class matches with the actual class of the input image and hence it falls within the high probability region. Thus, it is empirically shown that our method does not confuse random noise with adversarial noises. Moreover, we show how our method is robust towards special attacks which have access to both the network weights of CVAE as well as the target classifier networks where many network based methods falter. Further, we show that to eventually fool our method, we may need larger perturbations which becomes visually perceptible to the human eye. The experimental results shown over MNIST and CIFAR-10 datasets present the working of our proposal. In particular, the primary contributions made by our work is as follows. \begin{compactenum}[(a)] \item We propose a framework based on CVAE to detect the possibility of adversarial attacks. \item We leverage distribution based methods to effectively differentiate between randomly perturbed and adversarially perturbed images. \item We devise techniques to robustly detect specially targeted BIM-attacks~\cite{metzen2017detecting} using our proposed framework. \end{compactenum} To the best of our knowledge, this is the first work which leverages use of Variational AutoEncoder architecture for detecting adversaries as well as aptly differentiates noise from adversaries to effectively safeguard learned models against adversarial attacks. \section{Proposed Framework Leveraging CVAE} \label{sec:method} In this section, we present how Conditional Variational AutoEncoders (CVAE), trained over a dataset of clean images, are capable of comprehending the inherent differentiable attributes between adversaries and noisy data and separate out both using their probability distribution map. \subsection{Conditional Variational AutoEncoders (CVAE)} Variational AutoEncoder is a type of a Generative Adversarial Network (GAN) having two components as Encoder and Decoder. The input is first passed through an encoder to get the latent vector for the image. The latent vector is passed through the decoder to get the reconstructed input of the same size as the image. The encoder and decoder layers are trained with the objectives to get the reconstructed image as close to the input image as possible thus forcing to preserve most of the features of the input image in the latent vector to learn a compact representation of the image. The second objective is to get the distribution of the latent vectors for all the images close to the desired distribution. Hence, after the variational autoencoder is fully trained, decoder layer can be used to generate examples from randomly sampled latent vectors from the desired distribution with which the encoder and decoder layers were trained. \vspace{-0.3cm} \begin{figure}[h] \centering \includegraphics[width=0.45\textwidth]{cvae_diag.png} \caption{CVAE Model Architecture} \label{fig:cvae_diag} \end{figure} \vspace{-0.3cm} Conditional VAE is a variation of VAE in which along with the input image, the class of the image is also passed with the input at the encoder layer and also with the latent vector before the decoder layer (refer to Figure~\ref{fig:cvae_diag}). This helps Conditional VAE to generate specific examples of a class. The loss function for CVAE is defined by Equation~\ref{eq:cvae}. The first term is the reconstruction loss which signifies how closely can the input $X$ be reconstructed given the latent vector $z$ and the output class from the target classifier network as condition, $c$. The second term of the loss function is the KL-divergence ($\mathcal{D}_{KL}$) between the desired distribution, $P(z|c)$ and the current distribution ($Q(z|X,c)$) of $z$ given input image $X$ and the condition $c$. \begin{equation} \label{eq:cvae} L(X,c) = \mathbb{E} \big{[}\log P(X|z,c) \big{]} - \mathcal{D}_{KL} \big{[} Q(z|X,c)\ ||\ P(z|c) \big{]} \end{equation} \subsection{Training CVAE Models} For modeling $\log P(X|z,c)$, we use the decoder neural network to output the reconstructed image, $X_{rcn}$ where we utilize the condition $c$ which is the output class of the image to get the set of parameters, $\theta(c)$ for the neural network. We calculate Binary Cross Entropy (${\tt BCE}$) loss of the reconstructed image, $X_{rcn}$ with the input image, $X$ to model $\log P(X|z,c)$. Similarly, we model $Q(z|X,c)$ with the encoder neural network which takes as input image $X$ and utilizes condition, $c$ to select model parameters, $\theta(c)$ and outputs mean, $\mu$ and log of variance, $\log \sigma^2$ as parameters assuming Gaussian distribution for the conditional distribution. We set the target distribution $P(z|c)$ as unit Gaussian distribution with mean 0 and variance 1 as $N(0,1)$. The resultant loss function would be as follows, \begin{eqnarray} L(X,c) & = & {\tt BCE} \big{[} X, Decoder(X,\theta(c)) \big{]} - \nonumber\\ & & \frac{1}{2}\Big{[}Encoder_\sigma^2(X,\theta(c)) + Encoder_\mu^2(X,\theta(c)) \nonumber\\ & & \qquad - 1 - \log \big{(} Encoder_\sigma^2(X,\theta(c)) \big{)} \Big{]} \end{eqnarray} The model architecture weights, $\theta(c)$ are a function of the condition, $c$. Hence, we learn separate weights for encoder and decoder layers of CVAE for all the classes. It implies learning different encoder and decoder for each individual class. The layers sizes are tabulated in Table~\ref{tab:cvae_arch_sizes}. We train the Encoder and Decoder layers of CVAE on clean images with their ground truth labels and use the condition as the predicted class from the target classifier network during inference. \vspace{-0.2cm} \begin{table}[h] {\sf \scriptsize \begin{center} \begin{tabular}{|c||c|l|} \hline {\bf Attribute} & {\bf Layer} & {\bf Size} \\ \hline \hline & Conv2d & Channels: (c, 32)\\ & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & BatchNorm2d & 32 \\ \cline{2-3} & Relu & \\ \cline{2-3} & Conv2d & Channels: (32, 64)\\ Encoder & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & BatchNorm2d & 64 \\ \cline{2-3} & Relu & \\ \cline{2-3} & Conv2d & Channels: (64, 128)\\ & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & BatchNorm2d & 128 \\ \hline Mean & Linear & (1024,$z_{dim}$=128) \\ \hline Variance & Linear & (1024,$z_{dim}$=128) \\ \hline Project & Linear & ($z_{dim}$=128,1024) \\ \cline{2-3} & Reshape & (128,4,4) \\ \hline & ConvTranspose2d & Channels: (128, 64)\\ & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & BatchNorm2d & 64 \\ \cline{2-3} & Relu & \\ \cline{2-3} & ConvTranspose2d & Channels: (64, 32)\\ Decoder & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & BatchNorm2d & 64 \\ \cline{2-3} & Relu & \\ \cline{2-3} & ConvTranspose2d & Channels: (32, c)\\ & & Kernel: (4,4,stride=2,padding=1) \\ \cline{2-3} & Sigmoid & \\ \hline \end{tabular} \end{center} } \caption{CVAE Architecture Layer Sizes. $c$ = Number of Channels in the Input Image ($c=3$ for CIIFAR-10 and $c=1$ for MNIST).} \label{tab:cvae_arch_sizes} \end{table} \subsection{Determining Reconstruction Errors} Let $X$ be the input image and $y_{pred}$ be the predicted class obtained from the target classifier network. $X_{rcn, y_{pred}}$ is the reconstructed image obtained from the trained encoder and decoder networks with the condition $y_{pred}$. We define the reconstruction error or the reconstruction distance as in Equation~\ref{eq:recon}. The network architectures for encoder and decoder layers are given in Figure~\ref{fig:cvae_diag}. \begin{equation} \label{eq:recon} {\tt Recon}(X,y) = (X - X_{rcn,y})^2 \end{equation} Two pertinent points to note here are: \begin{compactitem} \item For clean test examples, the reconstruction error is bound to be less since the CVAE is trained on clean train images. As the classifier gives correct class for the clean examples, the reconstruction error with the correct class of the image as input is less. \item For the adversarial examples, as they fool the classifier network, passing the malicious output class, $y_{pred}$ of the classifier network to the CVAE with the slightly perturbed input image, the reconstructed image tries to be closer to the input with class $y_{pred}$ and hence, the reconstruction error is large. \end{compactitem} As an example, let the clean image be a cat and its slightly perturbed image fools the classifier network to believe it is a dog. Hence, the input to the CVAE will be the slightly perturbed cat image with the class dog. Now as the encoder and decoder layers are trained to output a dog image if the class inputted is dog, the reconstructed image will try to resemble a dog but since the input is a cat image, there will be large reconstruction error. Hence, we use reconstruction error as a measure to determine if the input image is adversarial. We first train the Conditional Variational AutoEncoder (CVAE) on clean images with the ground truth class as the condition. Examples of reconstructions for clean and adversarial examples are given in Figure~\ref{fig:eg_images_mnist} and Figure~\ref{fig:eg_images_cifar}. \vspace{-0.3cm} \begin{figure}[ht] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/orig_eg.png} \caption{Input Images} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/recon_eg.png} \caption{Reconstructed Images} \end{subfigure} \caption{Clean and Adversarial Attacked Images to CVAE from MNIST Dataset} \label{fig:eg_images_mnist} \end{center} \end{figure} \vspace{-0.3cm} \begin{figure}[ht] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/orig_eg.png} \caption{Input Images} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/recon_eg.png} \caption{Reconstructed Images} \end{subfigure} \caption{Clean and Adversarial Attacked Images to CVAE from CIFAR-10 Dataset. } \label{fig:eg_images_cifar} \end{center} \vspace{-0.5cm} \end{figure} \subsection{Obtaining $p$-value} As already discussed, the reconstruction error is used as a basis for detection of adversaries. We first obtain the reconstruction distances for the train dataset of clean images which is expected to be similar to that of the train images. On the other hand, for the adversarial examples, as the predicted class $y$ is incorrect, the reconstruction is expected to be worse as it will be more similar to the image of class $y$ as the decoder network is trained to generate such images. Also for random images, as they do not mostly fool the classifier network, the predicted class, $y$ is expected to be correct, hence reconstruction distance is expected to be less. Besides qualitative analysis, for the quantitative measure, we use the permutation test from~\cite{EfroTibs93}. We can provide an uncertainty value for each input about whether it comes from the training distribution. Specifically, let the input $X'$ and training images $X_1, X_2, \ldots, X_N$. We first compute the reconstruction distances denoted by ${\tt Recon}(X,y)$ for all samples with the condition as the predicted class $y = {\tt Classifier}(X)$. Then, using the rank of ${\tt Recon}(X',y')$ in $\{ {\tt Recon}(X_1,y_1), {\tt Recon}(X_2,y_2), \ldots, {\tt Recon}(X_N,y_N)\}$ as our test statistic, we get, \begin{eqnarray} T & = & T(X' ; X_1, X_2, \ldots, X_N) \nonumber\\ & = & \sum_{i=1}^N I \big{[} {\tt Recon}(X_i,y_i) \leq {\tt Recon}(X',y') \big{]} \end{eqnarray} Where $I[.]$ is an indicator function which returns $1$ if the condition inside brackets is true, and $0$ if false. By permutation principle, $p$-value for each sample will be, \begin{equation} p = \frac{1}{N+1} \Big{(} \sum_{i=1}^N I[T_i \leq T]+1 \Big{)} \end{equation} Larger $p$-value implies that the sample is more probable to be a clean example. Let $t$ be the threshold on the obtained $p$-value for the sample, hence if $p_{X,y} < t$, the sample $X$ is classified as an adversary. Algorithm~\ref{algo:adv_detect} presents the overall resulting procedure combining all above mentioned stages. \vspace{-0.3cm} \alglanguage{pseudocode} \begin{algorithm} \small \caption{Adversarial Detection Algorithm} \label{algo:adv_detect} \begin{algorithmic}[1] \Function{Detect\_Adversaries ($X_{train}, Y_{train}, X, t$)}{} \State recon $\gets$ ${\tt Train}(X_{train},Y_{train})$ \State recon\_dists $\gets$ ${\tt Recon}(X_{train},Y_{train})$ \State Adversaries $\gets$ $\phi$ \For{$x$ in $X$} \State $y_{pred}$ $\gets$ ${\tt Classifier}(x)$ \State recon\_dist\_x $\gets$ ${\tt Recon}(x,y_{pred})$ \State pval $\gets$ $p$-${\tt value}(recon\_dist\_x,recon\_dists)$ \If {pval $\leq$ $t$} \State Adversaries.${\tt insert}(x)$ \EndIf \EndFor \State {\bf return} Adversaries \EndFunction \Statex \end{algorithmic} \vspace{-0.4cm}% \end{algorithm} Algorithm~\ref{algo:adv_detect} first trains the CVAE network with clean training samples (Line~2) and formulates the reconstruction distances (Line~3). Then, for each of the test samples which may contain clean, randomly perturbed as well as adversarial examples, first the output predicted class is obtained using a target classifier network, followed by finding it's reconstructed image from CVAE, and finally by obtaining it's $p$-value to be used for thresholding (Lines~5-8). Images with $p$-value less than given threshold ($t$) are classified as adversaries (Lines~9-10). \section{Experimental Results} \label{sec:experiment} We experimented our proposed methodology over MNIST and CIFAR-10 datasets. All the experiments are performed in Google Colab GPU having $0.82$GHz frequency, $12$GB RAM and dual-core CPU having $2.3$GHz frequency, $12$GB RAM. An exploratory version of the code-base will be made public on github. \subsection{Datasets and Models} Two datasets are used for the experiments in this paper, namely MNIST~\cite{lecun2010mnist} and CIFAR-10~\cite{Krizhevsky09learningmultiple}. MNIST dataset consists of hand-written images of numbers from $0$ to $9$. It consists of $60,000$ training examples and $10,000$ test examples where each image is a $28 \times 28$ gray-scale image associated with a label from $1$ of the $10$ classes. CIFAR-10 is broadly used for comparison of image classification tasks. It also consists of $60,000$ image of which $50,000$ are used for training and the rest $10,000$ are used for testing. Each image is a $32 \times 32$ coloured image i.e. consisting of $3$ channels associated with a label indicating $1$ out of $10$ classes. We use state-of-the-art deep neural network image classifier, ResNet18~\cite{he2015deep} as the target network for the experiments. We use the pre-trained model weights available from~\cite{Idelbayev18a} for both MNIST as well as CIFAR-10 datasets. \subsection{Performance over Grey-box attacks} If the attacker has the access only to the model parameters of the target classifier model and no information about the detector method or it's model parameters, then we call such attack setting as Grey-box. This is the most common attack setting used in previous works against which we evaluate the most common attacks with standard epsilon setting as used in other works for both the datasets. For MNIST, the value of $\epsilon$ is commonly used between 0.15-0.3 for FGSM attack and 0.1 for iterative attacks \cite{samangouei2018defensegan} \cite{gong2017adversarial} \cite{xu2017feature}. While for CIFAR10, the value of $\epsilon$ is most commonly chosen to be $\frac{8}{255}$ as in \cite{song2017pixeldefend} \cite{xu2017feature} \cite{fidel2020explainability}. For DeepFool \cite{moosavidezfooli2016deepfool} and Carlini Wagner (CW) \cite{carlini2017towards} attacks, the $\epsilon$ bound is not present. The standard parameters as used by default in \cite{li2020deeprobust} have been used for these 2 attacks. For $L_2$ attacks, the $\epsilon$ bound is chosen such that success of the attack is similar to their $L_\infty$ counterparts as the values used are very different in previous works. \subsubsection{Reconstruction Error Distribution} The histogram distribution of reconstruction errors for MNIST and CIFAR-10 datasets for different attacks are given in Figure~\ref{fig:recons_dist}. For adversarial attacked examples, only examples which fool the network are included in the distribution for fair comparison. It may be noted that, the reconstruction errors for adversarial examples is higher than normal examples as expected. Also, reconstructions errors for randomly perturbed test samples are similar to those of normal examples but slightly larger as expected due to reconstruction error contributed from noise. \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/rec-errors.png.jpeg} \caption{MNIST dataset} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/rec-errors.jpeg} \caption{CIFAR-10 dataset} \end{subfigure} \caption{Reconstruction Distances for different Grey-box attacks} \label{fig:recons_dist} \end{center} \end{figure} \subsubsection{$p$-value Distribution} From the reconstruction error values, the distribution histogram of p-values of test samples for MNIST and CIFAR-10 datasets are given in Figure~\ref{fig:p_val}. It may be noted that, in case of adversaries, most samples have $p$-value close to $0$ due to their high reconstruction error; whereas for the normal and randomly perturbed images, $p$-value is nearly uniformly distributed as expected. \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/p-values.jpeg} \caption{$p$-values from MNIST dataset} \label{fig:p_mnist} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/p-values.jpeg} \caption{$p$-values from CIFAR-10 dataset} \label{fig:p_cifar} \end{subfigure} \caption{Generated $p$-values for different Grey-box attacks} \label{fig:p_val} \end{center} \end{figure} \subsubsection{ROC Characteristics} Using the $p$-values, ROC curves can be plotted as shown in Figure \ref{fig:roc}. As can be observed from ROC curves, clean and randomly perturbed attacks can be very well classified from all adversarial attacks. The values of $\epsilon_{atk}$ were used such that the attack is able to fool the target detector for at-least $45\%$ samples. The percentage of samples on which the attack was successful for each attack is shown in Table~\ref{tab:stat}. \begin{figure}[h] \begin{center} \begin{subfigure}{.38\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/linear_comparison.jpeg} \caption{MNIST dataset} \label{fig:roc_mnist} \end{subfigure} \begin{subfigure}{.37\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/linear_comparison.jpeg} \caption{CIFAR-10 dataset} \label{fig:roc_cifar} \end{subfigure} \caption{ROC Curves for different Grey-box attacks} \label{fig:roc} \end{center} \end{figure} \subsubsection{Statistical Results and Discussions} The statistics for clean, randomly perturbed and adversarial attacked images for MNIST and CIFAR datasets are given in Table~\ref{tab:stat}. Error rate signifies the ratio of the number of examples which were misclassified by the target network. Last column (AUC) lists the area under the ROC curve. The area for adversaries is expected to be close to $1$; whereas for the normal and randomly perturbed images, it is expected to be around $0.5$. \begin{table}[h] {\sf \scriptsize \begin{center} \setlength\tabcolsep{1.4pt} \begin{tabular}{|c|c|c|c|c|c|c|} \hline {\bf Type} & \multicolumn{2}{c|}{\bf Error Rate (\%)} & \multicolumn{2}{c|}{\bf Parameters} & \multicolumn{2}{c|}{\bf AUC} \\ \cline{2-3} \cline{4-5} \cline{6-7} & {\bf MNIST} & {\bf CIFAR-10} & {\bf MNIST} & {\bf CIFAR-10} & {\bf MNIST} & {\bf CIFAR-10} \\ \hline\hline NORMAL & 2.2 & 8.92 & - & - & 0.5 & 0.5\\ \hline RANDOM & 2.3 & 9.41 & $\epsilon$=0.1 & $\epsilon$=$\frac{8}{255}$ & 0.52 & 0.514\\ \hline FGSM & 90.8 & 40.02 & $\epsilon$=0.15 & $\epsilon$=$\frac{8}{255}$ & 0.99 & 0.91\\ \hline FGSM-L2 & 53.3 & 34.20 & $\epsilon$=1.5 & $\epsilon=1$ & 0.95 & 0.63\\ \hline R-FGSM & 91.3 & 41.29 & $\epsilon$=(0.05,0.1) & $\epsilon$=($\frac{4}{255}$,$\frac{8}{255}$) & 0.99 & 0.91\\ \hline R-FGSM-L2 & 54.84 & 34.72 & $\epsilon$=(0.05,1.5) & $\epsilon$=($\frac{4}{255}$,1) & 0.95 & 0.64\\ \hline PGD & 82.13 & 99.17 & $\epsilon$=0.1,$n$=12 & $\epsilon$=$\frac{8}{255}$,$n$=12 & 0.974 & 0.78\\ & & & $\epsilon_{step}=0.02$ & $\epsilon_{step}$=$\frac{1}{255}$ & & \\ \hline CW & 100 & 100 & - & - & 0.98 & 0.86\\ \hline DeepFool & 97.3 & 93.89 & - & - & 0.962 & 0.75\\ \hline \end{tabular} \end{center} } \caption{Image Statistics for MNIST and CIFAR-10. AUC : Area Under the ROC Curve. Error Rate (\%) : Percentage of samples mis-classified or Successfully-attacked} \label{tab:stat} \end{table} It is worthy to note that, the obtained statistics are much comparable with the state-of-the-art results. Interestingly, some of the methods~\cite{song2017pixeldefend} explicitly report comparison results with randomly perturbed images and are ineffective in distinguishing adversaries from random noises, but most other methods do not report results with random noise added to the input image. Since other methods use varied experimental setting, attack models, different datasets as well as $\epsilon_{atk}$ values and network model, exact comparisons with other methods is not directly relevant primarily due to such varied experimental settings. However, the results are mostly similar to our results while our method is able to statistically differentiate from random noisy images. \vspace{-0.2cm} In addition to this, since our method does not use any adversarial examples for training, it is not prone to changes in value of $\epsilon$ or with change in attacks which network based methods face as they are explicitly trained with known values of $\epsilon$ and types of attacks. Moreover, among distribution and statistics based methods, to the best of our knowledge, utilization of the predicted class from target network has not been done before. Most of these methods either use the input image itself \cite{jha2018detecting} \cite{song2017pixeldefend} \cite{xu2017feature}, or the final logits layer \cite{feinman2017detecting} \cite{hendrycks2016early}, or some intermediate layer \cite{li2017adversarial} \cite{fidel2020explainability} from target architecture for inference, while we use the input image and the predicted class from target network to do the same. \subsection{Performance over White-box attacks} In this case, we evaluate the attacks if the attacker has the information of both the defense method as well as the target classifier network. \cite{metzen2017detecting} proposed a modified PGD method which uses the gradient of the loss function of the detector network assuming that it is differentiable along with the loss function of the target classifier network to generate the adversarial examples. If the attacker also has access to the model weights of the detector CVAE network, an attack can be devised to fool both the detector as well as the classifier network. The modified PGD can be expressed as follows :- \begin{subequations} \begin{flalign} &X_{adv,0} = X,\\ &X_{adv,n+1} = {\tt Clip}_X^{\epsilon_{atk}}\Big{\{}X_{adv,n} + \nonumber\\ &\qquad \qquad \alpha .sign \big{(}\ (1-\sigma) . \Delta_X L_{cls}(X_{adv,n},y_{target}) + \nonumber\\ &\qquad \qquad \sigma . \Delta_X L_{det}(X_{adv,n},y_{target})\ \big{)} \Big{\}} \end{flalign} \end{subequations} Where $y_{target}$ is the target class and $L_{det}$ is the reconstruction distance from Equation \ref{eq:recon}. It is worthy to note that our proposed detector CVAE is differentiable only for the targeted attack setting. For the non-targeted attack, as the condition required for the CVAE is obtained from the target classifier output which is discrete, the differentiation operation is not valid. We set the target randomly as any class other than the true class for testing. \subsubsection{Effect of $\sigma$} To observe the effect of changing value of $\sigma$, we keep the value of $\epsilon$ fixed at 0.1. As can be observed in Figure \ref{fig:roc_sigma}, the increase in value of $\sigma$ implies larger weight on fooling the detector i.e. getting less reconstruction distance. Hence, as expected the attack becomes less successful with larger values of $\sigma$ \ref{fig:stats_sigma} and gets lesser AUC values \ref{fig:roc_sigma}, hence more effectively fooling the detector. For CIFAR-10 dataset, the detection model does get fooled for higher $c$-values but however the error rate is significantly low for those values, implying that only a few samples get attacks on setting such value. \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/c-change.jpeg} \caption{MNIST dataset} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/sigma-change.jpeg} \caption{CIFAR-10 dataset} \end{subfigure} \caption{ROC Curves for different values of $\sigma$. More area under the curve implies better detectivity for that attack. With more $\sigma$ value, the attack, as the focus shifts to fooling the detector, it becomes difficult for the detector to detect.} \label{fig:roc_sigma} \end{center} \end{figure} \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/sigma-err_rate.png} \caption{MNIST dataset} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/sigma-err_rate.png} \caption{CIFAR-10 dataset} \end{subfigure} \caption{Success rate for different values of $\sigma$. More value of $\sigma$ means more focus on fooling the detector, hence success rate of fooling the detector decreases with increasing $\sigma$.} \label{fig:stats_sigma} \end{center} \end{figure} \subsubsection{Effect of $\epsilon$} With changing values of $\epsilon$, there is more space available for the attack to act, hence the attack becomes more successful as more no of images are attacked as observed in Figure \ref{fig:stats_eps}. At the same time, the trend for AUC curves is shown in Figure \ref{fig:roc_eps}. The initial dip in the value is as expected as the detector tends to be fooled with larger $\epsilon$ bound. From both these trends, it can be noted that for robustly attacking both the detector and target classifier for significantly higher no of images require significantly larger attack to be made for both the datasets. \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/eps-change.jpeg} \caption{MNIST dataset} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/eps-change.jpeg} \caption{CIFAR-10 dataset} \end{subfigure} \caption{ROC Curves for different values of $\epsilon$. With more $\epsilon$ value, due to more space available for the attack, attack becomes less detectable on average.} \label{fig:roc_eps} \end{center} \end{figure} \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{MNIST/eps-err_rate.png} \caption{MNIST dataset} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{CIFAR-10/eps-err_rate.png} \caption{CIFAR-10 dataset} \end{subfigure} \caption{Success rate for different values of $\epsilon$. More value of $\epsilon$ means more space available for the attack, hence success rate increases} \label{fig:stats_eps} \end{center} \end{figure} \section{Comparison with State-of-the-Art using Generative Networks} Finally we compare our work with these 3 works \cite{meng2017magnet} \cite{hwang2019puvae} \cite{samangouei2018defensegan} proposed earlier which uses Generative networks for detection and purification of adversaries. We make our comparison on MNIST dataset which is used commonly in the 3 works (Table \ref{tab:stat2}). Our results are typically the best for all attacks or are off by short margin from the best. For the strongest attack, our performance is much better. This show how our method is more effective while not being confused with random perturbation as an adversary. \begin{table}[h] {\sf \scriptsize \begin{center} \setlength\tabcolsep{2pt} \begin{tabular}{|c|c|c|c|c|c|c|} \hline {\bf Type} & \multicolumn{4}{c|}{\bf AUC} \\ \cline{2-5} & {\bf MagNet} & {\bf PuVAE} & {\bf DefenseGAN} & {\bf CVAE (Ours)} \\ \hline\hline RANDOM & 0.61 & 0.72 & 0.52 & \textbf{0.52} \\ \hline FGSM & 0.98 & 0.96 & 0.77 & \textbf{0.99} \\ \hline FGSM-L2 & 0.84 & 0.60 & 0.60 & \textbf{0.95}\\ \hline R-FGSM & \textbf{0.989} & 0.97 & 0.78 & 0.987\\ \hline R-FGSM-L2 & 0.86 & 0.61 & 0.62 & \textbf{0.95}\\ \hline PGD & \textbf{0.98} & 0.95 & 0.65 & 0.97\\ \hline CW & 0.983 & 0.92 & 0.94 & \textbf{0.986}\\ \hline DeepFool & 0.86 & 0.86 & 0.92 & \textbf{0.96} \\ \hline \textbf{Strongest} & 0.84 & 0.60 & 0.60 & \textbf{0.95}\\ \hline \end{tabular} \end{center} } \caption{Comparison in ROC AUC statistics with other methods. More AUC implies more detectablity. 0.5 value of AUC implies no detection. For RANDOM, value close to 0.5 is better while for adversaries, higher value is better.} \label{tab:stat2} \end{table} \subsection{Use of simple AutoEncoder (AE)} MagNet \cite{meng2017magnet} uses AutoEncoder (AE) for detecting adversaries. We compare the results with our proposed CVAE architecture on the same experiment setting and present the comparison in AUC values of the ROC curve observed for the 2 cases. Although the paper's claim is based on both detection as well as purification (if not detected) of the adversaries. MagNet uses their detection framework for detecting larger adversarial perturbations which cannot be purified. For smaller perturbations, MagNet proposes to purify the adversaries by a different AutoEncoder model. We make the relevant comparison only for the detection part with our proposed method. Using the same architecture as proposed, our results are better for the strongest attack while not getting confused with random perturbations of similar magnitude. ROC curves obtained for different adversaries for MagNet are given in Figure \ref{fig:ae} \begin{figure}[h] \begin{center} \includegraphics[width=.3\textwidth]{comp_ae.jpeg} \includegraphics[width=.3\textwidth]{comp_vae.jpeg} \includegraphics[width=.3\textwidth]{comp_gan.jpeg} \caption{ROC curve of different adversaries for MagNet (left), PuVAE (centre), DefenseGAN (right)} \label{fig:ae} \end{center} \end{figure} \subsection{Use of Variational AutoEncoder (VAE)} PuVAE \cite{hwang2019puvae} uses Variational AutoEncoder (VAE) for purifying adversaries. We compare the results with our proposed CVAE architecture on the same experiment setting. PuVAE however, does not propose using VAE for detection of adversaries but in case if their model is to be used for detection, it would be based on the reconstruction distance. So, we make the comparison with our proposed CVAE architecture. ROC curves for different adversaries are given in Figure \ref{fig:ae} \subsection{Use of Generative Adversarial Network (GAN)} Defense-GAN \cite{samangouei2018defensegan} uses Generative Adversarial Network (GAN) for detecting adversaries. We used $L=100$ and $R=10$ for getting the results as per our experiment setting. We compare the results with our proposed CVAE architecture on the same experiment setting and present the comparison in AUC values of the ROC curve observed for the 2 cases. Although the paper's main claim is about purification of the adversaries, we make the relevant comparison for the detection part with our proposed method. We used the same architecture as mentioned in \cite{samangouei2018defensegan} and got comparable results as per their claim for MNIST dataset on FGSM adversaries. As this method took a lot of time to run, we randomly chose 1000 samples out of 10000 test samples for evaluation due to time constraint. The detection performance for other attacks is considerably low. Also, Defense-GAN is quite slow as it needs to solve an optimization problem for each image to get its corresponding reconstructed image. Average computation time required by Defense-GAN is $2.8s$ per image while our method takes $0.17s$ per image with a batch size of $16$. Hence, our method is roughly 16 times faster than Defense-GAN. Refer to Figure \ref{fig:ae} for the ROC curves for Defense-GAN. \chapter{Use of Variational AutoEncoder (VAE) for Purification} \section{Introduction} After detecting adversaries next net logical thing to do is to purify the images before passing to the target classifier. The idea of purification is to neutralise or reduce the threat of any adversary attack if made on the image. There are various existing works doing this. MagNet .... PuVAE..... PixelDefend..... DefenseGAN....... We however propose use of Variational AutoEncoder similar to MagNet but however with a modified form similar to DefenseGAN and PixelDefend. \section{Training of Variational AutoEncoder (VAE)} The proposed Variational AutoEncoder is trained similar to MagNet on only clean images. The network architecture consists of an $Encoder$ and a $Decoder$. $Encoder$ outputs mean, $\mu$ and variance, $\sigma$ of size, latent dimension, $z$. A value is sampled from the obtained value of $z$ and is fed to the decoder to output a reconstructed image $X_{recon}$ os the same size as $X$. The training loss, $L$ is described as follows :- \begin{eqnarray} \label{kuch_bhi} L(X) = &BCE[X,Decoder(z)] - \\ & \frac{1}{2}[Encoder_{\sigma}^2(X)+Encoder_{\mu}^2(X)-1-log(Encoder_{\sigma}^2(X))] \end{eqnarray} \section{Purification of Input Images} For purification of an input image, unlike MagNet \cite{meng2017magnet} instead of directly taking the reconstructed image, $X_{recon}$ as the purified image to feed to the classifier, we propose solving the following objective to achieve the same where $X_{purified}$ is the resultant purified image :- \begin{equation} X_{purified} = \min\limits_{\epsilon} c.\left\Vert\epsilon\right\Vert_2^2 + \left\Vert X+\epsilon-recon(X+\epsilon)\right\Vert_2^2 \end{equation} \label{eqn_pur} where $c$ is a constant parameter chosen accordingly. We use ADAM optimizer with $n$ iterations for each image. \section{Results on MNIST and Comparison With Other Works on MNIST dataset} We present the comparison in results for MNIST dataset \cite{lecun2010mnist} with the 2 methods discussed earlier MagNet and DefenseGAN. Results for adversarial training are generated in the same way as described in MagNet \cite{meng2017magnet}. All results are with $\epsilon=0.1$. \begin{table}[h] {\sf \scriptsize \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline {\bf Attack} & {\bf No defense} & {\bf Adversarial training} & {\bf DefenseGAN} & {\bf MagNet} & {\bf Ours} \\ \hline Clean & 0.974 & 0.822 & 0.909 & 0.95 & \bf{0.97} \\ \hline FGSM & 0.269 & 0.651 & 0.875 & 0.63 & \bf{0.887} \\ \hline R-FGSM & 0.269 & 0.651 & 0.875 & 0.63 & \bf{0.887} \\ \hline PGD & 0.1294 & 0.354 & 0.83 & 0.65 & \bf{0.886} \\ \hline CW & 0.1508 & 0.28 & 0.656 & 0.85 & \bf{0.907} \\ \hline \end{tabular} \end{center} } \caption{Comparison in results. Values reported are classifier success rate (in fraction out of 1)} \label{tab:comp_res} \end{table} \section{Variations for CIFAR-10 Dataset} MNIST dataset is a simple dataset with easily identifiable number shapes which can be easily and robustly learned by a neural network. It is therefore very easy to correct a perturbed image with a simple back-propagation method with fixed no of iterations. For CIFAR-10 dataset however, due to the inherent complexity in classifying objects, it is very easy to attack and thus simple defenses with fixed no of iterations is not enough to give a reasonably good purification result on attacks. \subsection{Fixed no of iterations} First, we evaluate the results with fixed no of iterations. The results are listed on Table \ref{tab:comp_cifar}. As can be observed with more no of iterations clean accuracy gets reduced and adversarial accuracy improves. The drawback with such method is that it is not essentially using any discrimination for the update rule for adversarial and non adversarial examples. As a result of this, reconstruction errors of both adversarial and clean images (see Figure \ref{fig:recons_errors_A}) are reduced leading to disappearance of important features. Formally, the purified example, $X_{pur}$ can be expressed as follows where $X_{adv}$ is the adversarial image, $n$ is the fixed no of iterations, $\alpha$ is the constant learning rate and $purifier$ is the Purifier autoencoder function. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha \frac{\partial L(X_{pur,i},purifier(X_{pur,i}))}{\partial X_{pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } L(X,Y) = (X-Y)^2 \\ \end{split} \label{Eqn:fix_iter_basic} \end{equation} \subsection{Fixed no of iterations with using ADAM optimizer for update} Major drawback with using constant learning rate is that both clean and adversarial examples are updated for fixed no of pixels in the image space meaning the distance between input and purified image is same irrespective if the input is adversarial or not. To counter it, we use ADAM optimizer to achieve the minima quickly. with same no of iterations. In this case, the update amount varies for adversarial and clean image as clean image has less reconstruction error (see Figure \ref{fig:recons_errors_B}). Formally, the update is defined as follows where $X_{adv}$ is the adversarial image, $X_{pur}$ is the purified image, $n$ is the no of iterations, $\alpha$ and $\beta$ are parameters for ADAM optimizer. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha w_i\\ &\text{Where } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{pur,i}))}{\partial X_{pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } L(X,Y) = (X-Y)^2 \\ \end{split} \label{Eqn:fix_iter_adam} \end{equation} \subsection{Variable learning rate based on the current reconstruction error} Usually for adversarial images, the initial reconstruction error is high as compared to clean image. Based on the following, an advantage can be taken to purify mostly only the adversarial images and not the clean images. No of iterations can be varied based on the reconstruction error of the input sample. First, the mean value, $\mu$ and variance, $\sigma$ of the distribution of reconstruction errors for the clean validation samples are determined. Then, the probability of falling within the equivalent gaussian distribution of reconstruction distances of clean validation samples is determined. The learning rate is varied accordingly linear to this probability. Formally, update rule can be defined as follows where $X_{adv}$ is the adversarial image, $X_{pur}$ is the purified image, $n$ is the no of iterations, $\alpha$ and $\beta$ are parameters for ADAM optimizer. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha_i w_i \\ &\text{Where } \alpha_i = \alpha (1 - \exp^{-(\frac{X_{pur,i}-\mu}{\sigma})^2}) \\ &\text{And } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{pur,i}))}{\partial X_{pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } L(X,Y) = (X-Y)^2 \\ \end{split} \label{Eqn:fix_iter_adam_variable_lr} \end{equation} \subsection{Set target distribution for reconstruction error} Major drawback with earlier variations is that even though they discriminate in purifying already clean and adversarial images, they still try to purify clean images by bringing down the reconstruction error. One drawback to this is on doing so, the important features of the image are lost as the purification model sees them as perturbations to the images giving rise to the reconstruction error. Back-propagating through them smoothens them leading to less reconstruction error but confuses the classifier leading to wrong predictions. To avoid this, we first find the mean, $\mu$ and variance, $\sigma$ of the clean image validation set. The objective for the update rule is kept to increase the probability mass function value with respect to the target distribution. Formally, the update rule is defined as follows :- \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha w_i\\ &\text{Where } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{pur,i}))}{\partial X_{pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } L(X,Y) = \frac{|dist(X,Y)-mu|}{\sigma} \\ &\text{Where } dist(X,Y) = (X-Y)^2 \end{split} \label{Eqn:fix_iter_target} \end{equation} \subsection{Set target distribution for reconstruction error with modified update rule} Drawback of the above method is that it tries to increase the reconstruction error (see Figure \ref{fig:recons_errors_C}) of the samples with less reconstruction error belonging to clean image set. Due to this, classification model gives less accuracy. To avoid this, we change the update rule as follows which ultimately leads to no change for clean images with reconstruction error less than $\mu$ (see Figure \ref{fig:recons_errors_C}). \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha w_i\\ &\text{Where } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{pur,i}))}{\partial X_{pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } L(X,Y) = \frac{max(dist(X,Y)-mu,0)}{\sigma} \\ &\text{Where } dist(X,Y) = (X-Y)^2 \end{split} \label{Eqn:fix_iter_target_modified} \end{equation} \subsection{Add random noise at each update step} Just adding random noise has been observed to improve the classification accuracy for adversarial examples as it changes the overall perturbation to near random breaking the targeted perturbation created by the adversarial attack to the corresponding clean sample. This technique can be used in conjunction to our method where random perturbation is added at each update step. This leads to slightly better results as observed in Table \ref{tab:comp_cifar}. Formally the update rule is defined as follows where $\gamma$ is the amount of noise to be added at each update step. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha w_i\\ &\text{Where } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{noise,pur,i}))}{\partial X_{noise,pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } X_{noise,pur,i} = X_{pur,i} + \gamma r_X, r_X ~ \mathcal{N}(0,I_X) \\ &\text{Where } L(X,Y) = \frac{max(dist(X,Y)-mu,0)}{\sigma} \\ &\text{Where } dist(X,Y) = (X-Y)^2 \end{split} \label{Eqn:fix_iter_target_random} \end{equation} \subsection{Add random transformation at each update step} Adding random rotate and resize transformations to the input image has also been observed to improve the classification accuracy for adversarial examples \cite{8954476}. This technique can be used in conjunction to our method where random transformation is added at each update step. This leads to slightly better results as observed in Table \ref{tab:comp_cifar}. Formally the update rule is defined as follows where $t$ is the transformation function taking the resize factor $f$ and rotation $\theta$ as input. \begin{figure}[h] \begin{center} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{Images/recon_error_figA.png} \caption{Fixed no of iterations} \label{fig:recons_errors_A} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{Images/recon_error_figB.png} \caption{Fixed no of iterations with using ADAM optimizer for update} \label{fig:recons_errors_B} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{Images/recon_error_figC.png} \caption{Set target distribution for reconstruction error} \label{fig:recons_errors_C} \end{subfigure} \begin{subfigure}{.4\textwidth} \centering \includegraphics[width=\textwidth]{Images/recon_error_figD.png} \caption{Set target distribution for reconstruction error with modified update rule} \label{fig:recons_errors_D} \end{subfigure} \caption{Reconstruction errors change for different variations} \label{fig:recon_errors_mnist} \end{center} \end{figure} \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha w_i\\ &\text{Where } w_i = \beta w_{i-1} + (1-\beta) \frac{\partial L(X_{pur,i},purifier(X_{trans,pur,i}))}{\partial X_{trans,pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } X_{trans,pur,i} = t(X_{pur,i},f,\theta) \\ &\text{Where } L(X,Y) = \frac{max(dist(X,Y)-mu,0)}{\sigma} \\ &\text{Where } dist(X,Y) = (X-Y)^2 \end{split} \label{Eqn:fix_iter_target_trans} \end{equation} \begin{table}[h] {\sf \scriptsize \begin{center} \begin{tabular}{|m{1.1cm}|m{0.9cm}|m{1.5cm}|m{1cm}|m{0.75cm}|m{0.75cm}|m{0.75cm}|m{0.5cm}|m{0.5cm}|m{0.6cm}|m{0.6cm}|m{0.5cm}|m{0.5cm}|m{1cm}|} \hline {\bf Attack} & {\bf No defense} & {\bf Adversarial training} & {\bf MagNet} & {\bf A ($n$=12)} & {\bf A ($n$=15)} & {\bf A ($n$=18)} & {\bf B} & {\bf C} & {\bf D} & {\bf E} & {\bf F} & {\bf G} & {\bf H (Ours)} \\ \hline Clean & 0.954 & 0.871 & 0.790 & 0.879 & 0.853 & 0.843 & 0.872 & 0.892 & \bf{0.924} & 0.907 & 0.908 & 0.858 & 0.905\\ \hline Random & 0.86 & - & 0.793 & 0.889 & 0.875 & 0.867 & 0.883 & 0.874 & \bf{0.90} & 0.873 & 0.893 & 0.846 & 0.889\\ \hline FGSM & 0.533 & 0.650 & 0.661 & 0.73 & 0.76 & 0.774 & 0.778 & 0.769 & 0.783 & \bf{0.834} & 0.818 & 0.828 & 0.825\\ \hline R-FGSM & 0.528 & 0.640 & 0.655 & 0.73 & 0.747 & 0.764 & 0.772 & 0.762 & 0.767 & \bf{0.817} & 0.811 & 0.814 & 0.815\\ \hline BIM & 0.002 & 0.483 & 0.367 & 0.632 & 0.694 & 0.702 & 0.706 & 0.692 & 0.684 & 0.702 & 0.729 & 0.711 & \bf{0.735}\\ \hline \end{tabular} \end{center} } \caption{Comparison of results for different variations on Cifar-10 dataset. A : Fixed no of iterations, B : Fixed no of iterations with using ADAM optimizer for update, C : Variable learning rate based on the current reconstruction error, D : Set target distribution for reconstruction error, E : Set target distribution for reconstruction error with modified update rule, F : Add random noise at each update step, G : Add random transformation at each update step, H : Add random noise + transformation at each update step} \label{tab:comp_cifar} \end{table} \section{Variations for ImageNet Dataset} ImageNet dataset is the high resolution dataset with cropped RGB images of size 256X256. For our experiments we use pretrained weights on ImageNet train corpus available from \cite{5206848}. For test set we use the 1000 set of images available for ILSVRC-12 challenge \cite{Russakovsky2015ImageNetLS} which is commonly used by many works \cite{xu2017feature} for evaluating adversarial attack and defense methods. This test set consists of 1000 images each belonging to a different class. The pre-trained weights of ResNet-18 classifier are also provided by ILSVRC-12 challenge \cite{Russakovsky2015ImageNetLS}. The 1000 images are chosen such that the classifier gives correct class for all of them. \subsection{Attack method} The attack method for ImageNet dataset is different as the classification accuracy for ImageNet dataset comprising of 1000 classes is defined by the top-1 accuracy which means a prediction is correct if any of the top 1\% of total classes or 10 class predictions in this case are correct. Hence, the iterative attack (which is used as baseline by all methods) is defined mathematically as follows where $J(.)$ is the cross entropy loss, $classifier(.)$ is the target classifier neural network, $\alpha$ is the step size and $\pi_{X,\epsilon}(.)$ function restricts value within $[X-\epsilon,X+\epsilon]$. \begin{equation} \begin{split} &X_{attacked,0} = X_{cln} \\ &X_{attacked,i+1} = \pi_\epsilon[X_{attacked,i} + \alpha \frac{\partial J(classifier(X_{attacked,i}),y)}{\partial X_{attacked,i}}] \text{ for } i \in \{1,2...,n\}\\ \end{split} \label{Eqn:imagenet_attack} \end{equation} \subsection{Noise remover network} We use autoencoder with skip connections and blind spot architecture for noise removal \cite{Laine2019HighQualitySD}. The network is trained as self-supervised task in N2V manner with the task of outputting a clean image given a noisy image. For additional details regarding the training settings for unknown noise form and magnitude, readers are referred to \cite{Laine2019HighQualitySD}. \subsection{No of iterations} Effect of varying the no of iterations of update for purifying adversarial examples can be seen in Table \ref{tab:comp_imagenet}. As can be observed, increasing no of iterations lead to better classification accuracy for purified adversaries but leads to drop in clean accuracy. Results for adversaries created with different no of iterations are also reported. The value of $\epsilon=\frac{8}{255}$ and update step, $\alpha=\frac{1}{255}$ are chosen as standard values for comparison with \cite{xu2017feature}. \subsection{Purification variations} We further explore different variations to the base version with fixed no of iterations and constant update rate $\alpha$. \subsubsection{Random noise at each step} Similar to Cifar-10 dataset, adding random noise to input leads to increase in classification accuracy. Hence, we conjunct this by adding random noise at each update step. As evident from Table \ref{tab:comp_imagenet}, there is a slight surge in classification of purified adversaries with this addition. Mathematically, update rule is defined as follows where $\gamma$ is the amount of noise to be added at each update step. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha \frac{\partial L(X_{pur,i},purifier(X_{noise,pur,i}))}{\partial X_{noise,pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } X_{noise,pur,i} = X_{pur,i} + \gamma r_X, r_X ~ \mathcal{N}(0,I_X) \\ &\text{Where } L(X,Y) = (X-Y)^2 \end{split} \label{Eqn:imagenet_random} \end{equation} \subsubsection{Random transformation at each step} Similar to Cifar-10 dataset, we add random rotate and resize transformation before each update step. This too results in a subsequent increase in classification accuracy of purified adversaries as observed in Table \ref{tab:comp_imagenet}. The reason for the rise in accuracy is that the transformation leads to change in the locality of the features where targeted attack was made. The classification network however has been trained to act robustly if the image is resized or rotated, hence the classified class for clean images doesn't change, while for attacked images due to relocation of targeted perturbations, the resultant perturbation tends towards non-targeted random noise leading to increased accuracy. Mathematically, update rule can be expressed as follows where $t$ is the transformation function taking the resize factor $f$ and rotation $\theta$ as input. \begin{equation} \begin{split} &X_{pur,0} = X_{adv} \\ &X_{pur,i+1} = X_{pur,i} - \alpha \frac{\partial L(X_{pur,i},purifier(X_{trans,pur,i}))}{\partial X_{trans,pur,i}} \text{ for } i \in \{1,2...,n\}\\ &\text{Where } X_{trans,pur,i} = t(X_{pur,i},f,\theta) \\ &\text{Where } L(X,Y) = (X-Y)^2 \end{split} \label{Eqn:imagenet_trans} \end{equation} \begin{table}[h] {\sf \scriptsize \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|} \hline {\bf Attack} & {\bf No defense} & {\bf Adversarial training} & {\bf MagNet} & {\bf A} & {\bf B} & {\bf C} \\ \hline Clean & 1.0 & 0.912 & \bf{0.916} & 0.902 & 0.895 & 0.892 \\ \hline Random & 0.969 & 0.901 & \bf{0.911} & 0.907 & 0.887 & 0.884 \\ \hline BIM ($\epsilon=\frac{10}{255}$) & 0.361 & 0.441 & 0.539 & 0.670 & 0.705 & \bf{0.726} \\ \hline BIM ($\epsilon=\frac{25}{255}$) & 0.002 & 0.254 & 0.312 & 0.580 & 0.665 & \bf{0.681}\\ \hline \end{tabular} \end{center} } \caption{Comparison of results for different variations on Imagenet dataset. A : Ours, B : Ours (With random noise), C : Ours (With random transformations)} \label{tab:comp_imagenet} \end{table} \section{Possible Counter Attacks} Based on the attack method, adaptive attacks can be developed to counter the attack. We study the 2 types of attacks in detail. For a detailed review on how to systematically determine an adaptive attack based on the category of defense, readers are referred to \cite{Laine2019HighQualitySD}. \subsection{Counter attack A} The first adaptive attack possible is designed by approximating the transformation function i.e. the function of the output image obtained by modifying the input image through the update rule by the differentiable function obtained by autoencoder end-to-end output given the input. Intuitively this can be thought of as the near output obtained by backpropagating through the reconstruction error loss between the input and end-to-end purified output after passing through autoencoder purifier network. We observe (see Table \ref{tab:comp_counter}) that on applying this counter attack, the accuracy for direct purifier output method drops drastically while ours method gives better robust results against this attack. Mathematically, we can express the attacked image, $X_{attacked}$ as follows where $X_{cln}$ is the original clean image, $n$ is the no of iterations, $classifier(.)$ is the target classifier network, $J(.)$ is the cross entropy loss, $purifier(.)$ is the purifier autoencoder, $\alpha$ is the update rate and $\pi_{X,\epsilon}(.)$ function restricts value within $[X-\epsilon,X+\epsilon]$. \begin{equation} \begin{split} &X_{attacked,0} = X_{cln} \\ &X_{attacked,i+1} = \pi_{X_{cln},\epsilon}[X_{attacked,i} + \alpha sign(\frac{\partial J(classifier(X_{attacked,i}),y)}{\partial X_{attacked,i}})] \\ &\text{ for } i \in \{1,2...,n\} \end{split} \label{Eqn:counter_attack_A} \end{equation} \subsection{Counter attack B} The second adaptive attack possible here is by modifying the loss function of the BIM attack by including new weighted term getting less reconstruction error from the purifier This way we attack both the classifier as well as purifier. The purifier method relies on reconstruction error as a measure to update the input to get less reconstruction error similar to clean images but if the attack is made with this consideration to fool the purifier method by giving similar reconstruction error to clean image while also fooling the classifier, the attack is successful as it bypasses the purifier method. For this attack, the attacked image seems to be attacked more at the edges as modifying those do not change the reconstruction error for purifier much. As observed from Table \ref{tab:comp_counter}, the adaptive counter attack is successful to an extent but needs a larger value of $\epsilon$ to make the attack have a considerably successful attack rate. Mathematically this attack is defined as follows where Mathematically, we can express the attacked image, $X_{attacked}$ as follows where $X_{cln}$ is the original clean image, $n$ is the no of iterations, $classifier(.)$ is the target classifier network, $J(.)$ is the cross entropy loss, $purifier(.)$ is the purifier autoencoder, $\alpha$ is the update rate, $\beta$ is the weighing factor for the reconstruction error in the combined loss function, and $\pi_{X,\epsilon}(.)$ function restricts value within $[X-\epsilon,X+\epsilon]$. \begin{equation} \begin{split} &X_{attacked,0} = X_{cln} \\ &X_{attacked,i+1} = \pi_{X_{cln},\epsilon}[X_{attacked,i} + \alpha sign(\frac{\partial J(X_{attacked,i},y) + \beta (X_{attacked,i} - purifier(X_{attacked,i}))^2}{\partial X_{attacked,i}})] \\ &\text{ for } i \in \{1,2...,n\} \end{split} \label{Eqn:counter_attack_B} \end{equation} \begin{table}[h] {\sf \scriptsize \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline {\bf Attack} & {\bf No defense} & {\bf Adversarial training} & {\bf MagNet} & {\bf Ours} \\ \hline Counter attack A & 0.004 & 0.122 & 0.199 & \bf{0.680} \\ \hline Counter attack B & 0.009 & 0.151 & 0.275 & \bf{0.507} \\ \hline \end{tabular} \end{center} } \caption{Comparison of results for counter attacks} \label{tab:comp_counter} \end{table} \chapter*{Abstract} \hspace{10mm}blah blah blah! \chapter*{Acknowledgement} \hspace{10mm}blah blah blah!
\section{Introduction} The Neyman-Scott point process \citep{NeymanScott1958} is a cluster point process model widely used in biology, astronomy, forestry, medicine, etc. Its main advantages are the straightforward interpretation of the model parameters and the closed form of moment properties, at least for the stationary version of the model. The model can be constructed in two stages and it is often called a doubly stochastic process: first, cluster centers are randomly sampled from a given Poisson point process; second, conditionally on the positions of cluster centers, random number of offspring points are randomly and independently placed around each cluster center. Thus, the stationary Neyman-Scott point process model is specified by the intensity of the Poisson process of cluster centers, the distribution of the number of points per cluster (hereafter called cluster size), and the distribution of the relative displacement of the offspring points around their respective cluster centers (hereafter called cluster spread). In the most popular type of Neyman-Scott point process, called the (modified) Thomas process \citep{Thomas1949}, the cluster size is assumed to follow a Poisson distribution and the cluster spread is governed by a radially symmetric Gaussian distribution. The stationary Thomas process is then described by the following parameters: the intensity $\kappa$ of the process of cluster centers, the mean number of points in a cluster $\alpha$ and the standard deviation $\omega$ of the Gaussian distribution determining cluster spread. A natural way of introducing inhomogeneity into the Neyman-Scott process model is allowing some of the model components (intensity of cluster centers $\kappa$, cluster size $\alpha$, cluster spread $\omega$) depend on a set of spatial covariates. Their significance then needs to be assessed. Several models of this type have been studied in the literature, as discussed in the following paragraphs. The Neyman-Scott point process with inhomogeneous cluster centers, with the distribution of the clusters being the same in terms of size and spread, allows for varying the number of clusters in the space. The inference for this process was investigated in \citet{MMK2014} and it was found that the Bayesian MCMC estimation procedure is more precise than composite likelihood or minimum contrast method. This model is not second-order inhomogeneity reweighted stationary (SOIRS) \citep{BMW2000}, but if instead the mean number of points in a cluster $\alpha$ is inhomogeneous, the resulting process is very close to SOIRS. The inference for SOIRS Neyman-Scott process (stationary Neyman-Scott point process thinned by a spatially varying function) can be performed by a two step method based on minimum contrast or composite likelihood \citep{WG2009}, as implemented in the R package \CRANpkg{spatstat} \citep{spatstat}. The inhomogeneity can be also introduced in the cluster spread $\omega$, then the process will be locally-scaled Neyman-Scott point process \citep{HJLN2003}. It is also possible to introduce inhomogeneity simultaneously in $\alpha$ and $\omega$, then the process can be called a Neyman-Scott point process with growing clusters \citep{M2014}. For the models with homogeneous population of cluster centers but inhomogeneity in the cluster properties we talk about cluster inhomogeneity. On the other hand, for the Neyman-Scott point process with inhomogeneous cluster centers we talk about inhomogeneity of centers. Combining the cluster inhomogeneity and inhomogeneity of centers leads to the notion of doubly inhomogeneous Neyman-Scott point process. The Bayesian MCMC inference for such a process was studied in \cite{MS2017}. Other kinds of inference were found to be useless for such complex model. Therefore, we build up the R package \pkg{binspp} which contains the Bayesian MCMC estimation procedure for the most general model with inhomogeneity in all three model components. This model contains all the previous models as special cases, including the stationary one. The radially symmetric Gaussian distribution is assumed to determine the cluster spread, which does not limit practical applicability of the models. We do not include SOIRS Neyman-Scott point process due to the different construction of the model and also due to availability of moment-based estimation methods. However, practically speaking the Neyman-Scott point process with inhomogeneous cluster size $\alpha$ can be used as an approximation to the SOIRS Neyman-Scott point process model. The most important statistical problem here is to assess the dependence of the data on the given set of covariates. Our package handles the spatial covariates influencing any or all of the model components: the intensity of the cluster centers $\kappa$, the cluster size $\alpha$ and the cluster spread $\omega$. The Bayesian MCMC procedure is time consuming, but its great benefit is that the significance of all covariates is provided from the estimated posterior distributions in a natural way. For example, in case of the inhomogeneity of cluster centers if a faster estimation method is used, it is necessary to perform parametric bootstrap in order to obtain the significance of the covariates. This is as much time consuming as the Bayesian MCMC procedure \citep{MMK2014}. Only in the case of SOIRS Neyman-Scott processes it is possible to use the fast estimation method and the significance of covariates can be assessed using the asymptotic normality result obtained in \citet{WG2009}. As mentioned above, the minimum contrast approach and the composite likelihood approach are available for SOIRS Neyman-Scott point process. They are also described in \citet{MMK2014} for the Neyman-Scott point process with inhomogeneous cluster centers. To the our best knowledge, they are not available for the other kinds of inhomogeneity discussed above. In order to model inhomogeneous clustered point patterns log-Gauussian Cox process (LGCP) models are often used \citep{MSW1998}. The inference for SOIRS LGCP is well developed with integrated nested Laplace approximation (INLA) \citep{RMCh2009} available through the package \CRANpkg{inlabru} \citep{inlabru}, with Bayesian MCMC inference available through the package \CRANpkg{lgcp} \citep{lgcp} or with the moment methods available through the package \pkg{spatstat}. Nevertheless, none of these packages allows for inference for LGCP with more complex types of inhomogeneity. An attempt in this direction has been made in \cite{Dvoraketal2019}. With these considerations in mind, we have implemented the core functions of the \pkg{binspp} package using \pkg{Rcpp} to speed-up the computation. As a result, short runs of the chain, useful for tuning up the hyperparameters of the prior distributions, are finished within minutes on a regular laptop. Long runs, used for the actual estimation, may be finished within a few hours, see the detailed example in Section~\ref{subsec:complex_example}. This makes our implementation easily applicable in practice, without the need to worry about the computational demands. The inference for Neyman-Scott point processes is usually performed with the assumption of Poisson distribution of of the number of points in a cluster. The same is assumed in all models discussed above, but the \pkg{binspp} package contains also the Bayesian MCMC estimation procedure for homogeneous generalised Neyman-Scott process. The method was described in \cite{AM2020}. This model uses the generalised Poisson distribution (GPD) as a distribution of the number of points in a cluster. The GPD allows for modelling of under- or over-dispersion. This allows for more flexible modelling of the distribution of the number of points in a cluster. The package specifically considers the following models. The inhomogeneous Thomas point process allowing for modelling of cluster centers, cluster spread and cluster sizes through covariates. The covariates are incorporated in every model component via exponential model. Such a general process was not presented in the literature, even \cite{MS2017} presents only a special case of this general model. Furthermore, the generalised Neyman-Scott point process which allows for modelling underdispersed or overdispersed cluster sizes is considered. This paper is organized as follows. First, in Section~\ref{models} we describe the models considered here. Then we briefly describe the algorithms in Section~\ref{MCMC}. In Section~\ref{examples} we show the use of our package for different types of models, with a detailed example in Section~\ref{subsec:complex_example} considering a real dataset of infected oak trees. This is a part of a larger dataset studied in \citet{FFCGA2019}. The model for the observed point pattern includes inhomogeneity in all three components of the model and for illustration we provide the outputs of a long run of the MCMC chain. We also show in Section~\ref{subsec:generalised} the use of the estimation procedure for homogeneous generalised Neyman-Scott point process and the possibility of detecting over- or under-dispersion of cluster sizes. Section~\ref{sec:discussion} is left for discussion. \section{Models} \label{models} Let us first describe the model in its full generality, i.e. the doubly inhomogeneous Neyman-Scott point process. The process of cluster centers $C$ follows an inhomogeneous Poisson point process with intensity function $\kappa f (\beta, u), \ u\in \mathbb{R}^2$, where $\kappa > 0$ and $\beta \in \mathbb{R}^k$ are parameters. The clusters $X_c, c \in C$, are independently attached to every cluster center $c$. The Neyman-Scott point process is the superposition of the clusters $X=\cup_{c\in C} X_c$, where $X_c$ are independent Poisson point processes with intensity function $\alpha (\mu,c)k(u-c, \omega (\nu,c)), u \in \mathbb{R}^2$, which depends on $c$. Here $\alpha(\mu, c)$ is the expected number of offspring points in the cluster corresponding to the parent point $c$ and $\mu \in \mathbb{R}^{l+1}$ is a parameter. Furthermore, $k(u, \omega(\nu, c))$ is the probability density function governing the relative displacement of the offspring points around the parent point $c$ (in this paper we assume $k$ is the density of the centered radially symmetric normal distribution with the standard deviation $\omega(\nu, c$)). The distribution of the number of points in the cluster with the cluster center $c$ is assumed to be Poisson for all inhomogeneous models, with the probabilities being denoted $p(n, \alpha(\mu, c))$. The parametric functions $f$, $\alpha$ and $\omega$ are the key ingredients of the model which describe the dependence on the spatial covariates. These functions are assumed to take the following parametric form: \begin{align*} f(\beta,u) & = \exp(\beta_1 z_1(u)+\ldots + \beta_k z_k(u)), \\ \alpha(\mu,c) & = \exp(\beta^\alpha_0+\beta^\alpha_1 z^\alpha_1(c)+\ldots + \beta^\alpha_l z^\alpha_l(c)), \\ \omega(\nu,c) & = \exp(\beta^\omega_0+\beta^\omega_1 z^\omega_1(c)+\ldots + \beta^\omega_m z^\omega_m(c)). \end{align*} Here $z_1, \ldots , z_k$ are the spatial covariates influencing the population of cluster centers, $z_1^\alpha, \ldots , z_l^\alpha$ are the spatial covariates influencing the cluster size and $z_1^\omega, \ldots , z_m^\omega$ are the spatial covariates influencing the cluster spread. All the $\beta$s are real-valued regression parameters. Note that the model for $f$ does not contain the intercept since its role is taken by the parameter $\kappa$. We use this parametrization to be consistent with the earlier works describing the models and the corresponding Bayesian inference \citep{M2014,KM2016,MS2017}. Specific choices of $k,l,m$ result in different special cases of the general model. For $k = 0, l = 0, m = 0$ the process is the stationary Neyman-Scott process. For $k > 0, l = 0, m = 0$ we obtain the inhomogeneous cluster centers. Similarly, $k = 0, l > 0, m = 0 $ results in inhomogeneous cluster sizes, while $k = 0, l = 0, m > 0$ leads to locally scaled process (inhomogeneous cluster spread). For $k = 0, l > 0, m > 0$ we obtain the process with growing clusters \citep{M2014} and finally for $k > 0, l > 0, m > 0$ we obtain the most general, doubly inhomogeneous process \citep{MS2017}. Our package allows for all the possible choices of $k, l, m$. However, the user must be aware of the possible identifiability issues which occur if the same covariate is used for $z_i$ and $z_j^\alpha$ for some $i$ and $j$, i.e. if the same covariate influences both $f$ and $\alpha$. It is a property of the two-step estimation algorithm described in the next section that the parameters $\beta_i$ and $\beta_j^\alpha$ cannot be estimated correctly in this case. For example, if $\beta_i = 0$ and $\beta_j^\alpha \neq 0$ then the first step of the algorithm will estimate $\hat\beta_i$ to be approximately $\beta_j^\alpha$. Our \pkg{binspp} package allows also for the estimation of the homogeneous generalised Neyman-Scott point process, where the distribution of the cluster sizes follows the generalised Poisson distribution, which is a popular model for count data \citep{WF1997}. The probability mass function of GPD is \begin{align*} p(n|\lambda, \theta) = \left\{\begin{array}{l} \frac{1}{n!}\theta(\theta + \lambda n)^{n-1}e^{-\theta-\lambda n}, \quad n = 0, 1, 2, \ldots, \\ 0, \quad \quad \text{if } n > m \text{ when } \lambda <0, \end{array} \right. \end{align*} with the expectation $\alpha = \frac{\theta}{1-\lambda}, \label{eq:E} $ and variance $\frac{\theta}{(1-\lambda)^3}. \label{eq:V}$ The parameter $\lambda \in [-1,1]$ in GPD models the over- or under-dispersion, $\lambda=0$ corresponds to the Poisson case, $\lambda>0$ to the over-dispersed and $\lambda<0$ to the under-dispersed case. \section{Inference} \label{MCMC} The inference for the doubly inhomogeneous Neyman-Scott point process is performed in two steps, similar to the approach of \cite{WG2009}. In the first step the parameters $\overline{\beta}=(\log (\lambda) ,\beta_1, \ldots, \beta_k)$ of the intensity function are estimated, based on the assumption that $X$ is the Poisson process with the intensity function \begin{align} \label{aprox} \overline{f}_{\overline{\beta}} (u) = \exp (\overline z(u) \overline \beta^T), \ u \in \mathbb R^2, \end{align} where $\overline z(u) = (1, z_1(u), \ldots , z_k(u))$. This assumption is intuitively justified if the range of interaction among the points is small compared to the range of changes in the spatial covariates and if $z_i$ is different form $z_j^\alpha$ for all combinations of $i$ and $j$. Specifically, we maximize the log-likelihood of the assumed inhomogeneous Poisson process: \begin{align} l(\overline{\beta})=\sum_{x\in X \cap W} \overline z(x)\overline{\beta}^T - \int_W \exp (\overline z(u)\overline{\beta}^T) \, \mathrm{d}u \end{align} Here $W$ is the observation window. The second step consists of estimation of the interaction parameters $\mu$ and $\nu$, conditionally on the estimate of $\overline{\beta}$. Bayesian estimation for the homogeneous Neyman-Scott point processes was carried out with an MCMC algorithm e.g. in \cite{GT2012, MW2007, M2014, KM2016}. In this approach, the cluster centers and the model parameters are updated in each step of the MCMC algorithm. After reaching the equilibrium, posterior distributions of the parameters can be estimated. The cluster centers are generally viewed as nuisance parameters. Considering the inhomogeneous clusters, the MCMC algorithm proceeds in the same way as in the homogeneous case, except that the likelihood is influenced by the parameters connected with the cluster inhomogeneity. We remark here that the estimation algorithm was not presented in such generality earlier, even \cite{MS2017} considered only a special case of this model, without allowing for the general form with covariates. However, the generalisation is straightforward. Let $C$ denotes the inhomogeneous Poisson point process of cluster centers with the intensity $\kappa f(\beta, u)$. Let $p(C|\kappa, \beta)$ denote the Poisson probability density function of the point process $C$, conditionally on $\kappa$ and $\beta$, with respect to the unit-rate homogeneous Poisson point process. Furthermore, let $p(X|C, \beta, \kappa, \mu, \nu)$ denote the Poisson probability density function of the point process $X$ under the knowledge of $C$, $\beta$, $\kappa$, $\mu$ and $\nu$. The joint posterior distribution of the process $C$ and the parameters is then \begin{align} p(C, \kappa, \mu, \nu |X) \propto p(X|C, \beta, \kappa, \mu, \nu) p(C|\kappa, \beta) p(\mu) p(\nu), \end{align} where $p(\mu)$ and $p(\nu)$ denote the prior probability density functions for the respective parameters. No prior for $\kappa$ is required because it is, in our estimation procedure including a modification similar to the one proposed by \citet{KM2016}, a deterministic function of $\mu$ and $\beta$. Indeed, the expected number $\mathbb E M$ of the observed points in the observation window $W$ is equal to \begin{align*} \kappa \int_W \alpha(\mu, u) [\int_{\mathbb R^2} k(u-c,\omega (\nu, c))f(\beta, c) \, \mathrm{d}c ] \, \mathrm{d}u, \end{align*} which can be approximated by \begin{align*} \mathbb E M \approx \kappa \int_W \alpha(\mu, u))f(\beta, u) \, \mathrm{d}u. \end{align*} Thus, in each iteration of the MCMC algorithm, $\kappa$ can be re-computed when $\mu$ is updated. Our MCMC algorithm consists of updating the process of cluster centers $C$ and updating the parameters $\mu$ and $\nu$. For updating $C$ we use the birth-death-move algorithm described in \citet{MollerWaagepetersen2004}. For updating $\mu$ and $\nu$ we use the Metropolis-Hastings algorithm. In order to obtain better mixing properties $\mu$ and $\nu$ is updated separately. Full details about this algorithm can be found in \cite{MS2017}. The inference for the interaction parameters $\mu$ and $\nu$ is performed from the estimated posterior distributions which are obtained from the MCMC samples after appropriate burn-in. The inference about the first-order inhomogeneity parameters $\beta$ cannot be obtained from the first step where the Poisson distribution is assumed. Therefore, we base the inference about $\beta$ on the posterior distribution of the cluster centers obtained in the second step. In every step the significance of $z_1, \ldots, z_k$ with respect to the process of cluster centers $C$ is assessed using the Poisson distribution of $C$ assumed in this model. The median of respective $p$-values computed from the posterior distribution is taken to be the estimate of the $p$-value of the test of significance of the given covariate. We remark that it is also possible to perform the full Bayesian estimation by considering the inhomogeneity of cluster centers in the MCMC procedure. However, this approach was found to be less efficient than the two-step approach due to identifiability issues in the full likelihood. Considering the generalised Neyman-Scott process, the MCMC algorithm consists of one extra step in addition to the traditional Metropolis-Hastings update of the model parameters and the birth-death-move update of the cluster centers. It is the update of the connections between the points and the cluster centers, since by assuming the non-Poisson distribution these connections take part in the likelihood of the process. Full details about this algorithm can be found in \cite{AM2020}. \section{Examples} \label{examples} In this section we provide a set of examples illustrating how different types of models can be fitted using the Bayesian MCMC approach implemented in the \pkg{binspp} package. The first few examples illustrate the use of the package, while the most complex example in Section~\ref{subsec:complex_example} describes the outputs of the algorithm in full detail. Model parametrization is described in Section~\ref{models}. Below we assume that \texttt{X} is the observed point pattern in the \texttt{ppp} format used in the \pkg{spatstat} package. We further assume that \texttt{X} is observed through the observation window $W$, which is a union of aligned rectangles, aligned with the coordinate axes. \texttt{x\char`_left}, \texttt{x\char`_right}, \texttt{y\char`_bottom} and \texttt{y\char`_top} are vectors giving the coordinates of the extreme points of the rectangles whose union forms the observation window \texttt{W}. Furthermore, \texttt{W\char`_dil} is the dilated observation window used to accommodate cluster centers outside \texttt{W} to mitigate the edge effects. An easy way to obtain $W\char`_dil$ from the vectors \texttt{x\char`_left} to \texttt{y\char`_top} is shown in Section \ref{subsec:complex_example}. All covariates such as \texttt{cov1} are assumed to be pixel images (objects of type \texttt{im} from the \pkg{spatstat} package) defined over the \texttt{W\char`_dil} domain. The list \texttt{control} contains important tuning constants such as the required number of iterations to be run (\texttt{NStep}), the length of the initial part of the chain to be discarded before computing estimates (\texttt{BurnIn}) or the sampling frequency used to reduce autocorrelations in the values used for computing the estimates (\texttt{SamplingFreq}). Also, hyperparameters for prior distributions for different parameters can be specified in this list, as illustrated in the detailed example in Section~\ref{subsec:complex_example}. Providing hyperparameter values guided by the knowledge of the problem at hand is highly recommended! However, some default values are used if the user does not provide them. All priors are normal distributions, priors for $\beta_i^\alpha$ and $\beta_i^\omega$, $i>0$, have expectation 0. We remark here that also the hyperparameters for $\beta_0^\alpha$ and $\beta_0^\omega$ must be given in $\log$ scale because all parameters, except of $\kappa$, are estimated in the exponential form. \subsection{Homogeneous Thomas process} Based on our experience, for this homogeneous model we recommend running at least $50\,000$ iterations, with burn-in of at least $25\,000$ steps. \begin{example} control = list(NStep=50000, BurnIn=25000, SamplingFreq=10) \end{example} The following commands provide equivalent ways of specifying that all three components of the model are homogeneous (no covariates are provided): \begin{example} Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_beta=NULL, z_alpha=NULL, z_omega=NULL) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_beta=list(), z_alpha=list(), z_omega=list()) \end{example} In this example default hyperparameter values were used. These can be retrieved in the following way: \begin{example} Output$priorParameters \end{example} The text outputs and graphical outputs are obtained as follows: \begin{example} print.outputs(Output) plot.outputs(Output) \end{example} \subsection{Thomas process with inhomogeneous cluster centers} In this example the population of parent points is inhomogeneous, with intensity function depending on a covariate. More covariates can be included in the model, provided they are given in the \texttt{z\char`_beta} list, see Section~\ref{subsec:complex_example} for an illustration. For this model with simple inhomogeneity we recommend running at least $100\,000$ iterations, with burn-in of at least $50\,000$ steps. Note that the covariates in the list \texttt{z\char`_beta} must be named in order to the \texttt{ppm} function from the \pkg{spatstat} package run properly. \begin{example} control = list(NStep=100000, BurnIn=50000, SamplingFreq=10) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_beta=list(Z1=cov1)) \end{example} \subsection{Thomas process with inhomogeneous mean number of points in a cluster} Now we assume that the mean number of points in a cluster depends on the position of the corresponding parent point $c$, with the function $\alpha(\mu,c)$ depending on a covariate. Again, more than one covariate may be used, provided they are given in the \texttt{z\char`_alpha} list. For this model with simple inhomogeneity we recommend running at least $100\,000$ iterations, with burn-in of at least $50\,000$ steps. \begin{example} control = list(NStep=100000, BurnIn=50000, SamplingFreq=10) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_alpha=list(cov1)) \end{example} \subsection{Thomas process with inhomogeneous cluster spread} In this case the spread of the clusters depends on the position of the corresponding parent point $c$, with the function $\omega(\nu,c)$ depending on a covariate. As before, more than one covariate may be given in the \texttt{z\char`_omega} list. For this model with simple inhomogeneity we recommend running at least $100\,000$ iterations, with burn-in of at least $50\,000$ steps. \begin{example} control = list(NStep=100000, BurnIn=50000, SamplingFreq=10) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_omega=list(cov1)) \end{example} \subsection{Thomas process with complex inhomogeneities in all model components}\label{subsec:complex_example} For this example we use the real dataset provided in the \pkg{binspp} package, see also \cite{FFCGA2019}: \begin{example} X = trees_N4 x_left = x_left_N4 x_right = x_right_N4 y_bottom = y_bottom_N4 y_top = y_top_N4 \end{example} Several covariates accompany the observed point pattern. In the following lists we specify which covariates are assumed to influence which model components. Note that each model component depends on two covariates. Due to identifiability reasons the lists \texttt{z\char`_beta} and \texttt{z\char`_alpha} must be disjoint (no covariate can appear in both lists). \begin{example} z_beta = list(refor=cov.refor, slope=cov.slope) z_alpha = list(tmi=cov.tmi, td=cov.td) z_omega = list(slope=cov.slope, reserv=cov.reserv) \end{example} The observation window is given as the union of aligned rectangles, aligned with the coordinate axes: \begin{example} W = owin(c(x_left[1],x_right[1]),c(y_bottom[1],y_top[1])) if(length(x_left)>=2){ for(i in 2:length(x_left)){ W2 = owin(c(x_left[i],x_right[i]),c(y_bottom[i],y_top[i])) W=union.owin(W,W2) } } \end{example} Dilated observation window: \begin{example} W_dil = dilation.owin(W,100) \end{example} The parameter 100 for the dilation specifies the width of the zone around $W$ where centers having offsprings in $W$ can occur. Since the Gaussian distribution for the offsprings is used, the width is infinite in theory, but for computational reasons we bound this region. For this model with complex inhomogeneities we recommend running at least $250\,000$ iterations, with burn-in of at least $150\,000$ steps. Hyperparameter values for prior distributions can be specified as follows: \begin{example} control = list(NStep=250000, BurnIn=150000, SamplingFreq=10, Prior_alpha_mean=3, Prior_alpha_SD=2, Prior_omega_mean=5.5, Prior_omega_SD=5, Prior_alphavec_SD=c(4.25,0.012), Prior_omegavec_SD=c(0.18,0.009)) \end{example} The following commands perform the MCMC estimation. With the required 250\,000 steps of the algorithm the computation takes approx. 2.5 hours on a regular laptop due to the implementation of the core functions using the \pkg{Rcpp} package. \begin{example} set.seed(12345) Output = binspp(X, control, x_left, x_right, y_bottom, y_top, W_dil, z_beta, z_alpha, z_omega) \end{example} Text output, providing the parameter estimates (medians of the estimated posterior distributions) together with the corresponding 2.5\% and 97.5\% quantiles, is obtained by the command \begin{example} print.outputs(Output) \end{example} Graphical output, given in Figures~\ref{fig:binspp_outputs1} to \ref{fig:binspp_outputs6}, is provided by the command \begin{example} plot.outputs(Output) \end{example} First, estimated surfaces of the first-order intensity function, the $\alpha(c)$ function, describing the mean number of points in a cluster, and the $\omega(c)$ function, describing the spread of the clusters, are plotted, as illustrated in Figure~\ref{fig:binspp_outputs1}. Then, histograms describing the estimated posterior distribution of the model parameters are plotted, see Figure~\ref{fig:binspp_outputs2}. The histograms for the first order parameters are not plotted, because the posterior distribution of these $\beta_1$ and $\beta_2$ are computed in the first under the assumption of Poissonity. But these parameter are bound with inhomogeneity of cluster centers, i.e. its significance should be computed from cluster centers only. In order to deal with this issue, we record the centers in every step of MCMC and also we record the significance of the covariates from the list \texttt{z\char`_beta} with respect to the population of cluster centers in every step of MCMC. Posterior histograms of the corresponding p-values are plotted instead of the posterior histograms for these parameters, see the bottom part of Figure~\ref{fig:binspp_outputs2}. This provides more precise inference about the significance of the covariates than the outcomes of the first step of estimation, where the \texttt{ppm} function from the \pkg{spatstat} package is used and where the precise locations of the (observed) offsprings may confound the significance of the covariates with respect to the (unobserved) parent points. Finally, traceplots for various quantities describing the state of the chain are plotted, including 1) the model parameters, 2) the p-values discussed in the previous paragraph, 3) the value of the log-likelihood itself, 4) the number of parent points, 5) acceptance probabilities for proposed updates of parameters influencing $\alpha(c)$ or $\omega(c)$ (not very informative for long runs but useful when tuning the algorithm for a new dataset with short runs), and 6) fractions of accepted updates in the past 1000 steps of the algorithm (much more informative than plots of the acceptance probabilities). See Figures~\ref{fig:binspp_outputs3} to \ref{fig:binspp_outputs6} for illustration. The traceplots for model parameters describe also the estimated median of the posterior distribution (given by the solid red line) together with the empirical 2.5\% and 97.5\% quantiles of the posterior distribution (red dashed lines). \begin{figure} \centering \includegraphics[width=0.8\textwidth]{Fig_data_1.pdf} \includegraphics[width=0.8\textwidth]{Fig_data_2.pdf} \includegraphics[width=0.8\textwidth]{Fig_data_3.pdf} \caption{Plots of the estimated first-order intensity function (top), the estimated function $\alpha(c)$ describing the mean number of points in a cluster (middle) and the estimated function $\omega(c)$ describing the spread of the clusters (bottom).} \label{fig:binspp_outputs1} \end{figure} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{Fig_data_4.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_5.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_6.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_7.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_8.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_9.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_10.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_11.pdf} \includegraphics[width=0.49\textwidth]{Fig_data_12.pdf} \caption{Histograms for estimated posterior distributions of various model parameters. Note that the parameter \texttt{alpha} in the histogram above corresponds to the parameters $\beta_0^\alpha$, the parameter \texttt{omega} corresponds to $\beta_0^\omega$ and the parameters \texttt{alphavec(i)} corresponds to the parameters $\beta_i^\alpha$ from Section~\ref{models}, \texttt{omegavec(i)} corresponds to $\beta_i^\omega$ and \texttt{beta(i)} corresponds to $\beta_i$. } \label{fig:binspp_outputs2} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{Fig_data_13.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_14.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_15.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_16.pdf} \caption{Traceplots for various quantities describing the state of the MCMC algorithm.} \label{fig:binspp_outputs3} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{Fig_data_17.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_18.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_19.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_20.pdf} \caption{Traceplots for various quantities describing the state of the MCMC algorithm.} \label{fig:binspp_outputs4} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{Fig_data_21.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_22.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_23.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_24.pdf} \caption{Traceplots for various quantities describing the state of the MCMC algorithm.} \label{fig:binspp_outputs5} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{Fig_data_25.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_26.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_27.pdf} \includegraphics[width=0.95\textwidth]{Fig_data_28.pdf} \caption{Traceplots for various quantities describing the state of the MCMC algorithm.} \label{fig:binspp_outputs6} \end{figure} \subsection{Generalised Neyman-Scott}\label{subsec:generalised} In this subsection we specify the implementation of the Bayesian MCMC algorithm for estimation of the homogeneous generalised Thomas point process (GTPP) which was described in \cite{AM2020}. In this subsection we assume that the point pattern \texttt{X} is an object of the format \texttt{ppp} from the \pkg{spatstat} package and that it is observed in a nrectangular observation window $W$. The notation and priors are slightly different than for the inhomogeneous models, due to the different notations used in the {corresponding} original papers. The GTPP can be simulated using \begin{example} X=rgtp(kappa, omega, lambda, theta, win = W) \end{example} Here \texttt{kappa} corresponds to the intensity of centers, \texttt{omega} to the standard deviation of the radially symmetric Gaussian distribution determining the spread of offsprings, and \texttt{lambda} and \texttt{theta} correspond to the parameters of the GPD {governing the} cluster size. The priors used in the estimation are lognormal for all parameters, except \texttt{lambda} which has a uniform prior. The hyperparametres and control parameters must be specified in the estimation function \texttt{estgtp} itself. The function \texttt{estgtpr} allows for plotting of all results and outputs of the MCMC chain. The posterior distribution of the parameter \texttt{lambda} can be used to determine the over- or under-dispersion. {Specifically, if} 0 is an element of the 95\% posterior interval for \texttt{lambda}, then the {Poisson assumption} cannot be rejected. See the example code where result summaries all posterior medians and 95\% quantiles of the model parameters. \begin{example} #Prior for parameter kappa a_kappa = 4 b_kappa = 1 x <- seq(0, 100, length = 100) hx <- dlnorm(x, a_kappa, b_kappa) plot(x, hx, type = "l", lty = 1, xlab = "x value", ylab = "Density", main = "Prior") #Prior for parameter omega a_omega = -3 b_omega = 1 x <- seq(0, 1, length = 100) hx <- dlnorm(x, a_omega, b_omega) plot(x, hx, type = "l", lty = 1, xlab = "x value", ylab = "Density", main = "Prior") #Prior for parameter lambda l_lambda = -1 u_lambda = 0.99 x <- seq(-1, 1, length = 100) hx <- dunif(x, l_lambda, u_lambda) plot(x, hx, type = "l", lty = 1, xlab = "x value", ylab = "Density", main = "Prior") #Prior for parameter theta a_theta = 4 b_theta = 1 x <- seq(0, 100, length = 100) hx <- dlnorm(x, a_theta, b_theta) plot(x, hx, type = "l", lty = 1, xlab = "x value", ylab = "Density", main = "Prior") #estimation procedure with default values for standard deviations of updates for the parameters est = estgtp(X$X, skappa = exp(a_kappa + ((b_kappa ^ 2) / 2)) / 100, somega = exp(a_omega + ((b_omega ^ 2) / 2)) / 100, dlambda = 0.01, stheta = exp(a_theta + ((b_theta ^ 2) / 2)) / 100, smove = 0.1, a_kappa = a_kappa, b_kappa = b_kappa, a_omega = a_omega, b_omega = b_omega, l_lambda = l_lambda, u_lambda = u_lambda, a_theta = a_theta, b_theta = b_theta, iter = 1000, plot.step = 1000, save.step = 1e9, filename = "") #plotting the results and estimationg of the parameters from refined MCMC chain discard = 100 step = 10 result = estgtpr(est, discard, step) result \end{example} \section{Summary}\label{sec:discussion} This paper presents a model and an implementation of the Bayesian MCMC algorithm for estimating parameters of inhomogeneous Neyman-Scott point process with inhomogeneity in cluster centers, cluster spread and/or cluster sizes. The simulation studies {assessing} the performance of the presented algorithm were published in \cite{KM2016} for the homogeneous process, in \cite{MMK2014} for inhomogeneous cluster centers and in \cite{MS2017} for inhomogeneous cluster centers and cluster spread. The presented package \pkg{binspp} allows also for identification of over- or under-dispersion of cluster sizes in a homogeneous model through the generalised Thomas point process. Since the algorithm is rather flexible, the package can be further {extended} by estimation methods for models where some cluster centers are given and fixed. It can also be {extended} into the direction of the spatio-temporal Neyman-Scott point processes. A user of this package should be aware of the following issues, connected with the Bayesian MCMC algorithms. First, priors should be carefully chosen, even though we provide a {sensible} default. For example, the range of the $\omega$ prior must be in coherence with the size of the observation window; similarly, the range of the priors for the regression parameters connected with the covariates must reflect the range of the covariate values. Second, when {slow} mixing is observed via low fractions of accepted updates, one might think of changing the standard deviation for proposal distributions. These standard deviations are also provided in the package by their default value. Third, if many covariates are {considered}, longer chains are needed {to get reasonably close to the equilibrium}. The equilibrium state can be determined by {the log-likelihood not increasing anymore}, {stabilized} number of centers, {stationary behaviour of the trace plots of the parameters}, or by {unimodal} histograms of posterior distributions. \section*{Acknowledgements} The project has been financially supported by the Grant Agency of Czech Republic (Project No. 19-04412S). The authors are very grateful to Begona Abellanas who initiated this project by asking for the implementation of the method and who provide us with the illustratory data set.
\section{Introduction} \subfile{sections/intro} \section{Related Works} \subfile{sections/related_works} \section{Dataset} \subfile{sections/dataset} \section{Methodology} \subfile{sections/methodology} \section{Results and Discussion} \subfile{sections/results} \section{Conclusion} In this paper, we introduce ScAN: a publicly available suicide attempt (SA) and ideation (SI) events dataset that consists of $12,759$ EHR notes with $19,960$ unique evidence annotations for suicidal behavior. To our knowledge, this is the largest and publicly available dataset for SA and SI, an important resource for suicidal behaviors research. We also provide a strong Ro\textsc{bert}a baseline model for the dataset: ScANER (SA and SI retriever) which consists of two sub-modules: (a.) an \textit{evidence retriever module} that extracts all the relevant evidence paragraphs from the patient's notes and (b.) a \textit{prediction module} that evaluates the extracted evidence paragraphs and predicts the SA and SI event label for the patient's stay at the hospital. ScAN and ScANER could help extract suicidal behavior in patients for suicide surveillance and predictions, leading to potentially early intervention and prevention efforts by medical professionals. \section{Annotation Guidelines} \section{Selected Clinical Sections} \label{app:clinical_sections} The sections selected for annotations after using \texttt{clinical\_sectionizer} are enumerated below: \begin{enumerate} \item Allergy \item Case Management \item Consult \item Discharge Summary \item Family history \item General \item HIV Screening \item Labs and Studies \item Medication \item Nursing \item Nursing/other \item Nutrition \item Observation and Plan \item Past Medical History \item Patient Instructions \item Physical Exam \item Physician \item Present Illness \item Problem List \item Radiology \item Rehab Services \item Respiratory \item Sexual and Social History \item Social Work \end{enumerate} \section{Hyper-parameter Settings} \label{app:training_params} All the hyper-parameter settings for both modules of ScANER are provided in Table~\ref{table:hyper_params}. \begin{table}[!htbp] \centering \footnotesize \renewcommand{\arraystretch}{1.2} \begin{tabular}{cccc} \toprule \multicolumn{4}{c}{\textbf{\textit{Evidence Retriever Module}}} \\ \midrule Learning Rate & Warmup steps & Optimizer & Adam $\epsilon$ \\ 2e-5 & 2,000 & Adam & 1e-8 \\ \midrule $\gamma$ & $\alpha$ & $\beta$ & \\ 2.5 & 1.1 & 1.5 & \\ \midrule \multicolumn{4}{c}{\textbf{\textit{Hospital Stay SA-SI Prediction Module}}} \\ \midrule Attention Heads & Attention Layers & Learning Rate & Warmup steps \\ 3 & 2 & 1e-3 & 1,200 \\ \midrule Optimizer & Adam $\epsilon$ & & \\ Adam & 1e-8 & & \\ \bottomrule \end{tabular} \caption{Hyper-parameter setting for both retriever and prediction module of ScANER.} \label{table:hyper_params} \end{table} \newpage \section{Confusion matrices} \label{app:confusion_matrix} The confusion matrices for SA and SI prediction at paragraph level is provided in Table~\ref{table:conf_app}. \begin{table}[!htbp] \renewcommand{\arraystretch}{1.2} \footnotesize \centering \begin{tabular}{l|ccc} \toprule \multicolumn{4}{c}{\textbf{\textit{Paragraph SA Prediction}}} \\ \midrule & Positive & Neg\_Unsure & Neutral-SA \\ \midrule Positive & 1,804 & 285 & 344 \\ Neg\_Unsure & 253 & 118 & 80 \\ Neutral-SA & 472 & 204 & 7,314 \\ \midrule \multicolumn{4}{c}{\textit{\textbf{Paragraph SI Prediction}}} \\ \midrule & Positive & Negative & Neutral-SI \\ \midrule Positive & 206 & 69 & 56 \\ Negative & 71 & 87 & 31 \\ Neutral-SI & 170 & 73 & 10,111 \\ \bottomrule \end{tabular} \caption{Confusion matrices for the predictions on the test set of evidence retriever.} \label{table:conf_app} \end{table} \subsection{Dataset collection} For annotation, we selected the notes from the MIMIC-III \cite{johnson2016mimic} dataset, which consists of the de-identified EHR data of patients admitted to the Beth Israel Deaconess Medical Center in Boston, Massachusetts from 2001 to 2012 \cite{johnson2016mimic}. The data includes notes, diagnostic codes, medical history, demographics, lab measurements among many other record types. We chose MIMIC-III because it is publicly available under a data use agreement and allows clinical studies to be easily reproduced and compared. The diagnostic ICD codes for the patients are provided at hospital-stay level in MIMIC with admission identification numbers (HADM\_ID in MIMIC database). We first filtered the hospital stays that had ICD codes associated with suicide and overdose. This resulted in $697$ hospital-stays for $669$ unique patients. For each stay, multiple de-identified notes such as nursing notes, physician notes, and discharge summaries are available. For the selected $697$ hospital-stays we extracted a total of $12,759$ notes. Each medical note contains multiple sections about a patient such as family and medical history, assessment and plan, and discharge instructions. We extracted different sections from these clinical notes using MedSpaCy’s\footnote{https://github.com/medspacy/medspacy} \texttt{clinical\_sectionizer} and filtered the relevant sections from these clinical notes for annotation. The extensive list of these sections is provided in Appendix~\ref{app:clinical_sections}. \subsection{Annotation Process} The aim was to annotate all instances of SA and SI documented in the medical notes as defined by Center of Disease Control and Prevention (CDC) \cite{hedegaard2020increase}. The filtered $12,759$ notes were annotated by a trained annotator under the supervision of a senior physician. Each note consisted of instances of SA, SI, both or none. The senior physician randomly annotated $330$ notes and had a 100\% agreement with the annotator on hospital-stay level annotation and $85$\% agreement on sentence-level annotations. After adjudication between the senior physician and the annotator, the disagreements were discussed and adjusted by the annotator. \begin{figure}[!htbp] \centering \includegraphics[width=7.7cm]{imgs/neg_sa_ver2.pdf} \caption{An example with \textit{negative} SA and \textit{negative} SI annotations.} \label{fig:neg_sa} \vspace{-1.5em} \end{figure} \paragraph{Suicide Attempt (SA):}The annotator labelled all the sentences with a mention of SA. Some hospital stays could represent multiple types of SA, such as in Fig.~\ref{fig:annotation}, where `tried to hang himself' is labelled as a \textit{positive} SA and `Tylenol overdose' is labelled as \textit{unsure} since the overdose was never confirmed as an SA event elsewhere in the medical notes of the patient's hospital-stay. The label \textit{unsure} is used when it is not clearly documented if a self-harm was an SA event or not. The \textit{negative} instance, example shown in Fig.~\ref{fig:neg_sa}, is a sentence that confirms that the self-harm, an ``accidental overdose'', responsible for the patient's hospital-stay is not an SA event. In this work, we only focused on suicidal self-harm and not non-suicidal self-harm \cite{crosby2011self}. Further sub-categories are also provided for an SA annotation in the form of the ICD label group: a.) T36-T50: Poisoning by drugs, medications and biological substances b.) T51-T65: Toxic effects on non-medical substances c.) T71: Asphyxiation or suffocation and d.) X71-X83: Drowning, firearm, explosive material, jumping from a high place, crashing motor vehicles, other specified means. \paragraph{Suicide Ideation (SI):}SI is defined as any mention and/or indication of wanting to take one’s own life or harm oneself. Similar to SA, any sentence with a mention of SI was labelled within the patient's notes. A SI annotation could be labeled as \textit{positive} or \textit{negative}, an example for each label is shown in Fig.~\ref{fig:pos_neg_si}. \begin{figure}[!htbp] \centering \includegraphics[width=7.7cm]{imgs/si_neg_ver4.pdf} \caption{Examples of \textit{positive} and \textit{negative} SI annotations.} \label{fig:pos_neg_si} \vspace{-0.5em} \end{figure} A sentence without SA or SI annotation would be considered as a \textit{neutral-SA} or \textit{neutral-SI} sentence respectively. Sentence level annotations provide more visibility to a medical expert for the hospital-stay level annotation. \subsection{Dataset statistics} ScAN consists of $19,690$ unique evidence annotations for the suicide relevant sections of $12,759$ EHRs of $697$ patient hospital-stays. There are a total of $17,723$ annotations for SA events and $1,967$ annotations for SI events. The distribution for both SA and SI events is provided in Table~\ref{table:sa_si_distr}. \begin{table}[!htbp] \renewcommand{\arraystretch}{1.2} \footnotesize \centering \begin{tabular}{lccc} \toprule \multirow{2}{*}{\textit{General Statistics}} & Patients & Hospital-stays & Notes \\ & $669$ & $697$ & $12,759$ \\ \midrule \multirow{2}{*}{\textit{Suicide Attempt}} & Positive & Negative & Unsure \\ & $14,815$ & $170$ & $2,738$ \\ \midrule \multirow{2}{*}{\textit{Suicide Ideation}} & Positive & Negative \\ & $1,167$ & $800$ & \\ \bottomrule \end{tabular} \caption{Distribution of unique annotations at the patient, hospital-stay and notes level in ScAN.} \label{table:sa_si_distr} \vspace{-1em} \end{table} \subsection{Evidence Retriever} \paragraph{Problem Formulation:} Given an input clinical note, the model extracts the evidences (one or more sentences) related to SA or SI (SA-SI) from the note. This is a binary classification problem where given a text snippet the model predicts whether it has an evidence for SA-SI or not. We learn this task at paragraph level where the input is a set of $20$ consecutive sentences because the local surrounding context provides additional important information \cite{yang2021context, rawat2019naranjo}. A paragraph was labeled as \textit{evidence} \textit{no}, if all the sentences in that paragraph are \textit{neutral-SA} and \textit{neutral-SI}. If there was at least one SA-SI sentence, it was considered an \textit{evidence} \textit{yes}. As the number of non-evidence sentences significantly outsized the evidence sentences, we decided to use an overlapping window of $5$ sentences between the paragraphs to build more evidence paragraphs. The distribution of the paragraphs, across all evidence, SA and SI labels for train, validation, and test set is provided in Table~\ref{table:para_distr}. We segregated the train and test set such that any patient observed by the \textit{retriever module} during training was not seen in the test set. This is important as there are patients who had multiple hospital-stays in ScAN. \vspace{0.4em}\noindent\newline \textbf{Proposed Model:} Transformer \cite{vaswani2017attention} based language models \cite{devlin2018bert, liu2019roberta} have shown great performance for a broad range of NLP classification tasks. Hence, to extract the evidence paragraphs we trained a Ro\textsc{bert}a \cite{liu2019roberta} based model. It has been previously shown that the domain-adapted versions of the pre-trained language models, such as clinical\textsc{bert} \cite{alsentzer2019publicly} or Bio\textsc{bert} \cite{lee2020biobert}, work better than their base versions. So, we further pre-trained the Ro\textsc{bert}a-base model over the MIMIC dataset to create a clinical version of Ro\textsc{bert}a model, hereby referenced as medRo\textsc{bert}a. During our initial exploration, we experimented with clinical\textsc{BERT} and Bio\textsc{BERT} but found that medRo\textsc{BERT}a consistently outperformed both models. medRo\textsc{BERT}a achieved an overall F1-score of $0.88$ whereas both clinical\textsc{BERT} and Bio\textsc{BERT} achieved an overall F1-score of $0.85$. Our hospital-level SA and SI predictor would work with any encoder-based evidence retriever model. \vspace{0.4em}\noindent\newline \textbf{Multi-task Learning:} We trained medRo\textsc{bert}a in a multi-task learning setting where along with learning the evidence classification task, the model also learns two auxiliary tasks: (a.) Identifying the label for SA between \textit{positive}, \textit{negative}, \textit{unsure} and \textit{neutral-SA} and, (b.) Identifying the label for SI between \textit{positive}, \textit{negative} and \textit{neutral-SI}. The training loss ($L(\theta)$) for our evidence retriever model was formulated as: \begin{equation} L(\theta) = L_{evi} + \alpha * L_{SA} + \beta * L_{SI} \end{equation} Where $L_{evi}$ is the negative log likelihood loss for evidence classification, $L_{SA}$ and $L_{SI}$ are SA and SI prediction losses respectively, and $\alpha$ and $\beta$ are the weights for the auxiliary tasks' losses. The distribution of labels across all the three tasks is highly skewed, hence, we applied the following techniques to learn an efficient and robust model. \begin{itemize} \item Weighted log loss was used in both main task and auxiliary tasks. The total loss for each task was calculated as the weighted sum of loss according to the \textit{label} of the input paragraph. Log weighing helps smooth the weights for highly unbalanced classes. The weight for each class was calculated using: \[ w_{l,t}=\left\{ \begin{array}{lll} 1.0 & \textrm{if}(w_{l,t}<1.0)\\ log(\gamma*N_t/N_{l,t}) \end{array} \right. \] Where $N_t$ is the count of all training paragraphs for the task $t$ and $N_{l,t}$ is the count of paragraphs with label $l$ for the task $t$ and $w_{l,t}$ is the calculated weight for those paragraphs. We tuned $\gamma$ as a hyper-parameter. All training hyper-parameters for our best model are provided in Appendix~\ref{app:training_params}. \vspace{-0.4em} \item We also employed different sampling techniques \cite{youssef1999image}, up and down sampling, to help our model learn from an imbalanced dataset. After sweeping for different sampling combinations as hyper-parameters, we found that down-sampling the \textit{no}-evidence paragraphs by $10\%$ resulted in the best performance. \vspace{-0.4em} \item The \textit{negative} label of SA is severely under-represented in ScAN making it difficult for the model to learn useful patterns from such instances, refer Table~\ref{table:para_distr}. After discussion with the experts, we decided to group the instances of \textit{negative} and \textit{unsure} together and label them as \textit{neg\_unsure} because for both groups the general psych outcome is to let the patient leave after the hospital-stay as there is no solid evidence defining whether the self-harm was a SA event. \end{itemize} \begin{figure*}[!t] \centering \includegraphics[width=15cm]{imgs/model_ver2.pdf} \caption{ScANER (\textbf{S}ui\textbf{c}ide \textbf{A}ttempt and Ideatio\textbf{n} \textbf{E}vents \textbf{R}etreiver) consists of two sub-modules: (a.) Evidence retriever module extracts evidence paragraphs from all EHR notes. We trained the module using all annotated paragraphs from ScAN. (b.) Prediction module predicts the SA and SI label for a patient using the evidence paragraphs extracted by the \textit{retriever module} from EHR notes during the patient's hospital-stay.} \label{fig:scaner} \vspace{-1em} \end{figure*} \begin{table}[t] \renewcommand{\arraystretch}{1.2} \footnotesize \centering \begin{tabular}{lccc} \toprule \textit{Suicide Attempt} & Positive & Neg\_Unsure & Neutral-SA \\ \midrule Train & $377$ & $54$ & $1,381$ \\ Val & $50$ & $10$ & $189$ \\ Test & $91$ & $19$ & $326$ \\ \midrule \textit{Suicide Ideation} & Positive & Negative & Neutral-SI \\ \midrule Train & $377$ & $214$ & $1,521$ \\ Val & $45$ & $28$ & $208$ \\ Test & $44$ & $35$ & $357$ \\ \bottomrule \end{tabular} \caption{Distribution of SA and SI at hospital-stay level in training, validation and testing set.} \label{table:adm_distr} \vspace{-2em} \end{table} \subsection{Hospital-stay level SA and SI Predictor} \label{sec:adm_prediction} \paragraph{Problem Formulation} Given all the clinical notes of a patient during the the hospital stay, the model predicts the label for SA (\textit{positive}, \textit{neg\_unsure} and \textit{neutral-SA}) and SI (\textit{positive}, \textit{negative} and \textit{neutral-SI}). The \textit{prediction module} uses the evidence paragraphs extracted by the \textit{retriever module}. \paragraph{Robust Finetuning} The retriever module is not perfect and can extract false positives. This results in extracting irrelevant paragraphs, with evidence label \textit{No}, along with evidence paragraphs for a hospital-stay with SA or SI and extracting irrelevant paragraphs as evidences for a hospital-stay with both SA and SI marked as \textit{neutral}. To tackle such situations and train a robust model, we applied three techniques: \vspace{-0.5em} \begin{itemize} \item For a hospital-stay with a non-\textit{neutral} label for SA or SI, during training we added some noise in the form of irrelevant paragraphs (a paragraph with no SA or SI annotation) from the notes to the set of actual evidence paragraphs for the input. An irrelevant paragraph from a clinical note was sampled with a probability of $0.05$. This forced the predictor module to learn effectively even with noisy inputs. \vspace{-0.5em} \item For a \textit{neutral} hospital-stay with no evidence paragraphs, we randomly chose $X$ unique irrelevant paragraphs from the notes. $X$ was sampled from the distribution of number of evidence paragraphs of the non-\textit{neutral} hospital-stays. This prevented the leaking of any information to the prediction module during training by keeping the distribution of number of input paragraphs the same across \textit{neutral} and non-\textit{neutral} instances. \vspace{-0.5em} \item Since these hospital-stays were extracted using the ICD codes related to suicide and overdose, the data is quite skewed with only $102$ \textit{neutral} events from a total of $697$ hospital-stays. Whereas in a real-world scenario, \textit{neutral} hospital-stays would be much higher than non-\textit{neutral} ones. Hence, to facilitate a balanced learning of the predictor module we introduced $1,800$ \textit{neutral} hospital-stays from the MIMIC dataset. The distribution for SA and SI at hospital-stay level is provided in Table~\ref{table:adm_distr}. \end{itemize} \begin{table*}[t] \centering \renewcommand{\arraystretch}{1.2} \footnotesize \begin{tabular}{l|ccc|l|ccc|l|ccc} \toprule \multicolumn{4}{c}{\textit{\textbf{Paragraph Evidence Prediction}}} & \multicolumn{4}{|c|}{\textit{\textbf{Paragraph SA Prediction}}} & \multicolumn{4}{c}{\textit{\textbf{Paragraph SI Prediction}}} \\ \midrule Evidence & P & R & F & Labels & P & R & F & Labels & P & R & F \\ \midrule Yes & 0.79 & 0.87 & 0.83 & Positive & 0.71 & 0.74 & 0.73 & Positive & 0.46 & 0.62 & 0.53 \\ No & 0.95 & 0.91 & 0.93 & Neg\_Unsure & 0.19 & 0.26 & 0.22 & Negative & 0.38 & 0.46 & 0.42 \\ \multicolumn{1}{c|}{-} & - & - & - & Neutral-SA & 0.95 & 0.92 & 0.93 & Neutral-SI & 0.98 & 0.99 & 0.98 \\ \midrule Overall & 0.87 & 0.89 & 0.88 & Overall & 0.62 & 0.64 & 0.63 & Overall & 0.61 & 0.69 & 0.64 \\ \bottomrule \multicolumn{12}{r}{\scriptsize{P: Precision, R: Recall and F: F1-score.}} \end{tabular} \caption{Paragraph level performance of the \textit{evidence retriever module}. The overall evaluation metrics (precision, recall and F1-score) are macro-weighted. Evidence prediction is the main task whereas SA and SI prediction are auxiliary tasks and help the model align the vector representations of the paragraphs for the \textit{hospital-stay level suicidal behavior prediction}.} \label{table:para_perf} \vspace{-1em} \end{table*} \paragraph{Proposed Model} The paragraphs extracted using the \textit{retriever module} for a patient's hospital-stay were provided as an input to the predictor module. We used a multi-head attention model to predict the SA and SI label for a hospital-stay as self-attention based models have proved to be quite effective for a lot of prediction tasks in machine learning \cite{devlin2018bert, cao2020self, hoogi2019self}. We encoded the extracted paragraphs ($[p_1, p_2 .... p_n]$) using the retriever module, medRo\textsc{BERT}a, to get a vector representation of $768$ dimensions for each of the paragraphs ($[v_1, v_2 ... v_n]$). Training the \textit{retriever module} on auxiliary tasks of predicting SA and SI helped align these paragraph representations for SA and SI prediction. Then, we added a prediction vector ($v_0$) along with all the vector representations of the paragraphs to get $\mathcal{V} = [v_0, v_1, v_2 ... v_n]$. We passed $\mathcal{V}$ through our multi-head attention model to get the hidden representations $\mathcal{H} = [h_0, h_1 ... h_n]$. We then passed $h_0$ through a SA inference layer and SI inference layer to predict the labels. During the whole training process, the weights of the retriever module were frozen whereas $v_0$ was a learnable vector initialised as an embedding in the multi-head attention model. We used a separate $v_0$ prediction vector so that it could retain the information from all the other paragraph representations for hospital-stay level prediction similar to how \textsc{[CLS]} is utilized in different transformer-based models for sequence prediction \cite{devlin2018bert, liu2019roberta}. We tuned the number of layers and number of attention heads of our prediction module as hyper-parameters and achieved the best performance using a 2-layer and 3-attention head model. Our complete ScANER model is illustrated in Fig~\ref{fig:scaner}.
\section{Introduction} \label{sec.Intro} Light and elusive degrees of freedom are ubiquitous in theoretical frameworks aimed at solving deficiencies of the standard model (SM) of particle physics. The feeble couplings and tiny masses imply a potentially prominent role in the early Universe, and their presence at early times can leave an imprint on cosmological observables. Some particle candidates for physics beyond the SM, such as the one investigated in this work, are somewhat special since they solve more than one problem. Attempts to detect CP violation by strong interactions have not been successful so far. From the theory point of view, the source of CP violation (or time-reversal violation in agreement with the CPT theorem) in Quantum ChromoDynamics (QCD) is controlled by a dimensionless parameter $\theta$ that is expected to be of order one. The non-observation of CP-violating electric dipole moments of nucleons puts the spectacular bound $\theta \lesssim 10^{-10}$~\cite{Baker:2006ts,Pendlebury:2015lrz,Abel:2020pzs}, and understanding this severe inequality is at the heart of the so-called strong CP problem. An elegant solution is the Peccei-Quinn (PQ) mechanism~\cite{Peccei:1977hh,Peccei:1977ur} where the $\theta$ parameter is promoted to a dynamical pseudo-scalar field known as the \textit{axion}~\cite{Wilczek:1977pj,Weinberg:1977ma}. QCD dynamics itself drives such a field toward the configuration of minimal energy that is CP conserving~\cite{Vafa:1984xg}. Remarkably, the QCD axion kills two birds with one stone since it provides a solution to another serious SM drawback: the energy density stored in the field oscillations has a redshift behavior with the Hubble expansion which is the same as the one for non-relativistic matter~\cite{Preskill:1982cy,Abbott:1982af,Dine:1982ah}. Thus the QCD axion is one of the strongest motivated viable dark matter candidates, and the production in the early Universe is of non-thermal origin~\cite{Kibble:1976sj,Vilenkin:1981kz,Kibble:1982dd,Sikivie:1982qv,Vilenkin:1982ks,Linde:1985yf,Huang:1985tt,Seckel:1985tj,Davis:1986xc,Lyth:1989pb,Linde:1990yj,Vilenkin:2000jqa}. Axions can be copiously produced in the early Universe also via scattering and decays of particles belonging to the primordial bath~\cite{Turner:1986tb,Berezhiani:1992rk,Brust:2013ova,Baumann:2016wac,DEramo:2018vss,Arias-Aragon:2020qtn,Arias-Aragon:2020shv,Green:2021hjh,DEramo:2021usm}. Eventually, once the early Universe gets cold enough and diluted, they propagate without any interaction along geodesics and free-stream until the present time. Their presence may alter the Hubble expansion rate since they contribute to the radiation energy density of the Universe as massive neutrinos do when they are still relativistic. The presence of such a cosmic axion background can leave distinct and detectable imprints, and current cosmological data put bounds on the axion mass and interactions~\cite{Hannestad:2005df,Melchiorri:2007cd,Hannestad:2007dd,Hannestad:2008js,Hannestad:2010yi,Archidiacono:2013cha,Giusarma:2014zza,DiValentino:2015zta,DiValentino:2015wba,Archidiacono:2015mda}. Recent work~\cite{Dror:2021nyr} suggested strategies to detect this population of axions even directly with terrestrial experiments. In this work, we revisit the joint constraints on the QCD axion and neutrino masses and improve the state-of-the-art analysis~\cite{Giare:2020vzo}. First, we do not rely upon the instantaneous decoupling approximation. This method assumes that thermal equilibrium is achieved in the early Universe but this is not always true. Furthermore, the effective number of bath degrees of freedom changes substantially below the weak scale, and the resulting axion amount would be quite sensitive to the precise value of the decoupling temperature. We overcome these limitation with the Boltzmann equation formalism that tracks the axion population across the expansion history. The axion coupling to gluons, which is necessary to solve the strong CP problem, constitues a serious challenge since such a perturbative description breaks down once strong interactions confine. Historically, the axion production rate was evaluated exclusively above~\cite{Masso:2002np,Graf:2010tv,Salvio:2013iaa,Ferreira:2018vjj} or below~\cite{Chang:1993gm,DEramo:2014urw,Ferreira:2020bpb,DiLuzio:2021vjd} the confinement scale, and cosmological bounds were derived by considering axion-pion and axion-gluon scatterings separately~\cite{Giare:2020vzo}. Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} provided continuous results for the axion production rate. In the high-temperature regime where perturbative QCD is trustworthy, a proper thermal field theory treatment regulates the singular IR behavior due to the long-range interactions mediated by gluons. At low temperatures, axions are produced via pion collisions. The two results are connected via a smooth interpolation across the QCD crossover. We employ these rates in our analysis, and the limits obtained here are more constraining than those previously found in the literature.\footnote{The recent analysis in Ref.~\cite{Caloni:2022uya} employed the rates provided by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} to bound thermally-produced axion-like particles.} Section~\ref{sec.axion} describes the QCD axion scenarios explored here, whose thermal production mechanism is detailed in Sec.~\ref{sec.production}. The cosmological analyses start in Sec.~\ref{sec.Cosmo}, which include a detailed description of the numerical implementation. Section~\ref{sec.Results} presents our results, derived using Big Bang Nucleosynthesis (BBN) and current cosmological measurements. Forecasted analyses based in future Cosmic Microwave Background (CMB) and galaxy survey observations will also be shown. We conclude in Sec.~\ref{sec:conclusions}. \section{QCD axion: mass and interactions} \label{sec.axion} Every QCD axion model features a global Abelian $U(1)$ symmetry, also known as PQ symmetry, which is anomalous under strong interactions and spontaneously broken. The QCD axion is the pseudo-Nambu-Goldstone-Boson (PNGB) that originates from such a breaking. The color anomaly of the PQ symmetry is responsible for a tiny axion mass that has profound cosmological consequences. Regardless of the specific microscopic realization, the color anomaly manifests itself at low energy through the contact interactions of the axion field $a$ with gluons \be \mathcal{L}_{aG} = \frac{\alpha_s}{8 \pi} \frac{a}{f_a} G^A_{\mu\nu} \widetilde{G}^{A \mu\nu} \ . \label{eq:LPQaxion} \ee We define $\alpha_s = g_s^2 / (4 \pi)$ the QCD fine structure constant, $G_{\mu\nu}^A$ the gluon field strength, $\widetilde{G}^{A \mu\nu} \equiv \epsilon^{\mu\nu\rho\sigma} G^A_{\rho\sigma} / 2$ its dual, and $f_a$ is known as the axion decay constant. Once we reach the confinement scale, strong QCD dynamics generate a non-perturbative potential that leads to the general expression for the axion mass~\cite{Bardeen:1978nq,GrillidiCortona:2015jxo,Gorghetto:2018ocs} \be m_a \simeq 5.7 \, \mu{\rm eV} \, \left( \frac{10^{12} \, {\rm GeV}}{f_a} \right) \ . \label{eq:ma} \ee Other axion couplings are allowed but not mandatory. Anomalous interactions to electroweak gauge bosons take a form similar to the one for gluons with different gauge couplings and model-dependent Wilson coefficients. The axion can couple via derivative interactions to SM fermions that we write schematically as follows \be \mathcal{L}_{a \psi} = \frac{\partial_\mu a}{f_a} \, \overline{\psi^\prime} \gamma^\mu \left(c^V_{\psi^\prime \psi} + c^A_{\psi^\prime \psi} \gamma^5 \right) \psi \ . \label{eq:apsicoupling} \ee The fields $\psi$ and $\psi^\prime$ do not necessarily belong to the same generation, and electroweak gauge invariance relates vector and axial-vector couplings. The derivative coupling preserves the shift symmetry $a \rightarrow a + {\rm const}$ consistently with the PNGB nature of the axion. The landscape of axion models is broad~\cite{Kim:2008hd,DiLuzio:2020wdo}. We divide them into two main classes according to the origin of the color anomaly: Kim-Shifman-Vainshtein-Zakharov (KSVZ)~\cite{Kim:1979if,Shifman:1979if} and Dine-Fischler-Srednicki-Zhitnitsky (DFSZ)~\cite{Dine:1981rt,Zhitnitsky:1980tq} frameworks. The coupling to gluons in Eq.~\eqref{eq:LPQaxion} and the consequent axion mass in Eq.~\eqref{eq:ma} are the same for both cases. Interactions with electroweak gauge bosons and SM fermions in Eq.~\eqref{eq:apsicoupling} are different instead. \subsection{KSVZ Axion} \label{subsec.KSVZ} None of the SM fields carries a PQ charge in this case. New colored fermions are responsible for the axion interaction with gluons. They get their mass from PQ breaking, and they have to be heavier than the TeV range to satisfy the collider bounds on new colored particles. For processes at energies below this mass, the new fermions can be integrated out and this procedure generates the local operator in Eq.~\eqref{eq:LPQaxion}. Anomalous couplings to electroweak gauge bosons can be present depending on the gauge charges of these fermions, but their effect is sub-dominant given the hierarchy among gauge coupling constants. Interactions with SM fermions are absent. We are interested in axion production at temperatures below the weak scale\footnote{Ref.~\cite{DEramo:2021lgb} provides the axion production rate across the intermediate mass threshold of the heavy PQ charged fermions.} so we employ the low-energy description in Eq.~\eqref{eq:LPQaxion}. Gluon scatterings are responsible for production above the GeV scale until the epoch when quarks and gluons get confined into hadrons. Below confinement, axion production is controlled by pion scatterings via the derivative interaction \be \mathcal{L}_{a\pi\pi\pi} = \frac{c_{a\pi\pi\pi}}{f_\pi} \, \frac{\partial_\mu a}{f_a} \, \mathcal{J}_\pi^\mu \ . \label{eq:pionKSVZ} \ee Here, $f_\pi \simeq 93 \, {\rm MeV}$ is the pion decay constant and we define the spin-one pion current \be \mathcal{J}_{\pi}^\mu \equiv \pi^0\pi^+\partial^\mu \pi^- + \pi^0\pi^-\partial^\mu \pi^+ - 2 \pi^+\pi^-\partial^\mu \pi^0 \ . \ee The only model dependent coupling is the dimensionless Wilson coefficient $c_{a\pi\pi\pi}$ that in our case results in \be c_{a\pi\pi\pi}^{\rm KSVZ} \simeq 0.12 \ . \ee \subsection{DFSZ Axion} \label{subsec.DFSZ} There is no new fermion field in this case, and the color anomaly of the PQ symmetry is generated by SM quarks that carry a non-vanishing PQ charge. The Higgs sector needs to be extended with another weak doublet and this brings an additional intermediate scale in the game: the mass of the heavy Higgs bosons. We work in the so-called decoupling limit, which is motivated also by collider bounds, where such a mass is well-above the weak scale. In particular, the heavy Higgs bosons mass is above the energies that we consider for axion production.\footnote{Ref.~\cite{DEramo:2021lgb} provides the axion production rate across the intermediate mass threshold of the heavy Higgs bosons.} The local operator in Eq.~\eqref{eq:LPQaxion} arises once we account for the anomalous effects of all SM quarks. Thus it is non-local above the weak scale since the top quark is the heaviest PQ-charged and colored fermion. At intermediate scales, the contact interaction is present with a scale-dependent anomaly coefficient accounting for the virtual effects of heavy quarks that have been integrated out. The presence of two Higgs doublets $H_u$ and $H_d$ introduces a new parameter relevant to axion phenomenology: the ratio between their vacuum expectations values (vevs) $v_u$ and $v_d$. We follow the standard convention and parameterize this ratio as $\tan\beta = v_u/ v_d$. These vevs generate fermion masses, and we consider a type-II two Higgs doublet model (2HDM). Unlike the previous case, the axion couples to SM fermions since they carry a PQ charge. The parameter $\tan\beta$ sets the relative interaction strength between different fermions. Thermal axion production is possibly sensitive to the value of $\tan\beta$ since fermion scattering is an active production source. Axion production in this scenario is richer. Above confinement, we have scattering processes caused by the interactions with SM fermions in Eq.~\eqref{eq:apsicoupling} besides quark and gluon scatterings mediated by the operator in Eq.~\eqref{eq:LPQaxion}. Below the confinement scale, axion production via electron and muon scatterings is present in this case. Concerning pion scatterings, axion production is controlled again by the interactions in Eq.~\eqref{eq:pionKSVZ}. However, the additional axion couplings to SM quarks modify the effective dimensionless parameter $c_{a\pi\pi\pi}$ as follows \be c_{a\pi\pi\pi}^{\rm DFSZ} = c_{a\pi\pi\pi}^{\rm KSVZ} - \frac{\cos 2\beta}{9} \ . \ee \section{Thermal Production} \label{sec.production} Scatterings are the only production channel available for the minimal KSVZ and DFSZ frameworks due to the flavor-conserving axion interactions. If flavor-violating couplings are allowed then decays also contribute~\cite{DEramo:2021usm}. Initially, axions may belong to the thermal bath if during or after inflationary reheating there are efficient mechanisms to produce them. Even if they are not present at the onset of the radiation domination epoch, they are produced by thermal scatterings and their interaction strength could bring them to equilibrium. Whether they thermalize or not, there will be a moment starting from which interactions are so rare that axions just free-stream until the present time. Keeping track of this axion population through the expansion history is the goal of this section. The output of this procedure is the prediction of the number of axions in a comoving volume as a function of the axion mass, and this is also the input for the cosmological analysis performed in the remaining part of this work. A quick method to estimate the axion relic density is via the \textit{instantaneous decoupling approximation}. Here, we assume that axions at some point reach thermal equilibrium, and that they suddenly decouple when the bath had a temperature $T_D$ identified by the relation \be \Gamma_a(T_D) = H(T_D) \ . \label{eq:TD} \ee The temperature dependent production rate $\Gamma_a(T)$ depends on the axion model and it quantifies the number of production processes that happen per unit time. On the other side of the equality, we have the Hubble expansion rate set by the Friedmann equation \be H(T) = \frac{\sqrt{\rho_{\rm rad}}}{\sqrt{3} M_{\rm Pl}} = \frac{\pi \sqrt{g_\star(T)}}{3 \sqrt{10}} \frac{T^2}{M_{\rm Pl}} \ \label{eq:Friedmann} \ee with $M_{\rm Pl} \equiv (8 \pi G)^{-1/2} \simeq 2.44\times10^{18}\, {\rm GeV}$ the reduced Planck's mass. The last equality holds for a radiation dominated Universe with a temperature dependent $g_\star(T)$ relativistic effective degrees of freedom. Axions just free-stream for temperatures below $T_D$ and therefore their comoving number density $Y_a \equiv n_a / s$ stays constant. Here, $s$ is the entropy density of the thermal bath which is conventionally parameterized as $s=(2\pi^2/45)g_{\star s}(T)T^3$ with $g_{\star s}(T)$ the number of entropic degrees of freedom. The asymptotic axion comoving density results in \be Y_a^\infty = Y_a(T \lesssim T_D) = \frac{45 \zeta(3)}{2 \pi^4 g_{\star s}(T_D)} \label{eq:Yainf} \ee with $\zeta(3) \simeq 1.2$ the Riemann zeta function. The asymptotic comoving density depends on the decoupling temperature only through the factor $g_{\star s}(T_D)$ in the denominator. Axions decoupling at later times are a more significant fraction of the thermal bath and therefore their comoving density is larger. \autoref{fig:TD} shows the decoupling temperature obtained via Eq.~\eqref{eq:TD} as a function of the axion mass (or, equivalently, as a function of the axion decay constant $f_a$ through the relation in Eq.~\eqref{eq:ma}) for the KSVZ axion via the production rates of Refs.~\cite{DEramo:2021psx,DEramo:2021lgb}. We use the $g_{\star}(T)$ and $g_{\star s}(T)$ functions provided by Ref.~\cite{Saikawa:2018rcs}, and we check that the outcome of our cosmological analysis is not sensitive to this specific choice.\footnote{We checked that the mass bounds obtained is this work are the same that one would obtain with the functions in Refs.~\cite{Drees:2015exa,Laine:2015kra}} For comparison, we reproduce also the results of Ref.~\cite{Giare:2020vzo} that estimated the axion relic abundance for the KSVZ axion within the instantaneous decoupling approximation by separating two different regimes: gluon and pion scatterings. This corresponds to the dashed lines in the figure. For axion-gluon scattering, the decoupling temperature was significantly overestimated. \begin{figure} \centering \includegraphics[width=\columnwidth]{new_maTadec.png} \caption{Decoupling temperature $T_D$ as a function of the axion mass $m_a$ (lower horizontal axis) and the axion decay constant $f_a$ (upper horizontal axis). Dashed lines corresponds to the values found by Ref.~\cite{Giare:2020vzo}, the solid line corresponds to the KSVZ axion with a continuous result for the rate.} \label{fig:TD} \end{figure} The pion rate employed by Ref.~\cite{Giare:2020vzo} results from a standard calculation within chiral perturbation theory and therefore is reliable. This is why the axion-pion dashed line agrees well with the full KSVZ estimate of the decoupling temperature. On the contrary, the axion-gluon dashed line is significantly far away from the correct KSVZ result. The production rate adopted by Ref.~\cite{Giare:2020vzo} in the deconfined phase corresponds to a dimensional analysis estimate. A proper rate evaluation that accounts for the running of the strong coupling constant enhances the rate as we approach the QCD crossover, and therefore it reduces the decoupling temperature. The net result is an underestimate of the axion relic density by previous studies, and this is the reason why the cosmological mass bounds found in this analysis are stronger. Therefore, we improve in this manuscript the results presented in Ref.~\cite{Giare:2020vzo}, which regardless if there were derived relying in estimated rates, have pioneered cosmological axion constraints and motivated studies as the one presented here. The criterion in Eq.~\eqref{eq:TD} leads to a ballpark estimate of the decoupling epoch but it is far from being rigorous. As it is manifest from Eq.~\eqref{eq:Yainf}, the final axion abundance is sensitive to the detailed value of the decoupling temperature only if $g_{\star s}$ is changing around the decoupling time. This is exactly the case for the axion parameter space investigated in this work. Furthermore, the interaction rate can have a peculiar structure around the decoupling temperature as in DFSZ theories where threshold effects around the mass of SM heavy quarks enhances the axion coupling to gluons.\footnote{This is analogous to integrating out a heavy PQ-charged and colored fermion in KSVZ theories as discussed in detail by Ref.~\cite{DEramo:2021lgb}.} We need to refine the axion relic density calculation in order to find solid cosmological bounds on the axion mass. A proper tool to follow the axion number density $n_a$ in the early Universe is the Boltzmann equation \be \frac{dn_{a}}{dt}+3Hn_{a}= \gamma_{a}\left(1-\frac{n_{a}}{n_{a}^{\rm eq}}\right)\ . \ee Here, $n_a^{\rm eq}$ is the axion equilibrium number density and $\gamma_{a}$ accounts for axion number-changing processes. The latter quantity is connected to the interaction rate $\Gamma_a$ introduced before via the relation $\gamma_a = n_a^{\rm eq} \Gamma_a$. We find it convenient to rewrite the Boltzmann equation in terms of dimensionless quantities. We switch to the comoving density $Y_a$ already introduced before, and we trade the time variable $t$ with the dimensionless combination $x\equiv M / T$. The overall mass scale $M$ is purely conventional and it can be chosen to make the numerical solution easier. The Boltzmann equation reads \be \frac{dY_{a}}{d\log x}=-\left(1-\frac{1}{3}\frac{d\log g_{\star s}}{d \log x}\right)\frac{\gamma_{a}(x)}{H(x)s(x)}\left(1-\frac{Y_{a}}{Y_{a}^{\rm eq}}\right) \ . \ee We solve this equation from an initial temperature at the TeV scale and we choose two boundary conditions: axions initially in thermal equilibrium, and vanishing initial axion population. As shown explicitly by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb}, for the axion mass range studied here ($m_a \gtrsim 0.1 \, {\rm eV}$) the initial condition does not matter if we start the evolution above the weak scale. We solve the Bolzmann equation numerically down to temperatures well below the mass scale of particles participating in the production processes, and we find that the axion yield $Y_{a}$ reaches a constant value. \autoref{fig:maYa} shows the final axion comoving density for both the KSVZ and the DFSZ cases, and for the latter we choose two different values of $\tan\beta$. For comparison, we show again the result of the previous analysis in Ref.~\cite{Giare:2020vzo} for the couplings to gluons and pions. The actual axion relic density is substantially larger than previously estimated. We also notice how the value of $\tan\beta$ does not alter the resulting axion abundance significantly, and in what follows we fix $\tan\beta = 3$ for the DFSZ axion case. \begin{figure} \centering \includegraphics[width=\columnwidth]{new_maYa.png} \caption{Asymptotic axion yield $Y_a^\infty$ as a function of $m_a$ (lower horizontal axis) and $f_a$ (upper horizontal axis). The right vertical axis identifies the correspondent values of $\Delta N_{\rm eff}$ and $n_{a,0}\equiv n_a(T_0)$. Solid lines are obtained via a Boltzmann equation solution. We show with dashed lines also the results of Ref.~\cite{Giare:2020vzo} for axion couplings to gluons and pions.} \label{fig:maYa} \end{figure} \section{Cosmological Analysis} \label{sec.Cosmo} As aforementioned in the introduction, QCD axions thermally produced in the early Universe can leave distinctive signatures in different cosmological observables that we shall review in what follows. We study the Universe at the times of BBN and recombination where the axions are not in thermal equilibrium with the thermal bath anymore. For this reason, we cannot use a single bath temperature $T$ as done in the previous section but we need to distinguish among the different temperatures for photons ($T_\gamma$), neutrinos ($T_\nu$), and axions ($T_a$). \subsection{Thermal Axion Cosmology} \label{sec.Cosmo.Theory} As along as thermal axions remain relativistic particles ($T_a\gg m_a$), they behave as radiation in the early Universe and their cosmological effects are those produced via their contribution to the effective number of neutrino species $N_{\rm eff}$. We recall its definition via the energy density of radiation as a function of the redshift $z$ \begin{equation} \rho_{\rm rad}(z)=\frac{\pi^2}{30}\left[ 2 T^4_{\gamma}(z) + \frac{7}{4} N_{\rm eff} T^4_{\nu}(z)\right]~ . \end{equation} Light relativistic axions will provide an additional contribution $\Delta \rho_{\rm rad}(z)\propto T_a^4(z)$ that we parameterize in terms of a correction $\Delta N_{\rm eff} \equiv N_{\rm eff}-3.044$ to the effective number of neutrino species with respect to the SM.\footnote{We recall that the effective number of neutrino species in the SM is $N^{\rm SM}_{\rm eff}=3.044$, see Ref.~\cite{Bennett:2020zkv} and references therein.} By means of the Boltzmann equation outlined in the previous section, it is possible to evaluate this correction as $\Delta N_{\rm eff}\simeq 75.6\,\left(Y_a^{\infty}\right)^{4/3}$ and retrace the effects of relativistic axions through the different cosmological epochs. Current limits on $\Delta N_{\rm eff}$ arise primarily from observables at two epochs: \textit{(i)} at the BBN period, and, \textit{(ii)} at the Recombination epoch. BBN is a cornerstone of Hot Big Bang cosmology since it explains the formation of the first light nuclei (heavier than the lightest isotope of hydrogen) by a solid understanding of the nuclear interactions involved in the production of elements. It also provides a natural laboratory to test extensions of the SM of elementary particles that involve additional relativistic species. Indeed, additional contributions to $\Delta N_{\rm eff}$ will increase the expansion rate $H(z)$ by Eq.\eqref{eq:Friedmann} and lead to a higher freeze-out temperature of the weak interactions, implying a higher fraction of primordial Helium and Deuterium (as well as a higher fraction of other primordial elements). This makes BBN a powerful tool for constraining the total amount of relativistic species and beyond the SM physics frameworks: given a concrete model, we can solve numerically the set of differential equations that regulate the nuclear interactions in the primordial plasma~\cite{PitrouEtal2018,Pisanti:2007hk,Consiglio:2017pot,Gariazzo:2021iiu}, compute the light element abundances and compare the results to the values inferred by astrophysical and cosmological observations. Given current uncertainties, the standard BBN predictions show a good agreement with direct measurements of primordial abundances~\cite{Pitrou:2020etk,Mossa:2020gjc,Pisanti:2020efz,Yeh:2020mgl} limiting $\Delta N_{\rm eff}\lesssim 0.3-0.4$ at 95\% CL. Notice also that BBN is expected to start at temperatures of the order of 1 MeV (after the neutrino decoupling) and end well before the recombination epoch. Therefore this bound can be safely applied to all thermal axions that are relativistic in this range of temperatures and it is highly independent of recombination processes. Conversely, the BBN predictions for the Helium abundance can impact the CMB angular spectra because they can be used to estimate the baryon energy density through a simple formula~\cite{Serpico:2004gx} \be \Omega_b h^2 = \frac{1 - 0.007125\ Y_p^{\rm BBN}}{273.279}\left(\frac{T_{\rm CMB}}{2.7255\ \mathrm{K}}\right)^3 \eta_{10} \ . \label{eq.Yp} \ee Here, $\eta_{10} \equiv 10^{10}n_b/n_\gamma $ is the photon-baryon ratio today, $T_{\rm CMB} $ is the CMB temperature at the present time and $Y_p^{\rm BBN} \equiv 4 n_{\rm He}/n_{b}$ is the Helium \textit{nucleon fraction} defined as the ratio of the 4-Helium to the baryon density one.\footnote{We will provide results in term of the Helium \textit{mass fraction} defined as $Y_P = Y_{\rm{He4}} \,m_{\rm{He4}} /[Y_{\rm{He4}}\, m_{\rm{He4}} + (1 - 4\,Y_{\rm{He4}}) \,m_{\rm{H1}}]$ with $ Y_{\rm{He4}}=1/4 \,Y_{p}^{\rm {BBN}}$, $m_{\rm{He4}}\simeq 4.0026$, and $m_{\rm{H1}}\simeq 1.0078$.} Considering lower temperatures, additional dark radiation at recombination leads to some characteristic signatures in the CMB temperature angular power spectrum, modifying the damping tail and changing two important scales: the sound horizon and the Silk damping scale~\cite{Hou:2011ec,Archidiacono:2013fha}. The final release of Planck 2018 temperature and polarization data constrains $\Delta N_{\rm eff}\lesssim 0.4$ at 95\% CL ~\cite{Akrami:2018vks}, basically providing the same sensitivity on additional relativistic relics as BBN constraints. However, in this case, axions must behave as relativistic particles at recombination, i.e. $m_{a}\lesssim T_a(z_{\rm{LS}})$ (where $z_{\rm{LS}}\simeq 1100$ is the redshift corresponding to the last scattering surface). The temperature of a population of axion decoupled from the thermal bath at $T_{\rm D}$ at recombination is given by \begin{equation} T_a(z_{\rm{LS}}) \simeq T_{\rm rec} \times \left(\frac{2}{g_{\star}(T_{\rm D})}\right)^{1/3}~, \label{eq:TaLS} \end{equation} with $T_{\rm rec}\simeq 0.3$ eV. Consequently only very light axions ($m_a\lesssim 0.1$~eV) are still relativistic during this epoch. \\ When axions become non-relativistic they contribute to the total amount of (hot dark) matter of the Universe. We quantify this contribution via the parameter $\Omega_a$ that, in the non-relativistic regime, reads \begin{equation} \Omega_a \, h^2 \simeq \frac{m_a\,n_a}{1.054\cdot 10^4\,\rm{eV}\,\rm{cm}^{-3}}~. \end{equation} Non-relativistic axions leave signatures similar to massive neutrinos, suppressing structure formation at scales smaller than their free-streaming length and leaving an imprint on the CMB temperature anisotropies via the early integrated Sachs-Wolfe effect. Therefore we expect the axion and total neutrino masses to be anti-correlated: increasing the axion mass leads to a larger hot dark matter component so that the contributions from massive neutrinos should be reduced to keep the total amount of hot dark matter consistent with the data. This is one of the reasons why multi-messenger analysis of the axion and neutrino effects on cosmological scales turned out to be a very promising tool for constraining their properties, also with direct implications for current and future direct experiments. Hence in the following analysis we study a realistic mixed hot dark matter scenario of axions and neutrinos taking also into account a possible non-vanishing neutrino mass, as robustly established by oscillation experiments~\citep{deSalas:2020pgw,deSalas:2018bym}. \subsection{Numerical Implementation} \label{sec.Cosmo.Implementation} In order to fully address the different effects induced by a relic population of thermal axions, we use a modified version of the latest version of the cosmological Boltzmann integrator code \textsc{CAMB} \citep{Lewis:1999bs,Howlett:2012mh}. In particular, the code has been modified to describe the QCD axion effects on cosmological scales only in terms of the axion mass that we include as an additional cosmological parameter in our analyses. For each value of the axion mass, the numerical calculation provides the axion contribution through various cosmological epochs, switching between the relativistic and non-relativistic regime (\autoref{fig:Density}). In what follows, we briefly retrace the modifications in the code and how we implemented them. The QCD axion mass window of interest for this analysis ranges from $0.1$ eV to $10$ eV. Given current bounds on hot thermal relics (see e.g. Ref.~\cite{Giare:2020vzo}), the axion is always relativistic during the BBN, contributing as additional dark radiation and modifying the theoretical predictions for the abundance of primordial elements. We make use of the code \textsc{PArthENoPE}~\citep{Gariazzo:2021iiu} to quantify these effects. Starting from the input values of $N_\mathrm{eff}$, the neutron lifetime $\tau_n$ and the baryon energy density $\Omega_b h^2$, we evaluate the primordial light element abundances by solving numerically a set of differential equations that regulate the nuclear interactions in the primordial plasma after neutrino decoupling ($T \gtrsim 1$ MeV) until the end of BBN ($T \sim 10$ keV). We include the BBN predictions in our analyses, following the same procedure adopted by the Planck collaboration~\citep{Aghanim:2018eyx}: we fix the neutron lifetime to $\tau_n = 879.4$ s, corresponding to the latest value reported by the Particle Data Group ($\tau_n = 879.4 \pm 0.6 $ s)~\citep{ParticleDataGroup:2020ssz} and create an interpolation grid varying $\Omega_b h^2 $ and $\Delta N_\mathrm{eff}$ within $\Delta N_\mathrm{eff} \in [0 ; 3]$ and $\Omega_b h^2 \in [0.0073 ; 0.033]$, respectively. In this way, for each value of the axion mass, we compute the corresponding $\Delta N_{\rm eff}(m_a)$ by solving the Boltzmann equation and the corresponding BBN predictions for all the light elements, from $\rm H$ up to $^7\rm Li$. Very light axions ($m_a\sim 0.1$ eV) are still relativistic at recombination and thus they modify the CMB angular spectra always trough their effects in $\Delta N_{\rm eff}$. Notice however that the correction to the effective number of relativistic particles coming from the tiny mass values aforementioned ($m_a\sim 0.1$ eV) is typically beyond the the sensitivity of current CMB data, while it can be relevant for future CMB stage-4 experiments~\cite{Giare:2021cqr}. Heavier axions, although relativistic during the BBN epoch, can be highly non-relativistic at recombination. In this case, they impact the CMB angular power spectra both indirectly (through their modification of the primordial Helium abundance during BBN) and directly (by the early integrated Sachs-Wolfe effect, increasing the amount of hot dark matter, similarly to massive neutrinos). We consider both effects. For the former one, a combined analysis of CMB and BBN data strongly disfavors contributions larger than $\Delta N_{\rm eff}\gtrsim 0.4$ (at both epochs) thus setting a robust upper limit on additional dark radiation in the early Universe. For the latter case, we dynamically evolve the axion energy density $\Omega_a(t)$ during all the cosmological evolution via the same procedure used for massive neutrinos and properly calculate the late-time effects on the matter power spectrum and structure formation. As an explicit example, \autoref{fig:Density} shows the energy density as a function of the scale factor for photons, axions, neutrinos and cold dark matter (assuming $m_a=1$~eV and $\sum m_\nu =0.06$~eV). Both neutrinos and axions behave as radiation at early times, and they become a sub-dominant dark matter contribution once they turn non-relativistic. For the specific mass values chosen to produce \autoref{fig:Density}, one can also appreciate that the contribution to the energy density of massive neutrinos and axions may differ significantly. In particular, axions with masses larger than $0.1$ eV become non-relativistic before the CMB time thus they start contributing to the matter density earlier (than neutrinos) leading to a significant impact on structure formation. As we shall see below, this feature will allow us to put stringent constraints on axion masses using large scale structure data. When the two species has similar masses, the evolution of their energy densities is preventing us to constrain axion masses that are smaller than the current bounds on neutrino masses $\sum m_\nu \lesssim 0.2 $ eV. \begin{figure} \centering \includegraphics[width=\columnwidth]{Densities.pdf} \caption{Energy density, normalized to the critical density, as a function of the scale factor for photons, massive neutrinos, axions and cold dark matter. An axion mass $m_a=1$~eV and a total neutrino mass $\sum m_\nu=0.06$~eV have been assumed (see the main text for details). The dashed vertical line represents approximately the value of the scale factor at recombination.} \label{fig:Density} \end{figure} \section{Results} \label{sec.Results} \subsection{Results from BBN} \label{sec.Results.BBN} \begin{table*} \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.6\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{Constraints from BBN only}}\\[0.2cm] \hline \textbf{\nq{Parameter \\}} & \textbf{\nq{BBN-A\\($Y_p + \Omega_b\,h^2$)}} & \textbf{\nq{BBN-B\\($Y_p + D/H$)}} & \textbf{\nq{BBN-C\\($Y_p + D/H + \Omega_b\,h^2$)}} \\ \hline\hline \multicolumn{4}{c}{\textbf{KSVZ Axion Model}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240^{+0.00020}_{-0.00020}$&$0.02251^{+0.00021}_{-0.00026}$&$0.022413\pm 0.000088$\\ $Y_p$ &$0.24682^{+0.00073}_{-0.0015}$&$0.24681^{+0.00079}_{-0.0015}$&$0.24638^{+0.00042}_{-0.00064}$\\ $10^{5}\cdot(D/H)$ &$2.547^{+0.030}_{-0.041}$&$2.527\pm 0.030$&$2.533\pm 0.019$\\ $\Delta N_{\rm eff}$ &$< 0.31$ \,\,$(< 0.40)$&$< 0.30\,\,(<0.40)$&$< 0.14\,\,(< 0.21)$\\ $m_a$ [eV] &$< 0.61 \,\, (< 3.6)$&$<0.53\,\, (<3.0 )$&$< 0.16\,\,(<0.25)$\\ $f_a$ [$10^7$ GeV]&$>0.934\, (>0.158)$&$>1.07\,(>0.19)$&$>3.56\,(>2.28)$\\ \hline \hline \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=3$)}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240\pm 0.00010$&$0.02249^{+0.00022}_{-0.00027}$&$0.022407\pm 0.000089$\\ $Y_p$ &$0.24668^{+0.00075}_{-0.0016}$&$0.24665^{+0.00082}_{-0.0016}$&$0.24621^{+0.00045}_{-0.00068} $\\ $10^{5}\cdot(D/H)$ &$2.543^{+0.031}_{-0.044}$&$2.526\pm 0.030$&$2.530\pm 0.019$\\ $\Delta N_{\rm eff}$ &$< 0.32\,\,(< 0.41)$&$< 0.30\,\,(< 0.41)$&$< 0.14\,\,(< 0.20)$\\ $m_a$ [eV] &$< 0.40\,\,(< 2.4)$&$< 0.33\,\,(< 2.0)$&$< 0.10\,\,(< 0.15)$\\ $f_a$ [$10^7$ GeV] &$>1.42\,(>0.23)$&$>1.73\,(>0.28)$&$>5.7\,(>3.8)$\\ \hline \hline \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=10$)}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240\pm 0.00010$&$0.02249^{+0.00022}_{-0.00027}$&$0.022407\pm 0.000089$\\ $Y_p$ &$0.24671^{+0.00077}_{-0.0017}$&$0.24668^{+0.00086}_{-0.0017}$&$0.24622^{+0.00049}_{-0.00076}$\\ $10^{5}\cdot(D/H)$ &$2.544^{+0.032}_{-0.045}$&$2.526\pm 0.030$&$2.530\pm 0.020$\\ $\Delta N_{\rm eff}$ &$< 0.33\,\,(< 0.42)$&$< 0.31\,\,(< 0.41)$&$< 0.14\,\,(< 0.21)$\\ $m_a$ [eV] &$< 0.40\,\,(< 2.5)$&$< 0.33\,\,(< 2.0)$&$< 0.10\,\,(< 0.15)$\\ $f_a$ [$10^7$ GeV] &$>1.42\,(>0.23)$&$>1.73\,(>0.28)$&$>5.7\,(>3.8)$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained from BBN primordial abundances. The constraints on $\Omega_{\rm b} h^2$ , $Y_p$ and $10^{5}\cdot(D/H)$ are given at 68\%CL while the upper bounds on $\Delta N_{\rm eff}$ and $m_a$ are given both at 95\% and 99\% CL.} \label{tab.BBN} \end{table*} \begin{figure*} \centering \includegraphics[width=\textwidth]{KSVZ_BBN.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the KSVZ QCD axion scenario. The different colors refer to the different data combinations here considered for BBN analyses, see \autoref{tab.BBN}.} \label{fig:KSVZ_BBN} \end{figure*} \begin{figure*} \centering \includegraphics[width=\textwidth]{DFSZ_BBN_b3.pdf} \caption{As \autoref{fig:KSVZ_BBN} but for the DFSZ QCD axion scenario. Since the results shown in Tab.~\ref{tab.BBN} demonstrate that the constraints in this axion cosmological scenario are almost independent of the $\beta$ parameter, we only illustrate here the case $\tan \beta=3$.} \label{fig:DFSZ_BBN} \end{figure*} It is instructive to start studying the constraints on thermal QCD axions restricting the analysis only to the BBN epoch. As explained in the previous section, the only effect of the axion during BBN is its contribution to the radiation energy density of the Universe via $\Delta N_{\rm eff}$. Independent astrophysical and cosmological measurements of primordial light element abundances limit the amount of additional dark radiation and thus impose an upper bound on the mass of the axion. Our baseline dataset for the BBN analyses consists of \begin{itemize} \item Two independent measurements of the primordial Helium \textit{mass fraction}, $Y_p = 0.2449 \pm 0.0040$ \cite{Aver:2015iza} and $Y_p = 0.2446\pm 0.0029$ \cite{Peimbert:2016bdg}. \item A percent determination of the primordial Deuterium abundance $D/H=\left(2.527\pm0.030\right)\cdot 10^{-5}$ based on six high precision and homogeneously analyzed $D/H$ measurements from \cite{Cooke:2017cwo}. \item The value of the baryon energy density parameter $\Omega_b\,h^2=0.0224 \pm 0.0001$ from the final 2018 Planck data release of temperature and polarization CMB angular power spectra \cite{Aghanim:2018eyx}. \end{itemize} We randomly sample $N=10^6$ linearly distributed values of the axion mass in the range $m_a\in[0.1\,,\,10]$ eV and of the baryon energy density in the range $\Omega_b h^2\in\left[0.020\,,\,0.025 \right]$. For each value of the axion mass, we compute the axion contribution to the effective number of neutrino species $\Delta N_{\rm eff} (m_a)$ by solving the Boltzmann equation. Given a set of points $(\Delta N_{\rm eff} ,\Omega_b h^2)$, we compute the BBN predictions for the primordial light elements by means of the publicly available code \textsc{PArthENoPE}, following the procedure outlined in the previous section. We therefore create a grid of points in the $(\Delta N_{\rm eff} ,\Omega_b h^2)$ plane similar to those usually obtained within the Monte Carlo methods. We then apply the priors on the BBN abundances, re-weighting the contributions of the points by means of an ``importance sampling'' method. As a result, we obtain informative posterior distributions for the parameters to be inferred by observations such as the axion mass and $\Delta N_{\rm eff}$. We apply this methodology to the KSVZ and DFSZ axion models. \autoref{tab.BBN} summarizes our results, \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN} provide the marginalized posterior distributions of parameters for the KSVZ and the DFSZ axion models, respectively. For the latter model, we fix the additional free parameter $\beta$ to two different values, $\tan \beta= \{3, 10\}$. As a common practice, we start adopting prior information on the total amount of the primordial Helium $Y_p$ and the baryon energy density $\Omega_b\,h^2$. We refer to this dataset as ``BBN-A ($Y_p + \Omega_b\,h^2$)'', which provides an upper limit on the additional dark radiation allowed during BBN $\Delta N_{\rm eff}<0.3$ at 95\% CL ( $\Delta N_{\rm eff}<0.4$ at 99\% CL), in perfect agreement with previous results discussed in literature~\cite{Giare:2020vzo}. Notice also that this bound remains unchanged for both models of axions, as expected. For the KSVZ scenario, this limit is translated into an upper bound on the axion mass of $m_a<0.6$ eV at 95\%CL ($m_a<3.6$ eV at 99\%CL). The axion contribution to $\Delta N_{\rm eff}$ is typically larger within the DFSZ model, and fixing $\tan \beta=3$ we obtain a slightly more constraining bound $m_a<0.4$ eV at 95\%CL ($m_a<2.4$ eV at 99\%CL). Performing the very same analysis with $\tan \beta=10$ the result does not change, proving that differences between the two cases remain too small to be observed given the current uncertainties, see also \autoref{fig:DFSZ_BBN} and \autoref{tab.BBN}. Finally, the constraints on the total amount of primordial Deuterium are at the percent level $D/H\simeq 2.54^{+0.03}_{-0.04}\cdot 10^{-5}$ (at 68\% CL) for both KSVZ and DFSZ models. Since in the analysis labeled here as BBN-A we are not assuming any prior information on Deuterium, this result can be compared to direct astrophysical measurements ($D/H\simeq 2.527\pm 0.030 \cdot 10^{-5}$), showing a perfect agreement and providing a robust consistency check. Notice however that these results are derived assuming a prior knowledge of the baryon-energy density as inferred by the Plank collaboration analyzing the last release of the CMB data. In order to remain completely independent on the physics at the recombination epoch, we repeat the same analysis by relaxing the prior on $\Omega_b h^2$ and combining instead with information on the total amount of both primordial Helium $Y_p$ and Deuterium $D/H$ from direct astrophysical measurements. We refer to this dataset as ``BBN-B($Y_p + D/H$)''. Also in this case, we derive exactly the same limit $\Delta N_{\rm eff}<0.3$ at 95\%CL ($\Delta N_{\rm eff}<0.4$ at 99\% CL) on additional dark radiation at the BBN epoch. However, the bound on the axion mass slightly changes with respect to the case BBN-A because of the different correlations among the parameters. In particular, assuming the prior on $D/H$ breaks the strong positive correlation between primordial Deuterium and the axion mass present in the previous case, see also \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN}. This leads to a small improvement in the axion mass limit: $m_a<0.5$ eV at 95\%CL ($m_a<3.0$ eV at 99\%CL) for the KSVZ axion, and $m_a<0.3$ eV at 95\%CL ($m_a<2.0$ eV at 99\%CL) for the DFSZ model (again with no differences between $\tan \beta=3$ and $\tan\beta=10$). We are not imposing any prior information on the baryon mass-energy density, which turns out to be $\Omega_b\,h^2=0.0225^{+0.0002}_{-0.0003}$ both for the KSVZ and DFSZ models. Since this bounds is derived only by assuming a prior knowledge of primordial abundances of Helium and Deuterium, it is completely independent from the CMB and thus can be compared with the value inferred by Planck collaboration ($\Omega_b\,h^2=0.0224 \pm 0.0001$), showing again a perfect agreement and providing another important consistency check of our numerical analyses. Finally, for completeness, we combine all the three priors together, referring to this dataset as ``BBN-C($Y_p+D/H+\Omega_b\,h^2$)''. This combination provides an improvement in the constraining power on the different parameters, leading to the limit $\Delta N_{\rm eff}<0.14$ at 95\% CL ($\Delta N_{\rm eff}<0.2$ at 99\% CL). This is a factor $\sim 2$ stronger than the bound from the previous two datasets (BBN-A and BBN-B). Consequently, the limits on the axion mass are also improved, obtaining in this case $m_a<0.16$ eV at 95\% CL ($m_a<0.25$~eV at 99\% CL) for the KSVZ model and $m_a<0.10$ eV at 95\% CL ($m_a<0.15$~eV at 99\% CL) for the DFSZ scenario. While this improvement is of course interesting to be noticed, it is also worth stressing that the combination of three different priors from the BBN perspective is not needed, as only two input parameters (\textit{i.e.}, $\Delta N_{\rm eff}$ and $\Omega_b\,h^2$) are required to compute all the light element abundances. Nevertheless, the additional constraints do not produce shifts or biases in the results, and only reduce the uncertainties, see also \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN}, reassessing the consistency among the data sets used here, which show no tensions, and further confirming the robustness of our analyses. \subsection{Results from the full cosmological analyses} The previous results have shown that the axion contribution to the radiation energy density is severely constrained during the BBN epoch both by direct astrophysical measurements of primordial light abundances and by constraints on the baryon energy density, limiting the allowed axion masses to the sub-eV range. Nevertheless the analyses carried out so far focused exclusively on a precise cosmological era, ignoring the subsequent Universe evolution. We shall perform in what follows a comprehensive analysis, addressing all the axion contributions towards the different cosmological epochs/scales. The fiducial cosmological model is a \emph{hot-relic} extension of the $\Lambda$CDM model, including both axions and neutrinos as hot thermal massive relics. We perform Monte Carlo Markov Chain (MCMC) analyses using the publicly available version of the \textsc{COBAYA} software~\citep{Torrado:2020xyz} and computing the theoretical model with the modified version of the cosmological Boltzmann integrator code \textsc{CAMB} \citep{Lewis:1999bs,Howlett:2012mh} described in \autoref{sec.Cosmo.Implementation}. In addition to the $\Lambda$CDM six-parameter model (\emph{i.e.}, the baryon $\omega_{\rm b}\equiv \Omega_{\rm b}h^2$ and cold dark matter $\omega_{\rm c}\equiv\Omega_{\rm c}h^2$ energy densities, the angular size of the horizon at the last scattering surface $\theta_{\rm{MC}}$, the optical depth $\tau$, the amplitude of primordial scalar perturbation $\log(10^{10}A_{\rm S})$ and the scalar spectral index $n_{\rm S}$), we add the axion mass $m_a$ and the sum of three active neutrino masses $\sum m_{\nu}$ (both in $\rm{eV}$). Concerning the QCD axion, we perform two separate analyses for the KSVZ and DFSZ frameworks.\footnote{The previous BBN analyses have shown that changes in the $\beta$ parameter are negligible. Therefore, in the full MCMC analysis within the DFSZ scenario we shall fix $\tan \beta=3$.} We choose flat prior-distributions for all the different cosmological parameters (unless otherwise stated), varying them uniformly in the conservative ranges listed in \autoref{tab.Priors}. We explore the posteriors of our parameter space using the MCMC sampler developed for \texttt{CosmoMC}~\cite{Lewis:2002ah,Lewis:2013hha}, see also Ref.~\cite{Neal:2005} for details concerning the ``fast dragging'' procedure used in our sampling method. The convergence of the chains obtained with this procedure is tested using the Gelman-Rubin criterion~\cite{Gelman:1992zz} and we choose as a threshold for chain convergence $R-1 \lesssim 0.02 $. Concerning observational constraints, our baseline data-set includes: \begin{itemize} \item Planck 2018 temperature and polarization (TT TE EE) likelihood, which also includes low multipole data ($\ell < 30$)~\citep{Aghanim:2019ame,Aghanim:2018eyx,Akrami:2018vks}. We refer to this combination as ``Planck 2018''. \item Planck 2018 lensing likelihood~\citep{Aghanim:2018oex}, constructed from measurements of the power spectrum of the lensing potential. We refer to this dataset as ``lensing''. \item Baryon Acoustic Oscillations (BAO) measurements extracted from data from the 6dFGS~\cite{Beutler:2011hx}, SDSS MGS~\cite{Ross:2014qpa} and BOSS DR12~\cite{Alam:2016hwk} surveys. We refer to this dataset combination as ``BAO''. \end{itemize} \label{sec.Results.CMB} \begin{table} \begin{center} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c@{\hspace{0. cm}}@{\hspace{1.5 cm}} c} \hline \textbf{Parameter} & \textbf{Prior} \\ \hline\hline $\Omega_{\rm b} h^2$ & $[0.005\,,\,0.1]$ \\ $\Omega_{\rm c} h^2$ & $[0.001\,,\,0.99]$\\ $100\,\theta_{\rm {MC}}$ & $[0.5\,,\,10]$ \\ $\tau$ & $[0.01\,,\,0.8]$\\ $\log(10^{10}A_{\rm S})$ & $[1.61\,,\,3.91]$ \\ $n_{\rm s}$ & $[0.8\,,\, 1.2]$ \\ $\sum m_{\nu}$ [eV] & $[0.06\,,\,5]$\\ $m_a$ [eV] & $[0.1\,,\,10]$\\ \hline\hline \end{tabular} \caption{List of the parameter priors.} \label{tab.Priors} \end{center} \end{table} \begin{table*}[htpb!] \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{KSVZ Axion Model}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{\nq{Planck 2018\\ (TT TE EE) }} & \textbf{\nq{Planck 2018\\+ lensing}} & \textbf{\nq{Planck 2018\\+lensing+BAO}} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02244\pm 0.00017$&$0.02243\pm 0.00015$&$0.02250\pm 0.00015$\\ $\Omega_{\rm c} h^2$ &$0.1224^{+0.0018}_{-0.0021}$&$0.1225^{+0.0016}_{-0.0022}$&$0.1208^{+0.0012}_{-0.0014}$\\ $100\,\theta_{\rm {MC}}$ &$1.04060^{+0.00038}_{-0.00034}$&$1.04058\pm 0.00036$&$1.04081\pm 0.00032$\\ $\tau$ &$0.0557\pm 0.0079$&$0.0564\pm 0.0076$&$0.0581^{+0.0070}_{-0.0080}$\\ $\log(10^{10}A_{\rm S})$ &$3.053\pm 0.017 $&$3.055^{+0.015}_{-0.016}$&$3.055^{+0.014}_{-0.016}$\\ $n_s$ &$0.9687\pm 0.0051$&$0.9681\pm 0.0049$&$0.9703\pm 0.0043$\\ $m_a$ [eV] &$< 1.04\,\,(< 1.86)$&$< 0.888\,\,(< 1.67)$&$< 0.282\,\,(< 0.420)$\\ $f_a$ [$10^{7}$ GeV]&$>0.55\,(>0.31)$&$>0.64\,(>0.34)$&$>2.02\,(>1.35)$\\ $\sum m_{\nu}$ [eV] &$< 0.297\,\,(< 0.422)$&$< 0.278\,\,(< 0.381)$&$<0.156\,\,(< 0.192)$\\ $\Delta N_{\rm eff}$ &$< 0.349\,\,(< 0.378)$&$< 0.340\,\,(<0.373)$&$< 0.226\,\,(< 0.275)$\\ $Y_P$&$0.24746^{+0.00077}_{-0.0017} $&$0.24741^{+0.00074}_{-0.0016}$&$0.24693^{+0.00048}_{-0.00097}$\\ $10^5\cdot (D/H)$&$2.556^{+0.033}_{-0.042}$&$2.558^{+0.029}_{-0.040}$&$2.531\pm 0.028$\\ $H_0$ [Km/s/Mpc] &$67.0^{+1.2}_{-0.77}$&$66.9^{+1.2}_{-0.73}$&$67.90\pm 0.53$\\ $\sigma_8$ &$0.790^{+0.029}_{-0.012}$&$0.793^{+0.023}_{-0.011}$&$0.8052^{+0.0099}_{-0.0075}$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained for the KSVZ Axion Model. The constraints on parameters are given at 68\%CL while the upper bounds are given both at 95\% and at 99\% CL.} \label{tab.CMB.KSVZ} \end{table*} \begin{table*}[htpb!] \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=3$)}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{\nq{Planck 2018\\ (TT TE EE) }} & \textbf{\nq{Planck 2018\\+ lensing}} & \textbf{\nq{Planck 2018\\+lensing+BAO}} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02243\pm 0.00017$&$0.02244\pm 0.00017$&$0.02250\pm 0.00015$\\ $\Omega_{\rm c} h^2$ &$0.1223^{+0.0018}_{-0.0023}$&$ 0.1224^{+0.0017}_{-0.0024}$&$0.1208^{+0.0012}_{-0.0016}$\\ $100\,\theta_{\rm {MC}}$ &$1.04061^{+0.00039}_{-0.00035}$&$1.04061^{+0.00040}_{-0.00035}$&$1.04081\pm 0.00031$\\ $\tau$ &$ 0.0554\pm 0.0080 $&$0.0566^{+0.0071}_{-0.0081}$&$0.0576^{+0.0069}_{-0.0077}$\\ $\log(10^{10}A_{\rm S})$&$3.052\pm 0.017$&$3.055^{+0.015}_{-0.017}$&$3.054\pm 0.015$\\ $n_s$ &$0.9685\pm 0.0053 $&$0.9682\pm 0.0052 $&$0.9702^{+0.0042}_{-0.0048}$\\ $m_a$ [eV] &$< 0.710 \, (< 1.81)$&$ < 0.697 \, (< 1.42)$&$< 0.209 \, (< 0.293)$\\ $f_a$ [$10^7$ GeV] &$>0.80\,(>0.31)$&$>0.82\,(>0.40)$&$>2.72\,(>1.94)$\\ $\sum m_{\nu}$ [eV] &$< 0.312 \, (< 0.426)$&$< 0.288 \, (< 0.390)$&$< 0.157 \, (< 0.193)$\\ $\Delta N_{\rm eff}$ &$< 0.358 \, (< 0.401 ) $&$< 0.360\, (<0.392)$&$< 0.243\,(<0.290)$\\ $Y_P$&$0.24732^{+0.00077}_{-0.0018}$&$0.24731^{+0.00077}_{-0.0018}$&$0.24689^{+0.00061}_{-0.0012}$\\ $10^5\cdot (D/H)$&$2.554^{+0.032}_{-0.041}$&$2.554^{+0.032}_{-0.042}$&$2.531\pm 0.028$\\ $H_0$ [Km/s/Mpc] &$67.0^{+1.2}_{-0.82}$&$67.0^{+1.2}_{-0.79} $&$67.90\pm 0.58$\\ $\sigma_8$ &$0.792^{+0.027}_{-0.012}$&$0.794^{+0.022}_{-0.010}$&$0.8059^{+0.0093}_{-0.0071}$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained for the DFSZ Axion Model ($\tan \beta=3$). The constraints on parameters are given at 68\%CL while the upper bounds are given both at 95\% and at 99\% CL.} \label{tab.CMB.DFSZ} \end{table*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Planck_KSVZ.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the KSVZ QCD axion scenario. The different colors refer to the different data combinations considered for MCMC analyses, see \autoref{tab.CMB.KSVZ}.} \label{fig:Planck_KSVZ} \end{figure*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Planck_DFSZ.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the DFSZ QCD axion scenario with $\tan \beta=3$. The different colors refer to the different data combinations considered for MCMC analyses, see \autoref{tab.CMB.DFSZ}.} \label{fig:Planck_DSFZ} \end{figure*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Elements.pdf} \caption{Constraints on the primordial abundance of Helium-4 ($Y_p$, left panel) and Deuterium ($D/H$, right panel) derived within the different methods and data-set detailed in the manuscript. The pink bands identify $68\%$ C.L. from current astrophysical determinations of $Y_p$ \cite{Aver:2015iza} and $D/H$ \cite{Cooke:2017cwo}.} \label{fig:Elements} \end{figure*} In particular, combining the Planck (TT TE EE) spectra with the Planck lensing measurement can be useful to gain some additional sensitivity on parameters that affect both the late-time expansion and the background geometry while the inclusion of the large-scale structure information from BAO measurements from galaxy surveys turns out to become crucial to set bounds on the amount of dark matter in the form of hot relics, as axions and/or neutrinos, as it is a powerful way to break degeneracy in the geometrical sector. We summarize the constraints on the cosmological parameters (at 68\% CL) and the upper bounds on the axion and neutrino masses (both at 95\% and 99\% CL) in \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ} for the KSVZ and DFSZ model, respectively. We also show the corresponding 1D and 2D marginalized posteriors in \autoref{fig:Planck_KSVZ} and in \autoref{fig:Planck_DSFZ}. As concerns the KSVZ axion model, exploiting the 2018 release of Planck temperature and polarization (TT TE EE) data, we derive the upper bound $m_a<1.04\,\rm{eV}$ at 95\% CL ($m_a<1.86\,\rm{eV}$ at 99\% CL) on the axion mass and $\sum m_{\nu}<0.297\,\rm{eV}$ at 95\% CL ($\sum m_{\nu}<0.422\,\rm{eV}$ at 99\% CL) on the sum of the neutrino masses. Notice that now the 95\% CL bound on the axion mass is much less constraining than those previously derived in \autoref{sec.Results.BBN}. Indeed, in this case we have many more parameters and therefore way more degeneracies, especially for the case of the neutrino mass and the cold dark matter energy density. Additionally, we include here the BBN predictions in the MCMC analysis by relating $\Omega_b$ and $Y_P$ through \autoref{eq.Yp} and thus without including direct astrophysical measurements of primordial abundances. While we obtain a slightly less constraining upper limit (even if perfectly consistent with the previous bounds from BBN light element abundances) for the total amount of extra dark radiation due to the axion contribution, $\Delta N_{\rm eff}<0.349$ at 95\% CL, the CMB analyses are fully consistent with both the standard BBN predictions and direct astrophysical measurements, see also \autoref{tab.CMB.KSVZ} and \autoref{fig:Elements} where we compare the values of $Y_P$ and $D/H$ as inferred by the different analysis and datasets. In particular, \autoref{fig:Elements} clearly states the agreement from the different data combinations considered along this study in the extraction of primordial element abundances, reassessing the limits on the different cosmological parameters derived here. Interestingly, the 99\% CL limits on the axion mass turn out to be more constrained than the BBN 99\% CL bounds, especially when including large scale structure observations. This is due to the fact that the large masses allowed within the 99\% CL contours during BBN are now excluded by their late-time effects on structure formation (providing also evidence about the importance of extending the analysis to all the different cosmological epochs and scales). As concerns the other datasets considered in our analyses, we may appreciate that the inclusion of CMB lensing measurements from the Planck satellite improve both the KSVZ axion mass bound $m_a<0.888$ eV at 95\% CL ($m_a<1.67$ eV at 99\% CL) and the limit on neutrinos $\sum m_{\nu}<0.278$ eV at 95\% CL ($\sum m_a<0.381$ eV at 99\% CL). However, as aforementioned, the most significant improvement comes from the inclusion of BAO data. QCD thermal axions and neutrinos are hot thermal relics with very large dispersion velocities, erasing structure formation below their free streaming scale, directly related to their mass. Therefore, none of these hot thermal species will contribute to structure formation at small scales, being the suppression of the matter power spectrum in the linear regime proportional to the amount of dark matter in the form of hot relics. Consequently, the addition of BAO observations leads to a robust upper limit of $m_a<0.282$ eV at 95\% CL ($m_a<0.420$ eV at 99\% CL) simultaneously improving the limit on the total neutrino mass to $\sum m_{\nu}<0.156$ eV at 95\% CL ($\sum m_a<0.192$ eV at 99\% CL). The same analyses for the DFSZ scenario leads to bounds similar to those obtained for the KSVZ axion (as in the BBN case of the previous section). In particular, analyzing the Planck (TT TE EE) data we obtain a more constraining bound on the axion mass with respect to the KSVZ scenario, namely: $m_a<0.710$ eV at 95\% CL ($m_a<1.81$ eV at 99\% CL). Including both lensing and BAO these limits are improved to $m_a<0.209$ eV at 95\% CL ($m_a<0.293$ eV at 99\% CL). Conversely, the limits on the total neutrino mass remain basically unchanged. Finally, we stress that the bounds on the axion mass obtained in this work are a factor $\sim 5$ better with respect to the results derived in Ref.~\cite{Giare:2020vzo} exploiting the very same data-sets. Indeed, in that case the analysis was performed for the axion-pion and the axion-gluon couplings separately. For the former, it was only considered the parameter space where the chiral perturbation theory approach was reliable (\textit{i.e.}, to decoupling temperatures smaller than $62$ MeV). Here, we have overcome both problems smoothly extending the thermal axion production across the QCD phase transition. Furthermore, we improve our predictions for the amount of axions by solving the Boltzmann equation instead of relying upon the instantaneous decoupling approximation. \subsection{A Forecast for CMB-S4 and DESI} One of the key targets of the Stage-IV CMB experiment (CMB-S4) is to increase the accuracy on extra dark radiation by almost an order of magnitude, opening to the possibility of robustly constraining the mass of thermal relics such as QCD axions~ \cite{Abazajian:2016yjj}. In addition, future observations of large scale structure will lead to highly accurate Baryon Acoustic Oscillation (BAO) data and are expected to provide an enormous improvement on the neutrino mass bound~\cite{DESI}. Here we conclude our analyses studying how these future experimental efforts will improve the constraining power on hot relics discussed so far. In particular, we simulate data for a CMB-S4-like \cite{Abazajian:2016yjj} observatory and for a DESI-like \cite{DESI,DESI:2013agm} BAO galaxy survey. These two future probes are expected to provide scientific results in the next few years and have been carefully designed to significantly improve the constraints on the neutrino sector and other forms of dark radiation, see e.g. Refs.~\cite{Abazajian:2016yjj,DESI,constraint_neutrino_stageIV,Abazajian:2019oqj}. \begin{table*} \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7 \textwidth}{!}{\begin{tabular}{c c c c } \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{Forecast $\Lambda$CDM +$m_a=1$eV}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{Fiducial Value} & \textbf{CMB-S4} & \textbf{CMB-S4 + DESI} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.0224$&$0.022399\pm 0.000035$&$0.022399\pm 0.000034$\\ $\Omega_{\rm c} h^2$ &$0.12$&$0.12050\pm 0.00059$&$0.11984\pm 0.00031$\\ $H_0$ [Km/s/Mpc]&$67.4$&$66.57^{+0.57}_{-0.44}$&$67.16\pm 0.22 $\\ $\tau$ &$0.05$&$0.0506^{+0.0024}_{-0.0026}$&$0.0511^{+0.0024}_{-0.0027}$\\ $\log(10^{10}A_{\rm S})$ &$3.044$&$3.0484\pm 0.0047$&$3.0475\pm 0.0047$\\ $n_s$ &$0.965$&$0.9622\pm 0.0021$&$0.9639\pm 0.0017$\\ $m_a$ [eV] &$1$&$1.13\pm 0.11$&$1.056^{+0.086}_{-0.075}$\\ $\sum m_{\nu}$ [eV] &$0.06$&$< 0.178\,\,(<0.220)$&$< 0.118\,\,(< 0.144)$\\ \hline \hline \end{tabular}} \end{center} \caption{Forecasted mean values, errors and upper bounds on the different cosmological parameters rising from CMB-S4 only and from CMB-S4 plus DESI. The forecasted errors on the parameters are given at 68\%CL, while the upper limits are given both at 95\% and at 99\% CL.} \label{tab.forecast} \end{table*} \begin{figure*} \centering \includegraphics[width=\textwidth]{Forecast.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies obtained from the forecasting data and methods, see \autoref{tab.forecast}.} \label{fig:forecast} \end{figure*} The fiducial cosmological model used to build the forecasted data is a \emph{hot-relic} extension of the $\Lambda$CDM model that assumes a non-vanishing axion mass ($m_a=1$ eV) and a non-vanishing total neutrino mass $\sum m_\nu = 0.06$ eV i.e. the minimum mass allowed by neutrino oscillation data. We adopt the KSVZ model for governing the axion interactions. The other standard six cosmological parameters are chosen to be in agreement wit the latest Planck 2018 constraints for a $\Lambda$CDM scenario, namely, we adopt the following fiducial values: $n_s = 0.965$, $\omega_b = 0.0224$, $\omega_c = 0.12$, $H_0 = 67.4$, $\tau=0.05$, $A_s = 2.1 \times 10^{-9}$. Notice that, within the KSVZ scenario, values of the axion mass $\sim 1$ eV, are still marginally consistent with the 95\% CL limit derived from the CMB data but they are strongly disfavored by large scale structure measurements from BAO. Therefore, one would expect to recover the value of axion mass assumed in our fiducial model with an uncertainty $\sigma(m_a)\ll 1\,\rm{eV}$, that will remark the sensitivity on the axion mass from future cosmic probes. In order to generate the forecasted data, we followed the same procedure detailed in \cite{Giare:2021cqr}: using the fiducial model introduced above, we compute the angular power spectra of temperature $ C_\ell^{TT} $, E and B polarization $ C_\ell^{EE,BB} $ and cross temperature-polarization $C_\ell^{TE} $ anisotropies. Then, we consider an experimental noise for the temperature angular spectra of the form \citep{Perotto:2006rj} \begin{equation} N_\ell = w^{-1}\exp(\ell(\ell+1)\theta^2/8 \ln 2)~, \end{equation} where $ \theta $ is the FWHM angular resolution and $ w^{-1} $ is the experimental sensitivity in units of $ \mu\mathrm{K}\,\rm arcmin $. The polarization noise is derived assuming $ w_p^{-1} = 2w^{-1} $ (one detector measures two polarization states). Here we fix $ \theta = \SI{3}{\arcminute} $ and $ w = 1\, \si{\mu\kelvin}\,\rm arcmin $. The simulated spectra are then compared with theoretical ones using the a likelihood $\mathcal{L}$ \citep{Perotto:2006rj,Cabass:2015jwe} \begin{equation} -2\ln\mathcal{L}_{\rm CMB} = \sum_{\ell} (2\ell + 1)f_{\rm sky}\left(\frac{D_\ell}{|C_\ell|} + \ln\frac{|C_\ell|}{|\hat{C_\ell}|} - 3 \right)~, \end{equation} where $\hat{C} $ and $ C $ are the theoretical and simulated spectra with noise, respectively defined by \begin{align} &|C_\ell | = C_\ell^{TT}C_\ell^{EE}C_\ell^{BB} - \left(C_\ell^{TE}\right)^2C_\ell^{BB}~; \\ &|\hat{C}_\ell| = \hat{C}_\ell^{TT}\hat{C}_\ell^{EE}\hat{C}_\ell^{BB} - \left(\hat{C}_\ell^{TE}\right)^2\hat{C}_\ell^{BB}~, \end{align} while $ D $ is \begin{align} D_\ell &= \hat{C}_\ell^{TT}C_\ell^{EE}C_\ell^{BB} + C_\ell^{TT}\hat{C}_\ell^{EE}C_\ell^{BB} + C_\ell^{TT}C_\ell^{EE}\hat{C}_\ell^{BB} \nonumber\\ &- C_\ell^{TE}\left(C_\ell^{TE}\hat{C}_\ell^{BB} + 2C_\ell^{TE}C_\ell^{BB} \right)~. \nonumber\\ \end{align} The range of multipoles is assumed to be $ 5 \leq \ell \leq 3000 $ and the sky coverage of the $ 40\% $ ($f_{\rm sky} = 0.4$). We do not include CMB lensing derived from trispectrum data. For the future BAO dataset we instead consider the DESI experiment~\citep{DESI:2013agm} and we employ the volume average distance as a tracer for BAO~\footnote{It would also be possible to forecast BAO data considering $D_A/r_s$ and $H(z)$ as independent measurements, allowing for stronger constraints. However some small tension ($\sim 1 \sigma$) has been identified between the current constraints from $D_A/r_s$ and $H(z)$ \citep{Addison:2017fdm}. Therefore we follow the conservative approach of \citep{Allison:2015qca} and employ the volume average distance for the BAO forecasts.} \begin{equation} D_V(z)\equiv \left(\frac{(1+z)^2D_A(z)^2cz}{H(z)}\right)^\frac{1}{3}~, \end{equation} where $D_A$ is the angular diameter distance and $H(z)$ the Hubble parameter. Assuming the very same fiducial model previously described, we compute the theoretical values of the ratio $D_V/r_s$ for several redshifts in the range $z=[0.15-1.85]$, where $r_s$ is sound horizon at the photon-baryon decoupling epoch. The uncertainties on $D_V/r_s$ are calculated propagating those for $D_A/r_s$ and $H(z)$ reported in \citep{DESI}. The simulated BAO data are compared to the theoretical $D_V/r_s$ values through a multivariate Gaussian likelihood \begin{equation} -2\ln \mathcal{L}_{\rm BAO} = \sum (\mathbf{\mu} - \hat{\mathbf{\mu}})C^{-1}(\mathbf{\mu} - \hat{\mathbf{\mu}})^T ~, \end{equation} where $\mu$ and $\hat{\mu}$ are the vectors containing the simulated and theoretical values of $D_V/r_s$ at different redshifts and $C$ their simulated covariance matrix. \autoref{tab.forecast} summarizes the results obtained from our forecasting methods for future CMB and BAO experiments while \autoref{fig:forecast} shows the $68\%$ and $95\%$~CL contour plots for the different cosmological parameters. Using our forecasted data for future CMB-S4 observations, we derive the 68\% CL constraint $m_a=1.13\pm 0.11$ eV, showing that future CMB measurements will be able to reach a sensitivity on the axion mass $\sigma(m_a)\simeq 0.1$ eV; about one order of magnitude better than current Planck data. On the other hand, the limit on the total neutrino mass, $\sum m_{\nu}<0.178$ eV ($\sum m_{\nu}<0.220$ eV at 99\% CL), shows that when axions are included in the picture as additional thermal species, the possibility to detect the expected minimum neutrino mass of $\sum m_{\nu}\sim0.06$~eV with future cosmic probes is no longer possible and only upper bounds can be derived, as already pointed out in \cite{Giare:2021cqr}. Combining together the likelihood for CMB-S4 and DESI-like experiments we improve the constraint on the axion mass to $m_a=1.056^{+0.086}_{-0.075}$~eV, i.e. the expected sensitivity combining future CMB and BAO probes is $\sigma(m_a)\simeq 0.08$ eV. Similarly, the bound on the total neutrino mass is improved to $\sum m_{\nu}<0.118$ eV ($\sum m_{\nu}<0.144$ eV at 99\% CL), still below the accuracy needed for a combined measurement of the axion mass together with a detection of a neutrino mass. Notice however that we have explored a very conservative fiducial cosmology assuming the minimum neutrino mass allowed by oscillation experiments (i.e. $\sum m_\nu=0.06$~eV): larger neutrino masses could lead to smaller forecasted errors. Nevertheless the improvement in the measurement of the axion parameters in the context of future cosmological probes is highly remarkable, as can be noticed from a very quick comparison between \autoref{tab.forecast} and \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ}. \section{Conclusions} \label{sec:conclusions} The QCD axion is one of the strongest motivated particle for physics beyond the SM since it solves the strong CP problem and it provides a viable dark matter candidate. From a more general perspective, axion-like particles (ALPs) with properties similar to the QCD axion arise naturally in top-down motivated frameworks such as string compactification~\cite{Arvanitaki:2009fg}. Non-perturbative strong dynamics generates a non-vanishing axion mass, and when thermally produced axions become non-relativistic they leave cosmological signatures that are very similar to those originated by massive neutrinos. Therefore, constraints on axion properties must be derived in cosmological models including also massive neutrino species. Present constraints~\cite{Giare:2020vzo} on these hybrid hot dark matter scenarios rely upon approximate methods that could bias the constraints. On the one hand, they are derived by employing the instantaneous decoupling approximation and the resulting axion relic population is quite sensitive to the precise value of the decoupling temperature; this is due to the significant change in the effective number of the degrees of freedom of the thermal bath. The Boltzmann equation formalism avoids this problem because is not necessary to assume that thermal equilibrium is achieved in the early Universe, and it allows to track carefully the decoupling epoch. On the other hand, a delicate input in the Boltzmann equation is the axion production rate. Previous studies evaluated the cosmological axion mass bounds by considering the axion-pion and axion-gluon scattering separately. We employ here the results provided by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} in which the production rate is continuous across the QCD crossover. By means of the robust Boltzmann equation integration method, we revisit here the constraints in a hydrid mixed hot dark matter scenario, in which both neutrinos and QCD axions are present. We retrace the entire cosmological history of relic axions. First, we track their number density via a numerical solution of the Boltzmann equation and we evaluate their asymptotic comoving number density. This quantity gets frozen when axions stop experiencing any interactions with the thermal bath, and this happens always well above the MeV scale. Thus once we approach the first cosmological era that allows us to put meaningful constraints, namely the BBN epoch, the number of axions in the comoving volume is a fixed quantity that cannot change. We compare our predictions with observations probing the time of BBN (light element abundances), the recombination era (CMB temperature and polarization), and large scale structure (lensing and BAO). For the axion mass range investigated here, axions are always relativistic at the time of BBN. They provide an additional contribution to dark radiation that we parameterize in terms of an effective number of additional neutrino species $\Delta N_{\rm eff}$. Analyzing light element abundances through BBN, we find the constraint $\Delta N_{\rm eff}<0.3$ at $95\%$~CL. For the KSVZ axion, we find the mass bound $m_a< 0.6$~eV (also at $95\%$~CL). If a prior on the baryon energy density from CMB is assumed, these bounds are further improved to $\Delta N_{\rm eff}<0.14$ and $m_a< 0.16$~eV, respectively. Similar results are found for the DFSZ axion (see \autoref{tab.BBN} for the complete set of BBN bounds). When one considers later cosmological eras, axions may not be relativistic anymore because they lose their kinetic energy as the Universe expands. The recombination temperature is $0.3$~eV, and therefore axions heavier than approximately this scale (see \autoref{eq:TaLS}) are non-relativistic at the time of CMB formation. If this is the case, they do not contribute to dark radiation at recombination but rather provide a sub-dominant hot dark matter component. Furthermore, their non-vanishing mass is responsible for washing out cosmological structures at small scales through free-streaming. We employ cosmological observations from the CMB temperature, polarization and lensing from the Planck satellite combined with large scale structure data. In our analysis, we include the consequences of the axion presence at BBN. For the KSVZ axion, we find the bounds $\Delta N_{\rm eff}<0.23$, $m_a< 0.28$~eV and $\sum m_\nu < 0.16$~eV (all at $95\%$~CL). This corresponds to a factor of $\sim 5$ improvement in the axion mass with respect to the existing limits~\cite{Giare:2020vzo}. For the DFSZ axion the bounds are even more constraining, as a consequence of the larger production rate, and they explicitly read $\Delta N_{\rm eff}<0.24$, $m_a< 0.21$~eV and $\sum m_\nu < 0.16$~eV (all at $95\%$~CL). The full set of bounds from cosmology are summarized in \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ} for the KSVZ and DFSZ axions, respectively. Following the same procedure used for current observational data, we perform a forecasted analysis for upcoming cosmological and astrophysical surveys, targeting a CMB-S4-like observatory and a DESI-like BAO galaxy survey. For this analysis we chose a fiducial $\Lambda$CDM model with a non-vanishing axion and total neutrino mass, simulating constraints for the case of CMB-S4 alone and for CMB-S4+DESI. Our results show that future CMB observations will be able to reach a sensitivity on the value of the axion mass around an order of magnitude better than current constraints while the bounds on the total neutrino mass will be improved by a factor of $\sim 2$. When combined with a DESI-like experiment, we found a $\sim 20\%$ improvement in the constraints on the axion mass leading to $\sigma(m_a) = 0.08 $ eV (for a fiducial $m_a = 1$~eV), while the total neutrino mass bound is improved by slightly more than $30\%$. Therefore, upcoming observations from future CMB and galaxy surveys could reach percent level constraints on the value of the axion mass. We refrain however that the inclusion of additional thermal species at early time significantly impacts the achievable bounds on the total neutrino masses preventing a direct measurements if $\sum m_\nu \lesssim 0.1$~eV. In concluding, while the future of the constraints on beyond the SM physics looks very bright from the point of view of next generation CMB and BAO experiments, extremely precise and carefully developed models of particle interactions in the early Universe are needed to keep theoretical modeling at pace with the improvements in accuracy that cosmological and astrophysical observations will perform in the current decade. \section*{CRediT authorship contribution statement} \textbf{Francesco D’Eramo}: Conceptualization, Validation, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Eleonora Di Valentino}: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{William Giar\`e}: Conceptualization, Software, Formal Analysis, Visualization, Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Fazlollah Hajkarim}: Conceptualization, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Alessandro Melchiorri }: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Olga Mena}: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Fabrizio Renzi}: Conceptualization, Software, Formal Analysis, Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Seokhoon Yun}: Conceptualization, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing \begin{acknowledgments} The work of FD, FH and SY is supported by the research grants: ``The Dark Universe: A Synergic Multi-messenger Approach'' number 2017X7X85K under the program PRIN 2017 funded by the Ministero dell'Istruzione, Universit\`a e della Ricerca (MIUR); ``New Theoretical Tools for Axion Cosmology'' under the Supporting TAlent in ReSearch@University of Padova (STARS@UNIPD). EDV is supported by a Royal Society Dorothy Hodgkin Research Fellowship. FD, WG, FH, AM and SY are supported by Theoretical Astroparticle Physics (TAsP),``iniziativa specifica'' of Istituto Nazionale di Fisica Nucleare (INFN). The work of FD and OM is supported by the Spanish grants PID2020-113644GB-I00, PROMETEO/2019/083 and by the European ITN project HIDDeN (H2020-MSCA-ITN-2019/860881-HIDDeN. FR acknowledges support from the NWO and the Dutch Ministry of Education, Culture and Science (OCW) (through NWO VIDI Grant No.2019/ENW/00678104 and from the D-ITP consortium). FD acknowledges the hospitality while this work was in preparation of the Munich Institute for Astro- and Particle Physics (MIAPP) which is funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany´s Excellence Strategy – EXC-2094 – 390783311 \end{acknowledgments} \section{Introduction} \label{sec.Intro} Light and elusive degrees of freedom are ubiquitous in theoretical frameworks aimed at solving deficiencies of the standard model (SM) of particle physics. The feeble couplings and tiny masses imply a potentially prominent role in the early Universe, and their presence at early times can leave an imprint on cosmological observables. Some particle candidates for physics beyond the SM, such as the one investigated in this work, are somewhat special since they solve more than one problem. Attempts to detect CP violation by strong interactions have not been successful so far. From the theory point of view, the source of CP violation (or time-reversal violation in agreement with the CPT theorem) in Quantum ChromoDynamics (QCD) is controlled by a dimensionless parameter $\theta$ that is expected to be of order one. The non-observation of CP-violating electric dipole moments of nucleons puts the spectacular bound $\theta \lesssim 10^{-10}$~\cite{Baker:2006ts,Pendlebury:2015lrz,Abel:2020pzs}, and understanding this severe inequality is at the heart of the so-called strong CP problem. An elegant solution is the Peccei-Quinn (PQ) mechanism~\cite{Peccei:1977hh,Peccei:1977ur} where the $\theta$ parameter is promoted to a dynamical pseudo-scalar field known as the \textit{axion}~\cite{Wilczek:1977pj,Weinberg:1977ma}. QCD dynamics itself drives such a field toward the configuration of minimal energy that is CP conserving~\cite{Vafa:1984xg}. Remarkably, the QCD axion kills two birds with one stone since it provides a solution to another serious SM drawback: the energy density stored in the field oscillations has a redshift behavior with the Hubble expansion which is the same as the one for non-relativistic matter~\cite{Preskill:1982cy,Abbott:1982af,Dine:1982ah}. Thus the QCD axion is one of the strongest motivated viable dark matter candidates, and the production in the early Universe is of non-thermal origin~\cite{Kibble:1976sj,Vilenkin:1981kz,Kibble:1982dd,Sikivie:1982qv,Vilenkin:1982ks,Linde:1985yf,Huang:1985tt,Seckel:1985tj,Davis:1986xc,Lyth:1989pb,Linde:1990yj,Vilenkin:2000jqa}. Axions can be copiously produced in the early Universe also via scattering and decays of particles belonging to the primordial bath~\cite{Turner:1986tb,Berezhiani:1992rk,Brust:2013ova,Baumann:2016wac,DEramo:2018vss,Arias-Aragon:2020qtn,Arias-Aragon:2020shv,Green:2021hjh,DEramo:2021usm}. Eventually, once the early Universe gets cold enough and diluted, they propagate without any interaction along geodesics and free-stream until the present time. Their presence may alter the Hubble expansion rate since they contribute to the radiation energy density of the Universe as massive neutrinos do when they are still relativistic. The presence of such a cosmic axion background can leave distinct and detectable imprints, and current cosmological data put bounds on the axion mass and interactions~\cite{Hannestad:2005df,Melchiorri:2007cd,Hannestad:2007dd,Hannestad:2008js,Hannestad:2010yi,Archidiacono:2013cha,Giusarma:2014zza,DiValentino:2015zta,DiValentino:2015wba,Archidiacono:2015mda}. Recent work~\cite{Dror:2021nyr} suggested strategies to detect this population of axions even directly with terrestrial experiments. In this work, we revisit the joint constraints on the QCD axion and neutrino masses and improve the state-of-the-art analysis~\cite{Giare:2020vzo}. First, we do not rely upon the instantaneous decoupling approximation. This method assumes that thermal equilibrium is achieved in the early Universe but this is not always true. Furthermore, the effective number of bath degrees of freedom changes substantially below the weak scale, and the resulting axion amount would be quite sensitive to the precise value of the decoupling temperature. We overcome these limitation with the Boltzmann equation formalism that tracks the axion population across the expansion history. The axion coupling to gluons, which is necessary to solve the strong CP problem, constitues a serious challenge since such a perturbative description breaks down once strong interactions confine. Historically, the axion production rate was evaluated exclusively above~\cite{Masso:2002np,Graf:2010tv,Salvio:2013iaa,Ferreira:2018vjj} or below~\cite{Chang:1993gm,DEramo:2014urw,Ferreira:2020bpb,DiLuzio:2021vjd} the confinement scale, and cosmological bounds were derived by considering axion-pion and axion-gluon scatterings separately~\cite{Giare:2020vzo}. Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} provided continuous results for the axion production rate. In the high-temperature regime where perturbative QCD is trustworthy, a proper thermal field theory treatment regulates the singular IR behavior due to the long-range interactions mediated by gluons. At low temperatures, axions are produced via pion collisions. The two results are connected via a smooth interpolation across the QCD crossover. We employ these rates in our analysis, and the limits obtained here are more constraining than those previously found in the literature.\footnote{The recent analysis in Ref.~\cite{Caloni:2022uya} employed the rates provided by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} to bound thermally-produced axion-like particles.} Section~\ref{sec.axion} describes the QCD axion scenarios explored here, whose thermal production mechanism is detailed in Sec.~\ref{sec.production}. The cosmological analyses start in Sec.~\ref{sec.Cosmo}, which include a detailed description of the numerical implementation. Section~\ref{sec.Results} presents our results, derived using Big Bang Nucleosynthesis (BBN) and current cosmological measurements. Forecasted analyses based in future Cosmic Microwave Background (CMB) and galaxy survey observations will also be shown. We conclude in Sec.~\ref{sec:conclusions}. \section{QCD axion: mass and interactions} \label{sec.axion} Every QCD axion model features a global Abelian $U(1)$ symmetry, also known as PQ symmetry, which is anomalous under strong interactions and spontaneously broken. The QCD axion is the pseudo-Nambu-Goldstone-Boson (PNGB) that originates from such a breaking. The color anomaly of the PQ symmetry is responsible for a tiny axion mass that has profound cosmological consequences. Regardless of the specific microscopic realization, the color anomaly manifests itself at low energy through the contact interactions of the axion field $a$ with gluons \be \mathcal{L}_{aG} = \frac{\alpha_s}{8 \pi} \frac{a}{f_a} G^A_{\mu\nu} \widetilde{G}^{A \mu\nu} \ . \label{eq:LPQaxion} \ee We define $\alpha_s = g_s^2 / (4 \pi)$ the QCD fine structure constant, $G_{\mu\nu}^A$ the gluon field strength, $\widetilde{G}^{A \mu\nu} \equiv \epsilon^{\mu\nu\rho\sigma} G^A_{\rho\sigma} / 2$ its dual, and $f_a$ is known as the axion decay constant. Once we reach the confinement scale, strong QCD dynamics generate a non-perturbative potential that leads to the general expression for the axion mass~\cite{Bardeen:1978nq,GrillidiCortona:2015jxo,Gorghetto:2018ocs} \be m_a \simeq 5.7 \, \mu{\rm eV} \, \left( \frac{10^{12} \, {\rm GeV}}{f_a} \right) \ . \label{eq:ma} \ee Other axion couplings are allowed but not mandatory. Anomalous interactions to electroweak gauge bosons take a form similar to the one for gluons with different gauge couplings and model-dependent Wilson coefficients. The axion can couple via derivative interactions to SM fermions that we write schematically as follows \be \mathcal{L}_{a \psi} = \frac{\partial_\mu a}{f_a} \, \overline{\psi^\prime} \gamma^\mu \left(c^V_{\psi^\prime \psi} + c^A_{\psi^\prime \psi} \gamma^5 \right) \psi \ . \label{eq:apsicoupling} \ee The fields $\psi$ and $\psi^\prime$ do not necessarily belong to the same generation, and electroweak gauge invariance relates vector and axial-vector couplings. The derivative coupling preserves the shift symmetry $a \rightarrow a + {\rm const}$ consistently with the PNGB nature of the axion. The landscape of axion models is broad~\cite{Kim:2008hd,DiLuzio:2020wdo}. We divide them into two main classes according to the origin of the color anomaly: Kim-Shifman-Vainshtein-Zakharov (KSVZ)~\cite{Kim:1979if,Shifman:1979if} and Dine-Fischler-Srednicki-Zhitnitsky (DFSZ)~\cite{Dine:1981rt,Zhitnitsky:1980tq} frameworks. The coupling to gluons in Eq.~\eqref{eq:LPQaxion} and the consequent axion mass in Eq.~\eqref{eq:ma} are the same for both cases. Interactions with electroweak gauge bosons and SM fermions in Eq.~\eqref{eq:apsicoupling} are different instead. \subsection{KSVZ Axion} \label{subsec.KSVZ} None of the SM fields carries a PQ charge in this case. New colored fermions are responsible for the axion interaction with gluons. They get their mass from PQ breaking, and they have to be heavier than the TeV range to satisfy the collider bounds on new colored particles. For processes at energies below this mass, the new fermions can be integrated out and this procedure generates the local operator in Eq.~\eqref{eq:LPQaxion}. Anomalous couplings to electroweak gauge bosons can be present depending on the gauge charges of these fermions, but their effect is sub-dominant given the hierarchy among gauge coupling constants. Interactions with SM fermions are absent. We are interested in axion production at temperatures below the weak scale\footnote{Ref.~\cite{DEramo:2021lgb} provides the axion production rate across the intermediate mass threshold of the heavy PQ charged fermions.} so we employ the low-energy description in Eq.~\eqref{eq:LPQaxion}. Gluon scatterings are responsible for production above the GeV scale until the epoch when quarks and gluons get confined into hadrons. Below confinement, axion production is controlled by pion scatterings via the derivative interaction \be \mathcal{L}_{a\pi\pi\pi} = \frac{c_{a\pi\pi\pi}}{f_\pi} \, \frac{\partial_\mu a}{f_a} \, \mathcal{J}_\pi^\mu \ . \label{eq:pionKSVZ} \ee Here, $f_\pi \simeq 93 \, {\rm MeV}$ is the pion decay constant and we define the spin-one pion current \be \mathcal{J}_{\pi}^\mu \equiv \pi^0\pi^+\partial^\mu \pi^- + \pi^0\pi^-\partial^\mu \pi^+ - 2 \pi^+\pi^-\partial^\mu \pi^0 \ . \ee The only model dependent coupling is the dimensionless Wilson coefficient $c_{a\pi\pi\pi}$ that in our case results in \be c_{a\pi\pi\pi}^{\rm KSVZ} \simeq 0.12 \ . \ee \subsection{DFSZ Axion} \label{subsec.DFSZ} There is no new fermion field in this case, and the color anomaly of the PQ symmetry is generated by SM quarks that carry a non-vanishing PQ charge. The Higgs sector needs to be extended with another weak doublet and this brings an additional intermediate scale in the game: the mass of the heavy Higgs bosons. We work in the so-called decoupling limit, which is motivated also by collider bounds, where such a mass is well-above the weak scale. In particular, the heavy Higgs bosons mass is above the energies that we consider for axion production.\footnote{Ref.~\cite{DEramo:2021lgb} provides the axion production rate across the intermediate mass threshold of the heavy Higgs bosons.} The local operator in Eq.~\eqref{eq:LPQaxion} arises once we account for the anomalous effects of all SM quarks. Thus it is non-local above the weak scale since the top quark is the heaviest PQ-charged and colored fermion. At intermediate scales, the contact interaction is present with a scale-dependent anomaly coefficient accounting for the virtual effects of heavy quarks that have been integrated out. The presence of two Higgs doublets $H_u$ and $H_d$ introduces a new parameter relevant to axion phenomenology: the ratio between their vacuum expectations values (vevs) $v_u$ and $v_d$. We follow the standard convention and parameterize this ratio as $\tan\beta = v_u/ v_d$. These vevs generate fermion masses, and we consider a type-II two Higgs doublet model (2HDM). Unlike the previous case, the axion couples to SM fermions since they carry a PQ charge. The parameter $\tan\beta$ sets the relative interaction strength between different fermions. Thermal axion production is possibly sensitive to the value of $\tan\beta$ since fermion scattering is an active production source. Axion production in this scenario is richer. Above confinement, we have scattering processes caused by the interactions with SM fermions in Eq.~\eqref{eq:apsicoupling} besides quark and gluon scatterings mediated by the operator in Eq.~\eqref{eq:LPQaxion}. Below the confinement scale, axion production via electron and muon scatterings is present in this case. Concerning pion scatterings, axion production is controlled again by the interactions in Eq.~\eqref{eq:pionKSVZ}. However, the additional axion couplings to SM quarks modify the effective dimensionless parameter $c_{a\pi\pi\pi}$ as follows \be c_{a\pi\pi\pi}^{\rm DFSZ} = c_{a\pi\pi\pi}^{\rm KSVZ} - \frac{\cos 2\beta}{9} \ . \ee \section{Thermal Production} \label{sec.production} Scatterings are the only production channel available for the minimal KSVZ and DFSZ frameworks due to the flavor-conserving axion interactions. If flavor-violating couplings are allowed then decays also contribute~\cite{DEramo:2021usm}. Initially, axions may belong to the thermal bath if during or after inflationary reheating there are efficient mechanisms to produce them. Even if they are not present at the onset of the radiation domination epoch, they are produced by thermal scatterings and their interaction strength could bring them to equilibrium. Whether they thermalize or not, there will be a moment starting from which interactions are so rare that axions just free-stream until the present time. Keeping track of this axion population through the expansion history is the goal of this section. The output of this procedure is the prediction of the number of axions in a comoving volume as a function of the axion mass, and this is also the input for the cosmological analysis performed in the remaining part of this work. A quick method to estimate the axion relic density is via the \textit{instantaneous decoupling approximation}. Here, we assume that axions at some point reach thermal equilibrium, and that they suddenly decouple when the bath had a temperature $T_D$ identified by the relation \be \Gamma_a(T_D) = H(T_D) \ . \label{eq:TD} \ee The temperature dependent production rate $\Gamma_a(T)$ depends on the axion model and it quantifies the number of production processes that happen per unit time. On the other side of the equality, we have the Hubble expansion rate set by the Friedmann equation \be H(T) = \frac{\sqrt{\rho_{\rm rad}}}{\sqrt{3} M_{\rm Pl}} = \frac{\pi \sqrt{g_\star(T)}}{3 \sqrt{10}} \frac{T^2}{M_{\rm Pl}} \ \label{eq:Friedmann} \ee with $M_{\rm Pl} \equiv (8 \pi G)^{-1/2} \simeq 2.44\times10^{18}\, {\rm GeV}$ the reduced Planck's mass. The last equality holds for a radiation dominated Universe with a temperature dependent $g_\star(T)$ relativistic effective degrees of freedom. Axions just free-stream for temperatures below $T_D$ and therefore their comoving number density $Y_a \equiv n_a / s$ stays constant. Here, $s$ is the entropy density of the thermal bath which is conventionally parameterized as $s=(2\pi^2/45)g_{\star s}(T)T^3$ with $g_{\star s}(T)$ the number of entropic degrees of freedom. The asymptotic axion comoving density results in \be Y_a^\infty = Y_a(T \lesssim T_D) = \frac{45 \zeta(3)}{2 \pi^4 g_{\star s}(T_D)} \label{eq:Yainf} \ee with $\zeta(3) \simeq 1.2$ the Riemann zeta function. The asymptotic comoving density depends on the decoupling temperature only through the factor $g_{\star s}(T_D)$ in the denominator. Axions decoupling at later times are a more significant fraction of the thermal bath and therefore their comoving density is larger. \autoref{fig:TD} shows the decoupling temperature obtained via Eq.~\eqref{eq:TD} as a function of the axion mass (or, equivalently, as a function of the axion decay constant $f_a$ through the relation in Eq.~\eqref{eq:ma}) for the KSVZ axion via the production rates of Refs.~\cite{DEramo:2021psx,DEramo:2021lgb}. We use the $g_{\star}(T)$ and $g_{\star s}(T)$ functions provided by Ref.~\cite{Saikawa:2018rcs}, and we check that the outcome of our cosmological analysis is not sensitive to this specific choice.\footnote{We checked that the mass bounds obtained is this work are the same that one would obtain with the functions in Refs.~\cite{Drees:2015exa,Laine:2015kra}} For comparison, we reproduce also the results of Ref.~\cite{Giare:2020vzo} that estimated the axion relic abundance for the KSVZ axion within the instantaneous decoupling approximation by separating two different regimes: gluon and pion scatterings. This corresponds to the dashed lines in the figure. For axion-gluon scattering, the decoupling temperature was significantly overestimated. \begin{figure} \centering \includegraphics[width=\columnwidth]{new_maTadec.png} \caption{Decoupling temperature $T_D$ as a function of the axion mass $m_a$ (lower horizontal axis) and the axion decay constant $f_a$ (upper horizontal axis). Dashed lines corresponds to the values found by Ref.~\cite{Giare:2020vzo}, the solid line corresponds to the KSVZ axion with a continuous result for the rate.} \label{fig:TD} \end{figure} The pion rate employed by Ref.~\cite{Giare:2020vzo} results from a standard calculation within chiral perturbation theory and therefore is reliable. This is why the axion-pion dashed line agrees well with the full KSVZ estimate of the decoupling temperature. On the contrary, the axion-gluon dashed line is significantly far away from the correct KSVZ result. The production rate adopted by Ref.~\cite{Giare:2020vzo} in the deconfined phase corresponds to a dimensional analysis estimate. A proper rate evaluation that accounts for the running of the strong coupling constant enhances the rate as we approach the QCD crossover, and therefore it reduces the decoupling temperature. The net result is an underestimate of the axion relic density by previous studies, and this is the reason why the cosmological mass bounds found in this analysis are stronger. Therefore, we improve in this manuscript the results presented in Ref.~\cite{Giare:2020vzo}, which regardless if there were derived relying in estimated rates, have pioneered cosmological axion constraints and motivated studies as the one presented here. The criterion in Eq.~\eqref{eq:TD} leads to a ballpark estimate of the decoupling epoch but it is far from being rigorous. As it is manifest from Eq.~\eqref{eq:Yainf}, the final axion abundance is sensitive to the detailed value of the decoupling temperature only if $g_{\star s}$ is changing around the decoupling time. This is exactly the case for the axion parameter space investigated in this work. Furthermore, the interaction rate can have a peculiar structure around the decoupling temperature as in DFSZ theories where threshold effects around the mass of SM heavy quarks enhances the axion coupling to gluons.\footnote{This is analogous to integrating out a heavy PQ-charged and colored fermion in KSVZ theories as discussed in detail by Ref.~\cite{DEramo:2021lgb}.} We need to refine the axion relic density calculation in order to find solid cosmological bounds on the axion mass. A proper tool to follow the axion number density $n_a$ in the early Universe is the Boltzmann equation \be \frac{dn_{a}}{dt}+3Hn_{a}= \gamma_{a}\left(1-\frac{n_{a}}{n_{a}^{\rm eq}}\right)\ . \ee Here, $n_a^{\rm eq}$ is the axion equilibrium number density and $\gamma_{a}$ accounts for axion number-changing processes. The latter quantity is connected to the interaction rate $\Gamma_a$ introduced before via the relation $\gamma_a = n_a^{\rm eq} \Gamma_a$. We find it convenient to rewrite the Boltzmann equation in terms of dimensionless quantities. We switch to the comoving density $Y_a$ already introduced before, and we trade the time variable $t$ with the dimensionless combination $x\equiv M / T$. The overall mass scale $M$ is purely conventional and it can be chosen to make the numerical solution easier. The Boltzmann equation reads \be \frac{dY_{a}}{d\log x}=-\left(1-\frac{1}{3}\frac{d\log g_{\star s}}{d \log x}\right)\frac{\gamma_{a}(x)}{H(x)s(x)}\left(1-\frac{Y_{a}}{Y_{a}^{\rm eq}}\right) \ . \ee We solve this equation from an initial temperature at the TeV scale and we choose two boundary conditions: axions initially in thermal equilibrium, and vanishing initial axion population. As shown explicitly by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb}, for the axion mass range studied here ($m_a \gtrsim 0.1 \, {\rm eV}$) the initial condition does not matter if we start the evolution above the weak scale. We solve the Bolzmann equation numerically down to temperatures well below the mass scale of particles participating in the production processes, and we find that the axion yield $Y_{a}$ reaches a constant value. \autoref{fig:maYa} shows the final axion comoving density for both the KSVZ and the DFSZ cases, and for the latter we choose two different values of $\tan\beta$. For comparison, we show again the result of the previous analysis in Ref.~\cite{Giare:2020vzo} for the couplings to gluons and pions. The actual axion relic density is substantially larger than previously estimated. We also notice how the value of $\tan\beta$ does not alter the resulting axion abundance significantly, and in what follows we fix $\tan\beta = 3$ for the DFSZ axion case. \begin{figure} \centering \includegraphics[width=\columnwidth]{new_maYa.png} \caption{Asymptotic axion yield $Y_a^\infty$ as a function of $m_a$ (lower horizontal axis) and $f_a$ (upper horizontal axis). The right vertical axis identifies the correspondent values of $\Delta N_{\rm eff}$ and $n_{a,0}\equiv n_a(T_0)$. Solid lines are obtained via a Boltzmann equation solution. We show with dashed lines also the results of Ref.~\cite{Giare:2020vzo} for axion couplings to gluons and pions.} \label{fig:maYa} \end{figure} \section{Cosmological Analysis} \label{sec.Cosmo} As aforementioned in the introduction, QCD axions thermally produced in the early Universe can leave distinctive signatures in different cosmological observables that we shall review in what follows. We study the Universe at the times of BBN and recombination where the axions are not in thermal equilibrium with the thermal bath anymore. For this reason, we cannot use a single bath temperature $T$ as done in the previous section but we need to distinguish among the different temperatures for photons ($T_\gamma$), neutrinos ($T_\nu$), and axions ($T_a$). \subsection{Thermal Axion Cosmology} \label{sec.Cosmo.Theory} As along as thermal axions remain relativistic particles ($T_a\gg m_a$), they behave as radiation in the early Universe and their cosmological effects are those produced via their contribution to the effective number of neutrino species $N_{\rm eff}$. We recall its definition via the energy density of radiation as a function of the redshift $z$ \begin{equation} \rho_{\rm rad}(z)=\frac{\pi^2}{30}\left[ 2 T^4_{\gamma}(z) + \frac{7}{4} N_{\rm eff} T^4_{\nu}(z)\right]~ . \end{equation} Light relativistic axions will provide an additional contribution $\Delta \rho_{\rm rad}(z)\propto T_a^4(z)$ that we parameterize in terms of a correction $\Delta N_{\rm eff} \equiv N_{\rm eff}-3.044$ to the effective number of neutrino species with respect to the SM.\footnote{We recall that the effective number of neutrino species in the SM is $N^{\rm SM}_{\rm eff}=3.044$, see Ref.~\cite{Bennett:2020zkv} and references therein.} By means of the Boltzmann equation outlined in the previous section, it is possible to evaluate this correction as $\Delta N_{\rm eff}\simeq 75.6\,\left(Y_a^{\infty}\right)^{4/3}$ and retrace the effects of relativistic axions through the different cosmological epochs. Current limits on $\Delta N_{\rm eff}$ arise primarily from observables at two epochs: \textit{(i)} at the BBN period, and, \textit{(ii)} at the Recombination epoch. BBN is a cornerstone of Hot Big Bang cosmology since it explains the formation of the first light nuclei (heavier than the lightest isotope of hydrogen) by a solid understanding of the nuclear interactions involved in the production of elements. It also provides a natural laboratory to test extensions of the SM of elementary particles that involve additional relativistic species. Indeed, additional contributions to $\Delta N_{\rm eff}$ will increase the expansion rate $H(z)$ by Eq.\eqref{eq:Friedmann} and lead to a higher freeze-out temperature of the weak interactions, implying a higher fraction of primordial Helium and Deuterium (as well as a higher fraction of other primordial elements). This makes BBN a powerful tool for constraining the total amount of relativistic species and beyond the SM physics frameworks: given a concrete model, we can solve numerically the set of differential equations that regulate the nuclear interactions in the primordial plasma~\cite{PitrouEtal2018,Pisanti:2007hk,Consiglio:2017pot,Gariazzo:2021iiu}, compute the light element abundances and compare the results to the values inferred by astrophysical and cosmological observations. Given current uncertainties, the standard BBN predictions show a good agreement with direct measurements of primordial abundances~\cite{Pitrou:2020etk,Mossa:2020gjc,Pisanti:2020efz,Yeh:2020mgl} limiting $\Delta N_{\rm eff}\lesssim 0.3-0.4$ at 95\% CL. Notice also that BBN is expected to start at temperatures of the order of 1 MeV (after the neutrino decoupling) and end well before the recombination epoch. Therefore this bound can be safely applied to all thermal axions that are relativistic in this range of temperatures and it is highly independent of recombination processes. Conversely, the BBN predictions for the Helium abundance can impact the CMB angular spectra because they can be used to estimate the baryon energy density through a simple formula~\cite{Serpico:2004gx} \be \Omega_b h^2 = \frac{1 - 0.007125\ Y_p^{\rm BBN}}{273.279}\left(\frac{T_{\rm CMB}}{2.7255\ \mathrm{K}}\right)^3 \eta_{10} \ . \label{eq.Yp} \ee Here, $\eta_{10} \equiv 10^{10}n_b/n_\gamma $ is the photon-baryon ratio today, $T_{\rm CMB} $ is the CMB temperature at the present time and $Y_p^{\rm BBN} \equiv 4 n_{\rm He}/n_{b}$ is the Helium \textit{nucleon fraction} defined as the ratio of the 4-Helium to the baryon density one.\footnote{We will provide results in term of the Helium \textit{mass fraction} defined as $Y_P = Y_{\rm{He4}} \,m_{\rm{He4}} /[Y_{\rm{He4}}\, m_{\rm{He4}} + (1 - 4\,Y_{\rm{He4}}) \,m_{\rm{H1}}]$ with $ Y_{\rm{He4}}=1/4 \,Y_{p}^{\rm {BBN}}$, $m_{\rm{He4}}\simeq 4.0026$, and $m_{\rm{H1}}\simeq 1.0078$.} Considering lower temperatures, additional dark radiation at recombination leads to some characteristic signatures in the CMB temperature angular power spectrum, modifying the damping tail and changing two important scales: the sound horizon and the Silk damping scale~\cite{Hou:2011ec,Archidiacono:2013fha}. The final release of Planck 2018 temperature and polarization data constrains $\Delta N_{\rm eff}\lesssim 0.4$ at 95\% CL ~\cite{Akrami:2018vks}, basically providing the same sensitivity on additional relativistic relics as BBN constraints. However, in this case, axions must behave as relativistic particles at recombination, i.e. $m_{a}\lesssim T_a(z_{\rm{LS}})$ (where $z_{\rm{LS}}\simeq 1100$ is the redshift corresponding to the last scattering surface). The temperature of a population of axion decoupled from the thermal bath at $T_{\rm D}$ at recombination is given by \begin{equation} T_a(z_{\rm{LS}}) \simeq T_{\rm rec} \times \left(\frac{2}{g_{\star}(T_{\rm D})}\right)^{1/3}~, \label{eq:TaLS} \end{equation} with $T_{\rm rec}\simeq 0.3$ eV. Consequently only very light axions ($m_a\lesssim 0.1$~eV) are still relativistic during this epoch. \\ When axions become non-relativistic they contribute to the total amount of (hot dark) matter of the Universe. We quantify this contribution via the parameter $\Omega_a$ that, in the non-relativistic regime, reads \begin{equation} \Omega_a \, h^2 \simeq \frac{m_a\,n_a}{1.054\cdot 10^4\,\rm{eV}\,\rm{cm}^{-3}}~. \end{equation} Non-relativistic axions leave signatures similar to massive neutrinos, suppressing structure formation at scales smaller than their free-streaming length and leaving an imprint on the CMB temperature anisotropies via the early integrated Sachs-Wolfe effect. Therefore we expect the axion and total neutrino masses to be anti-correlated: increasing the axion mass leads to a larger hot dark matter component so that the contributions from massive neutrinos should be reduced to keep the total amount of hot dark matter consistent with the data. This is one of the reasons why multi-messenger analysis of the axion and neutrino effects on cosmological scales turned out to be a very promising tool for constraining their properties, also with direct implications for current and future direct experiments. Hence in the following analysis we study a realistic mixed hot dark matter scenario of axions and neutrinos taking also into account a possible non-vanishing neutrino mass, as robustly established by oscillation experiments~\citep{deSalas:2020pgw,deSalas:2018bym}. \subsection{Numerical Implementation} \label{sec.Cosmo.Implementation} In order to fully address the different effects induced by a relic population of thermal axions, we use a modified version of the latest version of the cosmological Boltzmann integrator code \textsc{CAMB} \citep{Lewis:1999bs,Howlett:2012mh}. In particular, the code has been modified to describe the QCD axion effects on cosmological scales only in terms of the axion mass that we include as an additional cosmological parameter in our analyses. For each value of the axion mass, the numerical calculation provides the axion contribution through various cosmological epochs, switching between the relativistic and non-relativistic regime (\autoref{fig:Density}). In what follows, we briefly retrace the modifications in the code and how we implemented them. The QCD axion mass window of interest for this analysis ranges from $0.1$ eV to $10$ eV. Given current bounds on hot thermal relics (see e.g. Ref.~\cite{Giare:2020vzo}), the axion is always relativistic during the BBN, contributing as additional dark radiation and modifying the theoretical predictions for the abundance of primordial elements. We make use of the code \textsc{PArthENoPE}~\citep{Gariazzo:2021iiu} to quantify these effects. Starting from the input values of $N_\mathrm{eff}$, the neutron lifetime $\tau_n$ and the baryon energy density $\Omega_b h^2$, we evaluate the primordial light element abundances by solving numerically a set of differential equations that regulate the nuclear interactions in the primordial plasma after neutrino decoupling ($T \gtrsim 1$ MeV) until the end of BBN ($T \sim 10$ keV). We include the BBN predictions in our analyses, following the same procedure adopted by the Planck collaboration~\citep{Aghanim:2018eyx}: we fix the neutron lifetime to $\tau_n = 879.4$ s, corresponding to the latest value reported by the Particle Data Group ($\tau_n = 879.4 \pm 0.6 $ s)~\citep{ParticleDataGroup:2020ssz} and create an interpolation grid varying $\Omega_b h^2 $ and $\Delta N_\mathrm{eff}$ within $\Delta N_\mathrm{eff} \in [0 ; 3]$ and $\Omega_b h^2 \in [0.0073 ; 0.033]$, respectively. In this way, for each value of the axion mass, we compute the corresponding $\Delta N_{\rm eff}(m_a)$ by solving the Boltzmann equation and the corresponding BBN predictions for all the light elements, from $\rm H$ up to $^7\rm Li$. Very light axions ($m_a\sim 0.1$ eV) are still relativistic at recombination and thus they modify the CMB angular spectra always trough their effects in $\Delta N_{\rm eff}$. Notice however that the correction to the effective number of relativistic particles coming from the tiny mass values aforementioned ($m_a\sim 0.1$ eV) is typically beyond the the sensitivity of current CMB data, while it can be relevant for future CMB stage-4 experiments~\cite{Giare:2021cqr}. Heavier axions, although relativistic during the BBN epoch, can be highly non-relativistic at recombination. In this case, they impact the CMB angular power spectra both indirectly (through their modification of the primordial Helium abundance during BBN) and directly (by the early integrated Sachs-Wolfe effect, increasing the amount of hot dark matter, similarly to massive neutrinos). We consider both effects. For the former one, a combined analysis of CMB and BBN data strongly disfavors contributions larger than $\Delta N_{\rm eff}\gtrsim 0.4$ (at both epochs) thus setting a robust upper limit on additional dark radiation in the early Universe. For the latter case, we dynamically evolve the axion energy density $\Omega_a(t)$ during all the cosmological evolution via the same procedure used for massive neutrinos and properly calculate the late-time effects on the matter power spectrum and structure formation. As an explicit example, \autoref{fig:Density} shows the energy density as a function of the scale factor for photons, axions, neutrinos and cold dark matter (assuming $m_a=1$~eV and $\sum m_\nu =0.06$~eV). Both neutrinos and axions behave as radiation at early times, and they become a sub-dominant dark matter contribution once they turn non-relativistic. For the specific mass values chosen to produce \autoref{fig:Density}, one can also appreciate that the contribution to the energy density of massive neutrinos and axions may differ significantly. In particular, axions with masses larger than $0.1$ eV become non-relativistic before the CMB time thus they start contributing to the matter density earlier (than neutrinos) leading to a significant impact on structure formation. As we shall see below, this feature will allow us to put stringent constraints on axion masses using large scale structure data. When the two species has similar masses, the evolution of their energy densities is preventing us to constrain axion masses that are smaller than the current bounds on neutrino masses $\sum m_\nu \lesssim 0.2 $ eV. \begin{figure} \centering \includegraphics[width=\columnwidth]{Densities.pdf} \caption{Energy density, normalized to the critical density, as a function of the scale factor for photons, massive neutrinos, axions and cold dark matter. An axion mass $m_a=1$~eV and a total neutrino mass $\sum m_\nu=0.06$~eV have been assumed (see the main text for details). The dashed vertical line represents approximately the value of the scale factor at recombination.} \label{fig:Density} \end{figure} \section{Results} \label{sec.Results} \subsection{Results from BBN} \label{sec.Results.BBN} \begin{table*} \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.6\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{Constraints from BBN only}}\\[0.2cm] \hline \textbf{\nq{Parameter \\}} & \textbf{\nq{BBN-A\\($Y_p + \Omega_b\,h^2$)}} & \textbf{\nq{BBN-B\\($Y_p + D/H$)}} & \textbf{\nq{BBN-C\\($Y_p + D/H + \Omega_b\,h^2$)}} \\ \hline\hline \multicolumn{4}{c}{\textbf{KSVZ Axion Model}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240^{+0.00020}_{-0.00020}$&$0.02251^{+0.00021}_{-0.00026}$&$0.022413\pm 0.000088$\\ $Y_p$ &$0.24682^{+0.00073}_{-0.0015}$&$0.24681^{+0.00079}_{-0.0015}$&$0.24638^{+0.00042}_{-0.00064}$\\ $10^{5}\cdot(D/H)$ &$2.547^{+0.030}_{-0.041}$&$2.527\pm 0.030$&$2.533\pm 0.019$\\ $\Delta N_{\rm eff}$ &$< 0.31$ \,\,$(< 0.40)$&$< 0.30\,\,(<0.40)$&$< 0.14\,\,(< 0.21)$\\ $m_a$ [eV] &$< 0.61 \,\, (< 3.6)$&$<0.53\,\, (<3.0 )$&$< 0.16\,\,(<0.25)$\\ $f_a$ [$10^7$ GeV]&$>0.934\, (>0.158)$&$>1.07\,(>0.19)$&$>3.56\,(>2.28)$\\ \hline \hline \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=3$)}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240\pm 0.00010$&$0.02249^{+0.00022}_{-0.00027}$&$0.022407\pm 0.000089$\\ $Y_p$ &$0.24668^{+0.00075}_{-0.0016}$&$0.24665^{+0.00082}_{-0.0016}$&$0.24621^{+0.00045}_{-0.00068} $\\ $10^{5}\cdot(D/H)$ &$2.543^{+0.031}_{-0.044}$&$2.526\pm 0.030$&$2.530\pm 0.019$\\ $\Delta N_{\rm eff}$ &$< 0.32\,\,(< 0.41)$&$< 0.30\,\,(< 0.41)$&$< 0.14\,\,(< 0.20)$\\ $m_a$ [eV] &$< 0.40\,\,(< 2.4)$&$< 0.33\,\,(< 2.0)$&$< 0.10\,\,(< 0.15)$\\ $f_a$ [$10^7$ GeV] &$>1.42\,(>0.23)$&$>1.73\,(>0.28)$&$>5.7\,(>3.8)$\\ \hline \hline \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=10$)}}\\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02240\pm 0.00010$&$0.02249^{+0.00022}_{-0.00027}$&$0.022407\pm 0.000089$\\ $Y_p$ &$0.24671^{+0.00077}_{-0.0017}$&$0.24668^{+0.00086}_{-0.0017}$&$0.24622^{+0.00049}_{-0.00076}$\\ $10^{5}\cdot(D/H)$ &$2.544^{+0.032}_{-0.045}$&$2.526\pm 0.030$&$2.530\pm 0.020$\\ $\Delta N_{\rm eff}$ &$< 0.33\,\,(< 0.42)$&$< 0.31\,\,(< 0.41)$&$< 0.14\,\,(< 0.21)$\\ $m_a$ [eV] &$< 0.40\,\,(< 2.5)$&$< 0.33\,\,(< 2.0)$&$< 0.10\,\,(< 0.15)$\\ $f_a$ [$10^7$ GeV] &$>1.42\,(>0.23)$&$>1.73\,(>0.28)$&$>5.7\,(>3.8)$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained from BBN primordial abundances. The constraints on $\Omega_{\rm b} h^2$ , $Y_p$ and $10^{5}\cdot(D/H)$ are given at 68\%CL while the upper bounds on $\Delta N_{\rm eff}$ and $m_a$ are given both at 95\% and 99\% CL.} \label{tab.BBN} \end{table*} \begin{figure*} \centering \includegraphics[width=\textwidth]{KSVZ_BBN.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the KSVZ QCD axion scenario. The different colors refer to the different data combinations here considered for BBN analyses, see \autoref{tab.BBN}.} \label{fig:KSVZ_BBN} \end{figure*} \begin{figure*} \centering \includegraphics[width=\textwidth]{DFSZ_BBN_b3.pdf} \caption{As \autoref{fig:KSVZ_BBN} but for the DFSZ QCD axion scenario. Since the results shown in Tab.~\ref{tab.BBN} demonstrate that the constraints in this axion cosmological scenario are almost independent of the $\beta$ parameter, we only illustrate here the case $\tan \beta=3$.} \label{fig:DFSZ_BBN} \end{figure*} It is instructive to start studying the constraints on thermal QCD axions restricting the analysis only to the BBN epoch. As explained in the previous section, the only effect of the axion during BBN is its contribution to the radiation energy density of the Universe via $\Delta N_{\rm eff}$. Independent astrophysical and cosmological measurements of primordial light element abundances limit the amount of additional dark radiation and thus impose an upper bound on the mass of the axion. Our baseline dataset for the BBN analyses consists of \begin{itemize} \item Two independent measurements of the primordial Helium \textit{mass fraction}, $Y_p = 0.2449 \pm 0.0040$ \cite{Aver:2015iza} and $Y_p = 0.2446\pm 0.0029$ \cite{Peimbert:2016bdg}. \item A percent determination of the primordial Deuterium abundance $D/H=\left(2.527\pm0.030\right)\cdot 10^{-5}$ based on six high precision and homogeneously analyzed $D/H$ measurements from \cite{Cooke:2017cwo}. \item The value of the baryon energy density parameter $\Omega_b\,h^2=0.0224 \pm 0.0001$ from the final 2018 Planck data release of temperature and polarization CMB angular power spectra \cite{Aghanim:2018eyx}. \end{itemize} We randomly sample $N=10^6$ linearly distributed values of the axion mass in the range $m_a\in[0.1\,,\,10]$ eV and of the baryon energy density in the range $\Omega_b h^2\in\left[0.020\,,\,0.025 \right]$. For each value of the axion mass, we compute the axion contribution to the effective number of neutrino species $\Delta N_{\rm eff} (m_a)$ by solving the Boltzmann equation. Given a set of points $(\Delta N_{\rm eff} ,\Omega_b h^2)$, we compute the BBN predictions for the primordial light elements by means of the publicly available code \textsc{PArthENoPE}, following the procedure outlined in the previous section. We therefore create a grid of points in the $(\Delta N_{\rm eff} ,\Omega_b h^2)$ plane similar to those usually obtained within the Monte Carlo methods. We then apply the priors on the BBN abundances, re-weighting the contributions of the points by means of an ``importance sampling'' method. As a result, we obtain informative posterior distributions for the parameters to be inferred by observations such as the axion mass and $\Delta N_{\rm eff}$. We apply this methodology to the KSVZ and DFSZ axion models. \autoref{tab.BBN} summarizes our results, \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN} provide the marginalized posterior distributions of parameters for the KSVZ and the DFSZ axion models, respectively. For the latter model, we fix the additional free parameter $\beta$ to two different values, $\tan \beta= \{3, 10\}$. As a common practice, we start adopting prior information on the total amount of the primordial Helium $Y_p$ and the baryon energy density $\Omega_b\,h^2$. We refer to this dataset as ``BBN-A ($Y_p + \Omega_b\,h^2$)'', which provides an upper limit on the additional dark radiation allowed during BBN $\Delta N_{\rm eff}<0.3$ at 95\% CL ( $\Delta N_{\rm eff}<0.4$ at 99\% CL), in perfect agreement with previous results discussed in literature~\cite{Giare:2020vzo}. Notice also that this bound remains unchanged for both models of axions, as expected. For the KSVZ scenario, this limit is translated into an upper bound on the axion mass of $m_a<0.6$ eV at 95\%CL ($m_a<3.6$ eV at 99\%CL). The axion contribution to $\Delta N_{\rm eff}$ is typically larger within the DFSZ model, and fixing $\tan \beta=3$ we obtain a slightly more constraining bound $m_a<0.4$ eV at 95\%CL ($m_a<2.4$ eV at 99\%CL). Performing the very same analysis with $\tan \beta=10$ the result does not change, proving that differences between the two cases remain too small to be observed given the current uncertainties, see also \autoref{fig:DFSZ_BBN} and \autoref{tab.BBN}. Finally, the constraints on the total amount of primordial Deuterium are at the percent level $D/H\simeq 2.54^{+0.03}_{-0.04}\cdot 10^{-5}$ (at 68\% CL) for both KSVZ and DFSZ models. Since in the analysis labeled here as BBN-A we are not assuming any prior information on Deuterium, this result can be compared to direct astrophysical measurements ($D/H\simeq 2.527\pm 0.030 \cdot 10^{-5}$), showing a perfect agreement and providing a robust consistency check. Notice however that these results are derived assuming a prior knowledge of the baryon-energy density as inferred by the Plank collaboration analyzing the last release of the CMB data. In order to remain completely independent on the physics at the recombination epoch, we repeat the same analysis by relaxing the prior on $\Omega_b h^2$ and combining instead with information on the total amount of both primordial Helium $Y_p$ and Deuterium $D/H$ from direct astrophysical measurements. We refer to this dataset as ``BBN-B($Y_p + D/H$)''. Also in this case, we derive exactly the same limit $\Delta N_{\rm eff}<0.3$ at 95\%CL ($\Delta N_{\rm eff}<0.4$ at 99\% CL) on additional dark radiation at the BBN epoch. However, the bound on the axion mass slightly changes with respect to the case BBN-A because of the different correlations among the parameters. In particular, assuming the prior on $D/H$ breaks the strong positive correlation between primordial Deuterium and the axion mass present in the previous case, see also \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN}. This leads to a small improvement in the axion mass limit: $m_a<0.5$ eV at 95\%CL ($m_a<3.0$ eV at 99\%CL) for the KSVZ axion, and $m_a<0.3$ eV at 95\%CL ($m_a<2.0$ eV at 99\%CL) for the DFSZ model (again with no differences between $\tan \beta=3$ and $\tan\beta=10$). We are not imposing any prior information on the baryon mass-energy density, which turns out to be $\Omega_b\,h^2=0.0225^{+0.0002}_{-0.0003}$ both for the KSVZ and DFSZ models. Since this bounds is derived only by assuming a prior knowledge of primordial abundances of Helium and Deuterium, it is completely independent from the CMB and thus can be compared with the value inferred by Planck collaboration ($\Omega_b\,h^2=0.0224 \pm 0.0001$), showing again a perfect agreement and providing another important consistency check of our numerical analyses. Finally, for completeness, we combine all the three priors together, referring to this dataset as ``BBN-C($Y_p+D/H+\Omega_b\,h^2$)''. This combination provides an improvement in the constraining power on the different parameters, leading to the limit $\Delta N_{\rm eff}<0.14$ at 95\% CL ($\Delta N_{\rm eff}<0.2$ at 99\% CL). This is a factor $\sim 2$ stronger than the bound from the previous two datasets (BBN-A and BBN-B). Consequently, the limits on the axion mass are also improved, obtaining in this case $m_a<0.16$ eV at 95\% CL ($m_a<0.25$~eV at 99\% CL) for the KSVZ model and $m_a<0.10$ eV at 95\% CL ($m_a<0.15$~eV at 99\% CL) for the DFSZ scenario. While this improvement is of course interesting to be noticed, it is also worth stressing that the combination of three different priors from the BBN perspective is not needed, as only two input parameters (\textit{i.e.}, $\Delta N_{\rm eff}$ and $\Omega_b\,h^2$) are required to compute all the light element abundances. Nevertheless, the additional constraints do not produce shifts or biases in the results, and only reduce the uncertainties, see also \autoref{fig:KSVZ_BBN} and \autoref{fig:DFSZ_BBN}, reassessing the consistency among the data sets used here, which show no tensions, and further confirming the robustness of our analyses. \subsection{Results from the full cosmological analyses} The previous results have shown that the axion contribution to the radiation energy density is severely constrained during the BBN epoch both by direct astrophysical measurements of primordial light abundances and by constraints on the baryon energy density, limiting the allowed axion masses to the sub-eV range. Nevertheless the analyses carried out so far focused exclusively on a precise cosmological era, ignoring the subsequent Universe evolution. We shall perform in what follows a comprehensive analysis, addressing all the axion contributions towards the different cosmological epochs/scales. The fiducial cosmological model is a \emph{hot-relic} extension of the $\Lambda$CDM model, including both axions and neutrinos as hot thermal massive relics. We perform Monte Carlo Markov Chain (MCMC) analyses using the publicly available version of the \textsc{COBAYA} software~\citep{Torrado:2020xyz} and computing the theoretical model with the modified version of the cosmological Boltzmann integrator code \textsc{CAMB} \citep{Lewis:1999bs,Howlett:2012mh} described in \autoref{sec.Cosmo.Implementation}. In addition to the $\Lambda$CDM six-parameter model (\emph{i.e.}, the baryon $\omega_{\rm b}\equiv \Omega_{\rm b}h^2$ and cold dark matter $\omega_{\rm c}\equiv\Omega_{\rm c}h^2$ energy densities, the angular size of the horizon at the last scattering surface $\theta_{\rm{MC}}$, the optical depth $\tau$, the amplitude of primordial scalar perturbation $\log(10^{10}A_{\rm S})$ and the scalar spectral index $n_{\rm S}$), we add the axion mass $m_a$ and the sum of three active neutrino masses $\sum m_{\nu}$ (both in $\rm{eV}$). Concerning the QCD axion, we perform two separate analyses for the KSVZ and DFSZ frameworks.\footnote{The previous BBN analyses have shown that changes in the $\beta$ parameter are negligible. Therefore, in the full MCMC analysis within the DFSZ scenario we shall fix $\tan \beta=3$.} We choose flat prior-distributions for all the different cosmological parameters (unless otherwise stated), varying them uniformly in the conservative ranges listed in \autoref{tab.Priors}. We explore the posteriors of our parameter space using the MCMC sampler developed for \texttt{CosmoMC}~\cite{Lewis:2002ah,Lewis:2013hha}, see also Ref.~\cite{Neal:2005} for details concerning the ``fast dragging'' procedure used in our sampling method. The convergence of the chains obtained with this procedure is tested using the Gelman-Rubin criterion~\cite{Gelman:1992zz} and we choose as a threshold for chain convergence $R-1 \lesssim 0.02 $. Concerning observational constraints, our baseline data-set includes: \begin{itemize} \item Planck 2018 temperature and polarization (TT TE EE) likelihood, which also includes low multipole data ($\ell < 30$)~\citep{Aghanim:2019ame,Aghanim:2018eyx,Akrami:2018vks}. We refer to this combination as ``Planck 2018''. \item Planck 2018 lensing likelihood~\citep{Aghanim:2018oex}, constructed from measurements of the power spectrum of the lensing potential. We refer to this dataset as ``lensing''. \item Baryon Acoustic Oscillations (BAO) measurements extracted from data from the 6dFGS~\cite{Beutler:2011hx}, SDSS MGS~\cite{Ross:2014qpa} and BOSS DR12~\cite{Alam:2016hwk} surveys. We refer to this dataset combination as ``BAO''. \end{itemize} \label{sec.Results.CMB} \begin{table} \begin{center} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c@{\hspace{0. cm}}@{\hspace{1.5 cm}} c} \hline \textbf{Parameter} & \textbf{Prior} \\ \hline\hline $\Omega_{\rm b} h^2$ & $[0.005\,,\,0.1]$ \\ $\Omega_{\rm c} h^2$ & $[0.001\,,\,0.99]$\\ $100\,\theta_{\rm {MC}}$ & $[0.5\,,\,10]$ \\ $\tau$ & $[0.01\,,\,0.8]$\\ $\log(10^{10}A_{\rm S})$ & $[1.61\,,\,3.91]$ \\ $n_{\rm s}$ & $[0.8\,,\, 1.2]$ \\ $\sum m_{\nu}$ [eV] & $[0.06\,,\,5]$\\ $m_a$ [eV] & $[0.1\,,\,10]$\\ \hline\hline \end{tabular} \caption{List of the parameter priors.} \label{tab.Priors} \end{center} \end{table} \begin{table*}[htpb!] \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{KSVZ Axion Model}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{\nq{Planck 2018\\ (TT TE EE) }} & \textbf{\nq{Planck 2018\\+ lensing}} & \textbf{\nq{Planck 2018\\+lensing+BAO}} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02244\pm 0.00017$&$0.02243\pm 0.00015$&$0.02250\pm 0.00015$\\ $\Omega_{\rm c} h^2$ &$0.1224^{+0.0018}_{-0.0021}$&$0.1225^{+0.0016}_{-0.0022}$&$0.1208^{+0.0012}_{-0.0014}$\\ $100\,\theta_{\rm {MC}}$ &$1.04060^{+0.00038}_{-0.00034}$&$1.04058\pm 0.00036$&$1.04081\pm 0.00032$\\ $\tau$ &$0.0557\pm 0.0079$&$0.0564\pm 0.0076$&$0.0581^{+0.0070}_{-0.0080}$\\ $\log(10^{10}A_{\rm S})$ &$3.053\pm 0.017 $&$3.055^{+0.015}_{-0.016}$&$3.055^{+0.014}_{-0.016}$\\ $n_s$ &$0.9687\pm 0.0051$&$0.9681\pm 0.0049$&$0.9703\pm 0.0043$\\ $m_a$ [eV] &$< 1.04\,\,(< 1.86)$&$< 0.888\,\,(< 1.67)$&$< 0.282\,\,(< 0.420)$\\ $f_a$ [$10^{7}$ GeV]&$>0.55\,(>0.31)$&$>0.64\,(>0.34)$&$>2.02\,(>1.35)$\\ $\sum m_{\nu}$ [eV] &$< 0.297\,\,(< 0.422)$&$< 0.278\,\,(< 0.381)$&$<0.156\,\,(< 0.192)$\\ $\Delta N_{\rm eff}$ &$< 0.349\,\,(< 0.378)$&$< 0.340\,\,(<0.373)$&$< 0.226\,\,(< 0.275)$\\ $Y_P$&$0.24746^{+0.00077}_{-0.0017} $&$0.24741^{+0.00074}_{-0.0016}$&$0.24693^{+0.00048}_{-0.00097}$\\ $10^5\cdot (D/H)$&$2.556^{+0.033}_{-0.042}$&$2.558^{+0.029}_{-0.040}$&$2.531\pm 0.028$\\ $H_0$ [Km/s/Mpc] &$67.0^{+1.2}_{-0.77}$&$66.9^{+1.2}_{-0.73}$&$67.90\pm 0.53$\\ $\sigma_8$ &$0.790^{+0.029}_{-0.012}$&$0.793^{+0.023}_{-0.011}$&$0.8052^{+0.0099}_{-0.0075}$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained for the KSVZ Axion Model. The constraints on parameters are given at 68\%CL while the upper bounds are given both at 95\% and at 99\% CL.} \label{tab.CMB.KSVZ} \end{table*} \begin{table*}[htpb!] \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7\textwidth}{!}{\begin{tabular}{c c c c} \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{DSFZ Axion Model ($\tan \beta=3$)}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{\nq{Planck 2018\\ (TT TE EE) }} & \textbf{\nq{Planck 2018\\+ lensing}} & \textbf{\nq{Planck 2018\\+lensing+BAO}} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.02243\pm 0.00017$&$0.02244\pm 0.00017$&$0.02250\pm 0.00015$\\ $\Omega_{\rm c} h^2$ &$0.1223^{+0.0018}_{-0.0023}$&$ 0.1224^{+0.0017}_{-0.0024}$&$0.1208^{+0.0012}_{-0.0016}$\\ $100\,\theta_{\rm {MC}}$ &$1.04061^{+0.00039}_{-0.00035}$&$1.04061^{+0.00040}_{-0.00035}$&$1.04081\pm 0.00031$\\ $\tau$ &$ 0.0554\pm 0.0080 $&$0.0566^{+0.0071}_{-0.0081}$&$0.0576^{+0.0069}_{-0.0077}$\\ $\log(10^{10}A_{\rm S})$&$3.052\pm 0.017$&$3.055^{+0.015}_{-0.017}$&$3.054\pm 0.015$\\ $n_s$ &$0.9685\pm 0.0053 $&$0.9682\pm 0.0052 $&$0.9702^{+0.0042}_{-0.0048}$\\ $m_a$ [eV] &$< 0.710 \, (< 1.81)$&$ < 0.697 \, (< 1.42)$&$< 0.209 \, (< 0.293)$\\ $f_a$ [$10^7$ GeV] &$>0.80\,(>0.31)$&$>0.82\,(>0.40)$&$>2.72\,(>1.94)$\\ $\sum m_{\nu}$ [eV] &$< 0.312 \, (< 0.426)$&$< 0.288 \, (< 0.390)$&$< 0.157 \, (< 0.193)$\\ $\Delta N_{\rm eff}$ &$< 0.358 \, (< 0.401 ) $&$< 0.360\, (<0.392)$&$< 0.243\,(<0.290)$\\ $Y_P$&$0.24732^{+0.00077}_{-0.0018}$&$0.24731^{+0.00077}_{-0.0018}$&$0.24689^{+0.00061}_{-0.0012}$\\ $10^5\cdot (D/H)$&$2.554^{+0.032}_{-0.041}$&$2.554^{+0.032}_{-0.042}$&$2.531\pm 0.028$\\ $H_0$ [Km/s/Mpc] &$67.0^{+1.2}_{-0.82}$&$67.0^{+1.2}_{-0.79} $&$67.90\pm 0.58$\\ $\sigma_8$ &$0.792^{+0.027}_{-0.012}$&$0.794^{+0.022}_{-0.010}$&$0.8059^{+0.0093}_{-0.0071}$\\ \hline \hline \end{tabular}} \end{center} \caption{Results obtained for the DFSZ Axion Model ($\tan \beta=3$). The constraints on parameters are given at 68\%CL while the upper bounds are given both at 95\% and at 99\% CL.} \label{tab.CMB.DFSZ} \end{table*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Planck_KSVZ.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the KSVZ QCD axion scenario. The different colors refer to the different data combinations considered for MCMC analyses, see \autoref{tab.CMB.KSVZ}.} \label{fig:Planck_KSVZ} \end{figure*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Planck_DFSZ.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies within the DFSZ QCD axion scenario with $\tan \beta=3$. The different colors refer to the different data combinations considered for MCMC analyses, see \autoref{tab.CMB.DFSZ}.} \label{fig:Planck_DSFZ} \end{figure*} \begin{figure*}[htpb!] \centering \includegraphics[width=\textwidth]{Elements.pdf} \caption{Constraints on the primordial abundance of Helium-4 ($Y_p$, left panel) and Deuterium ($D/H$, right panel) derived within the different methods and data-set detailed in the manuscript. The pink bands identify $68\%$ C.L. from current astrophysical determinations of $Y_p$ \cite{Aver:2015iza} and $D/H$ \cite{Cooke:2017cwo}.} \label{fig:Elements} \end{figure*} In particular, combining the Planck (TT TE EE) spectra with the Planck lensing measurement can be useful to gain some additional sensitivity on parameters that affect both the late-time expansion and the background geometry while the inclusion of the large-scale structure information from BAO measurements from galaxy surveys turns out to become crucial to set bounds on the amount of dark matter in the form of hot relics, as axions and/or neutrinos, as it is a powerful way to break degeneracy in the geometrical sector. We summarize the constraints on the cosmological parameters (at 68\% CL) and the upper bounds on the axion and neutrino masses (both at 95\% and 99\% CL) in \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ} for the KSVZ and DFSZ model, respectively. We also show the corresponding 1D and 2D marginalized posteriors in \autoref{fig:Planck_KSVZ} and in \autoref{fig:Planck_DSFZ}. As concerns the KSVZ axion model, exploiting the 2018 release of Planck temperature and polarization (TT TE EE) data, we derive the upper bound $m_a<1.04\,\rm{eV}$ at 95\% CL ($m_a<1.86\,\rm{eV}$ at 99\% CL) on the axion mass and $\sum m_{\nu}<0.297\,\rm{eV}$ at 95\% CL ($\sum m_{\nu}<0.422\,\rm{eV}$ at 99\% CL) on the sum of the neutrino masses. Notice that now the 95\% CL bound on the axion mass is much less constraining than those previously derived in \autoref{sec.Results.BBN}. Indeed, in this case we have many more parameters and therefore way more degeneracies, especially for the case of the neutrino mass and the cold dark matter energy density. Additionally, we include here the BBN predictions in the MCMC analysis by relating $\Omega_b$ and $Y_P$ through \autoref{eq.Yp} and thus without including direct astrophysical measurements of primordial abundances. While we obtain a slightly less constraining upper limit (even if perfectly consistent with the previous bounds from BBN light element abundances) for the total amount of extra dark radiation due to the axion contribution, $\Delta N_{\rm eff}<0.349$ at 95\% CL, the CMB analyses are fully consistent with both the standard BBN predictions and direct astrophysical measurements, see also \autoref{tab.CMB.KSVZ} and \autoref{fig:Elements} where we compare the values of $Y_P$ and $D/H$ as inferred by the different analysis and datasets. In particular, \autoref{fig:Elements} clearly states the agreement from the different data combinations considered along this study in the extraction of primordial element abundances, reassessing the limits on the different cosmological parameters derived here. Interestingly, the 99\% CL limits on the axion mass turn out to be more constrained than the BBN 99\% CL bounds, especially when including large scale structure observations. This is due to the fact that the large masses allowed within the 99\% CL contours during BBN are now excluded by their late-time effects on structure formation (providing also evidence about the importance of extending the analysis to all the different cosmological epochs and scales). As concerns the other datasets considered in our analyses, we may appreciate that the inclusion of CMB lensing measurements from the Planck satellite improve both the KSVZ axion mass bound $m_a<0.888$ eV at 95\% CL ($m_a<1.67$ eV at 99\% CL) and the limit on neutrinos $\sum m_{\nu}<0.278$ eV at 95\% CL ($\sum m_a<0.381$ eV at 99\% CL). However, as aforementioned, the most significant improvement comes from the inclusion of BAO data. QCD thermal axions and neutrinos are hot thermal relics with very large dispersion velocities, erasing structure formation below their free streaming scale, directly related to their mass. Therefore, none of these hot thermal species will contribute to structure formation at small scales, being the suppression of the matter power spectrum in the linear regime proportional to the amount of dark matter in the form of hot relics. Consequently, the addition of BAO observations leads to a robust upper limit of $m_a<0.282$ eV at 95\% CL ($m_a<0.420$ eV at 99\% CL) simultaneously improving the limit on the total neutrino mass to $\sum m_{\nu}<0.156$ eV at 95\% CL ($\sum m_a<0.192$ eV at 99\% CL). The same analyses for the DFSZ scenario leads to bounds similar to those obtained for the KSVZ axion (as in the BBN case of the previous section). In particular, analyzing the Planck (TT TE EE) data we obtain a more constraining bound on the axion mass with respect to the KSVZ scenario, namely: $m_a<0.710$ eV at 95\% CL ($m_a<1.81$ eV at 99\% CL). Including both lensing and BAO these limits are improved to $m_a<0.209$ eV at 95\% CL ($m_a<0.293$ eV at 99\% CL). Conversely, the limits on the total neutrino mass remain basically unchanged. Finally, we stress that the bounds on the axion mass obtained in this work are a factor $\sim 5$ better with respect to the results derived in Ref.~\cite{Giare:2020vzo} exploiting the very same data-sets. Indeed, in that case the analysis was performed for the axion-pion and the axion-gluon couplings separately. For the former, it was only considered the parameter space where the chiral perturbation theory approach was reliable (\textit{i.e.}, to decoupling temperatures smaller than $62$ MeV). Here, we have overcome both problems smoothly extending the thermal axion production across the QCD phase transition. Furthermore, we improve our predictions for the amount of axions by solving the Boltzmann equation instead of relying upon the instantaneous decoupling approximation. \subsection{A Forecast for CMB-S4 and DESI} One of the key targets of the Stage-IV CMB experiment (CMB-S4) is to increase the accuracy on extra dark radiation by almost an order of magnitude, opening to the possibility of robustly constraining the mass of thermal relics such as QCD axions~ \cite{Abazajian:2016yjj}. In addition, future observations of large scale structure will lead to highly accurate Baryon Acoustic Oscillation (BAO) data and are expected to provide an enormous improvement on the neutrino mass bound~\cite{DESI}. Here we conclude our analyses studying how these future experimental efforts will improve the constraining power on hot relics discussed so far. In particular, we simulate data for a CMB-S4-like \cite{Abazajian:2016yjj} observatory and for a DESI-like \cite{DESI,DESI:2013agm} BAO galaxy survey. These two future probes are expected to provide scientific results in the next few years and have been carefully designed to significantly improve the constraints on the neutrino sector and other forms of dark radiation, see e.g. Refs.~\cite{Abazajian:2016yjj,DESI,constraint_neutrino_stageIV,Abazajian:2019oqj}. \begin{table*} \begin{center} \renewcommand{\arraystretch}{1.5} \resizebox{0.7 \textwidth}{!}{\begin{tabular}{c c c c } \multicolumn{4}{c}{}\\ \multicolumn{4}{c}{\textbf{Forecast $\Lambda$CDM +$m_a=1$eV}}\\[0.2cm] \hline \textbf{Parameter} & \textbf{Fiducial Value} & \textbf{CMB-S4} & \textbf{CMB-S4 + DESI} \\ \hline\hline $\Omega_{\rm b} h^2$ &$0.0224$&$0.022399\pm 0.000035$&$0.022399\pm 0.000034$\\ $\Omega_{\rm c} h^2$ &$0.12$&$0.12050\pm 0.00059$&$0.11984\pm 0.00031$\\ $H_0$ [Km/s/Mpc]&$67.4$&$66.57^{+0.57}_{-0.44}$&$67.16\pm 0.22 $\\ $\tau$ &$0.05$&$0.0506^{+0.0024}_{-0.0026}$&$0.0511^{+0.0024}_{-0.0027}$\\ $\log(10^{10}A_{\rm S})$ &$3.044$&$3.0484\pm 0.0047$&$3.0475\pm 0.0047$\\ $n_s$ &$0.965$&$0.9622\pm 0.0021$&$0.9639\pm 0.0017$\\ $m_a$ [eV] &$1$&$1.13\pm 0.11$&$1.056^{+0.086}_{-0.075}$\\ $\sum m_{\nu}$ [eV] &$0.06$&$< 0.178\,\,(<0.220)$&$< 0.118\,\,(< 0.144)$\\ \hline \hline \end{tabular}} \end{center} \caption{Forecasted mean values, errors and upper bounds on the different cosmological parameters rising from CMB-S4 only and from CMB-S4 plus DESI. The forecasted errors on the parameters are given at 68\%CL, while the upper limits are given both at 95\% and at 99\% CL.} \label{tab.forecast} \end{table*} \begin{figure*} \centering \includegraphics[width=\textwidth]{Forecast.pdf} \caption{Two-dimensional 68\% and 95\% CL allowed regions and one-dimensional probability posterior distributions for the most relevant cosmological parameters in axion cosmologies obtained from the forecasting data and methods, see \autoref{tab.forecast}.} \label{fig:forecast} \end{figure*} The fiducial cosmological model used to build the forecasted data is a \emph{hot-relic} extension of the $\Lambda$CDM model that assumes a non-vanishing axion mass ($m_a=1$ eV) and a non-vanishing total neutrino mass $\sum m_\nu = 0.06$ eV i.e. the minimum mass allowed by neutrino oscillation data. We adopt the KSVZ model for governing the axion interactions. The other standard six cosmological parameters are chosen to be in agreement wit the latest Planck 2018 constraints for a $\Lambda$CDM scenario, namely, we adopt the following fiducial values: $n_s = 0.965$, $\omega_b = 0.0224$, $\omega_c = 0.12$, $H_0 = 67.4$, $\tau=0.05$, $A_s = 2.1 \times 10^{-9}$. Notice that, within the KSVZ scenario, values of the axion mass $\sim 1$ eV, are still marginally consistent with the 95\% CL limit derived from the CMB data but they are strongly disfavored by large scale structure measurements from BAO. Therefore, one would expect to recover the value of axion mass assumed in our fiducial model with an uncertainty $\sigma(m_a)\ll 1\,\rm{eV}$, that will remark the sensitivity on the axion mass from future cosmic probes. In order to generate the forecasted data, we followed the same procedure detailed in \cite{Giare:2021cqr}: using the fiducial model introduced above, we compute the angular power spectra of temperature $ C_\ell^{TT} $, E and B polarization $ C_\ell^{EE,BB} $ and cross temperature-polarization $C_\ell^{TE} $ anisotropies. Then, we consider an experimental noise for the temperature angular spectra of the form \citep{Perotto:2006rj} \begin{equation} N_\ell = w^{-1}\exp(\ell(\ell+1)\theta^2/8 \ln 2)~, \end{equation} where $ \theta $ is the FWHM angular resolution and $ w^{-1} $ is the experimental sensitivity in units of $ \mu\mathrm{K}\,\rm arcmin $. The polarization noise is derived assuming $ w_p^{-1} = 2w^{-1} $ (one detector measures two polarization states). Here we fix $ \theta = \SI{3}{\arcminute} $ and $ w = 1\, \si{\mu\kelvin}\,\rm arcmin $. The simulated spectra are then compared with theoretical ones using the a likelihood $\mathcal{L}$ \citep{Perotto:2006rj,Cabass:2015jwe} \begin{equation} -2\ln\mathcal{L}_{\rm CMB} = \sum_{\ell} (2\ell + 1)f_{\rm sky}\left(\frac{D_\ell}{|C_\ell|} + \ln\frac{|C_\ell|}{|\hat{C_\ell}|} - 3 \right)~, \end{equation} where $\hat{C} $ and $ C $ are the theoretical and simulated spectra with noise, respectively defined by \begin{align} &|C_\ell | = C_\ell^{TT}C_\ell^{EE}C_\ell^{BB} - \left(C_\ell^{TE}\right)^2C_\ell^{BB}~; \\ &|\hat{C}_\ell| = \hat{C}_\ell^{TT}\hat{C}_\ell^{EE}\hat{C}_\ell^{BB} - \left(\hat{C}_\ell^{TE}\right)^2\hat{C}_\ell^{BB}~, \end{align} while $ D $ is \begin{align} D_\ell &= \hat{C}_\ell^{TT}C_\ell^{EE}C_\ell^{BB} + C_\ell^{TT}\hat{C}_\ell^{EE}C_\ell^{BB} + C_\ell^{TT}C_\ell^{EE}\hat{C}_\ell^{BB} \nonumber\\ &- C_\ell^{TE}\left(C_\ell^{TE}\hat{C}_\ell^{BB} + 2C_\ell^{TE}C_\ell^{BB} \right)~. \nonumber\\ \end{align} The range of multipoles is assumed to be $ 5 \leq \ell \leq 3000 $ and the sky coverage of the $ 40\% $ ($f_{\rm sky} = 0.4$). We do not include CMB lensing derived from trispectrum data. For the future BAO dataset we instead consider the DESI experiment~\citep{DESI:2013agm} and we employ the volume average distance as a tracer for BAO~\footnote{It would also be possible to forecast BAO data considering $D_A/r_s$ and $H(z)$ as independent measurements, allowing for stronger constraints. However some small tension ($\sim 1 \sigma$) has been identified between the current constraints from $D_A/r_s$ and $H(z)$ \citep{Addison:2017fdm}. Therefore we follow the conservative approach of \citep{Allison:2015qca} and employ the volume average distance for the BAO forecasts.} \begin{equation} D_V(z)\equiv \left(\frac{(1+z)^2D_A(z)^2cz}{H(z)}\right)^\frac{1}{3}~, \end{equation} where $D_A$ is the angular diameter distance and $H(z)$ the Hubble parameter. Assuming the very same fiducial model previously described, we compute the theoretical values of the ratio $D_V/r_s$ for several redshifts in the range $z=[0.15-1.85]$, where $r_s$ is sound horizon at the photon-baryon decoupling epoch. The uncertainties on $D_V/r_s$ are calculated propagating those for $D_A/r_s$ and $H(z)$ reported in \citep{DESI}. The simulated BAO data are compared to the theoretical $D_V/r_s$ values through a multivariate Gaussian likelihood \begin{equation} -2\ln \mathcal{L}_{\rm BAO} = \sum (\mathbf{\mu} - \hat{\mathbf{\mu}})C^{-1}(\mathbf{\mu} - \hat{\mathbf{\mu}})^T ~, \end{equation} where $\mu$ and $\hat{\mu}$ are the vectors containing the simulated and theoretical values of $D_V/r_s$ at different redshifts and $C$ their simulated covariance matrix. \autoref{tab.forecast} summarizes the results obtained from our forecasting methods for future CMB and BAO experiments while \autoref{fig:forecast} shows the $68\%$ and $95\%$~CL contour plots for the different cosmological parameters. Using our forecasted data for future CMB-S4 observations, we derive the 68\% CL constraint $m_a=1.13\pm 0.11$ eV, showing that future CMB measurements will be able to reach a sensitivity on the axion mass $\sigma(m_a)\simeq 0.1$ eV; about one order of magnitude better than current Planck data. On the other hand, the limit on the total neutrino mass, $\sum m_{\nu}<0.178$ eV ($\sum m_{\nu}<0.220$ eV at 99\% CL), shows that when axions are included in the picture as additional thermal species, the possibility to detect the expected minimum neutrino mass of $\sum m_{\nu}\sim0.06$~eV with future cosmic probes is no longer possible and only upper bounds can be derived, as already pointed out in \cite{Giare:2021cqr}. Combining together the likelihood for CMB-S4 and DESI-like experiments we improve the constraint on the axion mass to $m_a=1.056^{+0.086}_{-0.075}$~eV, i.e. the expected sensitivity combining future CMB and BAO probes is $\sigma(m_a)\simeq 0.08$ eV. Similarly, the bound on the total neutrino mass is improved to $\sum m_{\nu}<0.118$ eV ($\sum m_{\nu}<0.144$ eV at 99\% CL), still below the accuracy needed for a combined measurement of the axion mass together with a detection of a neutrino mass. Notice however that we have explored a very conservative fiducial cosmology assuming the minimum neutrino mass allowed by oscillation experiments (i.e. $\sum m_\nu=0.06$~eV): larger neutrino masses could lead to smaller forecasted errors. Nevertheless the improvement in the measurement of the axion parameters in the context of future cosmological probes is highly remarkable, as can be noticed from a very quick comparison between \autoref{tab.forecast} and \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ}. \section{Conclusions} \label{sec:conclusions} The QCD axion is one of the strongest motivated particle for physics beyond the SM since it solves the strong CP problem and it provides a viable dark matter candidate. From a more general perspective, axion-like particles (ALPs) with properties similar to the QCD axion arise naturally in top-down motivated frameworks such as string compactification~\cite{Arvanitaki:2009fg}. Non-perturbative strong dynamics generates a non-vanishing axion mass, and when thermally produced axions become non-relativistic they leave cosmological signatures that are very similar to those originated by massive neutrinos. Therefore, constraints on axion properties must be derived in cosmological models including also massive neutrino species. Present constraints~\cite{Giare:2020vzo} on these hybrid hot dark matter scenarios rely upon approximate methods that could bias the constraints. On the one hand, they are derived by employing the instantaneous decoupling approximation and the resulting axion relic population is quite sensitive to the precise value of the decoupling temperature; this is due to the significant change in the effective number of the degrees of freedom of the thermal bath. The Boltzmann equation formalism avoids this problem because is not necessary to assume that thermal equilibrium is achieved in the early Universe, and it allows to track carefully the decoupling epoch. On the other hand, a delicate input in the Boltzmann equation is the axion production rate. Previous studies evaluated the cosmological axion mass bounds by considering the axion-pion and axion-gluon scattering separately. We employ here the results provided by Refs.~\cite{DEramo:2021psx,DEramo:2021lgb} in which the production rate is continuous across the QCD crossover. By means of the robust Boltzmann equation integration method, we revisit here the constraints in a hydrid mixed hot dark matter scenario, in which both neutrinos and QCD axions are present. We retrace the entire cosmological history of relic axions. First, we track their number density via a numerical solution of the Boltzmann equation and we evaluate their asymptotic comoving number density. This quantity gets frozen when axions stop experiencing any interactions with the thermal bath, and this happens always well above the MeV scale. Thus once we approach the first cosmological era that allows us to put meaningful constraints, namely the BBN epoch, the number of axions in the comoving volume is a fixed quantity that cannot change. We compare our predictions with observations probing the time of BBN (light element abundances), the recombination era (CMB temperature and polarization), and large scale structure (lensing and BAO). For the axion mass range investigated here, axions are always relativistic at the time of BBN. They provide an additional contribution to dark radiation that we parameterize in terms of an effective number of additional neutrino species $\Delta N_{\rm eff}$. Analyzing light element abundances through BBN, we find the constraint $\Delta N_{\rm eff}<0.3$ at $95\%$~CL. For the KSVZ axion, we find the mass bound $m_a< 0.6$~eV (also at $95\%$~CL). If a prior on the baryon energy density from CMB is assumed, these bounds are further improved to $\Delta N_{\rm eff}<0.14$ and $m_a< 0.16$~eV, respectively. Similar results are found for the DFSZ axion (see \autoref{tab.BBN} for the complete set of BBN bounds). When one considers later cosmological eras, axions may not be relativistic anymore because they lose their kinetic energy as the Universe expands. The recombination temperature is $0.3$~eV, and therefore axions heavier than approximately this scale (see \autoref{eq:TaLS}) are non-relativistic at the time of CMB formation. If this is the case, they do not contribute to dark radiation at recombination but rather provide a sub-dominant hot dark matter component. Furthermore, their non-vanishing mass is responsible for washing out cosmological structures at small scales through free-streaming. We employ cosmological observations from the CMB temperature, polarization and lensing from the Planck satellite combined with large scale structure data. In our analysis, we include the consequences of the axion presence at BBN. For the KSVZ axion, we find the bounds $\Delta N_{\rm eff}<0.23$, $m_a< 0.28$~eV and $\sum m_\nu < 0.16$~eV (all at $95\%$~CL). This corresponds to a factor of $\sim 5$ improvement in the axion mass with respect to the existing limits~\cite{Giare:2020vzo}. For the DFSZ axion the bounds are even more constraining, as a consequence of the larger production rate, and they explicitly read $\Delta N_{\rm eff}<0.24$, $m_a< 0.21$~eV and $\sum m_\nu < 0.16$~eV (all at $95\%$~CL). The full set of bounds from cosmology are summarized in \autoref{tab.CMB.KSVZ} and \autoref{tab.CMB.DFSZ} for the KSVZ and DFSZ axions, respectively. Following the same procedure used for current observational data, we perform a forecasted analysis for upcoming cosmological and astrophysical surveys, targeting a CMB-S4-like observatory and a DESI-like BAO galaxy survey. For this analysis we chose a fiducial $\Lambda$CDM model with a non-vanishing axion and total neutrino mass, simulating constraints for the case of CMB-S4 alone and for CMB-S4+DESI. Our results show that future CMB observations will be able to reach a sensitivity on the value of the axion mass around an order of magnitude better than current constraints while the bounds on the total neutrino mass will be improved by a factor of $\sim 2$. When combined with a DESI-like experiment, we found a $\sim 20\%$ improvement in the constraints on the axion mass leading to $\sigma(m_a) = 0.08 $ eV (for a fiducial $m_a = 1$~eV), while the total neutrino mass bound is improved by slightly more than $30\%$. Therefore, upcoming observations from future CMB and galaxy surveys could reach percent level constraints on the value of the axion mass. We refrain however that the inclusion of additional thermal species at early time significantly impacts the achievable bounds on the total neutrino masses preventing a direct measurements if $\sum m_\nu \lesssim 0.1$~eV. In concluding, while the future of the constraints on beyond the SM physics looks very bright from the point of view of next generation CMB and BAO experiments, extremely precise and carefully developed models of particle interactions in the early Universe are needed to keep theoretical modeling at pace with the improvements in accuracy that cosmological and astrophysical observations will perform in the current decade. \section*{CRediT authorship contribution statement} \textbf{Francesco D’Eramo}: Conceptualization, Validation, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Eleonora Di Valentino}: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{William Giar\`e}: Conceptualization, Software, Formal Analysis, Visualization, Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Fazlollah Hajkarim}: Conceptualization, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Alessandro Melchiorri }: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Olga Mena}: Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing, Supervision. \textbf{Fabrizio Renzi}: Conceptualization, Software, Formal Analysis, Validation, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing. \textbf{Seokhoon Yun}: Conceptualization, Formal Analysis, Methodology, Writing - Original Draft, Writing - Review $\&$ Editing \begin{acknowledgments} The work of FD, FH and SY is supported by the research grants: ``The Dark Universe: A Synergic Multi-messenger Approach'' number 2017X7X85K under the program PRIN 2017 funded by the Ministero dell'Istruzione, Universit\`a e della Ricerca (MIUR); ``New Theoretical Tools for Axion Cosmology'' under the Supporting TAlent in ReSearch@University of Padova (STARS@UNIPD). EDV is supported by a Royal Society Dorothy Hodgkin Research Fellowship. FD, WG, FH, AM and SY are supported by Theoretical Astroparticle Physics (TAsP),``iniziativa specifica'' of Istituto Nazionale di Fisica Nucleare (INFN). The work of FD and OM is supported by the Spanish grants PID2020-113644GB-I00, PROMETEO/2019/083 and by the European ITN project HIDDeN (H2020-MSCA-ITN-2019/860881-HIDDeN. FR acknowledges support from the NWO and the Dutch Ministry of Education, Culture and Science (OCW) (through NWO VIDI Grant No.2019/ENW/00678104 and from the D-ITP consortium). FD acknowledges the hospitality while this work was in preparation of the Munich Institute for Astro- and Particle Physics (MIAPP) which is funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany´s Excellence Strategy – EXC-2094 – 390783311 \end{acknowledgments}
\section{\label{sec:level1}Introduction} The recent development in brilliant ultrafast optical and x-ray sources with femtosecond resolution has fostered investigations that aim at fundamental understanding of light-matter interaction and the resulting non-equilibrium properties of matter \cite{cn:Cavalleri05,cn:Ernstorfer09,cn:Melnikov11,cn:Ichikawa11,cn:Stojchevska14,cn:Huebener17,cn:Lloyd21}. This paves the way for applications such as light-induced control of magnetization reversal for data storage \cite{cn:Stamm07,cn:Radu11} or light-induced hot carriers for photo-catalytic processes, detection devices and energy harvesting \cite{cn:Brongersma15,cn:Narang16}. Time-dependent density functional theory (TDDFT) \cite{cn:Marques12,cn:Sharma14,cn:Olevano18} in the real-time domain has evolved as an important tool to unravel the dynamics of excitation processes in organic and inorganic materials \cite{cn:Lloyd21}. Recent efforts cover various aspects of light-matter interaction in metals \cite{cn:Volkov19,cn:Senanayake19} and semiconductors \cite{cn:Sato14b,cn:Tancogne17,cn:Pemmaraju18}, the simulation of pump-probe experiments in Si \cite{cn:Sato14a} or nonlinear absorption in complex molecules \cite{cn:Guandalini21} as well as charge and energy transfer after the impact of fast ions in aluminum sheets and nanoclusters \cite{cn:Schluenzen19,cn:Deuchler20,cn:Kononov20}. Many potential applications of non-equilibrium states induced by laser pulses involve a combination of different materials, for instance in the field of photo-catalysis \cite{cn:Wu12,cn:Akimov13} or optically induced (de-)magnetization processes and spin-transport in multilayer materials for magnetic storage \cite{cn:Rudolf12,cn:Cardin20}. In this spirit not only experiment but also first-principles studies on optically excited systems in the real-time domain are shifting from single material and bulk systems towards heterogeneous systems with increasing complexity. While significant fraction of this research is concerned with the fundamental understanding of demagnetization processes in metallic multilayer systems \cite{dewhurst2018laser,cn:Chen19}, the photo-induced catalytic processes and energy conversion usually involve the transfer of energy and charge across interfaces \cite{cn:Akimov13,cn:Wu15}. Here, real-time TDDFT (RT-TDDFT) approaches contribute towards a fundamental understanding of the carrier dynamics related to the plasmon-mediated injection of hot electrons from metallic nanostructures into semiconductors or insulators \cite{cn:Long14,cn:Zhang19,cn:Iida20,cn:Tomko21}. The efficient transfer of excitations or dissipation of energy across interfaces has also evolved as an important topic of ultra-fast pump-probe experiments \cite{cn:Melnikov11,cn:Rothenbach19,cn:Schumacher19,beyazit2019local}. Understanding the interaction of laser pulses with a heterostructure offers the possibility to induce selectively excitations in a particular layer which may propagate into the entire system. At the interface between metallic and insulating layers, the electronic structure is characterized by the hybridization between orbitals of the metallic and insulating part, which usually leads to localized states within the gap in the adjacent layer of the insulator \cite{cn:Oleinik00,cn:Butler01,cn:Abedi10,cn:Rothenbach19}. As we will show, these interface states might be employed by a proper choice of the photon energy to foster a simultaneous, concerted excitation of electrons and holes. This allows for a charge-neutral, but asymmetric propagation of the excited carriers into the metallic and insulating subsystems. The symmetry breaking at the interface leads to splitting of states with in-plane and out-of-plane orbital character. As pointed out earlier, changing the polarization of the incident light wave may result in a substantially different response \cite{gruner2019dynamics}, which could be used to select particular excitations at the interface and differentiate between the pathways of energy propagation into the bulk materials. Fe/MgO(001) represents the ideal model system to explore such effects. The Fe/MgO system was extensively investigated in the context of TMR (tunnel magnetoresistance) and benefits from the fact that electronic, magnetic and transport properties are well established \cite{cn:Butler01,cn:Mathon01,cn:Tiusan04,cn:Waldron06,cn:Belashchenko05,cn:Heiliger08,cn:Peralta08,cn:Rungger09,PhysRevB.79.174414,cn:Abedi10}. Recently, also optical and lattice excitations have been subject to theoretical and experimental studies \cite{cn:Rothenbach19,gruner2019dynamics,cn:Eggert20,cn:rothenbach2021effect}. Bulk Fe is a ferromagnetic metal with bcc structure and a magnetic moment of $2.22\,$$\mu_{\rm B}$/atom \cite{cn:LandoltBornstein2014}, showing a substantial density of occupied and unoccupied $d$-states in the vicinity of the Fermi level. MgO in turn is a wide band gap insulator, with an experimental band gap of of about $\sim$$\,7.7\,$eV \cite{roessler1967electronic,whited1973exciton}). DFT calculations with local or semi-local exchange-correlation functionals yield $4.5\,$eV$-4.9\,$eV \cite{cn:wang2004electronic,cn:schleife2006first,cn:shishkin2007self,cn:nourozi2019electronic} but the band gap can be improved by using hybrid exchange-correlation functionals, for a correct description considering quasiparticle and excitonic effects is essential \cite{cn:shishkin07,cn:Schleife09,begum2021theoretical}. On the other hand, since quasiparticle corrections essentially lead to a rigid shift of the electronic states of the insulator \cite{begum2021theoretical} in MgO, semi-local functionals still allow for a qualitative analysis of optical excitation processes. \begin{figure} \includegraphics[width=\columnwidth]{Fig1-resub.png}% \caption{\label{fig:intro} Layer resolved electronic density of states indicating the main orbital character of the states in the vicinity of the gap. The colored areas (orange for $\hbar\omega=2.25\,$eV, blue for $\hbar\omega=4.5\,$eV, green for $\hbar\omega=7.75\,$eV) mark the maximum energy range, in which direct resonant excitations can be expected (i.\,e.\ from the occupied states at $-\hbar\omega$ to the Fermi level and from the Fermi-level up to the unoccupied states at $\hbar\omega$). The horizontal arrow in the lowest panel denotes the position of the MgO band gap, obtained from the comparison of the bulk LDA band-structure with the bands originating from the center layer of MgO \protect\cite{gruner2019dynamics}. Inset: Side view of the minimal heterostructure Fe$_{1}$/(MgO)$_{3}$(001){}. The oscillating arrows illustrate the two orientations of the propagation direction of the applied laser pulses and the corresponding polarization of the electric field with respect to the layer stacking. } \end{figure} Here, we investigate a minimum four-layer system Fe$_{1}$/(MgO)$_{3}$(001), see Fig.~\ref{fig:intro}, which enables us of obtaining a qualitative picture of the various types of excitations and the dynamics of excited carriers at the metal-insulator interface in the real-time domain. Despite its simplicity our minimum model system already offers the necessary ingredients, such as a metallic and a nearly insulating layer separated by an interface layer characterized by a considerable hybridization between the $3d$-states of Fe and the $2p$-states of the apical oxygen, as illustrated in the layer- and orbital-projected density of states (DOS) in Fig.~\ref{fig:intro}(b). We use a RT-TDDFT modelling employing the adiabatic LDA (ALDA) for exchange and correlation for an adequate compromise regarding computational efficiency and numerical stability. Since our investigation is limited to the first $50$\,fs and photon energies far above the highest phonon modes, we neglect at the current stage ionic motion and electronic dissipation channels not covered by the ALDA. In our previous investigation \cite{gruner2019dynamics}, we concentrated on optical excitations with laser frequencies up to 3.27\,eV. These are still below the calculated bulk band gap of MgO obtained from (semi-)local DFT calculations. These photon energies allow thus for excitations in the Fe-layer that reach beyond the charge transfer gap but not for direct excitation in MgO, see Fig.~\ref{fig:intro}. In the present work, we now focus on laser frequencies in the vicinity and above the LDA band gap of MgO. We demonstrate that the excitation of the system (Fe vs.\ MgO vs.\ interface) depends strongly on the excitation energy and the polarization direction of the electric field. While the propagation of excited carriers across the interface could lead to to the accumulation or depletion of charge in particular zones, we observe, that interface-mediated simultaneous (but independent) excitation processes, involving electrons and holes, can effectively compensate the net electrical transfer. In addition, we study the effect of field strength on the transfer of excitations and the impact of spin-orbit interaction (SOI), which results in transient changes in magnetization, arising from the optical excitation. The paper is structured as follows: In Sec.\ \ref{sec:comp} we present the computational methodology and details. Sec.\ \ref{sec:mdyn} is devoted to magnetization dynamics, while in Sec.\ \ref{sec:inplane} we compare the excitation patterns for three frequencies and in-plane polarization of the light field. Sec.\ \ref{sec:outplane} addresses the dependence on the polarization direction of the electric field. Finally, Sec.\ \ref{sec:sum} provides a discussion and summary of the results. \section{\label{sec:comp} Computational details} The electronic structure and time-dependent properties were obtained from density functional theory (DFT) calculations using the ELK code \cite{ELK}, which is an all-electron full-potential linearized augmented-plane wave (LAPW) code that implements time-dependent DFT (TDDFT) in the real-time (RT) domain. To model Fe$_{1}$/(MgO)$_{3}$(001)\ we used muffin tin radii of 1.139 \AA, 1.164 \AA\ and 0.855 \AA\ for Fe, Mg and O, respectively. The plane wave cut-off parameter, $RK_{max}$, was set to 7. A $8 \times 8 \times 3$ $k$-mesh was used for the reciprocal space sampling. In the ground-state calculations, the convergence criterion for the electronic self-consistency cycle was a root-mean-square change of 10$^{-7}\,$a.u.\ in the Kohn-Sham potential. For the exchange-correlation functional we have chosen the local (spin) density approximation (LDA) in the parametrization of Perdew and Wang (PW92) \cite{perdewB45}. The optimized geometry \cite{gruner2019dynamics} was previously obtained with the VASP code \cite{cn:VASP1,cn:VASP2} using the generalized gradient approximation (GGA) of Perdew, Burke, and Ernzerhof (PBE) \cite{cn:Perdew96}. VASP (PBE) and Elk (LDA) lead to similar spin- and layer-resolved ground-state electronic partial DOS (PDOS) of the Fe$_{1}$/(MgO)$_{3}$(001)\ heterostructure, which is shown in Fig.~\ref{fig:intro} (for more details see~\cite{gruner2019dynamics}). In our investigation, we simulate laser pulses with different laser frequencies and peak power densities but constant duration. The monochromatic electromagnetic wave is folded with a Gaussian envelope with a constant full-width at half-maximum (FWHM) of $5.81\,$fs. The peak of the pulse is reached at $t=11.6\,$fs after the start of the simulation. \\ The real-time TDDFT method propagates the electron density in time by integrating the time-dependent Kohn-Sham equation (TDKS) \cite{krieger2015laser, elliott2016ultrafast, dewhurst2018laser, elliott2016optimal, dewhurst2016efficient}. The electric field of the laser pulse, expressed by the vector potential, $\bold A_{\rm ext}(t)$, enters the KS equation as a velocity gauge. \\ By solving the TDKS equations, we can obtain the time-dependent electronic properties of a system such as time-resolved DOS (TDDOS), using the following equation, see Ref. \cite{dewhurst2018laser}: \begin{equation} \begin{aligned} D_{\sigma}(E,t) = \sum_{i=1}^{\infty} \int_{\rm BZ} d^3\,\bold k \delta(E - \varepsilon_{i\bold{k}\sigma})\, g_{i\bold{k} \sigma}(t) \label{eq:TDDOS} \end{aligned} \end{equation} Where $g_{i\bold{k}\sigma}(t)$ are the time-dependent and spin-resolved occupation numbers, defined as: \begin{equation} \begin{aligned} g_{i\bold{k}\sigma}(t) = \sum_{j} n_{j\bold{k}\sigma} \left | \int d^3r\, \Phi_{j\bold{k}\sigma}(\bold r,t)\, \Phi^*_{i\bold{k}\sigma}(\bold r,0) \right |^2 \end{aligned} \end{equation} Here $n_{j\bold{k}\sigma}$ is the occupation number of the $j^{th}$ orbital and $\Phi_i$ are the ground-state Kohn-Sham orbitals~\cite{elliott2016ultrafast}. \begin{figure}[!htp] \includegraphics[width=0.5\textwidth]{Fig2-resub.png}% \caption Time-dependent vector potentials of laser pulses with different frequencies of $\hbar\omega$ = 2.25 eV, $\hbar\omega$ = 4.5 eV and $\hbar\omega$ = 7.75 eV (left) and Fourier transform of the time-dependent electric field for these laser pulses (right).} \label{E-t-fourier} \end{figure} \section{\label{sec:Results} Results} We carried out a systematic investigation of the impact of optical pulses with varying frequency, intensity and polarization on a Fe$_{1}$/(MgO)$_{3}$(001)\ heterostructure which consists of one layer of Fe and three layers of MgO: two interface (IF) and one central (C) in the latter, as illustrated in Fig.~\ref{fig:intro}. Consistent with our previous study \cite{gruner2019dynamics}, the laser pulses were designed to achieve a fluency typically found in experiments \cite{cn:Bierbrauer17,cn:Eschenlohr17} with a constant peak power density $S_{\rm peak}\approx 5\times 10^{12}\,$W/cm$^2$ for most of our calculations. % Additionally, we applied also pulses with $S_{\rm peak}\approx 5\times 10^{11}\,$W/cm$^2$ and $S_{\rm peak}\approx 5\times 10^{10}\,$W/cm$^2$, to assess the effect of nonlinear contributions (a detailed discussion is given in the Supplemental Material \cite{cn:supp}). The shape of the laser pulses, as well as the Fourier transform of the time-dependent electric field are shown in Fig. \ref{E-t-fourier}. Due to their finite duration, the pulses are not monochromatic and the Fourier transform of the time-dependent electric field $\bold{E}(t) = -\partial \bold {A_{\rm ext}(t)}/\partial t$ is characterized by a Gaussian energy distribution with a constant FWHM of 0.63\,eV centered around the energy of the monochromatic light wave. Our present investigation covers photon energies below ($\hbar\omega=$2.25 eV), in the order of ($\hbar\omega=$4.5 eV) and above ($\hbar\omega=$7.75 eV) the LDA band gap of MgO (4.64\,eV, consistent with previous results \cite{cn:wang2004electronic,cn:schleife2006first,cn:shishkin2007self,cn:nourozi2019electronic}) with particular emphasis on the impact of the polarization direction of the light wave relative to the orientation of the surface, as indicated by the oscillating red arrows in Fig.~\ref{fig:intro}. \begin{figure}[!htp] \includegraphics[width=0.45\textwidth]{Fig3-resub.png}% \caption Change of the total magnetic moment in the simulation cell as a function of time for in-plane and out-of-plane laser pulses with different laser frequencies.} \label{moment} \end{figure} \subsection{\label{sec:mdyn} Magnetization dynamics} Beyond our previous work \cite{gruner2019dynamics}, we include here the spin-orbit interaction (SOI). With SOI, the $z$-component of the electronic spin is no longer a conserved quantity, and thus the laser excitation may impact the magnetization of the system. We expect the largest effect for Fe, which in the ground state carries a moment of $2.25$ $\mu_{\rm B}$\ (close to the experimental value for bulk bcc iron, $2.22$ $\mu_{\rm B}$\ \cite{cn:LandoltBornstein2014}) and provides nearly the complete magnetization of the system, whereas on the neighboring O- and Mg IF-sites there is only a small induced spin-polarization of $6.4\times 10^{-4}$ $\mu_{\rm B}$\ and $1.3\times 10^{-2}$ $\mu_{\rm B}$, respectively. The time-dependent change of the total magnetization (cf.\ Fig.~\ref{moment}) shows dependence on the laser frequency as well as polarization, but remains with at most $\Delta m=-0.15$ $\mu_{\rm B}$\ small compared to the total moment in the cell. For an in-plane orientation of the electric field vector, the largest decrease is observed for a photon energy of $2.25\,$eV with its maximum change around $40\,$fs after the start of the pulse and a steady recovery afterwards. With increasing photon energies the effect is even smaller and the maximum change is reached earlier in time. This is attributed to the fact that the $d$-electrons, responsible for the large spin polarization, are more efficiently addressed by the lower energy pulses. For a polarization of the electric field along the stacking direction of the layers, the response of the magnetic subsystems is weaker with minute changes in magnetization for the photon energy of $4.5\,$eV and somewhat larger for $7.75\,$eV ($\Delta m=-0.05\,$$\mu_{\rm B}${}). Thus, we conclude that SOI has only a minor impact on the dynamics of charge transfer and excitations across the interface in Fe$_{1}$/(MgO)$_{3}$(001). This is further supported by a detailed comparison of the time- and layer-resolved DOS for two relevant cases in the Supplemental Material \cite{cn:supp}, which does not exhibit a notable difference between the excitation patterns obtained with SOI and within the scalar-relativistic approach. The limited impact of the laser pulse on the magnetization dynamics indicates that the mixing between the spin channels is small and thus the $z$ component of the spin is rather conserved. This allows us to use the differences between the spin-up and down projected time-resolved DOS to identify the propagation of excitations from the strongly spin-polarized Fe layer to the non-spin-polarized MgO part. However, further studies involving thicker heterostructures may be necessary to address other relevant mechanisms that can lead to laser induced magnetization reversal such as the optically induced spin transfer (OISTR) mechanism \cite{dewhurst2018laser}, observed in combined ferro-/antiferromagnetic heterostructures. \subsection{\label{sec:inplane} Laser excitations below and above the MgO gap} In the following we will address how the response of a metal/insulator heterostructure depends on the frequency of the electromagnetic wave. We elucidate different scenarios in our RT-TDDFT simulation by applying three different laser pulses with the same shape and peak power density $S_{\rm peak}\approx 5\times 10^{12}$ W/cm$^2$ as in the previous section, but with different excitation energies $\hbar\omega = 2.25\,$eV, $4.5\,$eV and $7.75\,$eV, covering the relevant range of photon energies. We start with the electric field of the pulse oriented along the $x$-axis, i.\,e., parallel to the stacking plane. For the first energy, $\hbar\omega$$\,=\,$$2.25\,$eV, the imaginary part of the dielectric tensor exhibits a local maximum. This energy is clearly below the band gap and can only address interface states in the MgO part or the conduction band across the charge transfer gap. The second energy of $4.5\,$eV falls slightly short of the LDA band gap of $4.64\,$eV. Although the finite pulse width leads to a Gaussian distribution of energies with a tail above this value (cf.\ Fig.~\ref{E-t-fourier}), direct excitations across the gap are negligible. The largest energy, $\hbar\omega$$\,=\,$$7.75\,$eV, is on the other hand sufficient for optical excitations in bulk MgO (see Fig.\ S3 in the Supplemental Material \cite{cn:supp} for a comparison of the response of bulk MgO to pulses with $\hbar\omega=4.5\,$eV and $7.75\,$eV). \begin{figure} \includegraphics[width=0.5\textwidth]{Fig4-resub.png}% \caption{Changes in the charge distribution $\Delta\rho({\mathbf r},t)=\rho({\mathbf r},t)-\rho({\mathbf r},0)$ at $t=20.2\,$fs after illumination with an in-plane polarized laser pulse with $S_{\rm peak}\approx 5\times 10^{12}\,$W/cm$^2$ for a) $\hbar\omega$ = 2.25 eV, b) $\hbar\omega$ = 4.5 eV and c) $\hbar\omega$ = 7.75 eV. Red/blue isosurfaces indicate regions with a depletion/accumulation of charge with an isosurface level of $\pm 2\times10^{-3} e_0/a^3_B$. } \label{fig:ChgIP} \end{figure} The transient charge redistribution in the Fe/MgO heterostructure, $\Delta\rho({\mathbf r},t)=\rho({\mathbf r},t)-\rho({\mathbf r},0)$, shown in Fig.~\ref{fig:ChgIP} for the three excitation energies at $t=20.2\,$fs, right after the decay of the laser pulse, provides a spatially resolved illustration of the characteristic differences between the three excitation frequencies. For all three frequencies, only small features show up at the Mg sites, indicating the primary importance of Fe and O orbitals. The changes in the charge cloud around the central Fe atom are largest for $\hbar\omega = 2.25\,$eV, while for $\hbar\omega = 7.75\,$eV we see enhanced excitations in the MgO layers, in accordance with our considerations from the last paragraph. The isosurfaces for $\hbar\omega$$\,=\,$$2.25\,$eV and $4.5\,$eV indicate a transfer of charge mainly from in-plane ($d_{x^2-y^2}$\ and/or $d_{xy}$) to $d_{3z^2-r^2}$\ orbitals of Fe. Likewise at the apical O(IF) a transfer from in-plane oriented $p_x$ to out-of-plane $p_z$ orbitals takes place. For $\hbar\omega$$\,=\,$$7.75\,$eV the pattern in $\Delta\rho({\mathbf r},t)$ rather suggests a transfer from $d_{xz}$\ and $d_{yz}$\ to $d_{3z^2-r^2}$\ and in-plane $d$-orbitals at the Fe site, whereas at O(IF) and O(C) a rather symmetric and much larger pattern emerges, indicating again a significant transfer from in-plane to out-of-plane oriented $p$-orbitals. \begin{figure*} \includegraphics[width=0.9\textwidth]{Fig5-resub.png}% \caption Time-dependent changes in the layer-resolved $\Delta$TDDOS for three in-plane laser pulses with frequencies $\hbar\omega$ = 2.25 eV (a-c), $\hbar\omega$ = 4.5 eV (d-f), $\hbar\omega$ = 7.75 eV (g-i) and a peak power density of $S_{\rm peak}\approx 5\times 10^{12}$ W/cm$^2$. The three columns show the partial $\Delta D_{\sigma}(E,t)$ of the Fe, the IF-MgO and the Center-MgO layers, respectively. The energy $E$ is given relative to the Fermi level. Note that the color scale differs between the columns. Purple arrows mark particular transitions and hybritizations which are discussed in the text. The green area at the left edge of each panel shows the static ground-state partial density of states for the respective layer. For better visibility, the static DOS of the MgO layers in the center and right column is scaled by a factor 4 compared to Fe in the left column.} \label{orbital-deltaTDDFT-atom-resolved-in-plane} \end{figure*} To address the question whether the excitations are coupled or occur independently in each layer we compare in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane} the change in the spin- and layer-resolved projected time-dependent DOS $\Delta D_{\sigma}(E,t) = D_{\sigma}(E,t)-D_{\sigma}(E,0)$ for the three cases. For the lowest frequency $\hbar\omega=2.25\,$eV, we consistently observe the largest changes in the minority spin channel of the Fe-layer, as it offers in comparison to the majority channel a larger number of potential initial and final states. Most of the features can be traced back to direct resonant transitions from occupied to unoccupied states in the static DOS, but several features appear also at energies significantly above and below the Fermi level. Such excitations are in particular present in both MgO layers, for instance close to the valence band edge of MgO, which lies around $4\,$eV below the Fermi level in the present heterostructure, suggesting a multi-photon excitation process. These excitation patterns disappear, when the intensity of the pulse -- specified here in terms of its peak power density -- is reduced by one or two orders of magnitude, while the features within $\pm\hbar\omega$ from $E_{\rm F}${} are still present (see Fig.~S6 and S7 in the Supplemental Material \cite{cn:supp} for a detailed discussion). This proves that the features far away from $E_{\rm F}${} arise from non-linear processes, while resonant excitations in the vicinity of $E_{\rm F}${} remain the main channel for carrier excitation. This indicates in turn that non-linear excitation effects in sufficiently strong pulses may be employed to effectively (de-)populate spatially extended states in the valence or conduction band of MgO(IF) and MgO(C) at energies beyond the reach of a direct excitation. Thus, for MgO(C) a significant depletion of valence band states takes place between $-4$ and $-5\,$eV, almost as large as in MgO(IF). Likewise, we observe connected features at $+8\,$eV, both indicated by the horizontal arrows in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(b-c). In MgO(C) intermediate levels, from which carriers might by excited beyond the gap, are essentially absent owing to the exponential decay of interface states in the band gap with increasing distance from the interface. Nevertheless, the changes in occupation numbers in the valence and conduction band are even larger in the central layer compared to the interface. The resonant excitations in the vicinity of the Fermi level confirm our previous conjecture, that hybridization between out-of-plane oriented orbitals in adjacent layers is particularly relevant for the transfer of excitations into and through the interface \cite{gruner2019dynamics}, see Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(a-c). Because of the large exchange-splitting, unoccupied $d_{3z^2-r^2}$\ states of Fe in the majority spin channel are located in the right window, $+0.8\,$eV above $E_{\rm F}${}, such that electrons can be transferred from in-plane $d$-orbitals around $-1.5\,$eV below $E_{\rm F}$\ (vertical arrows in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(a)) to $d_{3z^2-r^2}$. These hybridize with the $p_z$ orbitals of MgO(IF), which show a significant occupation as well in this energy range. In contrast, the decrease in occupation of the $p_x$ and $p_y$ states in MgO(IF) around $-1.5\,$eV appears much weaker, in particular compared to the rather strong effect in the $d_{x^2-y^2}$\ and $d_{xy}$\ orbitals of the Fe layer found at the same energy. In the minority channel, the out-of-plane oriented bonding $d_{3z^2-r^2}$\ states at $-2\,$eV mediate the excitation of carriers from the O $p_z$ states in the interface to the Fe $d_{xz}$\ and $d_{yz}$\ states around $+0.5\,$eV, which hybridize with the in-plane oriented $p_x$ and $p_y$ interface states in MgO(IF), see the horizontal arrows in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(a-b). Their occupation is much lower, compared to the out-of-plane $p_z$ states in the majority channel in the same energy range. The excitation pattern becomes more defined when we increase the energy towards the band gap of MgO. Due to the confined width of the $d$ band in the Fe-monolayer, the number of matching initial and final states for excitations within the $d$-band of Fe is diminished. For $\hbar\omega=4.5\,$eV, our simulations do not yield significant direct excitations between valence and conduction band states in bulk MgO. Thus, at this energy we can pinpoint the interface layer as pivotal for the excitations. Accordingly, we still observe in all layers a different excitation pattern in the minority and majority channel arising from the proximity to the spin-polarized Fe-layer. In the majority channel, carriers from the delocalized valence band edge of MgO(IF) and MgO(C) are excited into unoccupied interface states at $+0.5\,$eV, which hybridize with the $d_{3z^2-r^2}$\ states in the Fe-layer. In the minority channel, we observe a similar mechanism as described above, which effectively relocates charge density in reverse direction, towards MgO. It involves the $d_{3z^2-r^2}$\ states of Fe which hybridize with conduction band states of MgO(IF) and MgO(C), see Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(d-e). If we take a separate look at the central layer in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(f), we observe that states at the valence band edge of MgO(C) deplete and a concomitant occupation in the conduction band takes place, which is, however, separated by at least twice the laser energy. The comparison with our calculations for MgO bulk prove (cf.\ Fig.\ S3(b) in the Supplemental Material \cite{cn:supp}), that the intensity of the excitation cannot be explained by a direct transition in bulk MgO. Instead, the IF layer plays a decisive role, as it mediates concerted excitations from the valence band states extending between MgO(IF) and MgO(C) to the hybridized states of MgO(IF) and Fe just above the Fermi level and, simultaneously, hybridized states of MgO(IF) and Fe just below the Fermi level to extended conduction band states in MgO(IF) and MgO(C). These processes work in opposite direction and can be invoked independently by the same laser pulse. Their combination prevents an effective charge transfer between the metallic and the insulating subsystem. For $\hbar\omega=7.75\,$eV, a substantial laser excitation can occur directly in the MgO subsystem without the support of interface states. As a consequence, the excitation patterns of both spin channels assimilate in both layers of MgO, as compared to the lower photon energies. The largest fraction of the excitations removes states from the first peak below the valence band edge at $-4\,$eV (corresponding to $-1.2\,$eV in bulk MgO) and populates states around $3.5$-$4.0\,$eV (corresponding states in bulk MgO are located around $6.5\,$eV, see Fig.\ S3(a) in the Supplemental Material \cite{cn:supp}), which are marked by the vertical arrows in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(g-i). Direct excitations in the Fe-layer, as observed for the smaller frequencies, are largely absent. The substantial changes in the occupation numbers in Fe close to the Fermi level are again best explained through the interface-mediated mechanisms discussed above, which originate from the the hybridization between the spin-polarized states in Fe with MgO(IF). Despite the largest amount of excitation taking place directly in MgO(IF) and MgO(C), there is still a notable remaining asymmetry between the spin channels visible in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}(i). This asymmetry is a consequence of the proximity to the spin-polarized metal layer, since the corresponding static DOS of both spin channels is rather similar (cf.\ the green areas in Fig.~\ref{orbital-deltaTDDFT-atom-resolved-in-plane}). \subsection{\label{sec:outplane} Polarization dependence of the excitation pattern} \begin{figure}[!htp] \includegraphics[width=0.5\textwidth]{Fig6-resub.png}% \caption Snapshot of the evolution of the charge distribution $\Delta\rho({\bold r},t)$ for out-of-plane polarized pulses at $t=20.2\,$fs for $\hbar\omega = 4.5\,$eV in (a) and $\hbar\omega = 7.75\,$eV in (b). Same colors and isolevels as in Fig.~\ref{fig:ChgIP}. The positions of the atoms in the cell in (a) and (b) are the same as in Fig.~\ref{fig:intro} with Fe in the center. In (c) we shift the differential charge distribution shown in (b) by 0.5 lattice vector in each direction, in order to visualize better the features at the edges of the original unit cell. As a result, O(C) is now located in the center, while Fe is placed at the edges of the cell.} \label{z-Q} \end{figure} \begin{figure*} \includegraphics[width=1\textwidth]{Fig7-resub.png}% \caption a) Change of the electronic charge inside the muffin-tin spheres around the ions relative to the initial state, $\Delta Q(t) = Q(t)-Q(0)$ during and after the application of in-plane (ip) and out-of-plane (oop) polarized laser pulses with $\hbar\omega$ = 4.5 eV and $\hbar\omega$ = 7.75 eV. The initial charges $Q(0)$ within the muffin tin spheres for Fe, Mg(IF), O(IF), Mg(C) and O(C) are $24.42\,e_0$, $10.67\,e_0$, $7.24\,e_0$, $10.72\,e_0$ and $7.24\,e_0$, respectively. b) and c) Fourier transform of $\Delta Q(t)$ shown in a) for $\hbar\omega$ = 4.5 eV and $\hbar\omega$ = 7.75 eV, respectively.} \label{Q-fourier} \end{figure*} The diagonal components of the imaginary part of the dielectric tensor Im[$\epsilon(\omega)$] reported previously \cite{gruner2019dynamics} indicate a predominance of in-plane components for low excitation energies and a substantial increase of absorption in $z$-direction for frequencies above the band gap of MgO. In particular we found that for our system, the in-plane component Im[$\epsilon_{xx}(\omega)$] resembles bulk Fe, while the out-of-plane component Im[$\epsilon_{zz}(\omega)$] rather bears similarity to bulk MgO, in particular regarding the low absorption at energies below the gap. This implies a strong dependence of the excitation pattern on the polarization of the electric field component of the light pulse. To assess this, we carried out additional RT-TDDFT simulations for $\hbar\omega=4.5\,$eV and $7.75\,$eV with the vector potential (and thus the electric field) pointing along the $z$-axis, {\sl i.e.}\ along the stacking sequence of the heterostructure. The peak power density $S_{\rm peak}\approx 5\times 10^{12}\,$W/cm$^2$ and pulse shape was kept the same as in the last section. The corresponding differential densities taken at 20.2\,fs are shown in Fig.~\ref{z-Q}. They exhibit indeed substantial differences to the in-plane polarized field but also between the two laser frequencies. At $4.5\,$eV we observe a much weaker response compared to the in-plane case, which involves mainly a redistribution of charge from $d_{xz}$\ and $d_{yz}$\ to $d_{3z^2-r^2}$\ and $d_{x^2-y^2}$\ orbitals at Fe, cf.\ Fig.~\ref{z-Q}(a), similar to what was found for $\hbar\omega=1.67\,$eV in Ref.\ \onlinecite{gruner2019dynamics}. In contrast, Fig.~\ref{z-Q}(b,c) shows a substantially increased charge redistribution at all sites in the unit cell for the out-of-plane polarized 7.75\,eV pulse as compared to its in-plane counterpart (cf.\ Fig.~\ref{fig:ChgIP}(c)). At the Fe-site we monitor once again an occupation of $d_{3z^2-r^2}$\ states and a depletion of orbitals with in-plane-character, whereas the pattern at the apical and central O-sites suggest a redistribution between $s$ and $p_z$ orbitals. In contrast to frequencies below the bulk band gap of MgO, we encounter rather significant changes in the charge distribution around Mg(IF) sites as well. These effects are rather asymmetric and extend towards the Fe site into the interstitial. The characteristic features of the differential charge density $\Delta\rho$ are also reflected in the integrated charge density $\Delta Q$ in the muffin tin spheres around each site, shown in Fig.~\ref{Q-fourier}(a). We encounter for all frequencies and both directions of polarization a steep increase in $\Delta Q$ at the onset of the pulse, followed by a decrease, reaching a steady value after the pulse. At the O sites, we see a corresponding decrease in $\Delta Q$, accompanied by an increase of similar magnitude at the Mg sites, which we previously interpreted as an effective charge transfer from O to Mg \cite{gruner2019dynamics}. Consistently, this charge transfer increases significantly for $\hbar\omega=7.75\,$eV where direct excitations within bulk MgO occur. For the out-of-plane polarized pulse the increase of charge around Mg(IF) is significantly larger than the decrease around O(IF). Simultaneously, the amount of charge leaving the muffin tin sphere of Fe has substantially increased. This suggests that the large blue features close to Mg(IF) in Fig.~\ref{z-Q}c arise from a relocation of charge from the $d$ orbitals of Fe. The $\Delta Q$ are modulated by an oscillation with twice the frequency of the laser excitation, alluding a coherent ringing of the charge clouds which extends until the end of our simulations at 45\,fs. This is combined with characteristic beats indicating the superposition of oscillations with slightly varying frequencies. The frequency doubling is a consequence of the electric field driving the charge out and back into the muffin tin sphere at both sides in a similar way at positive and negative amplitudes. This symmetry is, however, broken at the interface for out-of-plane oriented pulses and the oscillations for Mg(IF) and O(IF) exhibit only half the frequency of the Fe and the central layers of MgO, accordingly. This is substantiated by the Fourier transform $\Delta Q(\omega)$ shown in Fig.~\ref{Q-fourier}(b) and \ref{Q-fourier}(c) for $\hbar\omega=4.5\,$eV and $\hbar\omega=7.75\,$eV, respectively. All curves show a large contribution at $\omega=0$ and features at $2\hbar\omega$ with a finite extension, similar to the width of the laser pulse. The latter can explain the beating in the oscillations in $\Delta Q(t)$. For $\hbar\omega=4.5\,$eV we also observe higher harmonics at $4\hbar\omega$, which appear most pronounced for O(C). In addition, the out-of-plane polarized pulses shown in Fig.~\ref{Q-fourier}(b) and \ref{Q-fourier}(c) exhibit large peaks at $\hbar\omega$ with a satellite at $3\hbar\omega$ in particular in the interface MgO layer. These peaks are suppressed in Fe and the central layer of MgO, which both have mirror symmetry. \begin{figure*} \includegraphics[width=1\textwidth]{Fig8-resub.png}% \caption Time-dependent changes in the layer-resolved $\Delta$TDDOS for out-of-plane laser pulses with frequencies $\hbar\omega = 4.5\,$eV (a-c) and $\hbar\omega= 7.75\,$eV (d-f) and a peak power density of $S_{\rm peak}\approx 5\times 10^{12}$ W/cm$^2$. The three columns show the partial $\Delta D_{\sigma}(E,t)$ for the Fe, MgO(IF) and the MgO (C) layers, respectively. The energy $E$ is given relative the Fermi level. Note that the color scale differs between the columns. Purple arrows mark particular transitions and hybritizations which are discussed in the text. The green areas refer again to the static partial DOS, scaled as in Fig.~\protect\ref{orbital-deltaTDDFT-atom-resolved-in-plane}. } \label{orbital-deltaTDDFT-atom-resolved} \end{figure*} The particular role of the interface for the excitation is even more pronounced for the out-of-plane polarization of the electric field, as shown in Fig.~\ref{orbital-deltaTDDFT-atom-resolved}. Most conclusive is once again the minority channel, where occupied and unoccupied $d$ states of Fe are nearly balanced. For $\hbar\omega=4.5\,$eV, we find here two pronounced and rather sharp features above and below the Fermi level, which are too close together to be explained by resonant excitations within the Fe layers, see Fig.~\ref{orbital-deltaTDDFT-atom-resolved}(a). However, taking into account that these features hybridize with interface states in MgO(IF), we can conjecture once again two transitions taking place cooperatively, which result in a charge transfer into the empty $3d$ orbitals of Fe: One from the valence band of MgO into the interface states above $E_{\rm F}$\ and another one from the interface states below $E_{\rm F}$\ into the conduction band of MgO, see Fig.~\ref{orbital-deltaTDDFT-atom-resolved}(a-b). The latter is involved in a subsequent non-linear excitation process, populating the MgO levels at 8.5\,eV. Furthermore, we observe similar features with larger changes in the occupation numbers above and below the Fermi level for the central layer of MgO, see Fig.~\ref{orbital-deltaTDDFT-atom-resolved}(c), keeping in mind that 4.5\,eV is not yet sufficient for a substantial direct excitation across the band gap. Interestingly, in MgO(C) the population of the unoccupied states at $8.5\,$eV appears to be even more defined compared to the pattern at $4\,$eV, which we can link to a direct excitation in the IF layer. This indicates, that excitations in the non-linear regime may actively foster the transfer of excitations across the IF. As expected from the differential charge density and the larger absorption coefficient for out-of-plane light, $\hbar\omega=7.75\,$eV leads in all three distinct layers to a much richer pattern in $\Delta D(E,t)$. In Fig.~\ref{orbital-deltaTDDFT-atom-resolved}(f), which refers to MgO(C), the vertical arrows denote the corresponding transition from the valence to the conduction band in bulk MgO. Excitations above $+6\,$eV and below $-6\,$eV apparently involve transitions to and from the interface states of MgO(IF). Consequently, we see changes in the occupation numbers of MgO(IF) and Fe, which are consistent with the mechanism identified above: From approximately $-6\,$eV to $+1\ldots 2\,$eV and from $-2\,$eV and above to $+6\ldots 7\,$eV, as indicated by the diagonal arrows in Fig.~\ref{orbital-deltaTDDFT-atom-resolved}(d-e): While transitions to the highest and from the lowest energies are exclusive to MgO(IF) and MgO(C) excitations in the vicinity of the Fermi energy accumulate again in the hybridizing $d$ states of Fe, which provide a large density of states and can serve as a buffer for the excitations from and into the MgO subsystem. The combination of a $d$-metal and a wide-band-gap insulator leads thus not only to a transfer of excited carriers into the subsystems but also to an asymmetric transfer of energy. In the Fe layer, due to the confinement, excited electron and hole states lie closer together than the photon energy. The distribution of excitations is thus closer to thermalization than one would obtain from an excitation of bulk Fe with the same light pulse. In contrast, excited positive and negative carriers are separated by up to $13\,$eV in MgO(C) for a strong $4.5\,$eV light pulse. \section{\label{sec:sum} Discussion and Conclusion} \begin{figure} \includegraphics[width=\columnwidth]{Fig9-resub.png}% \caption{ Schematic illustration of the concerted excitation mechanism mediated by interface states involving two simultaneous, but independent excitations across the charge transfer gap. This leads to the accumulation of excited carriers with a small energy separation in the metallic layer and a significantly larger separation than $\hbar\omega$ in the MgO part. In this way an efficient repopulation of carriers from valence band (red box) to conduction band states (blue box) is possible even for photon energies below the band gap of the insulator. The colored areas refer to the electronic bands. Green: valence and conduction band of the (bulk) insulator; blue: $d$-states of the (bulk) metal and interface states. } \label{fig:mechanism} \end{figure} Our systematic RT-TDDFT investigation of a minimal model Fe/MgO heterostructure shows that the response of the system strongly depends on both the photon frequency and polarization of the light field. Moreover, we could unravel the origin of the excitation and the transfer of carriers in full detail. In contrast to our previous study on Fe$_{1}$/(MgO)$_{3}$(001), we considered spin-orbit interactions and found that demagnetization effects do not exceed 10\,\% of the ground state magnetization of the Fe-layer and can thus be regarded of minor relevance in this particular system. We find in accordance with our previous study that for photon energies substantially below the LDA band gap of MgO excitations take place predominantly in the Fe subsystem, which provides a rich variety of initial and final states within the width of the $d$-band. This works most effectively when the electric field component of the light lies within the plane of the Fe-layer. The situation changes drastically when the photon energy approaches or even exceeds the LDA band gap of MgO. The reduced dimension of the Fe-layer narrows the d-band width of the Fe monolayer compared to bulk, with the consequence that even photon energies around $4.5\,$eV (i.\,e., close to the LDA band gap of MgO) can hardly trigger substantial excitations within the Fe-layer. Thus, for frequencies in the order of the $d$-band width and larger, the hybridization of Fe-$d$ and O-$p$ states at the interface plays a decisive role for the excitation. Hence, we could identify a generic mechanism associated with these states, which allows to pump excitations from deep within the valence band into the conduction band of the insulator even when the photon energy is not sufficient to reach the final states. This mechanism involves two simultaneous (but not necessarily coherent) excitations in the interface region, see Fig.~\ref{fig:mechanism}. The first excites valence band electrons of the insulator into an interface state above the Fermi level, while the second promotes electrons from the interface states below the Fermi level into the conduction band of MgO. The interface states of oxygen usually exhibit a low DOS, but since they hybridize with the $d$-states of the transition metal, the latter can act as a reservoir to accept and donate excited carriers to the apical oxygen. In turn, the relevant states in valence and conduction band can extend into the bulk layers of MgO, where direct transitions are inhibited by the band gap. Although this takes place independently, hot electrons and holes obtained from the two processes might thus be observed simultaneously in the bulk of the insulator, avoiding the penalty related to the Coulomb interaction between charged zones. Indeed, we found clear indications of such a joint accumulation of excited holes and electrons in the central layer. Whether a likewise transfer of excitations can be observed from the interface layer of Fe into the bulk needs to be assessed in future studies for thicker Fe films. Here, again, a sufficient hybridization of the out-of-plane $d$-orbitals between the inner Fe-layers and the IF-states might be a decisive factor. The above described mechanism leads to an asymmetric distribution of excitations, where -- directly after the pulse -- the excited electrons and holes in the metal are much closer to the Fermi level, as compared to the MgO subsystem. This might then lead to a substantially different dynamics of thermalization in both subsystems of the heterostructure as compared to the respective bulk systems, which might be detectable in time-resolved pump-probe experiments on the fs-time scale. Sufficiently high laser intensities, as applied in our computational approach, can furthermore trigger a non-linear multi-photon excitation process that allows to reach hybridized valence and conduction band states with a significantly larger distance to the Fermi level as compared to the photon energy. This implies that a similar effect might be achieved by the simultaneous application of two weaker laser pulses with different, appropriately chosen frequencies. Our simulations indicate a strong dependence of the absorbed light on the polarization of the electrical field and the frequency. As a consequence, the polarization direction emerges as an efficient means to select transitions to specific interface states. For frequencies below the band gap, in-plane polarized light induces a much stronger absorption, as shown previously \cite{gruner2019dynamics}, whereas for photon energies above the band gap, the out-of-plane direction leads to a significantly larger response. While in the former case excitations are confined to the Fe-layer, the direct excitations within the MgO play the most important role in the latter, since the finite width of the Fe-$d$ band limits the number of possible transitions in the ultrathin Fe-layer. For photon energies in the order of the band gap, we found excitations of similar strength for both polarization directions. Still we can distinguish these cases by a different excitation pattern in Fe and the adjacent MgO-layer. We link this to the local symmetry breaking at the interface, leading to an asymmetric deformation of the atomic charge cloud, which follows the oscillation of the vector potential. Our calculations were carried out for a minimal model heterostructure. The experimental synthesis of this structure may not be trivial, but we believe that the above sketched mechanisms can be transferred also to larger, more realistic systems with nanometer-sized layers, as used in previous experiments \cite{cn:Rothenbach19}. An important consequence of the confinement is the significantly reduced bandwidth of the $3d$-metal monolayer. A wider $d$ band would provide according to Fermi's golden rule additional possibilities for direct excitations within the Fe-subsystem for a laser pulse in the range of the calculated band gap. On the other hand, the MgO band gap is underestimated due to the LDA exchange correlation functional. Thus for a direct comparison with experiment, a quantitative description of the band gap and the location of the interface states is desirable. This requires the appropriate treatment of exchange and correlation beyond the (adiabatic) local density approximation in a time-dependent approach for both the ferromagnetic metal and the insulator in a computationally efficient implementation and must thus be left open for future work. Thus, despite the above mentioned restrictions, the model used in this study captures the essential excitation processes that may also be relevant for thicker heterostructures, when a laser pulse is applied with photon energy, which is slightly lower than the band gap of the insulator, but in the vicinity of or even larger compared to the $d$-band width of the metal. We expect that the fundamental mechanisms of excitation dynamics demonstrated in our proof-of-principle calculations are applicable to a wider range of metal-insulator heterostructures, which are characterized by a large density of states around the Fermi level in the metallic subsystem, and thus provide important guidelines for future pump-probe experiments. \bigskip \begin{acknowledgments} We wish to acknowledge funding by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) within collaborative research center CRC1242 (project number 278162697, subproject C02) and computational time at the Center for Computational Sciences and Simulation of the University of Duisburg-Essen on the supercomputer magnitUDE (DFG grants INST 20876/209-1 FUGG, INST 20876/243-1 FUGG). \end{acknowledgments}
\section{Introduction}\label{sec:introduction} \iffalse In the era of data explosion, the amount and latitude of data are increasing rapidly. However, the time and attention of analysts available for data exploration remain constant. Thanks to the development of visualization tools (e.g., IBM ManyEyes\cite{Viegas2007b}, Tableau\cite{Stolte2002b}, and Microsoft Excel), analysts can perform data exploration intuitively. However, we are now still in the early phase of visualization development. As people with different levels of knowledge in visualization are involved in data exploration\cite{Vartak2016}, there is an urgent demand for novice-friendly tools to lower the barrier of visualization, which has promoted the development of visualization recommendation (VisRec) system. Generally speaking, VisRec consists of visualization generation and ranking. VisRec systems should first enumerate all meaningful visualizations and then rank them(or get top-k) according to certain indicators. To construct a practical VisRec system, there also face some thorny challenges. (1) Huge Search Space: A chart consists of many independent decisions of design, such as which mark to use and what visualization channels to apply. All these combined choices generate a huge search space. (2) Inconsistent evaluation criteria: Visualization creation is a mining task, involving human perception, which is hard to capture. We may easily recognize whether a visualization is good, while it is hard to quantify which is better. Moreover, there lacks a uniform benchmark. To address the challenges, industry and academia proposed various solutions in recent years. Dealing with huge search space, Voyager\cite{Wongsuphasawat2016,Wongsuphasawat2017}, SeeDB\cite{Vartak2015b} and Show me\cite{Mackinlay2007b} leverage empirical rules to prune meaningless visualizations. DeepEye\cite{Luo2018}, Draco\cite{Moritz2019}, VizML\cite{Hu2019d}, Data2Vis\cite{Dibia2019b} learn from plenty of superior examples to promote great visualizations creation. For inconsistent evaluation criteria, most work s seek the credible ground truth by user study\cite{Wongsuphasawat2016,Luo2018,Hu2018,Key2012}. Besides, VizNet\cite{Hu2019e} forms a large-scale corpus of datasets compiled from the public, which can be the standard of good charts. Although some VisRec systems have been widely applied in practice, and even commercialized\cite{Tory2019b,Mackinlay2007b,Stolte2002b,Yalcin2018b}, there still exist some problems. Specifically, the user's analysis behavior can be roughly classified into two taxonomies. One is that users have less insight of data and lack definite intent. The other one is that users are familiar with data and expect to conduct task-oriented data analysis. For the former, existing VisRec systems can satisfy the majority of analysis scenarios. But for the latter, the state of art is short of integral and specific modeling of low-level analytic tasks, thus it is difficult to recommend targeted charts. However, previous studies have documented that the effectiveness of a visualization largely depends on the analytic task\cite{Amar2005b,Saket2019b,Vartak2016}, apart from dataset and data properties. \fi Data visualization is a promising way to facilitate data exploration. However, transforming the raw data into well-designed visualizations require users to be familiar with both the dataset and principles of effective visual encoding. Although the visual data analysis demand has nourished numerous visualization tools, they usually present a steep learning curve. Users need to engage in a tedious and time-consuming process to explore different design decision through trial and error. To address this issue, a remarkable series of Visualization Recommendation (VisRec) systems have been proposed both in academia\cite{Wongsuphasawat2017,Luo2018,Hu2019d,Moritz2019,Dibia2019b,Zhou2020} and industry(e.g., Tableau and Power BI) to facilitate the visualization authoring process. Over the past two decades, a surge of VisRec systems emerged as a powerful tool for visual analysis. The existing VisRec systems mainly consist of two categories\cite{Zhu2020}: rule-based approaches and learning-based approaches. Rule-based approaches build upon empirical visualization design knowledge. For instance, APT\cite{Mackinlay1986b}, Show me\cite{Mackinlay2007b}, DIVE\cite{Hu2018}, SeeDB\cite{Vartak2015b}, and Voyager\cite{Wongsuphasawat2017} leverage predefined perceptual rules to automatically generate visualizations. These rule-based approaches are intuitive to understand and can guarantees good explainability of the recommendations. However, they suffer from high requirements for domain expertise. Learning-based approaches learn from plenty of well-designed visualization examples to train models for VisRec, such as DeepEye\cite{Luo2018}, Data2Vis\cite{Dibia2019b}, VizML\cite{Hu2019d}, and Table2Charts\cite{Zhou2020}. Learning-based approaches avoid complicated hand-crafted rules, but they lack good scalability and may fail to achieve comparable performance as rule-based methods due to the limited training data. Although these VisRec systems can generate meaningful visualizations, they pay relatively little attention on the diversity of user intent. Previous studies have documented that the effectiveness of a visualization largely depends on the user's analytic task\cite{Brehmer2013,Rind2016,Saket2019b}. For a dataset, different people may hold different expectation of the recommendations according to their analysis intent. However, most of the existing VisRec systems lack detailed modeling of analytic tasks, so they can only prune meaningless results but fail to recommend targeted visualizations. As a result, given specific data columns, they will always produce the same charts for all the users. Even if some works have taken analytic tasks into account, the comprehensiveness and depth are still insufficient. For instance, Draco\cite{Moritz2019} only groups tasks into two categories: value tasks and summary tasks. NL4DV\cite{Narechania2020} only integrates five types of low-level analytic tasks into VisRec system. Fortunately, there is a remarkable series of empirical wisdom on task modeling both in academia and industry. For example, academic work from Saket \textit{et al}.\cite{Saket2019b} comprehensively evaluates the effectiveness of five commonly used chart types across different tasks. For industry, Financial Times Visual Vocabulary\cite{Martinstabe} provides great guidelines for designers and journalists to select the optimal symbology for data visualisations based on their tasks. However, all these design knowledge of analytic task are scattered across heterogeneous sources (e.g., papers, training sessions, projects etc.) and are rarely implemented in practice to power VisRec systems. In response to the problem, we first summarize the empirical knowledge of the analytic task and then propose a task-oriented visualization recommendation system, TaskVis\footnote{https://github.com/ShenLeixian/TaskVis}. As shown in Figure~2, the recommendation engine accepts analytic tasks and data properties and automatically generates appropriate visualizations for users. TaskVis differs from existing VisRec systems by modeling analytic tasks in details. The contributions of this paper are summarized as follows: \begin{itemize} \item A task base of 18 common analytic tasks with their appropriate chart types by a survey both in academia and industry. \item A rule base, which extends empirical wisdom with our targeted modeling of analytic tasks. \item A task-oriented VisRec system, TaskVis, which allows users to select their tasks precisely. \item A series of use cases and a user study to prove the effectiveness of TaskVis. \end{itemize} \begin{figure}[t] \label{fig:pipline} \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/pipeline} \caption{Recommendation pipeline. The recommendation engine accepts analytic tasks and data properties, and then automatically generates appropriate visualizations for users.} \end{figure} \section{Related Works} TaskVis draws upon prior efforts in analytic task construction and visualization recommendation systems. \iffalse \subsection{Visualization Specification} Visualization specification languages are critical to visualization generation. With the unified specification to describe the charts, data analysts can specify the detail of charts (e.g., mark, encoding and transform), while close the low-level details to users. Low-level languages provide wide-range custom design primitives to construct visualizations but they are cumbrous and require analysts to map all primitive elements. For example, ProtoVis\cite{Bostock2009} and D3\cite{Bostock2011} are designed to deal with the user's interactions, and Vega\cite{Satyanarayan2016} expends to declarative grammars. High-level languages such as Vega-Lite\cite{Satyanarayan2017}, ggplot2\cite{Wickham2010}, VizQL\cite{Stolte2002b}, ZQL\cite{Siddiqui2016b}, and Echarts\cite{Li2018a} provide concise cross-platform frameworks to create expressive visualizations, support rapid construction of interactive visualization in part by omitting details of visualization construction. Moreover, CompassQL\cite{Wongsuphasawat2016} offers a general-purpose query language for visualization recommendation by Vega-Lite. \fi \subsection{Analytic Tasks} There is a growing body of literature recognizes that the analytic task is vital for visualization design. Vartak \textit{et al}.\cite{Vartak2016} proposed that the intended task is one of the five factors that must be accounted for while making visualization recommendations. There have been numerous task taxonomies in the data visualization literature providing definitions of analytic tasks. For instance, Amar \textit{et al}.\cite{Amar2005b} presented a set of ten low-level analytic tasks that capture the user's activities while employing visualization tools for data exploration, including \textit{retrieve value}, \textit{filter}, \textit{compute derived value}, \textit{find extremum}, \textit{sort}, \textit{determine range}, \textit{characterize distribution}, \textit{find anomalies}, \textit{cluster}, and \textit{correlate}. Saket \textit{et al}.\cite{Saket2019b} evaluated the effectiveness of five commonly used chart types(mark as table, line, bar, scatter, and pie) across the ten tasks\cite{Amar2005b} by a crowdsourced experiment. Kim \textit{et al}.\cite{Kim2018b} measured subject performance across task types derived from the ten tasks mentioned above, and included \textit{compare values} task in addition. The tasks were further grouped into two categories: value tasks that just retrieve or compare individual values and summary tasks that require identification or comparison of data aggregation. Draco\cite{Moritz2019} and Dziban\cite{Lin2020a} are the following VisRec systems that involve value tasks and summary tasks. NL4DV\cite{Narechania2020} additionally included a \textit{Trend} task. AutoBrief\cite{Kerpedjiev1997} further enhanced VisRec systems by introducing domain level tasks. Wang \textit{et al}.\cite{Wang2020i} summarized 11 categories of task that are commonly adopted in fact sheets. Deep into scatter charts, Sarikaya \textit{et al.}\cite{Sarikaya2018b} first collected model tasks from a variety of sources to formulate the seeds for scatterplot-specific analytic task list, then performed card-sort to group tasks together based on their similarity. Rather than inputting task proactively, behavior-based systems represented by HARVEST\cite{Gotz2009b} and Eye Gaze\cite{Steichen2013} capture users’ interaction behavior to infer their analytic task. Besides, various empirical materials aiming at improving chart literacy have gradually formed in the industry practice. For instance, choosing a good chart\cite{Abela} identified four tasks for market researchers and Financial Times Visual Vocabulary\cite{Martinstabe} summarized nine tasks commonly used by designers and journalists. However, in the visualization community, there lack a comprehensive summary and further application of these tasks. \subsection{Visualization Recommendation} Early VisRec works represented by APT\cite{Mackinlay1986b}, SAGE\cite{Roth1994b}, and Rank-by-Feature Framework\cite{Seo2005b} are mostly rule-based. They take data features (e.g., statistical properties) into account and leverage visualization rules to prune large search space. The design rules in the community increase iteratively as subsequent works embody the previous works and produce new rules. Voyager\cite{Wongsuphasawat2016,Wongsuphasawat2017}, DIVE\cite{Hu2018}, Show me\cite{Mackinlay2007b}, Polaris\cite{Stolte2002b}, Profiler\cite{Kandel2012b} all contributed to the enrichment of rules with more data types. Instead of considering common visualization types, Wang \textit{et al}.\cite{Wang2018b} developed rules for automatic selection of line graph or scatter plot to visualize trends in time series. Datesite\cite{Cui2019} proactively generated insights using automatic algorithms for data exploration. To better benefit from design guidance provided by empirical studies, Moritz \textit{et al}.\cite{Moritz2019} proposed a formal framework that models visualization design knowledge as a collection of ASP (Answer Set Programming) constraints\cite{Gebser2011}. We also merge this idea into TaskVis and make further improvements. Rule-based approaches highly depend on domain expertise. In response, learning-based systems draw from existing well-designed visualizations to train neural models. DeepEye\cite{Luo2018} trained a decision-tree-based binary classifier to determine whether a visualization is good or not, and a learning-to-rank model to rank visualizations. Data2Vis\cite{Dibia2019b} built a multi-layered attention-based encoder-decoder network to directly map JSON-encoded datasets to Vega-Lite specification. Draco-Learn trained a RankSVM model on ranked pairs of visualizations and then automatically learned weights for soft constraints in ASP. VizML\cite{Hu2019d} identified five key design choices while creating visualizations. For a new dataset, the 841 dataset-level features extracted were fed into neural network models to predict the design choices. Table2Charts\cite{Zhou2020} used a deep Q-learning approach with copying mechanism and heuristic searching. Qian \textit{et al}.\cite{Rossi} proposed an end-to-end machine learning approach while MultiVision\cite{Wu2021e} built a Siamese neural network. \section{Background} \subsection{Vega-Lite} Inspired by prior works\cite{Moritz2019,Lin2020a}, we leverage Vega-Lite to specify visualizations. Vega-Lite\cite{Satyanarayan2017} is a high-level language of interactive graphics. It provides a composition declarative JSON syntax for visualization displays. Vega-Lite supports various atomic components, including marks, channels, and transforms. Figure~\ref{fig:vegalite} shows an example of Vega-Lite specification, which is a bar chart, including x-axis, y-axis, and color channel. In addition, sort, sum aggregation, and zero stack transformation are applied. \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/vegalite} \caption{Example of Vega-Lite specification. The figure shows a bar chart with an ordinal variable at x axis, a quantitative variable at y axis, and a nominal variable at color channel. In addition, sort, sum aggregation, and zero stack transformation are applied.} \label{fig:vegalite} \end{figure} \subsection{Answer Set Programming} Answer Set Programming (ASP) is a declarative programming paradigm based on logic programs and their answer sets. It provides a simple yet powerful modeling language to solve combinatorial problems. An ASP program is built on \textit{atoms}, \textit{literals}, and \textit{rules}. \textit{Atoms} are basic building blocks in ASP to represent elementary propositions. \textit{Literals} are atoms {\color{absolutezero} A} or their negation {\color{absolutezero} not A}. A \textit{rule} in ASP is in the form of {\color{absolutezero} A} {\color{aero}:-} ${\color{absolutezero} L_{0}, L_{1}, ..., L_{n}}.$ where ${\color{absolutezero} L_{i}}$ is a literal. The head ({\color{absolutezero} A}, left of {\color{aero}:-}) in the rule is true only if all the literals in the body ({\color{absolutezero} ${\color{absolutezero} L_{i}}$}, right of {\color{aero}:-}) are true. For instance, {\color{absolutezero} road}({\color{bluecrayola} cityA}, {\color{bluecrayola} cityC}) {\color{aero}:- } {\color{absolutezero} road}({\color{bluecrayola} cityA}, {\color{bluecrayola} cityB}), {\color{absolutezero} road}({\color{bluecrayola} cityB}, {\color{bluecrayola} cityC}). states that only when city A and B are connected and city B and C are connected, city A and C can be connected. If a rule is headless, it means that satisfying all the literals in the body will lead to a contradiction. Illustrated with example, {\color{aero}:- } {\color{absolutezero} on}({\color{bluecrayola} computer}), {\color{absolutezero} off}({\color{bluecrayola} computer}). states that a computer cannot be both on and off. If a rule is bodyless, it asserts the fact that its head is true, for example, {\color{absolutezero} on}({\color{bluecrayola} computer}). states that the computer is on. Besides, the aggregate rule {\color{amaranthpink} p} $\left\{ {\color{absolutezero} A_{0}, ..., A_{n}} \right\}$ {\color{amaranthpink} q}. restrains that at least {\color{amaranthpink} p} and at most {\color{amaranthpink} q} atoms in the set are true. More modeling constructs of ASP can be found in its document\footnote{https://potassco.org/}. Clingo\cite{Gebser2011} is an ASP system to solve logic programs. Given a combinatorial problem, a series of rules make up the ASP program, Clingo can be used as a solver to quickly enumerate all eligible combinations, with which the researchers can concentrate on the actual problem. \iffalse \subsection{Draco} Draco\cite{Moritz2019} is a constraint-based system based on answer set programming, which presents a formal model to represent visualization design knowledge. Draco also maintains a knowledge base depending on prior efforts such as APT\cite{Mackinlay1986b} and CompassQL\cite{Wongsuphasawat2016}. The knowledge base consists of design space definition, preference over the design space, and specification of outputs. The design space contains a set of building blocks of a visualization, for example, {\color{absolutezero} type} ({\color{bluecrayola} quantitative};{\color{bluecrayola} ordinal};{\color{bluecrayola} nominal};{\color{bluecrayola} temporal}). defines the four high-level data types and {\color{absolutezero} channel} ({\color{bluecrayola} x};{\color{bluecrayola} y};{\color{bluecrayola} color};{\color{bluecrayola} size};{\color{bluecrayola} shape}). defines the five supported single encoding channels. Preference rules over the design space effectively prune the search space, for example, {\color{aero}:-} {\color{absolutezero} channel}({\color{amaranthpink} E}, {\color{bluecrayola} shape}), {\color{brightmaroon} not} {\color{absolutezero} type}({\color{amaranthpink} E}, {\color{bluecrayola} nominal}). ensures that the model will not consider applying shape channel on non-nominal variables. Specification of outputs like {\color{aero} \#}{\color{brightmaroon} show} {\color{absolutezero} channel}/{\color{amaranthpink} 2} define the output items and the number of its parameter. With the aforementioned modeling process, Draco can be leveraged to build increasingly sophisticated visualization systems with less efforts. However, it only includes two abstract tasks (value and summary), which can hardly capture the user's activities during visual analysis. In response, TaskVis extends Draco with additional detailed modeling of analytic tasks. \fi \begin{figure*}[t] \centering \includegraphics[width=0.9\textwidth,keepaspectratio]{./pdf/outline} \caption{Architecture of TaskVis. TaskVis consists of six modules and two bases (for tasks \textbf{(a)} and rules \textbf{(e)} respectively). \textbf{(b)} Input: accepts the user's input. \textbf{(c)} Preprocess: extract data properties. \textbf{(d)} Visualization Generation: enumerate all qualified candidates. \textbf{(f)} Visualization Ranking: rank all visualizations according to selected scheme. \textbf{(g)} Output: present recommendation results to users. \textbf{(h)} Combination VisRec: make combination recommendations by iterating tasks.} \label{fig:overview} \end{figure*} \section{Overview} \textbf{User interface: } As shown in Figure \ref{fig:interface}, when uploading a dataset \textbf{(A)}, the data field shows data columns with the corresponding data type \textbf{(B)}. Users can customize system settings, including interested data columns \textbf{(B)}, max number of charts \textbf{(C)}, recommendation mode \textbf{(D)}, ranking scheme \textbf{(E)}, and task list \textbf{(F)}. Clicking \textit{Recommendation} button will generate visualizations on the right. Selected tasks are tabbed, along with a \textit{Display by task} switch \textbf{(G)}. If the switch is open, the charts will be displayed by tasks. \textbf{(H)} is the default thumbnail view with a row of charts. Clicking the task tab will show all the recommendations \textbf{(I)}. The chart can be previewed by clicking on it like in Figure \ref{fig:covid}. If the switch is closed, all the charts will be deduplicated first and displayed together like in Figure \ref{fig:display_by_notask}. The combination recommendation view is shown in Figure \ref{fig:combine}. \textbf{Architecture:} The architecture of TaskVis is shown in Figure~\ref{fig:overview}. Task base \textbf{(a)} is the foundation of the system , which will be discussed in Section \ref{sec:task}. Apart from the prerequisite dataset, users can also input optional data columns of interest and analytic tasks \textbf{(b)} like in Figure \ref{fig:interface}(B, F). The preprocessing module \textbf{(c)} will later extract data features (e.g., data type and cardinality) automatically. User intervention is also allowed in this phase as data type may be ambiguous in some scenarios. After preprocessing, extracted data features together with the user's input are sent to visualization generation module \textbf{(d)}. Conversion to ASP constraints is a premise to make input available for Clingo, which is an ASP system to solve logic programs. Apart from the user's input, a rule base \textbf{(e)} is the core of TaskVis and also should be sent into Clingo. More details will be discussed in Section~\ref{sec:rulebase}. All enumerated results in ASP constraints are transformed into Vega-Lite specification at the end of visualization generation stage. In visualization ranking module \textbf{(f)}, if previous modules have processed multi-tasks, the output VisRec list can be deduplicated. After that, each Vega-Lite is assigned a \textit{cost score} based on a cost model inspired by GraphScape\cite{Kim2017b}, which will be discussed in Section~\ref{sec:costmap}. On the basis, four rank schemes are designed for users to select, and each scheme has applicable scenarios, which will be discussed in Section~\ref{sec:rankscheme}. Finally, a VisRec list \textbf{(g)} is presented to users, where each chart in the list is an independent recommendation. So far, we have presented a complete visualization recommendation workflow. Iterating multiple tasks, we can obtain numerous visualizations that describe partial dataset. In addition, instead of just presenting individual charts, we propose combination recommendation \textbf{(h)} to extend the system, which leverages a set of charts to collaboratively describe the dataset based on task-oriented design principles. More details will be discussed in Section~\ref{sec:comrec}. \iffalse \textbf{APIs in the recommendation engine: } To make TaskVis more flexible to use, we also provide a variety of APIs in the recommendation engine as shown in Figure~\ref{fig:apis}. If users only input the dataset, TaskVis will perform blind recommendations according to specific rules which will be discussed in Section~\ref{sec:comrec}. It can help users obtain an overall understanding of the dataset when they are unfamiliar with the data. For analytic task, users are allowed to select single or multiply items, they can switch to show each task independently or the merged result. If the system accepts no interested data column or analytic task, all the items (data columns or analytic task) will be traversed to produce recommendations. \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/apis_table} \caption{APIs provided by recommendation engine. Various APIs can satisfy the user's diverse analysis requirements.} \label{fig:apis} \end{figure} \fi \section{Analytic Tasks}\label{sec:task} While many task taxonomies have been constructed, most of them only apply to specific scenarios. Besides, based on existing task taxonomies, some new tasks introduced by incremental works for visual data analysis are scattered across heterogeneous sources. To summarize these tasks, we maintain a task base from three aspects: \begin{itemize}[leftmargin=9pt] \item \textbf{Empirical academic studies:} A large body of early works pay attention to the effectiveness of visualization types for a selected task, either special for a particular chart type (e.g., scatter\cite{Sarikaya2018b,Wang2018b}, bar\cite{Croxton1927,Eells1926}, circle\cite{Croxton1927,Eells1926}, error bar\cite{Correll2014}, arc\cite{Skau2016}, area\cite{Skau2016}, and line\cite{Wang2018b}) or comprehensive evaluation\cite{Amar2005b,Saket2019b,Kim2018b,Demiralp2017,Wang2020h,Harris}. \item \textbf{Empirical summaries in industry:} Various fields such as newspaper, finance, geography, and engineering have a strong requirement for data visualization, rich practice experience has also been accumulated in the form of guides, training sessions, projects, libraries, etc.\cite{Martinstabe,Collective,Abela,Schwabish,Analytics,Ribecca,Chartguide} \item \textbf{Customized tasks: }Apart from commonly used tasks, task base also contains some others that we consider meaningful during our visualization practice, such as \textit{error range}. \end{itemize} Based on the studies above, similar to the methodology to identify scatterplot tasks in \cite{Sarikaya2018b}, we first formulate the seeds for analytic task list, covering both low-level and high-level tasks. To abstract these analytic tasks, we then invite several data visualization researchers with more than five years of experience to perform a card-sort and merge the similar tasks. Finally, we summarize 18 classical analytic tasks and their appropriate chart types as shown in Table~\ref{tab:taskbase}. What needs to explain is that \textit{filter} task requires users to specify some constraints of data additionally. So the implementation of this task is placed in data preprocessing stage, allowing users to filter data according to their own needs. For the other 17 tasks, users can choose anyone to perform data analysis at will. We also extract appropriate chart types for each task and retained the priority. For instance, the most appropriate chart type for \textit{comparison} task is line chart, followed by scatter chart, and finally bar chart. (*) in the table indicates combination of marks, for example, rect(text) represents that a text layer is superimposed on rect chart. \begin{table*}[h] \small \caption{Task base. \textit{Mark} column lists appropriate marks, where the rank has priority, (*) indicates the combination of marks, e.g. rect(text) means a text layer is superimposed on rect chart. } \centering \label{tab:taskbase} \renewcommand\arraystretch{1.1} \begin{tabular}{p{2.9cm}p{2.0cm}p{5.5cm}p{5cm}} \hline \rowcolor[HTML]{EFEFEF} \textbf{Task} & \textbf{Mark} & \textbf{Description}&\textbf{Reference} \\ \hline Change Over Time & line/area & Analyse how the data changes over time series& \cite{Ribecca,Chartguide,Martinstabe,Collective,Schwabish,Harris} \\ \hline Characterize Distribution & bar/point & Characterize the distribution of the data over the set& \cite{Amar2005b,Saket2019b,Ribecca,Chartguide,Martinstabe,Abela,Analytics,Narechania2020,Sarikaya2018b,Wang2020i,Srinivasan2019,Demiralp2017} \\ \hline Cluster & bar/point & Find clusters of similar attribute values& \cite{Amar2005b,Saket2019b,Chartguide,Shi2019,Srinivasan2019} \\ \hline Comparison & line/point/bar & Give emphasis to comparison on different entities& \cite{Ribecca,Collective,Abela,Analytics,Schwabish,Sarikaya2018b,Kim2018b,Wang2020i,Hu2019e,Hu2018} \\ \hline Compute Derived Value & rect(text)/arc/bar & Compute aggregated or binned numeric derived value& \cite{Amar2005b,Saket2019b,Wang2020i,Hu2018,Srinivasan2019} \\ \hline Correlate & bar/line & Determine useful relationships between the columns& \cite{Amar2005b,Saket2019b,Ribecca,Chartguide,Martinstabe,Abela,Analytics,Schwabish,Narechania2020,Sarikaya2018b,Shi2019,Wang2020i,Hu2018,Srinivasan2019,Demiralp2017,Harris} \\ \hline Determine Range & tick/boxplot & Find the span of values within the set& \cite{Amar2005b,Saket2019b,Ribecca,Srinivasan2019} \\ \hline Deviation & bar(rule)/point(rule) & Compare data with certain value like zero or mean& \cite{Martinstabe} \\ \hline Error Range & errorband/errorbar & Summarizes an error range of quantitative values& \cite{Correll2014} \\ \hline Filter & rect/bar/arc & Find data cases satisfying the given constrains& \cite{Amar2005b,Saket2019b,Narechania2020,Wang2020i,Srinivasan2019} \\ \hline Find Anomalies & bar/point & Identify any anomalies within the dataset& \cite{Amar2005b,Saket2019b,Sarikaya2018b,Shi2019,Wang2020i,Hu2019e,Srinivasan2019,Demiralp2017,Harris} \\ \hline Find Extremum & bar/point & Find extreme values of data column& \cite{Amar2005b,Saket2019b,Kim2018b,Wang2020i,Hu2019e,Srinivasan2019} \\ \hline Magnitude & arc/bar & Show relative or absolute size comparisons& \cite{Ribecca,Martinstabe,Skau2016} \\ \hline Part to Whole & arc & Show component elements of a single entity& \cite{Ribecca,Martinstabe,Abela,Analytics,Schwabish,Wang2020i,Skau2016} \\ \hline Retrieve Value & rect(text) & Find values of specific columns& \cite{Amar2005b,Saket2019b,Chartguide,Collective,Narechania2020,Kim2018b,Wang2020i,Hu2019e,Srinivasan2019} \\ \hline Sort & bar & Rank data according to some ordinal metric& \cite{Amar2005b,Saket2019b,Martinstabe,Wang2020i,Srinivasan2019,Harris} \\ \hline Spatial & geoshape/circle(text) & Show spatial data like latitude and longitude& \cite{Ribecca,Chartguide,Martinstabe,Collective,Schwabish} \\ \hline Trend & point(line) & Use regression or loess to show the variation trend& \cite{Analytics,Wang2020i,Hu2018, Wang2018b} \\ \hline \end{tabular} \end{table*} \iffalse \begin{table*}[h] \caption{Task base. \textit{Task} column is the name of the task. \textit{Mark} column lists suitable marks, where the rank has priority. \textit{Description} column is the description of the task. \textit{RankRec} column is the recommended rank scheme which will be discussed in Section~\ref{sec:rankscheme}} \centering \label{tab:taskbase1} \renewcommand\arraystretch{1.1} \begin{tabular}{lllll} \hline \rowcolor[HTML]{EFEFEF} &Task & Mark & Description&RankRec \\ \hline 1&Change Over Time & line/area & Analyse how the data changes over time series.&R3 \\ \hline 2&Characterize Distribution & bar/point & Characterize the distribution of the column’s values over the set.&R1 \\ \hline 3&Cluster & bar/point & Find clusters of similar attribute values or classify the data.&R1 \\ \hline 4&Comparison & line/point/bar & Give emphasis to comparison on different entities.&R1 \\ \hline 5&Compute Derived Value & rect(text)/arc/bar & Compute an aggregate or binned numeric derived Value.&R1 \\ \hline 6&Correlate & bar/line & Determine useful relationships between the columns.&R1 \\ \hline 7&Determine Range & tick/boxplot & Find the span of values within the set.&R2 \\ \hline 8&Deviation & bar(rule)/point(rule) & Compare data with certain value like zero or mean.&R1 \\ \hline 9&Error Range & errorband/errorbar & Summarizes an error range of quantitative values.&R1 \\ \hline 10&Filter & rect/bar/arc & Find data cases satisfying the given constrains.&R1 \\ \hline 11&Find Anomalies & bar/point & Identify any anomalies within the dataset.&R3 \\ \hline 12&Find Extremum & bar/point & Find extreme values of data column.&R1 \\ \hline 13&Magnitude & arc/bar & Show relative or absolute size comparisons.&R3 \\ \hline 14&Part to Whole & arc & Show component elements of a single entity.&R1 \\ \hline 15&Retrieve Value & rect(text) & Find values of columns.&R1 \\ \hline 16&Sort & bar & Rank data according to some ordinal metric.&R2 \\ \hline 17&Spatial & geoshape/circle(text)) & Show spatial data like latitude and longitude.&R2 \\ \hline 18&Trend & point & Use regression or loess to show the variation trend of data.&R1 \\ \hline \end{tabular} \end{table*} \fi \section{Visualization Generation} Generally, VisRec systems need to enumerate all possible visualizations first and then make recommendations\cite{Qin2020}. \subsection{Visualization components} Vega-Lite includes various atomic components, we support a part of them as follows: \textbf{Mark: } To better assist data analysts, we enrich the chart types of recommendations as much as possible. To this end, we merge and filter all the marks support in Vega-Lite and finally select 14 types, arc, area, bar, box plot, circle, error band, error bar, geoshape, line, point, rect, rule, text, and tick. Besides, TaskVis also supports layered charts (e.g., line + point) in some tasks. Compared with existing VisRec systems, TaskVis can recommend richer charts. \textbf{Channel: }In visual analysis, the rational application of visualization channels is one of the pivotal factors for designing aesthetic visualizations. Visualization channels include location, color, size, shape, slope, texture, and animation. There is a consensus that the first four can generally meet the demands of visualization design. Hence for simplicity, encoding channels in TaskVis only refer to the axis (x and y) and legend (color, size, and shape). It is worth mentioning that at most two legends are involved in a chart. \textbf{Transform: }Data transformation enables new value generation by various operations. For example, we can use \textit{bin} to bucket quantitative or temporal data, discretizing continuous variables. \textit{Regression} and \textit{loess} can be applied to produce trend lines. All the transform operations of Vega-Lite included in TaskVis are bin, aggregate, sort, stack, regression, loess, and scale. \iffalse \subsection{Search space} Given a dataset with multivariate, all the possible visualizations that satisfy the prescribed constraints form the search space of VisRec problem. The measurement of search space is presented as follows according to the analysis of visualization components above. Define the number of all possible visualizations is $f(v)$, where $v$ is the number of variables to be visualized. The search space relates to 12 types of mark as text and rule mark could only be added as another layer outside Clingo. Considering transform, there are $3\times2\times2\times2=24$ kinds of different transform combination for one variable. Potential combinations of variables in different channels depend on $v$. If $v$ is 1, then $f(1)=24\times C_5^1\times 12=1440$, where only one visualization channel can be adopted. If $v$ is 2, then $f(v)=f(1)+(24\times v)^2\times C_5^2\times12$, where contains $f(1)$ and a chart could involve two different channels. If $v$ is 3, then $f(v)=f(2)+(24\times v)^3\times C_5^3\times12$, where contains $f(1)$ and $f(2)$. Since a chart has a maximum of four visualization channels, so if $v\ge4$, then $f(v)=f(v-1)+(24\times v)^4\times C_5^4\times12$. \fi \subsection{Rule base}\label{sec:rulebase} Various visualization components form a huge search space, among which there are numerous invalid combinations and meaningless visualizations that show limited information. Fortunately, there are numerous rules either from users or traditional wisdom to prune "bad" visualizations. However, if all these rules are implemented in code with branch structure, it will be complicated to manage. Inspired by Draco\cite{Moritz2019}, we leverage answer set programming to construct design knowledge in a unified and extensible manner and finally build a rule base, which consists of three sources: empirical wisdom, customized rules for task, and user partial specification. \subsubsection{Empirical wisdom} Draco\cite{Moritz2019} maintains a knowledge base in ASP depending on prior efforts such as APT\cite{Mackinlay1986b} and CompassQL\cite{Wongsuphasawat2016}. ASP program of the knowledge base includes visualization attributes declaration, preference over design space, and output specification. Visualization attributes declaration specifies the domains of attributes, for example, {\color{absolutezero} type} ({\color{bluecrayola} quantitative};{\color{bluecrayola} ordinal};{\color{bluecrayola} nominal};{\color{bluecrayola} temporal}). defines the four high-level data types and {\color{absolutezero} channel} ({\color{bluecrayola} x};{\color{bluecrayola} y};{\color{bluecrayola} color};{\color{bluecrayola} size};{\color{bluecrayola} shape}). defines the five supported single encoding channels. Preference rules over design space can effectively prune the search space, for example, {\color{aero}:-} {\color{absolutezero} channel}({\color{amaranthpink} E}, {\color{bluecrayola} shape}), {\color{brightmaroon} not} {\color{absolutezero} type}({\color{amaranthpink} E}, {\color{bluecrayola} nominal}). ensures that the model will not consider applying shape channel on non-nominal variables. Specification of outputs like {\color{aero} \#}{\color{brightmaroon} show} {\color{absolutezero} channel}/{\color{amaranthpink} 2} define the output items and the number of its parameters. With the aforementioned modeling process, Draco can be leveraged to build increasingly sophisticated visualization systems with less efforts. In addition to Draco, we also integrate appropriate rules from other sources as listed in Table~\ref{tab:taskbase}. \subsubsection{Customized rules for task} Draco\cite{Moritz2019} only includes two abstract tasks (value and summary), which can hardly capture the user's activities during visual analysis. In response, TaskVis extends Draco with additional detailed modeling of analytic tasks based on the task base in Section~\ref{sec:task}. TaskVis introduces an additional primitive {\color{absolutezero} task}(). As shown in Table~\ref{tab:taskbase}, we summarize appropriate chart types for each task. It can be formulated as rules to effectively narrow the search space, for example, {\color{aero}:-} {\color{absolutezero} task}({\color{bluecrayola} sort}), {\color{brightmaroon} not} {\color{absolutezero} mark}({\color{bluecrayola} bar}). is an integrity constraint stating that it cannot be the case that mark type applied in \textit{sort} task is not bar. There is another type of rule that restricts operations to several specific tasks. For example, aggregation is not allowed in \textit{determine range}, \textit{trend}, \textit{deviation}, and \textit{error range} task, as they should display the raw data. Besides, based on the characteristics of each task, we also formulate separate rules independently. For instance, {\color{aero}:-} {\color{absolutezero} channel}({\color{amaranthpink} E}, {\color{bluecrayola} x}), {\color{brightmaroon} not} {\color{absolutezero} type}({\color{amaranthpink} E}, {\color{bluecrayola} temporal}), {\color{absolutezero} task}({\color{bluecrayola} change\_over\_time}). states that the variable on x-axis in \textit{change over time} task must be temporal. We develop these rules through iterative informal feedback from researchers and students with varying-level experience with visualizations based on a prototype of TaskVis. In each round, we pick out meaningless charts and further improve our rule base. \subsubsection{User partial specification} TaskVis supports full-automatic recommendation, users only need to input the dataset and the system can automatically generate appropriate visualizations. However, in order to make user input more flexible, we allow inputting partial specifications which includes interested data columns and their analytic tasks. It helps to restrict the search space within well-formed specifications of the user's interests. These rules are generated based on interactions between users and visualization interface, as shown in Figure \ref{fig:interface}(B, F). Recall Figure~\ref{fig:overview} (d), after transforming to ASP programs, the user's input along with the rule base is sent into Clingo. Differ from Draco\cite{Moritz2019}, which eliminates meaningless visualizations using hard constraints and finds the most preferred charts according to soft constraints. TaskVis first enumerates all candidate visualizations in ASP by hard constraints, and then converts to Vega-Lite specification for visualization ranking module to handle. Each selected task corresponds to an independent VisRec list. \begin{figure}[t] \centering \includegraphics[width=0.4\textwidth,keepaspectratio]{./pdf/cost} \caption{Example of cost model. \textit{cost score} of the visualization in Figure~\ref{fig:vegalite} can be obtained by summing up cost of all components. } \label{fig:cost} \end{figure} \section{Visualization Ranking}\label{sec:rank} TaskVis allows users to input multiple tasks, and some tasks have overlapping recommendations. This means that one chart may be applicable to multiple tasks. Therefore, if the visualization generation module handles multi-tasks, the VisRec list can be deduplicated first. After that, we derive a cost model inspired by GraphScape\cite{Kim2017b} to quantify the visualizations and design four rank schemes. \subsection{Cost model}\label{sec:costmap} As TaskVis is powered by Vega-Lite, a single visualization can be split into independent components, as shown in Figure \ref{fig:vegalite}. GraphScape\cite{Kim2017b} introduces a graph structure for modeling relationships among Vega-Lite-based charts. Graph nodes represent visualizations and edges represent edits that transform one visualization to another. GraphScape leverages linear programs to derive transition costs via a partial ordering of visualization components. Illustrated with example, in the transition category of visual encodings, following the perceptual kernels method\cite{Demiralp2014a}, metric-space embeddings are performed on visual encoding type comparisons. The results find the following transition cost order: x, y \textgreater row, column \textgreater color \textgreater size \textgreater shape \textgreater text, which assumes that changes to spatial encodings require more interpretation effort. The corresponding generated cost is shown in Figure~\ref{fig:cost} (left). Inspired by GraphScape\cite{Kim2017b}, we also generate a cost model and define \textit{cost score} to measure the complexity of different components. For a chart, \textit{cost score} can be obtained by adding the corresponding cost values of all components. Lower \textit{cost score} means the visualization is more concise. In detail, we extend GraphScape with the supplement and subdivision of visualization components. For mark type, we refer Table~\ref{tab:taskbase} to generate cost with priority of each task. Among channels, we replenish some components that are special for arc and geoshape chart. As to data transform, we not only add operations like stack, regression, and loess, but also subdivide aggregate operation into \MakeUppercase{aggregate\_sum}, \MakeUppercase{aggregate\_count}, and \MakeUppercase{aggregate\_mean}. Based on the cost model, each visualization can be assigned a \textit{cost score} with good explainability. For example, in Figure~\ref{fig:vegalite}, the chart is generated under \textit{sort} task, its component set and corresponding cost are shown in Figure~\ref{fig:cost} (right), \textit{cost score} can be obtained by summing up cost of all components. \subsection{Rank schemes}\label{sec:rankscheme} After computing \textit{cost score} of each chart, four rank schemes are designed as follows: \textbf{(I) Complexity-based ranking: } This scheme ranks visualizations according to the chart's \textit{cost score} from low to high. When people make visualization observations, they tend to view charts as a whole and hope to understand the information inside charts in a short time. According to our cost model, charts with lower \textit{cost score} are easier to understand, which is in line with people's habit of observing charts. This scheme is appropriate for most analytic tasks, such as \textit{change over time}, \textit{characterize distribution}, \textit{cluster}, etc. \textbf{(II) Reverse-complexity-based ranking: } Overall, charts with higher \textit{cost score} come first in this scheme. However, instead of reversing the visualizations in complexity-based ranking scheme, we first adopt the unsupervised algorithm DBSCAN to cluster all the results into several categories, where visualizations in one category are similar to each other (e.g., just exchange the coordinate axis or replace an aggregation function). Then the visualizations are ranked by category in reverse order while maintaining the partial rankings within the category. The scheme is appropriate for tasks like \textit{sort}, and \textit{determine range}. The rationality is that charts of these tasks are relatively simple, charts with high \textit{cost score} can present more information within a range that humans can easily perceive. \textbf{(III) Interested-data-columns-based ranking: } This scheme is mainly related to the data columns of interest inputted by the user. Users usually expect a chart to display as many data columns of interest as possible. So if a chart fails to show all the user's interested columns, it will be assigned a penalty. The new \textit{cost score} is computed by dividing $(N1/N2)$, where N1 is the number of data columns covered in a single chart and N2 is the number of the user's interested data columns. Visualizations are finally sorted by new generated \textit{cost score} from low to high. The scheme fits some comprehensive tasks like \textit{magnitude} and \textit{find anomalies}. \textbf{(IV) Tasks-coverage-based ranking: }\label{sec:taskcover} The above three rank schemes are more suitable for single-task situations. For multiple tasks, we believe that if a chart is an overlap of multiple tasks' VisRec list, it must have universal meaning and should be ranked in the forefront. We define \textit{task coverage number} of a chart as the number of tasks (within the user's input) it can satisfy. Before ranking by this scheme, we merge and deduplicate all tasks' VisRec list first, and identical visualizations average the \textit{cost score} value. On the basis, all charts are first ranked by \textit{task coverage number}, where those with the same \textit{task coverage number} are partially ranked by the \textit{cost score}. Noting that this rank scheme is valid only when TaskVis accepts multiple tasks, otherwise it will degenerate into complexity-based ranking scheme. Back to Figure~\ref{fig:overview} (f), users are allowed to select the four rank schemes freely to deal with the generated visualizations. We also recommend appropriate rank scheme for each task as default in the system based on the materials mentioned in Section~\ref{sec:task}. In the output VisRec list (g), each chart is an independent result. \section{Combination Recommendation}\label{sec:comrec} In this section, instead of recommending individual charts, we focus on generating a set of visualizations to give a brief view of the whole dataset, as shown in Figure~\ref{fig:overview}(h). We call this issue \textit{combination recommendation}. This is the gospel of users who are not familiar with the data and it is an effective way of system cold start. To this end, we extend tasks-coverage-based ranking scheme in the following two situations: \textbf{Without Task selection:} If users select no tasks, the generation of candidate visualizations relies on iterating all the tasks in task base. Combination recommendations are further formulated according to the following principles: (1) The set of charts must cover all the data columns of interest to users. (2) Larger \textit{task coverage number} is always chosen first. We describe the combination recommendation algorithm in Algorithm 1. \textbf{With Task selection:} If users have selected tasks of interest, iterating the inputted tasks can generate candidate visualizations. The first principle mentioned above will be relaxed here, because some data columns are only applicable for specific tasks, such as latitude and longitude can only appear in \textit{spatial} task. If only a single task is accepted, TaskVis can also recommend a set of targeted charts to describe the task. \begin{algorithm}[h] \caption{Combination Recommendation} \label{alg::comrec} \begin{algorithmic}[1] \Require $Result$: Visualization class; $Result.Fields$: Columns involved in a chart; $Cols_{interest}$: Columns of interest that users input; $Recs:list[Result]$: Visualization list after deduplication. \Ensure A set of visualizations $ANS:list[Result]$; \State sort Recs by Tasks-coverage-based ranking scheme; \State set $Ans=Cols_{covered}=[\,]$; \While {$Cols_{covered}\subset Cols_{interest}$ and $Recs$ != $NULL$ } \State append $Recs[0]$ to $ANS$; \State $chosen fields=Recs[0].Fields$; \State $Cols_{covered}=Cols_{covered}\cup chosen fields$; \If {$chosen fields.length$ is $1$} \State $enums=$ all data column combinations in $chosen fields$; \Else \State $enums=$ all data column combinations in $Cols_{covered}$; \EndIf \For{$vis$ in $Recs$} \If {$vis.Fields$ in $enums$ } \State delete $vis$ in $Recs$; \EndIf \EndFor \EndWhile \end{algorithmic} \end{algorithm} \iffalse \begin{figure}[h] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/covid_map} \caption{Representative VisRec examples of COVID-19 dataset in \textit{spatial} task. Geo-shape with heatmap and circle mark, and visualizations with circle mark support text label additionally.} \label{fig:covid1} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/COVID_time} \caption{Representative VisRec examples of COVID-19 dataset in \textit{change over time} task. Including line and area (support stack) marks.} \label{fig:covid_time1} \end{figure} \fi \section{Evaluation} This section will discuss the evaluation of TaskVis by a series of use cases and a user study, along with comparison with existing technologies. \subsection{Use Cases} This section will illustrate the recommendation capability of TaskVis with use cases. The individual recommendation will be exhibited first, and the combination recommendation follows. More recommendations can be found in the supplemental materials. \subsubsection{Individual Recommendation} Imagine that we are exploring a COVID-19 dataset of U.S.\cite{covid}, which contains the number of daily confirmed and dead cases. We may be interested in the geographical distribution of deaths. The recommendations in the \textit{spatial} task are shown in Figure~\ref{fig:covid}. One chart is clicked for preview, it applies color channel on the circle mark, and the concrete numbers are labeled. Geoshape charts leverage heat maps to reveal the distribution of deaths in each state. For this dataset, we may also be keen on ``how the number of daily confirmed cases has changed since the epidemic?". After selecting the \textit{change over time} task and data columns of interest, the recommendation results are shown in Figure~\ref{fig:covid_time}. We can intuitively observe the change in a total number of daily confirmed (national and four major regions distributed) by line and area charts, and the area charts also show the stack of data. \begin{figure}[t] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/covid_map2.png} \caption{VisRec examples of the COVID-19 dataset in the \textit{spatial} task with multiple columns. One chart is previewed by clicking on it. } \label{fig:covid} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/change_over_time.png} \caption{VisRec examples of COVID-19 dataset in the \textit{change over time} task with the \textit{region}, \textit{confirmed}, and \textit{date} columns. } \label{fig:covid_time} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.48\textwidth,keepaspectratio]{./pdf/display_by_notask.png} \caption{VisRec examples of the Happiness Ranking dataset. The \textit{Display by task} switch is closed.} \label{fig:display_by_notask} \end{figure} For the Happiness Ranking dataset\cite{happiness}, after choosing \textit{Region}, \textit{Happiness Score}, and \textit{Health} columns, selecting six tasks, and closing the \textit{Display by task} switch, all the charts are deduplicated and displayed together. As shown in Figure \ref{fig:display_by_notask}, the tasks-coverage-based ranking scheme is applied, charts ranked in the forefront are appropriate for more tasks, and the names are placed above the chart. The charts also support simple interactions like hovering to see data details. \subsubsection{Combination Recommendation} Imagine that we are analyzing the Hollywood Stories dataset\cite{hollywood} and are not familiar with the data. A general view of the dataset can be helpful for our subsequent in-depth exploration. As shown in Figure~\ref{fig:combine}, without selecting tasks and data columns, the set of charts covers all the data columns and satisfies the most tasks. As the system displays thumbnails by default, high-cardinality variables (like \textit{name}) will make the chart crowded, but clicking on the chart like in Figure \ref{fig:covid} can view the original clear chart. Although the use cases present promising results, our target is not to show that combination recommendation results are always superior. We argue that it offers an option to obtain a general view of the dataset. \begin{figure}[t] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/combination.png} \caption{Combination Recommendation results of the Hollywood Stories dataset. } \label{fig:combine} \end{figure} \subsection{User Study}\label{sec:evaluation} The overall goal of the study was to investigate TaskVis's ability to recommend targeted charts for the user's analytic tasks. \subsubsection{Participants} We invited 22 persons (6 female and 16 male) to participate the study. The participants include 1 undergraduate, 13 master candidates, 6 phd candidates, 1 researcher, and 1 data analyst. Among them, 8 participants perform data analysis every day, 9 monthly, and 5 less than once a month. All of them have the experience of using Microsoft Excel and programming with python to analyze and present their data. \subsubsection{Study Protocol} The study can be roughly classified into three parts: pre-designed experiment, free exploration, and post-study interviews. Before the study, we presented a short examination on color blindness and basic visualization knowledge. In the pre-designed experiment, we first made an explanation of the process in details and gave a brief description of each task. Then, given a recommended chart, participants were asked to answer a 5-point Likert scale question (-2 = strongly disagree, -1, 0, 1, 2 = strongly agree), ``The chart of \{1\} dataset can satisfy the \{2\} task.", where \{1\} is the dataset name and \{2\} is the task name. Metadata about the chart (e.g., task description and data columns) is also presented to help participants make their decisions. In total, there were 287 visualizations for participants to cope with. After the experiment, we made a tutorial to introduce the system interface and show some examples. Participants were later asked to freely explore TaskVis through a web browser on their computer, especially to perform tasks related to their actual day-to-day work. The user study lasted about one hour. Participants did not receive any intervention during the whole process. Finally, we conducted post-study interviews to get participants' feedback, including a questionnaire guided by the system usability scale to gauge the usability of TaskVis. \subsubsection{Datasets} We provided participants with two datasets in the pre-designed experiment. One is the COVID-19 data of the United States\cite{covid}, including the daily numbers of confirmed cases and deaths in each state. The dataset has 12903 records and consists of 5 quantitative, 3 nominal, and 1 temporal columns. The other is sales data of 406 different cars\cite{cars}, which is composed of 5 quantitative, 2 nominal, 1 ordinal, and 1 temporal columns. For free exploration, we offered more datasets covering areas of weather, sport, movie, etc. \subsubsection{Analysis of result} All participants finished the pre-designed experiment and explored the system with several datasets. We finally collected 6249 valid records from 22 participants in the pre-designed experiment. The average score is 1.05. In general, TaskVis can recommend targeted charts to satisfy the user's analytic task. We further analyzed the charts that were scored -2 or -1 more than three times and summarized the reasons as follows: (1) The overlap between marks makes charts difficult to distinguish, especially when a large amount of data is presented; (2) Outliers affect the users' understanding of the chart. For example, in the COVID-19 dataset, the number of deaths in one day exceeds 5000, which is much higher than the average. This may lead to some charts presenting in extreme ways; (3) The chart conveys limited information. This is mainly reflected in the \textit{determine range} task, where the chart only presents discrete variables. We think that all the reasons above are mainly aroused by the dataset, while we pay more attention to the form in which the data is presented. On the other hand, the abnormality of charts can also mirror the abnormality of the dataset, which is also meaningful in data analysis. So we believe that TaskVis still has a good recommendation ability, and we will also handle the problem in future work. TaskVis was generally considered as usable. Participants mostly agreed with the statements ``I think that I would like to use this system frequently." ($\mu$ = 4.3 on a 5-point Likert scale) and ``I thought the system was easy to use." ($\mu$ = 4.5 on a 5-point Likert scale). The mean system usability score is $\mu$ = 71, being between ``OK" and ``good"\cite{sus}. We also collected many feedbacks of the system. P4 (female, 27) said that ``The integrated tasks cover commonly used tasks in my daily work and it (TaskVis) can help me quickly generate appropriate visualizations." For ranking effectiveness, P1 (male, 23) made a comment that ``The four ranking schemes are interesting. I can choose different schemes according to my application scenarios. Usually, the charts listed in the front are relatively more appropriate." P18 (female, 23) commented regarding the final presentation of the system that "multiple presentation modes allow flexible exploration." In addition, P9 (male, 23) said that "Combination recommendation is useful, sometimes I select multiple tasks, but individual visualization may fail to cover all the tasks." Some participants also pointed out the drawbacks of TaskVis. P13(male, 25) said that ``It would be better to make the output editable." and P14 (male, 23) stated that ``More data insights can be further integrated. More convenient interaction paradigms may enhance the overall user experience, such as pen, touch, and natural language." Overall, participants all agreed that TaskVis is an effective visualization tool to facilitate data exploration. \subsection{Comparison} TaskVis is a task-oriented VisRec system. There is no ideal technology in the community to compare with. So this subsection only provides qualitative discussions. To our knowledge, most existing VisRec systems can not accept the user's analytic tasks and fail to recommend targeted results. Instead, TaskVis pays more attention to the user's tasks and can generate richer charts. So the recommended visualizations of TaskVis can better satisfy the user's diverse analysis intents. Besides, most VisRec systems generate only a few charts in a recommendation circle. Instead, TaskVis can recommend various visualizations for users to choose, and the charts ranked in the front are relatively more appropriate. Different schemes also apply to different scenarios. Recently, Visualization-oriented Natural Language Interfaces (V-NLIs) are becoming a complementary input modality to traditional WIMP interaction\cite{Shen2021a}. V-NLIs can extract the user’s task by understanding the NL utterances since they may hint at the user’s analysis goals. However, most V-NLIs can only deal with well-structured queries. They still face various challenges, such as the ambiguous and underspecified nature of human language. Compared with these technologies, TaskVis provides a set of commonly used analytic tasks and design an interaction to allow users to select their tasks precisely. Besides, the task base can be extended with more tasks in the future, and the system can easily integrate new tasks. Finally, we argue that TaskVis is not always superior to the aforementioned technologies. Rather, it provides a new approach to integrate the user's analytic tasks into VisRec systems and builds a task-oriented system that can generate targeted visualizations. We believe that these technologies and TaskVis can complement each other. \iffalse \section{Use Cases} This section illustrates the recommendation capability of TaskVis with use cases. Individual recommendation will be exhibited first and combination recommendation follows. Due to layout restrictions, we just show some representative examples here. More recommendations can be viewed in the supplemental materials. \subsection{Individual Recommendation} Imagine that we are exploring a COVID-19 dataset of U.S.\footnote{https://github.com/CSSEGISandData/COVID-19}, which contains the number of daily confirmed and dead cases. We may be interested in the geographical distribution of deaths. The recommendations in \textit{spatial} task are shown in Figure~\ref{fig:covid}. One chart is clicked for preview, it applies color channel on circle mark and the concrete numbers are labeled. Geoshape charts leverage heat map to reveal the distribution of deaths in each state. For this dataset, we may also be keen on ``how the number of daily confirmed cases has changed since the epidemic?". After selecting \textit{change over time} task and data columns of interest, the recommendation results are shown in Figure~\ref{fig:covid_time}. We can intuitively observe the change in total number of daily confirmed (national and four major regions distributed) by line and area charts, and the area charts also show the stack of data. Continue with Figure \ref{fig:interface}, after choosing \textit{Region}, \textit{Happiness Score}, and \textit{Health} columns in Happiness Ranking\footnote{https://www.promptcloud.com/world-happiness-report-dataset-2019/} dataset and selecting six analytic tasks, closing \textit{Display by task} switch, all the charts will be deduplicated first and displayed together. As shown in Figure \ref{fig:display_by_notask}, a tasks-coverage-based ranking scheme is applied, charts ranked in the forefront are appropriate for more tasks, and the names are placed above the chart. The charts also support simple interactions like hovering to see data details. Suppose that we are exploring another dataset, cars\footnote{http://stat-computing.org/dataexpo/1983.html}. Figure~\ref{fig:evaluation} lists representative results ranked in the forefront for each task. We can compare the number of cars with different cylinders by bar chart in \textit{comparison} task. The point chart in \textit{characterize distribution} task provides data distribution information. The range of displacement with different cylinders can be clearly observed with boxplot in \textit{determine range} task. The pie chart in \textit{part to whole} task reveals how the dataset is divided into three component elements. \subsection{Combination Recommendation} Imagine that we are analyzing the Hollywood Stories\footnote{https://www.kaggle.com/brendan45774/hollywood-most-profitable-stories} dataset and are not familiar with the data columns, a general view of the dataset can be helpful for our subsequent in-depth exploration. As shown in Figure~\ref{fig:combine}, without selecting tasks and data columns, the set of charts cover all the data columns and satisfy the most tasks. As the system displays thumbnails by default, high-cardinality variables (like \textit{name}) will make the chart crowded, but clicking on the chart like in Figure \ref{fig:covid} can view the original clear chart. TaskVis can also produce combination recommendations for special tasks. Still with cars dataset, Figure~\ref{fig:comsingletask} displays some examples with single task selection. The set of charts describe the data columns of interest (\textit{Horsepower}, \textit{Year}, \textit{Origin}, \textit{Cylinders}, and \textit{Displacement}) in a targeted manner while satisfying the selected task. Although the use cases present promising results, our target is not to show that combination recommendation results are always superior. We argue that it offers an option to obtain a general view of the dataset. \begin{figure}[t] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/covid_map2.png} \caption{VisRec examples of COVID-19 dataset in \textit{spatial} task with multiple columns. One chart is previewed by clicking on it. } \label{fig:covid} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/change_over_time.png} \caption{VisRec examples of COVID-19 dataset in \textit{change over time} task with \textit{region}, \textit{confirmed}, and \textit{date} columns. } \label{fig:covid_time} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.48\textwidth,keepaspectratio]{./pdf/display_by_notask.png} \caption{VisRec examples of Happiness Ranking dataset with multiple tasks. The \textit{Display by task} switch is closed.} \label{fig:display_by_notask} \end{figure} \begin{figure*}[t] \centering \includegraphics[width=0.95\textwidth,keepaspectratio]{./pdf/evaluation} \caption{Examples of TaskVis's individual recommendation with cars dataset. Here lists representative results ranked in the forefront for each task with default rank scheme. } \label{fig:evaluation} \end{figure*} \iffalse \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/combine_covid} \caption{Combination Recommendation results of COVID-19 dataset. The set of charts cover all the data columns of interest and satisfy the most tasks. } \label{fig:combine_covid} \end{figure} \fi \begin{figure}[t] \centering \includegraphics[width=0.47\textwidth,keepaspectratio]{./pdf/combination.png} \caption{Combination Recommendation result of Hollywood Stories dataset. The set of charts cover all the data columns of interest and satisfy the most tasks. } \label{fig:combine} \end{figure} \begin{figure*}[t] \centering \includegraphics[width=0.95\textwidth,keepaspectratio]{./pdf/combine_singletask} \caption{Combination recommendations of cars dataset with single task selection. The set of charts describe the data columns of interest (\textit{Horsepower}, \textit{Year}, \textit{Origin}, \textit{Cylinders}, and \textit{Displacement}) in a targeted manner while satisfying the selected task.} \label{fig:comsingletask} \end{figure*} \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{pdf/user_study} \caption{Pre-designed experiment in the user study.} \label{fig:user_study} \end{figure} \section{User Study}\label{sec:evaluation} The overall goal of the evaluation was to investigate TaskVis's ability of recommending targeted charts for the user's analytic task. To this end, we conducted a user study to assess the following aspects: \begin{itemize}[leftmargin=9pt] \item whether the visualizations recommended by TaskVis align with user preference. \item whether the rank schemes can help users explore the recommended charts in a proper order. \item whether the final presentation of TaskVis can assist users perform data analysis. \item whether TaskVis can strike a balance between system automation and the user's intent. \end{itemize} Generally compared with related works, TaskVis pays more attention on the user's analytic task and can recommend richer charts. However, there is no ideal technology in the community to compare with, so we designed a user study to evaluate TaskVis with pre-designed experiment and post-study interview. \textbf{Participants:} Excluding those who did not finish the experiment completely or failed to pass the visual impairment test, we received effective feedback from 22 persons (6 female and 16 male). The participants include 1 undergraduate, 13 master candidates, 6 phd candidates, 1 researcher, and 1 data analyst. Among them, 8 participants perform data analysis every day, 9 monthly, and 5 less than once a month. All of them have the experience of using Microsoft Excel and programming with python (e.g., Pandas, Numpy, and Matplotlib) to analyze and present their data. \textbf{Study Protocol:} The study can be roughly classified into three parts: pre-designed experiment, free exploration, and post-study interviews. Before the study, we presented a short examination on color blindness and basic visualization knowledge to ensure the effectiveness of follow-up study. In the pre-designed experiment, we first made an explanation of the process in detail and gave a brief description of each analytic task. After that, as shown in Figure \ref{fig:user_study}, given a recommended chart, participants were asked ``How well can you get information from the chart for \{1\} dataset with \{2\} task?", where \{1\} is the dataset name and \{2\} is the task name in task base. Based on personal perceptions, participants should give a score, 1, 2, or 3, where 1 point means the chart has nothing to do with the task at all, 3 point means the chart can present rich information about the task, and 2 point represents a neutral attitude. Metadata about the chart (e.g., task description and data columns) are also presented to help participants make their decisions. In total, there were 287 visualizations for participants to cope with. After the experiment, we made a tutorial to introduce the tool interface and show some examples, they were later allowed to assess TaskVis through a web browser on their computer to explore the datasets freely, especially to perform tasks related to their actual day-to-day work. The user study lasted about one hour. During the whole process, participants did not receive any intervention while we just made some necessary explanation of the system. Finally, we conducted a post-study interviews to get participants' feedback. \textbf{Datasets:} We provided participants with two datasets in the pre-designed experiment. One is the COVID-19 data of the United States, including the daily numbers of confirmed cases and deaths in each state. The dataset has 12903 records and consists of 5 quantitative, 3 nominal, and 1 temporal columns. The other is sales data of 406 different cars, which is composed of 5 quantitative, 2 nominal, 1 ordinal, and 1 temporal columns. For free exploration, we offered more datasets covering areas of weather, sport, movie, etc. \subsection{Analysis of result} We finally collected 6249 valid records from 22 participants in the pre-designed experiment\cite{Please refer to the supplementary materials for raw data of the experiment.}, where 3 point account for 63.59\%, 31.24\% is 2 point, and the proportion of 1 point is only 5.17\%. The average score is 2.58. In general, TaskVis is capable of recommending targeted charts to satisfy the user's analytic task. We further analyzed the charts that were scored 1 point three times or more and summarized the reasons as follows: (1) The overlap between marks makes charts difficult to distinguish, especially when a large amount of data is presented; (2) Outliers affect the users' understanding of the chart. For example, in COVID-19 dataset, the number of deaths in one day exceeds 5000, which is much higher than the average. This may lead to some charts presented in extreme ways; (3) The chart conveys limited information. This is mainly reflected in \textit{determine range} task, where the chart only presents discrete variables. We think that all the reasons above are mainly aroused by the dataset, while we pay more attention to the form in which the data is presented. On the other hand, the abnormality of charts can also mirror the abnormality of dataset, which is also meaningful in data analysis. So we believe that TaskVis still has a good recommendation ability, and we will also handle the problem in future work. \subsection{Feedback} All participants finished the pre-designed experiment and explored the system with several datasets. Generally, all of them agreed that TaskVis is an efficient tool for data analysis. They would like to use TaskVis to facilitate their daily work. Almost all participants said that performing data analysis with TaskVis was enjoyable, for instance, P8 (male, 35) commented that ``this system is very interesting to use." When asked whether the visualizations recommended by TaskVis align with their preference, P20 (male, 26) said that ``when performing tasks similar to my daily work, the generated results from it (TaskVis) always contain the charts I want to draw manually." P4 (female, 27) said that ``integrated tasks (in TaskVis) cover commonly used tasks in my day-to-day work and it (TaskVis) can help me quickly generate appropriate visualizations." For ranking effectiveness, P1 (male, 23) made a comment that ``the four ranking schemes are interesting. I can choose different schemes according to my application scenarios. Usually, the charts listed in the front are relatively more appropriate." P18 (female, 23) commented regarding the final presentation of the system that ``multiple presentation modes allow flexible exploration." P9 (female, 22) said that ``the presentation of the charts is intuitive." When asked about the user interface, P2 (male, 26) commented that ``the interface is easy to use and I can input data columns and tasks freely. Surprisingly, no input can also produce a general view of the dataset." In addition, P9 (male, 23) said that ``combination recommendation is useful, sometimes I select multiple tasks, but individual visualization may fail to cover all the tasks." P4 (female, 27) commented that ``I will put these charts in my slides." Some participants also pointed the drawbacks of TaskVis, ``it would be better to make the output editable." (P13, male, 25), ``more data insights can be further integrated." (P14, male, 23), and ``more convenient interaction paradigms may enhance the overall user experience, such as pen, touch, and natural language." (P17, male, 23). Overall, participants all agreed that TaskVis is an effective visualization tool and can facilitate data exploration. \fi \iffalse \begin{table} \caption{11} \label{tab:my-table} \begin{tabular}{|l|l|l|l|} \hline Dataset & 3 & 2 & 1 \\ \hline COVID-19 & 1564 & 942 & 188 \\ \hline Percentage & 58.05\% & 34.97\% & 6.98\% \\ \hline Cars & 2410 & 1010 & 135 \\ \hline Percentage & 67.79\% & 28.41\% & 3.80\% \\ \hline Total & 3974 & 1952 & 323 \\ \hline Percentage & 63.59\% & 31.24\% & 5.17\% \\ \hline \end{tabular} \end{table} \subsubsection{Visualization Ranking} For each task, we called \textit{innerid} the internal serial number of each chart, which is in line with the order of the chart recommended in TaskVis. We used the participants' selection (preference) as the response variable and the \textit{innerid} of the charts as explanatory variable to fit a linear model. We expected that \textit{innerid} has a significant influence on participants' selection, which means the visualization ranking module makes sense. 2 datasets and 17 tasks generate 33 groups of experiments (Cars dataset has no results with \textit{spatial} task). We also deliberately reversed the order of charts in several experiments, trying to verify the effectiveness of visualization ranking from multiple angles. In the 33 groups, excluding only one chart that are unable to fit a linear model, there left 31 valid groups. The analysis results showed that 16 groups' p-value is less than 0.05, indicating that the order of charts has a significant impact on participants' selection, accounting for 51.61\%. Among them, 14 groups of \textit{innerid} coefficients are positive, 2 groups are negative, and the 2 groups are indeed within the groups reversed intentionally. Overall, we could conclude that the visualization ranking module is positively associated with the choices of participants. We also analyzed the remaining groups. We were relieved to find that most groups’ charts are selected as ‘Strong’, which makes it difficult to fit a linear model. This did not indicate that the ranking schemes are invalid but TaskVis has strong recommendation capabilities. Besides, if users are not satisfied with the ranking results, TaskVis also allows users to select the ranking schemes freely. \subsubsection{Users' Preferences vs Recommendations} As one chart may be suitable for multiple tasks, experiment 2 allowed the participants to select multi-tasks for a given chart. We did not expect the recommendations of TaskVis completely conform to the user's preferences, but rank in the forefront. We sorted the tasks in a list according to the number of times selected by participants from high to low, and then observed rankings of TaskVis's recommendations in the list. For example, as to chart No.1004, TaskVis thinks it is most suitable for \textit{cluster}, \textit{find extremum}, \textit{characterize distribution}, and \textit{find anomalies} tasks. Participants' selections are shown as follows: \begin{figure}[h] \centering \includegraphics[width=0.45\textwidth,keepaspectratio]{./pdf/eva2} \label{fig:eva2} \end{figure} The top [1, 2, 3, 5] tasks were in line with TaskVis, which indicates that TaskVis's recommendations are consistent with the user's preferences. It is not a violation that several tasks rank in the front (e.g., \textit{comparison} and \textit{correlate}), as TaskVis is able to recommend other charts that are more related to these tasks. So we just target to recommend the charts that are most relevant to the task, not all relevant charts. The entire result of experiment 2 is shown as follows: \{No.1000: [1], No.1001: [1, 2, 4], No.1002: [1, 2, 3, 4, 5, 6], No.1003: [1], No.1004: [1, 2, 3, 5], No.1005: [1, 2], No.1006: [1, 3], No.1007: [1, 3, 4], No.1008: [1, 3], No.1009: [1]\} where \textit{100X} is the serial number, and [*] is the corresponding rankings of TaskVis's recommendations in participants' responses. We can see that TaskVis could well reflect the user's preferences. Please refer to the supplementary materials for detailed raw data of the evaluation. \fi \section{Conclusion and Future Work} In this paper, we present a task-oriented visualization recommendation approach called TaskVis. TaskVis improves the existing technologies by strongly correlating recommendations with the user's analytic task. It allows users to input their tasks and interests flexibly, thereby striking a better balance between automation and the user's intent. We hope that it can inspire more valuable works in the VisRec community. Nevertheless, it is still in the early stage of visualization recommendation. We now discuss how TaskVis can evolve to be more intelligent and what we need to do in the future. \textbf{Extract abundant data properties: }The rules in TaskVis are more detailed to the task but less involved in data properties, where only type, length, and cardinality of data columns are considered. However, the properties of multi-dimensional statistical data are beneficial for targeted recommendations, such as standard deviation, coefficient of variance, and quantitative coefficient of dispersion that extracted in VizML\cite{Hu2019d}. In the future, we will extend the rule base to support more statistical data properties. \textbf{Integrate semantics and natural language interface: }TaskVis only integrates data properties in the numerical sense but does not consider the semantic meaning. In the future, we will integrate the semantic type of data columns into TaskVis to transmit more valuable information\cite{Hulsebos2019}. Further, the user's occupation, social hotspots, and geographic information can be helpful to the personalized recommendation. In addition, a natural language interface can also greatly improve the user experience of the VisRec systems\cite{Shen2021a}. \textbf{Knowledge graph to construct rules: }Draco\cite{Moritz2019} has formalized visualization design knowledge as constraints, but the knowledge is independent of each other, which is not conducive to knowledge reasoning. We suppose leveraging a knowledge graph to construct a rule base in an extensible model where the rules are interrelated. Based on the Knowledge graph, we can conduct knowledge extraction from public examples. In addition, users can also be allowed for customizing rules to satisfy their requirements. \bibliographystyle{abbrv-doi}
\section{Introduction} 3D Mapping is an essential perception process in autonomous machines to build polygonal representation for the environment. With the information of the 3D map, autonomous machines can perceive the surrounding environment and perform several safety-critical autonomous execution tasks, such as localization, motion planning, and collision detection \cite{mp32021cvpr}. To build a 3D map, the sensor data generated from sensors, such as the 3D point cloud, is streamed into the computation pipeline to create and update the map, such as a corridor 3D map example in Fig. \ref{fig:overall_flow}. Within the end-to-end computation of autonomous systems, the perception stage (i.e., parse sensor data, build the 3D map, and localization) is a computationally intensive process for tracking real-time changes in the environment. For example, in a package delivery task for a micro aerial vehicle (MAV), the 3D map generation can take more than 70\% of the total runtime for autonomous navigation \cite{Behzad2018mavbench}. Maintaining and querying a 3D map in real-time is costly in terms of both memory and computation resources. As many 3D maps discretize the environment into cubic volumes (i.e., voxels), there is high memory access and capacity requirement for 3D map build and update. Due to the randomness of the input map voxel coordinates, the memory access pattern is highly irregular. The bandwidth of the memory is the main performance bottleneck impeding the real-time 3D mapping. Furthermore, the 3D map also requires large memory storage, which further increases with a higher resolution (i.e., smaller voxel size). For example, in a 3D scan dataset \cite{octomap_dataset}, a full 3D map with a resolution of 10~cm could require significant memory storage ranging from 10~MB to more than 5~GB \cite{hornung2013octomap}. In addition to the high memory access demand, the large volume of sensor data leads to a significant computation challenge for real-time 3D mapping. For example, the Microsoft Kinect sensor produces 9.2 million 3D points per second \cite{Biswas2014icra}. Such a high volume of points leads to low hardware throughput, i.e., below the real-time requirement 30 frames per second (FPS) \cite{singh2018cvpr}. Prior work explored the sampled frames or sparse points cloud for 3D maps, but most real-time 3D mappings still need to run on high-end CPUs \cite{hess2016icra} or GPUs \cite{gpuvoxel2014iros}, leading to significant power and form factor overhead. In resource and energy-constrained autonomous machines at the edge, enabling real-time 3D mapping is even more challenging. \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{figures/overall_flow.pdf} \vspace{-20pt} \caption{The computation pipeline in a autonomous machine. 3D Mapping is a crucial task that serves many (safety) purposes and can consume as much as 70\% the execution time~\cite{Behzad2018mavbench}.} \label{fig:overall_flow} \vspace{-10pt} \end{figure} In this work, we present the first 3D mapping accelerator for an efficient and widely used 3D occupancy mapping algorithm, i.e., OctoMap \cite{hornung2013octomap}. OctoMap is one of the most widely used approaches to represent the entire 3D environment due to its memory-efficient ``Octree'' structure; it is akin to the H.264 codec for video compression. In the OctoMap, the 3D map voxels are stored in the Octree, where all nodes are recursively divided into octants (i.e., eight children), as shown in Fig. \ref{fig:octree_steps}. The occupancy of each voxel is represented by probability, forming a reliable 3D map. Furthermore, the map leaf nodes can be pruned (compressed) based on the likelihood of children nodes. Although OctoMap is a state-of-the-art approach with promising results to save memory storage, it can still not meet the real-time throughput requirement on most desktop CPUs and edge device CPUs (based on our analysis in Section \ref{sec:workload_analysis}). Therefore, we develop an efficient 3D OctoMap accelerator, i.e. OctoMap Processing Unit (OMU), in this work to enable its operation in real-time for edge machines. To improve the hardware accelerator's performance, we first analyze the performance bottlenecks of OctoMap on CPUs. We observe that the voxel node pruning and expansion consume most of the runtime. Based on this workload analysis, we designed OMU\xspace\ with three key features. First, we update the map's voxels in parallel processing element (PE) units to maximize the compute throughput by up to 8$\times$. Second, we designed a special data storage structure and parallel memory banks to improve voxel store/fetch throughput by another 8$\times$. Third, we created a pruning address manager to manage the pruned addresses and maintains high memory utilization. We evaluated the proposed OMU\xspace\ accelerator after synthesis, place and route using a commercial 12~nm CMOS technology. Compared to a state-of-the-art desktop Intel i9 CPU and a more conventional robotics platform (i.e., ARM Cortex-A57 CPU in Jetson TX2), the accelerator achieves 13$\times$ and 62$\times$ performance improvement, respectively, and a 708$\times$ energy efficiency improvement compared to the ARM A57 CPU. OMU\xspace\ only consumes 250.8~mW of power and achieves 63~FPS in throughput, thus enabling low-power real-time perception in resource-constrained autonomous machines. The contributions of our work are as follows: \begin{itemize} \item We present a comprehensive workload breakdown and characterize the bottlenecks in 3D OctoMap. We observe that the node pruning stage consumes the most run-time, which we optimize via parallel access of children nodes. \item We develop a series of hardware acceleration techniques for probabilistic 3D mapping, including a method for parallel map-voxel updates, an efficient memory data storage structure, and a dynamic pruning-address management. \item We demonstrate a 12~nm probabilistic 3D mapping accelerator OMU\xspace. The experimental results show significant performance and power benefits, and 2$\times$ higher throughput than the real-time requirement for 3D mapping tasks. \end{itemize} \begin{figure}[!t] \centering \includegraphics[width=0.95\columnwidth]{figures/octree_steps.pdf} \vspace{-10pt} \caption{(a) The probability update operations for every voxel input, (b) the pruning operation when all the children have the same occupancy probability (tree depth=2 for illustration).} \label{fig:octree_steps} \vspace{-10pt} \end{figure} \section{Background} \section{Background} Over the past decades, many space representation approaches have been studied to map the unstructured environments into a digitized representation. The 3D maps contain the environment information in three dimensions, which is demanded in the perception of autonomous machines. \textbf{Dense vs. Sparse Map:} Depending on whether the map can represent the whole 3D environment, the map models can be categorized as either dense or sparse maps. For navigation and manipulation tasks in autonomous machines or robots, a ``dense'' 3D map model, which can cover the entire environment space, is desired for collision detection and motion planning. Several dense 3D models have been widely used to represent the environments, such as point clouds, elevation maps, multi-level surface maps, Octree \cite{hornung2013octomap}, and signed distance fields \cite{voxblox2017iros}. However, only Octree and signed distance fields can represent the unknown space. Compared to the dense map, sparse 3D maps are built based on extracted features or landmarks \cite{2018vlsi_navion}\cite{2019isscc_slam}\cite{Artal2015orb-slam}. However, these sparse 3D maps cannot represent the unknown space, which is necessary for the collision detection task in autonomous motion planning. \textbf{Probabilistic Representation:} To represent the space, each space point or voxel can be simply recorded in a binary manner as either occupied or free. However, given the uncertainty of sensor measurement (e.g. noise, errors), the simple binary space representation often leads to an inaccurate map ~\cite{hornung2013octomap}. A more reliable probabilistic map model can represent the map data by its occupancy probability instead of only representing the map voxels by occupied or free. During the map update, the map voxel updates its occupancy probability on top of the prior probability. The map voxels can be merged (pruned) with their neighbors with the same probability to save memory storage with the occupancy probability values. Although the probabilistic map is reliable and memory efficient, it needs a unique data storage structure and additional hardware. \textbf{Mapping Accelerators:} To accelerate the perception of autonomous systems, there are a few specialized accelerators that have been developed for resource-constrained autonomous robots or drones, as shown in Table \ref{tab:acc_hw}. For example, an OctoMap based motion planning accelerator was developed for collision detection in robots \cite{lian2018dadup}\cite{han2020daduseries}. However, the accelerator preloads and processes a lossy 3D map in batches, missing the challenges of real-time map building. There are also SLAM-based accelerators designed for real-time applications \cite{2018vlsi_navion}\cite{2019isscc_slam}, while they only build a sparse 3D map using extracted features and cannot represent the entire environment including the unknown space. Different from prior arts, in this work, \emph{we propose an accelerator solution---OMU\xspace\ to support \textbf{dense} and \textbf{probabilistic} 3D mapping in \textbf{real-time}. } \begin{table}[t!] \centering \caption{Comparison of Mapping Accelerators} \vspace{-5pt} \begin{tabular}{|l|c|c|c|c|c|} \hline & \makecell{Dadu-p\\\textbf{\cite{lian2018dadup}}} & \makecell{Dadu-cd\\\textbf{\cite{han2020daduseries}}} & \makecell{Navion\\\textbf{\cite{2018vlsi_navion}}} & \makecell{CNN-SLAM\\\textbf{\cite{2019isscc_slam}}} & \makecell{This\\{Work}} \\ \hline Dense Map & \checkmark & \checkmark & No & No & \checkmark \\ \hline Probabilistic &No & No &No & No &\checkmark \\ \hline Real-time &No & No &\checkmark & \checkmark &\checkmark \\ \hline \end{tabular} \label{tab:acc_hw} \vspace{-15pt} \end{table}% \section{OctoMap Workload Analysis} \label{sec:workload_analysis} To understand the computation bottleneck and guide the OctoMap accelerator design, we first introduce the basic operations in OctoMap and analyze its workload breakdown. \subsection{OctoMap Overview} As the map generation example illustrated in Fig. \ref{fig:overall_flow}, the 3D sensors generate a series of point clouds for 3D map building. A ray casting kernel will process the point cloud data to identify free voxels along the ray, while the point cloud will be registered as occupied voxels. In the OctoMap, the 3D space is discretized into equal-sized voxels and stored in an Octree structure, where all nodes are recursively divided into 8 children, as shown in Fig. \ref{fig:octree_steps}. Each leaf node \emph{n} is represented by the log-odds notation of the occupancy probability, as shown in equation (1), where \text{P(n)} is a prior probability \cite{hornung2013octomap}. \begin{equation} L_{\text{leaf}}(n) = \log\left[ \frac{P(n)}{1-P(n)}\right] \end{equation} There are three basic operations to update the occupancy status of one voxel: \emph{update leaf node}, \emph{recursively update parent nodes}, and \emph{node pruning}. First, based on the coordinates of the input voxel, a corresponding leaf node is found with its occupancy probability updated. Due to the log-odds notation of the probability value, only a simple addition operation is needed to update its probability, as shown in equation (2). Next, to enable efficient memory storage and multi-resolution queries, the occupancy probabilities of the parents are recursively updated from the bottom to the root. The probability policy of the parent nodes takes the maximum occupancy of all its eight children, as illustrated by equation (3). If all the children have identical occupancy during the parent update, the children nodes are pruned while its parent becomes a leaf. On the contrary, if all the children no longer have the same occupancy, the pruned leaf node is expanded. Experiments show that Octree pruning can significantly reduce the memory storage by up to 44\% with no accuracy loss~\cite{hornung2013octomap}. \vspace{-5pt} \begin{equation} L_{\text{leaf}}(n|z_{1:t}) = L(n|z_{1:t-1}) + L(n|z_{t}) \end{equation} \vspace{-10pt} \begin{equation} L_{\text{parent}}(n) = \max_{i=8} \ {L_{\text{leaf}}(n_i)} \end{equation} During the queries of the map, the occupancy value will be fetched based on the voxel coordinates. Based on the predefined clamping thresholds, the log-odds occupancy value can be classified as a status of occupied, free, or unknown. \subsection{Runtime Breakdown and Bottleneck Analysis} \begin{table}[t!] \centering \caption{Details of OctoMap 3D scan dataset.} \vspace{-5pt} \scalebox{0.9}{% \begin{tabular}{|l|l|l|l|} \hline & \textbf{FR-079 corridor} & \textbf{Freiburg campus} & \textbf{New College} \\ \hline Scan Number & 66 & 81 &92361 \\ \hline Average Points / Scan &89x$10^{3}$ &248x$10^{3}$ &156 \\ \hline Point Cloud (x$10^{6}$) & 5.9 & 20.1 & 14.5 \\ \hline Voxel Update (x$10^{6}$) & 101 & 1031 & 449 \\ \hline i9 CPU Latency (s) & 16.8 & 177.7 & 77.3 \\ \hline CPU Throughput (FPS) & 5.23 & 5.03 & 5.04 \\ \hline \end{tabular} } \label{tab:map_details} \vspace{-10pt} \end{table}% To characterize 3D mapping as a computational task, we performed runtime analysis for a variety of map graphs from the OctoMap 3D scan dataset \cite{octomap_dataset}. Each map we select is a representative sample from the dataset suite. The 3D maps have been run on a beefy Intel i9-9940X desktop CPU, with the experiment details listed in Table \ref{tab:map_details}. They contain multiple 3D laser scans, with every scan providing different numbers of 3D points. In this experiment, all the maps use the same resolution (i.e., voxel size) of 0.2~m. For example, to complete the 3D mapping of the FR-079 corridor map, the 3D laser generates 5.9 million points in the point cloud, which leads to more than 100 million voxel updates. To build the entire 3D map, the i9 CPU takes between 16 seconds and 3 minutes. The CPU throughput is only 5 frames per second when equivalently derived for common 320x240 sensor image size, and is much lower than a 30~FPS requirement in real-time application \cite{singh2018cvpr}. To understand the hardware requirements of OctoMap, we break down the runtime of each OctoMap operation (i.e., ray casting, update leaf, update parents, and node prune or expand) as shown in Fig. \ref{fig:runtime_breakdown}. The node prune and expand stages consume most of the runtime in all of the maps and is the workload bottleneck. This bottleneck is due to the ample tree prune leading to significant irregular memory access for children nodes. The limited memory bandwidth degrades the children node access and becomes the performance bottleneck for OctoMap. The node prune in the New College dataset takes less total runtime than the other two maps, mainly due to the fewer points per scan leading to less node pruning. It is worth to mention that the number of voxel updates can be reduced by voxel overlap search during ray casting. Hence the overlapped voxels only need to be updated once to save the memory access cost. However, to enable the voxel overlap search, the ray casting needs special voxel hashing and complex hardware acceleration, as \cite{kar2020raycasting}. In this work, we focus on the voxel map integration challenge, which can be combined with other advanced ray casting acceleration. \begin{figure}[!t] \centering \includegraphics[width=0.85\columnwidth]{figures/runtime_breakdown.pdf} \vspace{-10pt} \caption{Runtime breakdown in OctoMap workloads (a) FR-079 corridor, (b) Freiburg campus, and (c) New College.} \label{fig:runtime_breakdown} \vspace{-20pt} \end{figure} \section{Hardware Acceleration for 3D OctoMap} To improve the real-time performance of 3D OctoMap, we developed a series of acceleration techniques, including parallel Octree update (for 8$\times$ compute throughput), efficient data storage and parallel memory storage (for additional 8$\times$ memory bandwidth), and dynamic prune address management (for high memory utilization), as shown in Fig. \ref{fig:pe_uarch}. \subsection{Parallel Octree Update} In the conventional OctoMap update, the input voxels are updated in series during the mapping process, as there is potential update dependency between voxels. Even the latest version of OctoMap that is available on GitHub is still a single-threaded application library.\footnote{At the time of writing, the latest release of OctoMap is 1.9.6. It is publicly accessible online at \url{https://github.com/OctoMap/octomap}} This series voxel update significantly limits the throughput of the OctoMap computation. In this work, to parallelize the voxel update while maintaining the update dependency, the entire Octree is partitioned into 8 PE units and store map voxels based on the first-level tree branches. As shown in Fig. \ref{fig:pe_uarch}, for each input voxel, it is sent to a voxel scheduler module. Based on the first-level tree branch ID, which is generated by the voxel coordinate, the voxel update request is issued to different PE units. The number of PE is set to 8 (for eight children of each node) to maximum voxel update throughput by up to 8$\times$. \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{figures/pe_uarch.pdf} \vspace{-20pt} \caption{Hardware acceleration techniques for OctoMap.} \label{fig:pe_uarch} \vspace{-10pt} \end{figure} \subsection{Parallel Memory Storage and Efficient Data Structure} As our workload analysis indicates the voxel pruning is the performance bottleneck, we adopt an 8 parallel bank memory organization in each PE to enables parallel children access, i.e. all eight children can be accessed simultaneously within one clock cycle. This memory structure provides 8$\times$ memory bandwidth improvement and significantly alleviates the node pruning bottleneck, as illustrated in Section \ref{sec:exp}. Together with the PE level data parallelism, the accelerator is able to process 64$\times$ more voxel updates than a single-threaded CPU. To efficiently store the voxels in Octree, we introduce a new data storage structure for the probabilistic OctoMap algorithm. This is shown in Fig. \ref{fig:data_structure}. Within each of the 8 memory banks, the data is stored in a 64-bit format, including 32-bits for the memory pointer, 16-bits for the children's status tags, and 16-bits for the fixed-point log-odds voxel probability. \textbf{Memory pointer [63:32]:} It is used to point out the memory address of its eight children. The children with the same parent share the same address pointer, while can be distinguished by the memory bank offset (e.g., T-Mem0 stores the children[0]). \textbf{Status tag [31:16]:} Each child has a 2 bits status tag. There are 4 possible statuses for each child, i.e., unknown, occupied, free, or inner node (i.e., non-leaf node). \textbf{Probability [15:0]:} The occupancy probability of the current node is represented using a fixed-point value. The data type is chosen to have zero loss from the floating-point maps. Compared to the previous Octree storage \cite{han2020daduseries}, our work support probabilistic voxel update and multi-voxel access in parallel. Furthermore, the special design data structure also allows easier tree pruning, as it only needs to prune (delete) one memory address pointer for all children, leading to a simple memory address management. Fig. \ref{fig:data_structure} also provides an illustration example for two voxel updates with a simple tree depth of 3 (the real OctoMap has a tree depth of 16). Based on the input voxel coordinate, we generate the children's address at each tree depth to guide the memory access (i.e., address generation module). For example, the Root node (depth=0) is stored in the first row of the memories, containing the address pointer to its children in depth=1. Hence, Node 1 is updated and stored in the second row of T-Mem 3 because it is the 4th child. Similarly, the leaf Node 3 is stored in T-Mem 2 due to its branch ID. When the tree integrates a new voxel, it will expand the memory storage if the tree branch does not exist before, such as Node 5 and Node 6 in the example. This dynamic memory usage improves overall memory utilization. \begin{figure}[!t] \centering \includegraphics[width=1\columnwidth]{figures/data_structure.pdf} \vspace{-20pt} \caption{Developed data structure for probabilistic map update.} \label{fig:data_structure} \vspace{-15pt} \end{figure} \subsection{Dynamic Pruning Address Management} \begin{figure}[!b] \vspace{-20pt} \centering \includegraphics[width=\columnwidth]{figures/prune_addr.pdf} \vspace{-25pt} \caption{Dynamic prune address manager.} \label{fig:prune_addr} \vspace{0pt} \end{figure} The probabilistic 3D OctoMap has the advantage of dynamic tree pruning to significantly reduce memory storage. To efficiently manage the Octree prune and expansion, a prune address manager module is designed in each PE to record the random pruned memory addresses and maximize the memory address reuse. As shown in Fig. \ref{fig:prune_addr}, the prune address manager records the pruned address pointers during tree prune and issues available address pointer during the new tree branch expansion. The main logic inside the module is a stack buffer to store all the pruned memory address pointers. We use a simple stack buffer instead of a more complex FIFO to manage the dynamic addresses with very small area cost. During the tree pruning, the pruned pointer will be written into the stack. At the same time, this prune address manager can provide pruned pointers for new input voxels to reuse the pruned memory space during tree expansion. Due to this prune address manager, the map memories always maintain a high utilization during the 3D mapping, which also helps to relax the total memory capacity requirement. \section{Overview of OMU\xspace\ Accelerator} \label{methodology} \begin{figure}[!t] \centering \includegraphics[width=0.9\columnwidth]{figures/soc_overview.pdf} \vspace{-5pt} \caption{Overview of the proposed OMU\xspace\ accelerator.} \label{fig:soc_overview} \vspace{-15pt} \end{figure} We developed an accelerator solution OMU\xspace to enable real-time 3D OctoMap at the edge. The architecture overview of OMU\xspace\ is shown in Fig. \ref{fig:soc_overview}. Its key components are the following: \textbf{PE Units:} The most essential modules in the accelerator are the PE elements, which store and update the partitioned 3D map. The PE number is set to be 8 to maximize the OctoMap throughput, but it is also scalable depending on the real-time latency and power consumption requirements. In our design, each PE contains 256~kB memory, which consists of 8 32~kB memory banks. The memory size for each PE is chosen based on the consideration of workload sizes and the accelerator area. \textbf{Voxel Scheduler:} The input voxels for all of the PEs are scheduled using the voxel scheduler. We partition the Octree across the PE units, based on the first-level tree branches. During execution, the voxel scheduler will issue the voxel update task to different PEs based on the voxel coordinates. \textbf{Ray Casting and Voxel Queues:} The accelerator contains a ray casting module, which performs ray casting operations to identify free voxels between origin and points in the point cloud. The free and occupied voxels identified during the ray casting are stored into queues to be scheduled. The latency of the ray casting has been hidden within the map voxel update. This module can also be replaced by the more advanced ray casting accelerator \cite{kar2020raycasting} to reduce the voxel update number. \textbf{Voxel Query:} The accelerator supports a voxel query service, which is a strong requirement for tasks like collision detection in autonomously moving robots. During the voxel query, the probability of the requested voxel is fetched from one PE and sent to the voxel query module. Based on the probability thresholds, the occupancy (i.e., occupied, free, or unknown) of the queried voxel is identified. \textbf{Interconnect:} The accelerator is designed with a standard AXI slave interface. A controller module is developed within the accelerator to contain a few sets of configuration registers. To launch the accelerator operation, the user can program the AXI master host CPU to control accelerator configurations. The host CPU also manages to transfer point cloud data from shared memory or DMA DRAM to the accelerator. \section{Experimental Results} \label{sec:exp} \subsection{Methodology} \label{subsec:exp_dse} We implemented the OMU\xspace\ accelerator using synthesizable SystemC with the aid of hardware components from the open-source MatchLib library \cite{dac2018_hls}. The Verilog RTL is then generated by the Catapult high-level synthesis (HLS) tool. To obtain realistic area and energy results, the RTL of the accelerator is performed using commercial EDA tools based on a commercial 12~nm process. Also, a commercial 12~nm SRAM compiler generates all the SRAM memories. The accelerator is signed off at 0.8~V with 1~GHz frequency. We pushed the design to its maximum frequency to obtain better real-time processing performance. The energy, performance, and area results are reported based on the post-P\&R netlist at the typical corner. The layout view of the accelerator with 8-PE (each containing 256kB SRAM to store mappings) is shown in Fig. \ref{fig:layout_view}. The accelerator consumes 2.5 $mm^{2}$ area. \begin{figure}[!t] \centering \includegraphics[width=0.7\columnwidth]{figures/layout_view.pdf} \vspace{-5pt} \caption{OMU\xspace\ accelerator layout with 8 PEs in 12nm.} \label{fig:layout_view} \vspace{-10pt} \end{figure} \subsection{Performance Evaluation} \label{subsec:exp_cs} We compare the performance of the OMU\xspace\ accelerator with an Intel i9-9940$\times$ desktop CPU and an ARM Cortex-A57 CPU on the Nvidia Jetson TX2 platform. The 3D mappings from the OctoMap 3D scan dataset \cite{octomap_dataset} are used for the evaluations. As shown in Fig. \ref{fig:speedup}, the proposed OMU\xspace\ achieves 12.8$\times$ and 62.4$\times$ latency reduction for the 3D map FR-079 corridor compared to the Intel i9 CPU and the edge Arm A57 CPU. The OMU\xspace accelerator performs 62.4 FPS throughput thanks to the performance improvement, more than 2$\times$ of the real-time application requirement of 30 FPS. \begin{figure}[!b] \vspace{-20pt} \centering \includegraphics[width=1\columnwidth]{figures/speedup.pdf} \vspace{-15pt} \caption{(a) Latency and (b) throughput improvement of the OMU\xspace\ for the 3D map FR-079 corridor.} \label{fig:speedup} \vspace{0pt} \end{figure} Table \ref{tab:latency_table} shows the the improvement across different 3D maps. Table \ref{tab:throughput_table} provides the merits of accelerator throughput. Compared to the 5 FPS throughput in Intel i9 CPU, the edge CPU in TX2 can only achieve 1 FPS. In contrast, our accelerator achieves more than 60 FPS for all 3D maps, significantly improving compared to two baseline CPUs. Therefore, with the proposed acceleration techniques, the OMU\xspace\ accelerator can support 3D mapping applications in real-time systems. Fig. \ref{fig:acc_breakdown} shows the breakdown in the accelerator to illustrate the benefits. The Octree node prune and expand only takes less than 20\% runtime in the OMU\xspace\ operations. Compared to the CPU operations, it is evident that the computation bottleneck, i.e., node prune and expand, has been significantly alleviated. This improvement mainly comes from the latency reduction due to the parallel voxel updates and memory storage. Especially, the parallel voxel fetching for all children nodes significantly improves the node update speed and reduces the costly irregular memory accesses in the CPUs. \begin{figure}[!h] \vspace{-10pt} \centering \includegraphics[width=0.8\columnwidth]{figures/breakdown.pdf} \vspace{-10pt} \caption{Runtime breakdown in i9 CPU and OMU accelerator.} \label{fig:acc_breakdown} \vspace{-10pt} \end{figure} \begin{table}[t!] \centering \caption{Latency performance (s) comparison table.} \vspace{-5pt} \scalebox{0.9}{% \begin{tabular}{|l|l|l|l|} \hline & \textbf{FR-079 corridor} & \textbf{Freiburg campus} & \textbf{New College} \\ \hline Intel i9 CPU & 16.8 & 177.7 & 77.3 \\ \hline Arm A57 CPU & 81.7 &897.2 &401.5 \\ \hline OMU\xspace\ accelerator & 1.31 & 14.4 & 6.5 \\ \hline Speedup over i9 & 12.8$\times$ & 12.3$\times$ & 11.9$\times$ \\ \hline Speedup over A57 & 62.4$\times$ & 62.2$\times$ & 61.7$\times$ \\ \hline \end{tabular} } \label{tab:latency_table} \vspace{-10pt} \end{table}% \begin{table}[t!] \centering \caption{Throughput performance (FPS) comparison table.} \vspace{-5pt} \scalebox{0.9}{% \begin{tabular}{|l|l|l|l|} \hline & \textbf{FR-079 corridor} & \textbf{Freiburg campus} & \textbf{New College} \\ \hline Intel i9 CPU & 5.23 & 5.03 & 5.04 \\ \hline Arm A57 CPU &1.07 &1.0 &0.97 \\ \hline OMU\xspace\ accelerator & 63.66 & 62.05 & 60.87 \\ \hline \end{tabular} } \label{tab:throughput_table} \vspace{-10pt} \end{table}% \begin{table}[t!] \centering \caption{Energy consumption (J) comparison table} \vspace{-5pt} \scalebox{0.9}{% \begin{tabular}{|l|l|l|l|} \hline & \textbf{FR-079 corridor} & \textbf{Freiburg campus} & \textbf{New College} \\ \hline Arm A57 CPU &227.2 &2416.2 &1147.4 \\ \hline OMU\xspace\ accelerator & 0.32 & 3.62 & 1.63 \\ \hline Energy benefit & 708.8$\times$ & 668.1$\times$ & 703.6$\times$ \\ \hline \end{tabular} } \label{tab:energy_table} \vspace{-10pt} \end{table}% \subsection{Power and Energy Evaluation} \label{subsec:exp_cs} We analyze the OMU\xspace\ accelerator power after synthesis, place and route using the same 12~nm technology. At 1GHz, the accelerator consumes 250.8~mW power, in which 91\% power is consumed by SRAM access due to the frequency voxel data access and update. We did not compare the energy consumption of the accelerator with Intel i9 CPU, as the latter is a desktop CPU with a TDP power 165~W. We compare the power and energy with an edge platform (Nvidia Jetson TX2) as it is more representative. During the 3D mapping run on the TX2 platform, the power consumption of Cortex-A57 CPU is recorded, which is between 2.6 and 2.9~Watts. Using the average power, we compare the energy consumption between OMU\xspace\ accelerator and the A57 CPU in the Jetson TX2, as shown in Table \ref{tab:energy_table}. We observe that the proposed OMU\xspace\ achieves notably 668$\times$ to 708$\times$ energy efficiency improvement than A57 CPU. Therefore, the proposed OMU\xspace\ provides an efficient and feasible edge computing solution for real-time 3D perception in autonomous machines. \section{Conclusion} 3D mapping is an essential process in the perception of autonomous machines. In this paper, we introduce a 3D mapping accelerator to support real-time dense and probabilistic OctoMap efficiently. The proposed OMU\xspace\ hardware accelerator is designed with parallel voxel update and storage, efficient data storage structure, and dynamic prune address management. The accelerator is implemented with a commercial 12~nm technology and evaluated with OctoMap 3D scan dataset. Compared to an ARM A57 CPU, the proposed OMU\xspace\ achieves up to 62$\times$ performance improvement and a 63~FPS throughput, enabling 3D mapping in real-time for perception tasks on low-power edge use case deployments. \section*{Acknowledgment} This work is supported in part by JUMP ADA Research Center, DARPA DSSoC program, and the NSF Awards 1718160 and 1955422. \bibliographystyle{IEEEtran} \section{Introduction} This document is a model and instructions for \LaTeX. Please observe the conference page limits. \section{Ease of Use} \subsection{Maintaining the Integrity of the Specifications} The IEEEtran class file is used to format your paper and style the text. All margins, column widths, line spaces, and text fonts are prescribed; please do not alter them. You may note peculiarities. For example, the head margin measures proportionately more than is customary. This measurement and others are deliberate, using specifications that anticipate your paper as one part of the entire proceedings, and not as an independent document. Please do not revise any of the current designations. \section{Prepare Your Paper Before Styling} Before you begin to format your paper, first write and save the content as a separate text file. Complete all content and organizational editing before formatting. Please note sections \ref{AA}--\ref{SCM} below for more information on proofreading, spelling and grammar. Keep your text and graphic files separate until after the text has been formatted and styled. Do not number text heads---{\LaTeX} will do that for you. \subsection{Abbreviations and Acronyms}\label{AA} Define abbreviations and acronyms the first time they are used in the text, even after they have been defined in the abstract. Abbreviations such as IEEE, SI, MKS, CGS, ac, dc, and rms do not have to be defined. Do not use abbreviations in the title or heads unless they are unavoidable. \subsection{Units} \begin{itemize} \item Use either SI (MKS) or CGS as primary units. (SI units are encouraged.) English units may be used as secondary units (in parentheses). An exception would be the use of English units as identifiers in trade, such as ``3.5-inch disk drive''. \item Avoid combining SI and CGS units, such as current in amperes and magnetic field in oersteds. This often leads to confusion because equations do not balance dimensionally. If you must use mixed units, clearly state the units for each quantity that you use in an equation. \item Do not mix complete spellings and abbreviations of units: ``Wb/m\textsuperscript{2}'' or ``webers per square meter'', not ``webers/m\textsuperscript{2}''. Spell out units when they appear in text: ``. . . a few henries'', not ``. . . a few H''. \item Use a zero before decimal points: ``0.25'', not ``.25''. Use ``cm\textsuperscript{3}'', not ``cc''.) \end{itemize} \subsection{Equations} Number equations consecutively. To make your equations more compact, you may use the solidus (~/~), the exp function, or appropriate exponents. Italicize Roman symbols for quantities and variables, but not Greek symbols. Use a long dash rather than a hyphen for a minus sign. Punctuate equations with commas or periods when they are part of a sentence, as in: \begin{equation} a+b=\gamma\label{eq} \end{equation} Be sure that the symbols in your equation have been defined before or immediately following the equation. Use ``\eqref{eq}'', not ``Eq.~\eqref{eq}'' or ``equation \eqref{eq}'', except at the beginning of a sentence: ``Equation \eqref{eq} is . . .'' \subsection{\LaTeX-Specific Advice} Please use ``soft'' (e.g., \verb|\eqref{Eq}|) cross references instead of ``hard'' references (e.g., \verb|(1)|). That will make it possible to combine sections, add equations, or change the order of figures or citations without having to go through the file line by line. Please don't use the \verb|{eqnarray}| equation environment. Use \verb|{align}| or \verb|{IEEEeqnarray}| instead. The \verb|{eqnarray}| environment leaves unsightly spaces around relation symbols. Please note that the \verb|{subequations}| environment in {\LaTeX} will increment the main equation counter even when there are no equation numbers displayed. If you forget that, you might write an article in which the equation numbers skip from (17) to (20), causing the copy editors to wonder if you've discovered a new method of counting. {\BibTeX} does not work by magic. It doesn't get the bibliographic data from thin air but from .bib files. If you use {\BibTeX} to produce a bibliography you must send the .bib files. {\LaTeX} can't read your mind. If you assign the same label to a subsubsection and a table, you might find that Table I has been cross referenced as Table IV-B3. {\LaTeX} does not have precognitive abilities. If you put a \verb|\label| command before the command that updates the counter it's supposed to be using, the label will pick up the last counter to be cross referenced instead. In particular, a \verb|\label| command should not go before the caption of a figure or a table. Do not use \verb|\nonumber| inside the \verb|{array}| environment. It will not stop equation numbers inside \verb|{array}| (there won't be any anyway) and it might stop a wanted equation number in the surrounding equation. \subsection{Some Common Mistakes}\label{SCM} \begin{itemize} \item The word ``data'' is plural, not singular. \item The subscript for the permeability of vacuum $\mu_{0}$, and other common scientific constants, is zero with subscript formatting, not a lowercase letter ``o''. \item In American English, commas, semicolons, periods, question and exclamation marks are located within quotation marks only when a complete thought or name is cited, such as a title or full quotation. When quotation marks are used, instead of a bold or italic typeface, to highlight a word or phrase, punctuation should appear outside of the quotation marks. A parenthetical phrase or statement at the end of a sentence is punctuated outside of the closing parenthesis (like this). (A parenthetical sentence is punctuated within the parentheses.) \item A graph within a graph is an ``inset'', not an ``insert''. The word alternatively is preferred to the word ``alternately'' (unless you really mean something that alternates). \item Do not use the word ``essentially'' to mean ``approximately'' or ``effectively''. \item In your paper title, if the words ``that uses'' can accurately replace the word ``using'', capitalize the ``u''; if not, keep using lower-cased. \item Be aware of the different meanings of the homophones ``affect'' and ``effect'', ``complement'' and ``compliment'', ``discreet'' and ``discrete'', ``principal'' and ``principle''. \item Do not confuse ``imply'' and ``infer''. \item The prefix ``non'' is not a word; it should be joined to the word it modifies, usually without a hyphen. \item There is no period after the ``et'' in the Latin abbreviation ``et al.''. \item The abbreviation ``i.e.'' means ``that is'', and the abbreviation ``e.g.'' means ``for example''. \end{itemize} An excellent style manual for science writers is \cite{b7}. \subsection{Authors and Affiliations} \textbf{The class file is designed for, but not limited to, six authors.} A minimum of one author is required for all conference articles. Author names should be listed starting from left to right and then moving down to the next line. This is the author sequence that will be used in future citations and by indexing services. Names should not be listed in columns nor group by affiliation. Please keep your affiliations as succinct as possible (for example, do not differentiate among departments of the same organization). \subsection{Identify the Headings} Headings, or heads, are organizational devices that guide the reader through your paper. There are two types: component heads and text heads. Component heads identify the different components of your paper and are not topically subordinate to each other. Examples include Acknowledgments and References and, for these, the correct style to use is ``Heading 5''. Use ``figure caption'' for your Figure captions, and ``table head'' for your table title. Run-in heads, such as ``Abstract'', will require you to apply a style (in this case, italic) in addition to the style provided by the drop down menu to differentiate the head from the text. Text heads organize the topics on a relational, hierarchical basis. For example, the paper title is the primary text head because all subsequent material relates and elaborates on this one topic. If there are two or more sub-topics, the next level head (uppercase Roman numerals) should be used and, conversely, if there are not at least two sub-topics, then no subheads should be introduced. \subsection{Figures and Tables} \paragraph{Positioning Figures and Tables} Place figures and tables at the top and bottom of columns. Avoid placing them in the middle of columns. Large figures and tables may span across both columns. Figure captions should be below the figures; table heads should appear above the tables. Insert figures and tables after they are cited in the text. Use the abbreviation ``Fig.~\ref{fig}'', even at the beginning of a sentence. \begin{table}[htbp] \caption{Table Type Styles} \begin{center} \begin{tabular}{|c|c|c|c|} \hline \textbf{Table}&\multicolumn{3}{|c|}{\textbf{Table Column Head}} \\ \cline{2-4} \textbf{Head} & \textbf{\textit{Table column subhead}}& \textbf{\textit{Subhead}}& \textbf{\textit{Subhead}} \\ \hline copy& More table copy$^{\mathrm{a}}$& & \\ \hline \multicolumn{4}{l}{$^{\mathrm{a}}$Sample of a Table footnote.} \end{tabular} \label{tab1} \end{center} \end{table} \begin{figure}[htbp] \centerline{\includegraphics{fig1.png}} \caption{Example of a figure caption.} \label{fig} \end{figure} Figure Labels: Use 8 point Times New Roman for Figure labels. Use words rather than symbols or abbreviations when writing Figure axis labels to avoid confusing the reader. As an example, write the quantity ``Magnetization'', or ``Magnetization, M'', not just ``M''. If including units in the label, present them within parentheses. Do not label axes only with units. In the example, write ``Magnetization (A/m)'' or ``Magnetization \{A[m(1)]\}'', not just ``A/m''. Do not label axes with a ratio of quantities and units. For example, write ``Temperature (K)'', not ``Temperature/K''. \section*{Acknowledgment} The preferred spelling of the word ``acknowledgment'' in America is without an ``e'' after the ``g''. Avoid the stilted expression ``one of us (R. B. G.) thanks $\ldots$''. Instead, try ``R. B. G. thanks$\ldots$''. Put sponsor acknowledgments in the unnumbered footnote on the first page. \section*{References} Please number citations consecutively within brackets \cite{b1}. The sentence punctuation follows the bracket \cite{b2}. Refer simply to the reference number, as in \cite{b3}---do not use ``Ref. \cite{b3}'' or ``reference \cite{b3}'' except at the beginning of a sentence: ``Reference \cite{b3} was the first $\ldots$'' Number footnotes separately in superscripts. Place the actual footnote at the bottom of the column in which it was cited. Do not put footnotes in the abstract or reference list. Use letters for table footnotes. Unless there are six authors or more give all authors' names; do not use ``et al.''. Papers that have not been published, even if they have been submitted for publication, should be cited as ``unpublished'' \cite{b4}. Papers that have been accepted for publication should be cited as ``in press'' \cite{b5}. Capitalize only the first word in a paper title, except for proper nouns and element symbols. For papers published in translation journals, please give the English citation first, followed by the original foreign-language citation \cite{b6}.
\section{Introduction} The uncertainty principle rules out the possibility to obtain precise measurement outcomes simultaneously when one measures two incomparable observables at the same time. Since the uncertainty relation satisfied by the position and momentum \cite{Heisenberg1927}, various uncertainty relations have been extensively investigated \cite{Dammeier2015njp,Li2015,Guise2018pra,Giorda2019pra,Xiao2019pra,Sponar2020pra}. On the occasion of celebrating the 125th anniversary of the academic journal "Science", the magazine listed 125 challenging scientific problems \cite{Seife2005}. The 21st problem asks: Do deeper principles underlie quantum uncertainty and nonlocality? As uncertainty relations play significant roles in entanglement detection \cite{Hofman2003pra,Guhne2004prl,Guhne2009pra,Schwonnek2017prl,Qian2018qip,Zhao2019prl} and quantum nonlocality \cite{Oppenheim2010}, and many others, it is desirable to explore the mathematical structures and physical implications of uncertainties in more details from various perspectives. The state-dependent Robertson-Schr\"{o}dinger uncertainty relation \cite{Kennard1927,Weyl1928,Robertson1929,Schrodinger1930} is of form: \begin{eqnarray*} (\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})^2(\Delta_\rho\bsB)^2\geqslant\frac14\Br{ (\langle\set{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}\rangle_\rho - \langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\rho\langle\bsB\rangle_\rho)^2+\langle[\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB]\rangle_\rho^2}, \end{eqnarray*} where $\set{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}:=\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\bsB+\bsB\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, $[\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB]:=\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\bsB-\bsB\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, and $(\Delta_\rho\bsX)^2:=\Tr{\bsX^2\rho}-\Tr{\bsX\rho}^2$ is the variance of $\bsX$ with respect to the state $\rho$, $\bsX=\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB$. Recently, state-independent uncertainty relations have been investigated \cite{Guhne2004prl,Schwonnek2017prl}, which have direct applications to entanglement detection. In order to get state-independent uncertainty relations, one considers the sum of the variances and solves the following optimization problems: \begin{eqnarray} \var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+\var_\rho(\bsB)&\geqslant& \min_{\rho\in\rD(\mC^d)}\Pa{\var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+\var_\rho(\bsB)},\label{eq:1}\\ \Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\Delta_\rho\bsB&\geqslant& \min_{\rho\in\rD(\mC^d)}\Pa{\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\Delta_\rho\bsB},\label{eq:2} \end{eqnarray} where $\var_\rho(\bsX)=(\Delta_\rho\bsX)^2$ is the variance of the observable $\bsX$ associated to state $\rho\in\rD(\mC^d)$. Efforts have been devoted to provide quantitative uncertainty bounds for the above inequalities \cite{Busch2019}. However, searching for such uncertainty bounds may be not the best way to get new uncertainty relations \cite{Zhang2018}. Recently, Busch and Reardon-Smitha proposed to consider the \emph{uncertainty region} \cite{Busch2019} of two observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ and $\bsB$, instead of finding the bounds based on some particular choice of uncertainty functional, typically such as the product or sum of uncertainties \cite{Maccone2014}. Once we can identify what the structures of uncertainty regions are, we can infer specific information about the state with the minimal uncertainty in some sense. In view of this, the above two optimization problems \eqref{eq:1} and \eqref{eq:2} become \begin{eqnarray*} \min_{\rho\in\rD(\mC^d)}\Pa{\var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+\var_\rho(\bsB)} &=& \min\Set{x^2+y^2:(x,y)\in\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}},\\ \min_{\rho\in\rD(\mC^d)}\Pa{\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\Delta_\rho\bsB} &=& \min\Set{x+y:(x,y)\in\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}}, \end{eqnarray*} where $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}$ is the so-called uncertainty region of two observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ and $\bsB$ defined by \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB} = \Set{(\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta_\rho\bsB)\in\mR^2_+: \rho\in\rD(\mC^d)}. \end{eqnarray*} Random matrix theory or probability theory are powerful tools in quantum information theory. Recently, the non-additivity of quantum channel capacity \cite{Hastings2009} has been cracked via probabilistic tools. The Duistermaat-Heckman measure on moment polytope has been used to derive the probability distribution density of one-body quantum marginal states of multipartite random quantum states \cite{Christandl2014,Dartois2020} and that of classical probability mixture of random quantum states \cite{Zhang2018pla,Zhang2019jpa}. As a function of random quantum pure states, the probability density function (PDF) of quantum expectation value of an observable is also analytical calculated \cite{Venuti2013}. Motivated by these works, we investigate the joint probability density functions of uncertainties of observables. By doing so, we find that it is not necessarily to solve directly the uncertainty regions of observables. It is sufficient to identify the support of such PDF because PDF vanishes exactly beyond the uncertainty regions. Thus all the problems are reduced to compute the PDF of uncertainties of observables, since all information concerning uncertainty regions and state-independent uncertainty relations are encoded in such PDFs. In \cite{Zhang2021preprint} we have studied such PDFs for the random mixed quantum state ensembles, where all problems concerning qubit observables are completely solved, i.e., analytical formulae of the PDFs of uncertainties are obtained, and the characterization of uncertainty regions over which the optimization problems for state-independent lower bound of sum of variances is presented. In this paper, we will focus the same problem for random pure quantum state ensembles. Let $\delta(x)$ be delta function \cite{Hoskins2009} defined by \begin{eqnarray*} \delta(x)=\begin{cases} +\infty,&\text{if }x\neq0;\\0,&\text{if }x=0.\end{cases} \end{eqnarray*} One has $\Inner{\delta}{f}:=\int_\mathbb{R} f(x)\delta(x)\mathrm{d} x=f(0)$. Denote by $\delta_a(x):=\delta(x-a)$. Then $\Inner{\delta_a}{f} = f(a)$. Let $Z(g):=\Set{x\in D(g):g(x)=0}$ be the zero set of function $g(x)$ with its domain $D(g)$. We will use the following definition. \begin{definition}[\cite{lz2020ijtp,Zuber2020}] If $g:\mathbb{R}\to\mathbb{R}$ is a smooth function (the first derivative $g'$ is a continuous function) such that $Z(g)\cap Z(g')=\emptyset$, then the composite $\delta\circ g$ is defined by: \begin{eqnarray*} \delta(g(x)) = \sum_{x\in Z(g)} \frac1{\abs{g'(x)}}\delta_x. \end{eqnarray*} \end{definition} \section{Uncertainty regions of observables} We can extend the notion of the uncertainty region of two observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ and $\bsB$, put forward in \cite{Busch2019}, into that of multiple observables. \begin{definition} Let $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)$ be an $n$-tuple of qudit observables acting on $\mC^d$. The \emph{uncertainty region} of such $n$-tuple $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)$, for the mixed quantum state ensemble, is defined by \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}:=\Set{(\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)\in\mR^n_+:\rho\in\rD(\mC^d)}. \end{eqnarray*} Similarly, the \emph{uncertainty region} of such $n$-tuple $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)$, for the pure quantum state ensemble, is defined by \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}:=\Set{(\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)\in\mR^n_+:\ket{\psi}\in\mC^d}. \end{eqnarray*} Apparently, $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}\subset\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$. \end{definition} Note that our definition about uncertainty region is different from the one given in \cite{Dammeier2015njp}. In the above definition, we use the standard deviation instead of variance. Next we will show that $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$ is contained in the supercube in $\mR^n_+$. To this end, we study the following sets $\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\Set{\text{Var}_\psi(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}): \ket{\psi}\in\mC^d}$ and $\sM(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\Set{\text{Var}_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}): \rho\in\density{\mC^d}}$ for a qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ acting on $\mC^d$. The relationship between both sets $\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ and $\sM(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ is summarized into the following proposition. \begin{prop}\label{prop:convx} It holds that \begin{eqnarray*} \mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\sM(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\mathrm{conv}(\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})) \end{eqnarray*} is a closed interval $[0,\max_\psi\mathrm{Var}_\psi(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})]$. \end{prop} \begin{proof} Note that $\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\subset\sM(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\subset\mathrm{conv}(\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))$. Here the first inclusion is apparently; the second inclusion follows immediately from the result obtained in \cite{Petz2012}: For any density matrix $\rho\in\density{\mC^d}$ and a qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, there is a pure state ensemble decomposition $\rho=\sum_j p_j\proj{\psi_j}$ such that \begin{eqnarray}\label{eq:vardecom} \text{Var}_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) = \sum_j p_j\text{Var}_{\psi_j}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}). \end{eqnarray} Since all pure states on $\mC^d$ can be generated via a fixed $\psi_0$ and the whole unitary group $\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)$, it follows that \begin{eqnarray*} \mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) = \mathrm{im}(\Phi), \end{eqnarray*} where the mapping $\Phi:\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)\to \mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ is defined by $\Phi(\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y})=\mathrm{Var}_{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}\psi_0}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. This mapping $\Phi$ is surjective and continuous. Due to the fact that $\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)$ is a compact Lie group, we see that $\Phi$ can attain maximal and minimal values over the unitary group $\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)$. In fact, $\min_{\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)}\Phi=0$. This can be seen if we take some $\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}$ such that $\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}\ket{\psi_0}$ is an eigenvector of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$. Since $\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)$ is also connected, then $\mathrm{im}(\Phi)=\Phi(\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d))$ is also connected, thus $\mathrm{im}(\Phi)=[0,\max_{\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)}\Phi]$. This amounts to say that $\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ is a closed interval $[0,\max_{\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)}\Phi]$ which means that $\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ is a compact and convex set, i.e., \begin{eqnarray*} \mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) =\mathrm{conv}(\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})). \end{eqnarray*} Therefore \begin{eqnarray*} \mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) =\sM(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\mathrm{conv}(\mathscr{P}}\def\sQ{\mathscr{Q}}\def\sR{\mathscr{R}}\def\sS{\mathscr{S}}\def\sT{\mathscr{T}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))=[0,\max_{\textsf{U}}\def\V{\textsf{V}}\def\W{\textsf{W}}\def\X{\textsf{X}}\def\Y{\textsf{Y}(d)}\Phi]=[0,\max_{\psi}\mathrm{Var}_\psi(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})]. \end{eqnarray*} This completes the proof. \end{proof} Next, we determine $\max_{\rho\in\density{\mathbb{C}^d}}\var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ for an observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$. To this end, we recall the following $(d-1)$-dimensional probability simplex, which is defined by \begin{eqnarray*} \Delta_{d-1}:=\Set{\boldsymbol{p}}\def\bsq{\boldsymbol{q}}\def\bsr{\boldsymbol{r}}\def\bss{\boldsymbol{s}}\def\bst{\boldsymbol{t}=(p_1,\ldots,p_d)\in\mathbb{R}^d:p_k\geqslant0(\forall k\in[d]),\sum_jp_j=1}. \end{eqnarray*} Its interior of $\Delta_{d-1}$ is denoted by $\Delta^\circ_{d-1}$: \begin{eqnarray*} \Delta^\circ_{d-1}:=\Set{\boldsymbol{p}}\def\bsq{\boldsymbol{q}}\def\bsr{\boldsymbol{r}}\def\bss{\boldsymbol{s}}\def\bst{\boldsymbol{t}=(p_1,\ldots,p_d)\in\mathbb{R}^d:p_k>0(\forall k\in[d]),\sum_jp_j=1}. \end{eqnarray*} This indicates that a point $\bsx$ in the boundary $\partial\Delta_{d-1}$ means that there must be at least a component $x_i=0$ for some $i\in[d]$. Now we separate the boundary of $\partial\Delta_{d-1}$ into the union of the following subsets: \begin{eqnarray*} \partial\Delta_{d-1} =\bigcup^{d}_{j=1} F_j, \end{eqnarray*} where $F_j:=\Set{\bsx\in\partial\Delta_{d-1}: x_j=0}$. Although the following result is known in 1935 \cite{Bhatia2000}, we still include our proof for completeness. \begin{prop}\label{prop:varmax} Assume that $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ is an observable acting on $\mathbb{C}^d$. Denote the vector consisting of eigenvalues of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ by $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ with components being $\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\leqslant\cdots\leqslant \lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. It holds that \begin{eqnarray*} \max\Set{\var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}):\rho\in\density{\mathbb{C}^d}} =\frac14\Pa{\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}^2. \end{eqnarray*} Here $\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ and $\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. \end{prop} \begin{proof} Assume that $\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}:=\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$ where $a_j:=\lambda_j(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. Note that $\var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\Tr{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rho}-\Tr{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rho}^2=\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}^2}{\bsD_{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}}\lambda(\rho)}-\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsD_{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}}\lambda(\rho)}^2$, where $\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}=(a_1,\ldots,a_d)^\t, \boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}^2=(a^2_1,\ldots,a^2_d)^\t$, and $\bsD_{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}}=\overline{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}}\circ\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}$ (here $\circ$ stands for Schur product, i.e., entrywise product), and $\lambda(\rho)=(\lambda_1(\rho),\ldots,\lambda_d(\rho))^\t$. Denote \begin{eqnarray*} \bsx:=\bsD_{\boldsymbol{U}}\def\bsV{\boldsymbol{V}}\def\bsW{\boldsymbol{W}}\def\bsX{\boldsymbol{X}}\def\bsY{\boldsymbol{Y}}\lambda(\rho)\in\Delta_{d-1}:=\Set{\boldsymbol{p}}\def\bsq{\boldsymbol{q}}\def\bsr{\boldsymbol{r}}\def\bss{\boldsymbol{s}}\def\bst{\boldsymbol{t}=(p_1,\ldots,p_d)\in\mathbb{R}^d_+:\sum_jp_j=1}, \end{eqnarray*} the $(d-1)$-dimensional probability simplex. Then \begin{eqnarray*} \var_\rho(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}^2}{\bsx}-\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsx}^2=\sum^d_{j=1}a^2_jx_j - \Pa{\sum^d_{j=1}a_jx_j}^2=:f(\bsx). \end{eqnarray*} (i) If $d=2$, \begin{eqnarray*} f(x_1,x_2)&=&a_1^2x_1+a_2^2x_2-(a_1x_1+a_2x_2)^2\notag\\ &=&a_1^2x_1+a_2^2(1-x_1)-(a_1x_1+a_2(1-x_2))^2\notag\\ &=&(a_2-a_1)^2\Br{\frac14-\Pa{x_1-\frac12}^2}\leqslant \frac14(a_2-a_1)^2, \end{eqnarray*} implying that $f_{\max}=\frac14(a_2-a_1)^2$ when $x_1=x_2=\frac12$. (ii) If $d\geqslant3$, without loss of generality, we assume that $a_1< a_2<\cdots<a_d$, we will show that the function $f$ takes its maximal value on the point $(x_1,x_2,\ldots,x_{d-1},x_d)=(\tfrac12,0,\ldots,0,\tfrac12)$, with the maximal value being $\frac14(a_d-a_1)^2=\frac14\Pa{\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}^2$. Then, using Lagrangian multiplier method, we let \begin{eqnarray*} L(x_1,x_2,\cdots,x_d,\lambda)=\sum_{i=1}^d a_i^2x_i-\Pa{\sum_{i=1}^d a_ix_i}^2+\lambda\Pa{\sum_{i=1}^d x_i-1}. \end{eqnarray*} Thus \begin{eqnarray} \frac{\partial L}{\partial x_i}&=&a_i^2-2 a_i\Pa{\sum_{i=1}^d a_ix_i}+\lambda=0\quad(i=1,\ldots,d),\label{L-criticalpoints} \\ \frac{\partial L}{\partial \lambda}&=&\sum_{i=1}^d x_i-1=0.\notag \end{eqnarray} Denote $m:=\sum_{i=1}^d a_ix_i$. Because \eqref{L-criticalpoints} holds for all $i=1,\ldots,d$, we see that \begin{eqnarray*} \lambda=-a_i^2+2a_im=-a_j^2+2a_jm, \end{eqnarray*} that is, $m=\frac{a_i+a_j}2$ and $\lambda=a_ia_j$ for all distinct indices $i$ and $j$. Furthermore, for all distinct indices $i$ and $j$, the system of equations $\sum_{i=1}^d a_ix_i=m=\frac{a_i+a_j}2$ have no solution on $\Delta_{d-1}$. Hence there is no stationary point on $\Delta_{d-1}$, and thus $f_{\max}$ is obtained on the boundary $\partial\Delta_{d-1}$ of $\Delta_{d-1}$. Suppose, by induction, that the conclusion holds for the case where $d=k\geqslant2$, i.e., the function $f$ takes its maximal value $f_{\max}=\frac14(a_k-a_1)^2$ on the point $(x_1,x_2,\ldots,x_{k-1},x_k)=(\tfrac12,0,\ldots,0,\tfrac12)\in\partial\Delta_{k-1}$. Next we consider the case where $d=k+1$, i.e., the extremal value of $f(x_1,\ldots,x_{k+1})$ on $\partial\Delta_k$. If $\bsx\in F_j\subset\Delta_k$, where $j\in\set{2,\ldots,k}$, then $f_{k+1}(x_1,x_2,\cdots,x_{k+1}) =f_k(y_1,y_2,\cdots,y_{k})=\sum_{i=1}^{k} b_i^2y_i-(\sum_{i=1}^{k} b_iy_i)^2,$ where $b_1=a_1,\cdots, b_{i-1}=a_{i-1}, b_i=a_{i+1}, \cdots,b_k=a_{k+1},$ it is obvious that $b_1<b_2<\cdots<b_k$. By the previous assumption, we have \begin{eqnarray*} f_{\max}=\frac14(b_k-b_1)^2=\frac14(a_{k+1}-a_1)^2, \end{eqnarray*} and the maximal value is attained at $(x_1,x_2,\ldots,x_{k},x_{k+1})=(\tfrac12,0,\ldots,0,\tfrac12)$; similarly $f_{\max}=\frac14(a_{k+1}-a_2)^2$ is attained on $F_1$; $f_{\max}=\frac14(a_k-a_1)^2$ is attained on $F_{k+1}$. By comparing these extremal values, we know that \begin{eqnarray*} f_{\max}=\frac14(a_{k+1}-a_1)^2 \end{eqnarray*} is attained on $\partial\Delta_k$ and the maximal value is attained at $(x_1,x_2,\ldots,x_{k},x_{k+1})=(\tfrac12,0,\ldots,0,\tfrac12)$. \end{proof} \begin{remark} By using spectral decomposition theorem to $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, we get that $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=\sum^d_{j=1} a_j\proj{a_j}$. Denote $\ket{\psi}=\frac{\ket{a_1}+\ket{a_d}}{\sqrt{2}}$. Then we see that \begin{eqnarray*} \var_\psi(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) = \Tr{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\proj{\psi}} - \Tr{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\proj{\psi}}^2 = \frac14(\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))^2. \end{eqnarray*} \end{remark} \begin{prop} Let $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)$ be an $n$-tuple of qudit observables acting on $\mC^d$. Denote $v(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k):=\frac12(\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k)-\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k))$, where $k=1,\ldots,n$ and $\lambda_{\max/\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k)$ stands for the maximal/minimal eigenvalue of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$. Then \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\mathrm{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}\subset \Br{0,v(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1)}\times\cdots\times \Br{0,v(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n)}. \end{eqnarray*} \end{prop} \begin{proof} The proof is easily obtained by combining Proposition~\ref{prop:convx} and Proposition~\ref{prop:varmax}. \end{proof} \section{PDFs of expectation values and uncertainties of qubit observables}\label{app:A} Assume $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ is a non-degenerate positive matrix with eigenvalues $\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})<\cdots<\lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. Denote by $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}),\ldots,\lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))$. In view of the speciality of pure state ensemble and noting Propositions~\ref{prop:convx} and \ref{prop:varmax}, we will consider only the variances of observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ over pure states. In fact, the same problem is also considered very recently for mixed state \cite{Zhang2021preprint}. Then the probability density function of $\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi:=\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi}$ is defined by \begin{eqnarray*} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r) :=\int\delta(r-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)\mathrm{d}\mu(\psi). \end{eqnarray*} Here $\mathrm{d}\mu(\psi)$ is the so-called uniform probability measure, which is invariant under the unitary rotations, can be realized by the following way: \begin{eqnarray*} \mathrm{d}\mu(\psi) = \frac{\Gamma(d)}{2\pi^d}\delta(1-\norm{\psi})[\mathrm{d}\psi], \end{eqnarray*} where $[\mathrm{d}\psi]=\prod^d_{k=1}\mathrm{d} x_k\mathrm{d} y_k$ for $\psi_k=x_k+\mathrm{i}y_k(k=1,\ldots,d)$, and $\Gamma(\cdot)$ is the Gamma function. Thus \begin{eqnarray*} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r) =\Gamma(d)\int_{\mathbb{R}^d_+}\delta\Pa{r-\sum^d_{i=1}\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})r_i}\delta\Pa{1-\sum^d_{i=1}r_i}\prod^d_{i=1}\mathrm{d} r_i. \end{eqnarray*} For completeness, we will give a different proof of it although the following result is already obtained in \cite{Venuti2013}: \begin{prop}\label{prop:expectn} For a given quantum observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ with simple spectrum $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}),\ldots,\lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))$, where $ \lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})<\cdots<\lambda_d(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$, the probability density function of $\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi$, where $\ket{\psi}$ a Haar-distributed random pure state on $\mathbb{C}^d$, is given by the following: \begin{eqnarray}\label{eq:qubitexp} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)=(-1)^{d-1}(d-1)\sum^d_{i=1}\frac{(r-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))^{d-2}}{\prod_{j\in\hat i}(\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_j(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))}H(r-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})), \end{eqnarray} where $\hat i:=\set{1,2,\ldots,d}\backslash\set{i}$ and $H$ is the so-called Heaviside function, defined by $H(t)=1$ if $t>0$, $0$ otherwise. Thus the support of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)$ is the closed interval $[\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}),\lambda_n(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})]$. In particular, for $d=2$, we have \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)=\frac1{\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}(H(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))-H(r-\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))). \end{eqnarray*} \end{prop} \begin{proof} By performing Laplace transformation $(r\to s)$ of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)$, we get that \begin{eqnarray*} \sL(f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle})(s) = \Gamma(d)\int \exp\Pa{-s\sum^d_{i=1}\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})r_i}\delta\Pa{1-\sum^d_{i=1}r_i}\prod^d_{i=1}\mathrm{d} r_i. \end{eqnarray*} Let $$ F_s(t) :=\Gamma(d)\int \exp\Pa{-s\sum^d_{i=1}\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})r_i}\delta\Pa{t-\sum^d_{i=1}r_i}\prod^d_{i=1}\mathrm{d} r_i. $$ Still by performing Laplace transformation $(t\to x)$ of $F_s(t)$: \begin{eqnarray*} \sL(F_s)(x) &=&\Gamma(d)\int \exp\Pa{-s\sum^d_{i=1}\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})r_i}\exp\Pa{-x\sum^d_{i=1}r_i}\prod^d_{i=1}\mathrm{d} r_i\\ &=&\Gamma(d)\prod^d_{i=1}\int^\infty_0 \exp\Pa{-(s\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+x)r_i}\mathrm{d} r_i\\ &=&\frac{\Gamma(d)}{\prod^d_{i=1}(s\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+x)}, \end{eqnarray*} implying that \cite{zhang2018qip} \begin{eqnarray*} F_s(t) = \Gamma(d)\sum^d_{i=1}\frac{\exp\Pa{-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})st}}{(-s)^{d-1}\prod_{j\in\hat i}(\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_j(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))}, \end{eqnarray*} where $\hat i:=\Set{1,\ldots,d}\backslash\set{i}$. Thus \begin{eqnarray*} \sL(f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle})(s)=F_s(1) = \Gamma(d)\sum^d_{i=1}\frac{\exp\Pa{-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})s}}{(-s)^{d-1}\prod_{j\in\hat i}(\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_j(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))}. \end{eqnarray*} Therefore, we get that \begin{eqnarray*} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r) =(-1)^{d-1}(d-1)\sum^d_{i=1}\frac{H(r-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(r-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))^{d-2}}{\prod_{j\in\hat i}(\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_j(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))}, \end{eqnarray*} where $H(r-\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))$ is the so-called Heaviside function, defined by $H(t)=1$ if $t>0$; otherwise $0$. The support of this pdf is the closed interval $[l,u]$ where $$ l=\min\Set{\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}):i=1,\ldots,d},\quad u=\max\Set{\lambda_i(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}):i=1,\ldots,d}. $$ The normalization of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)$ (i.e., $\int_\mathbb{R} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)\mathrm{d} r=1$) can be checked by assuming $\lambda_1<\lambda_2<\cdots<\lambda_d$, then $[l,u]=[\lambda_1,\lambda_n]$ since $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)$ is a symmetric of $\lambda_i$'s. \end{proof} \subsection{The case for one qubit observable} Let us now turn to the qubit observables. Any qubit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, which may be parameterized as \begin{equation}\label{AA} \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=a_0\mathbb{1}+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma},\quad (a_0,\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})\in\mathbb{R}^4, \end{equation} where $\mathbb{1}$ is the identity matrix on the qubit Hilbert space $\mathbb{C}^2$, and $\boldsymbol{\sigma}=(\sigma_1,\sigma_2,\sigma_3)$ are the vector of the standard Pauli matrices: \begin{eqnarray*} \sigma_1=\Pa{\begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array} },\quad \sigma_2=\Pa{\begin{array}{cc} 0 & -\mathrm{i} \\ \mathrm{i} & 0 \end{array} },\quad \sigma_3=\Pa{\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array} }. \end{eqnarray*} Without loss of generality, we assume that our qubit observables are of simple eigenvalues, otherwise the problem is trivial. Thus the two eigenvalues of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ are \begin{eqnarray*} \lambda_k(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=a_0+(-1)^ka, \qquad k=1,2, \end{eqnarray*} with $a:=\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}=\sqrt{a_1^2+a_2^2+a_3^2}>0$ being the length of vector $\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e} =(a_1,a_2,a_3)\in \mathbb{R}^3$. Thus \eqref{eq:qubitexp} becomes \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r) = \frac1{\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}[H(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))-H(r-\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))]. \end{eqnarray*} \begin{thrm}\label{th:vardis} For the qubit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ defined by Eq.~\eqref{AA}, the probability density function of $\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, where $\psi$ is a Haar-distributed random pure state on $\mathbb{C}^2$, is given by \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) = \frac x{\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\sqrt{\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}^2-x^2}},\qquad x\in[0,\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}). \end{eqnarray*} \end{thrm} \begin{proof} Note that \begin{eqnarray}\label{eq:2nddelta} \delta(r^2-r^2_0)=\frac1{2\abs{r_0}}\Br{\delta(r-r_0)+\delta(r+r_0)}. \end{eqnarray} For $x\geqslant0$, because \begin{eqnarray*} \delta(x^2-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2) = \frac1{2x}\Br{\delta(x+\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}=\frac1{2x}\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}), \end{eqnarray*} we see that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) = \int\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\mathrm{d}\mu(\psi) = 2x\int\delta\Pa{x^2-\Delta^2_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}\mathrm{d}\mu(\psi). \end{eqnarray*} For any complex $2\times 2$ matrix $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2=\Tr{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}-\det(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\mathbb{1}$. Then $\Delta^2_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)$ \begin{eqnarray*} \delta\Pa{x^2-\Delta^2_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}} &=& \delta\Pa{x^2-(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)}. \end{eqnarray*} In particular, we see that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) &=& 2x\int^{\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}_{\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})} \mathrm{d} r\delta\Pa{x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r)}\int_{\mathbb{C}^2}\delta(r-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)\mathrm{d}\mu(\psi)\notag\\ &=& 2x\int^{\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})}_{\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})} \mathrm{d} rf^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r)\delta\Pa{x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r)}. \end{eqnarray*} Denote $f_x(r)=x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r)$. Thus $\partial_rf_x(r)=2r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. Then $f_x(r)=0$ has two distinct roots in $[\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}),\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})]$ if and only if $x\in\left[0,\frac{V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))}2\right)$, where $V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))=\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$. Now the roots are given by \begin{eqnarray*} r_\pm(x)=\frac{\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})+\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\pm\sqrt{V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))^2-4x^2}}2. \end{eqnarray*} Thus \begin{eqnarray*} \delta\Pa{f_x(r)}=\frac1{\abs{\partial_{r=r_+(x)} f_x(r)}}\delta_{r_+(x)}+\frac1{\abs{\partial_{r=r_-(x)} f_x(r)}}\delta_{r_-(x)}, \end{eqnarray*} implying that \begin{eqnarray*} f^{(2)}_{\Delta \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) = \frac{4x}{V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))\sqrt{V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))^2-4x^2}}. \end{eqnarray*} Now for $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=a_0\mathbb{1}+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}$, we have $V_2(\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))=2\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$. Substituting this into the above expression, we get the desired result: \begin{eqnarray*} f^{(2)}_{\Delta \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) = \frac x{\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\sqrt{\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}^2-x^2}}, \end{eqnarray*} where $x\in[0,\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}})$. This is the desired result. \end{proof} \subsection{The case for two qubit observables} Let $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=a_0+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}$ and $\bsB=b_0+\bsb\cdot\boldsymbol{\sigma}$ \begin{eqnarray*} && f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s) = \int\delta(r-\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi})\delta(s-\Innerm{\psi}{\bsB}{\psi})\mathrm{d}\mu(\psi)\\ &&=\frac1{(2\pi)^2}\int_{\mathbb{R}^2}\mathrm{d}\alpha\mathrm{d}\beta \exp\Pa{\mathrm{i}(r\alpha+s\beta)}\int \exp\Pa{-\mathrm{i}\Innerm{\psi}{\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB}{\psi}}\mathrm{d}\mu(\psi), \end{eqnarray*} where \begin{eqnarray*} &&\int \exp\Pa{-\mathrm{i}\Innerm{\psi}{\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB}{\psi}}\mathrm{d}\mu(\psi) = \int^{\lambda_+(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB)}_{\lambda_-(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB)} \exp\Pa{-\mathrm{i}t}f_2(t)\mathrm{d} t\\ &&=\frac1{2\abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}}\int^{\lambda_+(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB)}_{\lambda_-(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB)} \exp\Pa{-\mathrm{i}t}\mathrm{d} t=\exp\Pa{-\mathrm{i}(a_0\alpha+b_0\beta)}\frac{\sin\abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}}{\abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}}, \end{eqnarray*} for $$ \lambda_\pm(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB)=\alpha a_0+\beta b_0 \pm \abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}. $$ Now that \begin{eqnarray*} f^{(2)}_{\langle\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB\rangle}(r) =\frac1{\lambda_2-\lambda_1}(H(r-\lambda_1)-H(r-\lambda_2)), \end{eqnarray*} therefore \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)=\frac1{(2\pi)^2}\int_{\mathbb{R}^2}\mathrm{d}\alpha\mathrm{d}\beta \exp\Pa{\mathrm{i}((r-a_0)\alpha+(s-b_0)\beta)}\frac{\sin\abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}}{\abs{\alpha\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\beta\bsb}}. \end{eqnarray*} (i) If $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is linearly independent, then the following matrix $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is invertible, and thus \begin{eqnarray*} \Pa{\begin{array}{c} \tilde\alpha \\ \tilde\beta \end{array} } = \bsT^{\frac12}_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}\Pa{\begin{array}{c} \alpha \\ \beta \end{array} },\quad\text{where }\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb} = \Pa{\begin{array}{cc} \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb} \\ \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb} & \Inner{\bsb}{\bsb} \end{array} }. \end{eqnarray*} Thus we see that \begin{eqnarray*} &&f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)=\frac1{(2\pi)^2\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})}}\int_{\mathbb{R}^2}\mathrm{d}\tilde\alpha\mathrm{d}\tilde\beta \exp\Pa{\mathrm{i}((\tilde r-\tilde a_0)\alpha+(\tilde s-\tilde b_0)\tilde \beta)}\frac{\sin\sqrt{\tilde\alpha^2+\tilde\beta^2}}{\sqrt{\tilde\alpha^2+\tilde\beta^2}}\\ &&=\frac1{(2\pi)^2\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})}}\int^\infty_0\mathrm{d} t \sin t \int^{2\pi}_0\mathrm{d}\theta \exp\Pa{\mathrm{i}t((\tilde r-\tilde a_0)\cos\theta+(\tilde s-\tilde b_0)\sin\theta)}\\ &&=\frac1{(2\pi)\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})}}\int^\infty_0\mathrm{d} t\sin t J_0\Pa{t\sqrt{(\tilde r-\tilde a_0)^2+(\tilde s-\tilde b_0)^2}}, \end{eqnarray*} where $J_0(z)$ is the so-called Bessel function of first kind, defined by \begin{eqnarray*} J_0(z)=\frac1\pi\int^\pi_0\cos(z\cos\theta)\mathrm{d}\theta. \end{eqnarray*} Therefore \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s) =\frac1{2\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})}}\int^{+\infty}_0\mathrm{d} t\sin tJ_0\Pa{t\cdot\sqrt{(r-a_0, s-b_0)\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}^{-1}\Pa{\begin{array}{c} r-a_0 \\ s-b_0 \end{array} }}}, \end{eqnarray*} where \begin{eqnarray*} \int^{\infty}_0J_0(\lambda t)\sin(t)\mathrm{d} t = \frac1{\sqrt{1-\lambda^2}}H(1-\abs{\lambda}). \end{eqnarray*} Therefore \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s) =\frac{H(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r,s))}{2\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})(1-\omega^2_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r,s))}}, \end{eqnarray*} where \begin{eqnarray}\label{eq:omegaAB} \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r,s)=\sqrt{(r-a_0, s-b_0)\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}^{-1}\Pa{\begin{array}{c} r-a_0 \\ s-b_0 \end{array} }}. \end{eqnarray} (ii) If $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is linearly dependent, without loss of generality, let $\bsb=\kappa\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$ for some nonzero $\kappa\neq0$, then \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)=\frac1{(2\pi)^2}\int_{\mR^2}\mathrm{d}\alpha\mathrm{d}\beta \exp\Pa{\mathrm{i}((r-a_0)\alpha+(s-b_0)\beta)}\frac{\sin (a\abs{\alpha+\beta\kappa})}{a\abs{\alpha+\beta\kappa}}. \end{eqnarray*} Here $a=\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$. We perform the change of variables $(\alpha,\beta)\to(\alpha',\beta')$, where $\alpha'=\alpha+\kappa\beta$ and $\beta'=\beta$. We get its Jacobian, given by \begin{eqnarray*} \det\Pa{\frac{\partial(\alpha',\beta')}{\partial(\alpha,\beta)}}=\abs{\begin{array}{cc} 1 & \kappa \\ 0 & 1 \end{array} }=1\neq0. \end{eqnarray*} Thus \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)&=&\frac1{(2\pi)^2}\iint\mathrm{d}\alpha'\mathrm{d}\beta' \exp\Pa{\mathrm{i}((r-a_0)(\alpha'-\kappa\beta')+(s-b_0)\beta')}\frac{\sin (a\abs{\alpha'})}{a\abs{\alpha'}}\\ &=&\frac1{2\pi}\int \exp\Pa{\mathrm{i}((s-b_0)-\kappa(r-a_0))\beta'}\mathrm{d}\beta'\times\frac1{2\pi}\int\mathrm{d}\alpha' \exp\Pa{\mathrm{i}(r-a_0)\alpha'}\frac{\sin( a\abs{\alpha'})}{a\abs{\alpha'}}\\ &=&\delta((s-b_0)-\kappa(r-a_0))f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r). \end{eqnarray*} \begin{prop}\label{prop:expdis} For a pair of qubit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=a_0\mathbb{1}+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}$ and $\bsB=b_0\mathbb{1}+\bsb\cdot\boldsymbol{\sigma}$, (i) if $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is linearly independent, then the pdf of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi)$, where $\psi\in\mathbb{C}^2$ a Haar-distributed pure state, is given by \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s) =\frac{H(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r,s))}{2\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb})(1-\omega^2_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r,s))}}. \end{eqnarray*} (ii) If $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is linearly dependent, without loss of generality, let $\bsb=\kappa\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$, then \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)=\delta((s-b_0)-\kappa(r-a_0))f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r). \end{eqnarray*} \end{prop} From Proposition~\ref{prop:expdis}, we can directly infer the results obtained in \cite{Gutkin2013,Gallay2012}. We now turn to a pair of qubit observables \begin{eqnarray}\label{AB} \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E} =a_0\mathbb{1}+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}, \quad \bsB =b_0\mathbb{1}+\bsb\cdot\boldsymbol{\sigma} , \quad (a_0,\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}),(b_0,\bsb)\in \mathbb{R}^4, \end{eqnarray} whose uncertainty region \begin{eqnarray}\label{2DUR} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}:=\Set{(\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta_\psi \bsB)\in\mathbb{R}^2_+: \ket{\psi}\in \mathbb{C}^2} \end{eqnarray} was proposed by Busch and Reardon-Smith \cite{Busch2019} in the mixed state case. We consider the probability distribution density \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y) := \int\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\delta(y-\Delta_\psi \bsB)\mathrm{d}\mu (\psi), \end{eqnarray*} on the uncertainty region defined by Eq.~\eqref{2DUR}. Denote \begin{eqnarray*} \bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}:=\Pa{\begin{array}{cc} \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb} \\ \Inner{\bsb}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\bsb}{\bsb} \end{array} }. \end{eqnarray*} \begin{thrm}\label{th:varAvarB} The joint probability distribution density of the uncertainties $(\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta_\psi \bsB)$ for a pair of qubit observables defined by Eq.~\eqref{AB}, where $\psi$ is a Haar-distributed random pure state on $\mathbb{C}^2$, is given by \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y) = \frac{2xy\sum_{j\in\set{\pm}} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r_+(x),s_j(y))}{\sqrt{(a^2-x^2)(b^2-y^2)}}, \end{eqnarray*} where $a=\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}>0, b=\abs{\bsb}>0$, $r_\pm(x)=a_0\pm\sqrt{a^2-x^2}, s_\pm(y)=b_0\pm\sqrt{b^2-y^2}$. \end{thrm} \begin{proof} Note that in the proof of Theorem~\ref{th:vardis}, we have already obtained that \begin{eqnarray*} \delta(x^2-\Delta^2_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}) = \delta(x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r))) =\delta(f_x(r)), \end{eqnarray*} where $f_x(r):=x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r)$. Similarly, \begin{eqnarray*} \delta(y^2-\Delta^2_\psi\bsB) = \delta(g_y(s)), \end{eqnarray*} where $g_y(s)=y^2-(s-\lambda_1(\bsB))(\lambda_2(\bsB)-s)$. Again, by using \eqref{eq:2nddelta}, we get that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y) &=& 4xy\int\delta(x^2-\Delta^2_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\delta(y^2-\Delta^2_\psi\bsB)\mathrm{d}\mu(\psi)\\ &=& 4 xy\iint\mathrm{d} r\mathrm{d} sf^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)\delta(f_x(r))\delta(g_y(s)), \end{eqnarray*} where $f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s)$ is determined by Proposition~\ref{prop:expdis}. Hence \begin{eqnarray*} \delta\Pa{f_x(r)}&=&\frac1{\abs{\partial_{r=r_+(x)} f_x(r)}}\delta_{r_+(x)}+\frac1{\abs{\partial_{r=r_-(x)} f_x(r)}}\delta_{r_-(x)},\\ \delta\Pa{g_y(s)}&=&\frac1{\abs{\partial_{s=s_+(y)} g_y(s)}}\delta_{s_+(y)}+\frac1{\abs{\partial_{s=s_-(y)}. g_y(s)}}\delta_{s_-(y)}. \end{eqnarray*} From the above, we have already known that \begin{eqnarray*} \delta(f_x(r))\delta(g_y(s)) = \frac{\delta_{(r_+,s_+)}+\delta_{(r_+,s_-)}+\delta_{(r_-,s_+)}+\delta_{(r_-,s_-)}}{4\sqrt{(a^2-x^2)(b^2-y^2)}}. \end{eqnarray*} Based on this observation, we get that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y) = \frac{xy}{\sqrt{(a^2-x^2)(b^2-y^2)}}\sum_{i,j\in\set{\pm}}f_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r_i(x),s_j(y)). \end{eqnarray*} It is easily checked that $\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(\cdot,\cdot)$, defined in \eqref{eq:omegaAB}, satisfies that \begin{eqnarray*} \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r_+(x),s_+(y))=\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r_-(x),s_-(y)),\quad \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r_+(x),s_-(y))=\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB}(r_-(x),s_+(y)). \end{eqnarray*} These lead to the fact that \begin{eqnarray*} \sum_{i,j\in\set{\pm}}f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r_i(x),s_j(y))=2\sum_{j\in\set{\pm}}f_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r_+(x),s_j(y)). \end{eqnarray*} Therefore \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y) = \frac{2xy\sum_{j\in\set{\pm}}f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r_+(x),s_j(y))}{\sqrt{(a^2-x^2)(b^2-y^2)}}. \end{eqnarray*} We get the desired result. \end{proof} \subsection{The case for three qubit observables}\label{app:ABC} We now turn to the case where there are three qubit observables \begin{eqnarray}\label{ABC} \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E} =a_0\mathbb{1}+\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}, \quad \bsB =b_0\mathbb{1}+\bsb\cdot\boldsymbol{\sigma}, \quad \bsC =c_0\mathbb{1}+\bsc\cdot\boldsymbol{\sigma} \quad (a_0,\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}),(b_0,\bsb),(c_0,\bsc)\in \mathbb{R}^4, \end{eqnarray} whose uncertainty region \begin{eqnarray}\label{3DUR} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}:=\Set{(\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta_\psi \bsB,\Delta_\psi \bsC)\in\mathbb{R}^3_+: \ket{\psi}\in \mathbb{C}^2} . \end{eqnarray} We define the probability distribution density \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z) := \int\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\delta(y-\Delta_\psi \bsB)\delta(z-\Delta_\psi \bsC)\mathrm{d}\mu (\psi), \end{eqnarray*} on the uncertainty region defined by Eq.~\eqref{3DUR}. Denote \begin{eqnarray*} \bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}:=\Pa{\begin{array}{ccc} \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb} & \Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsc} \\ \Inner{\bsb}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\bsb}{\bsb} & \Inner{\bsb}{\bsc} \\ \Inner{\bsc}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}} & \Inner{\bsc}{\bsb} & \Inner{\bsc}{\bsc} \end{array} }. \end{eqnarray*} Again note that $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is also a semidefinite positive matrix. We find that $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})\leqslant3$. There are three cases that would be possible: $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=1,2,3$. Thus $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is invertible (i.e., $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=3$) if and only if $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ linearly independent. In such case, we write \begin{eqnarray*} \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t):=\sqrt{(r-a_0,s-b_0,t-c_0)\bsT^{-1}_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}(r-a_0,s-b_0,t-c_0)^\t}. \end{eqnarray*} In order to calculate $f_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}$, essentially we need to derive the joint probability distribution density of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi,\langle\bsC\rangle_\psi)$, which is defined by \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t) :=\int\delta(r-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)\delta(s-\langle\bsB\rangle_\psi)\delta(t-\langle\bsC\rangle_\psi)\mathrm{d}\mu(\psi). \end{eqnarray*} We have the following result: \begin{prop}\label{prop:ABC} For three qubit observables, given by Eq.~\eqref{ABC}, (i) if $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=3$, i.e., $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly independent, then the joint probability distribution density of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi,\langle\bsC\rangle_\psi)$, where $\psi$ is a Haar-distributed random pure state on $\mathbb{C}^2$, is given by the following: \begin{eqnarray}\label{eq:meanABC} f^{(2)}_{\langle \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle ,\langle \bsB\rangle , \langle \bsC\rangle }(r,s,t) =\frac1{4\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)). \end{eqnarray} (ii) If $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=2$, i.e., $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly dependent, without loss of generality, we assume that $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ are linearly independent and $\bsc=\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\kappa_{\bsb}\cdot\bsb$ for some $\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$ and $\kappa_{\bsb}$ with $\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\kappa_{\bsb}\neq0$, then \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t)= \delta((t-c_0)-\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}(r-a_0)-\kappa_{\bsb}(s-b_0))f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s). \end{eqnarray*} (iii) If $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=1$, i.e., $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly dependent, without loss of generality, we assume that $\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$ are linearly independent and $\bsb=\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsc=\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$ for some $\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$ and $\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$ with $\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\neq0$, then \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t) =\delta((s-b_0)-\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}(r-a_0))\delta((t-c_0)-\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}(r-a_0)) f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle}(r). \end{eqnarray*} \end{prop} \begin{proof} (i) If $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=3$, then $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is \emph{invertible}. By using Bloch representation, $\proj{\psi}=\frac12(\mathbb{1}_2+\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}\cdot\boldsymbol{\sigma})$, where $\abs{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}=1$. Then for $(r,s,t)=(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi,\langle\bsC\rangle_\psi)=(a_0+\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}},b_0+\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\bsb},\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\bsc})$, we see that \begin{eqnarray*} (r-a_0,s-b_0,t-c_0) = (\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}},\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\bsb},\Inner{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}{\bsc}). \end{eqnarray*} Denote $\bsQ:=(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc)$, which is a $3\times 3$ invertible real matrix due to the fact that $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly independent. Then $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}=\bsQ^\t\bsQ$ and $(r-a_0,s-b_0,t-c_0) =\bra{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}\bsQ$, which means that \begin{eqnarray*} \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)=\sqrt{\bra{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}\bsQ(\bsQ^\t\bsQ)^{-1}\bsQ^\t\ket{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}} = \abs{\boldsymbol{u}}\def\bsv{\boldsymbol{v}}\def\bsw{\boldsymbol{w}}\def\bsx{\boldsymbol{x}}\def\bsy{\boldsymbol{y}}=1. \end{eqnarray*} This tells us an interesting fact that $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi,\langle\bsC\rangle_\psi)$ lies at the boundary surface of the ellipsoid $\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)\leqslant1$, i.e., $\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)=1$. This indicates that the PDF of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\bsB\rangle_\psi,\langle\bsC\rangle_\psi)$ satisfies that \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t)\propto\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)). \end{eqnarray*} Next we calculate the following integral: \begin{eqnarray*} \int_{\mathbb{R}^3}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t))\mathrm{d} r\mathrm{d} s\mathrm{d} t=4\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}. \end{eqnarray*} Apparently \begin{eqnarray*} \int_{\mathbb{R}^3}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t))\mathrm{d} r\mathrm{d} s\mathrm{d} t= \int_{\mathbb{R}^3}\delta\Pa{1-\sqrt{\Innerm{\bsx}{\bsT^{-1}_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}}{\bsx}}}[\mathrm{d} \bsx]. \end{eqnarray*} Here $\bsx=(r-a_0,s-b_0,t-c_0)$ and $[\mathrm{d}\bsx]=\mathrm{d} r\mathrm{d} s\mathrm{d} t$. Indeed, by using spectral decomposition theorem for Hermitian matrix, we get that there is orthogonal matrix $\bsO\in\O(3)$ such that $\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}=\bsO^\t\mathrm{diag}(\lambda_1,\lambda_2,\lambda_3)\bsO$ where $\lambda_k>0(k=1,2,3)$. Thus \begin{eqnarray*} \omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)=\Innerm{\bsO\bsx}{\mathrm{diag}(\lambda^{-1}_1,\lambda^{-1}_2,\lambda^{-1}_3)}{\bsO\bsx}=\Innerm{\bsy}{\mathrm{diag}(\lambda^{-1}_1,\lambda^{-1}_2,\lambda^{-1}_3)}{\bsy} \end{eqnarray*} where $\bsy=\bsO\bsx$. Thus \begin{eqnarray*} \int_{\mathbb{R}^3}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t))\mathrm{d} r\mathrm{d} s\mathrm{d} t= \int_{\mathbb{R}^3}\delta\Pa{1-\sqrt{\Innerm{\bsy}{\mathrm{diag}(\lambda^{-1}_1,\lambda^{-1}_2,\lambda^{-1}_3)}{\bsy}}}[\mathrm{d} \bsy]. \end{eqnarray*} Let $\boldsymbol{z}=\mathrm{diag}(\lambda^{-1/2}_1,\lambda^{-1/2}_2,\lambda^{-1/2}_3)\bsy$. Then $[\mathrm{d}\boldsymbol{z}]=\frac1{\sqrt{\lambda_1\lambda_2\lambda_3}}[\mathrm{d}\bsy]=\frac1{\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}}[\mathrm{d}\bsy]$ and \begin{eqnarray*} \int_{\mathbb{R}^3}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t))\mathrm{d} r\mathrm{d} s\mathrm{d} t= \sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}\int_{\mathbb{R}^3}\delta\Pa{1-\abs{\boldsymbol{z}}}[\mathrm{d} \boldsymbol{z}]=4\pi \sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}. \end{eqnarray*} Finally we get that \begin{eqnarray*} f^{(2)}_{\langle \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle ,\langle \bsB\rangle , \langle \bsC\rangle }(r,s,t) = \frac1{4\pi\sqrt{\det(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})}}\delta(1-\omega_{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB,\bsC}(r,s,t)). \end{eqnarray*} (ii) If $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=2$, then $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly dependent. Without loss of generality, we assume that $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb}$ is independent. Now $\bsc=\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}+\kappa_{\bsb}\bsb$ for some $\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}},\kappa_{\bsb}\in\mathbb{R}$ with $\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\kappa_{\bsb}\neq0$. Thus \begin{eqnarray*} t-c_0&=&\langle\bsC\rangle_\psi-c_0 =\Innerm{\psi}{\bsc\cdot\boldsymbol{\sigma}}{\psi} =\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\Innerm{\psi}{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}\cdot\boldsymbol{\sigma}}{\psi}+\kappa_{\bsb}\Innerm{\psi}{\bsb\cdot\boldsymbol{\sigma}}{\psi}\\ &&=\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}(r-a_0)+\kappa_{\bsb}(s-b_0). \end{eqnarray*} Therefore we get that \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t)= \delta((t-c_0)-\kappa_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}(r-a_0)-\kappa_{\bsb}(s-b_0))f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle}(r,s). \end{eqnarray*} (iii) If $\op{rank}(\bsT_{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc})=1$, then $\set{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsb,\bsc}$ is linearly dependent. Without loss of generality, we assume that $\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$ are linearly independent and $\bsb=\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e},\bsc=\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\cdot\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}$ for some $\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$ and $\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}$ with $\kappa_{\bsb\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\kappa_{\bsc\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}\neq0$. Then we get the desired result by mimicking the proof in (ii). \end{proof} \begin{thrm}\label{th:ABC2} The joint probability distribution density of $(\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta_\psi\bsB,\Delta_\psi \bsC)$ for a triple of qubit observables defined by Eq.~\eqref{ABC}, where $\ket{\psi}$ is a Haar-distributed random pure state on $\mathbb{C}^2$, is given by \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z) =\frac{2xyz}{\sqrt{(a^2-x^2)(b^2-y^2)(c^2-z^2)}}\sum_{j,k\in\set{\pm}} f^{(2)}_{\langle \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle ,\langle \bsB\rangle,\langle \bsC\rangle}(r_+(x),s_j(y),t_k(z)), \end{eqnarray*} where $f_{\langle \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle \bsB\rangle, \langle \bsC\rangle}(r,s,t)$ is the joint probability distribution density of the expectation values $(\langle \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle \bsB\rangle_\psi,\langle \bsC\rangle_\psi)$, which is determined by Eq.~\eqref{eq:meanABC} in Proposition~\ref{prop:ABC}; and \begin{eqnarray*} r_\pm(x):=a_0\pm\sqrt{a^2-x^2},\quad s_\pm(y):=b_0\pm\sqrt{b^2-y^2},\quad t_\pm(z):=c_0\pm\sqrt{c^2-z^2}. \end{eqnarray*} \end{thrm} \begin{proof} Note that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z)&=&\int\delta(x-\Delta_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})\delta(y-\Delta_\psi \bsB)\delta(z-\Delta_\psi\bsC)\mathrm{d}\mu(\psi) \notag\\ &=& 8xyz\int\delta\Pa{x^2-\Delta^2_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}\cdot\delta\Pa{y^2-\Delta^2_\psi \bsB}\cdot\delta\Pa{z^2-\Delta^2_\psi\bsC}\mathrm{d}\mu(\psi). \end{eqnarray*} Again using the method in the proof of Theorem 1, we have already obtained that \begin{eqnarray*} \delta\Pa{x^2-\Delta^2_\psi \boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}\cdot\delta\Pa{y^2-\Delta^2_\psi \bsB}\cdot\delta\Pa{z^2-\Delta^2_\psi \bsC}=\delta(f_x(r))\delta(g_y(s))\delta(h_z(t)), \end{eqnarray*} where \begin{eqnarray*} f_x(r)&:=&x^2-(r-\lambda_1(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))(\lambda_2(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-r),\\ g_y(s)&:=&y^2-(s-\lambda_1(\bsB))(\lambda_2(\bsB)-s),\\ h_z(t)&:=&z^2-(t-\lambda_1(\bsC))(\lambda_2(\bsC)-t). \end{eqnarray*} Then \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z)&=&8xyz\iiint \delta(f_x(r))\delta(g_y(s))\delta(h_z(t))f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r,s,t)\mathrm{d} r\mathrm{d} s\mathrm{d} t. \end{eqnarray*} Furthermore we have \begin{eqnarray*} \delta(f_x(r))\delta(g_y(s))\delta(h_z(t)) = \frac{\sum_{i,j,k\in\set{\pm}}\delta_{(r_i(x),s_j(y),t_k(z))}}{8\sqrt{(a^2-x^2)(b^2-y^2)(c^2-z^2)}}. \end{eqnarray*} Based on this observation, we get that \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z)&=&\frac{xyz}{\sqrt{(a^2-x^2)(b^2-y^2)(c^2-z^2)}}\sum_{i,j,k\in\set{\pm}}\Inner{\delta_{(r_i(x),s_j(y),t_k(z))}}{f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}}. \end{eqnarray*} Thus \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z) = \frac{xyz\sum_{i,j,k\in\set{\pm}}f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_i(x),s_j(y),t_k(z))}{\sqrt{(a^2-x^2)(b^2-y^2)(c^2-z^2)}}. \end{eqnarray*} It is easily seen that \begin{eqnarray*} f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_+(x),s_+(y),t_+(z))=f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_-(x),s_-(y),t_-(z)),\\ f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_+(x),s_+(y),t_-(z))=f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_-(x),s_-(y),t_+(z)),\\ f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_+(x),s_-(y),t_+(z))=f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_-(x),s_+(y),t_-(z)),\\ f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_+(x),s_-(y),t_-(z))=f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_-(x),s_+(y),t_+(z)). \end{eqnarray*} From these observations, we can reduce the above expression to the following: \begin{eqnarray*} f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB,\Delta\bsC}(x,y,z) = \frac{2xyz\sum_{j,k\in\set{\pm}}f^{(2)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\bsB\rangle,\langle\bsC\rangle}(r_+(x),s_j(y),t_k(z))}{\sqrt{(a^2-x^2)(b^2-y^2)(c^2-z^2)}}. \end{eqnarray*} The desired result is obtained. \end{proof} Note that the PDFs of uncertainties of multiple qubit observables (more than three) will be reduced into the three situations above, as shown in \cite{Zhang2021preprint}. Here we will omit it here. \section{PDF of uncertainty of a single qudit observable} Assume $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ is a non-degenerate positive matrix with eigenvalues $\lambda_k(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=a_k(k=1,\ldots,d)$ with $a_d>\cdots>a_1$. Denote by $V_d(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})=\prod_{1\leqslant i<j\leqslant d}(a_j-a_i)$. Due to the following relation $(\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})^2=\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2}{\psi}-\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi}^2$, i.e., the variance of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ is the function of $r=\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi}$ and $s=\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2}{\psi}$, where $\ket{\psi}$ is a Haar-distributed pure state. Thus firstly we derive the joint PDF of $(\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi},\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2}{\psi})$, defined by \begin{eqnarray*} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s) := \int \delta(r-\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}{\psi})\delta(s-\Innerm{\psi}{\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2}{\psi})\mathrm{d}\mu(\psi). \end{eqnarray*} By performing Laplace transformation $(r,s)\to(\alpha,\beta)$ to $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s)$, we get that \begin{eqnarray*} \sL\Pa{f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}}(\alpha,\beta) =\int \exp\Pa{-\Innerm{\psi}{\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2}{\psi}}\mathrm{d}\mu(\psi)= \int \exp\Pa{-z}f^{(d)}_{\langle\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(z)\mathrm{d} z, \end{eqnarray*} where $f^{(d)}_{\langle\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(z)$ is determined by Proposition~\ref{prop:expectn}: \begin{eqnarray*} f^{(d)}_{\langle\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(z)=(-1)^{d-1}(d-1)\sum^d_{i=1}\frac{(z-(\alpha a_i+\beta a^2_i))^{d-2}}{\prod_{j\in\hat i}(a_i-a_j)(\alpha+\beta (a_i+a_j))}H(z-(\alpha a_i+\beta a^2_i)). \end{eqnarray*} Theoretically, we can calculate the above integral for any finite natural number $d$, but instead, we will focus on the case where $d=3,4$, we use \textit{Mathematica} to do this tedious job. By simplifying the results obtained via the Laplace transformation/inverse Laplace transformation in \textit{Mathematica}, we get the following results without details. \begin{thrm}\label{th:qu3it} For a given qutrit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, acting on $\mathbb{C}^3$, with their eigenvalues $a_1<a_2<a_3$, the joint pdf of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle_\psi)$, where $\ket{\psi}\in\mC^3$, is given by \begin{eqnarray*} f^{(3)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s) =\frac{\Gamma(3)}{V_3(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}, \end{eqnarray*} on $D=D_1\cup D_2$ for \begin{eqnarray*} D_1&=&\Set{(r,s): a_1\leqslant r\leqslant a_2, (a_1+a_2)r-a_1a_2\leqslant s\leqslant(a_1+a_3)r-a_1a_3},\\ D_2&=&\Set{(r,s): a_2\leqslant r\leqslant a_3, (a_2+a_3)r-a_2a_3\leqslant s\leqslant(a_1+a_3)r-a_1a_3}; \end{eqnarray*} and $f^{(3)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s)=0$ otherwise. Thus \begin{eqnarray*} f^{(3)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x) = \frac{2{\Gamma(3)}}{V_3(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}x\quad(\forall (r,x)\in R), \end{eqnarray*} where $R=R_1\cup R_2$ with \begin{eqnarray*} R_1&=&\Set{(r,x): a_1\leqslant r\leqslant a_2, \sqrt{(a_2-r)(r-a_1)}\leqslant x\leqslant \sqrt{(a_3-r)(r-a_1)}},\\ R_2&=&\Set{(r,x): a_2\leqslant r\leqslant a_3, \sqrt{(a_3-r)(r-a_2)}\leqslant x\leqslant \sqrt{(a_3-r)(r-a_1)}}, \end{eqnarray*} and $f^{(3)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x) =0$ otherwise. Moreover, we get that \begin{eqnarray*} f^{(3)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) = \frac{4\Gamma(3)}{V_3(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}x\Pa{\chi_{\Br{0,\tfrac{a_3-a_1}2}}(x)\varepsilon_{31}(x)-\chi_{\Br{0,\tfrac{a_3-a_2}2}}(x)\varepsilon_{32}(x)-\chi_{\Br{0,\tfrac{a_2-a_1}2}}(x)\varepsilon_{21}(x)}, \end{eqnarray*} where $x\in\Br{0,\frac{a_3-a_1}2}$ and $\chi_S(x)$ is the indicator of the set $S$, i.e., $\chi_S(x)=1$ if $x\in S$, and $\chi_S(x)=0$ if $x\notin S$; \begin{eqnarray}\label{eq:notationdelta} \varepsilon_{ij}(x):=\sqrt{\Pa{\frac{a_i-a_j}2}^2- x^2}. \end{eqnarray} \end{thrm} \begin{thrm} For a given qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, acting on $\mathbb{C}^4$, with their eigenvalues $a_1<a_2<a_3<a_4$, the joint pdf of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle_\psi)$, where $\ket{\psi}\in\mC^4$, is given by \begin{eqnarray*} f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s) =\frac{\Gamma(4)}{V_4(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}g(r,s), \end{eqnarray*} where $g(r,s)$ is defined by the following way: via $\varphi_{i,j}(r):=(a_i+a_j)r-a_ia_j$, \begin{eqnarray*} g(r,s) = \begin{cases} (a_4-a_3)(s-\varphi_{1,2}(r)),&\text{if }(r,s)\in D^{(1)}_1\cup D^{(2)}_2;\\ (a_4-a_1)(s-\varphi_{2,3}(r)),&\text{if }(r,s)\in D^{(2)}_1\cup D^{(2)}_4;\\ (a_2-a_1)(s-\varphi_{3,4}(r)),&\text{if }(r,s)\in D^{(2)}_5\cup D^{(3)}_1;\\ (a_2-a_3)(s-\varphi_{1,4}(r)),&\text{if }(r,s)\in D^{(1)}_2\cup D^{(2)}_3\cup D^{(2)}_6\cup D^{(3)}_2;\\ \end{cases} \end{eqnarray*} on $D=\bigcup^2_{i=1}D^{(1)}_i\cup \bigcup^6_{j=1} D^{(2)}_j\cup \bigcup^2_{k=1}D^{(3)}_k$ for \begin{eqnarray*} D^{(1)}_1&=&\Set{(r,s): a_1\leqslant r\leqslant a_2, \varphi_{1,2}(r)\leqslant s\leqslant\varphi_{1,3}(r)},\\ D^{(1)}_2&=&\Set{(r,s): a_1\leqslant r\leqslant a_2, \varphi_{1,3}(r)\leqslant s\leqslant\varphi_{1,4}(r)}, \end{eqnarray*} and \begin{eqnarray*} D^{(2)}_1&=& \Set{(r,s): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \varphi_{2,3}(r)\leqslant s\leqslant\varphi_{2,4}(r)},\\ D^{(2)}_2&=& \Set{(r,s): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \varphi_{2,4}(r)\leqslant s\leqslant\varphi_{1,3}(r)},\\ D^{(2)}_3&=& \Set{(r,s): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \varphi_{1,3}(r)\leqslant s\leqslant\varphi_{1,4}(r)},\\ D^{(2)}_4&=& \Set{(r,s): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \varphi_{2,3}(r)\leqslant s\leqslant\varphi_{1,3}(r)},\\ D^{(2)}_5&=& \Set{(r,s): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \varphi_{1,3}(r)\leqslant s\leqslant\varphi_{2,4}(r)},\\ D^{(2)}_6&=& \Set{(r,s): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \varphi_{2,4}(r)\leqslant s\leqslant\varphi_{1,4}(r)}, \end{eqnarray*} and \begin{eqnarray*} D^{(3)}_1&=&\Set{(r,s): a_3\leqslant r\leqslant a_4, \varphi_{3,4}(r)\leqslant s\leqslant\varphi_{2,4}(r)},\\ D^{(3)}_2&=&\Set{(r,s): a_3\leqslant r\leqslant a_4, \varphi_{2,4}(r)\leqslant s\leqslant\varphi_{1,4}(r)}, \end{eqnarray*} and $f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s)=0$ otherwise. \end{thrm} \begin{remark} Denote by $D_1=\bigcup^2_{i=1}D^{(1)}_i, D_2=\bigcup^6_{i=1}D^{(2)}_j$, and $D_3=\bigcup^2_{k=1}D^{(3)}_k$, respectively. Thus \begin{eqnarray*} D_1 &=& \Set{(r,s): a_1\leqslant r\leqslant a_2, \varphi_{1,2}(r)\leqslant s\leqslant\varphi_{1,4}(r)},\\ D_2 &=& \Set{(r,s): a_2\leqslant r\leqslant a_3, \varphi_{2,3}(r)\leqslant s\leqslant\varphi_{1,4}(r)},\\ D_3 &=& \Set{(r,s): a_3\leqslant r\leqslant a_4, \varphi_{3,4}(r)\leqslant s\leqslant\varphi_{1,4}(r)}. \end{eqnarray*} This implies that the support of $f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}$ is just $D_1\cup D_2\cup D_3$, i.e., ${\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}(f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle})=D_1\cup D_2\cup D_3$. \end{remark} \begin{cor}\label{cor:DeltaA4} For a given qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, acting on $\mathbb{C}^4$, with their eigenvalues $a_1<a_2<a_3<a_4$, the joint pdf of $(\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle_\psi)$, where $\ket{\psi}\in\mC^4$, is given by \begin{eqnarray*} f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x) =\frac{2\Gamma(4)}{V_4(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}xg(r,x^2+r^2). \end{eqnarray*} Moreover, via $\varphi_{i,j}(r):=(a_i+a_j)r-a_ia_j$, \begin{eqnarray*} f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x) =\frac{2\Gamma(4)}{V_4(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}x \begin{cases} (a_4-a_3)(x^2+r^2-\varphi_{1,2}(r)),&\text{if }(r,s)\in R^{(1)}_1\cup R^{(2)}_2;\\ (a_4-a_1)(x^2+r^2-\varphi_{2,3}(r)),&\text{if }(r,s)\in R^{(2)}_1\cup R^{(2)}_4;\\ (a_2-a_1)(x^2+r^2-\varphi_{3,4}(r)),&\text{if }(r,s)\in R^{(2)}_5\cup R^{(3)}_1;\\ (a_2-a_3)(x^2+r^2-\varphi_{1,4}(r)),&\text{if }(r,s)\in R^{(1)}_2\cup R^{(2)}_3\cup R^{(2)}_6\cup R^{(3)}_2;\\ \end{cases} \end{eqnarray*} on $R=\bigcup^2_{i=1}R^{(1)}_i\cup \bigcup^6_{j=1} R^{(2)}_j\cup \bigcup^2_{k=1}R^{(3)}_k$ for \begin{eqnarray*} R^{(1)}_1&=&\Set{(r,x): a_1\leqslant r\leqslant a_2, \sqrt{(a_2-r)(r-a_1)}\leqslant x\leqslant\sqrt{(a_3-r)(r-a_1)}},\\ R^{(1)}_2&=&\Set{(r,x): a_1\leqslant r\leqslant a_2, \sqrt{(a_3-r)(r-a_1)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}}, \end{eqnarray*} and \begin{eqnarray*} R^{(2)}_1&=& \Set{(r,x): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \sqrt{(a_3-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_2)}},\\ R^{(2)}_2&=& \Set{(r,x): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \sqrt{(a_4-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_3-r)(r-a_1)}},\\ R^{(2)}_3&=& \Set{(r,x): a_2\leqslant r\leqslant \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}, \sqrt{(a_3-r)(r-a_1)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}},\\ R^{(2)}_4&=& \Set{(r,x): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \sqrt{(a_3-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_3-r)(r-a_1)}},\\ R^{(2)}_5&=& \Set{(r,x): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \sqrt{(a_3-r)(r-a_1)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_2)}},\\ R^{(2)}_6&=& \Set{(r,x): \frac{a_2a_4-a_1a_3}{a_2+a_4-a_1-a_3}\leqslant r\leqslant a_3, \sqrt{(a_4-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}}, \end{eqnarray*} and \begin{eqnarray*} R^{(3)}_1&=&\Set{(r,x): a_3\leqslant r\leqslant a_4, \sqrt{(a_4-r)(r-a_3)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_2)}},\\ R^{(3)}_2&=&\Set{(r,x): a_3\leqslant r\leqslant a_4, \sqrt{(a_4-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}}, \end{eqnarray*} and $f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)=0$ otherwise. Moreover $f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$ can be identified as \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)&=&\frac{4^2}{V_4(\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e})}x\Big[(a_4-a_3)\chi_{\Br{0,\frac{a_2-a_1}2}}(x)\varepsilon^3_{12}(x)+(a_4-a_1)\chi_{\Br{0,\frac{a_3-a_2}2}}(x)\varepsilon^3_{23}(x)\notag\\ &&~~~~~~~~~~~~~-(a_4-a_2)\chi_{\Br{0,\frac{a_3-a_1}2}}(x)\varepsilon^3_{13}(x)+(a_2-a_1)\chi_{\Br{0,\frac{a_4-a_3}2}}(x)\varepsilon^3_{34}(x)\notag\\ &&~~~~~~~~~~~~~-(a_3-a_1)\chi_{\Br{0,\frac{a_4-a_2}2}}(x)\varepsilon^3_{24}(x)+(a_3-a_2)\chi_{\Br{0,\frac{a_4-a_1}2}}(x)\varepsilon^3_{14}(x)\Big]. \end{eqnarray*} Here the meanings of the notations $\chi$ and $\varepsilon_{ij}$ can be found in Theorem~\ref{th:qu3it}. \end{cor} \begin{remark} Denote by $R_1=\bigcup^2_{i=1}R^{(1)}_i, R_2=\bigcup^6_{i=1}R^{(2)}_j$, and $R_3=\bigcup^2_{k=1}R^{(3)}_k$, respectively. Thus \begin{eqnarray*} R_1 &=& \Set{(r,x): a_1\leqslant r\leqslant a_2, \sqrt{(a_2-r)(r-a_1)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}},\\ R_2 &=& \Set{(r,x): a_2\leqslant r\leqslant a_3, \sqrt{(a_3-r)(r-a_2)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}},\\ R_3 &=& \Set{(r,x): a_3\leqslant r\leqslant a_4, \sqrt{(a_4-r)(r-a_3)}\leqslant x\leqslant\sqrt{(a_4-r)(r-a_1)}}. \end{eqnarray*} This implies that the support of $f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}$ is just $R_1\cup R_2\cup R_3$, i.e., ${\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}(f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}})=R_1\cup R_2\cup R_3$. We draw the plot of the support of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$, where $d=3,4$, as below: \begin{figure}[ht] \subfigure[The support of $f^{(3)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$, where $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9)$] {\begin{minipage}[b]{.49\linewidth} \includegraphics[width=1\textwidth]{supp3} \end{minipage}} \subfigure[The support of $f^{(4)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$, where $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9,27)$] {\begin{minipage}[b]{.49\linewidth} \includegraphics[width=1\textwidth]{supp4} \end{minipage}} \caption{Plots of the supports of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$ for qudit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$.}\label{fig:supp3&supp4} \end{figure} \end{remark} Based on the above Corollary~\ref{cor:DeltaA4}, we can derive $f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$ just like to do similarly for $f^{(3)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$. As an illustration, we will present a specific example where the eigenvalues of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ are given by $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9,27)$. In fact, this approach can goes for any qudit observable with much computational complexity. In addition, deriving the joint PDF of two uncertainties $(\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB)$ of two qudit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ and $\bsB$, $f^{(d)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}$, is very complicated. This is not the goal of the present paper. \begin{exam} For a qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, acting on $\mathbb{C}^4$, with the eigenvalues $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9,27)$. Still employing the notation in \eqref{eq:notationdelta} here: \begin{eqnarray*} \varepsilon_{12}(x)=\sqrt{1-x^2},\quad \varepsilon_{13}(x)=\sqrt{4^2-x^2},\quad \varepsilon_{14}(x)=\sqrt{13^2-x^2},\\ \varepsilon_{23}(x)=\sqrt{3^2-x^2},\quad \varepsilon_{24}(x)=\sqrt{12^2-x^2},\quad \varepsilon_{34}(x)=\sqrt{9^2-x^2}. \end{eqnarray*} Then from Corollary~\ref{cor:DeltaA4}, using marginal integral, we can derive the PDF of $\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ that \\ (i) If $x\in[0,1]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{33696}\Pa{ 9\varepsilon^3_{12}(x)+13\varepsilon^3_{23}(x)-12\varepsilon^3_{13}(x)+\varepsilon^3_{34}(x)-4\varepsilon^3_{24}(x)+3\varepsilon^3_{14}(x)}. \end{eqnarray*} (ii) If $x\in[1,3]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{33696}\Pa{13\varepsilon^3_{23}(x)-12\varepsilon^3_{13}(x)+\varepsilon^3_{34}(x)-4\varepsilon^3_{24}(x)+3\varepsilon^3_{14}(x)}. \end{eqnarray*} (iii) If $x\in[3,4]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{33696}\Pa{-12\varepsilon^3_{13}(x)+\varepsilon^3_{34}(x)-4\varepsilon^3_{24}(x)+3\varepsilon^3_{14}(x)}. \end{eqnarray*} (iv) If $x\in[4,9]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{33696}\Pa{\varepsilon^3_{34}(x)-4\varepsilon^3_{24}(x)+3\varepsilon^3_{14}(x)}. \end{eqnarray*} (v) If $x\in[9,12]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{33696}\Pa{-4\varepsilon^3_{24}(x)+3\varepsilon^3_{14}(x)}. \end{eqnarray*} (vi) If $x\in[12,13]$, then \begin{eqnarray*} f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x) =\frac{x}{11232}\varepsilon^3_{14}(x). \end{eqnarray*} For illustrations, we draw the plot of $f^{(d)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$ for qudit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, where $d=3,4$, as below: \begin{figure}[ht] \subfigure[The PDF $f^{(3)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$, where $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9)$] {\begin{minipage}[b]{.49\linewidth} \includegraphics[width=1\textwidth]{varpdf3} \end{minipage}} \subfigure[The PDF $f^{(4)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$, where $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(1,3,9,27)$] {\begin{minipage}[b]{.49\linewidth} \includegraphics[width=1\textwidth]{varpdf4} \end{minipage}} \caption{Plots of the PDFs $f^{(d)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(x)$ for qudit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$.}\label{fig:varpdf3&varpdf4} \end{figure} \end{exam} In the last, we will identify the supports of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s)$ and $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$, where \begin{eqnarray*} f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s) &=& \int\delta(r-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle_\psi)\delta(s-\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle_\psi)\mathrm{d}\mu(\psi),\\ f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x) &=& 2x f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}\Pa{r,r^2+x^2}. \end{eqnarray*} \begin{thrm} For a qudit observable $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, acting on $\mathbb{C}^d(d>1)$, with eigenvalues $\lambda(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})=(a_1,\ldots,a_d)$, where $a_1<\cdots<a_d$, the supports of the PDFs of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}(r,s)$ and $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$, respectively, given by the following: \begin{eqnarray*} {\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}\Pa{f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}} = \bigcup^{d-1}_{k=1}F_{k,k+1}, \end{eqnarray*} where \begin{eqnarray*} F_{k,k+1} := \Set{(r,s): a_k\leqslant r\leqslant a_{k+1},\varphi_{k,k+1}(r)\leqslant s\leqslant \varphi_{1,d}(r)}; \end{eqnarray*} \begin{eqnarray*} {\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}\Pa{f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}} = \bigcup^{d-1}_{k=1} V_{k,k+1}, \end{eqnarray*} where \begin{eqnarray*} V_{k,k+1} := \Set{(r,x): a_k\leqslant r\leqslant a_{k+1},\sqrt{(a_{k+1}-r)(r-a_k)}\leqslant x\leqslant \sqrt{(a_d-r)(r-a_1)}}. \end{eqnarray*} \end{thrm} \begin{proof} Without loss of generality, we assume that $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}=\mathrm{diag}(a_1,\ldots,a_d)$ with $a_1<\cdots<a_d$. Let $\ket{\psi}=(\psi_1,\ldots,\psi_d)^\t\in\mathbb{C}^d$ be a pure state and $r_k=\abs{\psi_k}^2$. Thus $(r_1,\ldots,r_d)$ is a $d$-diemsional probability vector. Then \begin{eqnarray*} r=\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle = \sum^d_{k=1}a_kr_k\quad\text{and}\quad s=\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle = \sum^d_{k=1}a^2_kr_k. \end{eqnarray*} Thus, for each $k\in\set{1,\ldots,d-1}$, \begin{eqnarray*} &&s-\varphi_{k,k+1}(r) = \sum^d_{i=1}a^2_ir_i - (a_k+a_{k+1})\sum^d_{i=1}a_ir_i+a_ka_{k+1}\\ &&= \sum^d_{i=1}a^2_ir_i - (a_k+a_{k+1})\sum^d_{i=1}a_ir_i+a_ka_{k+1}\sum^d_{i=1}r_i\\ &&=\sum^d_{i=1}(a_i-a_k)(a_i-a_{k+1})r_i. \end{eqnarray*} Note that $a_1<\cdots<a_d$ and $r_i\geqslant0$ for each $i=1,\ldots,d$. We see that, when $i=k,k+1$, $(a_i-a_k)(a_i-a_{k+1})r_i=0$, and $(a_i-a_k)(a_i-a_{k+1})r_i\geqslant0$ otherwise. This means that $s\geqslant \varphi_{k,k+1}(r)$; and this inequality is saturated if $(r_k,r_{k+1})=(t,1-t)$ for $t\in(0,1)$ and $r_i=0$ for $i\neq k,k+1$. Similarly, we can easily get that $s\leqslant \varphi_{1,d}(r)$. Denote \begin{eqnarray*} F_{k,k+1} = \Set{(r,s): a_k\leqslant r\leqslant a_{k+1},\varphi_{k,k+1}(r)\leqslant s\leqslant \varphi_{1,d}(r)}; \end{eqnarray*} Hence \begin{eqnarray*} {\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}\Pa{f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}} = \bigcup^{d-1}_{k=1}F_{k,k+1}. \end{eqnarray*} Now, for $x=\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$, we see that $s=r^2+x^2$. By employing the support of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}^2\rangle}$, we can derive the support of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$ as follows: Denote \begin{eqnarray*} V_{k,k+1} = \Set{(r,x): a_k\leqslant r\leqslant a_{k+1},\sqrt{(a_{k+1}-r)(r-a_k)}\leqslant x\leqslant \sqrt{(a_d-r)(r-a_1)}}, \end{eqnarray*} then \begin{eqnarray*} \varphi_{k,k+1}(r)\leqslant s=r^2+x^2\leqslant \varphi_{1,d}(r)\Longleftrightarrow (r,x)\in V_{k,k+1}. \end{eqnarray*} Therefore the support of $f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}(r,x)$ is given by \begin{eqnarray*} {\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}\Pa{f^{(d)}_{\langle\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\rangle,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}} = \bigcup^{d-1}_{k=1} V_{k,k+1}. \end{eqnarray*} This completes the proof. \end{proof} For the joint PDF of uncertainties of multiple qudit observables acting on $\mC^d(d\geqslant3)$, say, a pair of qudit observables $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB)$, deriving the joint PDF $f^{(d)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y)$ is very complicated because there is much difficulty in calculating the Laplace transformation/inverse Laplace transformation of $f^{(d)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}(x,y)$. The reason is that we still cannot figure out what the relationship among $\lambda_k(\alpha\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}+\beta\bsB), \lambda_k(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})$, and $\lambda_k(\bsB)$ is for varied $(\alpha,\beta)\in\mR^2$. A fresh method to do this is expected to discover in the future. \section{Discussion and concluding remarks} Recall that the support ${\operatorname{supp}}} \newcommand{\var}{\operatorname{Var}(f)$ of a function $f$ is given by the closure of the subset of preimage for which $f$ does not vanish. From Theorem~\ref{th:vardis}, we see that the support of $f^{(2)}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}}$ is the closed interval $[0,\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}]$. This is in consistent with the fact that $\Delta_\psi\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}\in[0,v(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})]$, where $v(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}):=\tfrac12(\lambda_{\max}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E})-\lambda_{\min}(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}))$ and $\ket{\psi}$ is any pure state. From Proposition~\ref{prop:expdis} and Theorem~\ref{th:varAvarB}, we can infer that, for $d=2$, each element in $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}$ is just the solution of the following inequality: \begin{eqnarray*} \abs{\bsb}^2x^2+\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}^2y^2+2\abs{\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb}}\sqrt{(\abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}^2-x^2)(\abs{\bsb}^2-y^2)}\geqslant \abs{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}^2\abs{\bsb}^2+\abs{\Inner{\boldsymbol{a}}\def\bsb{\boldsymbol{b}}\def\bsc{\boldsymbol{c}}\def\bsd{\boldsymbol{d}}\def\bse{\boldsymbol{e}}{\bsb}}^2, \end{eqnarray*} which is exactly the one we obtained in \cite{Zhang2021preprint} for mixed states. This indicates that, in the qubit situation, we have that \begin{prop} For a pair of qubit observables $(\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\bsB)$ acting on $\mC^2$, it holds that \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\mathrm{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB} = \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\mathrm{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E},\Delta\bsB}. \end{eqnarray*} \end{prop} One may wonder if this identity holds for general $d\geqslant2$, as the variance of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ with respect to a mixed state can always be decomposed as a convex combination of some variances of $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}$ associated to pure states, see Eq.~\eqref{eq:vardecom}. For multiple qudit observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k$ $(k=1,\ldots,n)$ acting on $\mathbb{C}^d$, comparing the set $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$ with the set $ \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$ is an interesting problem. Unfortunately, our Theorem~\ref{th:ABC2}, together the result obtained in \cite{Zhang2021preprint}, indicates that $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3} =\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3}$ does not hold in general. In fact, $\partial\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3} =\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3}$ in the qubit situations, that is, the boundary surface of $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3}$ is just $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_2,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_3}$ in the qubit situations. This also indicates that the following inclusion is proper in general for multiple observables, \begin{eqnarray*} \mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}\subsetneq\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}. \end{eqnarray*} Based on this, two extreme cases: $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}=\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$ or $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}=\partial\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$ should be characterized. In addition, we also see that once we obtain the uncertainty regions for observables $\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k$, we can infer additive uncertainty relations such as \begin{eqnarray*} \sum^n_{k=1}(\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k)^2\geqslant \min_{\rho\in\density{\mathbb{C}^d}}\sum^n_{k=1}(\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k)^2 = \min\Set{\sum^n_{k=1}x^2_k:(x_1,\ldots,x_n)\in\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}}, \end{eqnarray*} or \begin{eqnarray*} \sum^n_{k=1}\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k\geqslant \min_{\rho\in\density{\mathbb{C}^d}}\sum^n_{k=1}\Delta_\rho\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_k = \min\Set{\sum^n_{k=1}x_k:(x_1,\ldots,x_n)\in\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{m})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}}. \end{eqnarray*} Analogous optimal problems can also be considered for $\mathcal{U}}\def\cV{\mathcal{V}}\def\cW{\mathcal{W}}\def\cX{\mathcal{X}}\def\cY{\mathcal{Y}^{(\text{p})}_{\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_1,\ldots,\Delta\boldsymbol{A}}\def\bsB{\boldsymbol{B}}\def\bsC{\boldsymbol{C}}\def\bsD{\boldsymbol{D}}\def\bsE{\boldsymbol{E}_n}$. These results can be used to detect entanglement \cite{Guhne2004prl,Schwonnek2017prl}. The current results and the results in \cite{Zhang2021preprint} together give the complete solutions to the uncertainty region and uncertainty relations for qubit observables. We hope the results obtained in the present paper can shed new lights on the related problems in quantum information theory. Our approach may be applied to the study on PDFs in higher dimensional spaces. It would be also interesting to apply PDFs to measurement and/or quantum channel uncertainty relations. \subsubsection*{Acknowledgments} This work is supported by the NSF of China under Grant Nos. 11971140, 12075159, and 12171044, Beijing Natural Science Foundation (Z190005), the Academician Innovation Platform of Hainan Province, and Academy for Multidisciplinary Studies, Capital Normal University. LZ is also funded by Natural Science Foundations of Hubei Province Grant No. 2020CFB538.
\section{Introduction} Young massive clusters (YMCs) play a fundamental role in the evolution of galaxies. Active sites of large-scale star formation, they act as laboratories in which to study how stars form, as well as impact and spatially interact within their natal environment. They are particularly useful in the study of massive stars which typically do not form in isolation. (\citealt{2005A&A...437..247D}, \citealt{2007MNRAS.380.1271P}, \citealt{2012MNRAS.424.3037G}, \citealt{2017ApJ...834...94S}, \citealt{2018ARA&A..56...41M}, \citealt{2020MNRAS.495.1209R}). Long the focus of intense observational study, intrinsic nebulosity associated with YMCs makes observational study difficult and datasets are almost always incomplete. While the full extent of the effect this incompleteness has on the results of analyses performed using these datasets is not known, previous studies have indicated it is not trivial (\citealt{2009Ap&SS.324..113A}, \citealt{2012A&A...545A.122P}, \citealt{2022A&A...659A..72B}). A core issue is whether the parameters determined are representative of physical processes in the cluster or are attributable to observational biases and effects. For example, if only 2D spatial data is available is identified substructure real or a perspective effect? If a cluster is determined to be mass segregated, is this real or does it just appear to be due to perspective effects and/or heavy incompleteness in the lower mass population? The issue of structure identification is exemplified by studies such as \citet{Cantat-Gaudin2020}, who showed that some formerly identified Milky Way clusters are actually likely to be asterisms. \citet{Piecka2021} also argue that the 3D structure of clusters cannot be properly determined for clusters at distances $>500$ pc. Another issue with observational datasets is that they can only give a ‘snapshot’ of a YMC at a single point in its evolution. Past and future spatial behaviours have to be extrapolated. But combined with the incompleteness problem, this is obviously difficult to achieve and the accuracy of any predictions questionable. For example, if no/few radial velocities are available, how trustworthy is a result that the cluster is expanding or contracting from proper motions alone? Observational studies serve a vital role in our understanding YMCs and informing star formation models, so it is critical that these questions are addressed so that their reliability can be ascertained. Simulated clusters provide a means to explore the properties of stellar clusters as examined with full 6 dimensional analysis. N-body simulations allow the evolution of clusters to be followed over time, and the actual evolution compared to that inferred from 2D or 3D velocity measurements at a single snapshot. At least at the formation stage, clusters will be embedded or at least associated with a natal gas cloud. Simulations which include hydrodynamics can probe the effects of extinction, since the gas dynamics during the formation and evolution of clusters can be followed as well as the evolution of the stars. Previous works which have investigated properties of simulated clusters from an observational perspective include \citet{2019MNRAS.485.3124K}. They developed the MYOSOTIS tool\footnote{\url{https://github.com/zkhorrami/MYOSOTIS}} which estimates a flux for each star, based on its mass, ages and metallicity, distance from the observer and properties of an assumed telescope. The code can also incorporate effects of extinction from gas surrounding the cluster, or a gas cloud between the cluster and the observer. \citet{2021arXiv211111805B} investigate how well properties of clusters such as the degree of clustering and mass segregation (using the INDICATE tool, \citealt{2019A&A...622A.184B}) would be measured using GAIA for a synthetic cluster placed inside a cloud at different distances, and with different binary fractions. Other work focuses on comparing the ages estimated from synthetic SEDs trace to the actual ages of stars in simulations \citep{2016A&A...587A..60F}. Studying the dynamics of clusters, \citet{2021A&A...647A.137J} compute the long term evolution of a Hyades-like cluster, investigating the origin of the shape of the tidal tails of the Hyades cluster. On extragalactic scales, \citet{2021arXiv211114875L} determine the 24 $\mu$m and H$\alpha$ emission from star clusters in a dwarf galaxy simulation, placing the galaxy at different distances to see how the estimated star formation rate varies. In this series of papers we attempt to answer how well observations capture the properties and physics of clusters given limitations of 2D measurements and extinction. Here we explore the impact of 2D perspective effects on the derived properties of clusters. Using a simulation by \citet{liow_collision_2020} of a YMC formed via a cloud-cloud collision between two molecular clouds over a $\sim$0.96\,Myr timescale we follow the spatial and kinematic evolution of the cluster, first utilising the full 6D astrometric parameters, then with only 2D spatial/kinematic data along three different Lines-of-Sight (LoS). This paper is structured as follows. Section 2 details our YMC simulation set-up and cluster dataset. In section 3 we describe our analysis methods, and results are discussed in section 4. Our conclusions are presented in section 5. \section{Data} \subsection{Simulation setup} For the main part of this paper, we use a simulation based on the standard speed, low turbulence and high density cloud-cloud collision model in \cite{liow_collision_2020}. This model is chosen because it produces a compact and roughly spherical cluster at the collision site, which is visually similar to realistic clusters, yet the collision velocity is high enough to strongly determine the location of the stars, and induces highly asymmetric velocities during cluster formation. The mass of the main central cluster formed in the simulation is $\approx 1.8 \times 10^4$ M$_{\odot}$, similar to a YMC. In \citet{2020MNRAS.496L...1D} we argue that cloud-cloud collisions may be one way of producing massive clusters in short timescales, and are in any case more representative of conditions in more extreme environments in our or other galaxies. To check our results are representative, and not dependent on this one model we have chosen, we also perform analysis on the low speed, medium density cloud-cloud collision model, labelled as `L20Turbulent' in \cite{liow_grouped_2021}, which we describe in Appendix\,\ref{results_c1020}. This model is a rerun of the model of the same initial conditions in \cite{liow_collision_2020}, i.e. the model that created Cluster L4, but individual stars are evolved instead of just sink particles. In this previous paper we ran this simulation using \texttt{PHANTOM} \citep{price_phantom_2018}. However since this publication, we have developed the \texttt{Ekster} code \citep{rieder_ekster_2021}. The \texttt{Ekster} code converts sink particles to star particles, sampling from an IMF, which in contrast to most numerical simulations allows us to model the full stellar population of the cluster. Hence to carry out the work we present here, we reran the simulation from \cite{liow_collision_2020}, which used sink particles, but instead used \texttt{Ekster} in order to obtain individual stars. The \texttt{Ekster} code combines multiple physical processes including gas hydrodynamics, gravitational dynamics and stellar evolution via the \texttt{AMUSE} interface \citep{amuse_2018}. \texttt{PHANTOM} \citep{price_phantom_2018}, a smoothed particle hydrodynamics (SPH) code for astrophysics, is used to simulate the gas hydrodynamics in \texttt{Ekster}. \texttt{PeTar} \citep{wang_petar_2020} is used to calculate the gravitational interaction between the stars. Lastly, \texttt{Ekster} uses the parametric stellar evolution code \texttt{SeBa} \citep{portegies_zwart_seba1_1996}. \begin{figure*} \centering \includegraphics[width=0.8\textwidth]{panels.png} \caption{Figure showing our simulated YMC D1050 at 3 different stages of evolution and from different 2D perspectives. The cluster is formed from a z-axis cloud-cloud collision. The cluster is shown at an age of (Top row:) 0.3\,Myr, (Middle row:) 0.6\,Myr and (Bottom row:) 0.9\,Myrs, as seen in the (Left column:) X-Y (Middle column:) Y-Z and (Right column:) X-Z plane. Black dots represent stars and the colour scale denotes gas density.} \label{Fig_simulation} \end{figure*} A full description of the initial setup for our simulation is presented in \cite{liow_collision_2020} but we also include details here for completeness. Initially, two ellipsoidal clouds with minor radii of 7\,pc and major radius of 16\,pc are created and aligned along the major axis. Each cloud has mass of $1\times 10^5$ M$_{\odot}$, which gives an initial cloud density of $2.06 \times 10^{-21}$ g cm$^{-3}$ and a spherical free-fall time of 1.46\,Myr. Each cloud contains half of the $5\times 10^6$ SPH particles used in this simulation. The gas particles are positioned randomly within the gas clouds. To simulate turbulence, we impose two separate initial velocity fields, one on each cloud, which are random, Gaussian and divergence-free. The setup of the clouds is similar to that of \cite{bate_formation_2003}. These turbulent fields are consistent with Burger's supersonic field and Larson's scaling relation, and more details can be found in \cite{liow_collision_2020}. In this simulation, the root-mean-square turbulent velocity is set to about 2.5\,km s$^{-1}$. Lastly, the clouds are given a relative velocity of 25\,km s$^{-1}$ to collide along the major axis. We use the isothermal equation of state to model the collision, as gas in molecular clouds is usually isothermal \citep{dobbs_gmc_sf_2014}. The temperature is kept at 20 K. Following the prescription by \cite{bate_modelling_1995}, we introduce sink particles to replace the dense gas particles when their density exceeds $\rho_{\rm sink} = 10^{-18}$ g cm$^{-3}$. At the point of creation, each sink has an accretion radius of 0.01\,pc. Sinks are converted to stars using a Kroupa IMF \citep{kroupa_2001}, adopting a mass range for stars of 0.01 to 100 M$_{\odot}$. Stars are positioned randomly within the accretion radius of the sink, and with a velocity dispersion similar to the surrounding gas velocity dispersion. We use the grouped star formation in \texttt{Ekster} \citep{liow_grouped_2021}. This is a star formation prescription which first collects the sinks into multiple groups. This allows us to sample massive stars, closer to a full IMF, even if the sinks themselves are low mass. In this model, the grouping parameters used are $d_g=1$\,pc, $v_g=1$\,km/s and $\tau_g = 1.65$\,Myr. In Figure~\ref{Fig_simulation} we show panels from all three orientations (XY, YZ, and XZ) at three different times (0.3, 0.6 and 0.9\,Myr) from the simulation. From the YZ (and XZ) direction stars initially form along the interface of the shock, since the clouds are colliding in the direction parallel to the $z$-axis, however in the XY direction they appear more spherically symmetric. Over time, the distribution of stars contracts along the $x-y$ axes and becomes more spherical as viewed in the YZ and XZ orientations. \subsection{Cluster Set} As detailed above, the simulation provides full 6D phase space (velocities and positions in the XYZ plane) data for each star. To explore how observer perspective and stellar sample incompleteness can impact the correct determination of a cluster’s properties, we generate 4 cluster realisations (Table\,\ref{Tab_clusters}) from the simulation. The first realisation consists of all cluster members with their full 6D phase space data intact, which will be used as a baseline for our analysis. Second, third and fourth realisations are created from the 2D data in each plane (XY, YZ, XZ) and represent how the cluster would appear if viewed as a 2D object in the XY, YZ and XZ planes. For these realisations all members are included, but only 4D phase space data is available for each star (i.e. 2D velocities and positions in the respective plane). For each realisation, 66 snapshots of the cluster are taken at 0.01\,Myr intervals between 0.30-0.96\,Myr. \begin{table} \caption{List of cluster realisations, phase space parameters and which stars these parameters are available for. \label{Tab_clusters} } \centering \begin{tabular}{c | c | c } \hline\hline Name & Phase Space & Availability \\ \hline D1050 & $X, Y, Z, V_{x}, V_{y}, V_{z}$ & All Members\\ D1050XY & $X, Y, V_{x}, V_{y}$ & All Members\\ D1050YZ & $Y, Z, V_{y}, V_{z}$ & All Members\\ D1050XZ & $X, Z, V_{x}, V_{z}$ & All Members\\ \hline \end{tabular} \end{table} \section{Method} We use the following tools to identify features and characterise behaviours in the spatial and velocity parameter spaces of the cluster. \subsection{INDICATE}\label{sect_indicate} We quantify stellar member's degree of association using the 2+D INDICATE\footnote{\url{https://github.com/abuckner89/INDICATE}} tool introduced by \citet{2019A&A...622A.184B}. The tool works by examining the local stellar spatial concentration around each star, comparing this to the expected value if the star were not clustered, then assigning an index value to each star accordingly. Advantageously, INDICATE is robust against edge effects, outliers, and there is no dependence between the index cluster shape, size or stellar density (see \citealt{2019A&A...622A.184B} for a discussion). Index values are derived as follows. An evenly spaced uniform (i.e. definitively non-clustered) control distribution is generated across the parameter space of the cluster with the same number of members as the cluster. For every star $j$ the mean Euclidean distance, $\bar{r}$, to its $5^{th}$ nearest neighbour $i$ in the control is determined in n-dimensional space i.e. \begin{equation} \\ r_j^2=\sum_{d=1}^{n}(j_{d}-i^{con}_{d})^{2} \end{equation} thus, \begin{equation} \\ \bar{r} = \frac{1}{N_{tot}} (\sum_{j=1}^{N_{tot}} r_j) \end{equation} \begin{figure} \centering \includegraphics[width=0.42\textwidth]{dbscan_diagram2.jpg} \caption{Visual demonstration of how the DBSCAN algorithm works. For each star, the area within radius $\epsilon$ is searched for neighbours. If the number of neighbours is greater than MinPts-1 the star is identified as a `core' star of the subcluster (green in plot). If a star is within the search radius of a core star and (i) has more than MinPts-1 neighbours it is also designed a core star, (ii) has less than MinPts-1 neighbours it is designated a `border' star (blue in plot). Else, the star is identified as `noise' (red in plot).} \label{Fig_dbscan} \end{figure} where $N_{tot}$ is the total number of cluster members, $n$ the number of dimensions of the parameter space, and $x$ the component of position along dimension $v$. The index of star $j$ is then calculated as the ratio of the actual and expected number of nearest neighbours to star $j$, such that \begin{equation} \label{eq_I} \\ I_{5,j}= \frac{N_{\bar{r}}}{5} \end{equation} where $N_{\bar{r}}$ is the actual number of nearest neighbours to star $j$ in the cluster, and $I_{5,j}$ is the unit-less index of the star with a value range of $0 \le I_{5,j} \le \frac{N_{tot}-1}{5}$. The higher the value of $I_{5,j}$ the greater the star’s degree of association. Calibration with random distributions is performed to identify index values which denote a star is spatially clustered (rather than randomly distributed). For a cluster, the mean index value, $\bar{I_5}^{random}$, of 100 realisations of a random distribution generated across the parameter space with $N_{tot}$ points is determined. Cluster star $j$ is then spatially clustered if it is greater than the significance threshold, defined as \begin{equation}\label{eq_IjIsig} \\ I_{5,\,j}> I_{sig} \text{\,,\,\,\,\,\,where\,\,\,\,\,} I_{sig}=\bar{I_5}^{random}+3\sigma \end{equation} where $\sigma$ is the standard deviation of $\bar{I_5}^{random}$. Using this criteria, $99.7\%$ of stars that are distributed in a spatially random configuration will have an index value below the significance threshold ($I_{5,j}<I_{sig}$). An advantage of INDICATE is that in addition to exploring the spatial behaviours of the general populous, it can reliably detect and quantify signatures of Type I and Type II mass segregation in clusters \citep{george_indicate_paper} defined respectively as the concentration of (i) high mass stars typically at the centre of a cluster and ii) lower-mass stars around high-mass (which are not necessarily concentrated together). This is because the index is calculated for every star, and its value represents the strength of the stellar concentration in its local neighbourhood. Therefore, if INDICATE is run on the entire population the values of the high-mass stars by definition provide a measure of (i). If INDICATE is run on just the massive population of the cluster, the index represents the relative concentration strength of high-mass stars with each other, thus providing a measure of (ii). \begin{figure*} \centering \includegraphics[width=0.5\textwidth]{Evolution_percent_clustered_all_2D_3D.jpg}\hfill \includegraphics[width=0.5\textwidth]{Evolution_median_index_clustered.jpg}\hfill \includegraphics[width=0.5\textwidth]{Evolution_median_index_clustered_XYZ.jpg} \caption{This figure shows the results of the INDICATE analysis as a function of cluster age in 2D and 3D. (Left:) Percentage of members found to be spatially clustered, which is consistently underestimated in the 2D perspectives. Median index value of stars identified as spatially clustered in (Middle:) 3D and (Right:) each of the 2D perspectives. Index values derived for the 2D are underestimated with respect to 3D but trends are preserved.} \label{Fig_index_all} \end{figure*} \subsection{DBSCAN} We employ the Density-Based Spatial Clustering of Applications with Noise (DBSCAN; \citealt{Ester96adensity-based}) algorithm to detect discrete subclusters of stars in the datasets, chosen for this work as it tends to be favoured by observers to quantify structure in cluster regions (\citealt{2014RAA....14..159G}, \citealt{2017A&C....18....1B}, \citealt{2019ASPC..523...87J}, \citealt{ 2019A&A...628A.123Z}, \citealt{2020BAAA..61R...80A}, \citealt{2021PASJ...73..652G}, \citealt{2021A&A...647A..14G}, \citealt{ 2021ApJS..254...20L}, \citealt{2021PASJ...73..652G}) perhaps because it offers several advantages over other well-established clustering algorithms. First, it does not require a priori knowledge of the number of clusters in a region as this is determined by the algorithm itself. This is particularly apt in star formation regions where the structure is often complex and the number of subclusters is not easily ascertained by visual inspection. Second, the shape of found subclusters is not necessarily spatially symmetric; again advantageous in regions of complex structure. Third, not all stars are assigned to a subcluster and can be identified as ‘noise’ (i.e. part of a wider distributed population), and DBSCAN is also robust against outliers. Finally, the algorithm’s output distinguishes between ‘core’ (central) and ‘border’ (edge) stars in each subcluster which can be useful if, for example, further kinematic study is later undertaken. In this context the definition of ‘subcluster’ is a discrete spatial grouping of stars at a density greater than random expectation, not a definitively gravitationally bound grouping (though this may be true as well). Indeed, it is possible for DBSCAN to find spatial groupings of stars which subsequent kinematic study will show are not a physical grouping. However the goal of this work is to investigate the influence of 2D orientation on perceived properties of the cluster, using tools typically used by observers, rather than determine how well those tools produce physically motivated clusters or subclusters. The impact of sample incompleteness on perceived cluster properties will be subject of Paper II in this series. DBSCAN works as follows. For each star, a search is performed for neighbours within radius $\epsilon$. If a star has a total number of neighbours (self-included) greater than or equal to a user-set minimum, MinPts, the star is designated as part of the core of the subcluster. If a star is within the search radius of a core star but has less neighbours than the minimum, it is designated a `border' star of the subcluster. If a star fails to meet the criteria to be either a core or border star, it is designated ‘noise’ (see Figure\,\ref{Fig_dbscan}). The values of MinPts and $\epsilon$ are free parameters set by the user. As a general rule MinPts should be set at $\ge D+1$ where $D$ is the dimension of the dataset (i.e. $\ge3$ for 2D, and $\ge4$ for 3D, datasets). In this work we follow the prescription of \citet{jrg1998densitybased} to set MinPts$=2\times\,D$. To derive the optimal value of $\epsilon$ we: \begin{enumerate} \item determine the distance to the MinPts$^{th}$ nearest neighbour for each star (k-distance) \item order the distances from shortest to longest, then number the stars \item plot star number vs. k-distance \item $\epsilon$ is equal to the k-distance which corresponds to the maximum curvature of the line, found using the \texttt{KneeLocator} class of the \texttt{kneed} Python package. \end{enumerate} \subsection{Q}\label{sect_q} To distinguish between a fractal, random and radial density gradient spatial configuration of the cluster, we use the $\mathcal{Q}$ parameter by \citet{2004MNRAS.348..589C}. This parameter is defined as the ratio between the Normalised Mean Edge Length $\bar{m}$ and Normalised Correlation Length $\bar{s}$ of cluster members i.e. \begin{equation} \\ \mathcal{Q}=\frac{\bar{m}}{\bar{s}} \end{equation} where $\bar{s}$ is the mean Euclidean distance between members divided by the cluster’s radius; and $\bar{m}$ is calculated from the Minimum Spanning Tree of members positions as the mean branch length divided by a normalisation factor of \begin{equation} \\ \sqrt{\frac{A}{N_{tot}}} \text{\;\;\;\;\;\;\;\;(for 2D)} \end{equation} \begin{equation} \\ \sqrt[3]{\frac{V}{N_{tot}}} \text{\;\;\;\;\;\;\;\;(for 3D)} \end{equation} with $A$ and $V$ the area and volume of the cluster respectively. When applied to 2D positional data, values of $\mathcal{Q}<0.8$, $\mathcal{Q}\approx0.8$ and $\mathcal{Q}>0.8$ indicate a cluster has a fractal, random and radial density gradient configuration respectively \citep{2004MNRAS.348..589C}. When applied to 3D positional data, the boundary values distinguishing fractal, random and radial density gradient configurations are slightly lowered at $\mathcal{Q}<0.7$, $\mathcal{Q}\approx0.7$ and $\mathcal{Q}>0.7$ respectively \citep{2009MNRAS.400.1427C}. \subsection{Velocity Analysis} We determine if the cluster is expanding or contracting through inspection of the directional velocities of stellar members. If expanding, the majority of stellar velocities, $v_{*}$, should be directed outwards from the cluster centre; and if contracting, directed inwards. Therefore, following the prescription of \citet{2019ApJ...870...32K}, we express the stellar velocities of all stars in terms of their outward velocities, $v^{*}_{out}$, w.r.t the cluster centre \begin{equation}\label{Eq_vout} \\ v^{*}_{out}=\vec{v}_{*}\cdot \hat{r}^{n} \end{equation} where $\hat{r}^{n}$ is the n-dimensional outward component of velocity \begin{equation} \\ \hat{r}^{n}=(r_{1},r_{2},….,r_{n}) \end{equation} and derive the median outward velocity, $\tilde{v}_{out}$, for the cluster. Negative values of $\tilde{v}_{out}$ denote cluster contraction, and positive values expansion. \subsection{The O-ring function} The O-ring function measures the mean surface density of objects at a distance $r$ from an object, averaged over all objects. Practically this has to be calculated over an annulus, whose area we define as $A(r)$ and half width as $q$. This leads to the definition we will use in this paper, \begin{equation} \\ \mathcal{O}(r)={\frac{2}{N_{\rm tot} A(r)}}{\sum_{i=1}^{N_{\rm tot}}}{\sum_{j>i}^{{N}_{\rm tot}}}I_{r}(i,j). \label{eqn_oring} \end{equation} Here $I_{r}(i,j)$ is a selection function which takes the value one if the distance between star particles $i$ and $j$ lies between $r-q$ and $r+q$, otherwise it is zero. In some form this function has been applied to a wide range of problems. In ecology it is used to test the spatial scales at which distributions deviate from complete spatial randomness by comparison with simulation \citep[e.g.][]{2004Oikos...104...209W}. In an astronomical context it has been demonstrated to be a useful test of whether a distribution of sources is random \citep{2019MNRAS.487..887R} or in an adapted form whether a distribution follows a particular generating function \citep{2021MNRAS.507.1904R}. In this paper however, we will use Equation \ref{eqn_oring} in a similar way to \cite{1995MNRAS.272..213L} and \cite{1997ApJ...482L..81S} to examine the spatial scales on which clustering occurs, rather than as a test of significance, and hence will refer to the O-ring function, rather than (as used in some contexts) the O-ring statistic. Changes in gradient in the O-ring function indicate where the distribution has a characteristic length scale, whereas a straight line indicates a power law (and therefore scale-free) relationship between density and distance. To compare the results of the simulation in two and three dimensions a three-dimensional version of the O-ring function is needed. We achieve this by the straightforward translation of Equation \ref{eqn_oring} into three dimensions by using the the three dimensional distance for $r$, and replacing $A(r)$ by the volume enclosed between spheres of radius $r-q$ and $r+q$. Alternatively we could have used the two-point correlation function widely used in cosmology, but as explained in \citep{2019MNRAS.487..887R} and \cite{1995MNRAS.272..213L} the O-ring function is more intuitive in this context. \section{Results} In this section we discuss the cluster's spatial and kinematic properties as determined from the full 6D and (2+2)D data to assess the impact of perspective effects and whether the evolution appears qualitatively similar irrespective of these. Comparative visualisations of the results discussed below are provided in Figures\,\ref{Fig_index_all}-\ref{Fig_fcorrect}. We first provide a description of the properties of the cluster using the 6D data in Section\,\ref{results_3D}, before comparing those derived from the limited (2+2)D data in Section\,\ref{results_2D}. \begin{figure} \centering \includegraphics[width=0.47\textwidth]{Evolution_vout.jpg} \includegraphics[width=0.49\textwidth]{Evolution_1D_vxyzout.jpg} \caption{This figure shows the (Top:) expansion velocity from 0.30-0.96\,Myrs for D1050, D1050XY, D1050YZ and D1050XZ; and (Bottom:) mean 1D directional velocity along the X, Y and Z axes. Positive values indicate expansion, negative contraction, and zero a static state (marked by the horizontal black dot-dash line).} \label{Fig_vout} \end{figure} \subsection{Overview of D1050}\label{results_3D} Figure\,\ref{Fig_index_all} shows the fraction of stars clustered (left) and the median index value of clustered stars (centre, right) versus time, as given by INDICATE. As shown in Figure\,\ref{Fig_index_all}, for the full 6D case there is a gradual increase in both the proportion of stars spatially clustered, and the degree of their associations, as the system evolves. In the first snapshot at 0.30\,Myr, $95.7\%$ of members are clustered, with a median index value for the population of $\tilde{I}_5=10.2$; but by 0.96\,Myr $99.2\%$ of members are spatially clustered and $\tilde{I}_5=100.0$. This suggests the cluster initially forms with the majority of its population in relatively loose spatial concentration(s), then shortly thereafter the spatial configuration rapidly and significantly changes such that a higher proportion of the population is in spatial concentration(s) that typically increase their degree of association by a factor of $\sim§10$. We perform a two sample Kolmogorov–Smirnov Test (2sKST) with a strict significance boundary of $p < 0.01$ to test whether the distributions are distinct and our assertion is correct. Retrieving $p<<0.01$, we reject the null hypothesis: the spatial behaviours of stars at 0.30\,Myr and 0.96\,Myr are distinct and the spatial configuration of the cluster does indeed significantly reconfigure. In regards to the nature of the spatial reconfiguration, we find that the evolution of the cluster is not driving it towards a centrally concentrated structure, but rather an increasingly dense clumpy one. As seen in Figure\,\ref{Fig_simulation}, at later times the central $\sim 2$ pc region is more densely filled with stars, which INDICATE shows are in clumpy structures. The increase in stars in the centre is the result of both ongoing star formation and a collective inward stellar motion. This motion is confirmed by our velocity analysis (Fig.\,\ref{Fig_vout}) and shows a sustained, accelerating, contraction of the system. Evidence for a heavily substructured configuration is provided by the number of distinct subclusters identified, which increases from 96 at 0.30\,Myrs to 837 at 0.96\,Myrs (Figure\,\ref{Fig_ncl}) while the fraction of the population within these subclusters slightly decreases from $97\%$ to $95\%$. Moreover, the cluster's $\mathcal{Q}$ value undergoes a steady increase but remains firmly $<<0.7$ at all age steps, that is, the density gradient remains in a fractal configuration as the cluster evolves. The O-ring functions in the upper panel of Figure \ref{Fig_oring_comb} confirm the growing density of the sub-clusters. In a thought experiment where stars are born at random positions in the simulation and do not move far from their birthplaces we would expect to see a uniform rise in the density, instead of which the O-ring functions show no rise at the shortest length scales, and the largest growth in density at about 0.2\,pc from other stars. Stars may be more likely to be born around 0.2\,pc from other stars as this length scale is similar to the Jeans length of the region, ( $\approx$ 0.38\,pc), which means that gravitational instability is likely to occur on these length scales. If Type I mass segregation is present the majority of massive stars should be spatially clustered with other high mass members. As shown in Figure\,\ref{Fig_MS_i} we find mass segregation to be present at all cluster ages. As the cluster evolves there is an increase in high mass stars spatially clustered together from $63.0\%$ to $94.5\%$, and the tightness of the clustering increases by a factor of $\sim21$. The prominent increases at $\sim 0.9$\,Myrs in both the number of stars clustered, and the tightness of this clustering, coincide with the onset of gravitationally driven star formation in the cluster. Examination of the positions of massive stars suggest they are forming in relative isolation towards the outer edges of the (high mass) stellar distribution, even after the onset of gravitationally driven star formation, then dynamical evolution is driving them to spatially cluster together along the collision axis in an asymmetric clumpy amalgamation ($Q<0.7$). If Type II mass segregation is present the majority of high mass stars should be clustered in stellar concentrations with other members, and the intensity of these concentrations should be significantly greater than those of the low/intermediate mass (LIM) population. As shown in Figure\,\ref{Fig_MS_ii} we find that initially most, but proportionally fewer, massive stars are in stellar concentrations than LIM stars and that typically the intensity is the same for both populations (i.e. no mass segregation is present). After $\sim\,0.75$\,Myrs the majority of high mass stars are still clustered but the proportion is now equivalent to the LIM population, and the typical intensity for massive stars is significantly greater (confirmed by a 2sKST). This suggests that high mass stars are initially more likely to form in isolated areas than their lower mass counterparts, but generally form in areas of comparable stellar concentrations, then as the cluster evolves most are mass segregated but a small number make up part of the dispersed population. Again, the notable spike in the tightness of clustering at $\sim 0.9$\,Myrs is consistent with the onset of gravitationally driven star formation in the cluster \citep[see the Mach 50 collision star formation rate line in first row, third column of Figure 5 in][]{liow_collision_2020}. As expected the above analysis using the full 6D data agrees with the evolution visually observed to occur in the simulation: stars initially form along the interface of the shock and the clustering is dominated by the initial positions of the star particles as spatially separate sinks (Figure\,\ref{Fig_simulation} top left panel) are formed and converted into discrete clusters. Over time gravitational collapse dominates and the star formation occurs preferentially in one main cluster centred about the collision axis, with the result that rather than seeing discrete areas of star formation, stars cover most of the central $\sim 2$ pc radius area (Figure\,\ref{Fig_simulation} middle and lower panels). The large increase in the degree of stellar association that occurs at $\sim 0.9$\,Myr in Fig.\,\ref{Fig_index_all} potentially marks the increase in star formation across the region due to gravitational collapse rather than the previously dominant collision-based formation.\\ \begin{figure*} \centering \includegraphics[width=0.49\textwidth]{Summary_Num_cl_DBSCAN_3D.jpg}\hfill \includegraphics[width=0.5\textwidth]{Summary_Num_cl_DBSCAN_2D3D_Diffclusters.jpg}\hfill \includegraphics[width=0.5\textwidth]{Summary_Percent_DBSCAN_2D3D_clusters.jpg} \caption{This figure shows the results of the DBSCAN analysis as a function of cluster age in 2D and 3D. (Left:) The number of subclusters found using the full 3D spatial information and (Middle:) in 2D with respect to 3D where $\Delta N_{SC} =0$ means the same number of subclusters were found in the 2D and 3D data, and $\Delta N_{SC}>0$ means the number of subclusters is overestimated in 2D. (Right:) The percentage of the population found to be in subclusters.} \label{Fig_ncl} \end{figure*} \begin{figure} \includegraphics[width=0.49\textwidth]{xyz.pdf} \includegraphics[width=0.49\textwidth]{xy_xz.pdf} \caption{ The density of stars as a function of radius derived from the O-ring function in (Top:) 3D and (Bottom) 2D. The O-ring functions are shown from 0.3\,Myr (lowest curve on right-hand side) to 0.9\,Myr (highest curve on right-hand side) in 0.1\,Myr steps. } \label{Fig_oring_comb} \end{figure} \subsection{2D Analysis}\label{results_2D} \subsubsection{Clustering} Viewed from different orientations, the perceived spatial behaviour of the stars varies. As seen in Figure\,\ref{Fig_simulation}, D1050XY has a notably different spatial symmetry compared to the other orientations being disk-like in appearance rather than elongated, and the distribution of the stars (especially at early times) is quite different also. The percentage of stars which are spatially clustered progressively decreases from 0.41\,Myrs in D1050XY, whilst for D1050YZ and D1050XZ there is an initial decrease which is followed by an increase at 0.53 and 0.89\,Myrs respectively (Figure\,\ref{Fig_index_all}). All have lower percentages of clustered stars compared to D1050, the 3D results. Despite this, all three orientations display broadly similar spatial behaviour as the system evolves. There is a steady increase in stars' degrees of association and a rapid increase at $\sim 0.9$\,Myr (consistent with the 6D results). Typically stars appear to increase their degree of association by a factor of $\sim$2.5-4, depending on perspective. Similar to the 3D case, 2sKSTs tests confirm a distinct change in the spatial behaviours of stars between 0.30\,Myr and 0.96\,Myr is observed in each orientation and that spatial reconfiguration occurs. The number of subclusters identified in D1050YZ and D1050XZ is underestimated w.r.t the actual number present until $\sim0.8$\,Myrs, when thereafter the number is overestimated but the proportion of stars found to be in subclusters is consistent with that found in the 3D case (Figure\,\ref{Fig_ncl}). This suggests the increased degree of stellar association of the cluster at this time has resulted in the detection of some real singular subclusters as numerous smaller ones with some of the real members wrongly assigned to the dispersed field. A similar effect is observed in D1050XY where the number of subclusters found is consistently overestimated w.r.t. the number actually present, but after 0.9\,Myrs there is a marked increase in the overestimation and to a degree similar to that of D1050YZ and D1050XZ. At ages $<0.35$\,Myrs the fraction of the population within the found subclusters is underestimated by up to $12\%$ in each orientation. However as shown in the right panel of Figure\,\ref{Fig_ncl} (with the exception of the above discussed deviations) the fraction of stars in subclusters is typically consistent and correct. We compared the membership of the subclusters in the 2D versus the full 3D spatial data: were stars being correctly grouped together? Figure\,\ref{Fig_fcorrect} left panel shows the fraction of subclusters which are identified with exactly the same members as found in the 3D perspective. Indeed, for all 2D perspectives this fraction is typically small. For D1050XY the fraction of correctly identified subclusters – that is consist exclusively of (and include all) true member stars – is greatest but decreases as the cluster evolves, from a peak of $56.3\%$ at 0.36\,Myrs to just $3.4\%$ by 0.96\,Myrs. For D1050YZ and D1050XZ, the fraction peaks at $<14\%$ before 0.36\,Myrs and declines to $\sim2\%$ by 0.96\,Myrs. Most subclusters found typically consist exclusively of some (but not all) true members or are an amalgamation of dispersed stars, stars which are in a real subcluster together and/or stars which are in different real subclusters. However some subclusters seen in 2D are true asterisms, consisting entirely of stars which come from the dispersed field. This is seen in Figure\,\ref{Fig_fcorrect} middle panel, where we show typically between $1.5-4.2\%$ of subclusters found in the 2D orientations consist entirely of members identified as part of the dispersed field in the 6D analysis. Interestingly, after 0.9\,Myrs the number of subclusters found in this category drops for D1050XY, suggesting that the additional subclusters found in this orientation at these times are less likely to be misidentified small collections of field members in the line-of-sight than at earlier stages. On the other hand, some real subclusters had all members assigned to different subclusters and/or the field in the 2D perspectives, i.e. they were completely missed in the 2D analysis. As shown in Figure\,\ref{Fig_fcorrect} right panel, the fraction of affected subclusters is negligible but more inclined to occur at later times, potentially due to confusion caused by the increased cluster density. \subsubsection{Kinematics} Figure\,\ref{Fig_vout} shows the expansion velocity as measured from our 2D/3D perspectives in the top panel, and the mean 1D expansion directional velocities in the bottom panel. Overall, the 2D perspectives generally show that the cluster is contracting. We see that the strongest contraction occurs along the $X$-axis while the cluster expands along the Z-axis for the majority of its evolution. Correspondingly the 2D perspective D1050XY (which neglects the $Z$-axis velocities) shows the strongest contraction - by 0.96\,Myrs a factor of 3.3 greater than D1050XZ which exhibits the least. As the cloud-cloud collision occurs along the $Z$-axis, these perspective differences are representative of the gas having initially higher velocities in this direction. Although the gas shocks, the velocity field is turbulent and the structure of the shock is asymmetric with non-zero velocities (to contrast with the case of uniform non-turbulent gas; see \citealt{2020MNRAS.496L...1D}). The $X$- and $Y$- axes are in the plane of the shock so their initial gas velocities are lower, hence the cluster more readily contracts in these directions and D1050XY shows the greatest contraction. Due to the asymmetry of the turbulent velocity fields, velocities in the $Y$-axis are lower than those of the $X$-axis (Figure\,\ref{Fig_vout}) which, combined with the expansion in the Z-axis, results in D1050XZ exhibiting the least contraction - while the developing shock causes a perceived expansion in this perspective until $0.63$\,Myrs. \begin{figure*} \centering \includegraphics[width=0.49\textwidth]{Evolution_percent_clustered_all_2D_3D_Massive_typei.jpg}\hfill \includegraphics[width=0.49\textwidth]{Evolution_median_index_clustered_Massive_typei.jpg}\hfill \includegraphics[width=0.49\textwidth]{Evolution_median_index_clustered_XYZ_Massive_typei.jpg} \caption{These panels shows signatures of Type I mass segregation found by INDICATE as a function of cluster age in 2D and 3D. (Left:) Percentage of high mass stars which are mass segregated. The strength of their spatial association is denoted by the median index value of the mass segregated stars, derived for the (Middle:) 3D and (Right:) 2D perspectives. Both the degree and strength of the segregation is underestimated in 2D w.r.t 3D, but trends are preserved.} \label{Fig_MS_i} \end{figure*} \begin{figure*} \centering \includegraphics[width=0.4\textwidth]{Evolution_percent_clustered_typeii_3D.jpg} \includegraphics[width=0.4\textwidth]{Evolution_median_index_clustered_typeii_3D.jpg}\hfill \includegraphics[width=0.4\textwidth]{Evolution_percent_clustered_typeii_XY.jpg} \includegraphics[width=0.4\textwidth]{Evolution_median_index_clustered_typeii_XY.jpg}\hfill \includegraphics[width=0.4\textwidth]{Evolution_percent_clustered_typeii_YZ.jpg} \includegraphics[width=0.4\textwidth]{Evolution_median_index_clustered_typeii_YZ.jpg}\hfill \includegraphics[width=0.4\textwidth]{Evolution_percent_clustered_typeii_XZ.jpg} \includegraphics[width=0.4\textwidth]{Evolution_median_index_clustered_typeii_XZ.jpg}\hfill \caption{These panels show the results of the INDICATE analysis for the High Mass (HM, dotted line) and Low/Intermediate Mass (LIM, solid line) populations as a function of cluster age in (Top Row:) 3D and 2D (Upper Middle Row:) X-Y, (Lower Middle Row:) Y-Z, (Bottom Row:) X-Z planes. Plots of (Left Column:) percentage of populations identified as spatially clustered and (Right Column:) median index value of clustered stars.} \label{Fig_MS_ii} \end{figure*} \subsubsection{Mass Segregation} Signatures of Type I mass segregation are weakened in all 2D orientations. Figure\,\ref{Fig_MS_i} shows that while general trends are preserved, values are consistently underestimated. The disparity between the actual and perceived fraction of segregated stars is most profound in the earlier stages of the cluster’s evolution, with the greatest disparity occurring at ages $<0.4$\,Myrs. This issue is particularly apt for D1050XY and D1050YZ where initially as few as a quarter of clustered stars ($<50\%$ total population) are identified as mass segregated compared to the 3D case, most likely due to the highly clumpy nature of the stellar distribution at this stage and its prominence in these orientations. Consequently the cluster would be incorrectly interpreted as initially having no/very weak signatures of mass segregation at $<0.4$\,Myrs when viewed from these perspectives. Furthermore, we find that the degree of association between high mass stars is consistently determined to be about half that of the 3D analysis for all 2D perspectives and time-steps. Examination of the 2D positions of massive stars correctly identifies that they are forming in relative isolation away towards the outer edges of the high mass spatial distribution, but not that they are ultimately clustering into an asymmetric clumpy amalgamation ($Q\approx0.8-0.9$ for $T>0.92\,$Myrs in D1050YZ and D1050XZ, $T>0.84\,$Myrs in D1050XY). However, as trends in the degree of association are consistent with the 3D perspective, and the majority of the population are perceived to be clustered, at ages $>0.4$\,Myrs the cluster would be correctly interpreted to possess signatures of mass segregation. Figure\,\ref{Fig_MS_ii} shows the general trends of the 3D Type II mass segregation analysis are preserved in the 2D perspectives but signatures are weakened. In all orientations the majority of massive stars are in stellar concentrations and initially this is proportionally less than for the LIM population, becoming equivalent between $\sim$0.65-0.80\,Myrs depending on orientation. The proportion of the two populations which are clustered at any given time is consistently underestimated in 2D (by how much varies with orientation). Evolutionary features of the tightness of this clustering for the two populations are preserved as initially they have similar degrees of association, then between 0.4-0.6\,Myrs (depending on orientation) massive stars gain relatively more intense spatial associations, and a rapid increase for both populations occurs after 0.9\,Myrs. Again, while specific values are mostly consistent between the different orientations there is some variation, and the values can be up to 8.5 times smaller than those obtained in the 3D analysis. A 2sKST confirms that once equivalent proportions of the two populations are clustered is achieved the perceived degree of association for the massive stars is significantly greater than the LIM stars in all three orientations. Therefore we find that broadly the correct conclusions are reached in the 2D perspectives: initially no mass segregation is present and high mass stars are more likely to form in isolated areas than their lower mass counterparts but do typically form in areas of comparable stellar concentrations. Later, most massive stars are mass segregated but there is a minority that are part of the dispersed population. The small variations in the age at which changes in the spatial behaviour occur are attributable to differences in the perceived stellar distribution at different cluster orientations. \begin{figure*} \centering \includegraphics[width=0.49\textwidth]{Frac_clusters_actually_correct.jpg}\hfill \includegraphics[width=0.49\textwidth]{Frac_2Dclusters_noise.jpg}\hfill \includegraphics[width=0.49\textwidth]{Frac_cl_mems_alldiffcls.jpg} \caption{Plot of fraction of subclusters (Left:) found in 2D that were also found in 3D with the same members; (Middle:) found in 2D for which all members were identified as part of dispersed population in 3D; (Right:) not found even partially in 2D that were present in the 3D data.} \label{Fig_fcorrect} \end{figure*} \subsubsection{Spatial Structure} In all 2D orientations, the apparent density gradient of the cluster is correctly identified as undergoing a steady increase as the cluster evolves but remaining in a fractal distribution ($\mathcal{Q}<0.8$). However, the degree of fractal substructure appears reduced. The lower panel of Figure\,\ref{Fig_oring_comb} shows the 2D O-ring functions. The shortest length-scale shown (0.01\,pc) corresponds to the size of a sink. At the longest scales the curves end when the number of particles becomes too small ($<$50) to yield meaningful results. A good illustrative curve is the X-Y projection of D1050 at 0.3\,Myr shown as the lower blue curve in bottom panel of Figure\,\ref{Fig_oring_comb}. The gradient changes between $10^{-2}$ and $10^{-1}$\,pc, and again around 1\,pc. The latter represents the edge of the whole simulation, whilst the former between $10^{-2}$ and a few times $10^{-2}$\,pc is the spatial scale of the sub-clusters. The reason for the flat region on spatial scales around 0.3\,pc and rather sharp gradient change at $10^{-1}$\,pc, both of which are largely absent from the 3D results, is the projection into 2D of many stars unrelated to the sub-cluster being measured. We can see this projection effect is much more serious in the X-Z plane where the overall surface density is higher; it raises the surface density of unrelated stars to be comparable to that of the sub-clusters on which they are superimposed. This effect also becomes more significant as the simulation evolves to higher density, and the density contrast becomes weaker. \cite{bate_msdc} made a similar point, that one should expect a gradient change in the O-ring function when the density of objects of interest falls to the density of background objects. Despite this there is still a change of gradient between $10^{-2}$ and a few times $10^{-2}$\,pc in 2D, which corresponds to the spatial scale seen in 3D, showing that even in these rather adverse circumstances the O-ring function is correctly locating the sub-structure scale. \section{Discussion and Conclusions} With the recent early release of the third instalment of the Gaia survey (EDR3; \citealt{2021A&A...649A...1G}), increasing numbers of clusters have full 3D kinematic information. However there are still many young clusters for whom the high extinction from their natal clouds is impenetrable for optical surveys, meaning infrared data (which often lack the 3D kinematics for members) must be used instead. Three dimensional positional information is even rarer, since Gaia parallaxes usually cannot place a star radially within a cluster to the precision required. As such 2D spatial-kinematic analysis remains a popular method, and sometimes is the only viable option, to determine cluster properties. It is therefore imperative to gain a better understanding of the impact of perspective effects and how representative the properties derived in these studies are of the true cluster properties. In this work we have explored this issue by deriving the properties of a simulated cluster from the 6D data and comparing with those derived using only (2+2)D data for the cluster in different orientations. The cluster we study here is formed via a cloud-cloud collision. We analyse this cluster partly because the collision naturally induces asymmetry in the resulting cluster making it a clear test of differences between 2D and 3D. We also check our results with a second example simulated cluster. Our analysis shows that the same qualitative conclusions tend be reached when viewing clusters in 2D versus 3D, but that quantitative conclusions when viewing in 2D are likely to be inaccurate. Arguably the greatest divergence between the true properties of the cluster and those derived using 2D data occurs in the perceived kinematics. As a consequence of the cloud- cloud collision, from which the stars are formed, the cluster is collapsing along the X- and Y- directions and expanding in the Z-direction for the majority of its traced evolution. Subsequently as the LoS orientation of the cluster is altered, contradictory determinations as to whether the cluster is expanding or contracting are made. In reality, the cluster is undergoing overall collapse between 0.3-0.96\,Myrs, which is correctly identified in the XY and YZ planes (albeit with variation in the collapse velocity), but in the XZ plane the cluster is perceived to expand until $\sim$ 0.65\,Myrs. This suggests that in the absence of 3D velocities, caution is warranted when evaluating cluster expansion/contraction from proper motions alone. This is particularly apt for young clusters which haven’t yet undergone dynamical relaxation (have an uncertain 3D shape) and/or their initial formation mechanism is unknown (differential expansion/contraction along each axis may be present). Prior to $\sim$ 0.9\,Myrs the dominant mode of star formation in our cluster is through the collision, and while the stellar density steadily increases as the cluster evolves it remains relatively low. During this phase, despite striking differences in the visual appearance of the cluster in each orientation, the apparent spatial association of stars, changes in the degree of subclustering, perceived stellar distribution (fractal, random or radial density gradient) and mass segregation present are consistent across 2D perspectives and 3D trends are also preserved (albeit with alteration to/variation in specific values in both cases). The main discrepancies in properties determined during this phase in 2D from those of 3D, are: (i) the apparent fraction of the various populations (general, massive and low/intermediate stars) spatially clustered and how this fraction evolves with the cluster; (ii) the number of perceived subclusters, which can also dramatically differ depending on 2D orientation perspective and (iii) stellar memberships of subclusters. The majority of subclusters found in the 2D data are wrongly inferred (asterisms, amalgamations of real subclusters and/or dispersed population members, individual real subclusters identified as multiple subclusters, only partial membership of real subclusters found etc.). While a negligible fraction of real subclusters are completely missed, the fraction of real subclusters correctly identified decreases as the cluster evolves to around $4\%$ by 0.9\,Myrs. Post 0.9\,Myrs, gravitationally driven star formation becomes significant, which together with collision-induced star formation increases the overall star formation rate and the stellar density rapidly increases. During this phase, the relative accuracy and consistency of properties derived from different orientations is reduced. For example the subcluster spatial scale becomes difficult to identify against the increasing background density. While trends in the apparent spatial association and perceived distribution of stars are generally preserved across the 2D perspectives, and there is less discrepancy between the number of perceived subclusters in the 2D orientations, the accuracy of subcluster stellar membership continues to decline. The latter can most easily be demonstrated from \citet{Balfour2015} figures 2 and 3, who perform simulations similar to ours but with lower turbulence. From one perspective the gas forms a network of filaments, but from the edge on perspective the shock interface spans the dimension of the clouds (similar to X-Y versus X-Z in Figure~\ref{Fig_simulation}). We chose to limit our 2D analysis to just three perspectives: the XY, YZ and XZ planes, despite that clusters can potentially be in any orientation in the LoS of an observer. Orientating the cluster to have a LoS in-between the planes therefore gives it an apparent shape which is a ‘hybrid’ of these three extremes. We also chose a relatively extreme case; differences from 2D perspectives may likely be smaller generally. Additional observational biases, such as sample incompleteness, were not considered in our analysis as these are outside the scope of this work. The purpose of the present study was to assess the impact of 2D projection on derived cluster properties, so by not introducing additional biases our results could be definitively attributed to 2D projection effects, rather than any specific set of observing conditions and/or combination of biases. These issues will be the focus of upcoming papers in this series. Overall we find that local environmental conditions of a cluster play a role in the accuracy of derived cluster properties so in the absence of 6D data these should be routinely taken into consideration when undertaking, and care should be taken when interpreting and assigning significance to the results of, 2D cluster analyses. \section*{Data Availability} The simulation data underlying this article was provided by KYL by permission, which will shared on request to the corresponding author with permission of KYL. The analysis data underlying this article will be shared on reasonable request to the corresponding author. \section*{Acknowledgements} AB, CLD and TN are funded by the European Research Council H2020-EU.1.1 ICYBOB project (Grant No. 818940). SR acknowledges funding from STFC Consolidated Grant ST/R000395/1 and the European Research Council Horizon 2020 research and innovation programme (Grant No. 833925, project STAREX). The authors would like to thank the referee R. Parker for his constructive and insightful feedback which led to the improvement of the manuscript. \bibliographystyle{mnras}
\section{Introduction} \label{sec:intro} It is now standard in many fields of economics and other disciplines to employ cluster-robust inference for the parameters of linear regression models. In the most common case, each of the $N$ observations is assigned to one of $G$ disjoint clusters, which might correspond to, for example, families, schools, villages, hospitals, firms, industries, years, cities, counties, or states. The assignment of observations to clusters is assumed to be known, and observations in different clusters are assumed to be independent, but any pattern of heteroskedasticity and/or dependence is allowed within each cluster. Under these assumptions, it is easy to compute cluster-robust variance matrices that yield asymptotically valid $t$-tests, Wald tests, and confidence intervals. However, even when $N$ is very large, the resulting inferences may be unreliable when $G$ is not large or the clusters are not sufficiently homogeneous. The literature on cluster-robust inference has grown rapidly in recent years. \citet{CM_2015} is a classic survey article. \citet*{CGH_2018} surveys a broader class of methods for various types of dependent data. \citet*{MNW-guide} explores the implications of key theoretical results for empirical practice. As that paper discusses, there are at least two situations in which cluster-robust $t$-tests and Wald tests are at risk of over-rejecting to an extreme extent, even when $G$ is not small. The first is when one or a few clusters are much larger than the rest, and the second is when the only ``treated'' observations belong to just a few clusters; \citet*{DMN_2019} discusses the first case, and \citet*{MW-JAE,MW-TPM,MW-EJ} discuss the second. In both of these cases, one cluster (or a few of them) has high leverage, in the sense that omitting this cluster has the potential to change the OLS estimates substantially. When that actually happens, a cluster is said to be influential. The concepts of leverage and influence are normally applied at the observation level \citep*{BKW_1980}, but they are equally applicable at the cluster level. Just as high-leverage observations can make heteroskedasticity-robust inference unreliable \citep{Chesher_1989}, so too can high-leverage clusters make cluster-robust inference unreliable. Just as highly influential observations may lead us to suspect that there is something wrong with the model or the data, so too may highly influential clusters. Although the two special cases discussed in the preceding paragraph are particularly important, any situation in which a few clusters have high leverage or high influence should be worrying. Note that there are at least two different concepts of leverage. The usual one focuses on fitted values or, equivalently, residuals. A cluster is said to have high leverage if removing it has the potential to change the fitted values for that cluster by a lot. It can also be of interest to study partial leverage \citep{CW_1980}. A cluster is said to have high partial leverage for the \th{j} coefficient if removing that cluster has the potential to change the estimate of the \th{j} coefficient by a lot. In this paper, we provide computationally efficient ways to identify high-leverage and influential clusters. These can be used as diagnostic tools to determine how reliable various methods for cluster-robust inference are likely to be. Of course, it is easy enough to check cluster sizes and the distribution of treatment status across clusters directly, and many careful empiricists already do these things. But whether a cluster has high leverage, is influential, or has both of these features can depend on the sample in rather complicated ways. In our view, it is best to investigate leverage, partial leverage, and influence at the cluster level directly. We provide a new Stata package called \texttt{summclust} that implements our procedures in order to summarize the cluster structure of a dataset. A byproduct of our calculations is that they make it very fast to compute two jackknife variance matrix estimators called CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$. These often seem to perform much better in finite samples than other cluster-robust variance estimators \citep*{MNW-bootknife}. Although these estimators have been known for some time \citep{BM_2002}, perhaps under different names, they have rarely been used because they were too expensive to compute. The \texttt{summclust} package can calculate both of them. The remainder of the paper is organized as follows. In the next section, we review cluster-robust inference for the linear regression model. \Cref{sec:influential} introduces our new measures of leverage, partial leverage, and influence at the cluster level. \Cref{sec:examples} discusses several special cases in which some or all of these measures can be determined analytically. \Cref{sec:jack} shows how our results can be used to compute the CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ jackknife variance matrix estimators. \Cref{sec:report} discusses what quantities should be reported, both for the case of one\kern 0.08333em-way clustering on which the paper focuses and for the case of two or more clustering dimensions. \Cref{sec:sims} describes some simulation experiments which suggest that it may be desirable to report many of these quantities. \Cref{sec:package} describes the \texttt{summclust} package. \Cref{sec:empirical} presents an empirical illustration in which our methods are highly informative, and \Cref{sec:conc} concludes. \section{The Linear Regression Model with Clustering} \label{sec:model} Most of the paper deals with the linear regression model \begin{equation} \label{eq:lrmodel} {\bm{y}}_g ={\bm{X}}_g{\bm\beta} + {\bm{u}}_g, \quad g=1,\ldots,G, \end{equation} where the data have been divided into $G$ disjoint clusters. The \th{g} cluster has $N_g$ observations, so that the sample size is $N = \sum_{g=1}^G N_g$. In \eqref{eq:lrmodel}, ${\bm{X}}_g$ is an $N_g\times k$ matrix of regressors, ${\bm\beta}$ is a $k$-vector of coefficients, ${\bm{y}}_g$ is an $N_g$-vector of observations on the regressand, and ${\bm{u}}_g$ is an $N_g$-vector of disturbances (or error terms). The ${\bm{X}}_g$ may of course be stacked into an $N\times k$ matrix ${\bm{X}}$\kern -0.08333em, and likewise the ${\bm{y}}_g$ and ${\bm{u}}_g$ may be stacked into $N$-vectors ${\bm{y}}$ and ${\bm{u}}$, so that \eqref{eq:lrmodel} can be rewritten as ${\bm{y}} = {\bm{X}}\!{\bm\beta} + {\bm{u}}$. Dividing the sample into clusters only becomes meaningful if we make assumptions about the disturbance vectors ${\bm{u}}_g$ and, consequently, the score vectors ${\bm{s}}_g = {\bm{X}}_g^\top {\bm{u}}_g$. For a correctly specified model, ${\rm E}({\bm{s}}_g)={\bm{0}}$ for all $g$. We further assume that \begin{equation} \label{eq:Sigma_g} {\rm E}({\bm{s}}_g{\bm{s}}_g^\top) = {\bm{\Sigma}}_g \quad\mbox{and}\quad {\rm E}({\bm{s}}_g{\bm{s}}_{g'}^\top) = {\bm{0}}, \quad g,g'=1,\ldots,G,\quad g'\ne g, \end{equation} where ${\bm{\Sigma}}_g$ is the symmetric, positive semidefinite variance matrix of the scores for the \th{g} cluster. The second assumption in \eqref{eq:Sigma_g} is crucial. It says that the scores for every cluster are uncorrelated with the scores for every other cluster. We take the number of clusters $G$ and the allocation of observations to clusters as given. The important issue of how to choose the clustering structure, perhaps by testing for the correct level of clustering, is discussed in detail in \citet*{MNW-testing}. The OLS estimator of ${\bm\beta}$ is \begin{equation*} \hat{\bm\beta} = ({\bm{X}}^\top\!{\bm{X}})^{-1}{\bm{X}}^\top{\bm{y}} = {\bm\beta}_0 + ({\bm{X}}^\top\!{\bm{X}})^{-1}{\bm{X}}^\top{\bm{u}}, \end{equation*} where the second equality depends on the assumption that the data are actually generated by \eqref{eq:lrmodel} with true value ${\bm\beta}_0$. It follows that \begin{equation} \hat{\bm\beta} - {\bm\beta}_0 = ({\bm{X}}^\top\!{\bm{X}})^{-1}\sum_{g=1}^G {\bm{X}}_g^\top{\bm{u}}_g = \Big(\kern -0.08333em\sum_{g=1}^G{\bm{X}}_g^\top\!{\bm{X}}_g\Big)^{\!\!-1} \sum_{g=1}^G {\bm{s}}_g. \label{eq:betahat} \end{equation} From the rightmost expression in \eqref{eq:betahat}, we see that the distribution of $\hat{\bm\beta}$ depends on the disturbance subvectors ${\bm{u}}_g$ only through the distribution of the score vectors ${\bm{s}}_g$. Asymptotic inference commonly uses the empirical score vectors $\hat{\bm{s}}_g = {\bm{X}}_g^\top \hat{\bm{u}}_g$, in which the ${\bm{u}}_g$ are replaced by the residual subvectors $\hat{\bm{u}}_g$, to estimate the variance matrix of the ${\bm{s}}_g$. This should work well if the sum of the ${\bm{s}}_g$, suitably normalized, is well approximated by a multivariate normal distribution with mean zero, and if the ${\bm{s}}_g$ are well approximated by the $\hat{\bm{s}}_g$. However, this type of asymptotic inference can be misleading when either of these approximations is poor. It follows immediately from \eqref{eq:betahat} that an estimator of the variance of $\hat{\bm\beta}$ should be based on the usual sandwich formula, \begin{equation} \label{eq:trueV} ({\bm{X}}^\top\!{\bm{X}})^{-1} \Big(\kern -0.08333em\sum_{g=1}^G {\bm{\Sigma}}_g\kern -0.08333em\Big) ({\bm{X}}^\top\!{\bm{X}})^{-1}. \end{equation} The natural way to estimate \eqref{eq:trueV} is to replace the ${\bm{\Sigma}}_g$ matrices by their empirical counterparts, that is, the $\hat{\bm{s}}_g\hat{\bm{s}}_g^\top$. If, in addition, we multiply by a correction for degrees of freedom, we obtain the cluster-robust variance estimator, or CRVE, \begin{equation} \mbox{CV$_{\tn1}$:}\qquad \frac{G(N-1)}{(G-1)(N-k)} ({\bm{X}}^\top\!{\bm{X}})^{-1} \Big(\kern -0.08333em\sum_{g=1}^G \hat{\bm{s}}_g\hat{\bm{s}}_g^\top\Big) ({\bm{X}}^\top\!{\bm{X}})^{-1}. \label{eq:CV1} \end{equation} This is by far the most widely used CRVE in practice, and it is the default one implemented in \texttt{Stata}; alternatives to this estimator will be discussed in \Cref{sec:jack}. When $G=N$\kern -0.08333em, the CV$_{\tn1}$ estimator reduces to the familiar HC$_1$ estimator \citep{MW_1985} that is robust only to heteroskedasticity of unknown form. The fundamental unit of inference when the observations are clustered is the cluster, not the observation; this is evident from \eqref{eq:betahat}, \eqref{eq:trueV}, and \eqref{eq:CV1}. The asymptotic theory for cluster-robust inference has been analyzed recently by \citet{DMN_2019} and \cite{HansenLee_2019} under the assumption that $G\to\infty$. In general, the quality of the asymptotic approximation is determined by the number of clusters $G$ and the extent of heterogeneity of the score vectors \citep{MNW-guide}. The more the distributions of the scores vary across clusters, the worse the asymptotic approximation will likely be. Heterogeneity can arise from variation in cluster sizes and/or from variation in the distributions of the disturbances, the regressors, or both. As we discuss in \Cref{sec:influential,sec:report,sec:sims}, leverage, partial leverage, and summary statistics based on them provide useful measures of heterogeneity across clusters. Inference about ${\bm\beta}$ is typically based on cluster-robust $t$-statistics and Wald statistics. If $\beta_j$ denotes the \th{j} element of ${\bm\beta}$ and $\beta_{0j}$ is its value under the null hypothesis, then the appropriate $t$-statistic is \begin{equation} t_j = \frac{\hat\beta_j - \beta_{0j}}{\textrm{s.e.}(\hat\beta_j)}, \label{eq:cr-tstat} \end{equation} where $\hat\beta_j$ is the OLS estimate, and $\textrm{s.e.}(\hat\beta_j)$ is the square root of the \th{j} diagonal element of \eqref{eq:CV1}. Under extremely strong assumptions \citep*{BCH_2011}, it can be shown that $t_j$ asymptotically follows the $t(G-1)$ distribution. Conventional inference in \texttt{Stata} and other programs is based on this distribution. As the articles cited in the second paragraph of \Cref{sec:intro} discuss, inference based on $t_j$ and the $t(G-1)$ distribution can be unreliable when $G$ is small and/or the clusters are severely heterogeneous. This is true to an even greater extent for Wald tests of two or more restrictions \citep{PT_2018}. The measures of leverage and partial leverage at the cluster level that we introduce in the next section may help to identify the sort of heterogeneity that is likely to make inference unreliable. Instead of using the $t(G-1)$ distribution, we can obtain both $P$ values for $t_j$ and confidence intervals for $\beta_j$ by employing the wild cluster restricted (or WCR) bootstrap \citep*{CGM_2008}. It can sometimes provide much more reliable inferences than the conventional approach; see \Cref{sec:sims} and \citet{DMN_2019}. \citet*{RMNW} describes a computationally efficient implementation of this method in the Stata package \texttt{boottest}. When $G$ is reasonably large and the clusters are not very heterogeneous, inferences based on the WCR bootstrap and inferences based on CV$_{\tn1}$ $t$-statistics combined with the $t(G-1)$ distribution will often be very similar. When they differ noticeably, neither should be relied upon without further investigation. \Cref{sec:jack} discusses two other CRVEs, which we refer to as CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$, that are both based on the cluster jackknife. In practice, these estimators are often extremely similar. CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ tend to yield more reliable inferences in finite samples than does CV$_{\tn1}$, especially when the clusters are quite heterogeneous; see \citet{MNW-bootknife} and \Cref{sec:sims}. Based on this simulation evidence, we recommend computing either CV$_{\tn3}$ or CV$_{\tn3{\rm J}}$ essentially all the time. This is easy to do using \texttt{summclust}. \section{Identifying High-Leverage and Influential Clusters} \label{sec:influential} At the observation level, there are three classic measures of heterogeneity, namely, leverage, partial leverage, and influence \citep{BKW_1980,CH_1986}. In this section, we propose analogous measures at the cluster level. Measures of leverage at the observation level are based on how much the residual for observation $i$ changes when that observation is omitted from the regression. If $h_i$ denotes the \th{i} diagonal element of the ``hat matrix'' ${\bm{H}} = {\bm{P}}_{\bm{X}} = {\bm{X}}({\bm{X}}^\top\!{\bm{X}})^{-1}{\bm{X}}^\top$\kern -0.08333em, then omitting the \th{i} observation changes the \th{i} residual from $\hat u_i$ to $\hat u_i/(1-h_i)$. Because $0 < h_i < 1$, this delete\kern 0.04167em-one residual is always larger in absolute value than $\hat u_i$. The factor by which the delete\kern 0.04167em-one residual exceeds $\hat u_i$ increases with $h_i$. Since the average of the $h_i$ is $k/N$\kern -0.08333em, observations with values of $h_i$ substantially larger than $k/N$ may reasonably be said to have high leverage. Similarly, dropping the \th{g} cluster when we estimate ${\bm\beta}$ changes the \th{g} residual vector from $\hat{\bm{u}}_g$ to $({\bf I} - {\bm{H}}_g)^{-1}\hat{\bm{u}}_g$, where \begin{equation} {\bm{H}}_g = {\bm{X}}_g({\bm{X}}^\top\!{\bm{X}})^{-1}{\bm{X}}_g^\top \end{equation} is the $N_g\times N_g$ diagonal block of ${\bm{H}}$ that corresponds to cluster~$g$. The matrix ${\bm{H}}_g$ is the cluster analog of the scalar $h_i$. Of course, it is not feasible to report the ${\bm{H}}_g$. In fact, when any of the clusters is sufficiently large, even computing and storing these matrices may be challenging. As a measure of leverage, we therefore suggest using a matrix norm of the ${\bm{H}}_g$. Specifically, we suggest the scalar \begin{equation} \label{eq:traceXX} L_g = \Tr({\bm{H}}_g) = \Tr\!\big({\bm{X}}_g^\top\!{\bm{X}}_g({\bm{X}}^\top\!{\bm{X}})^{-1}\big). \end{equation} When the \th{g} cluster contains just one observation, say the \th{i}, then $L_g = h_i$. Thus, in this special case, the leverage measure that we are proposing reduces to the usual measure of leverage at the observation level. The trace in \eqref{eq:traceXX} is the nuclear norm of the matrix ${\bm{H}}_g$. In general, the nuclear norm of a matrix ${\bm{A}}$ is the sum of the singular values of ${\bm{A}}$. When ${\bm{A}}$ is symmetric and positive semidefinite, the singular values are equal to the eigenvalues, which are non-negative. Since the trace of any square matrix is equal to the sum of the eigenvalues, the trace of a symmetric and positive semidefinite matrix is also its nuclear norm. In principle, we could report any norm of the ${\bm{H}}_g$ matrices, but the nuclear norm is particularly easy to compute, and it has the advantage of being linear. This implies that we can sum over $g$ and take the sum inside the norm just as if the ${\bm{H}}_g$ were scalars. Since $\sum_{g=1}^G {\bm{X}}_g^\top\!{\bm{X}}_g = {\bm{X}}^\top\!{\bm{X}}$, this result means that $G^{-1} \sum_{g=1}^G \Tr({\bm{H}}_g) = k/G$, which is analogous to the result that the average of the $h_i$ over all observations is $k/N$\kern -0.08333em. High-leverage clusters can be identified by comparing the $L_g$ to $k/G$, their average. If, for some cluster $h$, $L_h$ is substantially larger than $k/G$, then cluster $h$ may be said to have high leverage. Just how much larger $L_h$ has to be is a matter of judgement. A cluster with $L_h=2k/G$ probably does not qualify, but a cluster with $L_h=5k/G$ probably does. Cluster $h$ can have high leverage either because $N_h$ is considerably larger than $G/N$ or because the matrix ${\bm{X}}_h$ is somehow extreme relative to the other ${\bm{X}}_g$ matrices, or both. We can compare the leverage of any two clusters by forming ratios. For example, if $L_1 = 3$ and $L_2 = 1$, then we can say that the first cluster has three times the leverage of the second cluster. Like the classic leverage measure $h_i$, the one we suggest in \eqref{eq:traceXX} shows the potential impact of a particular cluster on residuals and fitted values, but not on any particular regression coefficient. When interest focuses on just one such coefficient, say the \th{j}\kern -0.08333em, it may be more interesting to calculate the partial leverage of each cluster. The concept of partial leverage was introduced, for individual observations, in \citet{CW_1980}. Let \begin{equation} \acute{\bm{x}}_j = \big({\bf I} - {\bm{X}}_{[j]}\big({\bm{X}}_{[j]}^\top{\bm{X}}_{[j]}\big)^{\kern -0.08333em-1} {\bm{X}}_{[j]}^\top\big){\bm{x}}_j, \label{eq:acutex} \end{equation} where ${\bm{x}}_j$ is the vector of observations on the \th{j} regressor, and ${\bm{X}}_{[j]}$ is the matrix of observations on all the other regressors. Thus $\acute{\bm{x}}_j$ denotes ${\bm{x}}_j$ after all the other regressors have been partialed out. The partial leverage of observation $i$ is simply the \th{i} diagonal element of the matrix $\acute{\bm{x}}_j(\acute{\bm{x}}_j^\top\acute{\bm{x}}_j)^{-1}\acute{\bm{x}}_j^\top$, which is just $\acute x_{ji}^2/(\acute{\bm{x}}_j^\top\acute{\bm{x}}_j)$, where $\acute x_{ji}^2$ is the \th{i} element of $\acute{\bm{x}}_j$. The analogous measure of partial leverage for cluster $g$ is \begin{equation} L_{gj} = \frac{\acute{\bm{x}}_{gj}^\top\acute{\bm{x}}_{gj}} {\acute{\bm{x}}_j^\top\acute{\bm{x}}_j}\kern 0.08333em, \label{eq:partial} \end{equation} where $\acute{\bm{x}}_{gj}$ is the subvector of $\acute{\bm{x}}_j$ corresponding to the \th{g} cluster. This is what \eqref{eq:traceXX} reduces to if we replace ${\bm{X}}$ and ${\bm{X}}_g$ by $\acute{\bm{x}}_j$ and $\acute{\bm{x}}_{gj}$, respectively. It is easy to calculate the partial leverage for every cluster for any coefficient of interest. The average of the $L_{gj}$ is evidently $1/G$, so that if cluster $h$ has $L_{hj} >\!> 1/G$, it has high partial leverage for the \th{j} coefficient. Moreover, as we will see in \Cref{sec:sims}, the empirical distribution of the $L_{gj}$ across clusters seems to provide useful diagnostic information. One possible consequence of heterogeneity is that the estimates may change a lot when certain clusters are deleted. It can therefore be illuminating to delete one cluster at a time, so as to see how influential each cluster is. To do this in a computationally efficient manner, we compute the cluster-level matrices and vectors \begin{equation} {\bm{X}}_g^\top\!{\bm{X}}_g \quad\mbox{and}\quad {\bm{X}}_g^\top{\bm{y}}_g, \quad g=1,\ldots,G. \label{eq:subthings} \end{equation} This is almost costless if we calculate the quantities in \eqref{eq:subthings} first and then use them to construct ${\bm{X}}^\top\!{\bm{X}}$ and ${\bm{X}}^\top{\bm{y}}$. The vector of least squares estimates when cluster $g$ is deleted is then \begin{equation} \label{eq:delone} \hat{\bm\beta}^{(g)} = ({\bm{X}}^\top\!{\bm{X}} - {\bm{X}}_g^\top\!{\bm{X}}_g)^{-1} ({\bm{X}}^\top{\bm{y}} - {\bm{X}}_g^\top{\bm{y}}_g). \end{equation} Unless $k$ is extremely large, it should generally be fairly inexpensive to compute $\hat{\bm\beta}^{(g)}$ for every cluster using \eqref{eq:delone}. Especially when they vary a lot, the $\hat{\bm\beta}^{(g)}$ can reveal a great deal about the sample. In addition, as we shall see in \Cref{sec:jack}, they may be used to calculate jackknife variance matrices. When there is a parameter of particular interest, say~$\beta_j$, it may be a good idea to report the $\hat\beta_j^{(g)}$ for $g=1,\ldots,G$ in either a histogram or a table. If $\hat\beta_j^{(h)}$ differs greatly from $\hat\beta_j$ for some cluster $h$\kern -0.08333em, then cluster $h$ is evidently influential. In a few extreme cases, there may be a cluster $h$ for which it is impossible to compute $\hat\beta_j^{(h)}$\kern -0.08333em. This will happen, for example, when the regressor corresponding to $\beta_j$ is a treatment dummy and cluster $h$ is the only treated one. This is an extreme example of the problem of few treated clusters, and inferences based on either the $t(G-1)$ distribution or the WCR bootstrap are likely to be completely unreliable in this case \citep{MW-TPM,MW-EJ,MW-RI}. Identifying influential clusters by comparing the $\hat{\bm\beta}^{(g)}$ from \eqref{eq:delone} with $\hat{\bm\beta}$ is very similar to identifying influential observations using the classic methods discussed in \citet{BKW_1980} and \citet{CH_1986}; for an interesting recent extension, see \citet*{BGM_2021}. If influential clusters have been identified, the investigator will need to decide how to deal with them. Perhaps the influential clusters are atypical in ways that should make us mistrust the results, either because the model does not seem to apply to them or because there are measurement errors or observations that have been miscoded. Regression models often include cluster fixed effects. When one of the regressors is a fixed-effect dummy for cluster $g$, the matrices ${\bm{X}}_g^\top\!{\bm{X}}_g$ and ${\bm{X}}^\top\!{\bm{X}} - {\bm{X}}_g^\top\!{\bm{X}}_g$ are singular. This will cause the calculation in \eqref{eq:delone} to fail unless a generalized inverse routine, such as the \texttt{invsym} routine in Mata, is used. The problem can be avoided, and some computer time saved, by partialing out the fixed-effect dummies prior to computing the cluster-level matrices and vectors in \eqref{eq:subthings} using, for example, the \texttt{areg} procedure in \texttt{Stata}. Partialing these out means replacing ${\bm{X}}$ and ${\bm{y}}$ by $\tilde{\bm{X}}$ and $\tilde{\bm{y}}$, the deviations from their cluster means. For example, the element of $\tilde{\bm{y}}$ corresponding to the \th{j} observation in the \th{g} cluster is $y_{g,j} - N_g^{-1}\sum_{i=1}^{N_g} y_{g,i}$. The \th{g} subvector of $\tilde{\bm{y}}$ is $\tilde{\bm{y}}_g$, and the \th{g} submatrix of $\tilde{\bm{X}}$ is $\tilde{\bm{X}}_g$. Since there is just one fixed effect per cluster, $\tilde{\bm{y}}_g$ depends solely on ${\bm{y}}_g$, and $\tilde{\bm{X}}_g$ depends solely on ${\bm{X}}_g$. The calculations in \eqref{eq:traceXX} and \eqref{eq:delone} are now based on $\tilde{\bm{X}}^\top\!\tilde{\bm{X}}$\kern -0.08333em, $\tilde{\bm{X}}^\top\tilde{\bm{y}}$, the $\tilde{\bm{X}}_g^\top\!\tilde{\bm{X}}_g$, and the $\tilde{\bm{X}}_g^\top\tilde{\bm{y}}_g$. We believe that investigators should routinely compute both the $L_g$ and the $L_{gj}$ for any coefficient(s) of particular interest. In some cases, the $L_g$ and the $L_{gj}$ will be roughly proportional to the $N_g$ (the cluster sizes). That in itself would be informative. It may be even more interesting, however, if the relative size of $L_h$ and/or $L_{hj}$ for some cluster(s) $h$ is much larger, or much smaller, than the relative size of $N_h$. When $G$ is small, it may be feasible to report the $L_g$, along with the $L_{gj}$ and the $\hat\beta_j^{(g)}$ for one or a very few values of $j$, in a table. When $G$ is not small, it may be interesting to report the empirical distributions of these quantities, either in tabular or graphical form. Measures of leverage and partial leverage will often help to identify cases in which inference, especially asymptotic inference, may be unreliable; see \Cref{sec:sims}. Unlike the leverage measures, the $\beta^{(g)}_j$ may be either positive or negative, must depend on the ${\bm{y}}_g$, and necessarily vary across clusters. They may sometimes turn up features of the model or dataset that require further investigation, including data errors. \section{Simple Examples} \label{sec:examples} In this section, we discuss a number of simple examples in which it is possible to calculate our measures of leverage and influence analytically. These examples are quite revealing. \begin{example}[Estimation of the mean] \label{ex:mean} Finding the sample mean is equivalent to performing a least-squares regression in which the only regressor is $x_i = 1$ for all $i=1,\ldots,N$\kern -0.08333em. In this case, it is easy to see that ${\bm{X}}_g^\top\!{\bm{X}}_g = N_g$ and ${\bm{X}}^\top\!{\bm{X}} = N$\kern -0.08333em. Therefore, \begin{equation} L_g = \Tr({\bm{H}}_g) = \frac{N_g}{N} = \frac{N_g}{\sum_{h=1}^G N_h}. \label{eq:conlev} \end{equation} In this simple case, cluster leverage is exactly proportional to cluster size. In other cases, we can interpret leverage as a generalization of cluster size that takes into account other types of heterogeneity as well. Evidently, $\hat\beta = \bar{y} = N^{-1}\sum_{g=1}^G N_g\kern 0.08333em\bar{y}_g$, where $\bar{y}$ and $\bar{y}_g$ denote the sample average for the full sample and for cluster $g$, respectively. This expression can be rewritten as \begin{equation} \hat\beta = \sum_{g=1}^G\frac{N_g}{N}\kern 0.08333em\bar{y}_g = \sum_{g=1}^G L_g\kern 0.08333em \hat\beta_g, \label{eq:bhat} \end{equation} so that $\hat\beta$ is seen to be a weighted average of the $G$ estimates $\hat\beta_g=\bar y_g$, with the weight for each cluster equal to its leverage. Similarly, we find that \begin{equation} \hat\beta^{(g)} = \frac{N}{N-N_g}\sum_{h \neq g} L_h\kern 0.08333em \hat\beta_h, \label{eq:bhatg} \end{equation} where the first factor simply makes up for the fact that we are summing over $G-1$ clusters instead of $G$ as in \eqref{eq:bhat}. Subtracting \eqref{eq:bhat} from \eqref{eq:bhatg}, we conclude that \begin{equation} \hat\beta^{(g)} - \hat\beta = \frac{N_g}{N}\big(\hat\beta^{(g)} - \hat\beta_g\big) = L_g\big(\hat\beta^{(g)} - \hat\beta_g\big). \label{eq:bdiff} \end{equation} Therefore, cluster $g$ will be influential whenever omitting it yields an estimate $\hat\beta^{(g)}$ that differs substantially from the estimate $\hat\beta_g$ for cluster $g$ itself, especially when cluster $g$ also has high leverage. \end{example} \begin{example}[Single regressor plus constant] \label{ex:regressor} Consider a regression design with a single regressor, $x_i$, and a constant term. Then \begin{equation*} {\bm{X}}_g^\top\!{\bm{X}}_g = \left[ { \begin{array}{cc} N_g & \sum_{i=1}^{N_g}x_{g,i} \\ \sum_{i=1}^{N_g}x_{g,i} & \sum_{i=1}^{N_g}x_{g,i}^2 \end{array} } \right] \quad \textrm{and} \quad ( {\bm{X}}^\top\!{\bm{X}} )^{-1} = \frac{1}{N^2 \hat\sigma_x^2} \left[ { \begin{array}{cc} \sum_{i=1}^N x_i^2 & -\sum_{i=1}^N x_i \\ -\sum_{i=1}^N x_i & N \end{array} } \right]\!, \end{equation*} where $\hat\sigma_x^2$ denotes the sample variance of the $x_i$. After some algebra, we find that \begin{equation} L_g = \frac{N_g}{N\hat\sigma_x^2}\big(\hat\sigma_x^2 + \hat\sigma_{x,g}^2 + (\bar{x}_g-\bar{x})^2\big) , \label{eq:constlev} \end{equation} where $\bar{x}_g$ and $\hat\sigma_{x,g}^2$ denote the sample mean and sample variance of the $x_i$ within cluster~$g$. Expression \eqref{eq:constlev} is a straightforward generalization of \eqref{eq:conlev}. The last two terms within the large parentheses are the sample variance of the $x_{g,i}$ within cluster $g$ and the square of the difference between $\bar{x}_g$ and $\bar{x}$. The sum of these terms is the sample variance of the $x_{g,i}$ around $\bar{x}$ within cluster~$g$. Thus cluster $g$ will have high leverage when the variance of the $x_{g,i}$ around $\bar{x}$ within that cluster is large relative to the variance $\hat\sigma_x^2$ for the full sample. If everything except cluster sizes were perfectly balanced, $L_g$ would evidently reduce to $2N_g/N$\kern -0.08333em. The partial leverage for $x$ is just \begin{equation} L_{g2} = \frac{N_g\big(\hat\sigma_{x,g}^2 + (\bar{x}_g-\bar{x})^2\big)}{N\hat\sigma_x^2}\kern 0.08333em, \label{eq:constplev} \end{equation} the total variation around $\bar{x}$ within cluster $g$ divided by the total variation within the sample. If everything except cluster sizes were perfectly balanced, it would reduce to $N_g/N$\kern -0.08333em. \end{example} \begin{example}[Single regressor plus fixed effects] \label{ex:regressorFE} Suppose there is a single regressor, $x_i$, and there are cluster-level fixed effects, which have been partialed out. In this case, we can write all quantities as deviations from their cluster averages, and there is no distinction between leverage and partial leverage. Then $\tilde{\bm{X}}_g^\top\!\tilde{\bm{X}}_g =\sum_{i=1}^{N_g} (x_{g,i}-\bar{x}_g)^2 = N_g \hat\sigma_{x,g}^2$. Similarly, $\tilde{\bm{X}}^\top\!\tilde{\bm{X}} = \sum_{g=1}^G N_g\kern 0.08333em \hat\sigma_{x,g}^2$ is the average variance of the $x_i$ across all clusters. We find that \begin{equation} L_g = \frac{N_g\kern 0.08333em\hat\sigma_{x,g}^2}{\sum_{h=1}^G N_h\kern 0.08333em\hat\sigma_{x,h}^2}, \label{eq:felev} \end{equation} which is again a straightforward generalization of \eqref{eq:conlev}. The leverage of cluster $g$ is proportional to $N_g$ times the variance of the $x_{g,i}$ around $\bar{x}_g$. Thus, for example, doubling the variance of the $x_{g,i}$ has the same effect on leverage as doubling~$N_g$. In this case, using \eqref{eq:felev}, it is easy to see that \begin{equation} \hat\beta = \frac{\sum_{g=1}^G N_g\kern 0.08333em \hat\sigma_{xy,g}} {\sum_{g=1}^G N_g\kern 0.08333em \hat\sigma^2_{x,g}} = \sum_{g=1}^G L_g \frac{\hat\sigma_{xy,g}}{\hat\sigma^2_{x,g}} = \sum_{g=1}^G L_g \hat\beta_g, \label{eq:bhatfe} \end{equation} where $\hat\sigma_{xy,g} = (1/N_g)\sum_{i=1}^{N_g} (x_{g,i} - \bar{x}_g) (y_{g,i} - \bar y_g)$ is the sample covariance of $x_i$ and $y_i$ within cluster~$g$. The rightmost expressions in \eqref{eq:bhat} and \eqref{eq:bhatfe} are identical. In both cases, $\hat\beta$ is seen to be a weighted average of the $G$ cluster estimates, with the weight for each cluster equal to its leverage. When cluster $g$ is omitted, we obtain \begin{equation} \hat\beta^{(g)} = \frac{\sum_{h\ne g} N_h \hat\sigma_{xy,h}} {\sum_{h\ne g} N_h \hat\sigma^2_{x,h}} = \frac{\sum_{h\ne g} L_h \hat\beta_h}{\sum_{h\ne g}L_h}, \label{eq:bhatgfe} \end{equation} which would specialize to \eqref{eq:bhatg} if \eqref{eq:conlev} were true. As before, $\hat\beta^{(g)}$ is a weighted average of the $\hat\beta_h$, with weights proportional to the $L_g$, which in this case are also the partial leverages. Subtracting \eqref{eq:bhatfe} from \eqref{eq:bhatgfe}, we find that \begin{equation} \hat\beta^{(g)} - \hat\beta = L_g\big(\hat\beta^{(g)} - \hat\beta_g\big), \label{eq:betagdiff} \end{equation} which is formally identical to the rightmost expression in \eqref{eq:bdiff}, although of course $L_g$ is defined in \eqref{eq:felev} not \eqref{eq:conlev}. Cluster $g$ will be influential whenever $\hat\beta^{(g)}$ differs substantially from the estimate $\hat\beta_g$ for cluster $g$ itself, especially when cluster $g$ also has high leverage. \end{example} \begin{example}[Treatment model with a constant term] \label{ex:treatconst} Now we specialize \Cref{ex:regressor} to the case in which the single regressor is a treatment dummy denoted by $d_i$. Let $\bar{d}_g$ and $\bar{d}$ denote the proportion of treated observations in cluster $g$ and in the sample, respectively. Then \eqref{eq:constlev} becomes \begin{equation} \label{eq:treatlev1} L_g = \frac{N_g}{N} \Big(\frac{\bar{d}_g}{\bar{d}} + \frac{1-\bar{d}_g}{1-\bar{d}}\Big). \end{equation} The first factor here is the relative size of the \th{g} cluster. The second factor depends on how much $\bar{d}_g$ differs from $\bar{d}$. When $\bar{d}_g = \bar{d}$, we see that $L_g = 2 N_g/N$. Otherwise, the first term inside the parentheses causes leverage to be high whenever $\bar{d}_g$ is large relative to $\bar{d}$, and the second term causes leverage to be high whenever $\bar{d}_g$ is small relative to~$\bar{d}$. As $\bar{d}$ increases for given $\bar{d}_g$, the first term becomes smaller relative to the second term. Thus the \th{g} cluster will tend to be influential either when it has a large proportion of treated observations and the overall proportion is small, or when it has a small proportion of treated observations and the overall proportion is large. We can also obtain the partial leverage of the treatment dummy for this case. Expression \eqref{eq:constplev} simply becomes \begin{equation} \label{eq:treatplev1} L_{g2} = \frac{N_g}{N} \Big(\frac{\bar{d}_g}{\bar{d}} + \frac{\bar{d} - \bar{d}_g}{1 - \bar{d}}\Big). \end{equation} Once again, the first factor is the relative size of the \th{g} cluster. The second factor reduces to~1 when $\bar{d}_g=\bar{d}$, so that $L_{g2} = N_g/N$ in that special case. We can further specialize \eqref{eq:treatlev1} and \eqref{eq:treatplev1} to models in which the treatment is applied at the cluster level. Suppose that all observations in clusters $g = 1, \ldots ,G_1$ are treated and no observations in the $G_0=G-G_1$ control clusters from $G_1+1$ to $G$ are treated. Then we find that $\bar{d}_g = 1$ for $g = 1, \ldots ,G_1$, and $\bar{d}_g = 0$ for $g = G_1 +1, \ldots ,G$. Inserting these into \eqref{eq:treatlev1} shows that \begin{equation} \label{eq:treatlev2} L_g = \begin{cases} \frac{N_g}{N} \frac{1}{\bar{d}\addh8} & \textrm{for } g=1,\ldots,G_1, \\ \frac{N_g}{N} \frac{1}{(1-\bar{d}\addh8\kern 0.08333em)} & \textrm{for } g=G_1 +1,\ldots,G. \end{cases} \end{equation} Inserting them into \eqref{eq:treatplev1} shows that \begin{equation} \label{eq:treatplev2} L_{g2} = \begin{cases} \frac{N_g}{N} \frac{\bar{d}+1}{\bar{d}\addh8} & \textrm{for } g=1,\ldots ,G_1, \\ \frac{N_g}{N} \frac{\bar{d}}{(1-\bar{d}\addh8\kern 0.08333em)} & \textrm{for } g=G_1 +1,\ldots ,G. \end{cases} \end{equation} Thus any cluster tends to have high leverage if $N_g/N$ is large. A treated cluster has high leverage and partial leverage if $\bar{d}$ is small. Conversely, a control cluster has high leverage and partial leverage if $\bar{d}$ is large. \end{example} \begin{example}[Treatment with fixed effects] \label{ex:treatFE} Finally, we consider the case of cluster-level fixed effects, where treatment is randomly applied at the individual level. This is a special case of \Cref{ex:regressorFE}. We cannot consider cluster fixed effects with cluster-level treatment, because the treatment dummy would be invariant within clusters. We specialize \eqref{eq:felev} and find that \begin{equation} L_g = \frac{N_g\kern 0.08333em \bar{d}_g (1-\bar{d}_g)} {\sum_{h=1}^G N_h\kern 0.08333em \bar{d}_h (1-\bar{d}_h)} . \label{eq:treatlev} \end{equation} Thus, as before, the leverage of cluster $g$, relative to the average for the other clusters, is proportional to its size, $N_g$. It also depends on the proportion of treated observations in the cluster. The maximum (relative) leverage for cluster $g$ occurs at $\bar{d}_g=1/2$ and is symmetric around~$1/2$. The result \eqref{eq:betagdiff} continues to hold. It tells us that cluster~$g$ will be influential when its leverage \eqref{eq:treatlev} is large and $\hat\beta^{(g)}$ differs greatly from $\hat\beta_g$. \end{example} \section{Two Jackknife Variance Matrix Estimators} \label{sec:jack} Although the CV$_{\tn1}$ variance estimator defined in \eqref{eq:CV1} is very widely used, it does not have particularly good finite\kern 0.04167em-sample properties. That is one reason why bootstrap methods are so commonly employed. Two alternative CRVEs, which are usually known as CV$_{\tn2}$ and CV$_{\tn3}$, were proposed in \citet{BM_2002}. They are the cluster analogs of the hetero\-skedasticity-consistent estimators HC$_2$ and HC$_3$, which are appropriate when the $u_i$ are independent. These names were coined in \citet{MW_1985}, which proposed HC$_3$ as a jackknife variance estimator. In the remainder of this section, we focus on CV$_{\tn3}$, because CV$_{\tn2}$ is not a jackknife estimator and is not amenable to the computational methods that we propose; for more on it, see \citet{Imbens_2016}, \citet{PT_2018}, and \citet*{NAAMW_2020}. The usual expression for CV$_{\tn3}$ is \begin{equation} \mbox{CV$_{\tn3}$:}\qquad \frac{G-1}{G} ({\bm{X}}^\top{\bm{X}})^{-1}\Big(\kern 0.08333em\sum_{g=1}^G \ddot{\bm{s}}_g\ddot{\bm{s}}_g^\top \Big)({\bm{X}}^\top{\bm{X}})^{-1}, \label{eq:CV3} \end{equation} where the modified score vectors $\ddot{\bm{s}}_g$ are defined as \begin{equation} \ddot{\bm{s}}_g = {\bm{X}}_g^\top{\bm{M}}_{gg}^{-1}\kern 0.08333em\hat{\bm{u}}_g. \label{eq:bis3} \end{equation} Here ${\bm{M}}_{gg} = {\bf I}_{N_g} - {\bm{X}}_g({\bm{X}}^\top{\bm{X}})^{-1}\kern -0.08333em{\bm{X}}_g^\top$ is the diagonal block corresponding to the \th{g} cluster of the projection matrix ${\bm{M}}_{\bm{X}}$, which satisfies $\hat{\bm{u}} = {\bm{M}}_{\bm{X}}{\bm{u}}$. Although computing CV$_{\tn3}$ using \eqref{eq:CV3} works well when all the $N_g$ are very small, it becomes expensive, or perhaps computationally infeasible, when even one of the $N_g$ is sufficiently large. The problem is that an $N_g\times N_g$ matrix needs to be stored and inverted for every cluster. A method that is much faster for large clusters has recently been proposed in \citet{NAAMW_2020}. Versions of this procedure apply to both CV$_{\tn2}$ and CV$_{\tn3}$. However, recognizing that CV$_{\tn3}$ is a jackknife estimator allows us to develop a much simpler and even faster method for it. The most obvious cluster jackknife estimator of $\var(\hat{\bm\beta})$ is \begin{equation} \mbox{CV$_{\tn3{\rm J}}$:}\qquad \frac{G-1}{G} \sum_{g=1}^G (\hat{\bm\beta}^{(g)} - \bar{\bm\beta})(\hat{\bm\beta}^{(g)} - \bar{\bm\beta})^\top, \label{eq:jack} \end{equation} where $\bar{\bm\beta}$ is the sample mean of the $\hat{\bm\beta}^{(g)}$, which were defined in \eqref{eq:delone}. The expression in \eqref{eq:jack} is the cluster analog of the usual jackknife variance matrix estimator given in \citet[eqn.\ (11)]{MW_1985}. Each of the $\hat{\bm\beta}^{(g)}$ is obtained by deleting a cluster instead of an observation, and the summation is over clusters instead of observations. If $\bar{\bm\beta}$ in \eqref{eq:jack} is replaced by $\hat{\bm\beta}$, we obtain the estimator CV$_{\tn3}$: \begin{equation} \mbox{CV$_{\tn3}$:}\qquad \frac{G-1}{G} \sum_{g=1}^G (\hat{\bm\beta}^{(g)} - \hat{\bm\beta}) (\hat{\bm\beta}^{(g)} - \hat{\bm\beta})^\top. \label{eq:jack3} \end{equation} This version of CV$_{\tn3}$ is numerically identical to the one in \eqref{eq:CV3}; see \citet{MNW-bootknife} for a proof. Unless all the clusters are very small, computing CV$_{\tn3}$ using \eqref {eq:jack3} is far faster than using \eqref{eq:CV3}; some timings are reported in \citet{MNW-bootknife}. Many discussions of jackknife variance estimation follow \citet{Efron_79} and use $\bar{\bm\beta}$ as in \eqref{eq:jack}, but others, including \citet{BM_2002}, use $\hat{\bm\beta}$ as in \eqref{eq:jack3}. Although these two jackknife variance estimators are asymptotically the same, they are rarely equal. For example, in the case of \eqref{eq:bhatfe}, they will coincide only when every cluster has the same (partial) leverage. Thus CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ will normally differ, with CV$_{\tn3}$ always larger than CV$_{\tn3{\rm J}}$ in the sense that the difference between them is a positive semi-definite matrix. In practice, however, they tend to be very similar \citep{MNW-bootknife}, and there seems to be no good reason to expect either CV$_{\tn3}$ or CV$_{\tn3{\rm{J}}}$ to perform better in general. The factor of $(G-1)/G$ in both \eqref{eq:jack} and \eqref{eq:jack3} is designed to compensate for the tendency of the $\hat{\bm\beta}^{(g)}$ to be too spread out. This factor is the analog of the usual factor of $(N-1)/N$ for a jackknife variance matrix at the individual level. It implicitly assumes that all clusters are the same size and perfectly balanced, with disturbances that are independent and homoskedastic. In this special case, the estimators CV$_{\tn3}$ and CV$_{\tn3{\rm{J}}}$ would be identical and unbiased \citep{BM_2002}. Interestingly, the original HC$_3$ estimator proposed in \citet{MW_1985} is actually the analog of CV$_{\tn3{\rm J}}$. The modern version of HC$_3$, which is the analog of CV$_{\tn3}$, seems to be due to \citet[Chapter 16]{DM_1993}. This version of HC$_3$ is normally computed by dividing each residual by the corresponding diagonal element of ${\bm{M}}_{\bm{X}}$, and the factor of $(N-1)/N$ is usually (but incorrectly) omitted. Both jackknife estimators may readily be used to compute cluster-robust $t$-statistics. In view of the fact that there are $G$ terms in the summation, it seems natural to compare these with the $t(G-1)$ distribution, as usual. These procedures should almost always be more conservative than $t$-tests based on the widely-used CV$_{\tn1}$ estimator. The results in \Cref{sec:sims} suggest that they can be much more conservative. When a model includes fixed effects, some care needs to be taken when computing CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$. As noted in \Cref{sec:influential}, it is computationally attractive to partial out fixed effects prior to calculating $\hat{\bm\beta}$. However, if we were to partial out any arbitrary regressors prior to computing the delete-one-cluster estimates in \eqref{eq:delone}, then the computed $\hat{\bm\beta}^{(g)}$ would depend on the values of the partialed-out regressors for the full sample, including those in the \th{g} cluster, which would be incorrect. Consequently, the values of CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ will be incorrect if we partial out any regressor that affects more than one cluster (such as industry-level fixed effects with firm-level clustering). An important exception is when the regressors that are partialed out are cluster fixed effects or fixed effects at a finer level (such as firm-level fixed effects with industry-level clustering), because each of them affects only one cluster. See the discussion of the \texttt{absorb} and \texttt{fevar} options in \Cref{sec:package}. It is possible that the vector ${\bm\beta}$ is identified for the full sample but not when one cluster is deleted. For example, consider the coefficient on a dummy variable that takes on non-zero values only for observations in the \th{g} cluster. This coefficient cannot be identified when cluster $g$ is omitted. In such a case, the matrix ${\bm{X}}^\top\!{\bm{X}} - {\bm{X}}_g^\top\!{\bm{X}}_g$ in \eqref{eq:delone} is singular, and CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ should not be computable. However, because \texttt{summclust} uses the \texttt{invsym} function in \texttt{Stata}, and hence a generalized inverse, the offending element of $\hat{\bm\beta}^{(g)}$ is simply replaced by~$0$. The package therefore checks whether any of the $\beta^{(g)}$ coefficients of interest are equal to $0$ and issues a warning when they are; see \Cref{sec:package}. \citet{MNW-bootknife} studies how to modify the WCR bootstrap (\Cref{sec:model}) to use CV$_{\tn3}$ instead of CV$_{\tn1}$ and how to modify the bootstrap DGP in a similar way. This yields several new bootstrap procedures. Limited simulation results suggest that, because using CV$_{\tn3}$ with the $t(G-1)$ distribution often works so well, the gains from using the new procedures for inference based on CV$_{\tn3}$ tend to be smaller than the gains from using the classic WCR bootstrap for inference based on CV$_{\tn1}$. \section{What Should Be Reported} \label{sec:report} When the number of clusters is small, it is easy enough to look at all the $N_g$, $\beta^{(g)}_j$, $L_g$, and $L_{gj}$ to see whether any clusters are unusually large, unusually influential, or have unusually high leverage or partial leverage. Once $G$ exceeds 10 or 12, however, it may be more informative to plot these quantities. This can be done in many different ways, including histograms and box plots. Another possibility is to report a number of summary statistics. The \texttt{summclust} package, to be discussed in \Cref{sec:package}, always reports the minimum, first quartile, median, mean, third quartile, and maximum of the $N_g$ and the $L_g$. It also reports these quantities for the $L_{gj}$ and the $\beta^{(g)}_j$ for the specified regressor~$j$. In the remainder of this section, we focus on cluster sizes and leverage. We consider a generic quantity $a_g$, which might denote any of $N_g$, $L_g$, or $L_{gj}$ for $g=1,\ldots,G$. It seems plausible that inference may be unreliable when any of the $a_g$ vary substantially across clusters, and we provide some evidence to support this conjecture in \Cref{sec:sims}. It may be attractive to report a single measure of how much the distribution of the $a_g$ differs from what it would be in the perfectly balanced case. There are many such measures. One possibility is the scaled variance \begin{equation} V_s(a_{\bullet}) = \frac{1}{(G-1)\bar a^2} \sum_{g=1}^G (a_g - \bar a)^2, \label{eq:coefvar} \end{equation} where the argument $a_{\bullet}$ is to be interpreted as the entire set of $a_g$ for $g=1,\ldots,G$, and $\bar a$ denotes the arithmetic mean, which is $N/G$ for the $N_g$, $k/G$ for the $L_g$, and $1/G$ for the $L_{gj}$. These are all positive numbers, so it is reasonable to scale by their squares. Larger values of $V_s$ imply that the $a_g$ are more variable across clusters, relative to their mean. We could report either $V_s$ or its square root, which is often called the coefficient of variation. In the perfectly balanced case, $V_s=0$. By default, \texttt{summclust} reports the coefficient of variation for the cluster sizes, the leverages, the partial leverages, and the $\hat\beta_j^{(g)}$\kern -0.08333em. Another possibility is to report one or more alternative sample means. The more these differ from the arithmetic mean, the more heterogeneous must be the clusters. Three common alternatives to the arithmetic mean are the harmonic, geometric, and quadratic means: \begin{equation} \bar a_{\rm harm} = \left(\frac{1}{G}\sum_{g=1}^G 1/a_g\right)^{\!\!\!-1}\kern -0.08333em, \quad \bar a_{\rm geo} = \left(\prod_{g=1}^G a_g\right)^{\!\!\!1/G}\kern -0.08333em, \;\;\mbox{and}\;\; \bar a_{\rm quad} = \left(\frac{1}{G}\sum_{g=1}^G a_g^2\right)^{\!\!\!1/2}\kern -0.08333em. \end{equation} Unless all the $a_g$ are the same, the harmonic and geometric means will be less than the arithmetic mean $\bar a$, and the quadratic mean (which has the same form as the root mean squared error of an estimator) will be greater than $\bar a$. We could either report the three alternative means directly, or the ratio of each of them to $\bar a$. The three ratios provide scale\kern 0.04167em-free measures of cluster heterogeneity; the closer they are to one, the more homogeneous are the clusters. \texttt{summclust} can, optionally, report all of these quantities. Another way to quantify the heterogeneity of the cluster sizes and the regressors is to calculate $G^*$\kern -0.08333em, the ``effective number of clusters,'' as proposed in \citet*{CSS_2017}. The value of $G^*$ depends on the coefficient $j$ for which it is being computed and on a parameter $\rho$ to be discussed below, so we denote it $G^*_j(\rho)$. It is defined as \begin{equation} G^*_j(\rho) = \frac{G}{1 + \Gamma_j(\rho)}\kern 0.08333em, \quad \Gamma_j(\rho) = \frac1G \sum_{g=1}^G \Big(\frac{\gamma_{gj}(\rho) - \bar\gamma_j(\rho)}{\bar\gamma_j(\rho)}\Big)^{\!2}, \quad \bar\gamma_j(\rho) = \frac1G\sum_{g=1}^G \gamma_{gj}(\rho), \label{eq:gstar} \end{equation} where $0\le\rho\le1$, and the $\gamma_{gj}(\rho)$ are given by \begin{equation} \gamma_{gj}(\rho) = {\bm{e}}_j^\top({\bm{X}}^\top{\bm{X}})^{-1} {\bm{X}}_g^\top{\bm{\Omega}}_g(\rho){\bm{X}}_g ({\bm{X}}^\top{\bm{X}})^{-1}{\bm{e}}_j, \quad g=1,\ldots,G. \label{eq:gammag} \end{equation} Here ${\bm{e}}_j$ is a $k$-vector with 1 in the \th{j} position and 0 everywhere else, so that ${\bm{e}}_j^\top({\bm{X}}^\top{\bm{X}})^{-1}$ is the \th{j} row of $({\bm{X}}^\top{\bm{X}})^{-1}$\kern -0.08333em, and ${\bm{\Omega}}_g(\rho)$ is an $N_g\times N_g$ matrix with 1 on the principal diagonal and $\rho$ everywhere else. It is easy to see that \begin{equation} {\bm{\Omega}}_g(\rho) = \rho\kern 0.08333em{\bm\iota}\biota^\top + (1-\rho)\kern 0.04167em{\bf I}, \label{eq:omega} \end{equation} where ${\bm\iota}$ is an $N_g$-vector of 1s, and ${\bf I}$ is an $N_g\times N_g$ identity matrix. Notice that $\Gamma_j(\rho)$ is just the scaled variance of the $\gamma_{gj}(\rho)$; compare \eqref{eq:coefvar}. The parameter $\rho$ may be interpreted as the intra-cluster correlation coefficient for a model with random effects at the cluster level. Since $\rho$ is unknown, \citet{CSS_2017} suggests calculating $G^*_j(1)$ as a sort of worst case. However, when there are fixed effects at the cluster level, or fixed effects at a finer level nested within clusters, those fixed effects will absorb all of the intra-cluster correlation. This can lead to numerical instabilities, as we discuss below. Thus it does not make sense to specify $\rho>0$ in either of these cases. It does seem natural to use $G^*_j(0)$, however, because the amount of intra-cluster correlation that remains in models with cluster fixed effects is often quite small. From \eqref{eq:gammag} and \eqref{eq:omega}, we see that \begin{equation} {\bm{X}}_g^\top{\bm{\Omega}}_g(\rho){\bm{X}}_g = \rho ({\bm\iota}^\top\!{\bm{X}}_g)^\top ({\bm\iota}^\top\!{\bm{X}}_g) + (1-\rho){\bm{X}}_g^\top{\bm{X}}_g. \label{eq:gammiddle} \end{equation} This result makes it inexpensive to compute the $\gamma_{gj}(\rho)$ for any value of $\rho$ by first computing them for $\rho=0$ and $\rho=1$. The needed equations are \begin{equation} \begin{aligned} \gamma_{gj}(0) &= {\bm{w}}_j^\top{\bm{X}}_g^\top{\bm{X}}_g\kern 0.08333em{\bm{w}}_j,\\ \gamma_{gj}(1) &= ({\bm\iota}^\top\!{\bm{X}}_g\kern 0.08333em{\bm{w}}_j)^\top({\bm\iota}^\top\!{\bm{X}}_g\kern 0.08333em{\bm{w}}_j), \;\mbox{and}\\ \gamma_{gj}(\rho) &= \rho\kern 0.08333em\gamma_{gj}(1) + (1-\rho)\gamma_{gj}(0), \end{aligned} \label{eq:gammarho} \end{equation} where ${\bm{w}}_j$ is the \th{j} column of $({\bm{X}}^\top{\bm{X}})^{-1}$. After obtaining the $\gamma_{gj}(\rho)$ from \eqref{eq:gammarho}, it is trivial to compute $G^*_j(\rho)$ using \eqref{eq:gstar}. Evidently, $G^*_j(\rho)$ is always less than $G$. When it is much smaller than~$G$, it can provide a useful warning. If we attempt to compute $G^*_j(\rho)$ for $\rho>0$ when there are cluster fixed effects, numerical instabilities are likely to arise. Suppose that we have partialed out cluster fixed effects prior to computing $G^*_j(\rho)$. Then the first term on the right-hand side of \eqref{eq:gammiddle} should in theory be a zero matrix, because every column of ${\bm{X}}_g$ should add to zero. In practice, however, the limitations of floating-point arithmetic mean that this matrix will actually contain extremely small positive numbers. When the fixed effects are not partialed out, similar but more complicated numerical issues arise. The Stata package \texttt{clusteff} discussed in \citet{LS_2018} is designed to calculate $G^*_j(\rho)$, with $\rho=0.9999$ rather than $\rho=1$ by default to avoid numerical instabilities. However, the only version of this package that we have used does so in a very computationally inefficient way. It apparently computes the $\gamma_g(\rho)$ by brute force instead of using \eqref{eq:gammarho}. When any of the $N_g$ is large, this can take a very long time, or even fail because Stata runs out of memory. For example, it failed with the samples used in \citet{MNW-guide}, where the largest values of $N_g$ were either $35,995$ or $144,914$. To circumvent this problem, one could use a random sample of the data for each cluster to compute an approximation to $G^*_j(\rho)$, but with \eqref{eq:gammarho} that is no longer necessary. Like $V_s(a_{\bullet})$ and the alternative sample means for measures of leverage and partial leverage discussed above, $G^*_j(\rho)$ is sensitive not only to variation in cluster sizes but also to other features of the ${\bm{X}}_g$ matrices. However, it is not sensitive to heteroskedasticity or to any other features of the disturbances. Our \texttt{summclust} package computes $G^*_j(0)$, $G^*_j(1)$, and (optionally) $G^*_j(\rho)$ for a specified covariate. However, when there are cluster fixed effects, or fixed effects nested within clusters, it will only compute $G^*_j(0)$. For example, it will not compute $G^*_j(\rho)$ for $\rho\ne0$ whenever there are state\kern 0.04167em-level fixed effects and clustering at the region level. The quantity $G^*_j(0)$ is very closely related to $V_s(L_{{\bullet}j})$, where $L_{{\bullet}j}$ denotes the entire set of $L_{gj}$, for $g=1,\ldots,G$. It is not hard to see that the $\gamma_g(0)$ defined in \eqref{eq:gammag} and \eqref{eq:gammarho} are equal to the $L_{gj}$ defined in \eqref{eq:partial} divided by $\acute{\bm{x}}_j^\top\acute{\bm{x}}_j$. Since this makes the $\gamma_g(0)$ proportional to the $L_{gj}$, $V_s(L_{{\bullet}j})$ is numerically identical to $\Gamma(0)$; compare \eqref{eq:coefvar} and the middle equation in \eqref{eq:gstar}. Thus we see from the first equation in \eqref{eq:gstar} that $G^*_j(0)$ is simply a monotonically decreasing function of the scaled variance of our measures of partial leverage at the cluster level. When $V_s(L_{{\bullet}j})$ is large, $G^*_j(0)$ is necessarily much smaller than $G$. Up to this point, we have focused on the case of one\kern 0.04167em-way clustering. However, it is also of interest to compute measures of leverage, partial leverage, and influence when there is multi\kern 0.04167em-way clustering \citep*{CGM_2011}. When there is two\kern 0.04167em-way clustering, which is the simplest and most commonly-encountered case, we recommend computing the usual one\kern 0.04167em-way measures of leverage, partial leverage, and influence for each of the two clustering dimensions. This requires calling \texttt{summclust} twice. When the number of clusters in either dimension is small, or any of these measures suggests that the data are seriously unbalanced in either dimension, then conventional inference can be seriously unreliable. The WCR bootstrap, applied to the dimension with the fewest clusters or the most unbalanced clusters \citep*{MNW_2021}, is likely to provide less unreliable inferences, but they may still be problematic. It would probably also be interesting to calculate the standard measures of leverage, partial leverage, and influence for the intersection of the two clustering dimensions. This means calling \texttt{summclust} a third time. Suppose there are two clustering dimensions, with $G$ clusters in the first dimension and $H$ clusters in the second. Then the number of intersection clusters is at most $GH$, but it can sometimes be smaller if some of the intersection clusters are empty. In order to use \texttt{summclust} for the intersections, it is necessary to create a new variable that uniquely identifies each of the intersection clusters. It is important to remember that, when \texttt{summclust} is invoked three times for each of two clustering dimensions and their intersection, the CV$_{\tn3}$ standard error that it reports for each of the three cases is based on a different pattern of one\kern 0.04167em-way clustering. When two\kern 0.04167em-way clustering is appropriate, none of these standard errors are valid. \section{Simulation Experiments} \label{sec:sims} In order to investigate the predictive power of various summary measures of leverage and partial leverage, we perform a few simulation experiments. The objective is to see whether the rejection frequencies for cluster-robust $t$-tests, both asymptotic and WCR bootstrap, can be predicted from summaries of the features of the ${\bm{X}}$ matrix. There are 3000 cases, each corresponding to a particular ${\bm{X}}$ matrix. For each case, we generate 10,000 values of ${\bm{y}}$ and use them to estimate rejection frequencies for tests at the .05 level. In the experiments, there are either 20 clusters and 2000 observations or 30 clusters and 3000 observations. The cluster sizes $N_g$ are determined by a parameter $\gamma\ge0$, as follows: \begin{equation} N_g = \left[N\frac{\exp(\gamma g/G)}{\sum_{j=1}^G \exp(\gamma j/G)}\right]\!,\;\; g=1,\ldots,G-1, \label{csgamma} \end{equation} where $[\cdot]$ denotes the integer part of its argument, and $N_G = N - \sum_{j=1}^{G-1} N_g$. As $\gamma$ increases, the cluster sizes become increasingly unbalanced. The value of $\gamma$ is varied uniformly between 2 and 4, so that the cluster sizes tend to vary quite a lot. When $G=20$, the smallest cluster has between 8 and 32 observations, and the largest has between 229 and 378. When $G=30$, the smallest cluster has between 7 and 32 observations, and the largest has between 237 and 396. There are five regressors, one of which is the test regressor, plus a constant term. The regressors are either 0 or 1. With probability $1-p_c$, all the observations in a cluster are~0. With probability $p_c$, they randomly equal either 0 or 1, both with probability 0.5. Thus, when $p_c=1$, all variation is at the individual level, and leverage tends to be proportional to cluster sizes. As $p_c$ declines, the samples become more unbalanced. In the experiments, the values of $p_c$ are chosen to be 0.25, 0.30, 0.35, 0.40, 0.50, and 0.60, each for one\kern 0.04167em-sixth of the cases. Smaller values of $p_c$ tend to be associated with larger discrepancies between actual rejection frequencies and .05, the nominal level of the tests. \begin{figure}[tb] \begin{center} \caption{Predicted rejection frequencies for asymptotic and bootstrap tests at .05 level} \label{fig:1} \includegraphics[width=0.99\textwidth]{inf-figB.pdf} \end{center} {\footnotesize \textbf{Notes:} Each of the curves shows fitted values from the generalized additive model \eqref{eq:ssmodel} that predicts observed rejection frequencies, based on 10,000 replications, using nonlinear functions of the $V_s(L_{{\bullet}j})$; see the text for details. Bootstrap rejection frequencies are based on $B=399$. For the asymptotic tests based on CV$_{\tn1}$, the $R^2$ is 0.9487 for $G=20$ and 0.9404 for $G=30$. For the tests based on CV$_{\tn3}$, the $R^2$ is 0.8709 for $G=20$ and 0.8811 for $G=30$. For the WCR bootstrap tests, the $R^2$ is 0.4593 for $G=20$ and 0.3400 for $G=30$.} \end{figure} For each experiment, we obtain 9000 estimated rejection frequencies. One\kern 0.04167em-third of these are based on CV$_{\tn1}$ and the $t(G-1)$ distribution, one\kern 0.04167em-third are based on CV$_{\tn3}$ and the $t(G-1)$ distribution, and one\kern 0.04167em-third are based on the WCR bootstrap with $399$ bootstrap samples. To predict these rejection frequencies, we use a generalized additive model based on smoothing splines; see \citet[Section~7.7]{JWHT}. The base model can be written as \begin{equation} r_i = \beta_0 + f_1(V_{si}) + f_2(V^{1/2}_{si}) + \beta_1 G^*_{i0} + u_i, \label{eq:ssmodel} \end{equation} where $r_i$ is the rejection frequency for case~$i$, $V_{si}$ denotes $V_s(L_{{\bullet}j})$, the scaled variance of the partial leverages $L_{gj}$ for the test regressor for case~$i$, $G^*_{i0}$ denotes $G^*_j(0)$ for the test regressor for case~$i$ (recall that it is a function of the $L_{gj}$), and $f_1(\cdot)$ and $f_2(\cdot)$ are smoothing splines with five degrees of freedom. Since everything on the right-hand side of \eqref{eq:ssmodel} is a function of $V_{si}$, this model is simply using the $V_{si}$ to predict the $r_i$ in a potentially nonlinear way. \Cref{fig:1} shows the fitted values from \eqref{eq:ssmodel}, which are predicted rejection frequencies, plotted against the scaled variance of the partial leverages $L_{gj}$ for three methods of inference and two sample sizes. Panel~(a) shows them for $t$-tests based on both CV$_{\tn1}$ (solid lines) and CV$_{\tn3}$ (dashed lines) for $G=20$ and $G=30$, and Panel~(b) shows them for WCR bootstrap tests for the same two cases. The $t$-tests based on CV$_{\tn1}$ often over-reject to an extreme degree. For the very smallest values of $V_s(L_{{\bullet}j})$, the tests tend to over-reject modestly, with predicted rejection frequencies of 0.058 for $G=20$ and 0.055 for $G=30$. However, these then rise quite rapidly and almost linearly. In fact, for $G=30$, \eqref{eq:ssmodel} omits the $f_2$ term because it has very little explanatory power. Nevertheless, the analysis of variance for nonparametric effects strongly suggests that there actually is nonlinearity for both $G=20$ and $G=30$. For $G=30$, there are four cases (out of 3000) for which $V_s(L_{{\bullet}j})>15$. These are not shown in the figure, but the approximately linear relationship continues to hold, and the fit for these extreme cases is reasonably good. In contrast, the $t$-tests based on CV$_{\tn3}$ tend to under-reject for small values of $V_s(L_{{\bullet}j})$. For the very smallest values, the predicted rejection frequencies are 0.033 for $G=20$ and 0.039 for $G=30$. Although it is not obvious from the figure, the CV$_{\tn3}$ tests are predicted to under-reject somewhat more than half the time, because, in our experiments, most values of $V_s(L_{{\bullet}j})$ are quite small. As $V_s(L_{{\bullet}j})$ increases, rejection frequencies increase, although for $G=20$ they start to decline again once $V_s(L_{{\bullet}j})$ exceeds about 9.6. The predicted rejection frequencies never exceed 0.105 for $G=20$ and 0.118 for $G=30$. In a few cases (74 for $G=20$ and 5 for $G=30$), it was impossible to obtain meaningful CV$_{\tn3}$ estimates because the matrix that is inverted in \eqref{eq:delone} was singular. This happened whenever one of the regressors took the same value for all observations in $G-1$ of the clusters. These cases were dropped. Panel~(b) of \Cref{fig:1} shows the fitted values from \eqref{eq:ssmodel} for WCR bootstrap $t$-tests plotted against the scaled variance of the $L_{gj}$. These curves are not even close to being linear. For both values of $G$, the predicted rejection frequencies are extremely close to .05 for the smallest values of $V_s(L_{{\bullet}j})$. They then rise for a while, achieving maxima of 0.061 for $G=20$ and 0.057 for $G=30$, and subsequently fall to very low levels. In fact, the predicted values for $G=20$ are slightly negative for a few extreme values of $V_s(L_{{\bullet}j})$ that are not shown in the figure, where the actual values that are being predicted are mostly zero. In one respect, Panel~(b) of \Cref{fig:1} is a bit misleading. It suggests that the bootstrap tests under-reject for most values of $V_s(L_{{\bullet}j})$. They actually over-reject much more often than they under-reject, because most of the observed values of $V_s(L_{{\bullet}j})$ are relatively small. For $G=20$, the crossover between over-rejection and under-rejection occurs at about 4.66, with only 380 values of $V_s(L_{{\bullet}j})$ (out of 3000) greater than 4.66. For $G=30$, the crossover occurs at about 6.12, with only 139 values of $V_s(L_{{\bullet}j})$ greater than 6.12. The bootstrap tests often under-reject when the number of ``treated'' clusters (that is, clusters that have any non-zero values of the test regressor) is small. When this happens, the asymptotic tests almost always over-reject, especially the ones based on CV$_{\tn1}$. Given the way we generate the regressors, this situation inevitably tends to occur more frequently, and to a greater extent, for $G=20$ than for $G=30$. Apparently $V_s(L_{{\bullet}j})$ tends to be quite large when this happens, so that \eqref{eq:ssmodel} is able to predict both the over-rejection by the asymptotic tests and the under-rejection by the bootstrap tests. It is natural to ask whether we can improve the fit of \eqref{eq:ssmodel} by adding additional explanatory variables that are not simply functions of the $V_s(L_{{\bullet}j})$. The answer is that we can. When a large number of additional explanatory variables is added to this equation, the variables $\bar a_{\rm geo}(L_{{\bullet}j})$ and $G^*_j(1)$ are always highly significant. In most cases, at least some functions of the $L_g$ are also significant. However, functions of partial leverage generally seem to have much more explanatory power than functions of leverage. The spline $f_1(V_{si})$ is always highly significant, even when many other regressors are included. Thus, at least in these experiments, the scaled variance of the partial leverages, which is the square of their coefficient of variation, seems to be particularly revealing. We make no effort to obtain the best possible predictive model, because the specification of any such model would be extremely dependent on the precise way in which the regressors in our experiments were generated. In particular, we simply add additional explanatory variables linearly, not within splines. Nevertheless, for all six experiments, we are able to reduce the residual standard errors substantially. In the best case, for $G=30$ and CV$_{\tn3}$, we can reduce it by 21\%. In the worst case, for $G=20$ and CV$_{\tn1}$, we can reduce it by 9\%. Thus it appears that no single summary statistic for either partial leverage or leverage can fully capture the effects of the ${\bm{X}}$ matrix on the rejection frequencies of either asymptotic or bootstrap tests. Based on these results, which are of course extremely dependent on the way in which the regressors are generated, it seems sensible for investigators to look at a number of different summary measures for both leverage and partial leverage. The \texttt{summclust} package therefore reports several of these. The most informative one seems to be the scaled variance, defined in \eqref{eq:coefvar}, of the partial leverage measures $L_{gj}$, defined in \eqref{eq:partial}, for the regressor of interest. However, this recommendation is necessarily very tentative. \section{The \texttt{summclust} Package} \label{sec:package} The \texttt{summclust} package calculates a large number of statistics to help assess cluster heterogeneity. It also provides CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ standard error estimates. The package does not rely on any other \texttt{Stata} packages, but it does require a version of \texttt{Stata} that provides Mata's panelsum() function (Version~13 or later). To illustrate \texttt{summclust}'s functionality and syntax, we consider a simple example using the online dataset \texttt{nlswork}, which contains a sample of women who were 14--26 years of age in 1968 from the National Longitudinal Survey of Young Working Women. Key output for this example is shown in this section. Additional output, along with a brief discussion, can be found in \Cref{sec:app}. All the output is displayed on screen, and most is also available in Mata and/or return memory using \texttt{r()}; see \Cref{sec:app}. Suppose we are interested in estimating a simple Mincer regression using the \texttt{nlswork} dataset. We want to ask whether there is a marriage premium for wages. The variable \texttt{msp} is equal to 1 if the person is married and cohabits with their spouse, and equal to 0 otherwise. For the purposes of this example, we cluster by industry. The following code opens the dataset and estimates the regression using Stata's \texttt{regress} command: \begin{verbatim} webuse nlswork, clear reg ln_wage i.grade i.age i.birth_yr union race msp, cluster(ind) \end{verbatim} \noindent The Stata output provides CV$_{\tn1}$ standard errors. Alternatively, we can estimate the coefficient on \texttt{msp} and two standard errors for it using \texttt{summclust}. The command is: \begin{verbatim} summclust msp, yvar(ln_wage) xvar(union race) \\\ fevar(grade age birth_yr) cluster(ind) \end{verbatim} \noindent This code results in the default output from \texttt{summclust}, which is mostly contained in two tables. The first one includes the coefficient on the variable specified (in this case \texttt{msp}), the CV$_{\tn1}$ and CV$_{\tn3}$ standard errors for this coefficient, and the associated $t$-statistics, $P$~values, and confidence intervals. \begin{verbatim} Cluster summary statistics for msp when clustered by ind_code. There are 19130 observations within 12 ind_code clusters. \end{verbatim} \begin{verbatim} Regression Output s.e. | Coeff Sd. Err. t-stat P value CI-lower CI-upper ------+---------------------------------------------------------------- CV1 | -0.027515 0.009293 -2.9608 0.0130 -0.047969 -0.007061 CV3 | -0.027515 0.014064 -1.9564 0.0763 -0.058470 0.003440 ----------------------------------------------------------------------- \end{verbatim} \noindent Unsurprisingly, the first row matches the output from the \texttt{regress} command. In this case, the CV$_{\tn1}$ and CV$_{\tn3}$ standard errors are noticeably different, with the latter being considerably larger. The second table from \texttt{summclust} may provide some insight as to why this is so. It reports summary statistics for $N_g$, $L_g$, $L_{gj}$, and $\beta_{j}^{(g)}$. \begin{verbatim} Cluster Variability Statistic | Ng Leverage Partial L. beta no g -----------+----------------------------------------------------- min | 38.00 0.093321 0.001622 -0.033200 q1 | 159.00 0.672924 0.008649 -0.029275 median | 995.50 3.515491 0.056682 -0.027765 mean | 1594.17 5.416667 0.083333 -0.026920 q3 | 2335.50 7.731883 0.120933 -0.025975 max | 6335.00 20.289183 0.312995 -0.015835 -----------+----------------------------------------------------- coefvar | 1.19 1.152965 1.141326 0.162898 \end{verbatim} \noindent We see that the clusters are extremely heterogeneous. The largest cluster contains almost one\kern 0.04167em-third of the sample and is 167 times the size of the smallest. There are also extreme differences in both leverage and partial leverage across clusters. The ratio of the largest to the smallest value is 217 for leverage and 193 for partial leverage. The sum of the leverages is $12 \times 5.416667 = 65$, which is the number of estimated coefficients. Although the $\beta_{j}^{(g)}$\kern -0.08333em, denoted ``beta no g'' in the table, vary quite a bit, dropping one cluster never changes the sign of the coefficient. The syntax of \texttt{summclust} requires that the first argument be the variable corresponding to the coefficient of interest, in this case \texttt{msp}. The arguments \texttt{yvar}, \texttt{xvar}, and \texttt{cluster}, which follow the comma after \texttt{msp}, are required. The dependent variable is specified in \texttt{yvar}. The clustering variable is specified in the \texttt{cluster} argument. The treatment of additional independent variables requires a bit more discussion. The argument \texttt{xvar} is used for listing `ordinary' regressors, such as continuous and binary variables. In the example above, these are the binary indicators for union and race. Time\kern 0.04167em-series operators and factor variables are not permitted within \texttt{xvar}. The optional argument \texttt{fevar} should be used for the latter. This argument includes all the listed variables as factor variables to be treated as additional independent variables. In the above example, these are \texttt{grade}, \texttt{age}, and \texttt{birth\_yr}. Each argument in \texttt{fevar} will result in the creation of a set of temporary dummy variables for each value of the argument. These dummy variables are included in the regression, and there is no constant term if they are present. The sample code above does not illustrate several additional options. The most important of these is the \texttt{absorb} option, which operates like \texttt{fevar}. It treats its argument, a single variable, as an additional factor variable to include in the set of regressors. \texttt{absorb(varname)} can be used when including \texttt{i.varname} in a regression would result in many fixed effects. Speed is increased, perhaps substantially, by partialing out the absorbed fixed effects from the dependent and all the independent variables. It is advisable to use \texttt{absorb} rather than \texttt{fevar} whenever their argument corresponds to a set of cluster fixed effects, since the elements of $\hat{\bm\beta}^{(g)}$ that correspond to the fixed effects cannot be identified in that case; see \Cref{sec:influential}. The \texttt{absorb} option should be used with care. Partialing out fixed effects is valid for the measures of leverage and influence and for the jackknife variance matrices only when the absorbed variable yields fixed effects that can be partialed out on a cluster-by-cluster basis. That is, \texttt{absorb} should only be used for straight cluster fixed effects or for fixed effects at a finer level, such as state $\times$ year fixed effects for a panel with clustering at the state level. It is not valid to partial out fixed effects that are not limited to a single cluster. In that case, the ${\bm\beta}^{(g)}$ and quantities based on them would be different for the original data and the data after partialing out, because the partialed-out observations for the \th{g} cluster would depend on other clusters as well. Accordingly, \texttt{summclust} checks to ensure that the clustering variable is invariant within each value of the absorb variable. When it is not, a warning is displayed, and the estimates for $L_{gj}$, $\beta_{j}^{(g)}$\kern -0.08333em, CV$_{\tn3}$, and CV$_{\tn3{\rm J}}$ are not available. To see the difference between \texttt{fevar} and \texttt{absorb}, we can estimate an expanded regression that includes industry fixed effects. The following two commands produce identical estimates for $N_g$, $L_{gj}$, $\beta_{j}^{(g)}$, and CV$_{\tn3}$. However, the estimates of the $L_g$ are different. \begin{verbatim} summclust msp, yvar(ln_wage) xvar(union race) \\\ fevar(grade age birth_yr ind) cluster(ind) \end{verbatim} \begin{verbatim} summclust msp, yvar(ln_wage) xvar(union race) \\\ fevar(grade age birth_yr) absorb(ind) cluster(ind) \end{verbatim} \noindent Including the cluster fixed effects changes the coefficient and the two standard errors. Both commands produce the following regression output: \begin{verbatim} Regression Output s.e. | Coeff Sd. Err. t-stat P value CI-lower CI-upper ------+---------------------------------------------------------------- CV1 | -0.020895 0.007086 -2.9487 0.0132 -0.036492 -0.005299 CV3 | -0.020895 0.007931 -2.6345 0.0232 -0.038352 -0.003438 ----------------------------------------------------------------------- \end{verbatim} \noindent However, they produce somewhat different output for cluster variability, as measured by leverage; see \Cref{sec:app}. The option {\tt \underbar{sam}ple} allows for sample restrictions. The argument(s) for this option are whatever would follow the ``if'' in a standard \texttt{regress} command. For instance, in order to restrict the analysis to individuals 25 years of age or older in the nlswork example, \texttt{sample(age>=25)} should be added to the list of options. The remaining options instruct \texttt{summclust} to print additional output. For the \texttt{nlswork} example, this output is shown in \Cref{sec:app}. \hangindent=\parindent\hangafter=1\noindent {\tt \underbar{jack}knife} calculates the CV$_{\tn3{\rm J}}$ standard error and the associated $t$-statistic, $P$ value, and confidence interval. These results are displayed in an additional row in the Regression Output table. \hangindent=\parindent\hangafter=1\noindent {\tt \underbar{sv}ars} prints the alternative means of the $N_g$, $L_g$, $L_{gj}$, and $\beta_j^{(g)}$\kern -0.08333em, as described in \Cref{sec:report}. For the $N_g$, $L_g$, and $L_{gj}$, it reports the harmonic, geometric, and quadratic means, as well as the ratio of each of them to the arithmetic mean. For the $\beta_j^{(g)}$\kern -0.08333em, which can be negative, only the quadratic mean and its ratio are reported, because the harmonic and geometric means are not defined for negative numbers. \hangindent=\parindent\hangafter=1\noindent {\tt gstar} calculates the effective number of clusters $G^*_j(0)$. When there are no cluster fixed effects, or fixed effects nested within clusters, it also calculates $G^*_j(1)$. \hangindent=\parindent\hangafter=1\noindent {\tt \underbar{r}ho} calculates the effective number of clusters, $G_j^*(\rho)$, but only if it is valid to do so. It either prints $G_j^*(\rho)$ in addition to $G^*_j(0)$ and $G^*_j(1)$, or it reports that $G_j^*(\rho)$ cannot be computed and prints only $G^*_j(0)$. This option can be specified with or without also specifying \texttt{gstar}, and the output will be the same in either case. The value of $\rho$ is specified as \texttt{rho($\rho$)}, where $\rho$ must be between 0 and~1. The program stops and displays an error message when an invalid value of $\rho$ is entered. \hangindent=\parindent\hangafter=1\noindent {\tt \underbar{tab}le} prints a table of the $G$ cluster-specific estimates of $N_g$, $L_g$, $L_{gj}$, and~$\beta_{j}^{(g)}$. If $G > 52$, then the unformatted matrix is displayed instead of a table. \section{Empirical Example} \label{sec:empirical} We consider an empirical example from \citet{BG_2019}, which studies an experiment where retail firms were randomly assigned to enter different geographic markets within the Dominican Republic. Firm entries were assigned across 72 districts, with clustering by district. After randomization, 21 districts had no entrants and so were in the control group, 18 districts had one entrant, another 18 had two, and the remaining 15 had three. The primary analysis only distinguishes between the 51 treated districts and the 21 control districts. The number of observations (stores) per district varies from 20 to~55. This example is interesting because conventional wisdom \citep[e.g.,][]{MNW-guide} suggests that, with 72 clusters that do not vary much in size, and with neither few treated nor few control clusters, inference based on CV$_{\tn1}$ standard errors and the $t(71)$ distribution should work well. However, our leverage measures suggest otherwise, and alternative inference methods yield noticeably different results. The model we estimate is \begin{equation} Y_{sd} = \alpha + \gamma Z_d + {\bm{X}}_{sd}\kern 0.08333em{\bm\beta} + \epsilon_{sd}. \label{mainreg} \end{equation} Here $s$ indexes stores, and $d$ indexes districts. The treatment variable $Z_d$ equals~1 if district~$d$ is treated (there was entry) and~0 if it was a control (there was no entry). The coefficient of interest is $\gamma$, which measures the causal effect of increased competition on an outcome $Y$\kern -0.08333em. The original paper deals with many outcomes, but we focus on just one of them, the log of demeaned prices after treatment. The results from this regression are found in Table~5, Panel~B, column~4, row~1 of \citet{BG_2019}. The table states that there are 72 clusters and $2,025$ observations; however, the replication dataset that we use contains just $1,926$ observations. Regression \eqref{mainreg} includes 17 control variables in the row vector ${\bm{X}}_{sd}$. These are the first lag of the outcome variable, the number of retailers in each neighborhood pre\kern 0.04167em-treatment, a lagged quality index, eight province fixed effects, total neighborhood beneficiaries of a conditional cash transfer program, percent beneficiaries of that program, average income in the district, two district education measures, and a binary indicator for the urban status of the district. Thus the total number of regressors is~19. \begin{table}[tp] \caption{Estimates of the Treatment Effect} \label{tab:ests} \vspace*{-0.5em} \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcccc} \toprule Method &$\hat\gamma$ &Standard Error &$P$ value &Confidence Interval \\ \midrule CV$_{\tn1}$ &$-0.01469$ &$0.00724$ &$0.0461$ &[$-0.02913$, $-0.00025$]\\ CV$_{\tn3}$ &$-0.01469$ &$0.00909$ &$0.1105$ &[$-0.03281$, \phantom{+}$0.00343$]\\ WCR bootstrap &$-0.01469$ & &$0.0898$ &[$-0.03125$, \phantom{+}$0.00245$]\\ \bottomrule \end{tabular*} \vskip 6pt {\footnotesize \textbf{Notes:} There are $N=1,926$ observations and $G=72$ clusters. The WCR bootstrap uses $B=999,999$.} \end{table} The OLS estimate of $\gamma$, its CV$_{\tn1}$ standard error, the $P$ value for a test that $\gamma=0$, and a .95 confidence interval are shown in the first row of \Cref{tab:ests}. Allowing for different numbers of reported digits, these estimates accord with the ones in \citet{BG_2019}. The estimate of $-0.01469$ has the expected sign (average prices declined). However, the $P$ value is just slightly less than 0.05, and the confidence interval barely excludes~0. \begin{table}[tp] \caption{Leverage and Partial Leverage for $\hat\gamma$} \label{tab:comp_sum} \vspace*{-0.5em} \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}lcccc} \toprule Statistic & $N_g$ & Leverage & Partial Leverage & $\hat\gamma^{(g)}$ \\ \midrule Minimum & 20\phantom{.0} & 0.130842 & 0.000099 & $-0.017550$ \\ First quartile & 24\phantom{.0} & 0.204104 & 0.003166 & $-0.015089$ \\ Median & 26\phantom{.0} & 0.235813 & 0.009001 & $-0.014791$ \\ Mean & \phantom{0}26.75 & 0.263889 & 0.013889 & $-0.014663$ \\ Third quartile & 27\phantom{.0} & 0.292042 & 0.020926 & $-0.014070$ \\ Maximum & 55\phantom{.0} & 0.737797 & 0.064242 & $-0.010723$ \\ Coef.\ of variation &\phantom{00}0.21 &0.388686 &1.059813 &$\phantom{-}0.074061$ \\ \bottomrule \end{tabular*} \vskip 6pt {\footnotesize \textbf{Notes:} There are $N=1,926$ observations and $G=72$ clusters. The effective numbers of clusters are $G^*_{\gamma}(0) = 34.16$ and $G^*_{\gamma}(1) = 33.33$.} \end{table} We next use the \texttt{summclust} package to calculate the cluster-level characteristics of the model and dataset. Some key ones are reported in \Cref{tab:comp_sum}. It is evident that cluster sizes are well balanced, varying from 20 to 55, with the first and third quartiles equal to 24 and 27. However, both the leverages $L_g$ and the partial leverages $L_{g1}$ vary considerably. The former range from 0.1308 to 0.7378, and the latter from 0.0001 to 0.0642. The coefficients of variation are 0.3887 and 1.0598, respectively. The latter is moderately large, although not enormous. The two values of $G^*$ are slightly smaller than $G/2$, which also suggests that the sample is not well balanced. Most of the $\hat\gamma^{(g)}$ do not vary much, and thus their coefficient of variation is small. However, the most extreme values are notable. The estimate of~$\gamma$, which is $-0.01469$, could be as small as $-0.01755$ or as large as $-0.01072$ if just one out of 72 clusters were dropped. These results suggest that CV$_{\tn1}$, the default CRVE, may not be particularly reliable in this case. We therefore consider two alternative procedures. The second row of \Cref{tab:ests} reports the CV$_{\tn3}$ standard error as well as the $P$ value and confidence interval associated with it, computed using \texttt{summclust}. At $0.1105$, the CV$_{\tn3}$ $P$ value does not even allow us to reject the null at the .10 level. The third row of \Cref{tab:ests} reports a WCR bootstrap $P$ value and a .95 confidence interval, both computed using \texttt{boottest} \citep{RMNW}. At 0.0898, the bootstrap $P$ value also does not allow us to reject the null hypothesis at the .05 level. Of course, both these confidence intervals include~0. In view of the reasonably large number of clusters and the fact that cluster sizes do not vary much, the large discrepancy between the results for CV$_{\tn1}$ and the other two procedures may seem surprising. However, it is not all that surprising when we note how much the leverages and, especially, the partial leverages vary. \begin{figure}[tb] \begin{center} \caption{\label{fig:competition}{Partial Leverage vs Cluster Size}} \vskip -8pt {\includegraphics[width=0.90\textwidth]{competition.pdf}} \end{center} \vskip -20pt {\footnotesize \textbf{Notes:} The figure plots partial leverage against cluster size for 72 clusters. A green X marks a treated cluster, and an orange circle marks a control cluster.} \end{figure} To explore what is driving the differences in partial leverage, we create a scatter plot. \Cref{fig:competition} plots partial leverage against the number of observations per cluster, with different colors and symbols depending on whether or not a given district (cluster) was treated. The figure has two interesting features. The first is that the three rather large clusters have fairly small partial leverage. The second is that the 12 clusters with the highest partial leverage are all control districts. The first result is quite surprising, since large clusters often tend to have high leverage. But \Cref{fig:competition} makes it clear that there is, in general, no simple relationship between cluster sizes and partial leverage. The second result is not so surprising, because only 21 out of the 72 clusters are controls. Many of the control clusters presumably have high partial leverage because control clusters are relatively rare. \section{Concluding Remarks} \label{sec:conc} In modern empirical work, it is very often assumed that the observations belong to a number of disjoint clusters. No dependence across clusters is allowed, but, as we discuss in \Cref{sec:model}, there may be arbitrary patterns of heteroskedasticity and correlation within each cluster. In such cases, the key unit of observation is the cluster. It therefore makes sense to examine measures of influence, leverage, and partial leverage at the cluster level. As we discuss in \Cref{sec:influential}, these measures are easy to compute and are conceptually very similar to classic measures of influence, leverage, and partial leverage at the observation level. In simple cases, our measures can be obtained theoretically, and studying such cases, as we do in \Cref{sec:examples}, provides some useful insights. Our measure of influence, which is closely related to the jackknife, can provide valuable information about how empirical results depend on the data in the various clusters. Investigators should be wary if dropping one or two clusters changes the results dramatically. In \Cref{sec:jack}, we show how to calculate two jackknife variance matrix estimators, CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$, very rapidly as a byproduct of our other computations. Although these estimators are not new \citep{BM_2002}, they have until recently been difficult or impossible to compute for large samples. In related work \citep{MNW-bootknife}, we show that CV$_{\tn3}$ and CV$_{\tn3{\rm J}}$ generally yield extremely similar results, and that they are often much more reliable than the widely-used CV$_{\tn1}$ variance matrix estimator. \Cref{fig:1} provides additional evidence on the latter point. We recommend that our measures of leverage and partial leverage be used as diagnostic tools to identify datasets and regression designs in which cluster-robust inference is likely to be challenging. In \Cref{sec:report}, we discuss several ways of summarizing these measures. In \Cref{sec:sims}, we show that many of these summary statistics, especially the scaled variance of the partial leverages, can help to explain how well both asymptotic and bootstrap cluster-robust inference performs when the number of clusters is modest (20 or 30 in our experiments). We argue that investigators should examine a number of these summary statistics and exercise caution whenever there seems to be a lot of variation across clusters. In \Cref{sec:empirical}, we present an empirical example in which conventional asymptotic inference based on CV$_{\tn1}$ seems to work poorly, even though there are 72 clusters that do not vary much in size, and neither the number of treated clusters nor the number of control clusters is particularly small. However, since our measures of partial leverage vary quite a lot, with a coefficient of variation that exceeds one, there is reason to worry about the accuracy of conventional inferences based on CV$_{\tn1}$ and the $t(71)$ distribution. In fact, both CV$_{\tn3}$ and the WCR bootstrap yield inferences that differ substantially from the conventional ones. The procedures that we discuss in this paper are implemented in a new Stata package called \texttt{summclust}, which may be obtained from \texttt{SSC} or \url{https://github.com/mattdwebb/summclust}. A detailed description of the summclust command and its options is given in \Cref{sec:package}.
\chapter*{List of Mathematical Symbols} \markboth{\MakeUppercase{List of Mathematical Symbols}}{} Mathematical symbols, where relevant, are grouped based on the chapter in which they are first introduced. For a symbol, if a relevant definition is provided in the body of the report, a reference is given. \section*{General Symbols} \begin{tabular}{ll} $\mathcal{O}$ & Big O notation. \\[0.2cm] $\text{BPM}$ & Beats per minute. \\[0.2cm] \end{tabular} \section*{\Cref{tb_quant}} \begin{tabular}{ll} $\delta_s$ & Score note search bound; \Cref{def:bound_ms}. \\[0.2cm] $t_e$ & The estimated note onset time in the performance audio file. \\[0.2cm] $t_d$ & The detected time relative to the performance audio file. \\[0.2cm] $t_s$ & The note onset time in the score. \\[0.2cm] $t_r$ & The true note onset time in the performance audio. \\[0.2cm] $e_i$ & Error; \Cref{def:error}. \\[0.2cm] $l_i$ & Latency; \Cref{def:latency}. \\[0.2cm] $o_i$ & Offset; \Cref{def:offset}. \\[0.2cm] $r_m$ & Miss rate. \\[0.2cm] $r_e$ & Misalign rate. \\[0.2cm] $\theta_e$ & Misalignment threshold; \Cref{def:misalign}. \\[0.2cm] $p_e$ & Piece completion; \Cref{def:pc}. \\[0.2cm] $\sigma_e$ & Standard deviation of error. \\[0.2cm] $\text{MAE}$ & Mean absolute error. \\[0.2cm] $\mu_e$ & Mean imprecision. \\[0.2cm] $r_p$ & Precision rate. \\[0.2cm] $r_{pp}$ & Piecewise precision rate. \\[0.2cm] $r_{pt}$ & Total precision rate. \\[0.2cm] $\mu_l$ & Mean latency. \\[0.2cm] $\sigma_l$ & Standard deviation of latency. \\[0.2cm] $\text{MAO}$ & Mean absolute offset. \\[0.2cm] $\sigma_o$ & Standard deviation of offset. \\[0.2cm] \end{tabular} \newpage \section*{\Cref{tb_qual}} \begin{tabular}{ll} $\textsc{Timestamps}$ & List of timestamps; \Cref{def:closesttimestamp}. \\[0.2cm] $\textsc{Timestamp}_f$ & Timestamp provided by follower; \Cref{def:closesttimestamp}. \\[0.2cm] $\textsc{Timestamp}_c$ & Timestamp giving the smallest $\textsc{Error}$; \Cref{def:closesttimestamp}. \\[0.2cm] $\textsc{Error}$ & The error between two timestamps; \Cref{def:closesttimestamp}. \\[0.2cm] $\textsc{UpperBoundOrEqual}(x, lst)$ & A function that finds the first element greater than or equals $x$ in $lst$. \\[0.2cm] $\textsc{LowerBoundOrEqual}(x, lst)$ & A function that finds the first element less than or equals $x$ in $lst$. \\[0.2cm] \end{tabular} \section*{\Cref{impl_beat}} \begin{tabular}{ll} $\hat{\tau}$ & Instantaneous tempo; \Cref{def:insttempo}. \\[0.2cm] $t_{b}$ & The time of a detected beat; \Cref{def:insttempo}. \\[0.2cm] $a_{d}$ & Acceleration in direction $d$. \\[0.2cm] $\delta_{|a|}$ & Absolute change in acceleration; \Cref{def:abschgaccel}. \\[0.2cm] $T_{delay}$ & Time delay. \\[0.2cm] $\tau_a$ & Detected tempo in audio; \Cref{def:targplaybackrate}. \\[0.2cm] $\tau_d$ & Desired audio tempo; \Cref{def:targplaybackrate}. \\[0.2cm] \end{tabular} \newpage \section*{\Cref{impl_asm}} \begin{tabular}{ll} $S$ & Score MIDI Data; \Cref{def:score_alignment_asm}. \\[0.2cm] $P$ & Performance MIDI Data; \Cref{def:score_alignment_asm}. \\[0.2cm] $L$ & An alignment between Score and Performance MIDI Data; \Cref{def:score_alignment_asm}. \\[0.2cm] $N$ & The set of musical notes. \\[0.2cm] $\Gamma$ & Gap; \Cref{def:score_alignment_asm}. \\[0.2cm] $\alpha$ & Score for a match; \Cref{asm_three_error_def}. \\[0.2cm] $\beta$ & Score for a mismatch; \Cref{asm_three_error_def}. \\[0.2cm] $\gamma$ & Score for an indel; \Cref{asm_three_error_def}. \\[0.2cm] $\textsc{Sim}$ & Similarity function; \Cref{sim_func_defn}. \\[0.2cm] $G$ & A grid system based on $P$ and $S$ to contain alignment scores. \\[0.2cm] $\textsc{Score}$ & Score function; \Cref{def:scorefunc}. \\[0.2cm] $\textsc{Trace}$ & Backward tracing function to return optimal alignments. \\[0.2cm] $\beta_s(c_1, c_2)$ & Score function for a mismatch between two elements $c_1$ and $c_2$. \\[0.2cm] $\Psi$ & A list of sets where each set $\psi$ contains parallel notes for a time instance in the score. \\[0.2cm] $\textsc{ChordScore}$ & A function returning the score for matching a note in a chord. \\[0.2cm] $\text{clamp}$ & The mathematical clamp function that bounds $x$ between $a$ and $b$. \\[0.2cm] $\textsc{Cost}$ & Cost function. \\[0.2cm] $J(a, b)$ & A function that returns the Jaccard index of sets $a$ and $b$. \\[0.2cm] $\epsilon$ & Maximum interval for chord execution; \Cref{def:maxintchordexe}. \\[0.2cm] $\delta$ & Post-alignment parallel voice threshold; \Cref{def:postalignparvoicethres}. \\[0.2cm] $N_{\Gamma P}$ & Number of gaps in performance. \\[0.2cm] $N_{\Gamma S}$ & Number of gaps in score. \\[0.2cm] $N_{\textsc{Mismatch}}$ & Number of mismatches. \\[0.2cm] \end{tabular} \newpage \section*{\Cref{impl_dtw}} \begin{tabular}{ll} $\mathcal{S}$ & Feature vector representing the time series of the score; \Cref{def:scofo_dtw}. \\[0.2cm] $\mathcal{P}$ & Feature vector representing the time series of the performance; \Cref{def:scofo_dtw}. \\[0.2cm] $\mathcal{W}$ & Optimal alignment path between $\mathcal{S}$ and $\mathcal{P}$; \Cref{def:scofo_dtw}. \\[0.2cm] $\mathcal{D}(\mathcal{W})$ & Cost of a path $\mathcal{W}$; \Cref{def:scofo_dtw}. \\[0.2cm] $d$ & Distance function. \\[0.2cm] $\sigma_t$ & Standard deviation of time estimate; \Cref{def:timefreq}. \\[0.2cm] $\sigma_\omega$ & Standard deviation of frequency estimate ($\si{\radian}\,\si{\second}^{-1}$); \Cref{def:timefreq}. \\[0.2cm] $\sigma_f$ & Standard deviation of frequency estimate (\si{\hertz}); \Cref{def:timefreq}. \\[0.2cm] $Q$ & The ratio of the centre frequency to the bandwidth. \\[0.2cm] $f_s$ & Sampling rate. \\[0.2cm] $N_{bin}$ & Number of bins per octave. \\[0.2cm] $f_{\min}$ & Minimum frequency. \\[0.2cm] $f_{\max}$ & Maximum frequency. \\[0.2cm] $W$ & Window function. \\[0.2cm] $K$ & Total number of frequency bins. \\[0.2cm] $\Omega$ & Bandwidth. \\[0.2cm] $x$ & A signal of length $L$; \Cref{alg:nsganalysis}. \\[0.2cm] \textbf{$\textbf{(I)FFT}_N$} & (Inverse) FFT of length $N$; \Cref{alg:nsganalysis}. \\[0.2cm] $g_k$ & Real-valued filters centred at $\omega_k$ forming the vector $\textbf{g}$; \Cref{alg:nsganalysis}. \\[0.2cm] $I_k$ & Finite index set where $k \in I_k$; \Cref{alg:nsganalysis}. \\[0.2cm] $c$ & \textbf{CQ-NSGT} coefficients; \Cref{alg:nsganalysis}. \\[0.2cm] $h_0$ & Slicing window centred at $0$. \\[0.2cm] $s$ & \textbf{SliCQ} (slice) coefficients. \\[0.2cm] $C_Q$ & Constant-Q coefficients; \Cref{def:normenergy}. \\[0.2cm] $E$ & Energy; \Cref{def:normenergy}. \\[0.2cm] $w_a$, $w_b$, $w_c$ & Weights used to introduce bias towards a certain step direction in DTW; \autoref{eqn:oltw_dtw}. \\[0.2cm] \texttt{c} & Search window. \\[0.2cm] \texttt{MaxRunCount} & A constraint that constrains the slope of the path. \\[0.2cm] $M$ & The cost matrix system containing $\mathcal{P}$, $\mathcal{S}$ and $\mathcal{D}$. \\[0.2cm] $(\texttt{i}, \texttt{j})$ & Coordinate of the top-rightmost calculated position in $M$. \\[0.2cm] \texttt{previous} & Previous direction(s) incremented. \\[0.2cm] \texttt{current} & Current direction(s) to increment. \\[0.2cm] \texttt{runCount} & The number of consecutive times the system is incremented in a certain direction. \\[0.2cm] $(i', j')$ & The latest coordinate of the lowest cost path. \\[0.2cm] \end{tabular} \chapter*{List of Acronyms} \markboth{\MakeUppercase{List of Acronyms}}{} \begin{acronym}[MIREX] \acro{A-A}{Audio-to-Audio} \acro{A-S}{Audio-to-Symbolic} \acro{AMT}{Automatic Music Transcription} \acro{API}{Application Programming Interface} \acro{APT}{Automatic Page Turning} \acro{ASM}{Approximate String Matching} \acro{CQT}{Constant Q-Transform} \acro{CRF}{Conditional Random Field} \acro{DCT}{Discrete Cosine Transform} \acro{DSP}{Digital Signal Processing} \acro{DTW}{Dynamic Time Warping} \acro{FFT}{Fast Fourier Transform} \acro{GPLv3}{GNU General Public Licence v3.0} \acro{GUI}{Graphical User Interface} \acro{HMM}{Hidden Markov Model} \acro{IR}{Impulse Response} \acro{JIT}{Just-in-Time} \acro{MFCC}{Mel Frequency Cepstral Coefficient} \acro{MIDI}{Musical Instrument Digital Interface} \acro{MIR}{Music Information Retrieval} \acro{MIREX}{Music Information Retrieval Evaluation eXchange} \acro{ML}{Machine Learning} \acro{NMF}{Non-negative Matrix Factorisation} \acro{NSG}{Nonstationary Gabor} \acro{OCR}{Optical Character Recognition} \acro{OLTW}{Online Time Warping} \acro{OMR}{Optical Music Recognition} \acro{PF}{Performance Features} \acro{QIP}{Quantum Image Processing} \acro{QbH}{Query by Humming} \acro{RL}{Reinforcement Learning} \acro{RNN}{Recurrent Neural Network} \acro{S-S}{Symbolic-to-Symbolic} \acro{SF}{Score Features} \acro{SMC}{Sequential Monte Carlo} \acro{SMF}{Standard MIDI File} \acro{STFT}{Short-time Fourier Transform} \acro{WTW}{Windowed Time Warping} \end{acronym} \chapter{Introduction} \epigraph{\itshape I think we will find more and more ways in which technology invades our artistic spaces, so music is something you will need more than ever because it is there in time and in space and for that moment only.}{Simon Rattle} \section{Motivation} Portable digital devices, especially tablet computers such as the iPad and the Microsoft Surface, transformed the music education and production industries. In the former industry, the iPad--equipped with interactive touch-enabled music education applications--is now ubiquitous in elementary music classes \cite{ruismaki13, riley15}; in the latter, music composition and performance software running on portable devices are gradually gaining its way into normal use by professional and amateur musicians of many genres \cite{staffpad, musicnotes, tuneapp, forscore}. Moreover, it is worth noting that, these days, professional musicians, whether individual musicians \cite{ravelyuja}, ensembles \cite{debussyborromeo} or even large orchestras \cite{tonkunstlerorch}, can be seen performing on stage with digital sheet music. Further, musical scores are readily available as digital copies through music catalogues such as \textit{IMSLP}\footnote{\url{https://imslp.org/wiki/Main_Page}} and online music stores. With the exponential growth in popularity and computation power of these devices \cite{tabletgrowth} in mind, there exists even more potential for them to become more indispensable to all musicians--a musician's digital companion should not only be limited to merely a paper sheet music replacement. One such area that is quite needed and useful is the crux of this project: \textbf{score following}, i.e. real-time tracking of the position of a musical performance on a musical score according to the musical performance. Many useful applications of score followers exist, such as automatic page turning (APT) and computer-aided accompaniment. These and other applications are detailed further in \autoref{scofo_apps}. \section{Challenges} \label{challenges} This project recognises three main challenges in score following research and development. The first two relates to research and evaluation problems of score following. The final challenge lies in the actual implementation and development of a robust score follower. The three subsections below detail the challenges. \subsection{Research} Research into score following is extensive, ranging from elementary ``string matching'' techniques, first introduced in 1984 \cite{dannenberg84,vercoe84}, to state-of-the-art deep learning algorithms that can follow raw sheet music images \cite{henkel20}. Many works in the literature also develop different types of score followers, such as systems that take in MIDI as opposed to those that take in audio. Hence, it is daunting for new researchers to study existing literature and come up with novel solutions in a specific area or application. \subsection{Evaluation} Following from the fact that there are many types of score followers, naturally, evaluation of score followers is not well standardised. While there was effort in 2006 to standardise evaluation \cite{mirex, cont07} as part of MIREX, currently, the evaluation standards are considered out of date given the speed at which score following research is carried out. This had two implications: firstly, many research groups decided to up with their own--often proprietary--evaluation and comparison strategies that unfortunately favours their own approach; secondly, the MIREX evaluation was not popular among researches in the field (there were usually only a few submissions per year and from 2018 onwards there were none). Further, proof of concept score following software that applies score following in practical applications such as computer-aided accompaniment \cite{musicplusone} and APT \cite{arzt08} is often written ad hoc as part of the research project, resulting in software incompatible with standardised evaluations. \subsection{Score Following} Finally, the biggest challenge is that score following in itself is a well-known difficult problem \cite{sturm13,mullerdtw,dannerberg03,chen19,heijink00}, significant enough, in fact, that an entire chapter--\autoref{scofo_challenges}--is dedicated to detail the main challenges. In short, these challenges include difficulties in feature extraction from the performance audio, deviations (intentional and unintentional) between human performances and the corresponding score, underspecified sheet music, music improvisation and polyphonic music. \section{Contributions} \label{intro:contrib} The contributions of this project are threefold, each relating to the three respective challenges identified in \autoref{challenges}. Firstly, the project provides an extensive review of score following's applications, technicalities and challenges before diving into almost 40 years of score following research, providing a detailed and critical overview of research ranging from early pioneering work to recent state-of-the-art solutions. Secondly, two open-source evaluation testbenches--one quantitative and the other qualitative--for score following are introduced. A novel way of obtaining quantitative testbench data is proposed, and the \textit{QualScofo} dataset is introduced for qualitative benchmarking. The two testbenches have a well-defined API that can be compatible with most score followers. The qualitative testbench also demonstrates practical usages, such as APT, for the score follower in question. Thirdly, three score followers are created. First, a beat-tracking-based approach is incorporated into an interactive conductor application to showcase an entertaining application for score following. Secondly, an Approximate String Matching (ASM) aligner is implemented as part of a novel way to produce testbench data for the quantitative testbench, as well as to provide more technical background details of score following. Finally, a CQT-DTW score follower is implemented--it is shown that this score follower is robust against major challenges of score following (such as polyphonic music and performance deviations), and that the real-time CQT approach consistently and significantly outperforms a commonly used FFT-based approach in extracting audio features for score following. \section{Report Structure} This report is divided into three parts per the threefold contributions given in \autoref{intro:contrib}. The parts are as listed: \begin{enumerate} \item \textbf{\autoref{scofo} — \nameref{scofo}}: \Cref{scofo_apps} first provides applications of score following to give an insight into the motivations of researching and developing such systems. \Cref{scofo_preliminaries} then dives into preliminaries to give sufficient technical and historic background on the many types and details of score following. Further, the challenges of score following are covered in \autoref{scofo_challenges}, before \autoref{scofo_relatedwork} which gives an extensive literature review on related and past work in score following. \item \textbf{\autoref{testbench} — \nameref{testbench}}: This part deals with formulating systematic and reliable approaches for evaluating score followers. Challenges faced by existing approaches are first detailed in \autoref{tb_preliminaries} before implementation details of a proposed open-source pair of evaluation testbenches are covered in chapters~\ref{tb_quant} and \ref{tb_qual}. \item \textbf{\autoref{impl} — \nameref{impl}}: A part is dedicated for the completed implementations of three score followers. First, the \textit{TuneApp Conductor} beat-tracking-based score follower is introduced in \autoref{impl_beat}. An Approximate String Matching (ASM) approach is introduced subsequently in \autoref{impl_asm} to produce ground-truth alignments for the quantitative testbench and also to give technical background for the subsequent DTW-based score follower. Finally, a novel CQT-DTW score follower robust against major score following challenges is introduced in \autoref{impl_dtw}. \end{enumerate} A concluding chapter, \autoref{conclusion}, will discuss findings and contributions of this project, before suggesting areas of future work. \section{Extra Notes to Readers} \subsection{Assumed knowledge} This report assumes elementary musical knowledge. Readers are expected to be able to read simple sheet music (in modern staff notation\footnote{A guide can be found at \url{https://en.wikipedia.org/wiki/Musical_notation\#Modern_staff_notation}.}, see an example in \autoref{fig:modern-staff-notation}) and understand the basic concepts of sound and music, namely pitch, volume and length. Throughout this report, the British English variant of musical terminology is used (e.g. \textit{quaver} over \textit{eighth note}). In terms of computer science, readers are assumed to understand basic concepts in algorithms, data structures and software engineering covered by elementary undergraduate-level courses. Readers are also assumed to understand simple concepts of (audio) signal processing, mainly basic concepts in the time and frequency domains. An undergraduate-level introductory signal processing course is sufficient. \part{Implementations} \label{impl} \input{02_parts/03_impl/chapters/01_beattracking.tex} \input{02_parts/03_impl/chapters/02_asm.tex} \input{02_parts/03_impl/chapters/04_dtw.tex} \section{Evaluation} \label{impl_dtw_eval} All evaluation runs are performed on the system described in \autoref{appendix_benchmark_system}. \Cref{impl_dtw_prod_repro} contains instructions on how to reproduce these evaluations--note that real-time-sensitive metrics, such as latency and offset, depend heavily on the benchmarking system's hardware capabilities. \Cref{impl_dtw_eval_quant} first covers results for quantitative evaluations run on the \nameref{impl_dtw_eval_bach10} and \nameref{impl_dtw_eval_bwv846} datasets. \Cref{impl_dtw_eval_qual} subsequently covers discusses results for qualitative evaluations run on the \textit{QualScofo} dataset to observe how well the system generalises to a variety of music. \subsection{Quantitative Results} \label{impl_dtw_eval_quant} In the quantitative evaluations, the misalignment threshold $\theta_e$--introduced in \Cref{def:misalign}, is varied in the range $\si{50\milli\second}$ to $\si{3000\milli\second}$ in $\si{50\milli\second}$ increments for precision rate reports--other metrics are reported at the default $\theta_e = \si{300\milli\second}$ setting. The score note search bound (see \Cref{def:bound_ms}) is set to the default $\si{1\milli\second}$. Four systems, two offline and two online, are put to the test. All the parameters used are, unless otherwise noted, the defaults stated in \autoref{impl_dtw_impl}. The offline systems use classical DTW as described in \autoref{impl_dtw_dtw} (\nameref{impl_dtw_dtw_offline}), and comprise: \begin{itemize} \item \textbf{CQT Offline}. This system extracts features from the audio using a classical CQT computation method as described in \cite{christiancqt} and detailed further in \autoref{cqt_impl} (\nameref{impl_dtw_offline_mode_cqt}). This CQT computation method requires the full input signal and does not run in real time. This serves as a baseline system for offline alignment. \item \textbf{NSGT-CQT Offline}. This system extracts features from the audio using the sliCQ method described in \cite{holighaus13} and detailed further in \autoref{cqt_impl} (\nameref{impl_dtw_online_mode_cqt}). While this method is real-time capable, it would be interesting to see how this CQT computation method performs in comparison to the method described in \cite{christiancqt}. \end{itemize} On the other hand, the online systems use OLTW, as described in \autoref{impl_dtw_dtw} (\nameref{impl_dtw_dtw_online}); they are: \begin{itemize} \item \textbf{CQT (Pseudo) Online}. This system uses FFT before binning the frequencies into imitate CQT features\footnote{Further information can be found at \url{https://librosa.org/doc/main/generated/librosa.pseudo_cqt.html}}. As seen in \autoref{fig:cqt_time}, this system is not real-time capable on the evaluation system and hence will cause latency and offset to build up; however, this will only affect real-time-sensitive metrics such as latency and offset. This feature extraction technique is similar to ones used by Dixon and Arzt \textit{et al.}{} \cite{dixonOLTW,Dixon2005MATCHAM,arzt08,arzt16}, and serves as a baseline to study if using sliCQ features improves the score follower's performance. \item \textbf{NSGT-CQT Online}. This system extracts features from the audio using the sliCQ method described in \cite{holighaus13} and detailed further in \autoref{cqt_impl} (\nameref{impl_dtw_online_mode_cqt})--this setup is the ``flagship'' score follower of the project. \end{itemize} \subsubsection{Bach10} \label{impl_dtw_eval_bach10} The Bach10 dataset \cite{duan11bach10}, also used for evaluating the ASM score aligner in \autoref{impl_asm_eval_bach10}, comprises 10 short chorales, each with four voices played by four instruments (violin, clarinet, saxophone and bassoon). The composite recording of all the instruments' audio tracks is used as the performance audio, and therefore this evaluation tests the ability of the system to extract features reliably from actual performance audio, discussed in \autoref{scofo_challenge_limitfe}. All pieces are highly polyphonic, and thus this test strongly evaluates the system's robustness against following polyphonic music, as detailed in \autoref{scofo_challenges_polyphonic}. As the recordings are done by trained musicians in a recording setting, there are some, but not many, performance deviations; notably, the performance has significant tempo deviations as they emulate the phrasing of a choir performance (and thus contain appropriate pauses between lines where a choir may naturally pause and breathe). Thus, the system's reaction to performance deviations as detailed in \autoref{scofo_challenges_perfdev} is not so apparent in this evaluation suite. Further, the musical pieces do not contain many ornaments and underspecified performance directions, so the performance of the system against underspecified musical scores (see \autoref{scofo_challenges_underspec}) is not a priority here. \autoref{fig:bach10_plot_precision} shows the four systems' total precision rate ($r_{pt}$) performance on the Bach10 dataset. As expected, the \textbf{CQT Offline}{} system performed very well. The \textbf{NSGT-CQT Offline}{} system performs almost identically, showing sliCQ's robustness and reliability in extracting features from the audio. More interestingly, the \textbf{CQT (Pseudo) Online}{} system's performance consistently and significantly trails behind that of the \textbf{NSGT-CQT Online}{} system. This is exacerbated by the fact that the former system is not truly capable of running in real time on the test system (see \autoref{fig:cqt_time}). While this system was not evaluated against pieces in the MIREX evaluation dataset \cite{cont07}, the \textbf{NSGT-CQT Online}{}'s total precision rate for Bach10 at $\theta_e = \si{300\milli\second}$ outperforms all known pure audio-to-audio methods in the literature \cite{arzt08, suzuki10} when ran through the MIREX evaluation. Most notably, the fact that the \textbf{CQT (Pseudo) Online}{} system is heavily based on Dixon's original solution \cite{Dixon2005MATCHAM} shows the robustness of sliCQ in extracting audio features over existing and commonly used FFT-based methods. While it is apparent that some existing methods in the literature--a select few detailed in \autoref{scofo_recent_mirex}--(may) outperform this system at the MIREX and/or Bach10 dataset evaluations, this system, as mentioned, does not require complete score data as opposed to the aforementioned methods. Not requiring complete score data is an advantage as some musical pieces do not have full score data and users may have to resort to annotated score recordings \cite{arztconcert}. Nevertheless, most feature extraction techniques for complex high-performing systems rely on FFT-based methods to extract features, and sliCQ's robustness and reliability can potentially increase performance in the aforementioned systems. This system is also simple, flexible and easily extensible to be improved--\autoref{impl_dtw_dicsuss} will outline many areas in which this system can be improved. \begin{figure}[h] \centering \includegraphics[width=0.75\columnwidth]{assets/bach10_plot_precision/output.pdf} \caption{Total precision rate ($r_{pt}$) results of the four score following systems over varying misalign thresholds ($\theta_e$) on the Bach10 dataset.} \label{fig:bach10_plot_precision} \end{figure} For \textbf{NSGT-CQT Online}, the $95\%$ total precision rate at $\theta_e = \si{1400\milli\second}$ implies that about $95\%$ of notes in the correct dataset are correctly aligned within $\si{1400\milli\second}$ of the actual position. This further implies that this system is robust enough for APT, which does not require very high precision rates. At $\theta_e = \si{2650\milli\second}$, the system also reaches $99\%$ total precision rate, reaching performance very close to the offline approaches. This performance was not matched within $\theta_e \leq \si{3000\milli\second}$ by the \textbf{CQT (Pseudo) Online}{} system. At the standard $\theta_e = \si{300\milli\second}$, the \textbf{NSGT-CQT Online}{} system's total precision rate is a respectable $74\%$, which is sufficient for performance analysis and APT. Moving on, at the standard $\theta_e = \si{300\milli\second}$ setting, further piecewise (average across all pieces) metrics detailed in \autoref{table:eval_metrics_bach10} are studied to compare the four systems--\Cref{tb_quant} gives full details of these metrics. Online metrics, such as those related to latency and offset, are only reported for the online methods. \begin{table}[ht] \caption{Metrics used to compare the approaches against the Bach10 dataset.} \centering \begin{tabular}{c c} \hline\hline Metric & Symbol \\ [0.5ex] \hline Miss Rate & $r_m$ \\ Misalign Rate & $r_e$ \\ Piece Completion & $p_e$ \\ Standard Deviation of Error & $\sigma_e$ \\ Mean Absolute Error & $\text{MAE}$ \\ Standard Deviation of Latency & $\sigma_l$ \\ Mean Latency & $\mu_l$ \\ Standard Deviation of Offset & $\sigma_o$ \\ Mean Absolute Offset & $\text{MAO}$ \\ Piecewise Precision Rate & $r_{pp}$ \\ Total Precision Rate & $r_{pt}$ \\ \hline \end{tabular} \label{table:eval_metrics_bach10} \end{table} \autoref{table:bach10_metrics} shows the piecewise results for the four systems. As discussed and seen in \autoref{fig:bach10_plot_precision}, the two offline systems performed almost identically, and have exceptional performance, reaching almost $99\%$ piecewise precision rate. On the other hand, between the two online systems, the \textbf{NSGT-CQT Online}{} system performs better across the board compared to the \textbf{CQT (Pseudo) Online}{} system, save for the miss rate ($r_m$) metric where the latter system performed very slightly better. The \textbf{CQT Offline}{} approach's non-real-time capability is demonstrated here with poor scores in mean latency ($\mu_l$) and mean absolute offset ($\text{MAO}$). As the pieces in the Bach10 dataset are not that long (the average piece length is under one minute), the build-up in lag is actually not as pronounced as that observed in the BWV846 evaluation presented later in \autoref{impl_dtw_eval_bwv846}. Overall, the performance of the project's flagship online system, \textbf{NSGT-CQT Online}{}, is excellent especially when compared to the FFT-based counterpart--\textbf{CQT (Pseudo) Online}{}. The performance of \textbf{NSGT-CQT Online}{} on the highly polyphonic music pieces with each audio recording comprising four different instruments show how the follower system is reliable in extracting robust features from audio, dealing with polyphonic music and--to an extent--performance deviations. \afterpage{% \clearpag \thispagestyle{empty \begin{landscape \begin{table} \caption{Piecewise results of the systems against the Bach10 dataset at $\theta_e = \si{300\milli\second}$. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$). \textbf{Bolded} and \textit{italic} results denote the best score for the online and offline systems respectively in each metric.} \centering \begin{tabular}{l c c c c c c c c c c c} \hline\hline System & $r_m\downarrow$ & $r_e\downarrow$ & $p_e\uparrow$ & $\sigma_e(\si{\milli\second})\downarrow$ & $\text{MAE}(\si{\milli\second})\downarrow$ & $\sigma_l(\si{\milli\second})\downarrow$ & $\mu_l(\si{\milli\second})\downarrow$ & $\sigma_o(\si{\milli\second})\downarrow$ & $\text{MAO}(\si{\milli\second})\downarrow$ & $r_{pp}\uparrow$ & $r_{pt}\uparrow$ \\ [0.5ex] \hline \textbf{CQT Offline}{} & 0.000 & \textit{0.012} & 1.000 & \textit{48} & 63 & N/A & N/A & N/A & N/A & \textit{0.988} & \textit{0.989} \\ \textbf{NSGT-CQT Offline}{} & 0.000 & 0.013 & 1.000 & 72 & \textit{58} & N/A & N/A & N/A & N/A & 0.987 & 0.986 \\ \hline \textbf{CQT (Pseudo) Online}{} & \textbf{0.004} & 0.349 & 0.983 & 88 & 76 & 962 & 4014 & 987 & 4051 & 0.647 & 0.641 \\ \textbf{NSGT-CQT Online}{} & 0.006 & \textbf{0.240} & \textbf{0.996} & \textbf{66} & \textbf{64} & \textbf{883} & \textbf{1490} & \textbf{880} & \textbf{1529} & \textbf{0.754} & \textbf{0.743} \\ \hline \end{tabular} \label{table:bach10_metrics} \end{table} \begin{table} \caption{Piecewise results of the systems against the BWV846 dataset at $\theta_e = \si{300\milli\second}$. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$). \textbf{Bolded} and \textit{italic} results denote the best score for the online and offline systems respectively in each metric.} \centering \begin{tabular}{l c c c c c c c c c c c} \hline\hline System & $r_m\downarrow$ & $r_e\downarrow$ & $p_e\uparrow$ & $\sigma_e(\si{\milli\second})\downarrow$ & $\text{MAE}(\si{\milli\second})\downarrow$ & $\sigma_l(\si{\milli\second})\downarrow$ & $\mu_l(\si{\milli\second})\downarrow$ & $\sigma_o(\si{\milli\second})\downarrow$ & $\text{MAO}(\si{\milli\second})\downarrow$ & $r_{pp}\uparrow$ & $r_{pt}\uparrow$ \\ [0.5ex] \hline \textbf{CQT Offline}{} & 0.000 & \textit{0.045} & 0.979 & \textit{55} & \textit{53} & N/A & N/A & N/A & N/A & 0.957 & 0.957 \\ \textbf{NSGT-CQT Offline}{} & 0.000 & 0.025 & \textit{0.997} & 64 & 96 & N/A & N/A & N/A & N/A & \textit{0.978} & \textit{0.976} \\ \hline \textbf{CQT (Pseudo) Online}{} & 0.015 & 0.327 & 0.925 & 105 & 99 & 5149 & 9333 & 5095 & 9272 & 0.658 & 0.662 \\ \textbf{NSGT-CQT Online}{} & \textbf{0.013} & \textbf{0.193} & \textbf{0.940} & \textbf{88} & \textbf{72} & \textbf{307} & \textbf{1066} & \textbf{265} & \textbf{1030} & \textbf{0.794} & \textbf{0.797} \\ \hline \end{tabular} \label{table:bwv846_metrics} \end{table} \end{landscape} \clearpag } \subsubsection{BWV846} \label{impl_dtw_eval_bwv846} The BWV846 dataset is produced by the ASM aligner as discussed in \autoref{impl_asm_eval_bwv846}. This evaluation suite demonstrates the last piece in the puzzle for the novel score following quantitative dataset procurement method detailed in \autoref{tb_quant_dataset_api}. This dataset has key differences when compared to Bach10--most of which are addressed in \autoref{impl_asm_eval_bwv846}. Most importantly, the performances--especially the \textit{Fugue}'s--have more deviations from the score, which showcase the score follower's ability to handle performance deviations. Further, the \textit{Prelude} is highly monophonic, and the \textit{Fugue} otherwise, so some insight into the follower's ability to follow either monophonic and polyphonic music can be drawn. \begin{figure}[h] \centering \includegraphics[width=0.75\columnwidth]{assets/bwv846_plot_precision/output.pdf} \caption{Total precision rate ($r_{pt}$) results of the four score following systems over varying misalign thresholds ($\theta_e$) on the BWV846 dataset.} \label{fig:bwv846_plot_precision} \end{figure} \autoref{fig:bwv846_plot_precision} shows the four systems' total precision rate ($r_{pt}$) performance on the Bach10 dataset. Generally, the performance of the four systems are similar to that seen in the quantitative evaluation on the Bach10 dataset. For the two offline systems, the \textbf{CQT Offline}{} system appeared to have an edge over the \textbf{NSGT-CQT Offline}{} system at $\theta_e \leq \si{250\milli\second}$, after which the latter system consistently performs better before both systems reach almost perfect $r_{pt}$ approaching $\theta_e = \si{3000\milli\second}$. Unsurprisingly, for the online systems, the \textbf{NSGT-CQT Online}{} system once again consistently outperforms the \textbf{CQT (Pseudo) Online}{} system. Interestingly, the former system even surpassed the performance of the \textbf{NSGT-CQT Offline}{} approach at $\theta_e \leq \si{150\milli\second}$--this was not expected. Though, unlike for the Bach10 evaluation suite, both online approaches did not approach $r_{pt} = 1$ as $\theta_e$ approached $\si{3000\milli\second}$. The \textbf{NSGT-CQT Online}{} system's performance plateaued at $r_{pt} \approx 0.96$ after $\theta_e \geq \si{2500\milli\second}$, suggesting that the gap to the almost-perfect-scoring offline systems stem from the system's inability to navigate around performance deviations which are more frequent in the BWV846 dataset than in the Bach10 dataset. Nevertheless, the performance is still impressive, considering the fact that for $\theta_e \leq \si{1000\milli\second}$, the performance of the online systems on the BWV846 dataset is significantly better than that of the BWV846 dataset as seen in \autoref{fig:bach10_plot_precision}--this may be attributable to the clearer note onsets produced by the piano in the BWV846 performance, which is in contrast to the less clear ones in the Bach10 recordings. Piecewise metrics, identical to the ones presented in \autoref{table:eval_metrics_bach10}, are presented at the standard $\theta_e = \si{300\milli\second}$ for the systems in \autoref{table:bwv846_metrics}. The performances of the offline systems are very close to each other, with the \textbf{NSGT-CQT Offline}{} approach slightly trumping over the \textbf{CQT Offline}{} approach in the most important metrics: total precision rate ($r_{pt}$) and piecewise precision rate ($r_{pp}$). On the other hand, for the online systems, the performance advantage of the \textbf{NSGT-CQT Online}{} system over the \textbf{CQT (Pseudo) Online}{} system is even more pronounced here than in the \nameref{impl_dtw_eval_bach10} evaluation. The \textbf{CQT (Pseudo) Online}{}'s non-real-time property translated to very poor scores in the latency and offset metrics, and is worse here than in the \nameref{impl_dtw_eval_bach10} evaluation as both pieces in BWV846 are significantly longer (and thus the lag builds up). Importantly, the standard deviations of latency ($\sigma_l$) and offset ($\sigma_o$) of the \textbf{NSGT-CQT Online}{} systems are low as also seen in \autoref{table:bach10_metrics}--this suggests that there is a possible improvement area by letting the score follower report score events at a sensible $\mu_l$ ahead of the currently aligned position. Exploiting the fact that the \textit{Prelude} is highly monophonic and the \textit{Fugue} otherwise, key metrics obtained via the two online systems at $\theta_e = \si{300\milli\second}$ for each piece are reported in \autoref{table:bwv846_eval_separate}. There is simply no contest between the two online approaches--the \textbf{NSGT-CQT Online}{} approach outperforms the \textbf{CQT (Pseudo) Online}{} system in every metric measured. Perhaps unexpectedly, the systems fared slightly better (around $5\%$ improvement in $r_p$) in the highly polyphonic \textit{Fugue} than the highly monophonic \textit{Prelude}--it is however worth noting that this slight difference is not conclusive that the techniques used favour polyphonic pieces: the \textit{Prelude}, of which the first six bars can be seen in \autoref{fig:modern-staff-notation}, potentially poses another challenge--the majority of the \textit{Prelude} comprises broken \textit{arpeggios} repeated twice, and this repetition may mislead the system--this is in contrast to the well-structured \textit{Fugue} that has longer lines of melody and harmony--this can only be explained with qualitative analysis, which will be discussed in \autoref{impl_dtw_eval_qual}. Nevertheless, this comparison shows that the system performs robustly against highly monophonic and highly polyphonic piano pieces, and thus shows that the feature extraction method is reliable--it does not favour either category of music. \begin{table}[ht] \caption{Results of the two online systems on the \textit{Prelude} and \textit{Fugue} of BWV846 with $\theta_e = \si{300\milli\second}$. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$). \textbf{Bolded} results denote the best score for each piece in each metric.} \centering \begin{tabular}{c c c c c c c c} \hline\hline Piece & System & $r_m\downarrow$ & $r_e\downarrow$ & $p_e\uparrow$ & $\sigma_e(\si{\milli\second})\downarrow$ & $\text{MAE}(\si{\milli\second})\downarrow$ & $r_{p}\uparrow$ \\ [0.5ex] \hline \multirow{2}{*}{\textit{Prelude}} & \textbf{CQT (Pseudo) Online}{} & 0.035 & 0.334 & 0.909 & 90 & 71 & 0.631 \\ & \textbf{NSGT-CQT Online}{} & \textbf{0.031} & \textbf{0.193} & \textbf{0.914} & \textbf{80} & \textbf{60} & \textbf{0.776} \\ \hline \multirow{2}{*}{\textit{Fugue}} & \textbf{CQT (Pseudo) Online} & 0.000 & 0.321 & 0.942 & 121 & 126 & 0.685 \\ & \textbf{NSGT-CQT Online}{} & 0.000 & \textbf{0.193} & \textbf{0.967} & \textbf{96} & \textbf{84} & \textbf{0.813} \\ \hline \end{tabular} \label{table:bwv846_eval_separate} \end{table} Overall, the performance of the flagship \textbf{NSGT-CQT Online}{} system is, as was observed in \autoref{impl_asm_eval_bach10}, exceptional especially when compared against the \textbf{CQT (Pseudo) Online}{} system. The flagship system appears to generalise well to both monophonic and polyphonic pieces, and is able to perform well against performance deviations. \subsection{Qualitative Evaluation Results} \label{impl_dtw_eval_qual} The quantitative evaluations performed in \autoref{impl_dtw_eval_quant} cover a variety of baroque pieces by Johann Sebastian Bach for piano and four voices--it contains some diversity in the music that measures the systems' performance against performance deviations and polyphonic music. The systems' robustness against limitations in feature extraction was also explored in the two evaluation suites. Nevertheless, the two suites do not reflect the performance of the systems in generalising to more diverse pieces performed under different circumstances; thus, qualitative analyses were performed for the flagship \textbf{NSGT-CQT Online}{} system (described in \autoref{impl_dtw_eval_quant}) against a diverse collection of music pieces. The system's performance against underspecified music scores will also be explored. The dataset used for this suite of evaluations is the \textit{QualScofo} dataset presented in \autoref{tb_qual_prod_dataset}. Qualitative evaluations are done via connecting this system to the qualitative testbench proposed in \autoref{tb_qual}. A human user judges the quality of following, mainly via how much the currently followed position deviates from the actual score position based on the performance audio. Should such deviations occur, how fast the follower corrects itself is also noted. Recordings of all the testbench runs are provided--see \autoref{impl_dtw_prod_demos} for more information. \Cref{impl_dtw_prod_repro} shows instructions on how to reproduce the evaluation. Here, the performance of the follower on every piece of the \textit{QualScofo} dataset is discussed individually--overall comments are provided after these discussions. These pieces are organised by their respective groups. Readers are advised to watch the recordings provided in the repository (see \autoref{impl_dtw_prod_demos}) while perusing the analysis below. \begin{itemize} \item{\texttt{cello} \begin{enumerate} \item{\texttt{suite1} While this excerpt consists almost entirely of semiquavers, performers often introduce \textit{rubato} (temporal deviations)--this is in contrast to the structurally similar \textit{Prelude in C major, BWV 846}. In this performance, Yo-Yo Ma liberally holds many of the root notes present in the first and third beat of each bar. Further, as a consequence of the time-frequency uncertainty principle (\Cref{def:timefreq}), the lower register of the cello pose a challenge for feature extraction. This piece therefore challenges the score follower's ability to respond to temporal performance deviations and limitations in low-pitched feature extraction. The score follower flawlessly handled this performance--the deviations were very minimal and mostly spanned only about half a beat's length. The held root notes were easily identified and seamlessly followed. } \end{enumerate} } \item \texttt{octet} \begin{enumerate} \item{\texttt{mendelssohn} This octet excerpt consists of one melody line mainly driven by the first violin along with harmonic layers provided by the other instruments. The tempo is quite steady, and performance deviations are rare if any. This piece therefore tests the follower's ability to extract features from polyphonic audio arising from multiple instruments. This excerpt was handled quite well by the follower with almost no deviations save for some instability in the first bar. The follower was able to follow the melodic notes of the violin--up to note-level--flawlessly. } \end{enumerate} \item \texttt{orchestra} \begin{enumerate} \item{\texttt{eine} This excerpt for a chamber string orchestra by Mozart contains some common ornaments in classical music, notably the \textit{trill} and \textit{acciaccatura}. The melody line is simple, with the lower register instruments (viola, cello and double bass) playing a more supportive role. This excerpt tests the follower's ability to follow performance deviations stemming from ornaments--for a chamber string orchestra performance. This piece as a whole was handled quite well by the system, save for a bar's length of deviation between bars 8 and 11, which was quickly fixed as the next phrase started in bar 11. The mentioned ornaments posed no challenge to the score follower. } \item{\texttt{peer} This excerpt for a small romantic-era symphony orchestra starts by featuring several expressive solo melody lines--played interchangeably by the flute and the oboe--which contain a significant amount of artistic \textit{rubato}. The string section follows with a recapitulation of the melody lines, also flush with expressivity and \textit{rubato}--this piece therefore evaluates the follower's ability to perform against performance deviations stemming from both a solo instrument and a large ensemble. The solo melodic lines were followed flawlessly and as a whole the excerpt was handled well. Some deviation--up to a beat's length--was found during the string unison section in bars 20-24; this deviation was rectified quickly after the phrase. } \item{\texttt{1812-1} This first excerpt from the \textit{1812 Overture} is the first part of the brass fanfare finale. The recording of this performance is not as clear despite it being a studio recording. This composition was also made for a large romantic-era symphony orchestra with a separate brass band and artillery (cannon). This excerpt does not contain the artillery section, but is still quite complex as it contains multiple layers of sound from the wide array of instruments. Further, there are running notes played by the strings between the very loud phrases of the fanfare that may cause a challenge in extracting reliable features from polyphonic audio produced by a large ensemble. As expected, while the brass fanfare notes were well followed, the running notes of the strings were not followed well, with deviations of up to half a bar. These deviations were however quickly fixed as the next phrase of the brass fanfare began. } \item{\texttt{1812-1} This second excerpt from the \textit{1812 Overture} is the second part of the brass fanfare finale. This part of the finale contains the artillery (cannon) and bells section, and therefore strongly tests the follower's ability to generalise against non-standard instruments. This excerpt was handled quite excellently (mostly minor deviations of up to two beats) save for the final twelve bars where a deviation of up to two bars occurred; nevertheless, this deviation was rectified as the piece progressed into the last two bars. The follower therefore was able to extract features from this complex excerpt, but the structure of the piece caused some confusion in the last few bars. } \end{enumerate} \item \texttt{piano} \begin{enumerate} \item{\texttt{fugue} Bach's polyphonic \textit{Fugue in C major, BWV 846} appears multiple times in this report--including in the quantitative analysis of this follower in \autoref{impl_dtw_eval_quant}--as a prime example of a polyphonic piano piece. The challenges from this piece arise not only from its polyphony, but also from its ornaments and the performer's artistic deviations. The \textit{mordent}s in the piece (see \autoref{fig:846fugue13} for an example) were played by the performer as a \textit{trill}, and an additional \textit{trill} was added in bar 23. Note that this performance, from the MAESTRO dataset \cite{MAESTRO}, is the same as that used in the quantitative analysis done in \autoref{impl_dtw_eval_quant}. The $0.813$ total precision rate at $\theta_e = \si{300\milli\second}$ shown in \autoref{table:bwv846_eval_separate} was reflected well in this qualitative evaluation (note that $\si{300\milli\second}$ constitutes $30\%$ of a beat assuming a tempo of $60\text{BPM}$). Overall, the entirety of the piece was well handled, and the ornaments did not pose a challenge--most deviations were only up to half a beat's length and were quickly resolved. It could be shown from here that the follower is quite robust against polyphonic piano performances. } \item{\texttt{prelude} In contrast to the \textit{Fugue}, the \textit{Prelude in C major, BWV846} is primarily monophonic. It comprises repeating broken \textit{arpeggios}, with the top three notes repeated every iteration and the bottom two notes held over the whole length of the \textit{arpeggio}. Not many performance deviations are present in this piece, but the repeating nature of the top three notes in the broken \textit{arpeggios} may pose a challenge for score followers to align structurally similar melody lines. This performance, like the \textit{Fugue}, is taken from the MAESTRO dataset \cite{MAESTRO} and therefore is the same as that used in the quantitative analysis done in \autoref{impl_dtw_eval_quant}. The $0.685$ total precision rate at $\theta_e = \si{300\milli\second}$ shown in \autoref{table:bwv846_eval_separate}--lower than the $0.815$ of the \textit{Fugue}--was reflected well in this qualitative evaluation. The repeating nature of the top three notes in the \textit{arpeggio} caused significant misalignments of up to a beat in the first seven bars. Nevertheless, the piece was handled well beyond the deviations mentioned: after the first seven bars, the following stabilised. The performer's slowing down in the final few bars however caused noticeable deviations of up to a beat's length. } \item{\texttt{turkish} This simple classical-era piece by Mozart contains a simple melody line like many pieces of its era. The tempo of the performance is quite constant, and there are not many ornaments save for the added \textit{trill} by the performer in the second last bar in the excerpt. Save for the follower's slight instability in the first bar, the performance was handled flawlessly by the score follower--the added \textit{trill} posed no challenge to the system. } \item{\texttt{moonlight} This popular piece by Beethoven comprises repeating triplets throughout the first movement with a melody line gradually developing. Slight temporal deviations are common in performances, including in this performed by the famous pianist Claudio Arrau. The repeating triplets are expected to pose a challenge to score followers as they may align the notes to the wrong iteration of the triplets. The score follower started off with some significant instability in the beginning, which was resolved as the performance moved into bar 2. There were minimal deviations in the rest of the piece--deviations, if any, were only up to half a beat's length. Overall, the score follower's performance was excellent. } \item{\texttt{unsospiro} Like many of Liszt's pieces, \textit{Un sospiro} is challenging. It contains a very fast series of repeating broken \textit{arpeggios}, with a simple melody line layered of top. The \textit{tempo} of this romantic-era piece is also often varied artistically in performances, including in this live performance by Marc-André Hamelin in 1997. The first two bars before the melodic line starts contained significant deviations and instability, but when the melodic line started, the following was generally stable towards the end of the excerpt, with some noticeable deviations (of up to half a beat's length) in the end of some melodic phrases. } \item{\texttt{gnossienne} This late 19th century piece by Erik Satie is unique in the sense that it is in \textit{free time}, i.e. it does not have any bar lines--this is common amongst many of Satie's ``unorthodox'' compositions. Nevertheless, there still exists a meter (4/4) in this excerpt. The \textit{free time} structure perhaps was given to emphasise the free-flowing long melodic phrases that should not be disconnected. Many performances of this piece, including this performance, contain significant \textit{rubato} to emphasise these melodic phrases. There also exists many \textit{acciaccatura} ornaments within the simple melodic lines. This piece was handled reasonably well--the only obstacles were in following the relatively silent parts between melodic lines, where misalignments of up to two beats' length were observed. Nevertheless, these misalignments were resolved as the piece moves into the next melodic line. The \textit{acciaccatura} ornaments did not pose a challenge. } \item{\texttt{entertainer} This contemporary 20th century piece by Scott Joplin contains a playful melody line for the right hand supported by a simple accompaniment for the left hand. Notably, this performance was recorded on a \textit{pianola} (piano roll) and is not of studio quality. This piece serves as an indication on whether the follower can follow contemporary pieces, and also to observe whether the lower quality in recording affects the follower. This piece was handled flawlessly, with little to no noticeable deviations. } \item{\texttt{clair} \textit{Clair de lune} starts off with a performance direction: ``\textit{Andante très expressif}'', which translates to ``moderatly slow, very expressive''. Bar 15 then has the direction ``\textit{Tempo rubato}''. This excerpt, performed by the famous pianist Lang Lang, is a romantic piece that showcases very rich \textit{rubato} and expressivity; thus, this piece contains many artistic performance deviations that are challenging to score followers. This score follower handled the temporal deviations well, with deviations up to one beat in length, notably in bars 11-14. The deviations however were quickly fixed in bar 15. } \end{enumerate} \item \texttt{violin} \begin{enumerate} \item{\texttt{chaconne-arp} The \textit{Chaconne} was used extensively in \autoref{scofo_challenges} as an example of a challenging piece for score followers to follow. This excerpt features the \textit{arpeggios} discussed in \autoref{scofo_challenges_underspec}: the \textit{arpeggio} marking in bar 89 poses a challenge for score followers as performers may interpret this differently. Hilary Hahn's performance used here in fact contains two separate ways of playing the arpeggio. Hahn follows the suggested way from bars 89 to 100 before switching to another way until the end of the \textit{arpeggio} section. This may also be treated as \textit{improvisation} as discussed in \autoref{scofo_challenges_polyphonic}. The synthesised MIDI of the performance used by the follower merely contains the \textit{unbroken} chords as specified in the score; therefore, it is expected that significant deviations may occur during the \textit{arpeggio} section. The section leading into the \textit{arpeggio} section--bars 84 to 88, despite containing some temporal deviations common to solo baroque performances, was handled flawlessly by the follower. The \textit{arpeggio} section was not handled as well, but was surprisingly still quite acceptable. The first part (bars 89 to 100) only contained deviations of up to two beats, but the other style of playing the \textit{arpeggios} employed by Hahn from bars 100 to 119 caused larger deviations of up to 1 bar (3 beats). This however was resolved in the second bar of the section succeeding the \textit{arpeggio} section (bar 121). All in all, the follower's robustness against such an extreme underspecification is remarkably impressive. } \item{\texttt{chaconne-front} This front excerpt of the \textit{Chaconne} comprises the polyphonic section shown in \autoref{fig:chaconnefirst10} which was described--in \autoref{scofo_challenges_perfdev_intentional}--as an excerpt that cannot be practically played on a violin. Hahn in this performance breaks down the chords in bars 1 to 8 into groups of two and does not hold the notes not in the top two of each chord. Hahn plays some chords in bars 9 to 16 in the ``rebound'' style, replaying the lower notes after executing the chord from bottom to top. These performance deviations are not encoded in the score, and therefore are expected to cause problems in score following. This section, as expected, was not handled as well as other pieces in the dataset; nevertheless, the deviations, despite widespread, were mostly only up to a beat's length from the start to bar 15. From bar 16 to the end of the excerpt however, the deviation increased to up to a bar in length, and was not resolved by the end. It is however expected that the simpler structure beyond this excerpt would help the follower to resolve this deviation. } \end{enumerate} \end{itemize} Overall, the score follower performed quite robustly against the wide variety of performances in the \textit{QualScofo} dataset. A common problem for most of the pieces is that there is some instability in the beginning of the following, but this soon goes away. Moreover, misalignments, if present and noticeable, are usually small (up to a bar's length in the worst case) and generally gets resolved further into the piece as the algorithm has more of the performance's information to work with. Only one piece--the \texttt{violin} group's \texttt{chaconne-front} piece--caused significant misalignments, resulting in a deviation of up to a bar that was not resolved within the excerpt. Notably, the \textit{QualScofo} dataset contains pieces that cover not only the four main challenges targeted by the system discussed in \autoref{impl_dtw_req}, but also partially (via the \texttt{violin} group's \texttt{chaconne-arp} piece) the fifth (\nameref{scofo_challenge_music_improv}) given in \autoref{scofo_challenges}. The score follower is generally robust against these challenges especially the four targeted in \autoref{impl_dtw_req}, and therefore it can be said that the targeted requirements are fulfilled via the results of this qualitative analysis. \chapter{A CQT-DTW Score Follower} \label{impl_dtw} \epigraph{\itshape The notes are just signs. You have to go behind them.}{Mariss Jansons} \section{Motivation} The previous score followers introduced in chapters~\ref{impl_beat} and \ref{impl_asm} do not sufficiently address the challenges in score following this project aims to tackle. This CQT-DTW approach therefore is set out to resolve as many challenges listed in \autoref{scofo_challenges} as possible. The specific challenges targeted are listed in \autoref{impl_dtw_req}. \section{Requirements} \label{impl_dtw_req} This score follower shall address the following challenges previously listed in \autoref{scofo_challenges}: \begin{enumerate} \item \textbf{\Cref{scofo_challenge_limitfe} -- \nameref{scofo_challenge_limitfe}}. This DTW-based system shall work with reliable features extracted from the audio of both the performance and score. No extra processing will be required from the users' side, and digital score data is optional. \item \textbf{\Cref{scofo_challenges_perfdev} -- \nameref{scofo_challenges_perfdev}}. This system shall aim to provide robust score following even with the presence of performance deviations, either intentional or unintentional. \item \textbf{\Cref{scofo_challenges_underspec} -- \nameref{scofo_challenges_underspec}}. Music ornaments, such as the \textit{trill}, \textit{mordent} and \textit{glissandi}, shall be properly tracked by this follower. \item \textbf{\Cref{scofo_challenges_polyphonic} -- \nameref{scofo_challenges_polyphonic}}. Polyphonic music, either mono-instrumental or multi-instrumental, shall be handled reliably by this system. \end{enumerate} While the final challenge--\nameref{scofo_challenge_music_improv} (\autoref{scofo_challenge_music_improv})--is omitted, further work can be done to extend this system to address the challenge. As trackers are rarely used for improvised music, this is not currently targeted by the implementation. \section{Technical Background} Technicalities that build up this score following system are provided here, beginning with the motivation backing the choice of CQT in \autoref{impl_dtw_cqt_compared} before a deep dive into its technicalities given in \autoref{impl_dtw_cqt_tech}; \autoref{impl_dtw_cqt_to_note} is dedicated to detail how the resultant features vectors for alignment are derived. Similarity calculation via DTW is then covered in subsections~\ref{impl_dtw_compared} (where a comparison of DTW with other approaches is given) and \ref{impl_dtw_tech} (where DTW's technicalities are covered in detail). \Cref{impl_dtw_dist_comp} deals with the distance computation required for DTW. Finally, \autoref{impl_dtw_baseline_worked_example} covers OLTW--the online DTW implementation used in this approach; a worked example is also included. \subsection{CQT: Compared to other Features} \label{impl_dtw_cqt_compared} As mentioned in \autoref{scofo_mdr_audio}, the audio from the score and performance can be very difficult to work with. Therefore, application-specific lower-level features are often extracted from the audio. Numerous differing examples of such features exist, and many were previously applied in score following. The choice of CQT over other methods is defended by comparing CQT directly against other methods; more in-depth analyses of these features can be found in \cite{grachten13, joder10}. It is also worth noting that CQT was used in Chen and Jang's DTW approach \cite{chen19} recently, which showed that CQT was indeed robust for score following; however, their approach mainly focuses on optimising offline onset detection methods for alignment--the real-time following relies on an off-the-shelf online onset detector that works via Recurrent Neural Networks (RNNs) \cite{eyben10, bock12}. Chen and Jang also used score information to determine the frequency range of CQT to use--its dependency on score information is seen as an inflexibility when compared to this system. \subsubsection{Versus Short-time Fourier Transform (STFT)} The spectrogram of an audio signal can be produced via computing the STFT--an example of a spectrogram is shown in \autoref{fig:preludespecgram}. Background for STFT related to CQT can be found in \autoref{impl_dtw_cqt_tech}. The STFT is well researched and applied in many areas of signal processing due to its simplicity, but there are two major issues in the context of score following. Firstly, the complexity required to compare two spectrograms is intensive. Early DTW score aligners therefore use more sparse mid-level features \cite{muller04, orio01}, which were not reliable due to the next issue: the standard FFT uses a constant bin size throughout all frequencies, leading to a consistent and fully continuous transform that unfortunately does not reflect human auditory perception--humans perceive frequency on a logarithmic scale. Mapping these constant-sized bins into a logarithmic scale results in peaks on the lower end that are incredibly wide, lacking much required detail. The pioneering DTW score follower by Dixon and Widmer in 2005 \cite{Dixon2005MATCHAM} went around this limitation by mapping the windowed FFT of the signal into 84 frequency bins that are linear at low frequencies and logarithmic at high frequencies; however, the resolution problem at low frequency persists. CQT neatly solves the second issue by increasing the buffer size at lower frequencies and reducing the buffer size at larger frequencies--\autoref{impl_dtw_cqt_tech} contains more technical background for the CQT and develops concepts of CQT based on the Fourier transform. The first issue is actually not addressed by the naïve implementation of the CQT, and in fact the computation of CQT is more intensive. Real-time CQT is however made possible in advancements by Dörfler, Holighaus, Grill and Velasco \cite{holighaus13,angelo11}--more details are given in \autoref{impl_dtw_cqt_tech}. \subsubsection{Versus Chromagrams} Discrete chromagrams, introduced by Wakefield in 1999 \cite{wakefieldchroma}, are sequences of \emph{chroma vectors}, where each chroma vector representation is a 12-element vector. Each element in the vector represents the spectral energy corresponding to one pitch class in an octave (e.g. C, C\#, D, ...). Chromagrams were in fact used by numerous approaches in both alignment and following, and the computation of chromagrams can be done via a number of different ways, including via the STFT and CQT \cite{dannerberg03, ellis07, mauch10, muller11, peeters06, suzuki10}. Systems using features derived from the chroma representation were also developed \cite{ewert09, muller05}. A latent problem with using chromagrams exists: the pitches of a note class across all octaves are grouped into one element in the chroma vector. This means that the representation is unable to determine from which octave a note is from--while this may be seen as an advantage in terms of handling deviations from the score in the event that the performer plays the piece with the correct notes in the wrong octave; nevertheless, such a system would fail when there are parts in the score that comprise distinct parts with the same notes transposed to different octaves. The CQT is capable of representing the range required for multi-octave music, and hence is immune to this problem. \subsubsection{Versus Mel Frequency Cepstral Coefficients (MFCC)} Mel Frequency Cepstral Coefficients (MFCCs) are more commonly used in speech methods \cite{mermelstein76}, but are useful features in MIR \cite{logan00} and were previously applied in music alignment \cite{grachten13}. MFCCs are in fact based on the STFT, and are commonly derived as follows \cite{SAHIDULLAH2012543}: \begin{enumerate} \item Take the STFT of a signal. \item Using triangular or cosine overlapping windows, map the powers of the spectrum obtained onto the \emph{mel scale} (a perceptual scale of pitches judged by listeners to be equidistant from one another) \cite{stevens37}. \item Take the logs of the powers at each of the mel frequencies. \item Take the DCT (Discrete Cosine Transform) of the list of mel log powers. \end{enumerate} These amplitudes of the resulting spectrum are finally the MFCCs. Other approaches to compute MFCCs can be found in \cite{SAHIDULLAH2012543}. MFCCs, however, are less useful for capturing pitch features (a task in which the CQT excels at) essential for score following \cite{hu04}. MFCCs are more useful for capturing the formant structure and timbre of speech and music signals \cite{grachten13}. \subsubsection{Versus Other Features} Features other than the ones listed above, such as chroma onsets \cite{ewert09} and spectral factorisation \cite{orti15}, were also used in the literature, but thus far no known methods reliably outperform the flexibility, reliability and robustness of the CQT to capture comprehensive audio features required for score following. \subsection{CQT: Technicalities} \label{impl_dtw_cqt_tech} Before diving into the technicalities behind CQT, related background of the Fourier Transform and STFT is first given. Note that, for simplicity, the \emph{continuous} variants are discussed--their \emph{discrete} analogues \cite{nagathil13} are used in digital signal processing, as in the case of this score following implementation. \subsubsection{Relevant background in Fourier Transform} First, a definition of the Fourier Transform is given: \begin{definition}[Fourier Transform] The Fourier transform of $f(t)$ is given by $$ F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt. $$ \end{definition} If the frequency of $f(t)$ changes over time, $F(\omega)$ does not capture \emph{what} these changes are and \emph{when} these changes occur. This is because $e^{j\omega t}$ does not have \emph{compact support}, defined as: \begin{definition}[Compact Support \& Set] A function has compact support if it is zero outside a \emph{compact set}. A compact set $\mathfrak{S}$ of a topological space $\mathfrak{X}$ is compact if for every open cover of $\mathfrak{S}$ there exists a finite subcover of $\mathfrak{S}$. \end{definition} Thus, the Fourier transform is not ideal for studying \emph{non-stationary} process signals, which includes musical audio as it has non-constant frequencies and spectral contents. \autoref{fig:ft-partitions} shows the behaviour of the Fourier Transform--it is not able to capture changes in frequency over time. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/plots/ft.pdf} \caption{The partition of the time-frequency plane representing Fourier Transform behaviour.} \label{fig:ft-partitions} \end{figure} \subsubsection{Relevant background in STFT} STFT is a \emph{Fourier-related transform} capable of performing time-frequency analysis of non-stationary process signals. The definition is most commonly given as: \begin{definition}[Short-time Fourier Transform] The Short-time Fourier Transform of $f(t)$ first multiplies $f(t)$ by a real-valued even \emph{windowing function} $g(t)$ (which is nonzero over only a short, finite interval and has a norm of $1$). The Fourier transform of the resulting signal is taken as the window is slid along the time axis \emph{in constant intervals}, resulting in a 2D representation of the signal. Mathematically, $$ STFT\{f(t)\}(u, \omega) = \int_{-\infty}^{\infty} f(t) g(t-u) e^{-j \omega t} \, dt. $$ \label{eqn:stft1} \end{definition} The ``sliding along the time axis'' involves the studying of contents of $f(t)$ around the time $u$ by varying $u$. What can be decided is the size around $u$ to consider at any point in time--this is determined by the \emph{support} of the windowing function $g(t)$. Relating to \autoref{fig:ft-partitions}, the STFT tiling of the time-frequency plane can be represented as a grid of boxes each centred at $(u, \omega)$, shown in \autoref{fig:stft-partitions}. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/plots/stft.pdf} \caption{The partition of the time-frequency plane representing STFT behaviour.} \label{fig:stft-partitions} \end{figure} One pitfall for STFT is that it has a fixed resolution--the width of the windowing function $g(t)$ directly affects how the signal is represented in terms of resolutions in time and frequency. This is known as the \emph{time-frequency uncertainty principle}, or the \emph{Gabor limit}, which is related to Heisenberg's uncertainty principle. \begin{definition}[Time-frequency Uncertainty Principle] Given that the standard deviations of the time and frequency estimates (in $\si{\radian}\,\si{\second}^{-1}$) are $\sigma_t$ and $\sigma_\omega$ respectively, $$ \sigma_t \sigma_\omega \geq \frac{1}{2}, $$ which implies that a function cannot be both time- and band-limited; alternatively from $\omega = 2\pi f$ this can be rewritten in terms of the standard deviation of frequency estimate $\sigma_f$ (in \si{\hertz}), $$ \sigma_t \sigma_f \geq \frac{1}{4\pi}. $$ \label{def:timefreq} \end{definition} \autoref{fig:stft2} shows a comparison of using two window widths. \begin{figure}[h] \centering \subfloat[]{{\includegraphics[width=0.45\linewidth]{assets/plots/stft.pdf} }} \qquad \subfloat[]{{\includegraphics[width=0.45\linewidth]{assets/plots/stft2.pdf} }} \caption{Illustration of the time-frequency uncertainty principle. The left figure has a wider window, giving it better frequency resolution but worse time resolution. The right figure gets better time resolution with a thinner window, but loses out in frequency resolution.} \label{fig:stft2} \end{figure} Another problem of STFT is that the frequency bins are constant sized and cannot be changed--humans perceive pitch on a \emph{logarithmic} scale, and the constant frequency bins in STFT when mapped to a logarithmic scale leads to poor resolution in the lower frequency bins. \subsubsection{CQT: Background} The CQT is another Fourier-related transform that was first proposed in 1978 \cite{youngbergcqt} and subsequently introduced to musical applications in 1991 \cite{browncqt}. The $Q$ in CQT denotes the ratio of the centre frequency to the bandwidth--thus Constant-Q implies that the aforementioned ratio is kept constant. CQT therefore is capable of capturing auditory features that relate to the resolution of the human auditory system. This is opposed to the STFT that has constant bandwidths and window sizes. However, it is worth noting that the CQT is still subject to the time-frequency uncertainty principle defined in \Cref{def:timefreq}. CQT's constant-Q ratio is achieved by varying the time shifts for each window, giving rise to two key observations: \begin{itemize} \item At high frequencies, resolution in \emph{time} improves. \item At low frequencies, resolution in \emph{frequency} improves. \end{itemize} The CQT depends on a few key parameters: \begin{itemize} \item $f_s$, the sampling rate. \item $N_{bin}$, the number of bins per octave. \item $f_{\min}$ and $f_{\max}$, the minimum and maximum frequencies respectively. \end{itemize} $f_s$ is typically set to $44100\si{\hertz}$, the common sampling rate used by music on Audio CD, which captures the typical range of human hearing ($20-20000\si{\hertz}$) as a consequence of the Nyquist-Shannon sampling theorem \cite{nyquist}. It is worth noting, however, that the highest pitch on a piano--$C8$--corresponds to a frequency of approximately $4186.0\si{\hertz}$, which implies that lower $f_s$ (e.g. $22050\si{\hertz}$) may still capture adequate information. Naturally as in musical applications there are 12 notes in an octave, $N_{bin}$ is set to $12$. $f_{\min}$ should logically be set to the lowest pitch on the piano $A0$ ($27.5\si{\hertz}$), however this is usually set much higher, e.g. at $C3$ ($130.8\si{\hertz}$), and the reason can be traced back to \Cref{def:timefreq}--the bin size required for the gap between $A0$ and $A\#0$ is around $1.6\si{\hertz}$; setting $\sigma_f$ to half of the smallest bin size gives $\sigma_f \approx 0.8 \si{\hertz}$ and $\sigma_t \approx 100\si{\milli\second}$. Notably, $\sigma_t \approx 100\si{\milli\second}$ leads to relatively unresponsive applications due to low time resolution. On the other hand, setting $f_{\min} = C3$ gives $\sigma_f \approx 65.4 \si{\hertz}$ and $\sigma_t \approx 1200\si{\micro\second}$ in a similar configuration. While there certainly is information lost when $f_{\min}$ is set higher, this is countered by the fact that the sounds made by an instrument produces \emph{overtones} above the note (thus part of these overtones are captured within the range). Worth noting is that Chen and Jang \cite{chen19} instead used score information to determine both $f_{\min}$ and $f_{\max}$, but there is a key optimisation used by them that will be detailed later on. Clearly, $f_{\max}$ is bounded by $f_s$ by the Nyquist-Shannon sampling theorem as such: $$ f_{\max} \leq \frac{1}{2} f_s; $$ however, again for optimisation reasons to result in fewer bins to process, $f_{\max}$ is usually set at--or slightly above--$4186.0\si{\hertz}$, the highest pitch of the piano. Once $N_{bin}$, $f_{\min}$ and $f_{\max}$ are chosen, a sequence of geometrically spaced centre frequencies $f_0, f_1, ..., f_K$ can be formed: $$ f_k = f_{\min} \times 2^{\frac{k}{N_{bin}}} $$ where $0 \leq k \leq K, k \in \mathbb{Z}$ and $K \in \mathbb{Z}$ is the largest frequency such that $f_K \leq f_{\max}$ implying $f_{K+1} \geq f_{\max}$. (This further implies that $K$ is the total number of frequency bins.) From here, the bandwidth at the $k$-th frequency is therefore $$ \Omega_k = f_{k+1} - f_{k-1}. $$ Thus, as required by CQT, $Q$, the ratio of $f_k$ (the centre frequency) to $\Omega_k$ (its corresponding bandwidth) is \textbf{constant} and independent of $k$: \begin{align*} Q & = \frac{f_k}{\Omega_k} \\ & = \frac{f_k}{f_{k+1} - f_{k-1}} \\ & = \frac{f_{\min} \times 2^{\frac{k}{N_{bin}}}}{f_{\min} \times 2^{\frac{k+1}{N_{bin}}}-f_{\min} \times 2^{\frac{k-1}{N_{bin}}}} \\ & = \frac{2^{\frac{k}{N_{bin}}}}{2^{\frac{k+1}{N_{bin}}}-2^{\frac{k-1}{N_{bin}}}} \\ & = \frac{1}{2^\frac{1}{N_{bin}} - 2^{-\frac{1}{N_{bin}}}}. \end{align*} It is quite clear that the calculation of the STFT involves moving a window along the \emph{time} axis. The CQT requires a different paradigm--the window function is instead the real-valued, zero-centred and even continuous function $W(f)$, which is moved along the \emph{frequency} axis. $W(f)$ is positive in the interval $(-0.5, 0.5)$ and zero elsewhere. To achieve varying bandwidths, $W(f)$ is scaled accordingly as it is translated, the window required for $f_k$ is given by $$ W_k(f) = \frac{f - f_k}{\Omega_k}. $$ \subsubsection{CQT: Calculation} \label{sec:cqt_calc} The CQT, as can be seen, is much more complex than the STFT. This most likely motivated Dixon and Widmer in 2005 \cite{Dixon2005MATCHAM} to instead bin spectral features calculated via the more efficient STFT into linear-log bins. This technique was in fact used even in 2021 by Henkel and Widmer to extract features for their object-detection-based sheet music score follower \cite{henkel21}. Chen and Jang in their 2019 score following system \cite{chen19} instead limited the number of times the CQT is calculated--they only calculated the CQT \emph{twice} for each detected onset (before and after). CQT's inefficiency strongly demotivated its use in real-time approaches--CQT (and its derivatives) is more commonly used in non-real-time applications \cite{mauch10, muller11, peeters06, suzuki10,thickstun20}. In 1992 a method employing the FFT to efficiently calculate the CQT (and its inverse) was proposed \cite{brown92}; this was improved further via a method that efficiently calculates CQT octave-by-octave using low-pass filtered and downsampled results for consecutively lower pitches \cite{christiancqt}. However, neither approach was capable in real-time processing of an audio stream. Nevertheless, in \cite{holighaus13} a bounded-delay CQT implementation was proposed; it was shown to be real-time capable. This approach was referred to as the \emph{sliced CQT} (sliCQ), as it involved \emph{slicing} the signal into overlapping time slices via Tukey windows--this is in contrast to prior approaches that rely on a Fourier transform of the entire signal. A detailed overview of sliCQ can be found in \cite{holighaus13}; here, a high-level overview on the analysis part is given to highlight key features of the algorithm and detail modifications required to enable real-time processing of a streamed signal. First, the \textbf{$\textbf{CQ-NSGT}_L$} NSG (Nonstationary Gabor) analysis algorithm for a signal $x$ of length $L$ is given in \Cref{alg:nsganalysis}. Key functions and parameters are as follows: \begin{itemize} \item \textbf{$\textbf{(I)FFT}_N$} denotes a (inverse) FFT of length $N$ (including the necessary preprocessing--periodisation or zero-padding--to ensure that the input vector is of length $N$). \item $a_k$ denotes selected frequency-dependent time-shift parameters (hop sizes) forming the vector $\textbf{a}$. \item $g_k$ are real-valued filters centred at $\omega_k$ representing windows constructed in the frequency domain forming the vector $\textbf{g}$. \item $I_K$ is the finite index set where $k \in I_K$. \end{itemize} \begin{algorithm}[h] \caption{NSG analysis: $c = \textbf{CQ-NSGT}_L(x,\textbf{g},\textbf{a})$}\label{alg:nsganalysis} \begin{algorithmic}[1] \State $y\gets \textbf{FFT}_L(x)$ \For{$k\in I_K,~n=0,\ldots,\frac{L}{a_k}-1$} \State $c \gets \sqrt{\frac{L}{a_k}}\cdot\textbf{IFFT}_{\frac{L}{a_k}}(y\bar{g_k})$ \EndFor \end{algorithmic} \end{algorithm} NSG analysis in \Cref{alg:nsganalysis} results in $c$, \textbf{CQ-NSGT} coefficients that mimic CQT coefficients calculated by classical methods \cite{brown92, christiancqt}. Further, \cite{holighaus13} also proposes the inverse algorithm: NSG synthesis, which can transform $c$ back into $x$--readers interested in the details as well as proofs of the propositions may consult \cite{holighaus13}. The computational complexity of NSG analysis, shown in \Cref{alg:nsganalysis} is $$\mathcal{O}(L \log L).$$ While \Cref{alg:nsganalysis} deals with a full signal (analogous to the FFT), sliCQ analysis (analogous to the STFT) cuts the signal into slices along the time axis before computing the \textbf{sliCQ coefficients} $s$, which mimic CQ coefficients computed for each time slice. The process is as follows: \begin{enumerate} \item The signal $x \in \mathbb{C}^{L}$ of length $L$ is cut into overlapping slices $x_m$ of length $2N$ via multiplying with uniform translations of $h_0$ (a $0$-centred slicing window)--the slicing process is illustrated in \autoref{fig:tukeywins}. \item For each $x_m$, the coefficients $$c^m \in\mathbb{C}^{\frac{2N}{a_k} \times |I_K|}$$ are obtained by applying $\textbf{CQ-NSGT}_{2N}(x,\textbf{g},\textbf{a})$ (\Cref{alg:nsganalysis}). \item Because the slicing windows overlap as per \autoref{fig:tukeywins}, each time index corresponds to two consecutive slices. Thus, the slice coefficients $c^m$ are rearranged into a $2$-layer array $s = \{s^l\}_{l\in\{0,1\}} \in \mathbb{C}^{2\times \frac{L}{a_k}\times |I_K|}$; see \autoref{fig:slicqarray}. \end{enumerate} Like for \Cref{alg:nsganalysis}, \cite{holighaus13} proposed sliCQ synthesis which complements sliCQ analysis. SliCQ synthesis reconstructs the original signal $x$ from the sliCQ coefficients $s$. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/cqnsgt/Fig2-eps-converted-to.pdf} \caption{Tukey windows used for slicing with essential length $N$ and transition areas of length $M$, for some $N,M\in \mathbb{N}$ with $M < N$. Note that the chosen amount of zero-padding leads to a half-overlap situation. Source: \cite{holighaus13}.} \label{fig:tukeywins} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/cqnsgt/Fig3-eps-converted-to.pdf} \caption{Schematic illustration of the sliCQ coefficients' structure. Source: \cite{holighaus13}.}\label{fig:slicqarray} \end{figure} Assuming that the slice length $2N$ is independent of $L$, the resulting computational complexity of sliCQ analysis is $$ \mathcal{O} (L). $$ SliCQ analysis' properties bring about several observations important for feature extraction in this system's context: \begin{itemize} \item The \textbf{efficiency} and \textbf{bounded computational complexity} of the algorithm allows for \emph{real-time processing} of a signal. \item The \textbf{slicing} process implies that NSG analysis resulting in high-quality CQ coefficients can be done with individual slices of the signal, contrary to earlier CQT calculation approaches that require the full signal \cite{brown92, christiancqt}. This means that sliCQ analysis can be performed on \emph{streamed} slices of an input signal. \end{itemize} Thus, sliCQ analysis is suitable for a score following system as it can extract features from a \emph{streamed} performance audio signal in \emph{real time}. \autoref{fig:cqt_time} contrasts the time taken by sliCQ and pseudo CQT (computed via FFT)\footnote{\url{https://librosa.org/doc/main/generated/librosa.pseudo_cqt.html}} to extract features from varying lengths of audio. As expected, the time taken for both approaches are linear with regard to the length of the audio (in other words, the time complexity is $\mathcal{O}(L)$ where $L$ is the length of the signal). Notably, pseudo CQT is not able to perform within real-time constraints. SliCQ on the other hand comfortably meets the real-time boundary, requiring only a little over 10\% of the audio's length. \Cref{impl_dtw_prod_repro} contains instructions on how to reproduce these results. \begin{figure}[h] \centering \includegraphics[width=0.75\columnwidth]{assets/cqt_time/output.pdf} \caption{Plot of time taken for feature extraction versus length of audio. NSGT-CQT denotes sliCQ analysis with transition and slice lengths of 2048 and 8192 respectively, and CQT (Pseudo) denotes pseudo CQT computed via FFT with hop and frame lengths of 2048 and 8192 respectively. The audio used is a 44100Hz recording of \textit{AchGottundHerr} from the Bach10 dataset \cite{duan11bach10}, and the results are obtained on the system described in \autoref{appendix_benchmark_system}.} \label{fig:cqt_time} \end{figure} Nevertheless, a challenge in using sliCQ for a \textit{streamed} sequence persists: careful choices of slicing and window properties must be made to ensure the high quality of the computed coefficients, e.g. a slice length that is too long in length implies low response times, and a slice length too short is unable to capture adequate features required. Further implementation details of this algorithm can be found in \autoref{cqt_impl}; for this system, windowing and slicing properties are exposed as configurable parameters. \subsection{From CQT Features to Feature Vectors} \label{impl_dtw_cqt_to_note} In this system, CQT is run in real time continuously on slices of the audio signals. The extracted CQT coefficients for each time slice are converted to their absolute values then $\ell_1$-normalised to sum up to $1$. Formally, \begin{definition}[Normalised Energy for a Time Slice] Given that the extracted CQT coefficients for a time slice $t$ is represented by $C_Q(t)$ (these in fact correspond to sliCQ coefficients $s$ as computed in \nameref{sec:cqt_calc}), the normalised energy for each time slice, $E(t)$ is given by $$ E(t) = \frac{|C_Q(t)|}{\|C_Q(t)\|_1}. $$ $E(t, f_k)$ represents an element in $E(t)$ that comprises the energy for the frequency bin centred at $f_k$. \label{def:normenergy} \end{definition} Thus, the \textbf{Feature Vector} for aligning performance and score audio signals (see \Cref{def:scofo_dtw}) is $E(t)$. \autoref{fig:featuresbwv846} shows example visualisations of extracted feature vectors from performance audio following the system detailed in subsections~\ref{impl_dtw_cqt_tech} and \ref{impl_dtw_cqt_to_note}. \Cref{impl_dtw_prod_repro} contains instructions on how to reproduce these results. For reference, the sheet music for the music pieces can be found on \textit{IMSLP}\footnote{\url{https://imslp.org/wiki/Prelude\_and\_Fugue\_in\_C\_major\%2C\_BWV\_846\_(Bach\%2C\_Johann\_Sebastian)}}. It is first worth noting that the clarity obtained here is far superior when compared to the spectrograms (obtained via STFT) shown in Figures~\ref{fig:preludespecgram} and \ref{fig:fuguespecgram}. While harmonics--shown primarily by the fainter notes an octave and a compound major fifth above the real notes in the score--are still present, the actual notes in the score clearly dominate the visualised features. Another observation is related to the time-frequency uncertainty principle (see \Cref{def:timefreq}): the frequency resolution at lower frequencies is poorer than that of higher frequencies; observe the blurrier features extracted from the lower notes. \begin{figure}[h] \centering \subfloat[\centering \textit{Prelude}.]{{\includegraphics[width=0.45\linewidth]{assets/cq-feature/prelude.pdf} }} \qquad \subfloat[\centering \textit{Fugue}.]{{\includegraphics[width=0.45\linewidth]{assets/cq-feature/fugue.pdf} }} \caption{Visualisation of the feature vectors extracted from the first 15 seconds of an audio performance (obtained from the MAESTRO dataset \cite{MAESTRO}) of Bach's \textit{Prelude and Fugue in C major, BWV 846}.} \label{fig:featuresbwv846} \end{figure} \subsection{DTW: Compared to other Approaches} \label{impl_dtw_compared} A review of major work in DTW-based followers is provided in \autoref{scofo_dtw}. Indeed, \autoref{scofo_litreview} outlines myriad possible approaches for score following; therefore, firstly the motivations for choosing DTW is outlined by comparing DTW directly to other major approaches. \subsubsection{Versus Approximate String Matching (ASM)} \label{dtw_vs_asm} DTW is closely related to ASM, and many concepts from the ASM aligner implemented in \autoref{impl_asm} are shared with DTW. In short, the major difference between DTW and ASM is that in the former, the notion of \emph{gaps} and \emph{arrows} does not exist--one sequence in the DTW alignment is treated as a \emph{time-warped} version of the other. The concept of \emph{time-warped} sequence alignment in DTW renders DTW highly capable of aligning audio-to-audio, which in turn motivated the myriad uses of DTW in speech recognition \cite{rabiner89}. The primary advantage of DTW over ASM is the fact that the DTW does not require complex feature extraction techniques to extract string data from performance or score data. The effort in converting the ASM aligner featured in \autoref{impl_asm} to a real-time method is futile considering the work required to render it capable of following audio performances. ASM-based methods were also quickly made obsolete since the introduction of DTW and HMM approaches--the performance of ASM-based methods is significantly far behind its successors. \subsubsection{Versus Hidden Markov Models (HMMs)} \Cref{scofo_dtw} mentioned how DTW is a special case of HMMs. What is more pertinent is the fact that DTW-based followers are simpler and more flexible. HMM-based methods usually require the full detailed score of the performance to produce \emph{hidden states} required for score following; DTW-based methods, on the other hand, do not strictly require score data. Further, the technicalities and work required to develop a HMM model is overly complex for measly returns. Further, DTW's audio-to-audio following nature means that the digital score representation can be either synthesised from any form of digital score, or obtained from performance recordings. This key advantage was exploited by Arzt \textit{et al.}{} in their demonstration of a score follower in the \textit{Concertgebouw}. The researchers were not able to find sufficiently good digital scores of the \textit{Alpensinfonie}, and therefore resorted to manually annotate downbeats on a recording of a separate performance. Score following is then performed based on this annotated recording, which maps to corresponding sections on scanned sheet music shown on tablets to the audience \cite{arzt16, arztconcert}. This workaround would not have been possible for a HMM (and ASM) method. \subsubsection{Versus Sheet Music Image Following} The paradigm-shifting methods documented in \autoref{scofo_sheetmusicimages} are capable of following sheet music images. However, one major disadvantage identified is that these approaches are data driven, and the major implementations are trained on the MSMD dataset \cite{dorfer17} which contains sheet music in the LilyPond format. The ground-truth information used to map performance audio to pixels on a sheet music image produced from the LilyPond files is not available, and thus the researchers resorted to synthesising constant-\textit{tempo} performance audio from the MIDI data extracted from the LilyPond scores. While Henkel and Widmer's most recent work in 2021 \cite{henkel21} shows some improvements in generalising to performance audio, the problem of generalising to sheet-music images and more diverse human-produced performances is yet to be solved. It is however hopeful to be able to train the networks on datasets with human performance audio mapped to scanned sheet music images; nevertheless, such datasets do not currently exist, and the creation of such a dataset would be of really high effort and budget, though a feasible--but imperfect--way is to perform audio-to-audio alignment between human-generated performance audio and the synthesised audio, then map the human performance audio to the score data in the MSMD dataset. Further, a method could be devised to align score data in the MSMD dataset to data in corresponding scanned sheet music images. DTW is therefore chosen over sheet music image following despite the latter's capability in providing an end-to-end solution able to follow performance audio on sheet music images. \subsubsection{Other Key Advantages} In \autoref{scofo_recent_mirex}, DTW is shown to be dominant in the MIREX evaluations. DTW shines in its flexibility to be extended or modified to work with different aspects and features of audio, such as the STFT and chromagram representations. Further, score data can also be used to augment audio features extracted from the score. These advantages were exploited and experimented by the top performers of the MIREX evaluation \cite{orti15,alonso16,alonso17,carabias12,suzuki10}. \subsection{DTW: Technicalities} \label{impl_dtw_tech} Here, a deeper dive into the technicalities of DTW in the score following context is given. Readers preferring a more general introduction may refer to \cite{rabiner93}. \subsubsection{Introduction} DTW, as mentioned in \autoref{dtw_vs_asm}, is similar to ASM. First, score following is defined as a DTW problem, based on the score alignment ASM definition in \Cref{def:score_alignment_asm}. The following definition shows how closely related DTW and ASM are, with the exception that the concept of \emph{gaps} is absent in DTW. \begin{definition}[Score following as a DTW problem] Let the time series of the score and the performance to be the \emph{feature vectors} $\mathcal{S}=s_1,s_2,...s_m$ and $\mathcal{P}=p_1,p_2,...,p_n$ respectively. Note that $\mathcal{P}$ is \emph{streamed} and \emph{partial} (with regard to $\mathcal{S}$). An alignment between $\mathcal{S}$ and $\mathcal{P}$ is a path $\mathcal{W} = \mathcal{W}_1, \mathcal{W}_2, ..., \mathcal{W}_i$ through an $m \times n$ cost matrix where each $\mathcal{W}_k$ is an ordered pair $(i_k, j_k)$ such that $(i, j) \in \mathcal{W}$ means that $s_i$ and $p_i$ are aligned. $\mathcal{W}$ is constrained to be monotonous, continuous and bounded by the ends of both sequences $\mathcal{S}$ and $\mathcal{P}$. The alignment is done with respect to the \emph {local} cost matrix, and the cost of a path $\mathcal{D(W)}$ is the sum of the local match costs of the path. The goal is to minimise $\mathcal{D(W)}$. \label{def:scofo_dtw} \end{definition} \subsubsection{Local Step Constraint Calculation} Rabiner \textit{et al.}{} in 1993 \cite{rabiner93} proposed several local step constraints which can be used for the computation for optimal $\mathcal{D}$. The simplest and most common one is as follows: \begin{equation} \mathcal{D}(i, j) = d(i, j) + \min \begin{cases} \mathcal{D}(i, j-1) \\ \mathcal{D}(i-1, j) \\ \mathcal{D}(i-1, j-1) \\ \end{cases} \label{eqn:orig_dtw} \end{equation} given that $d(i, j)$ is the distance between $s_i$ and $p_i$, $\mathcal{D}(i, j)$ is the cost of the minimum cost path from $(1,1)$ to $(i, j)$ and $\mathcal{D}(1, 1) = d(1, 1)$. An optimal alignment path can be extracted by tracing the recursion backwards from $\mathcal{D}(m, n)$. \subsubsection{Optimisations in Path Computation} To speed up DTW path calculations, global path constraints are often introduced--this is similar to the bounds added in \autoref{impl_asm_complexity} to optimise the ASM aligner; in fact, the constraint in which the path lies within a fixed distance from the diagonal is known in DTW as the Sakoe-Chiba bound \cite{sakoe78}. On the other hand, the constraint for the path that lies within a parallelogram around the diagonal of the matrix is known as the Itakura parallelogram \cite{itakura75}. A deeper study into these two constraints can be found in \cite{dtwitakuravssakoe}. It is again worth noting that there always exists a constraint strict enough to give suboptimal alignments save for the trivial case where $\mathcal{P} = \mathcal{S}$. Nevertheless, even with these constraints, the naïve implementation DTW recursion in \autoref{eqn:orig_dtw} has quadratic time and space complexity with regard to the length of the sequences to align (assuming $n \leq m$, the time complexity can be said to be $\mathcal{O}(n^2)$; the space complexity is simply $\mathcal{O}(mn)$). SparseDTW \cite{sparsedtw} and PrunedDTW \cite{pruneddtw} both retain the original complexities, but offer decreased computation times. However, there exist recent developments that break these bounds: Gold and Sharir in 2018 \cite{gold18} broke the almost-50-year-old quadratic time bound, giving a method that runs in $\mathcal{O}(n^2 \log \log \log n / \log \log n)$; further, Tralie and Dempsey in 2020 \cite{tralie2020} proposed an optimised DTW method that runs in $\mathcal{O}(m+n)$ space complexity. To further improve runtimes, optimality is often sacrificed--the optimal path is \emph{approximated}. MultiscaleDTW \cite{muller06} is one such example, but the most popular algorithm is perhaps FastDTW \cite{fastdtw}, which has linear time and space complexity. Nevertheless, Wu and Keogh in 2020 \cite{wu20} showed that FastDTW is approximate and generally slower than the exact DTW in application. Further, SparseDTW \cite{sparsedtw}, while being an exact calculation of DTW (and has its original complexity), was shown to be comparable in speed to FastDTW. The caveat, thus, is that complexity notation may mislead when the algorithm is deployed into production--the $\mathcal{O}(1)$ step could be vastly different among different algorithms. \subsubsection{Online Time Warping (OLTW)} Whilst many recent optimised (and sometimes approximate) DTW algorithms may calculate the required path in a duration less than the length of the aligned time sequences (therefore making them technically capable of real-time applications), the real-time constraint usually does not involve a \emph{streamed} sequence required for score following as per \Cref{def:scofo_dtw}. Dixon in 2005 \cite{dixonOLTW} presented a DTW variant--known as on-line time warping (OLTW)--that is capable of incrementally aligning sequences of arbitrary lengths in real time.\footnote{Some authors refer to OLTW as ODTW (Online Dynamic Time Warping) \cite{henkel21}.} Dixon's algorithm calculates the path in a \emph{forward manner} as such: in the main loop, a partial row or column of the path cost matrix is calculated (using the standard DTW recursion as per \autoref{eqn:orig_dtw}, restricted to use only matrix entries which are already calculated). The decision if a row or a column should be calculated depends on where the current minimum cost path on the current row and column lies--the tending ``direction'' of the current path is used as a constraint to reduce the total amount of computation required. Dixon's complete algorithm runs in linear time with regard to the length of the series (thus meaning that the incremental step is bounded by a constant). \autoref{fig:dtw_time} compares the time required to align sequences of varying length between classical DTW and OLTW. The quadratic time complexity of the classical DTW algorithm is apparent, which is in contrast to OLTW's linear time complexity. \Cref{impl_dtw_prod_repro} contains instructions on how to reproduce these results. \begin{figure}[h] \centering \includegraphics[width=0.75\columnwidth]{assets/dtw_time/output.pdf} \caption{Plot of time taken for alignment versus sequence length. Classical DTW denotes an unoptimised and recursive version of DTW, and OLTW denotes Dixon's OLTW algorithm with the parameters $\texttt{MaxRunCount} = 3$ and $\texttt{c} = 500$ (these parameters are detailed subsequently in \autoref{impl_oltw_param}). The sequences are made up of 50-unit elements, populated with random samples of floating-point numbers from a uniform distribution over $[0, 1)$. To reduce noise, the average of three runs is taken. The results are obtained on the system described in \autoref{appendix_benchmark_system}.} \label{fig:dtw_time} \end{figure} Further, OLTW has been applied and extended successfully in many score following applications, including musical analysis \cite{Dixon2005MATCHAM}, APT \cite{arzt08} and computer-aided accompaniment \cite{schauer17}. Dixon's OLTW algorithm would go on to form the basis of Arzt's works \cite{arzt08,arzt10,arzt12,arzt15, arzt16}. Macrae and Dixon in 2010 \cite{macrae10dtw} further developed OLTW to incorporate ideas of the A* algorithm \cite{hart68}. Other derivations of OLTW were also introduced by Suzuki \textit{et al.}{} \cite{suzuki10}, Carabias-Orti \textit{et al.}{} \cite{carabias12} and Chen and Jang \cite{chen19} among many others; numerous approaches involve adding more weights and terms (usually to introduce temporal elements) to the classic DTW recursion shown in \autoref{eqn:orig_dtw}. Dixon's OLTW algorithm was chosen to be part of this follower's system, and its technicalities and a detailed worked example is presented in \autoref{impl_dtw_baseline_worked_example}. The feature vector used for DTW in this system is the \textbf{Normalised Energy for a Time Slice} as defined in \Cref{def:normenergy}. While Dixon and Widmer \cite{Dixon2005MATCHAM} used the half-wave rectified first-order difference computed from every consecutive pair of energy vectors computed to simulate note onsets, this configuration performed worse when trialled in this score follower. In further experiments in DTW aligners it was also found that not performing rectification offered superior performance \cite{thickstun20}. \subsection{Distance Computation} \label{impl_dtw_dist_comp} To compute the distance $d(i, j)$ between the feature vectors $E_{i}(t)$ and $E_{j}(t)$, the $\ell_1$ (Manhattan) distance is used: \begin{definition}[Distance Function used for DTW] $$ d(i, j) = \| E_{i}(t) - E_{j}(t) \|_1 $$ \label{def:distfunc} \end{definition} An example calculation is given in \autoref{impl_dtw_baseline_worked_example}. As an aside, Arzt and Dixon's work prior to 2016 in \cite{Dixon2005MATCHAM,arzt08} incorrectly stated that the Euclidean (i.e. $\ell_2$-norm) was used--this was corrected in 2016 in \cite{arzt16}: the Manhattan ($\ell_2$) distance between the two vectors normalised by a logarithmically weighted sum of their norms was actually used. In practice, it was found that the simple $\ell_1$ (Manhattan) distance works sufficiently well, and using more complex methods like the aforementioned would incur unnecessary computation complexity while not offering measurable improvements. \subsection{OLTW: Technicalities and Worked Example} \label{impl_dtw_baseline_worked_example} \input{02_parts/03_impl/chapters/04a_dtw_workedexample.tex} \section{Score Follower Framework} This score follower conforms to the generic framework given in \autoref{scofo_generic}. The \textbf{features extracted} from the score and performance is the \emph{normalised energy in frequency bins captured by CQT} as described in subsections~\ref{impl_dtw_cqt_tech} and \ref{impl_dtw_cqt_to_note}. \textbf{Similarity calculation} is performed via taking the $\ell_1$ distance between two feature vectors as detailed in \autoref{impl_dtw_dist_comp}. Finally, the \textbf{alignment} step is done via OLTW as delineated in \autoref{impl_dtw_baseline_worked_example}. Further, this score follower is of the \textbf{audio-to-audio} class--the score can either be a notated audio file (or stream), or synthesised from MIDI/MusicXML to audio. \input{02_parts/03_impl/chapters/04b_dtw_impl.tex} \input{02_parts/03_impl/chapters/04c_dtw_eval.tex} \input{02_parts/03_impl/chapters/04d_dtw_discussion.tex} \input{02_parts/03_impl/chapters/04e_dtw_product.tex} \input{02_parts/03_impl/chapters/04f_future.tex} \section{Future Work} \label{impl_dtw_future} While the sliCQ audio feature extraction technique performs remarkably well, there are many potential areas of improvement for this system. In this section, possible areas of future work are outlined and discussed. \subsection{Improvements to OLTW} The OLTW algorithm, first introduced by Dixon in 2005 \cite{Dixon2005MATCHAM}, has seen many iterations and improvements, some of which are detailed in \autoref{impl_dtw_tech} and \cite{arzt16}. It would be interesting to study the performance of this system after applying the improvements, which include, but are not limited to: \begin{itemize} \item \textbf{Reconsidering past decisions}. A method to backtrack and reconsider past decisions in the OLTW algorithm was proposed by Arzt \textit{et al.}{} in 2008 \cite{arzt08}; this work was performed to alleviate the OLTW algorithm's tendency to deviate significantly from the optimal path thus requiring a large amount of time to recover, as the algorithm only considers the current local information of the performance and score. This improvement provided two major improvements in following real-life performances with more significant performance deviations: it improved the algorithm's robustness against tempo changes and also its error tolerance. \item \textbf{Tempo models}. Score following can also be seen as a task of adapting the tempo of the score to the performance audio. Variations in tempo (known commonly as \textit{rubato}) is prevalent in most kinds of (classical) music (previously discussed in \autoref{scofo_challenges_perfdev}); therefore, feeding tempo information computed from the performance into the OLTW algorithm (and even learning tempo deviations from different performers before storing them) can significantly improve the score follower's performance. A version of this improvement was formalised and implemented by Arzt and Widmer in 2010 \cite{arzt10}. Chen and Jang in 2019 \cite{chen19} also incorporated a tempo model in their system. \item \textbf{Windowed Time Warping (WTW)}. WTW was first introduced as an improvement to OLTW that incorporates idea of the A* algorithm \cite{hart68} in 2010 by Macrae and Dixon \cite{macrae10dtw}. WTW was shown to be real-time capable and is in fact faster (by a factor of almost 100) than OLTW; however, WTW was only able to match the performance of OLTW in terms of alignment. Nevertheless, the usage of WTW would decrease the computation power required to compute the optimal path, which is important when using this system in more resource-constrained devices, such as mobile phones. Further, as some improvements may add to the latency and computational load of the following algorithm, the usage of WTW will open more doors to more novel and computationally heavy improvements. \end{itemize} As mentioned in \autoref{impl_dtw_impl_arch}, the component-based architecture of this project's score following system means that improvements detailed above (and beyond) can be easily created as another ``Follower'' component (as shown in \autoref{fig:oltw_step}) and plugged into the system. \subsection{Online denoising and dereverberation of performance audio} While this extension was briefly mentioned by numerous authors in the field \cite{henkel20}, no actual study and implementation was done--the closest to dealing with reverberation was in Henkel and Widmer's 2021 work \cite{henkel21} which used Impulse Responses (IRs) to augment synthesised performance audio in the MSMD dataset to allow their score follower to generalise better to performances in real-life settings. Denoising and dereverberation techniques (which are more actively developed in the speech processing field \cite{naylor10,speechdenoising}, but are increasingly being researched for general audio \cite{engel2020ddsp}) may lead to significant improvements in the robustness of the score follower especially in end user environments. Users may use the score follower on devices with subpar microphones resulting in noisy audio, or attempt to use the system in different environments that cause the audio to be noisy or reverberant. \subsection{Using more Score Features} While an advantage of this score following system is that an annotated audio representation of the score is sufficient, many high-performing systems in the MIREX evaluation (discussed in \autoref{scofo_recent_mirex}) exploit the availability of high-quality note onset information in the score to improve the follower's capability. This is used in implementations by Carabias-Orti \textit{et al.}{} \cite{carabias12}, Rodriguez-Serrano \textit{et al.}{} \cite{rodriguez16}, Bris-Peñalver \textit{et al.}{} \cite{orti15,alonso16,alonso17} and Chen and Jang \cite{chen19}; all of which managed to produce high-quality score following evaluation results. \subsection{Web Implementation} Implementing this score follower on the Web (perhaps even to replace the current pair-device-based page turner implementation in \emph{TuneApp}\footnote{\url{https://tuneapp.co/pageturner}}) would allow the usage of the system on all Web-enabled devices easily without the hassle of manually installing a software artifact. Further, this system would be able to reach more users as a Web application, as opposed to only reaching a subset of users being a desktop- or mobile-exclusive application. Significant challenges on porting this score follower to the Web exist; most notably, this score follower is written in Python (as mentioned in \autoref{impl_dtw_impl_techstack}). Python is (currently) not a language well supported by the Web. Viable strategies of implementing this include (but are not limited to): \begin{itemize} \item \textbf{Rewriting in JavaScript or a JavaScript-supported language}. As mentioned in \autoref{tb_qual_impl_details_choice}, JavaScript is the \textit{lingua franca} of the Web. Thus, the follower can be rewritten in JavaScript (or a language that can transpile into JavaScript\footnote{\url{https://www.slant.co/topics/101/~best-languages-that-compile-to-javascript} covers a comprehensive list of languages that transpile into JavaScript.}, including but not limited to TypeScript\footnote{\url{https://www.typescriptlang.org/}}, Kotlin\footnote{\url{https://kotlinlang.org/docs/js-overview.html}} and F\#\footnote{\url{https://fable.io/}}). A problem with using JavaScript--or any language that transpiles into JavaScript--is that JavaScript is inherently single threaded, and would not fully support this system's multiprocessing architecture as detailed in \autoref{impl_dtw_impl}. \item \textbf{Rewriting in a WebAssembly-supported language}. WebAssembly\footnote{\url{https://webassembly.org/}} (abbreviated \textit{Wasm}) is a binary instruction format designed as a portable compilation target for various programming languages to be run on the Web. \textit{Wasm} is designed to be fast, safe and open. While there are fewer languages that provide full compilation support to \textit{Wasm}\footnote{\url{https://github.com/appcypher/awesome-wasm-langs} provides a comprehensive and updated list.} compared to the many languages that can transpile into JavaScript, major languages such as C++\footnote{\url{https://github.com/emscripten-core/emscripten}. Note that most languages that support emitting of LLVM (\url{https://llvm.org/ProjectsWithLLVM/}) are in fact supported by \textit{Emscripten}.} and Go\footnote{\url{https://golang.org/}} support compiling to \textit{Wasm}. Another advantage of \textit{Wasm} over (transpiling to) JavaScript is that \textit{Wasm} supports multithreading using \texttt{SharedArrayBuffer} in browsers\footnote{\url{https://emscripten.org/docs/porting/pthreads.html}}. Significant work however will be required to first rewrite the project into a \textit{Wasm}-supported language and then connect the emitted \textit{Wasm} output to the GUI. \item \textbf{Running Python on the Web}. This approach would theoretically require minimal effort as the project can remain in Python. There are two major classes of approaches that can enable Python on the browser: compiling into JavaScript (major implementations include Transcrypt\footnote{\url{https://www.transcrypt.org/}}, Brython\footnote{\url{https://brython.info/}} and Skulpt\footnote{\url{https://skulpt.org/}}) and incorporating a Python runtime in the browser (implementations include Pyodide\footnote{\url{https://pyodide.org/}}, which works by compiling the Python runtime into \textit{Wasm}). While there are numerous projects bringing Python to the browser, none of them currently fully support all the features required by this project (multiprocessing for instance), and thus block this approach. Pyodide (currently version 0.17.0 as of time of writing) shows great promise as it is actively developed, and incorporating the score follower into Pyodide would be an interesting project in the future when the features required for this score follower are implemented. \end{itemize} Note that porting the GUI part of the follower, which is mostly covered by the qualitative testbench introduced in \autoref{tb_qual} is comparatively trivial as it is written using Web technologies--see \autoref{tb_qual_impl_details_choice}. \subsection{Real-life Testing} \label{impl_dtw_future_reallife} Unfortunately, in this work's time period, the COVID-19 pandemic prevented real-life tests from being carried out. It would be interesting to evaluate this project's system with musicians--of varying skill levels--in different real-life settings, be it music practice or performance. This would require augmenting the performance audio streaming component to take in streamed audio from a microphone. \subsection{Score Following Applications} The qualitative testbench introduced in \autoref{tb_qual} can be used in conjunction with this score follower as a means of carrying out performance analysis as discussed in \autoref{scofo_apps_perfanal}. The qualitative analyses--supported by the quantitative analyses--performed in \autoref{impl_asm_eval} strongly suggest that this system is accurate enough for this purpose. Moreover, the qualitative testbench can be used as an APT system, but more precisely an Automatic Page \emph{Scrolling} system. The results in the qualitative evaluations in \autoref{impl_dtw_eval_qual} show that this system is reliable and robust enough to be used to follow complete performances with appreciable performance deviations. Work remains to be done however to test this system on real performers--with varying skill levels--as per \autoref{impl_dtw_future_reallife}. Score following has many applications beyond performance analysis and APT, some of which are detailed in \autoref{scofo_apps}. It would be interesting to explore the usage of this system in, for instance, computer-aided accompaniment and performance cues. \subsection{Handling Improvised Performances} This system was not tested thoroughly against improvised performances, which is a challenge of score following identified in \autoref{scofo_challenge_music_improv}. It would be interesting to see how well this system performs against improvised performances, and also to investigate the necessary adjustments and/or extensions required to allow the system to perform well on improvised performances. \chapter{A Beat Tracking Approach: The TuneApp Conductor} \label{impl_beat} \epigraph{\itshape If the difference between 1911 and 2011 is electricity and computation, then Max Mathews is one of the five most important musicians of the 20th Century.}{Miller Puckette} Beat-tracking-based score followers were briefly mentioned in subsections~\ref{scofo_relwork_temporal} and \ref{scofo_relwork_partial}. These type of trackers are, of course, suboptimal as they do not use reliably available musical information available in the sheet music. Nevertheless, beat tracking itself is a widely studied field in MIR \cite{matthewdavies19}, and there exists \textit{two} beat-tracking-related MIREX evaluations \cite{mirexaudiobeattracking,mirexaudiodownbeatestimation}. While not directly related to work that will be presented in the subsequent chapters, there exists motivation in creating a simple beat-tracking-based score follower. \section{Motivation} \subsection{Author's Backstory} \label{impl_beattrack_backstory} \textit{In this subsection, ``I'' shall refer to the author.} I am not a musician, but I used to play the violin and some piano. Growing up with electrical engineering influences (thanks to my father, who worked at \textit{AT\&T Bell Labs}) eventually led me to read Jon Gertner's \textit{The Idea Factory: Bell Labs and the Great Age of American Innovation} \cite{gertner2012idea} (a key factor in my acceptance at Imperial College London--I discussed contents of this book with my interviewer). Bell Labs had no shortage of legends, but one that struck me the most was Max Mathews: undoubtedly the father of computer music. Max Mathews gave the music community so much--from little toys like his \textit{Radio-Baton} to now-ubiquitous synthesisers. He showed that it is possible to fuse my musical and engineering interests to create fun and interactive engineering projects. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/tuneapp156.png} \caption{Desktop home page of \textit{TuneApp 1.5.6 (November 2020)}} \label{fig:tuneapp156} \end{figure} Fast-forward some years, \textit{TuneApp}\footnote{\url{https://www.tuneapp.co/}}--a widely available, cross-platform, music practice companion with core music practice features like a chromatic tuner, metronome, page turner, beat detector etc. was born. The home page of \textit{TuneApp} is shown in \autoref{fig:tuneapp156}. In fact, I plan to incorporate score follower systems introduced in the work in the page turner (manual as of time of writing). One of Max Mathews' work that I particularly liked was the \textit{Radio-Baton} \cite{radiobaton}--an instrument that allows the user to ``conduct'' music. \autoref{fig:mathewsradiobaton} shows Mathews waving the \textit{Radio-Baton}. \begin{figure}[h] \centering \includegraphics[width=0.3\columnwidth]{assets/Mathews260.jpg} \caption{Max Mathews waving the \textit{Radio-Baton}.} \label{fig:mathewsradiobaton} \end{figure} The high engineering sophistication required for the \textit{Radio-Baton} begs the question: \begin{displayquote} Now that sensors that could deliver the same information required for the functionality of the \textit{Radio-Baton} are more common (and even embedded into mobile devices), can a similar contraption be easily made in today's widely available technology? \end{displayquote} The answer, spoiler alert, is \textit{yes}. This chapter of the report details one weekend I spent for this score following-related work. \subsection{A different Score Following Model} Work in this section via a simpler beat tracking model serves to show how the technology stack of a score follower should look like, in addition to giving a practical example of how the generic framework of score following (\autoref{scofo_generic}) is fulfilled. \section{Requirements} \label{impl_beattrack_req} Requirements that are partly fulfilled by the \textit{Radio-Baton} are captured to create a ``conductor'' experience. In this case, no specialised hardware is required. The beats are tracked via common sensors widely available on user devices--be it PCs or mobile phones. \subsection{Beat Tracking on User Input} A core part of conducting is to provide the fundamental \textit{beats} of the music to be followed by the player. This application shall be able to track beats via user input. Users on a PC/Mac shall be able to use a button to tap, whereas users on accelerometer-enabled mobile phones (most modern smartphones) shall be able to wave their phones to indicate the beats of the music. \subsection{Real-time Beat-sensitive Music Playback} After tracking beats input by the user, the application shall have a music player that can play back--in real time--the music at the tempo derived from the user input. The music is provided by the user; three forms of input are supported: \nameref{scofo_mdr_midi}, \nameref{scofo_mdr_audio} and \nameref{scofo_mdr_musicxml}, each in a separate interface. \subsection{Music Playback Visualisation} In addition to auditory feedback on user input, a visualisation, core to the \textit{score following} aspect of the application, is provided. This is similar to the visual feedback provided in the qualitative testbench (\autoref{tb_qual}). \section{Technical Background} The technical background on how the requirements defined in \autoref{impl_beattrack_req} are fulfilled is first provided. \subsection{Beat Tracking on User Input} \subsubsection{Algorithm to calculate instantaneous tempo} The metric of interest to be measured from user input is the \textbf{instantaneous tempo}. \begin{definition}[Instantaneous tempo] The instantaneous tempo, $\hat{\tau}$, in $\text{BPM}$ (beats per minute) is defined as $$ \hat{\tau} = \frac{60}{t_{b,n} - t_{b,n-1}}, $$ where $t_{b,n}$ and $t_{b,n-1}$ are the times (measured in $\si{\second}$) of the last two detected beats. \label{def:insttempo} \end{definition} $\text{BPM}$ is a common unit for tempo widely used in music. As this equation requires two beats, the tempo prior to receiving two beats is set to $\hat{\tau}_0$: the music's original tempo (detected from MIDI, Audio or MusicXML). There exists possibilities of creating a tempo model based on information recorded prior to the two most recent beats, but experimentally this did not bring about good results--real conductors and musicians respond most sensitively to the most recent beats. Further, when the next beat is not detected, the music is usually played at the last indicated tempo--thus motivating the use of the instantaneous tempo here. Another possibility is to incorporate a temporal model that slows down the music exponentially over time when no further beats are detected, but again this is not natural: musicians usually continue playing at the set tempo unless an indication to stop is provided by the conductor. \subsubsection{Button Input: All Web devices} A button will be provided for users to ``tap'' on--this can be via a mouse click on a PC or Mac, or a touch on a touchscreen device. This registers the time of the beats ($t_{b,n}$ and $t_{b,n-1}$). \subsubsection{Accelerometer: Most modern mobile devices} In addition to a button input, an accelerometer--common in modern mobile devices--can be used to measure acceleration in three axes. This can thus be used to calculate whether a strong and sudden change in acceleration is detected in any direction (which is the primary sign of a beat used by conductors). Taking the two most recent sets of acceleration in three directions as $\{a_{d,n}\}$ and $\{a_{d,n-1}\}$ for $d \in \{x,y,z\}$, the \textbf{absolute change in acceleration} is derived: \begin{definition}[Absolute change in acceleration] The absolute change of acceleration, $\delta_{|a|}$, is calculated as follows: $$ \delta_{|a|} = \sum_{d=x,y,z} |a_{d,n} - a_{d,n-1}|. $$ \label{def:abschgaccel} \end{definition} Moving on, what constitutes a \textbf{detected beat} is defined: \begin{definition}[Detected beat] A beat shall be treated as detected if $\delta_{|a|}$ is larger than a user-adjustable threshold $\theta_a$ (important due to hardware differences and user preferences). \end{definition} When a beat is detected, the system is suspended for a set time delay: $T_{delay} = \si{200\milli\second}$ (the gap translates to $300\text{BPM}$). This is used to cap the tempo at a sensible maximum of $300\text{BPM}$, and also serves to stop erroneous series of beats being detected in a single intended beat. During beat tracking, the accelerometer sensors are constantly polled to detect changes in acceleration to update $\delta_{|a|}$, save for the period when the system is suspended for $T_{delay}$. \subsection{Real-time Beat-sensitive Music Playback} Players for MIDI, Audio and MusicXML that are able to play music at the indicated instantaneous tempo $\hat{\tau}$ are required. MIDI and MusicXML contain score data that indicates beats, so implementing change of speed is trivial--the synthesiser just needs to play the indicated notes at a different tempo. The Audio component is difficult for two reasons: \begin{enumerate} \item \textbf{Non-pitch-shifting speed change}: A naïve and fast time-stretching method to change the speed of audio would cause a pitch shift. Transposition, or pitch scaling, is required to counter the pitch-shifting effects. \item \textbf{Beat detection}: The playback speed is determined by \textit{aligning} beats detected from the user to beats on the audio. A beat detection algorithm is therefore required to extract beat data from the audio recording. \end{enumerate} First, the more trivial non-pitch-shifting speed change problem is tackled. Firstly, the \textbf{target playback rate} is defined: \begin{definition}[Target playback rate] First, take $\tau_a$ as the audio's detected tempo (for simplicity's sake, assume that the audio has constant tempo, but note that this system is capable of processing audio with varying tempo). $\tau_d$ is defined as the desired audio tempo (derived from user input). The target playback rate is therefore $$\frac{\hat{\tau}_d}{\tau_a}.$$ \label{def:targplaybackrate} \end{definition} A playback rate of $2$ without pitch adjustments means that the frequency of the audio will be \textit{doubled} (the wavelengths of the audio frequencies are halved): the resulting audio is said to be an \textit{octave} higher than the original. Therefore, it is required to \textit{transpose} (pitch adjust/scale) \cite{rai19} the resulting audio, effectively halving the frequencies, to compensate for the pitch shift resulting from the change of playback rate. Moving on, the harder problem of audio beat detection is resolved. A beat detector is required for this. A real-time beat detector can be used, but is not paramount to this application; the beats in the audio can be detected more reliably using an offline algorithm prior to the user's conducting. \subsection{Music Playback Visualisation} A visual interface showing the tracking of the beats and the response of the application greatly improves user interaction and experience. The type of music visualisation depends on the available musical information. For MIDI, note information can be generated in a scrolling piano roll with the currently played note(s) highlighted. Audio, on the other hand, does not contain note information--the waveform or the spectrogram can be instead shown with a playback marker placed on the current audio position. MusicXML is the most straightforward--the interface is similar to the qualitative testbench's described in \autoref{tb_qual}: the rendered score is shown with a marker denoting the score position. \section{Score Follower Framework} The application fulfils the generic score follower framework described in \autoref{scofo_generic}. The \textbf{features extracted} from the score and ``performance'' (in this case conducting) are \textit{beats}. The \textbf{similarity calculation} step is fused with the \textbf{alignment} step, in which the music playback is synchronised by aligning the \textit{instantaneous tempo} in the score and the user's conducting. It follows that this tracker is of the \textbf{symbolic-to-symbolic} type--the follower works by matching symbolic temporal information extracted from the conducting and the score. Notice also that the system could be modified to use actual musical performance audio as the input--this would require a real-time beat tracking solution to detect beats in the performance audio. \section{Implementation} \label{impl_beattrack_impl} As this application is an integration to the existing \textit{TuneApp} Web stack, the technologies used are therefore the same, i.e. React\footnote{\url{https://reactjs.org/}} and TypeScript\footnote{\url{https://www.typescriptlang.org/}}. While \textit{TuneApp} is kept proprietary, the source code is available for non-commercial purposes upon request. To access device acceleration data, the well-defined \texttt{DeviceMotionEvent}\footnote{\url{https://developer.mozilla.org/en-US/docs/Web/API/DeviceMotionEvent}} Web API that offers applications access to the data is used. As for non-pitch-shifting playback rate changing audio playback, the Web Audio API\footnote{\url{https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio}} is used. This API gives access to audio processing implementations, often native and efficient, by different browsers. To detect the beats in an audio file, a Web implementation of a fast and reliable non-real-time method proposed by Simon Dixon in 2001, \textit{BeatRoot} \cite{beatroot}, is used. \textit{BeatRoot} is capable of detecting beats from a wide range of musical styles, including classical, jazz and modern. \textit{BeatRoot} works by detecting and analysing rhythmic events to generate tempo hypotheses at various metrical levels--the best fit is chosen from these hypotheses. As \textit{BeatRoot} works on only a single channel of audio, audio data from all channels are averaged before being fed into the system. The MIDI visualisation is built upon prior work in \textit{TuneApp}'s \textit{MIDI Visualizer}\footnote{\url{https://www.tuneapp.co/visualizer}}, which is in turn based on the \texttt{Magenta.js}\footnote{\url{https://magenta.github.io/magenta-js/music/index.html}} library. The \texttt{SGM} soundfont\footnote{\url{https://www.polyphone-soundfonts.com/documents/27-instrument-sets/256-sgm-v2-01}} is used for MIDI synthesisation. The interface is a piano roll that scrolls with the music, see the implementation in \autoref{fig:tuneappconductordeployed}(a): currently active notes are \textit{magenta}, and other notes are \textit{grey}. The Audio visualisation, on the other hand, is a waveform of the average audio over all channels, together with grey vertical lines denoting instances of the detected beats. The waveform scrolls in line with the playback, with a red vertical line showing the current playback position, see \autoref{fig:tuneappconductordeployed}(b). A MusicXML display library is used for MusicXML visualisation\footnote{\url{https://opensheetmusicdisplay.github.io/}}--the playback shows the sheet music in addition to a green marker showing the current position in the score--see \autoref{fig:tuneappmxmlconductor}. For each section, users can upload their own files or use a sample file provided. \section{Results} Readers interested in trying the \textit{TuneApp Conductor} can do so by visiting \url{https://www.tuneapp.co/conductor}. \subsection{Fulfilment of Requirements} Following the implementation details in \autoref{impl_beattrack_impl}, all requirements listed in \autoref{impl_beattrack_req} are met. A small exception is that the MusicXML-based interface, while complete and working, is not released to the public--\autoref{impl_beattrack_appuse} contains more information on this. \subsection{Application Usage and Interface} \label{impl_beattrack_appuse} \autoref{fig:tuneappconductordeployed} shows the two variants released for users: the MIDI-based conductor (a) and the audio-based one (b). Users on their mobile devices can either tap the green \textbf{TAP} button, or start conducting by treating their devices as a conducting baton. Users on a PC or Mac can only use the button. \begin{figure}[h] \centering \subfloat[\centering The MIDI-based conductor]{{\includegraphics[width=5cm]{assets/tuneapp/conductor-midi.png} }} \qquad \subfloat[\centering The audio-based conductor]{{\includegraphics[width=5cm]{assets/tuneapp/conductor-audio.png} }} \caption{The two released variants of the \textit{TuneApp Conductor}.} \label{fig:tuneappconductordeployed} \end{figure} The MusicXML-based conductor was not deployed, as it was hard to optimise for mobile: even the most modern devices that were tested on showed significant sluggishness in the application, likely due to the large MusicXML rendering power required on top of the resources needed for beat-aligned music playback. Nevertheless, it works well on a modern laptop--see \autoref{fig:tuneappmxmlconductor}, but it was not released to the public: \textit{TuneApp}'s core goal is to be as cross-platform as possible. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/tuneapp/conductor-mxml.png} \caption{The MusicXML-based \textit{TuneApp Conductor}, not released to users.} \label{fig:tuneappmxmlconductor} \end{figure} \subsection{User Feedback} \label{impl_beattrack_feedback} User feedback collected by informal survey show that the \textit{TuneApp Conductor} is well received. Users liked the idea in general, and the performant loading and functioning of the application is often mentioned. Some comments and reviews received include: \begin{itemize} \item ``This is such a good idea! It's so fun to use and works very fast!'' \item ``I am surprised that this works so well on my phone!'' \item ``This is great for people who are `closet conductors' (like me), but most notably it has potential to be used for training musicians' rhythmic abilities.'' \item ``Such a cool use for common sensors we easily take for granted these days.'' \end{itemize} Users surveyed enjoyed both the MIDI- and Audio-based conductors, indicating no preference of one to the other. A select few testers allowed to test the MusicXML-based conductor echoed the sentiments mentioned in \autoref{impl_beattrack_appuse}: the MusicXML rendering and playback was not responsive and performant enough. Hence, the feature was dropped entirely, but may come back in the future--either by optimisation of the rendering and playback of the interface, or simply via the increase in computation power allowing more powerful devices to run it better. \subsection{Evaluation} As this score follower does not produce note onset information, the quantitative testbench (\autoref{tb_quant}) cannot be used. Note, however, that the qualitative testbench (\autoref{tb_qual}) is in fact already built into this approach via the MusicXML-based interface. In addition, qualitative feedback is obtained from the two other interfaces. Extensive user testing is used and informal surveying is performed to collate qualitative feedback. User feedback is as reported in \autoref{impl_beattrack_feedback}. Interestingly, one user compared the application to one of Google's experiments: the \textit{Semi-Conductor}\footnote{\url{https://semiconductor.withgoogle.com/}}. While the \textit{Semi-Conductor} features more nuances in conducting as it uses pose detection to detect ``conducting information'' via the users' cameras, the user did not find Google's approach responsive enough--it is after all an application that is intended to demonstrate \textit{PoseNet}--a Web-based pose detection model \cite{posenet}--running in-browser rather than to provide a musically focused application, which is the \textit{TuneApp Conductor}'s core goal. \section{Discussion} \label{impl_dtw_dicsuss} Overall, the quantitative and qualitative evaluation results presented in \autoref{impl_dtw_eval} show that the follower fulfils all the requirements set out in \autoref{impl_dtw_req}. Notably, it was shown by the quantitative analysis in \autoref{impl_dtw_eval_quant} that the sliCQ approach to obtain CQT coefficients from audio as features for score following consistently outperforms a commonly used traditional FFT-based approach. Nevertheless, the OLTW algorithm as discussed in \autoref{impl_dtw_dtw_online} can be improved in many ways to obtain better performance--this, along with other possible areas of future work--will be discussed subsequently in \autoref{impl_dtw_future}. The component-based architecture described in \autoref{impl_dtw_impl_arch} means that extensions to the score follower would generally only require the implementation of an individual component that can be easily swapped into the system. \chapter{An Approximate String Matching (ASM) Approach} \label{impl_asm} \epigraph{\itshape Music helps immensely with math skills, and math skills help immensely with music skills.}{Michael Giacchino} This chapter goes back to basics to create a basic music alignment system via Approximate String Matching, a notion popular in early score followers. Performance of such score followers and aligners are inferior to the many score followers introduced after the first ten years of score following, but for this project there are motivations to introduce a simple alignment system. \section{Motivation} The creation of the ground-truth alignment dataset for the quantitative testbench (via widely available performance datasets such as the MAESTRO \cite{MAESTRO} and MAPS \cite{emiya10} datasets) introduced in \autoref{tb_quant} requires the alignment of a performance MIDI sequence to MIDI data extracted from a score. This alignment can either be done by tedious manual alignment, or by the use of an Approximate String Matching (ASM) aligner. This latter method would allow straightforward generation of reference ground-truth alignment datasets, with minimal manual adjustments required post-alignment. Thus, this ASM aligner is a core part of the new data procurement method explained in \autoref{tb_quant_dataset_api}. In addition, such an aligner can be converted into a score follower, but most importantly, an ASM aligner--being simple and easy to explain--is important in the context of this report to help develop complex concepts used in more advanced approaches proposed in the next chapter. \section{Requirements} \label{impl_asm_req} \subsection{Offline MIDI Data Alignment} The primary goal of this system remains to complement the quantitative testbench introduced in \autoref{tb_quant}. The system shall, given MIDI data obtained from performance recordings on MIDI-capable instruments as well as reference MIDI data from scores, provide offline alignments. \subsection{Robust Score Alignment} \label{impl_asm_robust} As offline score aligners share many of their online score follower counterparts' challenges, which are covered in \autoref{scofo_challenges}, the aligner shall produce alignments that are high quality and robust to performance deviations. Note also that this aligner is intended to process performance in datasets, which usually have limited performance deviations \cite{MAESTRO,emiya10}. \subsection{Misalignment Indication} \label{impl_asm_indicate} This system shall produce indication of misalignments that it could not resolve automatically to aid manual adjustments. \subsection{Input Data Size} \label{impl_asm_input_size} The aligner shall work reasonably efficiently with a pair of sequences, each of length up to $10000$ elements. This number is arrived at after computing the average number of notes per performance in the MAESTRO dataset ($5517$) \cite{MAESTRO}. \subsection{Output Format} This system shall produce alignments in the reference format required by the quantitative testbench, described in \autoref{tb_quant_dataset_api}. In short, each aligned note is described in a line with three columns denoting the true note onset time in the performance, the note onset time in the score and the MIDI note number of the note respectively. \section{Technical Background} \label{impl_asm_techback} \subsection{Approximate String Matching (ASM)} \label{impl_asm_techback_asm} The crux of robust symbolic-to-symbolic score alignment and score following systems is \textbf{Approximate String Matching (ASM)}. ASM is more commonly known as \textit{sequence alignment} in the bioinformatics field where the establishment of homologies between genomic sequences is of large interest \cite{marcosola17}. In fact, the third chapter in \cite{marcosola17} as well as Navarro's 2001 review \cite{navarro01} of ASM provide excellent overviews on ASM, useful for the interested reader. ASM is also colloquially referred to in the computer science community as \textit{fuzzy string searching}. Applied in both score following and score alignment, both online and offline ASM algorithms exist. This aligner deals with the \textit{offline} counterpart. Algorithms may also be classified as \textit{global} or \textit{local}--the former means that the ends of the sequences are not \textit{free}: the final shape of the alignment spans throughout both sequences attempting to match them completely; the latter is the opposite: the ends of the sequences are \textit{free}. \textit{Semi-global} (or ``glocal'') aligners is another classification of interest: it works with aligning a smaller sequence end-to-end to a local region of the larger sequence, in which the larger sequence has free ends. ASM score followers may use a special form of an online semi-global aligner--this method can make it robust to skips and repeats. ASM score aligners on the other hand use offline global ASM algorithms--score and performance data are usually sequences that are similar and of roughly equal size. Clearly, identical sequences are trivial to align. When sequences differ, as in the case of performance data mismatching with score data, it is necessary to understand how these errors are dealt with. Before that, score alignment is first formulated as an ASM problem. \subsubsection{Problem Formulation} \begin{definition}[Score alignment as an ASM problem] The score's MIDI data is first represented as a string $S = s_1 s_2 \ldots s_n$ and the performance MIDI data as a string $P = p_1 p_2 \ldots p_m$. The goal is to find the best scoring \textit{global alignment} between $S$ and $P$, giving the respective resulting strings $S' = \sigma_1 \ldots \sigma_\nu$ and $P' = \pi_1 \pi_2 \ldots \pi_\nu$, where $S'$ and $P'$ are \textit{substrings} of $S$ and $P$ respectively with \textit{gaps} allowed in them. The aligned result can therefore be represented as a list of tuples $$L = [(\sigma_1,\pi_1), \ldots, (\sigma_\nu,\pi_\nu)].$$ For any arbitrary tuple in $L$, the non-gap elements may \textit{match}, \textit{mismatch} or be matched to a \textit{gap} $\Gamma$. The final case is referred to as an \textit{indel} (INsertion or DELetion). \label{def:score_alignment_asm} \end{definition} Defining the set of musical notes $N \in \{A, B, C, D, E\}$, an example of aligning score and performance data is given. Say that $P = ABCDABE$ and $S = ACDDCBC$, an alignment may be $P' = ABCDA \Gamma BE$ and $S' = A \Gamma CDDCBC$, giving $$L = [(A,A), (B, \Gamma), (C, C), (D, D), (A, D), (\Gamma, C), (B, B), (E, C)].$$ $(A,A)$ denotes a \textit{match}, meaning that the right note is played. $(B, \Gamma)$ and $(\Gamma, C)$ are cases of \textit{indel}; the former indicating an extra note not in the score being played, the latter a missed note in the score not being played. $(A, D)$ indicates a \textit{mismatch}: a wrong note $A$ played instead of the correct note $D$. \subsubsection{Scoring System} There are three ways in which non-gap elements in tuples of $L$ may be matched. Given an arbitrary tuple $(\sigma,\pi)$ where $\sigma \neq \Gamma$ (i.e. $\sigma$ is not a gap element), there are three cases: \begin{enumerate} \item $\sigma = \pi$, \textbf{Match}: the two elements are the same. \item $\sigma \neq \pi$, \textbf{Mismatch}: the two elements are different. \item $\pi = \Gamma$, \textbf{Indel}: the best alignment involves aligning $\sigma$ to a gap. \end{enumerate} Notice that a tuple may never be both gaps, as deleting the tuple will yield a better alignment. The cases above therefore generalise for tuples where $\pi \neq \Gamma$. Moving on, how these three cases affect the \textit{scoring function} to be maximised is detailed. A \textbf{match} is not an error and therefore should be assigned a zero or positive score. \textbf{Mismatch} and \textbf{indel} errors are assigned negative values. These values can be tuned according to the data or use case; for example, for alignments where gaps are undesirable, the indel score (which is also known as the \textit{gap penalty}) can be significantly negative. Needleman-Wunsch assigns 1 to match and -1 for mismatch and indel \cite{needleman70}. \subsubsection{Algorithm Presentation} The alignment problem set forth can be brute-forced. While the alignment here is not time sensitive, the problem quickly becomes intractable for large sequences (which is in this case, see \autoref{impl_asm_input_size}). The ways of aligning two sequences of lengths $m, n$ is given by $$ \binom{n+m}{m}\frac{(m+n)!}{(m!)^2}. $$ For $n = m = 100$, this evaluates to approximately $9 \times 10^{58}$. Assuming each enumeration takes one millisecond, the algorithm would take up to $3 \times 10^{48}$ \textit{years} to complete! Thus, the algorithm's core part is based on the Needleman-Wunsch algorithm \cite{needleman70}, an efficient algorithm that performs ASM besides being a popular example of dynamic programming. For now, the Needleman-Wunsch algorithm's scoring system is used. An example of the use of the proposed algorithm is given: the goal is to produce a score alignment of the sequences $P = ABCDABE$ and $S = ACDDCBC$ where the set of musical notes is $N \in \{A, B, C, D, E\}$. The steps required for alignment are outlined: \begin{enumerate} \item \textbf{Grid Construction}. First a grid $G$ based on $P$ and $S$ is constructed. For convenience, the grid is indexed using a coordinate system $(x, y)$, where the last row of the first column is the origin $(0, 0)$--this cell is referred to as $G(0, 0)$. $x^+$ is in the rightward direction and $y^+$ is in the upward direction. $P$ is placed on the last row starting from $G(2, 0)$ to the right and $S$ is placed on the first column starting from $G(0, 2)$ to the top. Spaces are left for scores. \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $B$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $C$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $D$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $D$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $C$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $A$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} \item \textbf{Table Filling}. First, the score for each cell is calculated row-by-row. Following from the scoring system set forth, parameters for the scores for a match, a mismatch and an indel are defined: \begin{definition}[Scores for the three error cases] \label{asm_three_error_def} $\alpha$, $\beta$ and $\gamma$ denote the scores for a match, mismatch and an indel respectively. \end{definition} In this example, $\alpha = 1$ and $\beta = \gamma = -1$. The \textit{Similarity Function}, $\textsc{Sim}$, is defined as: \begin{definition}[Similarity Function] \label{sim_func_defn} $$ \textsc{Sim}(c_1, c_2) = \begin{cases} \alpha, & \text{if }c_1 = c_2 \\ \beta, & \text{otherwise} \\ \end{cases} $$ where $c_1$ and $c_2$ are elements in the strings $P$ and $S$. \end{definition} The score function is defined as \begin{definition}[Score function] The score for a cell $G(x, y)$ is given by $$ \textsc{Score}(x, y) = \max \begin{cases} \textsc{Score}(x-1, y-1) + \textsc{Sim}(G(x, 0), G(0, y)) \\ \textsc{Score}(x-1, y) + \gamma \\ \textsc{Score}(x, y-1) + \gamma \\ \end{cases} $$ where $\textsc{Score}(0, y) = \textsc{Score}(x, 0) = -\infty$ and $\textsc{Score}(1, 1) = 0$. The first line constitutes moving diagonally upwards and rightwards and matching (or mismatching) $G(x, 0)$ and $G(0, y)$, whereas the second line denotes moving rightwards by matching $G(0, y)$ to a gap. The final line indicates moving upwards by matching $G(x, 0)$ to a gap. \label{def:scorefunc} \end{definition} First, the simplest row $G(x, 1)$ and column $G(1, y)$ are filled: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & -7 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $B$ & -6 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $C$ & -5 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $D$ & -4 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $D$ & -3 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $C$ & -2 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $A$ & -1 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & 0 & -1 & -2 & -3 & -4 & -5 & -6 & -7 \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} The necessary subgrid required to calculate $\textsc{Score}(2,2)$ is then extracted for simplicity: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $A$ & -1 & \phantom{} \\ \phantom{} & 0 & -1 \\ \phantom{} & \phantom{} & $A$ \\}; \end{tikzpicture} Here, \begin{equation*} \begin{split} \textsc{Score}(2, 2) &= \max \begin{cases} \textsc{Score}(1, 1) + \textsc{Sim}(G(2, 0), G(0, 2)) = 0 + \textsc{Sim}(A, A) & = 1 \\ \textsc{Score}(1, 2) + \gamma = -1 + -1 & = -2 \\ \textsc{Score}(2, 1) + \gamma = -1 + -1 & = -2 \\ \end{cases}\\ &= 1. \end{split} \end{equation*} This calculation is straightforward as it is clear that the best score arises from aligning $A$ to $A$ without introducing any gaps. The \emph{backwards} movement direction that gives the best score is also recorded. In this case, this is represented as an \textbf{arrow} from $G(2,2)$ to $G(1, 1)$. Further, \textsc{Score}(3, 2), \textsc{Score}(2, 3) and \textsc{Score}(3, 3) are calculated. \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & -2 & \phantom{} & \phantom{} \\ $A$ & -1 & 1 & \phantom{} \\ \phantom{} & 0 & -1 & -2 \\ \phantom{} & \phantom{} & $A$ & $B$ \\}; \end{tikzpicture} Here, \begin{equation*} \begin{split} \textsc{Score}(3, 2) &= \max \begin{cases} \textsc{Score}(2, 1) + \textsc{Sim}(G(3, 0), G(0, 2)) = 0 + \textsc{Sim}(B, A) & = -1 \\ \textsc{Score}(2, 2) + \gamma = 1 + -1 & = 0 \\ \textsc{Score}(3, 1) + \gamma = -2 + -1 & = -3 \\ \end{cases}\\ &= 0, \end{split} \end{equation*} \begin{equation*} \begin{split} \textsc{Score}(2, 3) &= \max \begin{cases} \textsc{Score}(1, 2) + \textsc{Sim}(G(2, 0), G(0, 3)) = 0 + \textsc{Sim}(A, C) & = -1 \\ \textsc{Score}(1, 3) + \gamma = -2 + -1 & = -3 \\ \textsc{Score}(2, 2) + \gamma = 1 + -1 & = 0 \\ \end{cases}\\ &= 0, \end{split} \end{equation*} and \begin{equation*} \begin{split} \textsc{Score}(3, 3) &= \max \begin{cases} \textsc{Score}(2, 2) + \textsc{Sim}(G(3, 0), G(0, 3)) = 1 + \textsc{Sim}(B, C) & = 0 \\ \textsc{Score}(2, 3) + \gamma = 0 + -1 & = -1 \\ \textsc{Score}(3, 2) + \gamma = 0 + -1 & = -1 \\ \end{cases}\\ &= 0. \end{split} \end{equation*} For $\textsc{Score}(3, 2)$ and $\textsc{Score}(2, 3)$, the cases in which gaps are introduced are more optimal than moving diagonally. This is repeated until the whole grid is filled, giving \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & -7 & -5 & -3 & -1 & -2 & -2 & 0 & 0 \\ $B$ & -6 & -4 & -2 & -2 & -1 & -1 & 1 & 0 \\ $C$ & -5 & -3 & -3 & -1 & 0 & 0 & 0 & -1 \\ $D$ & -4 & -2 & -2 & -1 & 1 & 1 & 0 & -1 \\ $D$ & -3 & -1 & -1 & 0 & 2 & 1 & 0 & -1 \\ $C$ & -2 & 0 & 0 & 1 & 0 & -1 & -2 & -3 \\ $A$ & -1 & 1 & 0 & -1 & -2 & -3 & -4 & -5 \\ \phantom{} & 0 & -1 & -2 & -3 & -4 & -5 & -6 & -7 \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} As an aside, note that the score for a cell can be given from two or all of the three cases. An example is in the calculation of $\textsc{Score}(6,6)$, in which the calculation is \begin{equation*} \begin{split} \textsc{Score}(6, 6) &= \max \begin{cases} \textsc{Score}(5, 5) + \textsc{Sim}(G(6, 0), G(0, 6)) = 1 + \textsc{Sim}(A, C) & = 0 \\ \textsc{Score}(5, 6) + \gamma = 0 + -1 & = -1 \\ \textsc{Score}(6, 5) + \gamma = 1 + -1 & = 0 \\ \end{cases}\\ &= 0. \end{split} \end{equation*} This implies that two optimal alignments can be derived, either by mismatching $(G(6,0), G(0,6)) = (A, C)$ or by adding a gap to give the tuple $(G(6, 0), \Gamma) = (A, \Gamma)$. It also means that there will be two branches of the optimal path: one from $G(6,6)$ to $G(5,5)$, another from $G(6,6)$ to $G(6,5)$. \item \textbf{Tracing the optimal path}. Once final grid is produced, the optimal path(s) is(are) traced to give the global alignment(s). The path is traced by starting from the top right corner $G(8, 8)$ and moving according to the available arrows from the cells. The path ends at $G(1, 1)$. The path-tracing algorithm can be written as a function $\textsc{Trace}$ where a call to $\textsc{Trace}(1+|P|, 1+|S|, [\,])$ gives all the optimal solutions. $$ \textsc{Trace}(x, y, a) = \begin{cases} \textsc{Trace}(x-1, y-1, [(G(x, 0), G(0, y))] + a), & \text{if diagonal arrow present} \\ \textsc{Trace}(x-1, y, [(G(x, 0), \Gamma)] + a), & \text{if left arrow present} \\ \textsc{Trace}(x, y-1, [(\Gamma, G(0, y))] + a), & \text{if down arrow present} \\ \end{cases} $$ where $\textsc{Trace}(1, 1, a) = a$ and the $+$ operator for two lists is defined as concatenation. This approach does not enumerate over all possible optimal paths but instead returns the first optimal alignment. An example alignment result is given by the path traced by \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & -7 & -5 & -3 & -1 & -2 & -2 & 0 & \textbf{0} \\ $B$ & -6 & -4 & -2 & -2 & -1 & -1 & \textbf{1} & 0 \\ $C$ & -5 & -3 & -3 & -1 & 0 & \textbf{0} & 0 & -1 \\ $D$ & -4 & -2 & -2 & -1 & 1 & \textbf{1} & 0 & -1 \\ $D$ & -3 & -1 & -1 & 0 & \textbf{2} & 1 & 0 & -1 \\ $C$ & -2 & 0 & 0 & \textbf{1} & 0 & -1 & -2 & -3 \\ $A$ & -1 & \textbf{1} & \textbf{0} & -1 & -2 & -3 & -4 & -5 \\ \phantom{} & \textbf{0} & -1 & -2 & -3 & -4 & -5 & -6 & -7 \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} giving $P'_1 = ABCDA \Gamma BE$, $S'_1 = A \Gamma CDDCBC$ and $$L_1 = [(A,A), (B, \Gamma), (C, C), (D, D), (A, D), (\Gamma, C), (B, B), (E, C)].$$ Other optimal alignments are possible by tracing alternative paths. Another optimal alignment is given by \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & -7 & -5 & -3 & -1 & -2 & -2 & 0 & \textbf{0} \\ $B$ & -6 & -4 & -2 & -2 & -1 & -1 & \textbf{1} & 0 \\ $C$ & -5 & -3 & -3 & -1 & 0 & \textbf{0} & 0 & -1 \\ $D$ & -4 & -2 & -2 & -1 & \textbf{1} & 1 & 0 & -1 \\ $D$ & -3 & -1 & -1 & \textbf{0} & 2 & 1 & 0 & -1 \\ $C$ & -2 & 0 & 0 & \textbf{1} & 0 & -1 & -2 & -3 \\ $A$ & -1 & \textbf{1} & \textbf{0} & -1 & -2 & -3 & -4 & -5 \\ \phantom{} & \textbf{0} & -1 & -2 & -3 & -4 & -5 & -6 & -7 \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} giving $P'_2 = ABC \Gamma DABE$, $S'_2 = A \Gamma CDDCBC$ and $$L_2 = [(A,A), (B, \Gamma), (C, C), (\Gamma, D), (D, D), (A, C), (B, B), (E, C)].$$ \end{enumerate} \subsection{Complexity Improvements} \label{impl_asm_complexity} Taking that the \textsc{Score} function takes $\mathcal{O}(1)$ time to compute, the algorithm requires $\mathcal{O}(nm)$ time and space. It is worth noting that for the majority of global alignments, the optimal path lies within a certain region in the diagonal. If optimality can be given up for the sake of time and space complexity, a common optimisation is to introduce a \textit{bounded} grid, i.e., scores are only computed for a maximum distance $d$ from the main diagonal. For $d = 2$ applied on the above example, the calculations are limited to the scores shown on the following grid: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & -2 & 0 & \textbf{0} \\ $B$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & -1 & -1 & \textbf{1} & 0 \\ $C$ & \phantom{} & \phantom{} & \phantom{} & -1 & 0 & \textbf{0} & 0 & -1 \\ $D$ & \phantom{} & \phantom{} & -2 & -1 & \textbf{1} & 1 & 0 & \phantom{} \\ $D$ & \phantom{} & -1 & -1 & \textbf{0} & 2 & 1 & \phantom{} & \phantom{} \\ $C$ & -2 & 0 & 0 & \textbf{1} & 0 & \phantom{} & \phantom{} & \phantom{} \\ $A$ & -1 & \textbf{1} & \textbf{0} & -1 & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \textbf{0} & -1 & -2 & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} It is clear that less space and time are required in this setting. The shape of the bounds can be a parallelogram as well, which may give better results for certain cases. The grid, with a parallelogram bound applied, would look roughly like: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $C$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \textbf{0} \\ $B$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} & -1 & -1 & \textbf{1} & \phantom{} \\ $C$ & \phantom{} & \phantom{} & -3 & -1 & 0 & \textbf{0} & 0 & \phantom{} \\ $D$ & \phantom{} & \phantom{} & -2 & -1 & \textbf{1} & 1 & 0 & \phantom{} \\ $D$ & \phantom{} & -1 & -1 & \textbf{0} & 2 & 1 & \phantom{} & \phantom{} \\ $C$ & \phantom{} & 0 & 0 & \textbf{1} & 0 & -1 & \phantom{} & \phantom{} \\ $A$ & \phantom{} & \textbf{1} & \textbf{0} & -1 & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \textbf{0} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ \phantom{} & \phantom{} & $A$ & $B$ & $C$ & $D$ & $A$ & $B$ & $E$ \\}; \end{tikzpicture} However, bounding may give suboptimal results--there will always be a bound strict enough to give suboptimal matches save for the trivial case where $P = S$. As optimality is important, ways to improving the footprint of the algorithm without compromising global optimality are focussed on. A space optimisation can be achieved using Hirschberg's algorithm \cite{hirschberg75} which uses divide and conquer to reduce the space complexity to $\mathcal{O}(\min(m,n))$. With regard to improvements in running time, the Method of Four Russians achieves an $\mathcal{O}(mn / \log{n})$ time complexity for the algorithm \cite{sung2010algorithms}. This therefore means that the alignment algorithm can be optimised to run in \textbf{linear memory} and \textbf{subquadratic time}. Also notice that while the \textit{bottom-up} approach was presented, the algorithm can also be computed via a \textit{top-down} approach in which the algorithm starts by calculating $\textsc{Score}(8, 8)$. Notice however that the top-down approach may include repeat score calculations; this can be averted using \textit{memoisation}, i.e. storing the results of calls to the $\textsc{Score}$ function and returning the cached result when the function is called with the same inputs again. \subsection{Similarity Matrix} The similarity function defined in \Cref{sim_func_defn} can be further developed to produce more favourable alignments with regard to score alignment. In principle, mistakes that are more likely to happen should be penalised less. Instead of penalising a mismatch naïvely by assigning a score of $-1$, note that mistakes constituting accidentally playing a neighbouring note may be more probable than one playing a distant note; that is, a mismatch of $(A, B)$ is more likely than a mismatch of $(A, E)$ in actual music performances. This is especially probable for keyboard instruments as opposed to multi-string instruments like the lute and violin, where mistakes involving the accidental playing of neighbouring strings that are not close in pitch are more common. The likeliness of pitch mismatch mistakes also varies dynamically: at higher notes on a string for stringed instruments, neighbouring pitch mistakes are more likely--the notes are \textit{spatially} closer together. Thus, different instruments may use different penalising systems for mismatches; however, it still remains that neighbouring note mistakes are significantly likely and this system would generalise well to most instruments. Therefore, a \textbf{similarity matrix} that penalises mismatches between distant notes more is introduced. This matrix for the set of musical notes $N \in \{A, B, C, D, E\}$ is given by \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { \phantom{} & $A$ & $B$ & $C$ & $D$ & $E$ \\ $A$ & \textbf{1} & -1 & -2 & -3 & -4 \\ $B$ & -1 & \textbf{1} & -1 & -2 & -3 \\ $C$ & -2 & -1 & \textbf{1} & -1 & -2 \\ $D$ & -3 & -2 & -1 & \textbf{1} & -1 \\ $E$ & -4 & -3 & -2 & -1 & \textbf{1} \\}; \end{tikzpicture} The parameter $\alpha$ in this case is equal to $1$ and the parameter $\beta$ is a function given by $$ \beta_s(c_1, c_2) = -|c_1 - c_2| ~\text{where}~ c_1 \neq c_2 ~\text{and}~ c_1, c_2 \in N $$ taking the definition of subtraction of two elements in $N$ as simply their distance of their indices in $N$. Given that there are 128 MIDI pitches, this system may overpenalise mistakes that are too far away; hence, a lower bound, $\hat{\beta}$, for the most negative error can be set, where mismatches for pairs of pitches that have scores lower than the bound would instead have an error equal to the prescribed lower bound. $\beta_s$ is therefore updated to be $$ \beta_s'(c_1, c_2) = \max(-|c_1 - c_2|, \hat{\beta}) ~\text{where}~ c_1 \neq c_2 ~\text{and}~ c_1, c_2 \in N. $$ To penalise values increasingly up to an octave interval, $\hat{\beta} = -12$ is chosen--there are 12 semitones (and hence MIDI pitches) in an octave. \subsection{A sensible gap (indel) penalty} Gaps may be required to optimally align score and performance sequences due to extra notes being played or notes being missed. This is not uncommon in performance and may also be caused by inferior MIDI devices unable to capture all the performance data. This is a parameter subject to tuning according to the dataset, but a sensible value is $\gamma = -1$, similar to a small mistake made by accidentally playing a neighbouring note. \subsection{Dealing with Chords and Polyphony} \label{impl_asm_polyphony} Parallel voices, such as chords on the piano, cause two problems for the current setup. Firstly, there is no \textit{correct} way to order parallel voices in the chord defined in the score to be aligned. Secondly, chords in the performance may not be played and/or recorded at the same time instance--a chord $\{A,B,C\}$ comprising the three notes $A$, $B$ and $C$ may be played in any of the $3! = 6$ orders. This is further complicated if pieces with multiple instruments are aligned. Three different approaches are explored for this system--the third approach is chosen. \begin{enumerate} \item \textbf{Double Alignment}. This solution is inspired by Dannenberg and Mukaino's work \cite{dannenberg88}. Chords identified in the score are grouped into a set--a chord with the parallel notes $A$, $B$, $C$ would hence be denoted as $\{A,B,C\}$. The problem now comes at the alignment stage: the algorithm needs to be extended to work with these sets. This can be done by allowing notes for the chord in $P$ to come in any of the $3! = 6$ orders. A naïve approach would be to generate multiple $S$ each denoting a permutation of the chords in the score and pick the $S$ giving the best alignment, but this quickly becomes intractable. A better technique is to modify the algorithm to allow accepting of multiple notes in $P$ for the alignment. This again requires a redefinition of the similarity and $\beta$ function. As a reminder, the similarity function is currently $$ \textsc{Sim}'(c_1, c_2) = \begin{cases} \alpha, & \text{if }c_1 = c_2, \\ \beta_s'(c_1, c_2), & \text{otherwise} \\ \end{cases} $$ where $$ \beta_s'(c_1, c_2) = \max(-|c_1 - c_2|, \hat{\beta}) ~\text{where}~ c_1 \neq c_2 ~\text{and}~ c_1, c_2 \in N. $$ First, the score sequence $S = s_1 s_2 \ldots s_n$ is converted into a list of sets $\Psi = \psi_1 \psi_2 \ldots \psi_\nu$. Each set $\psi$ contains parallel notes at one time instance (non-parallel notes are therefore singletons). The alignment problem is redefined to find an alignment between $P$ and $\Psi$, giving $P'$ and $\Psi'$ as the optimal alignments and a list of tuples representing the alignment result. The similarity function required is $$ \textsc{Sim}''(c, \psi) = \begin{cases} \alpha, & \text{if } c \in \psi \\ \beta_s''(c, \psi), & \text{otherwise} \\ \end{cases} $$ where $c \in P$ and $c \in N$. $\beta_s''(c, \psi)$ is defined as $$ \beta_s''(c, \psi) = \max(-\textsc{MinAbsDist}(c, \psi), \hat{\beta}) ~ ~\text{where}~ c \notin \psi $$ where $\hat{\beta} = -12$ as noted. The $\textsc{MinAbsDist}(c, \psi)$ function returns the minimum absolute distance (calculated by the absolute difference in pitch number) of $c$ with any element in $\psi$. The $\textsc{Score}$ function also needs to be changed for the second case: this is because playing the next note $G(x, 0)$ in a possible chord $G(0, y)$ should not be considered an indel. In addition, a match or mismatch should still be more favourable and hence the value for $\textsc{Sim}$ is capped at 0. The redefined function is therefore $$ \textsc{Score}''(x, y) = \max \begin{cases} \textsc{Score}''(x-1, y-1) + \textsc{Sim}''(G(x, 0), G(0, y)) \\ \textsc{Score}''(x-1, y) + \textsc{ChordScore}(x, y)\\ \textsc{Score}''(x, y-1) + \gamma \\ \end{cases} $$ where $$ \textsc{ChordScore}(x, y) = \begin{cases} \text{clamp}(\gamma,\textsc{Sim}''(G(x, 0), G(0, y)),\alpha) & ~\text{if} ~x \neq 1, y \neq 1 ~\text{and}~ |G(0, y)| > 1,\\ \gamma & ~\text{otherwise}. \\ \end{cases}\\ $$ ($\text{clamp}(a, x, b)$ is the mathematical clamp function that bounds $x$ between $a$ and $b$: $\text{clamp}(a, x, b) = max(a, min(x, b))$.) As an example, consider $\Psi = \{A\}\{A,B,C\}\{A,C\}\{D\}$ and $P = ACBACAD$. For convenience, say $\psi_1 = \{A\}$, $\psi_2 = \{A,B,C\}$ and so on. The completed grid which gives an optimal solution is \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $\psi_4$ & -4 & -2 & 0 & 1 & 3 & 4 & 5 & \textbf{7} \\ $\psi_3$ & -3 & -1 & 1 & 2 & 4 & \textbf{5} & \textbf{6} & 5 \\ $\psi_2$ & -2 & 0 & \textbf{2} & \textbf{3} & \textbf{4} & 5 & 6 & 5 \\ $\psi_1$ & -1 & \textbf{1} & 0 & -1 & -2 & -3 & -4 & -5 \\ \phantom{} & \textbf{0} & -1 & -2 & -3 & -4 & -5 & -6 & -7 \\ \phantom{} & \phantom{} & $A$ & $C$ & $B$ & $A$ & $B$ & $C$ & $D$ \\}; \end{tikzpicture} where the alignment is $$ L = [(A, \{A\}), (C, \{A, B, C\}), (B, \{\Gamma\}), (A, \{\Gamma\}), (C, \{A, C\}), (A, \{\Gamma\}), (D, \{D\})]. $$ An extra alignment step is added in the end to give every $p \in P$ a time, or in this case a pairing to $\psi \in \Psi$. The gaps are hence removed--a tuple $(p, {\Gamma})$ will have $p$ matched to the closest $\psi$ that precedes it. For the case of $(\Gamma, \psi)$ where $\psi \neq \Gamma$, otherwise known as a set of notes in the score with no mapping to a performance note, the set of notes is dropped. The final alignment is given by a list of tuples $L' = [(\rho_1, \psi_1), \ldots, (\rho_k, \psi_k)]$, $$ L' = [(\{A\}, \{A\}), (\{C, B, A\}, \{A, B, C\}), (\{C, A\}, \{A, C\}), (\{D\}, \{D\})]. $$ As seen, even though the chords are played in the wrong order in $P$, they are still aligned in the end. A problem in the current setup quickly arises, however, for repeat chords. Say $P = ABAB$ and $\Psi = \{A, B\}\{A, B\}$. The three alignments \begin{equation*} \begin{split} [(\{A, B\}, \{A, B\}), (\{A, B\}, \{A, B\})],& \\ [(\{A, B\}, \{A, B\}), (\{A, B\}, \{B\})],& ~\text{and}~ \\ [(\{A, B\}, \{A\}), (\{A, B\}, \{A, B\})]& \\ \end{split} \end{equation*} are all ``optimal''. It is clear that the more ideal solution is the first alignment--two notes are played for each chord comprising two notes. This problem arises because a chord set $\psi$ is not penalised to accept more notes than it contains. This can be done in the calculation of $\textsc{Score}$, but it further complicates the already complex function. Note that using timing information may give rise to a better solution, but that unnecessarily complicates the problem--it is already assumed in \autoref{impl_asm_robust} that the performances used to create reference datasets are likely of high quality and adding temporal information to the algorithm may complicate the problem more than help it. Notice that the sequence is now aligned \emph{twice} after the algorithm is modified to work with polyphonic music--$L$ is the result of the first alignment and $L'$ the second. Therefore, the definition of optimality needs to be extended to include the minimisation of a \emph{cost} function in the final alignment. This cost function, $\textsc{Cost}$, is defined as $$ \textsc{Cost}(L') = \sum_{\forall (\rho, \psi) \in L'} J(\rho, \psi) $$ where $J(\rho, \psi)$ is the \textbf{Jaccard index}, a statistic used to gauge the similarity of sets, $$ J(\rho, \psi) =\begin{cases} 1 & ~\text{if}~ \rho = \psi = \varnothing, \\ \frac{\rho \cap \psi}{\rho \cup \psi} & ~\text{otherwise.} \\ \end{cases} $$ However, note that this now comes back to the original unoptimised problem--there may be up to $$ \binom{n+\nu}{\nu}\frac{(\nu+n)!}{(\nu!)^2} $$ ``optimal'' paths to consider! Methods like these are better in score following (as in the source of inspiration of this solution \cite{dannenberg88}) where the path needs not to be optimal--it just needs to be ``good enough''--heuristics can therefore be used to speed up calculations. For instance, Desain and Heijink's approach \cite{desain97,heijink00} uses a window to limit the alignment size, making the calculations significantly more tractable. \item \textbf{Sorting Parallel Performance and Score Notes}. This solution, simpler than the first method, makes use of performance temporal information to preprocess performance data. Another parameter, $\epsilon$, is defined the maximum interval for chord execution. \begin{definition}[Maximum interval for chord execution] The \textbf{maximum interval for chord execution}, $\epsilon$, is the maximum allowed time for a chord to be fully executed, i.e. for all its notes onsets to be recorded. \label{def:maxintchordexe} \end{definition} The determination of $\epsilon$ is rather trivial for piano music. A data-driven solution is to base it on the time interval between the two closest notes in the score. However, a sensible estimate of $\epsilon = 50 \si{\milli\second}$ for piano music should work well--this is a touch lower than the time interval between two demisemiquaver notes at $120\text{BPM}$. Before alignment is performed, a preprocessing step will first run through $P$ and sort (in ascending order) note onsets that can be grouped within the time interval $\epsilon$. The grouping will be \textit{greedy} with regard to the number of notes in a chord--if there exists multiple overlapping solutions to neighbouring notes, the group with the most notes will be selected. For instance, taking $$ A_{500} \quad D_{549}\quad C_{551}\quad B_{552}, $$ where the substrings of the note denote the note onset time in $\si{\milli\second}$, the resulting sequence should be $$ A_{500}\quad B_{552} C_{551} D_{549} $$ instead of $$ A_{500} D_{549} \quad C_{551} B_{552}. $$ Additionally, parallel voices in the score data will also be sorted in ascending order. More musically informed readers may point to technically demanding works of Rachmaninoff where pianists with limited finger span may need to \textit{break} large chords. However, notice that the notes in the chord are sorted in ascending order--the chords in $P$ and $S$ will remain in the correct order as pianists usually break the chord and play the notes in ascending order. Where this may cause a problem is in strummed string instruments like the guitar--a chord may be played from top to bottom slowly, causing the chord to take more than $\epsilon$ to completely execute--\textit{in the ``wrong'' direction}. More examples can be drawn from \autoref{scofo_challenges_polyphonic}--chords in the \textit{Chaconne}, see \autoref{fig:chaconnefirst10}, may be executed in either direction at varying speeds. Moreover, the requirement to determine the parameter $\epsilon$ also makes the algorithm harder to generalise to more instruments and musical styles. Further, this procedure mangles performance data and may cause more mistakes in the alignment than try to fix them. \item \textbf{Sorting Parallel Score Notes and Running a Post-alignment Step}. This solution uses part of the second approach; first, parallel voices in the score are sorted (which is likely the way a chord is executed), then, gaps and mismatches are corrected after automatic alignment. These gaps and mismatches will be indicated to the user as per \autoref{impl_asm_indicate}. There is already an assumption made in \autoref{impl_asm_robust} that the performances used to create reference datasets likely have few mistakes and this should still give the best possible alignment prior to more corrections--it does not overcomplicate the problem as in the first solution, and it does not perturb performance data as in the second method. The preprocessing of the score data--i.e. sorting parallel voices, still gives correct score information. Besides sorting parallel voices in the score, an optional post-alignment step is proposed. Note that each misalignment may have a corresponding misalignment that both cancel each other out. An example for misaligned gaps is given by the (mis)alignment $$[(A,\Gamma), (B, B), (\Gamma, A)].$$ If all the elements in the above are part of a set of parallel voices, the two gaps with $A$ should be aligned together to give $$[(A, A), (B, B)].$$ A more complex case involving also a mismatch is the (mis)alignment $$[(A,\Gamma), (B, B), (\Gamma, C), (C, A)].$$ Similarly, if all the elements are part of a set of parallel voices, the mismatches and gaps can be fixed to give the alignment $$[(A,A), (B,B), (C,C)].$$ Thus, a post-alignment step can iterate through the alignment to find trivially fixable misalignments that correspond to false negatives involving parallel notes. As such misalignments may also occur with fast passages in which the sequence of notes may be misplayed, an adjustable threshold is used to determine how far apart between two misalignments to consider them to be ``close enough'' to be fixed by this post-alignment step. The threshold parameter is defined as follows: \begin{definition}[Post-alignment Parallel Voice Threshold] The \textbf{Post-alignment Parallel Voice Threshold}, $\delta$, is the maximal absolute difference in score time between two notes to treat the two notes as ``close enough'' to be considered eligible for post-alignment parallel voice fixes. \label{def:postalignparvoicethres} \end{definition} The choice of $\delta$ should vary from piece to piece depending on how ``polyphonic'' the performance is--monophonic performances may not need post-alignment at all, and pieces with low polyphony can sensibly have $\delta$ set anywhere from $0$ to the time taken for a beat in the score. This post-alignment step introduces a temporal aspect in the alignment--the original ASM algorithm does not use any temporal information in source data. \end{enumerate} It is thus clear that the third approach--i.e. sorting parallel notes in the score and then running a post-alignment step is superior when compared to the two other methods. The \textbf{third method} is therefore chosen. \subsection{Dealing with Ornaments} \label{impl_asm_ornaments} The \textit{trill}, a common music ornament, consists of a rapid alternation between two adjacent notes, usually a semitone or tone apart. In some MIDI files, ornaments are not reflected and therefore a \textit{trill} is reduced to its base note onset in the data. Following this, Dannenberg and Mukaino \cite{dannenberg88} dealt with \textit{trills} and \textit{glissandi} by introducing a special mode in their score follower that allows the mapping of many performance notes (the actual many notes making up the \textit{trill} or the \textit{glissando}) to one score note (the base note of the \textit{trill} or \textit{glissando}). However, recent MIDI-producing musical programs \cite{lilypond} are able to produce MIDI data that reflects the ornament. Nevertheless, notice that performers may interpret ornaments in different ways--see sections~\ref{scofo_challenges_perfdev} and \ref{scofo_challenges_underspec}. This means that manual alignment will occasionally be required after automatic alignment. However, the advantage this has over Dannenberg and Mukaino's approach is that the score has more onsets--albeit artificial--to work with, giving better temporal resolution: in Dannenberg and Mukaino's solution, if an event is required to be triggered in the time between a \textit{trill} event and the subsequent note onset, the system would have to estimate when to trigger that event. Ornaments are not dealt in a special way in this system, giving the users the choice to either use MIDI data that reflects ornaments or otherwise. Thus, further manual adjustment may be required for MIDI files not reflecting ornaments, but as ornaments generally do not span the majority of pieces, these adjustments are projected to be minimal. \section{Score Follower Framework} As this system does not run in real time, it is a score aligner (some authors use the term \textit{offline score follower}). However, the generic framework of score followers described in \autoref{scofo_generic} can be used to model this system. The \textbf{features extracted} from the performance and the score are \textit{pitch}, \textit{note order} and \textit{note onset time} information in the form of a sequence of MIDI notes. The \textbf{similarity calculation} is via the minimisation of an offline ASM cost function defined in \autoref{impl_asm_techback}, which provides a globally optimal \textbf{alignment}. Clearly, this system works on strings and hence is of the \textbf{symbolic-to-symbolic} type. \section{Implementation} \subsection{Algorithm Information} The final algorithm used is as presented in \autoref{impl_asm_techback_asm}. In summary, the used definitions are as follows: $$ \textsc{Score}^{*}(x, y) = \max \begin{cases} \textsc{Score}^{*}(x-1, y-1) + \textsc{Sim}^{*}(G(x, 0), G(0, y)) \\ \textsc{Score}^{*}(x-1, y) + \gamma^{*} \\ \textsc{Score}^{*}(x, y-1) + \gamma^{*} \\ \end{cases} $$ where $\textsc{Score}^{*}(0, y) = \textsc{Score}^{*}(x, 0) = -\infty$ and $\textsc{Score}^{*}(1, 1) = 0$, $$ \textsc{Sim}^{*}(c_1, c_2) = \begin{cases} \alpha^{*}, & \text{if }c_1 = c_2, \\ \beta^{*}(c_1, c_2), & \text{otherwise} \\ \end{cases} $$ where $$ \beta^{*}(c_1, c_2) = \max(-|c_1 - c_2|, \hat{\beta}^{*}) ~\text{where}~ c_1 \neq c_2 ~\text{and}~ c_1, c_2 \in N^{*}. $$ ($N^{*}$ is the set of all 128 MIDI note representations.) The final solution is the first complete optimal path traced by the $\textsc{Trace}^{*}(1+|P|, 1+|S|, [\,])$ function: $$ \textsc{Trace}^{*}(x, y, a) = \begin{cases} \textsc{Trace}^{*}(x-1, y-1, [(G(x, 0), G(0, y))] + a), & \text{if diagonal arrow present} \\ \textsc{Trace}^{*}(x-1, y, [(G(x, 0), \Gamma^{*})] + a), & \text{if left arrow present} \\ \textsc{Trace}^{*}(x, y-1, [(\Gamma^{*}, G(0, y))] + a), & \text{if down arrow present} \\ \end{cases} $$ where $\textsc{Trace}^{*}(1, 1, a) = a$ and the $+$ operator for two lists is defined as concatenation. The parameters $\alpha^{*}$, $\hat{\beta}^{*}$ and $\gamma^{*}$ are $1$, $-12$ and $-1$ respectively as discussed. To deal with chords and polyphony, the third method detailed in \autoref{impl_asm_polyphony} is used; the score sequence $S$ is preprocessed: parallel notes are sorted in ascending order. The post-alignment step that fixes close and trivial misalignments is used as required with its corresponding threshold, $\delta$, adjusted as necessary. \subsection{Output Data} Data is output in two streams: \texttt{stdout} and \texttt{stderr}. \begin{enumerate} \item \texttt{stdout}: In this stream, alignment data that fulfil the reference data format as per \autoref{tb_quant_dataset_api} are output. In the event of a mismatch an indication is provided in the format \begin{verbatim} // MISMATCH: <PERFORMANCE_NOTE> - <SCORE_NOTE> \end{verbatim} where note information comprises the note onset time of the note and the MIDI number of the note. A gap, on the other hand, is reported in the following format \begin{verbatim} // GAP: <GAP|PERFORMANCE_NOTE> - <GAP|SCORE_NOTE> \end{verbatim} \item \texttt{stderr}: Auxiliary information such as the number of mismatches and gaps are output. The first line prints if the post-alignment step is enabled--the other lines are always printed. The metrics introduced each line from the second line onwards correspond to $|L|$, $N_{\Gamma P}= |[(a, b) ~ \forall ~ (a, b)\in L ~\text{where}~ a = \Gamma]|$, $N_{\Gamma S} = |[(a, b) ~ \forall ~ (a, b) \in L ~\text{where}~ b = \Gamma]|$ and $N_{\textsc{Mismatch}} = |[(a, b) ~ \forall ~ (a, b) \in L ~\text{where}~ a \neq b]|$ respectively. The output format is given by \begin{verbatim} Running PostAlign with threshold <POST_ALIGNMENT_THRESHOLD> Length of alignment: <...> Total number of gaps in performance: <...> Total number of gaps in score: <...> Total number of mismatches: <...> \end{verbatim} \end{enumerate} \subsection{Implementation Details} \label{impl_asm_impl_details} This algorithm is introduced in Python, as it is meant to be used in the quantitative testbench (\autoref{tb_quant}). The rationale for using Python is straightforward as the code is to be added into the testbench\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}} which is written in Python. It is easier to maintain a codebase in one language. The other benefits and best practices of Python mentioned in \autoref{tb_quant_bettereng} apply here as well. \section{Evaluation} \label{impl_asm_eval} As the ASM aligner is a tool that needs to be reliable enough to produce ground-truth alignments, it is first evaluated against a widely available dataset that contains manually aligned data in \autoref{impl_asm_eval_bach10}. The ASM aligner is then used for its purpose in \autoref{impl_asm_eval_bwv846}--it is used to produce reference alignments for a selected suite in the MAESTRO dataset \cite{MAESTRO}. The results for both evaluations in subsections~\ref{impl_asm_eval_bach10} and \ref{impl_asm_eval_bwv846} can be reproduced in the qualitative testbench repository's \nameref{tb_quant_repro_suite}. \subsection{Performance on Bach10} \label{impl_asm_eval_bach10} The Bach10 dataset \cite{duan11bach10} contains ground-truth alignments in the required format stipulated in \autoref{tb_quant_dataset_api} and the output of this aligner. Moreover, it contains the MIDI of the reference score. This means that the Bach10 dataset is an ideal candidate to evaluate the aligner and also the quantitative testbench proposed in \autoref{tb_quant}: the output of the aligner can be directly compared against the reference ground-truth alignments via the quantitative testbench. The misalignment threshold $\theta_e$ (refer to \Cref{def:misalign}) is set to $\si{300\milli\second}$, the standard as per MIREX evaluations \cite{cont07}. The score note search bound $\delta_s$ (described in \Cref{def:bound_ms}) is set to the default $\si{1\milli\second}$. Evaluation is run by first converting the MIDI of the score and the performance part (extracted from the ground-truth alignments) into a pair of strings which are then fed into the ASM aligner algorithm. While the Bach10 dataset is highly polyphonic--it comprises 10 short chorales, each with four voices each played in four instruments--the parallel voices in the performance audio are well quantized and -aligned (as the performance audio is strictly beat-aligned resulting in parallel voices having the exact same timestamp \cite{duan11bach10}). As a result, the post-alignment step designed in \autoref{impl_asm_polyphony} to deal with misaligned parallel voices is not required. The output of the aligner is then converted into the score follower output defined in \autoref{tb_quant_scofo_api}--as this is a non-real-time alignment, $t_d$, the time the note is detected, is simply set to $t_e$, the estimated note onset time in the performance audio file. This means all metrics dealing with latency $l_i$ and offset $o_i$ are not valid--the metrics thus ignored are mean latency $\mu_l$, standard deviation of latency $\sigma_l$, mean absolute offset $\text{MAO}$ and standard deviation of offset $\sigma_o$. Additionally, piece completion $p_e$ is also irrelevant as this is a global alignment that matches both ends of both strings of data. Added to the evaluation metrics are the metrics from the ASM aligner: the length of alignment $|L|$, the number of gaps in performance $N_{\Gamma P}$, the number of gaps in score $N_{\Gamma S}$ and the number of mismatches $N_{\textsc{Mismatch}}$. All the metrics considered are given in \autoref{table:asmbach10}. Readers may wish to consult \autoref{tb_quant_metrics} for more information about metrics related to the quantitative benchmark. \begin{table}[ht] \caption{Metrics used to evaluate the ASM Score Aligner against the Bach10 dataset.} \centering \begin{tabular}{c c} \hline\hline Metric & Symbol \\ [0.5ex] \hline Miss Rate & $r_m$ \\ Misalign Rate & $r_e$ \\ Mean Absolute Error & $\text{MAE}$ \\ Standard Deviation of Error & $\sigma_e$ \\ Precision Rate & $r_p$ \\ Length of Alignment & $|L|$ \\ Number of Gaps in Performance & $N_{\Gamma P}$ \\ Number of Gaps in Score & $N_{\Gamma S}$ \\ Number of Mismatches & $N_{\textsc{Mismatch}}$ \\ \hline \end{tabular} \label{table:asmbach10} \end{table} The results are shown in \autoref{table:asmbach10scores}. The repository of the testbench\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}} contains instructions on how to reproduce these results. As the runs were almost instantaneous, their runtimes were not recorded. \begin{table}[ht] \caption{Results of the ASM Score Aligner against the Bach10 dataset. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$).} \centering \begin{tabular}{l c c c c c c c c c} \hline\hline Piece & $r_m\downarrow$ & $r_e\downarrow$ & $\text{MAE}\downarrow$ & $\sigma_e\downarrow$ & $r_p\uparrow$ & $|L|$ & $N_{\Gamma P}\downarrow$ & $N_{\Gamma S}\downarrow$ & $N_{\textsc{Mismatch}}\downarrow$ \\ [0.5ex] \hline \textit{AchGottundHerr} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 142 & 3 & 0 & 0 \\ \textit{AchLiebenChristen} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 283 & 1 & 0 & 0 \\ \textit{ChristederdubistTagundLicht} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 182 & 1 & 0 & 0 \\ \textit{ChristeDuBeistand} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 233 & 9 & 0 & 0 \\ \textit{DieNacht} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 197 & 7 & 0 & 0 \\ \textit{DieSonne} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 212 & 6 & 0 & 0 \\ \textit{HerrGott} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 189 & 0 & 0 & 0 \\ \textit{FuerDeinenThron} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 149 & 0 & 0 & 0 \\ \textit{Jesus} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 170 & 6 & 0 & 0 \\ \textit{NunBitten} & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 234 & 1 & 0 & 0 \\ \hline \end{tabular} \label{table:asmbach10scores} \end{table} As it can be seen in \autoref{table:asmbach10scores}, the ASM aligner performed exceptionally well on the Bach10 dataset. Upon closer inspection, it can be seen that most of the very minimal errors where $N_{\Gamma P} \neq 0$ are due to the fact that the performance data does not contain all the notes in the score--this means that the performances has \emph{missed notes} when compared to the full score data. These can be trivially fixed--authors of the Bach10 dataset resorted to removing these missed notes entirely from their ground-truth alignments, which explains results with $r_m = 0$ but $N_{\Gamma P} \neq 0$. From these results it can be shown that this ASM alignment method is indeed a reliable method to produce ground-truth alignments between symbolic score and performance data. A caveat, however, is that the symbolic performance data used in this evaluation were obtained from the ground-truth alignment as it was not captured directly from the musicians--the instruments recorded in the Bach10 dataset were not MIDI capable. Further, the annotation of the ground-truth alignment was done via manual beat alignment, so parallel notes on different voices are aligned on the same annotated note onset time. It can, nevertheless, be expected that if MIDI-capable instruments were used, similar results can be obtained: the issue with parallel notes can be resolved with the post-alignment step with a reasonable setting for the post-alignment parallel voice threshold $\delta$. The next evaluation in \autoref{impl_asm_eval_bwv846} uses data that do not produce evaluation results with such caveats. \subsection{Performance on Bach's BWV 846} \label{impl_asm_eval_bwv846} Bach's BWV 846 is a recurring theme for this project--its value is that it is a pair of pieces that showcases two important contrasts: the \textit{Prelude} is primarily monophonic and lacks ornaments; the \textit{Fugue} is highly polyphonic and contains some ornaments. Thus, it is apt to use both pieces to evaluate the aligner. The performance MIDI of both pieces are obtained from the MAESTRO dataset \cite{MAESTRO}. The sheet music is obtained from \textit{MuseScore.com}\footnote{\url{https://musescore.com/}}, which contains high-quality sheet files for both performances. The \textit{MuseScore}\footnote{\url{https://musescore.org/}} score-editing program provides features to annotate how ornaments should be played. The reference sheet file for the \textit{Fugue} contains the standard interpretation of the written ornaments. For instance, \autoref{fig:846fugue13} shows how the interpretation of a \textit{mordent} is specified in the 13th bar of the \textit{Fugue}. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/bwv846/fugue13.png} \caption{Bar 13 of Bach's \textit{Fugue in C major, BWV 846} in \textit{MuseScore}. The semi-opaque notes are manual indications for the execution of the \textit{mordent} (the ornament shown above the fourth beat of the top staff).} \label{fig:846fugue13} \end{figure} These indications represent the standard--and most widely accepted--way of executing these ornaments and are left as-is--the player however is free to interpret the ornament however they wish; in fact, the performer in the MAESTRO dataset played this \textit{mordent} with a few more alternating notes, making it more akin to a short \textit{trill}. Misalignments are thus expected, and manual adjustments after the initial alignment can be done to fix these deviations. As the MAESTRO dataset does not contain ground-truth alignments like the Bach10 dataset used in \autoref{impl_asm_eval_bach10}, only metrics reported by the aligner are evaluated--these are summarised in \autoref{table:asmbwv846}. Manual inspection is further performed to check the alignment between the performance and the score. \begin{table}[ht] \caption{Metrics used to evaluate the ASM Score Aligner against BWV 846.} \centering \begin{tabular}{c c} \hline\hline Metric & Symbol \\ [0.5ex] \hline Length of Alignment & $|L|$ \\ Number of Gaps in Performance & $N_{\Gamma P}$ \\ Number of Gaps in Score & $N_{\Gamma S}$ \\ Number of Mismatches & $N_{\textsc{Mismatch}}$ \\ \hline \end{tabular} \label{table:asmbwv846} \end{table} Because the performance data are obtained from a MIDI-capable device, the problems related to polyphonic notes mentioned in \autoref{impl_asm_polyphony} arise. It is expected that the \textit{Prelude} requires minimal fixes, as opposed to the \textit{Fugue}. Therefore, the post-alignment step is run with $\delta$ adjusted as necessary. It is worth mentioning that the MAESTRO dataset comprises performances by performers with a range of skill with some performances containing substantial errors--it is after all collected from an international junior piano competition\footnote{\url{https://piano-e-competition.com/}}. The \textit{Fugue} is a much more challenging piece than the \textit{Prelude}, and more deviations were found in the performance. \subsubsection{Prelude} While this project treats the \textit{Prelude} as a highly monophonic piece, it is worth noting that the final bar contains a chord. This can be seen in \autoref{fig:prelude33}. Throughout the piece the two base notes of each broken \textit{arpeggio} are also held--but this property can be ignored since only note onsets are dealt with. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/bwv846/prelude33.png} \caption{Bars 33-35 of Bach's \textit{Prelude in C major, BWV 846}. The final bar contains a chord in this otherwise highly monophonic piece.} \label{fig:prelude33} \end{figure} It is thus expected that the post-alignment step is needed to handle that last chord. Alignment was first run with $\delta = \text{N/A}$, i.e. the post-alignment step is not run. It was then found that setting $\delta = 0$ is sufficient to handle the last chord. Results are summarised in \autoref{table:asmpreludescores}. The repository of the testbench\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}} contains instructions on how to reproduce these results. \begin{table}[ht] \caption{Results of the ASM Score Aligner against the Prelude, BWV 846. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$).} \centering \begin{tabular}{c c c c c c c c} \hline\hline $\delta$ & $|L|$ & $N_{\Gamma P}\downarrow$ & $N_{\Gamma S}\downarrow$ & $N_{\textsc{Mismatch}}\downarrow$ \\ [0.5ex] \hline N/A & 551 & 3 & 2 & 0 \\ 0 & 549 & 1 & 0 & 0 \\ \hline \end{tabular} \label{table:asmpreludescores} \end{table} As expected, the ASM aligner was able to align the piece well even without the post-alignment step. Note that when the post-alignment step is not run, gaps arise in the final bar--the chord is not executed in parallel perfectly. The last 7 lines of the alignment output are as following: \begin{verbatim} // GAP: GAP - 113333.288 36 // GAP: 134664.1666666667 72 - GAP 134670.83333333334 113333.288 48 // GAP: 134674.1666666667 36 - GAP 134675.83333333334 113333.288 64 // GAP: GAP - 113333.288 67 // GAP: GAP - 113333.288 72 \end{verbatim} When post-alignment was run with $\delta = 0$, most of the gaps are fixed, save for a gap in the performance--this is due to performer mistake: in the final chord, the performer omitted MIDI note number 64 which corresponds to the \textit{G} above middle-\textit{C}. This gap can therefore be removed for the ground-truth alignment, and thus this shows that the ASM approach handles the \textit{Prelude} exceptionally well. \subsubsection{Fugue} The highly polyphonic \textit{Fugue} is expected to introduce more gaps and mismatches without the post-alignment step. Further, the \textit{Fugue} is more technically demanding than the \textit{Prelude}--this is reflected in the higher number of mistakes by the performer in the piece. With regard to polyphony, $\delta$ is adjusted further higher. For reference, the time taken for a beat in the score is $1000\si{\milli\second}$. Key results with $\delta \in \{\text{N/A}, 0\si{\milli\second}, 500\si{\milli\second}, 1000\si{\milli\second}\}$ are shown in \autoref{table:asmfuguescores}. \begin{table}[ht] \caption{Results of the ASM Score Aligner against the Fugue, BWV 846. The arrows, where present, denote whether a metric should be minimised ($\downarrow$) or maximised ($\uparrow$).} \centering \begin{tabular}{c c c c c c c c} \hline\hline $\delta (\si{\milli\second})$ & $|L|$ & $N_{\Gamma P}\downarrow$ & $N_{\Gamma S}\downarrow$ & $N_{\textsc{Mismatch}}\downarrow$ \\ [0.5ex] \hline N/A & 950 & 196 & 197 & 29 \\ 0 & 932 & 178 & 179 & 26 \\ 500 & 787 & 33 & 34 & 0 \\ 1000 & 549 & 23 & 24 & 0 \\ \hline \end{tabular} \label{table:asmfuguescores} \end{table} The number of deviations, as projected, are higher in the \textit{Fugue} than that in the \textit{Prelude}. It is clear that a higher $\delta$ is required, however it must be noted that higher $\delta$ values introduce the possibility of \emph{false positives}--the post-alignment algorithm may be too aggressive in resolving gaps and mismatches to the extent that it mistakenly aligns some notes. Upon closer inspection of the results, $\delta = 1000\si{\milli\second}$ contains some false positives--some performance notes are matched to wrong notes in the score. The alignment results for $\delta = 500\si{\milli\second}$, which corresponds to half a beat in score time, had a close-to-zero false positive rate--the gaps were later identified as missed or extra notes in the score. The extra notes were mostly in areas with \textit{mordent} ornaments (an example is shown in \autoref{fig:846fugue13})--in which, as mentioned, the player plays the \textit{mordent} as a short \textit{trill} instead, meaning that there were extra notes in the performance. Gaps caused by missed notes were mainly mistakes, and were easily fixable. For the purpose of creating the ground-truth alignments, these minor mistakes can actually be omitted entirely should the benefit of the doubt be given to the follower for missed or extra notes. Overall, the performance of the ASM aligner on the \textit{Fugue} is exceptional, and the fact that the alignment only required trivial manual adjustments to be of ground-truth quality is testament to the robustness and reliableness of the ASM aligner. \section{Discussion} \subsection{Testbench Complement: Ground-Truth Aligner} As can be seen from the results in \autoref{impl_asm_eval}, this ASM aligner proved capable and reliable of quickly producing high-quality ground-truth alignment datasets from music performance datasets containing performance MIDI data, namely the MAESTRO dataset. This result means that researchers of score followers and score aligners may exploit the increasing ubiquity of such datasets to produce high-quality reference datasets for evaluation of score followers. Moreover, all the requirements listed in \autoref{impl_asm_req} are met. This aligner therefore serves as a good complement to the quantitative testbench introduced in \autoref{tb_quant}, and will resolve the challenge of sourcing high-quality ground-truth alignments for evaluation. The proposed approach also is less tedious than the approaches taken by authors of the Bach10 dataset \cite{duan11bach10}, Traditional Flute Dataset \cite{tfd}, PHENICX-Anechoic dataset \cite{miron16, PHENICX} and Vienna 4x22 Piano Corpus \cite{vienna4x22}, as covered in \autoref{tb_quant_dataset_api}. Further, while Thickstun \textit{et al.}{} \cite{thickstun20} proposed a beat-alignment algorithm that--like this approach--requires minimal manual work, this approach is more flexible: Thickstun \textit{et al.}{}'s approach was limited only for music that intersects both the MAESTRO \cite{MAESTRO} and KernScores \cite{sapp05} datasets; this proposed approach can work with any arbitrary pair of performance and score data. \subsection{Conversion to Score Following} Most early work in score following, as covered in \autoref{scofo_earlywork}, involve ASM-based methods. It is therefore interesting to study how this aligner can be converted to its real-time counterpart. First, note that this aligner produces \emph{offline optimal global} alignments given two complete performance and score strings. Score followers do not have access to the whole performance string, and hence have to settle for an \emph{online suboptimal local} alignment. Upholding optimality is difficult mainly due to the time complexity of alignment algorithms. The \emph{local} counterpart of the Needleman-Wunsch algorithm, the Smith-Waterman algorithm \cite{smithwaterman}, has a time complexity of $\mathcal{O}(mn)$ to align two sequences of lengths $m$ and $n$, which is not sufficiently fast enough for real-time purposes. Most of the early ASM-based followers use certain heuristics to reduce the time complexity to linear or quasilinear \cite{dannenberg84, vercoe84}, resulting in systems that can run \emph{online}. Further, ASM-based methods are plagued by limitations in performance feature extraction. ASM-based methods require the string representation of performances, and a lot of work was put into making string-based feature extraction from performances robust--see \autoref{scofo_relatedwork_early_workcontinued}. MIDI-capable devices prove trivial as the data can be directly captured, but work with performance audio proved difficult for ASM-based methods, especially with ones that work with pitch data. Moreover, much effort was put into dealing with ornaments and parallel voices. These issues are difficult even for non-real-time systems as shown in subsections~\ref{impl_asm_ornaments} and \ref{impl_asm_polyphony}. \Cref{scofo_challenges_polyphonic} details more of the challenges in dealing with polyphony. Even with myriad extensions for ASM-based followers to handle polyphony \cite{dannenberg88}, many researchers in the field do not consider the problem of polyphony properly handled until an audio-to-audio DTW-based approach was introduced roughly 20 years since the first score following papers \cite{Dixon2005MATCHAM}. The complications stated here therefore explain why ASM-based methods were quickly made obsolete by approaches involving statistical models (\autoref{scofo_stats_hmm}) and DTW (\autoref{scofo_dtw}) that can work directly on performance audio. Nevertheless, it is worth noting that even recent advancements in score following build upon the work and concepts from basic ASM-based score aligners; for instance, the common path constraints used in DTW algorithms are similar to those presented in \autoref{impl_asm_complexity}. Therefore, the detailing of this ASM-based aligner serves as a good technical introduction for core concepts used in more advanced score following approaches. \section{Resultant Product} \subsection{Open-source Repository} The score follower is released publicly under the GPLv3 Licence on GitHub\footnote{\url{https://github.com/flippy-fyp/flippy}}. \subsection{Usage Guide} The README\footnote{\url{https://github.com/flippy-fyp/flippy/blob/main/README.md}} of the repository shows a detailed usage guide of the score follower, including instructions on how to use it with the quantitative testbench (\autoref{tb_quant}) and qualitative testbench (\autoref{tb_qual}). A development guide is also provided. \subsection{Demos} \label{impl_dtw_prod_demos} Video demonstrations of the system in action when used in conjunction with the qualitative testbench against all the pieces discussed in the qualitative evaluation analysis (\autoref{impl_dtw_eval_qual}) are provided in the repository under the \texttt{demos} directory\footnote{\url{https://github.com/flippy-fyp/flippy/tree/main/demos}}. \subsection{Reproduction Suite} \label{impl_dtw_prod_repro} A reproduction suite is provided to reproduce results discussed in this chapter. This not only includes plots (Figures~\ref{fig:cqt_time}, \ref{fig:featuresbwv846}, \ref{fig:dtw_time}, \ref{fig:bach10_plot_precision} and \ref{fig:bwv846_plot_precision}) and metrics (Tables~\ref{table:bach10_metrics}, \ref{table:bwv846_metrics} and \ref{table:bwv846_eval_separate}), but also the qualitative analyses in \autoref{impl_dtw_eval_qual} producing the demos in \autoref{impl_dtw_prod_demos}. The README of the repository contains further detailed information on the reproduction suite. \section{Implementation} \label{impl_dtw_impl} \subsection{Technology Stack} \label{impl_dtw_impl_techstack} Python was used, with similar reasons as those covered in \autoref{tb_quant_impl_details} and \autoref{impl_asm_impl_details}. Similar good practices in software engineering detailed in \autoref{tb_quant_bettereng} are used. \subsection{Following Modes} Two modes will be made available with different settings to the user: \textbf{Online Mode} and \textbf{Offline Mode}. The former runs with the whole performance sequence available to the follower (thus running the system as an aligner) and the latter otherwise. \subsection{System Architecture} \label{impl_dtw_impl_arch} Here a specific focus is given to the \textbf{Online Mode}'s system architecture--the \textbf{Offline Mode}'s architecture is similar, save for the real-time streaming of performance audio to the system--the \textbf{Offline Mode} has full knowledge of the entire performance audio prior to beginning alignment. The architecture of this follower is informed by the reasoning given in \autoref{tb_qual_impl_details_choice}--the interface of each component is clearly defined, and it is thus intended that individual components can be swapped out when needed. Three architecture diagrams each showing a different part of the system are presented here, before the full architecture of the system is shown. \subsubsection{Preprocessor} The architecture for the preprocessing step as covered in \autoref{impl_oltw_param} is given in \autoref{fig:oltw_preprocessor}. \begin{figure}[h] \centering \includegraphics[width=0.75\columnwidth]{assets/sysarch/preproc.pdf} \caption{Architecture Diagram for the Preprocessor.} \label{fig:oltw_preprocessor} \end{figure} Preprocessing is straightforward--here it is assumed that the score is MIDI data. Via the Synthesiser, the \texttt{pretty\_midi}\footnote{\url{https://github.com/craffel/pretty-midi}} and FluidSynth\footnote{\url{https://www.fluidsynth.org/}} libraries are used to synthesise score data into WAVE files. The \nameref{impl_dtw_sys_arch_audio_preproc} will be covered in its own architecture diagram in \autoref{fig:oltw_audiopreproc}--in short it produces $\mathcal{S}$ to be fed into the OLTW Follower. \subsubsection{Follower} \autoref{fig:oltw_step} shows the architecture diagram for the OLTW follower; this diagram describes the system when running the follower algorithm detailed in \autoref{impl_oltw_param}. \begin{figure}[h] \centering \includegraphics[width=0.85\columnwidth]{assets/sysarch/actual.pdf} \caption{Architecture Diagram for the Following step.} \label{fig:oltw_step} \end{figure} Performance Audio is streamed into the Audio Preprocessor, which converts the audio into pieces of $\mathcal{P}$ to be consumed by the OLTW Follower. The OLTW Follower then computes the best alignment and outputs it via a Backend module. The Backend module can be configured to output in either the \emph{timestamp} format (suitable for the qualitative testbench proposed in \autoref{tb_qual}) or the \emph{alignment} format (suitable for the quantitative testbench introduced in \autoref{tb_quant}). The streaming of the performance audio can be configured with the following parameters: \begin{itemize} \item \textbf{Simulate Performance}. When in online mode, this setting emulates the live-streaming of the performance audio file into the system. This can be turned off for testing purposes to save time at the expense of obtaining inaccurate real-time-sensitive metrics (such as those related to latency and offset). This is turned off by default. \item \textbf{Sleep Compensation}. The emulation of live-streaming the performance audio into the system is done by sleeping an appropriate amount of time between feeding two performance audio slices into the system. As most devices do not have real-time operating systems that allow exact sleep durations, the sleeping time is usually more than the ideal time. Sleep compensation allows the user to specify a small iota of time to reduce the sleep time between two slices to ensure that the sleep time more accurately emulates the streaming of the performance audio. This is set to $\si{0.0005\si{\second}}$ by default. \item \textbf{Play Performance Audio}. This setting, when turned on, plays the performance audio as it is streamed into the system. Listening to the performance audio is crucial when evaluating the system using the qualitative testbench as it allows a human user to judge the system by observing how accurate the alignment is based on the played audio. This setting is turned off by default. \end{itemize} Several tunable parameters are also available for the Backend: \begin{itemize} \item \textbf{Backtracking}. With backtracking on, the follower is allowed to ``go back in score time'', essentially reporting aligned score events that precede the last aligned score event. This setting does not heavily affect the Backend in \emph{alignment} mode (as that mode only reports ``unseen'' notes). In the \emph{timestamp} mode however, turning off backtracking heavily stabilises the timestamps output. Backtracking is turned off by default. \item \textbf{Backend Compensation}. This setting only affects the \emph{timestamp} Backend mode. Because of the nature of streaming in slices, the follower essentially works on a slice of audio that is one frame length's amount of time behind, thus, the timestamps reported when this setting is on are each the sum of the original timestamp and a frame length's amount of time. Backend compensation is turned on by default. \end{itemize} As the follower runs time-sensitive real-time processes, parallelism is employed to reduce overall system latency. Here, two \textbf{multiprocessing queues}\footnote{\url{https://docs.python.org/3/library/multiprocessing.html}} are used to allow the Audio Preprocessor, OLTW Follower and Backend to run in parallel. This architecture ensures that the three running components do not block each other--if the system is not designed in parallel, the preprocessor may lose slices of audio streamed real-time into the system, or the Backend may block the time-sensitive follower. Using parallelism also allows the system to take advantage of the increased computation power offered on modern machines, which are often multicore. Further, the OLTW follower is designed in a way to consume elements of $\mathcal{P}$ on demand and the blocking multiprocessing queue system fits well. In terms of parallel processes run, as the OLTW Follower and Backend each run one process and the Audio Processor covered below runs two processes, a total of four parallel processes work together concurrently during following. \subsubsection{Audio Preprocessor} \label{impl_dtw_sys_arch_audio_preproc} The architecture for the audio preprocessor is shown in \autoref{fig:oltw_audiopreproc}. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/sysarch/audiopreproc.pdf} \caption{Architecture Diagram for the Audio Preprocessor.} \label{fig:oltw_audiopreproc} \end{figure} The slicer obtains slices of a specific length (detailed further in \autoref{cqt_impl}) of the input audio then writes it into the Slice Queue, another instance of a multiprocessing queue. This ensures that all input audio slices are obtained without latency or blocking issues, and implies that the preprocessor runs two processes in parallel. The Feature Extractor component then consumes slices of audio from the Slice Queue to be fed into the CQT implementation covered in~\autoref{cqt_impl}--the extracted CQT feature is then processed into the feature vector representations described in \autoref{impl_dtw_cqt_to_note}. \subsubsection{Overall Architecture} The full architecture of the system is shown in \autoref{fig:oltw_archfull}. The system is segmented to delineate the two core steps of the system: preprocessing and following. As discussed, in short, the preprocessing step--running two parallel processes--preprocesses score data prior to following. The following step then takes over, running four parallel processes to process streamed performance audio and align extracted features before outputting the timestamp or alignment output via the Backend component. \begin{figure}[h] \centering \includegraphics[width=0.45\columnwidth]{assets/sysarch/full.pdf} \caption{Overall Architecture.} \label{fig:oltw_archfull} \end{figure} \subsection{CQT Implementation} \label{cqt_impl} The invertible real-time CQT algorithm--sliCQ--introduced by Dörfler, Holighaus, Grill and Velasco \cite{holighaus13,angelo11} is used. In particular, the Python implementation by Grill is used\footnote{\url{https://github.com/grrrr/nsgt}}. Further, some other available substitutes of sliCQ are detailed below. \subsubsection{Offline Mode} \label{impl_dtw_offline_mode_cqt} The parameters used in Offline Mode are $f_s = 44100\si{\hertz}$ and $N_{bin}=12$. $f_{\min}$, $f_{\max}$, slice length and transition length can be customised via command line arguments, but otherwise default to the values defined below in \nameref{impl_dtw_online_mode_cqt}. In addition to the sliCQ algorithm, a reference CQT computation method using classical CQT as introduced in \cite{christiancqt}\footnote{\url{https://librosa.org/doc/main/generated/librosa.cqt.html}} can be selected. \subsubsection{Online Mode} \label{impl_dtw_online_mode_cqt} In Online Mode, the default parameters are $f_s = 44100\si{\hertz}$, $N_{bin}=12$, $f_{\min} = 130.8 \si{\hertz}$ ($C3$) and $f_{\max} = 4186.0 \si{\hertz}$ ($C8$). Further, the default frame length is $8192$ samples and the default hop length is $2048$ samples, which means that each hop is $\frac{2048}{44100} \approx 46\si{\milli\second}$ long. These frames are directly fed as slices into the sliCQ algorithm detailed in \autoref{impl_dtw_cqt_tech}; referring to \autoref{fig:tukeywins}, the default settings here imply $2N = 8192$ and $M = 2048$. In addition to sliCQ, ``real-time-capable'' CQT approximations provided in the \texttt{librosa} library, namely hybrid CQT\footnote{\url{https://librosa.org/doc/main/generated/librosa.hybrid_cqt.html}} and pseudo CQT\footnote{\url{https://librosa.org/doc/main/generated/librosa.pseudo_cqt.html}}, are available as options--these alternatives are, as expected, not as performant as sliCQ--see \autoref{impl_dtw_eval} for evaluation results. For configuration purposes, $f_{\min}$, $f_{\max}$, slice length, transition length and other further parameters detailed in this system are available as configurable command line arguments--refer to the repository\footnote{\url{https://github.com/flippy-fyp/flippy}} for more information. Multithreading for sliCQ computation is available as an option for performance, and, when required and if enabled, FFT calculations are sped up via using the FFTW library\footnote{\url{http://www.fftw.org/}}. \subsection{DTW Implementation} \label{impl_dtw_dtw} \subsubsection{Offline Mode (Classical)} \label{impl_dtw_dtw_offline} In Offline Mode, users can choose between classical DTW (implementing \autoref{eqn:orig_dtw}) or the OLTW algorithm as will be covered below in \nameref{impl_dtw_dtw_online}. Command line settings are provided to switch between these two modes. This will allow comparison of classical offline DTW to OLTW. The weights for the local path constraint calculation (see \autoref{eqn:oltw_dtw}), $w_a$, $w_b$ and $w_c$, are all set to $1$ (as per standard configurations in DTW, see \autoref{eqn:orig_dtw}), but can be configured differently. \subsubsection{Online Mode (OLTW)} \label{impl_dtw_dtw_online} In Online Mode, the OLTW algorithm as detailed in \autoref{impl_dtw_baseline_worked_example} is used. The two parameters listed in \autoref{impl_oltw_param}, \texttt{c} and \texttt{MaxRunCount}, are set to 500 and 3 respectively. With a hop length giving a hop time of approximately $46\si{\milli\second}$ long, the width of the search band is around $23\si{\second}$ long--relevant experiments showed that a search band of $10\si{\second}$ is sufficient \cite{Dixon2005MATCHAM, arzt08}. These parameters are available for customisation via the command line. The weights $w_a$, $w_b$ and $w_c$ are set to $0.5$, $1$ and $1$ respectively to favour full performances with minimal mistakes as in the evaluation runs discussed in \autoref{impl_dtw_eval}--the weights can be tuned differently to adjust the follower to work with a variety of performances. \subsubsection{Parameters} \label{impl_oltw_param} Dixon's OLTW algorithm \cite{Dixon2005MATCHAM} is used as the baseline algorithm for this project's system, and here technicalities of the algorithm are presented before a worked step-by-step example. The parameters for the algorithm are listed: \begin{itemize} \item \texttt{c}: The search window. \item \texttt{MaxRunCount}: A parameter which constrains the slope of the path to be between $\frac{1}{\texttt{MaxRunCount}}$ and \texttt{MaxRunCount}. \end{itemize} Extending the original local path constraint algorithm given in \autoref{eqn:orig_dtw}, weights are introduced to introduce bias towards a certain step direction. The resultant formula is shown in \autoref{eqn:oltw_dtw}; $w_a$, $w_b$ and $w_c$ are configurable parameters, which can be positive or negative. Similar weighting systems were also used in multiple approaches in the literature \cite{arzt08, arzt16, chen19, orti15,wang16}. \begin{equation} \mathcal{D}(i, j) = \min \begin{cases} w_a \times d(i, j) + \mathcal{D}(i, j-1) \\ w_b \times d(i, j) + \mathcal{D}(i-1, j) \\ w_c \times d(i, j) + \mathcal{D}(i-1, j-1) \\ \end{cases} \label{eqn:oltw_dtw} \end{equation} In fact, the original approach in OLTW by Dixon \cite{dixonOLTW} is a case of \autoref{eqn:oltw_dtw} with $w_a = w_b = 1$ and $w_c = 2$--this is to make the comparison of different path lengths in the algorithm possible. Note further that \cite{arzt16} presented an incorrect version of \autoref{eqn:oltw_dtw}. Another constraint is added to limit the runtime of the algorithm: if the calculation of a certain clause (out of the three in \autoref{eqn:oltw_dtw}) in $\mathcal{D}$ depends on an uncalculated entry, that entry is set to $\infty$ (i.e. ignored). The algorithm is set up so that at least one clause is not $\infty$. \subsubsection{Algorithm Presentation} \label{impl_oltw_presentation} \begin{itemize} \item \textbf{Preprocessing} \begin{enumerate} \item \textbf{Compute $\mathcal{S}$}. $\mathcal{S}$ is first computed. This can either be from the synthesised score (MIDI or MusicXML), or from a preprocessed piece of audio (the preprocessing maps relevant points in the audio to its position in a score). For simplicity, the former case is assumed from this point onwards. \item \textbf{Construct Cost Matrix}. A cost matrix $M$ containing the costs $\mathcal{D}$ is constructed. This is similar to the grid constructed in \autoref{impl_asm_techback_asm}. $M$ is indexed using a coordinate system $(x, y)$ where the last row of the first column is the origin $(0, 0)$--this cell is referred to as $M(0, 0)$. $x^+$ is in the rightward direction and $y^+$ is in the upward direction. $\mathcal{S}$ is placed on the first column starting from $M(0, 1)$ in the $y^+$ direction: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_m$ \\ \vdots \\ $s_2$ \\ $s_1$ \\ \phantom{} \\}; \end{tikzpicture} $M$ will expand in the score following process in the $x^+$ direction as $\mathcal{P}$ is streamed in--$\mathcal{P}$ is placed starting from $M(1, 0)$ tending towards the $x^+$ direction. $M(0, 0)$ is left empty, $M(x, y)$ for $x > 0$ and $y > 0$ are spaces left for the costs $\mathcal{D}$--in fact, for $i \neq 0, j \neq 0$, $$ \mathcal{D}(i, j) = M(i, j). $$ \end{enumerate} \item \textbf{Following Algorithm} Here, the generic following algorithm is presented. Step 4-7 forms the main \emph{loop} of the algorithm. \begin{enumerate} \item \textbf{Initialise variables} Let \texttt{i} and \texttt{j} be the latest (top-rightmost) calculated position in $M$ representing $M(i, j)$. \texttt{i} and \texttt{j} are both set to $1$. The \texttt{current} and \texttt{previous} variables track the direction(s) of the current and previous direction(s) of increment and have values that can be \texttt{i}, \texttt{j}, \texttt{ij} or \texttt{None}. Both variables are initialised to \texttt{None}. The \texttt{runCount} variable which is an integer is initialised to 1. This variable keeps track the consecutive number of times the system is incremented in a certain direction. \item \textbf{Obtain $p_\texttt{i}$}. \item \textbf{Calculate $\mathcal{D}(\texttt{i}, \texttt{j})$}. \item \textbf{Determine whether to increment \texttt{i}, \texttt{j} or both (\texttt{ij})}. \begin{itemize} \item If $\texttt{i} < \texttt{c}$, increment both (\texttt{ij}). (This is always the case for the beginning of the system, so that a square block of length $\texttt{c}$ is formed.) \item Else if $\texttt{runCount} > \texttt{MaxRunCount} $, increment $j$ if \texttt{previous = i}, increment $i$ otherwise. (This prevents the algorithm from ``running away'' too far in one direction. The effect of this is that the slope of the path is bound between $\frac{1}{\texttt{MaxRunCount}}$ and $\texttt{MaxRunCount}$.) \item Else obtain the latest coordinate of the lowest cost path $(i', j')$ fulfilling $\min(\mathcal{D}(i', j'))$ for $i' = \texttt{i}$ or $j' = \texttt{j}$. If $i' < \texttt{i}$ increment $\texttt{j}$; else if $j' < \texttt{j}$ increment $\texttt{i}$; else increment \texttt{ij}. (This limits the search path--only a row or column in the tending direction of the path is calculated, save for the case where $(i', j') = (\texttt{i}, \texttt{j})$ where both \texttt{i} and \texttt{j} are incremented.) \end{itemize} The \texttt{current} variable holds this decision, and can be \texttt{i}, \texttt{j} or \texttt{ij}. \item \textbf{Increment \texttt{i}, \texttt{j} depending on \texttt{current}}. \begin{itemize} \item $\texttt{i} \in \texttt{current}$: \begin{enumerate} \item Increment \texttt{i}. \item Exit if performance is complete; otherwise, obtain $p_\texttt{i}$. \item Compute $\mathcal{D}(\texttt{i}, \texttt{J})$ for $\texttt{J} \in \mathbb{Z}, \max(0, \texttt{j}-\texttt{c} + 1) < \texttt{J} \leq \texttt{j}$. \end{enumerate} \item $\texttt{j} \in \texttt{current}$: \begin{enumerate} \item Increment \texttt{j}. \item Compute $\mathcal{D}(\texttt{I}, \texttt{j})$ for $\texttt{I} \in \mathbb{Z}, \max(0, \texttt{i}-\texttt{c} + 1) < \texttt{I} \leq \texttt{i}$. \end{enumerate} \end{itemize} \item \textbf{Update \texttt{runCount}}. Increment \texttt{runCount} if $\texttt{current} = \texttt{previous} \neq \texttt{ij}$; otherwise, reset \texttt{runCount} to $1$. Assign $\texttt{previous}$ to $\texttt{current}$. \item \textbf{Go to Step 4}. \end{enumerate} \end{itemize} \subsubsection{Algorithm Analysis} As can be seen, for every step of the loop a maximum of $2 \times \texttt{c}$ calculations of $\mathcal{D}$ are required. These calculations are also memoised and kept in $M$, meaning that bounded time is required for each computation, giving a time complexity of $\mathcal{O}(1)$. From this, every step of the loop also has a time complexity of $\mathcal{O}(1)$, and finally it can be said the whole following procedure is \emph{linear} in time complexity with regard to the longest of the sequences $\mathcal{P}$ and $\mathcal{S}$: $\mathcal{O}(\max(|\mathcal{P}|, |\mathcal{S}|))$. On the other hand, the space complexity is simply $\mathcal{O}(|\mathcal{P}||\mathcal{S}|)$. As was discussed in \autoref{impl_dtw_tech}, \autoref{fig:dtw_time} demonstrates the linear time complexity ($\mathcal{O}(\max(|\mathcal{P}|, |\mathcal{S}|))$) of OLTW, which is in contrast to the quadratic time complexity ($\mathcal{O}(|\mathcal{P}||\mathcal{S}|)$) of DTW. \subsubsection{Worked Example} \label{impl_dtw_baseline_example_sequences} The OLTW algorithm is worked out in a step-by-step example here. For this example, \texttt{c} is set to 3, \texttt{MaxRunCount} is ignored, and $w_a = w_b = w_c = 1$. Referring to \Cref{def:scofo_dtw}, assume the example feature vectors $\mathcal{P}$ and $\mathcal{S}$ in \autoref{eqn:exampleps} are extracted from the audio following steps detailed in subsections \ref{impl_dtw_cqt_tech} and \ref{impl_dtw_cqt_to_note}. Note that the complete $\mathcal{P}$ is given here--during the example $\mathcal{P}$ will be partially fed into the system. Also, assume that $K = 2$, i.e. there are $2$ frequency bins; further, for simplicity, the normalisation step is skipped. \begin{align} \begin{split} \mathcal{P} & = \begin{bmatrix} 1 \\ 2 \end{bmatrix} \begin{bmatrix} 3 \\ 3 \end{bmatrix} \begin{bmatrix} 2 \\ 2 \end{bmatrix} \begin{bmatrix} 2 \\ 3 \end{bmatrix} \begin{bmatrix} 6 \\ 6 \end{bmatrix} \\ \mathcal{S} & = \begin{bmatrix} 1 \\ 2 \end{bmatrix} \begin{bmatrix} 3 \\ 3 \end{bmatrix} \begin{bmatrix} 2 \\ 2 \end{bmatrix} \begin{bmatrix} 4 \\ 3 \end{bmatrix} \begin{bmatrix} 2 \\ 2 \end{bmatrix} \end{split} \label{eqn:exampleps} \end{align} For convenience, the distances $d(i, j)$ between every pair of vectors in $\mathcal{P}$ and $\mathcal{S}$ (calculated as per \autoref{impl_dtw_dist_comp}) are given in the grid below. $i$ and $j$ respectively index $\mathcal{P}$ and $\mathcal{S}$. Note also that not all distances are required should the algorithm not need to calculate the distance in question. An example calculation is $$ d(2, 1) = \| p_2 - s_1 \|_1 = |3-1| + |3-2| = 3. $$ \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $d$ & $p_1$ & $p_2$ & $p_3$ & $p_4$ & $p_5$ \\ $s_1$ & 0 & 3 & 1 & 2 & 9 \\ $s_2$ & 3 & 0 & 2 & 1 & 6 \\ $s_3$ & 1 & 2 & 0 & 1 & 8 \\ $s_4$ & 4 & 1 & 3 & 2 & 5 \\ $s_5$ & 1 & 2 & 0 & 1 & 8\\}; \end{tikzpicture} \begin{enumerate} \item First, the preprocessing steps are run. Only $s_1$, $s_2$ and $s_3$ are shown now for simplicity. \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_3$ \\ $s_2$ \\ $s_1$ \\ \phantom{} \\}; \end{tikzpicture} \item The algorithm is run for $\texttt{i}, \texttt{j} < \texttt{c}$. For each step the minimum cost path is \textbf{bolded}. $(i', j')$ is the top-rightmost bolded cell within $M$--this represents the current position in the score of the performance. \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_3$ & \phantom{} \\ $s_2$ & \phantom{} \\ $s_1$ & \textbf{0} \\ \phantom{} & $p_1$ \\}; \end{tikzpicture} \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_3$ & \phantom{} & \phantom{} \\ $s_2$ & 3 & \textbf{0} \\ $s_1$ & \textbf{0} & 3 \\ \phantom{} & $p_1$ & $p_2$ \\}; \end{tikzpicture} \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_3$ & 4 & 2 & \textbf{0} \\ $s_2$ & 3 & \textbf{0} & 2 \\ $s_1$ & \textbf{0} & 3 & 4 \\ \phantom{} & $p_1$ & $p_2$ & $p_3$ \\}; \end{tikzpicture} Thus far, the calculations are trivial as $p_1 p_2 p_3 = s_1 s_2 s_3$. The optimal diagonal path is found trivially. Here, $(i', j') = (\texttt{i}, \texttt{j}) = (3, 3)$. \item The next direction to increment is both \texttt{i} and \texttt{j} as $(i', j') = (\texttt{i}, \texttt{j})$. First, \texttt{i} is incremented and relevant costs are computed; then, \texttt{j} is incremented with its relevant costs computed as well. \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_4$ & \phantom{} & \phantom{} & \phantom{} & \phantom{} \\ $s_3$ & 4 & 2 & \textbf{0} & 1 \\ $s_2$ & 3 & \textbf{0} & 2 & 3 \\ $s_1$ & \textbf{0} & 3 & 4 & 6 \\ \phantom{} & $p_1$ & $p_2$ & $p_3$ & $p_4$ \\}; \end{tikzpicture} \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_4$ & \phantom{} & 3 & 3 & 2 \\ $s_3$ & 4 & 2 & \textbf{0} & \textbf{1} \\ $s_2$ & 3 & \textbf{0} & 2 & 3 \\ $s_1$ & \textbf{0} & 3 & 4 & 6 \\ \phantom{} & $p_1$ & $p_2$ & $p_3$ & $p_4$ \\}; \end{tikzpicture} Notice that now $\texttt{i} = i'$ but $\texttt{j} \neq j'$. \item As $\texttt{i} = i'$ but $\texttt{j} \neq j'$, the next step is to increment \texttt{i}: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_4$ & \phantom{} & 3 & 3 & \textbf{2} & 7 \\ $s_3$ & 4 & 2 & \textbf{0} & \textbf{1} & 9 \\ $s_2$ & 3 & \textbf{0} & 2 & 4 & 9 \\ $s_1$ & \textbf{0} & 3 & 4 & 6 & \phantom{} \\ \phantom{} & $p_1$ & $p_2$ & $p_3$ & $p_4$ & $p_5$ \\}; \end{tikzpicture} Now, $\texttt{i} \neq i'$ but $\texttt{j} = j'$. \item From $\texttt{i} \neq i'$ but $\texttt{j} = j'$ the next step is to increment \texttt{j}: \begin{tikzpicture} \matrix[matrix of nodes,nodes={draw=gray, anchor=center, minimum size=.6cm}, column sep=-\pgflinewidth, row sep=-\pgflinewidth] (A) { $s_5$ & \phantom{} & \phantom{} & 3 & \textbf{3} & 11 \\ $s_4$ & \phantom{} & 3 & 3 & \textbf{2} & 7 \\ $s_3$ & 4 & 2 & \textbf{0} & \textbf{1} & 9 \\ $s_2$ & 3 & \textbf{0} & 2 & 3 & 9 \\ $s_1$ & \textbf{0} & 3 & 4 & 6 & \phantom{} \\ \phantom{} & $p_1$ & $p_2$ & $p_3$ & $p_4$ & $p_5$ \\}; \end{tikzpicture} As $\texttt{previous} = \texttt{current} = \texttt{j} \neq \texttt{ij}$, \texttt{runCount} is incremented to $2$. \end{enumerate} The algorithm terminates when the last element in $\mathcal{S}$ is reached. Note that this example does not show the case where \texttt{runCount} reaches \texttt{MaxRunCount}, but the idea is simple--when this occurs, the direction opposing the previously computed direction is taken. Further, the output of the follower is triggered whenever $j'$ changes--this indicates that the follower deems that the position in the score has moved. The mapping that maps the specific $j'$ entry to the position in the score, previously obtained in the preprocessing step, is used to output the score position--this could be a timestamp. \chapter{Discussion} \label{tb_discussion} \epigraph{\itshape Music is very abstract. When we talk about music, we're not discussing the music itself but rather how we react to it.}{Daniel Barenboim} \chapter{Qualitative Testbench} \label{tb_qual} \epigraph{\itshape If it sounds right, then it is.}{Eddie Van Halen} The implementation of the qualitative testbench is detailed in this chapter. First, the main goal to be achieved by this testbench is presented in \autoref{tb_qual_maingoal} before requirements captured in \autoref{tb_qual_req} are addressed in \autoref{tb_qual_address}. Also detailed in \autoref{tb_qual_impl_details} are the implementation details of the testbench. Last but not least, \autoref{tb_qual_results} details the final product of this testbench. Actual usage of the testbench will be covered in \autoref{impl} as it will be used to evaluate the project's score following approaches. \section{Main Goal} \label{tb_qual_maingoal} The main goal of the qualitative testbench is to provide a user interface showing score following in action: the score follower shall follow the score provided in real time. The position of the tracking shall be showed live to the user for evaluation purposes. \section{Addressing Requirements} \label{tb_qual_address} \subsection{Open-source} Similar to this testbench's quantitative counterpart (\autoref{tb_quant}), this testbench is publicly available under the GPLv3 licence on GitHub\footnote{\url{https://github.com/flippy-fyp/flippy-qualitative-testbench/}}. \subsection{Flexible Score Follower API} In \autoref{tb_quant_scofo_api} it was noted that the quantitative testbench only works for score followers capable of producing tracked note onset data. This automatically disqualifies approaches that do not produce such data (such as eye-gaze and beat tracking systems). This testbench resolves this issue--the only output required from score followers is the \textbf{instantaneous time} of the currently followed position in the score. An alignment algorithm shall take the timing information provided by the score follower to overlay a marker on a provided sheet music to indicate the estimated position. \subsection{Flexible Dataset API} \label{tb_qual_flexdatasetapi} This approach requires no tedious creation of valuable reference datasets. Since a human user is the primary agent evaluating the followers, the only dataset required here is sheet music and its corresponding performance audio (streamed live or playback). Currently, only the \nameref{scofo_mdr_musicxml} format is accepted. It is however possible to perform staff detection for sheet music images which would make the approach viable for recent approaches working on sheet music images (this was experimented in \cite{vreefollow})--this feature can be added when the need arises. For the purpose of qualitatively evaluating the score following system proposed subsequently in \autoref{impl_dtw}, the \textit{QualScofo} dataset comprising a wide variety of musical pieces, was compiled--see \autoref{tb_qual_prod_dataset} for more information. \subsection{Clear Visualisations} Readers may note that the visualisation provided by Thickstun \textit{et al.}{} \cite{thickstun20} (shown in \autoref{fig:thickstunvis}) may be somewhat helpful despite its shortcomings. In fact, the adding of visualisations immune to the offset problem in the quantitative testbench was considered, but it quickly became clear that the proposed quantitative metrics adequately capture such information. Users can also quickly compare the aligned files with their respective reference files to obtain more information. That said, the benefits of clear visualisations are appreciated. Thus, a friendly user-interface for score following visualisation is introduced in this qualitative testbench. All the user needs to do is to load the MusicXML sheet music, then play the performance audio after initiating the testbench and follower. The user can then evaluate the actual following of the score follower by the visual marker provided by this testbench. This is useful for evaluating systems prior to their user acceptance testing stage in real-life applications. Users can judge subjectively how well a score follower is performing; they can also look for specific features targeted by the score follower to optimise. \section{Implementation Details} \label{tb_qual_impl_details} \subsection{Choice of Framework and Language} \label{tb_qual_impl_details_choice} The decision of which framework and language to implement this testbench is, in contrast to the quantitative counterpart, not as straightforward. The fact that the quantitative testbench works on artifacts in the form of completed alignment text files means that the quantitative testbench can in fact use any language capable of reading in text files and performing mathematical analyses. The qualitative testbench, on the other hand, may be required to work with score followers written in different languages, tools and frameworks. Rewriting the testbench ad hoc in the target score follower's language defeats the intention of an open and widely adopted test suite. In fact, the motivation behind the flexible APIs of the qualitative testbench stems from part of Ken Thompson's well-known Unix philosophy \cite{unixphilo}: \begin{displayquote} Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new ``features''. \end{displayquote} Therefore, the qualitative testbench is intended to be an easy plug-and-play testbench solution highly capable of doing just its job. Hence, it should be written in a language and/or framework that facilitates such a requirement. Also note that the user interface requirement for visualisations means that a framework and language supporting these visualisations are required. Python remains a viable alternative with the benefits detailed in \autoref{tb_quant_bettereng}. However, Python's graphical user interface (GUI) options (e.g. \texttt{Tkinter}, \texttt{PyGtk} etc.) are not as strong as those in an area that has seen huge strides in GUI development: the Web. The \texttt{Electron} framework\footnote{\url{https://www.electronjs.org/}} was thus chosen. The \texttt{Electron} framework allows easy development of cross-platform desktop apps with the classic Web stack of JavaScript, HTML and CSS. Well-known applications built with \texttt{Electron} include Visual Studio Code, WhatsApp Desktop and Microsoft Teams. The Web support in \texttt{Electron} comes from its inclusion of \texttt{Chromium}\footnote{\url{https://www.chromium.org/}}, an open-source browser that is the core of the well-known Google Chrome browser. JavaScript execution in \texttt{Electron} is powered by the performant V8 JavaScript engine that just-in-time (JIT) compiles JavaScript code to run quickly on machines \cite{v8}--experimental results show that even though JavaScript is widely regarded as a slow interpreted language, JavaScript on V8 proves to be very performant (much more than Python) in benchmarks \cite{benchmarksgame} for a language of its class. Cross-platform desktop apps may also require OS-specific functions--\texttt{Electron} offers this in its vast, well-documented, suite of APIs. JavaScript being the \textit{lingua franca} of the Web also means that the community of developers is active and strong. There hence exists many open-source libraries. In fact, the user interface for rendering MusicXML is built upon an existing library\footnote{\url{https://opensheetmusicdisplay.org/}}. Migration of the codebase into a Web-based application (or a Web-based mobile application framework such as React Native\footnote{\url{https://reactnative.dev/}}) is also straightforward for \texttt{Electron} applications. The downside of \texttt{Electron} is clearly its bundle size after building--the application has to effectively bundle a whole web browser (\texttt{Chromium}). The qualitative testbench can be written for the Web to be used in a browser, but that would disqualify the vast majority of score followers not written in a Web-supported framework or language. In addition, the capability of working with native OS calls would prove more convenient for this testbench's purposes, effectively facilitating an interface capable of working with many score followers. \subsection{Follower-Testbench Interface} \label{tb_qual_follower_testbench_interface} A significant challenge in building the testbench is in the implementation of the follower-testbench interface--a requirement for a flexible testbench is that it should support followers written in any framework or language. While there are user-friendly abstractions (a strong contender is ZeroMQ\footnote{\url{https://zeromq.org/}}) that facilitate communication between programs written in different languages, these are not as easily set up as plain low-level sockets, which are simple to implement and available in most programming languages and systems. Using sockets not only allow the score follower to run in a separate and independent process--it also means that the score follower can run on a \emph{separate device}. This is beneficial when used in ensemble settings--the follower could be run on one system equipped with a well-placed microphone to take in audio from the performance, which is then fed into the score follower. The resultant timestamps can be broadcasted to the devices running this testbench, which can, in effect, replace the players' sheet music. Further, the computation-heavy score following algorithm could be off-loaded to a high-performance server, and the devices displaying the sheet music and following result do not need to be highly performant systems. To initialise the testbench, users would indicate the host's port in the testbench to which the follower would send UDP packets--UDP was chosen for its lower overhead and the fact that it supports individual, separable message packets containing timestamps from the follower. Despite UDP's nature of dropping packets and possible out-of-order message receiving which are not present in TCP, in practice the UDP interface worked seamlessly given the low bandwidth required; further, using TCP would require extra programming to parse the required timestamps as TCP is a stream-oriented protocol--this would incur extra overhead in addition to the acknowledgement overhead present in TCP. As the responsiveness of the testbench is paramount, UDP is ideal. During score following, the testbench receives and parses timestamps in UDP packets received from the follower, which is then used to calculate and indicate the position on the displayed sheet music. \autoref{fig:qualbwv846} shows the qualitative testbench at work. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/electron/bwv846.png} \caption{A screenshot of the qualitative testbench software at work. The piece being followed is Bach's \textit{Prelude in C major, BWV 846}. The user interface is simple and straightforward: the first line of the header shows the currently open (if any) MusicXML's file path, together with file controls. The second line contains a textbox for users to key in the local host's port number to which the follower would send timestamp output (via UDP messages), along with controls to start and stop the following.} \label{fig:qualbwv846} \end{figure} \subsection{Efficient Marker Positioning} \label{sec:efficient_marker_position} A requirement to pursue the qualitative testbench's goal of giving clear visualisations on the performance of a score follower is the testbench's responsiveness. The most computationally intensive part of this testbench is the positioning of the visual marker on the music sheet. Score followers may output arbitrary timestamps that are not necessarily close to and/or larger than the last timestamp produced--this means that the testbench needs to responsively handle arbitrary jumps. Some score followers may also produce timestamps that do not correspond directly to a note onset timestamp in the score. The library used for MusicXML visualisation\footnote{\url{https://opensheetmusicdisplay.github.io/}} offers an interface to position the marker on note onsets of the MusicXML document. In the testbench's preprocessing step, each note onset is tied to its timestamp in seconds. Thus, the testbench needs to performantly position the visual marker to the (closest) note onset based on the timestamp given by the score follower. \subsubsection{Finding the Closest Timestamp} \label{tb_qual_finding_closest} The problem is first formulated: \begin{definition}[The problem of Finding the Closest Timestamp] Given a list of timestamps $\textsc{Timestamps}$ and a timestamp from the follower $\textsc{Timestamp}_f$, find $\textsc{Timestamp}_c$, the timestamp within $\textsc{Timestamps}$ that minimises $\textsc{Error} = |\textsc{Timestamp}_c - \textsc{Timestamp}_f|$. Where there exists ties, the preceding timestamp is returned. \label{def:closesttimestamp} \end{definition} A naïve approach is to calculate $\textsc{Error}$ for every single element in $\textsc{Timestamps}$. Immediately the calculation can be optimised--note that the values of $\textsc{Error}$ form a parabola with a minimum; therefore, the calculation can be stopped when $\textsc{Error}$ first increases--the preceding timestamp is the required result. An example evaluation of this algorithm is as such: given $\textsc{Timestamps} = [0, 2, 4, 6, 8]$ and $\textsc{Timestamp}_f = 3.3$, the $\textsc{Error}$s calculated are $[3.3, 1.3, 0.7, 2.7]$--the calculation stops at the fourth element and the result is thus $\textsc{Timestamp}_c = 4$. The above approach takes $\mathcal{O}(n)$ time and space, where $n$ is the number of elements in $\textsc{Timestamps}$. As mentioned, the responsiveness of the visual marker is of utmost importance, and any optimisation is welcome--the number of note onsets in large complex scores can be on the order of tens of thousands to hundreds of thousands, and each score following session requires this function to be called as many times as there are note onsets in the score (and therefore in the context of the whole score following the time complexity is quadratic--$\mathcal{O}(n^2)$). All the latency caused by this calculation adds up and results in an overall drop in the testbench's responsiveness. A more efficient approach is used--$\textsc{Timestamps}$ can be preprocessed and stored as a binary search tree. Two binary search tree operations that help solve the problem are $$\textsc{UpperBoundOrEqual}(\textsc{Timestamp}_f, \textsc{Timestamps})$$ and $$\textsc{LowerBoundOrEqual}(\textsc{Timestamp}_f, \textsc{Timestamps})$$ that find the first element greater than or equals and lesser than or equals $\textsc{Timestamp}_f$ respectively, both in $\mathcal{O}(\log n)$ time. For the example given above, the former function returns $4$, the latter $2$--the former results in a smaller $\textsc{Error}$ and therefore is the required result. The optimisation from $\mathcal{O}(n)$ to $\mathcal{O}(\log n)$ is significant, especially when the complexity is instead calculated in the context of the whole score following procedure: the resulting complexity of calculating required timestamps is quasilinear: $\mathcal{O}(n \log n)$. \subsubsection{Placing the Visual Marker Efficiently} Because the score follower may produce arbitrary timestamps at any point in time, the procedure of calculating and/or placing the visual marker of the preceding timestamp may be incomplete when a new timestamp is received. Instead of finishing this operation and therefore causing \emph{compounded} drops in responsiveness when multiple successive big jumps are required, the procedure for the preceding note can be preempted. Procedure preemption varies across different languages, frameworks and systems. As the main programming language chosen, of which the reasons of choice are detailed in \autoref{tb_qual_impl_details_choice}, JavaScript offers first-class support for \emph{asynchronous programming} via Promises\footnote{\url{https://web.dev/promises/}}. In most multi-threaded languages, asynchronous programming is a means of \emph{parallel programming} in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress \cite{asyncdotnet}. However, JavaScript, as the informed reader may point out, is single threaded. JavaScript's Promises allow the emulation of such asynchronous behaviour--Promise evaluation does not block the main JavaScript thread. The benefit of using the asynchronous programming paradigm is that the idea and execution of preemption become simpler: via cancelling the in-progress asynchronous job that is independent of the main thread. The calculation of the closest timestamp as well as the placement of the visual marker are thus performed asynchronously via Promises. By current design, however, preemption in JavaScript Promises is not well supported; fortunately, wrappers for Promises that add preemption support to JavaScript Promises exist. This testbench uses one such wrapper: Bluebird\footnote{\url{http://bluebirdjs.com/docs/getting-started.html}}. As an aside, another possible way of dealing with preempting asynchronous code in JavaScript is via Observables\footnote{\url{https://rxjs-dev.firebaseapp.com/guide/observable}}. Observables offer a different and easier interface, but currently require the inclusion of a significantly large and complex library. Note however that Observables are currently a proposed feature for JavaScript\footnote{\url{https://github.com/tc39/proposal-observable}}. With preemptive asynchronous programming in JavaScript, the placing of the visual marker on the sheet music is made more efficient--the latest timestamp takes priority and may cause the preemption of any calculations and placement operations of preceding timestamps. \subsection{Engineering Practices} The good engineering practices employed in the development of the quantitative testbench as per \autoref{tb_quant_bettereng} are replicated. Fortunately, while the choice of language and framework for this testbench was tougher, better practices are more easily maintained as there are many existing tools created and supported by the community. Again, the maintainability and reliability of the source code are tackled via the three core steps: static analysis, code testing and automated testing. The first two steps are conveniently covered by using React\footnote{\url{https://reactjs.org/}} and TypeScript\footnote{\url{https://www.typescriptlang.org/}} on top of \texttt{Electron}. React is a JavaScript library framework that abstracts away the view layer for Web applications besides allowing the creation of reusable components. Further, React applications are fast, scalable and simple--data on the interface can be changed without reloading the page. This results in less code being written to enable the interface features of this testbench, and therefore there are fewer areas to make mistakes in. TypeScript, on the other hand, is a \textit{typed} superset of JavaScript. TypeScript has a type system vastly stronger than that of \texttt{mypy} for Python, and \textit{transpiles} down to JavaScript for runtime execution. Static analysis and testing are covered by these two tools--React abstracts away user interface rendering code; TypeScript provides powerful static analysis. These features do not mean there is no need for tests--tests are still necessary; however, the number of tests required is fewer due to React's abstractions and TypeScript's strong static analysis. GitHub Actions\footnote{\url{https://github.com/features/actions}} is once again used to run automated tests--the setup is similar to that in \autoref{tb_quant_bettereng}. \subsection{Known Limitations} \subsubsection{MusicXML Library Issues} The library used for MusicXML visualisation, \textit{OpenSheetMusicDisplay}\footnote{\url{https://opensheetmusicdisplay.github.io/}}, is currently a limiting factor for the performance of this qualitative testbench--it only reached version \texttt{1.0.0} on 6 May 2021, and still has unresolved issues, such as failing to handle score repeats and inaccurately rendering some score components. Nevertheless, this project is actively being developed and updating this dependency for this testbench is trivial when a new version becomes available. The inability to handle repeats can be worked around by unrolling repeats using a MusicXML editor, and the score rendering inaccuracies are not significant enough to cause major issues in using this testbench. \section{Resultant Product} \label{tb_qual_results} \subsection{Open-source Repository} The testbench is released publicly under the GPLv3 Licence on GitHub\footnote{\url{https://github.com/flippy-fyp/flippy-qualitative-testbench}}. \subsection{Usage Guide} The README\footnote{\url{https://github.com/flippy-fyp/flippy-qualitative-testbench/blob/main/README.md}} of the repository shows a detailed usage guide of all features in this testbench. The README in the repository for the score follower to be introduced in \autoref{impl_dtw}\footnote{\url{https://github.com/flippy-fyp/flippy}} also details a usage guide for this testbench. Further, the README shows a development guide, including details on how to install dependencies, set up a development environment, run a development instance of the application that will refresh upon live code changes, lint code and build the project. \subsection{Pre-built Installers} Pre-built installers, automatically built via GitHub Actions, are available for Mac, Windows and Linux systems. These installers give most users a simple way to quickly set up the testbench. Should these pre-built installers not work (perhaps due to the usage of an esoteric system), users can also follow the development guide to build the testbench for their system. \subsection{Mock Follower} A mock follower program is written in Python to demonstrate usage of the testbench and also serve as an example on how to implement a score follower that complies with the follower-testbench interface described in \autoref{tb_qual_follower_testbench_interface}. Effectively, this mock follower serves as a simple toy example that helps users understand the simple interface, which is core for the adoption of this testbench. \subsection{QualScofo: A Qualitative Score Following Dataset} \label{tb_qual_prod_dataset} For the purpose of qualitative evaluations using this testbench, a dataset--the \textit{QualScofo} (\textbf{Qual}itative \textbf{Sco}re \textbf{fo}llowing) dataset--comprising a variety of music pieces with different instrument configurations is compiled\footnote{The dataset can be found at \url{https://github.com/flippy-fyp/QualScofo}.}. The dataset comprises five \textit{groups} each made up of several \textit{pieces} with similar instrument configurations. There are 16 pieces in total. \textit{Pieces} are usually short excerpts (up to 2 minutes). Each piece may be uniquely identified with its Group ID and Piece ID. Tables~\ref{table:qual_dataset_1} and \ref{table:qual_dataset_2} give detailed information on each piece in the dataset. The tables are sorted by \textbf{Group ID}, \textbf{Piece ID} and \textbf{Year} (of composition). More details pertinent in the context of score following for each piece are provided in the dataset's usage in \autoref{impl_dtw_eval_qual}. As can be seen, the \textit{QualScofo} dataset covers a wide range of classical music encompassing music composed between 1717 and 1905. Further, the instrumentation configurations range from unaccompanied violin and cello to romantic-era symphony orchestras. Some performances are recorded in a studio, while others are live performance recordings. The most notable limitation of this dataset is that it does not span a large range of performer skill levels--this is due to the difficulty of procuring recordings by less-skilled players. The scores are obtained from \textit{MuseScore.com}\footnote{Not to be confused with its sister organisation--\textit{MuseScore.org}--that produces the score-editing program \textit{MuseScore}.} and converted into the MIDI, MusicXML and PDF formats; the corresponding performance audio files are obtained via \textit{YouTube}\footnote{\url{https://www.youtube.com/}. Downloadasaur (\url{https://www.downloadasaur.com}) was used to obtain the audio representations of the performance videos.}. As this dataset is made for research purposes, it falls under the fair use allowance\footnote{Under section 107 of the Copyright Act of 1976, allowance is made for ``fair use'' for purposes such as criticism, comment, news reporting, teaching, scholarship, education and research. Fair use is a use permitted by copyright statute that might otherwise be infringing.}. The source \textit{MuseScore.com} and \textit{YouTube} URLs for each piece can be formed via the following format: \texttt{\url{https://bit.ly/qualscofo-(musescore|youtube)-<GROUP_ID>-<PIECE_ID_PREDASH>}}. \texttt{<GROUP\_ID>} denotes the Group ID, and \texttt{<PIECE\_ID\_PREDASH>} denotes the Piece ID characters prior to the first occurring dash (\texttt{-}), if any. For instance, the \textit{YouTube} URL for the \texttt{chaconne-arp} piece in the \texttt{violin} group is \url{https://bit.ly/qualscofo-youtube-violin-chaconne}. Note that the performance audio of the pieces \texttt{prelude} and \texttt{fugue} in the \texttt{piano} group are not obtained from \textit{YouTube} but from the MAESTRO dataset \cite{MAESTRO}. \afterpage{% \clearpag \thispagestyle{empty \begin{landscape \begin{table} \centering \caption{Details of the qualitative dataset (Part 1 of 2).} \label{table:qual_dataset_1} \begin{tabularx}{\linewidth}{|l|l|l|L|L|L|L|L|L|L|} \hline \textbf{Group ID} & \textbf{Piece ID} & \textbf{Year} & \textbf{Piece Name} & \textbf{Composer} & \textbf{Instrumentation} & \textbf{Excerpt Range} & \textbf{Notes} \\ \hline \texttt{cello} & \texttt{suite1} & 1717-23 & Cello Suite No. 1 in G Major (Prélude) BWV1007 & Johann Sebastian Bach & Solo Cello & Bars 1-22 & Studio recording by professional cellist Yo-Yo Ma. \\ \hline \texttt{octet} & \texttt{mendelssohn} & 1825 & String Octet in E-flat major, Op. 20 & Felix Mendelssohn & String Octet & Bars 1-21 & Live performance recording by professional musicians. \\ \hline \texttt{orchestra} & \texttt{eine} & 1787 & Eine kleine Nachtmusik, K. 525 & Wolfgang Amadeus Mozart & Chamber String Orchestra & Bars 1-23 & Live performance recording by professional musicians. \\ \hline \texttt{orchestra} & \texttt{peer} & 1875 & Peer Gynt, Op. 23 & Edvard Grieg & Romantic-era Symphony Orchestra & Bars 1-29 & Studio recording by Berliner Philharmoniker Orchestra under Herbert von Karajan. \\ \hline \texttt{orchestra} & \texttt{1812-1} & 1880 & 1812 Overture, Op. 49 & Pyotr Ilyich Tchaikovsky & Romantic-era Symphony Orchestra, Brass Band, Artillery & Bars 358-379 & Studio recording, unknown orchestra, but most likely Morton Gould Orchestra and Band. \\ \hline \texttt{orchestra} & \texttt{1812-2} & 1880 & 1812 Overture, Op. 49 & Pyotr Ilyich Tchaikovsky & Romantic-era Symphony Orchestra, Brass Band, Artillery & Bars 380-422 & Studio recording, unknown orchestra, but most likely Morton Gould Orchestra and Band. \\ \hline \texttt{piano} & \texttt{fugue} & 1722 & Fugue in C major, BWV 846 & Johann Sebastian Bach & Piano & Full piece & Obtained from the MAESTRO dataset \cite{MAESTRO}. \\ \hline \texttt{piano} & \texttt{prelude} & 1722 & Prelude in C major, BWV 846 & Johann Sebastian Bach & Piano & Full piece & Obtained from the MAESTRO dataset \cite{MAESTRO}. \\ \hline \end{tabularx} \end{table} \end{landscape} \clearpag } \afterpage{% \clearpag \thispagestyle{empty \begin{landscape \begin{table} \centering \caption{Details of the qualitative dataset (Part 2 of 2).} \label{table:qual_dataset_2} \begin{tabularx}{\linewidth}{|l|l|l|L|L|L|L|L|L|L|} \hline \textbf{Group ID} & \textbf{Piece ID} & \textbf{Year} & \textbf{Piece Name} & \textbf{Composer} & \textbf{Instrumentation} & \textbf{Excerpt Range} & \textbf{Notes} \\ \hline \texttt{piano} & \texttt{turkish} & 1783 & ``Turkish March'' from Piano Sonata No. 11 in A major, K. 331/300i & Wolfgang Amadeus Mozart & Piano & Bars 1-25 (Movement III) & Studio recording by professional pianist Rousseau. \\ \hline \texttt{piano} & \texttt{moonlight} & 1801 & Piano Sonata No. 14 ``Moonlight'', Op. 27 & Ludwig van Beethoven & Piano & Bars 1-16 (Movement I) & Live performance recording by Claudio Arrau. \\ \hline \texttt{piano} & \texttt{unsospiro} & 1845-49 & ``Un sospiro'' from Three Concert Études, S.144 & Franz Liszt & Piano & Bars 1-10 (Étude No. 3) & Live performance recording by Marc-André Hamelin \\ \hline \texttt{piano} & \texttt{gnossienne} & 1890 & Gnossienne No. 1 & Erik Satie & Piano & Bars 1-35 (Assuming each bar comprises 4 beats) & Studio recording by professional pianist Alessio Nanni. \\ \hline \texttt{piano} & \texttt{entertainer} & 1902 & The Entertainer & Scott Joplin & Piano & Bars 1-16 & Audio recorded from a piano roll (pianola). \\ \hline \texttt{piano} & \texttt{clair} & 1905 & ``Clair de Lune'' from Suite bergamasque, L. 75 & Claude Debussy & Piano & Bars 1-17 & Studio recording by professional pianist Lang Lang. \\ \hline \texttt{violin} & \texttt{chaconne-arp} & 1717-1720 & ``Chaconne'' from Partita in D minor for solo violin, BWV1004 & Johann Sebastian Bach & Solo Violin & Bars 84-123 (Chaconne) & Studio recording by professional violinist Hilary Hahn. \\ \hline \texttt{violin} & \texttt{chaconne-front} & 1717-1720 & ``Chaconne'' from Partita in D minor for solo violin, BWV1004 & Johann Sebastian Bach & Solo Violin & Bars 1-24 (Chaconne) & Studio recording by professional violinist Hilary Hahn. \\ \hline \end{tabularx} \end{table} \end{landscape} \clearpag } \chapter{Quantitative Testbench} \label{tb_quant} \epigraph{\itshape May not music be described as the mathematics of the sense, mathematics as music of the reason? The musician feels mathematics, the mathematician thinks music: music the dream, mathematics the working life.}{James Joseph Sylvester} In this chapter, the implementation of the quantitative testbench is covered. Firstly, the main goal of the testbench is detailed in \autoref{tb_quant_maingoal}. Then, requirements covered in \autoref{tb_quant_req} are addressed in \autoref{tb_quant_address} before implementation details are covered in \autoref{tb_quant_impl_details}. Last but not least, \autoref{tb_quant_result} details the final product of this testbench. Actual usage of the testbench will be covered in \autoref{impl} as it will be used to evaluate the project's own score following approaches. \section{Main Goal} \label{tb_quant_maingoal} The main goal of this quantitative testbench is to provide a wide range of quantitative metrics suitable to assess and compare various types of score followers for different applications and music genres. \section{Addressing Requirements} \label{tb_quant_address} \subsection{Open-source} The open-source nature of the testbench would encourage adoption and research reproducibility. This testbench is publicly available under the GPLv3 Licence on GitHub\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}}. \subsection{Flexible Score Follower API} \label{tb_quant_scofo_api} The output required from a score follower required by the testbench is the alignment output produced after the follower completes a full following of a piece of music. The only requirement for the score follower is that it must be able to produce \textit{note onset detection data} of the followed piece of music. Note onsets are the primary feature of interest for score followers; hence, most--if not all--score followers produce this feature as an output. Audio-to-symbolic (especially audio-to-score) and symbolic-to-symbolic score followers can be trivially tweaked to produce such an output, whereas audio-to-audio-based systems would require some annotation in the followed audio that maps auditory note onsets to the score, which is almost always made available \cite{arzt16}. The project's approach is based on the format proposed by the original MIREX evaluation standards \cite{cont07}. The ID field, however, is not used, nor is the special score format--these are useful only for the private dataset. Instead of using the ID field to match notes in the dataset with notes in the follower's alignment output, the note onset time and the MIDI note number are used--this pair of values uniquely identifies every note sufficiently. Note that this is only \textit{sufficient}--some instruments like the violin are capable of producing two identically pitched notes at the same time, but this poses no problem to score followers: both notes can still be treated as a single note onset. Moreover, as the note onset time in the MIDI is a floating-point value, different programs may output the onset time in varying precision. This is handled by introducing a small search bound (set by default to $\si{1\milli\second}$) defined as such: \begin{definition}[Score note search bound] The score note search bound, $\delta_s$ is a parameter that forms a search window of width $\delta_s$ to match note onset times obtained from score followers to note onset times specified in the score datasets. This search is done efficiently and uses an algorithm similar to the solution to the problem defined in \Cref{def:closesttimestamp}; see \autoref{sec:efficient_marker_position} for more information. \label{def:bound_ms} \end{definition} In the proposed format, each line in the file denotes a detected note onset and comprises four columns: \begin{enumerate} \item \texttt{est\_time}: $t_e$, the estimated note onset time in the performance audio file ($\si{\milli\second}$, float) \item \texttt{det\_time}: $t_d$, the detected time relative to the performance audio file ($\si{\milli\second}$, float) \item \texttt{note\_start}: $t_s$, the note onset time in the score ($\si{\milli\second}$, float) \item \texttt{midi\_note\_num}: the MIDI note number of the note (integer) \end{enumerate} These data adequately capture not only the predicted note onset time which is core to precise score following--latency information, important for evaluating the reactivity and responsiveness of the score follower (crucial for followers targeting time-sensitive applications such as computer-aided accompaniment), are also captured. Further details on how these fields are processed are covered in \autoref{tb_quant_metrics}. Notice that this data format is also produced by music aligners--the quantitative testbench can evaluate both music aligners and score followers. Clearly, working on note onset data does not cover all score followers: eye-gaze-based and beat-tracking-based score followers do not produce such data, for instance. This is where the qualitative testbench (\autoref{tb_qual}) fills in the gaps. \subsection{Flexible Dataset API} \label{tb_quant_dataset_api} The quantitative testbench requires reference ground-truth alignments between the audio of the performance and the score. The testbench uses the MIREX reference format \cite{cont07} which is simple and flexible. The reference file format is made up of lines where each line contains data relating to a note onset. Each line contains three columns--the last two are identical to the last two columns in the score follower output required; this means that the note onset and MIDI note number pair address unique note onsets in both formats. The columns are: \begin{enumerate} \item \texttt{tru\_time}: $t_r$, the true note onset time in the performance audio ($\si{\milli\second}$, float) \item \texttt{note\_start}: $t_s$, the note onset time in the score ($\si{\milli\second}$, float) \item \texttt{midi\_note\_num}: the MIDI note number of the note (integer) \end{enumerate} Procuring reference data in this format is non-trivial--the authors of the original format kept their dataset as a privately held test set \cite{cont07}. The only publicly available dataset with such reference data is the Bach10 dataset \cite{duan11bach10}. Other publicly available datasets using different formats for the reference ground-truth alignments exist, such as the Traditional Flute Dataset \cite{tfd}, PHENICX-Anechoic dataset \cite{miron16, PHENICX} and Vienna 4x22 Piano Corpus \cite{vienna4x22}. These formats can be converted to follow the format described. The production of ground-truth alignments is known to be non-trivial. The naïve approach is to perform manual alignment entirely given a score and performance audio--this was done for the Vienna 4x22 Piano Corpus \cite{vienna4x22}. Authors of the Bach10 dataset \cite{duan11bach10} slightly automated the procedure: software was built to record and modify manually tapped beats. Musicians tapped the beats while listening to the audio file, producing a series of beats. Beat-time alignment is performed, and each note in the score file is then linearly interpolated from the detected beats to produce the reference alignment \cite{duan11bach10}. On another note, the authors of the PHENICX-Anechoic dataset \cite{miron16, PHENICX} instead performed an initial audio-to-score alignment before manually adjusting misalignments under the guidance of a pitch estimator. A more recent approach by Thickstun \textit{et al.}{} in 2020 \cite{thickstun20} uses a method analogous to DTW that temporally aligns symbolic scores and performances from the KernScores \cite{sapp05} and MAESTRO \cite{MAESTRO} datasets--this method requires minimal human intervention. To generate high-quality ground-truth alignments flexibly, this project proposes the use of a custom Approximate String Matching (ASM) aligner detailed in \autoref{impl_asm} that requires minimal human intervention. This approach exploits the increasing ubiquity of music performance music datasets (such as the MAESTRO \cite{MAESTRO} and MAPS \cite{emiya10} datasets) comprising performance MIDI and audio data captured by digital instruments. While only common for piano music now, as more research moves into instruments such as the guitar and violin, it is inevitable that such datasets will be produced for instruments besides the piano. As music datasets like the two mentioned do not contain the ground-truth alignments required, reference scores (in the MIDI format, which can be derived from the commonly used MusicXML, LilyPond and Humdrum formats) are first obtained before aligning them to the performance MIDI files to produce high-quality ground-truth alignments. As opposed to Thickstun's \textit{et al.}{}'s approach \cite{thickstun20} which limits the evaluation on piano music that intersects both the MAESTRO and KernScores datasets, this method is flexible--users can produce ground-truth alignments between any pair of corresponding symbolic performance and score data. Worse comes to worst, if reference data in this format is unavailable or intractable to produce, users can defer to the qualitative testbench (\autoref{tb_qual}) that does not require such reference data. \subsection{Wide array of Evaluation Metrics} \label{tb_quant_metrics} \Cref{tb_challenges} mentions that different score followers optimise for different applications and music. This therefore means that they also aim for different metrics to optimise. The metrics of this testbench is based on--and extended from--the original MIREX score following evaluation proposal \cite{cont07} and Thickstun's 2020 proposal \cite{thickstun20} for evaluating music aligners. It is worth noting that metrics in both papers are in turn derived from earlier audio-to-score alignment works \cite{meron01, orio01, shalevshwatz04}. From this point onwards, mathematical notation for note onset timing as defined in subsections~\ref{tb_quant_scofo_api} and \ref{tb_quant_dataset_api} is used. The notation is extended to refer to the $i$-th note onset (according to the reference score): $t_{si}$ refers to the note onset time $t_s$ of the $i$-th note in the score. Three key note-level definitions are presented. \begin{definition}[Error] The error, $e_i$, is defined as: $$ e_i = t_{ei} - t_{ri}; $$ the error is the time between the estimated note onset time and the actual performance note onset time. Score followers that require high accuracy but can sacrifice latency and reactivity, such as those used for music analysis, primarily seek to minimise this metric. \label{def:error} \end{definition} \begin{definition}[Latency] Latency, $l_i$, is defined as: $$ l_i = t_{di} - t_{ei} > 0; $$ latency is a measure of how long the score follower takes to identify the event after it deems it occurred. This metric is important for reactive and low latency systems--it shows how fast the score follower is able to process and report a note onset event. \label{def:latency} \end{definition} \begin{definition}[Offset] Offset, $o_i$, is defined as such: $$ o_i = t_{di} - t_{ri}; $$ the offset denotes the lag between the reporting of the detection and the time the event actually occurred. This is particularly important for systems that need to react quickly to note events, such as those in computer-aided accompaniment systems. \label{def:offset} \end{definition} Next, notes that are deemed ``incorrect'' are classified. \begin{definition}[Missed notes] Missed notes are defined as events that exist in the reference but are not recognised. \end{definition} \begin{definition}[Misaligned notes] Misaligned notes are recognised notes that are too far (the \emph{misalignment threshold} is usually set to $\theta_e = \si{300\milli\second}$, but is a configurable parameter in this testbench) from the reference onset, i.e. $$ |e_i| \ge \theta_e. $$ \label{def:misalign} \end{definition} The acceptability of missed or misaligned notes once again depends on the application of the score follower. Let the total number of reference notes, missed notes and misaligned notes be $n$, $n_m$ and $n_e$ respectively. Computer-aided accompaniment followers would be ``lost'' and produce bogus accompaniment if the \textbf{miss rate} $r_m = \frac{n_m}{n}$ (the percentage of missed score onsets) or the \textbf{misalign rate} $r_e = \frac{n_e}{n}$ (the percentage of misaligned score events) are not low enough. Followers for APT could afford a higher miss rate, as long as the notes near the page turning or scrolling position are not missed or too misaligned. Further, a metric is introduced to measure how far a score follower is capable to follow a piece: \begin{definition}[Piece completion] Piece completion, $p_e$, is the percentage of non-misaligned notes followed. All robust score followers should aim to have almost perfect piece completion scores. \label{def:pc} \end{definition} Building from the error, latency and offset metrics defined above, more useful ``global'' metrics are derived for \textit{correct}, i.e. non-misaligned notes, that can be used to compare score followers. The \textbf{standard deviation of error}, $\sigma_e$, and \textbf{mean absolute error}, $\text{MAE}$, are calculated as $$ \sigma_e = \sqrt{\frac{\sum e_i^2}{n}} ~ \forall i ~\text{where}~ |e_i| \leq \theta_e $$ and $$ \text{MAE} = \frac{\sum |e_i| }{n} ~ \forall i ~\text{where}~ |e_i| \leq \theta_e $$ respectively. These two metrics show the spread and absolute mean of the overall error. The MAE is also known as the \textbf{mean imprecision} $\mu_e$. The \textbf{precision rate}--the most common metric used to compare score followers in the MIREX evaluation--is simply $$r_p = 1 - r_m - r_e.$$ For testbench runs across a suite of pieces, two overall metrics related to the precision rate are the \textbf{piecewise precision rate} $r_{pp}$ and \textbf{total precision rate} $r_{pt}$ which respectively denote the average precision rates across the group of pieces and the percentage of correctly aligned score events across the whole group of pieces. Also reported are the \textbf{mean latency} ($\mu_l$), \textbf{standard deviation of latency} ($\sigma_l$), \textbf{mean absolute offset} ($\text{MAO}$) and \textbf{standard deviation of offset} ($\sigma_o$) for non-misaligned notes. Being an extension of MIREX metrics, results produced by MIREX evaluations can be compared to the metrics proposed here. The reporting of all the proposed metrics in a clear and concise manner encourages a holistic overview on the performance of score followers. \section{Implementation Details} \label{tb_quant_impl_details} \subsection{Choice of Language} Choosing the language for implementing the quantitative testbench was relatively straightforward. Python\footnote{\url{https://www.python.org/}} was chosen--similar to Thickstun \textit{et al.}{}'s \cite{thickstun20} approach. The heavy mathematical nature of the quantitative testbench benefits from Python's wide library of numeric packages, such as \texttt{numpy}. In addition, in recent years, Python is widely used in the scientific community--recent score followers also started to move away from proprietary frameworks in favour of Python \cite{henkel19,dorfer18}, in part due to the ease of applying Machine Learning on the score following problem via the many Machine Learning tools built for Python. Python is also simple and easy to learn, leading to wide usage inside and outside the scientific community as users need not worry about nits in software development--they can focus more on the core logic and intent of the program. This wide acceptance adds to the benefit that the source code of the testbench can be easily understood--and even extended--by users. While Python lacks in speed \cite{benchmarksgame}, note that the running of the testbench is not time sensitive and that the runtime of the testbench is linear time with respect to the number of notes in the score. Further, in practice, testbench runs are multitudes faster than real time. More of Python's benefits are covered in \autoref{impl}--Python is extensively used to prototype this project's score followers. \subsection{Engineering Practices} \label{tb_quant_bettereng} Python is a dynamic and weakly typed interpreted language. This implies that Python programs may be hard to maintain especially as projects age and grow; for instance, not knowing what \textit{type} is valid for a variable makes mistakes (e.g. mistakenly assigning strings to \texttt{est\_time} which is supposed to take an integer) hard to avoid in the long run. To counter Python's weaknesses, a three-part strategy is used: static analysis, code testing and automated testing. Firstly, \texttt{mypy}\footnote{\url{http://mypy-lang.org/}}, a static type checker, is used to statically analyse the source code, catching statically analysable errors before they bubble into runtime errors that are more difficult to fix. The code is also generously annotated with types in Python's \texttt{typing} module, which not only assists \texttt{mypy} in producing better static checks--these annotations also make it easier for users to understand the code, helping users produce better code changes. Further, the code is extensively tested (via Python's \texttt{unittest} feature), which includes mocking testbench runs, to ensure that results the testbench deliver are reliable. Many edge cases (such as empty scores) are covered to make sure they behave properly, saving valuable debugging time by preventing these errors from arriving at runtime. Finally, GitHub Actions\footnote{\url{https://github.com/features/actions}} is used to run automated tests, including unit tests and mock testbench runs. This adds another layer of protection--contributors may sometimes forget to run tests after making code changes, and this layer would prevent bugs and regressions from arriving in the code. In addition, developers develop on different types of machines--having a central workflow running tests on a baseline environment (Ubuntu 20.04) ensures clear signal of test results in code changes (it is, however, worth noting that the solution is designed to be runnable on all Python 3-capable environments). \section{Resultant Product} \label{tb_quant_result} \subsection{Open-source Repository} The testbench is released publicly under the GPLv3 Licence on GitHub\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}}. \subsection{Usage Guide} The README\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench/blob/main/README.md}} of the repository shows a detailed usage guide of all features in this testbench. The repository for the score follower to be introduced in \autoref{impl_dtw}\footnote{\url{https://github.com/flippy-fyp/flippy}} also demonstrates usage of this testbench. \subsection{Tools} Besides offering the features discussed in this chapter, convenience tools are provided--these include: \begin{enumerate} \item \textbf{ASM Score Aligner}. This aligner produces testbench reference data from performance and reference scores, as described in \autoref{tb_quant_dataset_api}. The algorithm is fully detailed in \autoref{impl_asm}. \item \textbf{MIDI to Score Converter}. This converter takes in MIDI files and outputs a score format with each line comprising two columns representing each note's start time (\si{\milli\second}, float) and MIDI note number respectively. This converter makes it convenient to extract note onset details from MIDI files. \item \textbf{MusicXML to MIDI/Score Converter}. This converter takes in MusicXML files and is capable of extracting MIDI data out of the file (described in \autoref{scofo_mdr_musicxml}). This MIDI data can also be converted into the score format described above (effectively, the MIDI output is piped into the MIDI to Score Converter). \item \textbf{Score to MIDI Converter}. This converter is the opposite of the MIDI to Score Converter. \item \textbf{Reference Score to MIDI Converter}. This converter takes a file containing a score of the reference format described in \autoref{tb_quant_dataset_api} and outputs a MIDI file. The first column (\texttt{tru\_time}) is used as the note onset time in the MIDI. \end{enumerate} \subsection{Reproduction Suite} \label{tb_quant_repro_suite} A reproduction suite is provided to not only demonstrate actual usage of this testbench, but also to reproduce results of the ASM score aligner to be introduced in \autoref{impl_asm}. \chapter{Preliminaries} \label{tb_preliminaries} \epigraph{\itshape The only way to judge art is to wait and see if it becomes evergreen. This takes a bit of time.}{Andrea Bocelli} As part of the effort to propose fairer and better evaluation testbenches for score followers, the challenges in evaluating followers are identified in \autoref{tb_challenges} before lessons are taken from MIREX's limited success in \autoref{tb_mirex_limited}. Subsequently, other evaluation methods used in the literature are studied in \autoref{tb_literature}. Finally, main requirements sought to be captured in this project's score following evaluation approach is detailed in \autoref{tb_requirements}. It is worth noting that music alignment testbenches may be used to evaluate score followers as well: the completed following data can be fed to the alignment testbench. Hence, evaluation work is frequently shared between followers and aligners. \section{Challenges} \label{tb_challenges} Evaluation to compare score followers is challenging for multiple reasons, including but not limited to: \begin{enumerate} \item \textbf{Generalisation}. Some score followers are optimised for specific kinds of music and therefore address different sets of challenges mentioned in \autoref{scofo_challenges}. Score followers built primarily for monophonic music (most of the early work (\autoref{scofo_earlywork})) are vastly different from those capable of following polyphonic or even multi-instrumental music. Some score followers also primarily deal with certain types of ensembles or instruments, making evaluation datasets biased against trackers not built for following the instruments defined in the datasets. Optimisation areas also span into the periods of the followed music: followers trained to follow baroque music deal with challenges different from those of a follower tracking modern guitar music. \item \textbf{Application-specific Details}. The follower's primary application (among the many detailed in \autoref{scofo_apps}) also plays a role in evaluation. A score follower built for computer-aided accompaniment deals primarily with providing a natural and smooth accompaniment (and hence are better evaluated with experiments with actual performers), whereas a musical-analysis-focused follower would be better suited for quantitative benchmarks dealing with the precision of musical features such as note onsets. Followers for APT have the loosest requirements--these trackers just need to know roughly when to scroll the score or ``flip'' the digital page, implying that the margin of allowed error can be large (seconds in contrast to the milliseconds required in computer-aided accompaniment and musical analysis). \item \textbf{Musical Data Representation}. The many types of musical data representations (see \autoref{scofo_mdr}) score followers work with also pose a challenge. It would be hard to have an evaluation metric comparing score followers working using audio performance data to trackers working with captured MIDI data--transcribing the audio to MIDI for the latter tracker is a solution, but automatic music transcription is a difficult problem \cite{gowrishankar16} and would make the comparison unfair. Recent work on following sheet music images \cite{henkel19} would require a completely new methodology to evaluate as well. \item \textbf{Simulating Realistic Performance Deviations}. Many score followers propose algorithms that are robust against deviations in performance, such as skips, repeats and so on. It is hard to formulate a good and fair evaluation strategy to factor these features into the evaluation. Some authors resort to artificially inserting errors into the symbolic data of the score and synthesising the score, which would be limited by the capabilities of the synthesis software to produce performance errors that can be likened to a deviation produced by a human performer. Music datasets also often contain recordings with highly skilled performers who have lower tendencies to make mistakes. \item \textbf{Unique Score Following Systems}. Some followers completely detract from notions common in most score followers; for instance, there exists score followers that work only with beat tracking \cite{toiviainen98} or with eye-gaze detection \cite{tabone20}. Vercoe's pioneering system \cite{vercoe85} was also extended to integrate visual information. These score followers may not produce musical data common in score follower evaluation such as note onsets, or may be disadvantaged by the impracticality of running non-automated evaluations. \item \textbf{Proprietary Systems}. Most implementations of score following are kept proprietary; further, some are implemented in proprietary frameworks. Public evaluations may merely require the score follower to expose a predefined API, which could be done using a compiled binary targeted at the OS and architecture of the evaluation system (as in MIREX \cite{cont07}). Some authors also keep their evaluation datasets private as production of such datasets is tedious. All these contribute to evaluations being difficult to run and reproduce. \item \textbf{Dataset}. Producing a dataset for score following evaluation is difficult. Not only is the production of the ground-truth alignment tedious despite the possibility of using state-of-the-art aligners to help, but the sourcing of good performance data is difficult. Several datasets\footnote{Readers interested in MIR datasets can refer to \url{https://github.com/ismir/mir-datasets}.} were produced fulfilling some score following evaluation requirements \cite{duan11bach10, vienna4x22, MAESTRO}, but not all are of sufficient quality in the score following context. \end{enumerate} \section{MIREX's limited success} \label{tb_mirex_limited} All the challenges detailed in \autoref{tb_challenges} contributed to the limited success of the MIREX evaluation. MIREX's audio-to-score following evaluation proposal in 2006 \cite{cont07} is a significant step in score following research with the definition of many useful metrics; nevertheless, the primary disadvantage of it lies in the dataset. MIREX's initial dataset contains a voice and clarinet work by Mozart, a violin work by Bach and a work composed mainly for computer-aided accompaniment by Boulez. Later editions of the evaluation incorporated more works, but most remain classical music \cite{duan11bach10,miron16}. In addition, MIREX's dataset is not public, this is somewhat understandable--the effort required in creating this dataset means that the datasets are most valuable as unpublished test sets. The disadvantage in making the data completely private means that entrants could not predict how well their algorithms performed prior to evaluation--they would have to wait one year for the next edition. This is in contrast to a popular evaluation in computer vision, the Middlebury evaluation for optical flow \cite{baker07}, that has public and private dataset splits--the publicly available split is useful for initial testing and is often used to compare new state-of-the-art algorithms whose evaluation results are still pending. In addition to having no public data, the evaluation framework, which could be provided publicly without any apparent issue, is also private. While reading the proposal (\cite{cont07}) and evaluation submission page (which notes deviations from the proposal) could be sufficient to understand the evaluation methodology, having a published software framework, preferably open-source such as that in the Middlebury evaluation, would help authors understand the evaluation further and run some tests themselves to make sure they conform correctly to the evaluation API. Further, submissions are treated as a black box and the entire performance audio file is supplied \textit{a priori} to the follower. It is up to participants to indicate whether their followers are indeed aligners (and thus not cheat by using the entirety of the performance). The fact that DTW-based methods dominate recent editions of the evaluation in \autoref{scofo_recent_mirex} also suggests that the evaluation may strongly favour such approaches--this may have contributed to the fact no HMM-based methods entered despite their apparent good performances in real-life tests \cite{metronaut}. Entrants who are also the authors of private datasets submitted to the evaluation also have an unfair advantage; this likely was the reason Cont \textit{et al.}{} and Arzt \textit{et al.}{} did not enter their improved solutions--both groups contributed to private datasets used in the evaluation. The fact that the evaluation is limited to audio-to-score following (the organisers allow symbolic-to-score evaluation via MIDI-to-MIDI, but no entrants used this so far) also automatically disqualified candidates whose solutions did not conform to this paradigm. Recent entries by Bris-Peñalver \cite{orti15,alonso16,alonso17} and Rodriguez-Serrano \cite{orti15} also scored extremely high: 92.41\% and 97.43\% in the total precision scores respectively, suggesting that the evaluation may not be sufficient to discriminate top performers in new state-of-the-art approaches. It is also worth noting that these two authors are from the same research group that submitted multiple approaches, sometimes in a single year, and may have inadvertently overfitted their solution on the evaluation dataset. \section{Solutions in the Literature} \label{tb_literature} It was previously mentioned that both music aligners and score followers may share evaluation methodologies--notably the datasets. Here, research done in evaluating aligners is also covered. Score followers whose methodology detract from the norm (such as eye-gaze-based or beat-tracking-based systems) usually come up with their own evaluation methodology that focuses on the advantages of using their unique approaches \cite{tabone17, tabone20,toiviainen98,henkel19}. In fact, MIREX also runs evaluations for beat tracking systems (although not on real-time systems necessary for score following) \cite{dixon07}. Application-focused systems also usually come up with their own evaluation methods that exercise the approach in the intended area \cite{cont08,arzt16}. As mentioned, datasets for score following evaluation are difficult to produce. For performance audio data, some authors resort to constructing synthetic datasets using a synthesiser \cite{hu04, remi16, Maezawa15, meron01,orio01}. This method is convenient, but results on such data could mislead: an algorithm can perform vastly differently on human performances; \autoref{scofo_mdr} noted that synthesisers cannot capture the full expressiveness of a human performer, often producing inexpressive constant-tempo performances that can be trivially followed. Some authors appreciate this problem and turn to perturbing onsets and offsets in the score prior to synthesis \cite{ewert12, raffel16}, but these perturbations are still artificial and may not reflect those produced by a human performer. Further, a way for producing ground-truth alignments is by capturing both performance audio and symbolic data (usually MIDI) using digital instruments such as the Yamaha Disklavier or the Bösendorfer SE/CEUS. Popular and publicly available examples include the MAESTRO \cite{MAESTRO} and MAPS \cite{emiya10} datasets. Nevertheless, these datasets do not contain corresponding scores and are limited to piano music. A subpar solution for the score problem could be to randomly adjust timings of the performance transcripts--Thickstun \textit{et al.}{} \cite{thickstun20} proposed a better solution: first obtain a subset of performances from the MAESTRO dataset and subsequently pairing it with scores from the KernScores dataset \cite{sapp05}. As a matter of fact, Thickstun \textit{et al.}{} in 2020 \cite{thickstun20} proposed a solution to tackle evaluation methodologies for audio-to-score alignment. Their approach culminated in an open-source testbench suite\footnote{Available at \url{https://github.com/jthickstun/alignment-eval}.}, which could be adjusted to work with audio-to-score score followers. Improving upon metrics defined in the MIREX counterpart \cite{cont07}, the authors also introduced a visual component to the evaluation, as seen in \autoref{fig:thickstunvis}--a problem with the visualisation is that it highlights as errors deviations that are not very relevant to score following--most of the errors in \autoref{fig:thickstunvis} identified relate to mistimed note \textit{offsets}; in score following, timings of note \textit{onsets} are more important. In addition, the authors also admit that their testbench is limited to piano music that intersects both the MAESTRO and KernScores datasets. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/assets/jthickstun_alignment.png} \caption{Thickstun \textit{et al.}{}'s visualisation example to compare the piano-roll performance (top) captured by the Yamaha Disklavier to the performance-aligned score created by warping the score according to the ground-truth alignment (middle). In the comparison plot (bottom), red was used to identify missed notes and yellow to identify extra notes. This example visualises the beginning of a performance of Bach’s \textit{Prelude and Fugue in G-sharp minor (BWV 863).} Source: \cite{thickstun20}.} \label{fig:thickstunvis} \end{figure} \section{Testbench Feature Requirements} \label{tb_requirements} There can practically exist no one perfect evaluation testbench that can fairly and robustly address challenges identified in \autoref{tb_challenges} to compare score followers of all types from all eras. This project, however, proposes two open-source evaluation solutions--one quantitative and the other qualitative--that both in conjunction will address most of the issues. Most score followers will support both testbenches, with the qualitative one having a slight advantage due to a more flexible API. The main goals and then the requirements captured by the two proposals are covered. \subsection{Quantitative Testbench} \label{tb_quant_req} The main goal of the quantitative testbench is to provide a wide range of quantitative metrics for evaluating score followers. This testbench shall show a follower's precision, latency, robustness and further. The quantitative testbench shall also be the automated counterpart in the proposed pair of testbenches. \begin{enumerate} \item \textbf{Open-source}: open-source evaluation testbenches encourage high adoption rates and contribute to reproducible evaluation and research. In addition, community-driven enhancements ensure the continual improvement of the testbench. \item \textbf{Flexible Score Follower API}: the testbench should be easily extended to work with different score followers. \item \textbf{Flexible Dataset API}: instead of forcing users to use a predefined dataset as in Thickstun \textit{et al.}{}'s \cite{thickstun20} approach, users should be free to use datasets they deem suitable for the purpose of evaluating their approaches. \item \textbf{Wide array of Evaluation Metrics}: reporting multiple different metrics such as latency, delay in onset detection, misalign percentage etc. as part of a wide set of evaluation metrics gives a more holistic view of the system's performance. \end{enumerate} These requirements are covered by the implementation of the quantitative testbench in \autoref{tb_quant}. \subsection{Qualitative Testbench} \label{tb_qual_req} The qualitative testbench's main goal is to provide an interface where human users can evaluate score followers in situations more similar to where these systems will be applied. In this case, the testbench shall show a score being followed in real time. As opposed to the automated quantitative testbench, the qualitative testbench relies on the manual judgment of a human evaluator, already necessary in score followers aimed at computer-aided accompaniment among other applications. \begin{enumerate} \item \textbf{Open-source}: as proposed in \autoref{tb_quant_req}. \item \textbf{Flexible Score Follower API}: as proposed in \autoref{tb_quant_req}. \item \textbf{Flexible Dataset API}: as proposed in \autoref{tb_quant_req}. \item \textbf{Clear Visualisation}: the testbench should produce clear indication of a score being followed in real time to be judged by humans. \end{enumerate} These requirements are covered in \autoref{tb_qual} which details the project's implementation of the qualitative testbench. \part{Testbench} \label{testbench} \input{02_parts/02_testbench/chapters/01_preliminaries.tex} \input{02_parts/02_testbench/chapters/02_quantitative.tex} \input{02_parts/02_testbench/chapters/03_qualitative.tex} \chapter{Conclusion} \label{conclusion} \epigraph{\itshape Those who have achieved all their aims probably set them too low.}{Herbert von Karajan} Following the three-part structure of this report, the report is concluded by tackling the three parts one at a time. \section*{\autoref{scofo}: \nameref{scofo}} In this part a thorough review that covers score followers' applications (\autoref{scofo_apps}), basic preliminaries (\autoref{scofo_preliminaries}), challenges (\autoref{scofo_challenges}) and finally an extensive literature review (\autoref{scofo_litreview}) was presented. To the best of knowledge no such recent review was published in the literature, and new score following papers assume substantial prior score following knowledge. Moreover, it is common for new papers to only provide a literature review that covers a minimal subset of score followers related to their proposals. Hence, it is with hope that this provides readers without any significant prior knowledge of score following to be able to get up to speed with score following in the last 40 years, making their study or research on score followers much easier. In the context of this report, this part gave extensive background on the ideas and concepts discussed and developed in the other two parts--the number of references to this part is testament to the significance of the review. A challenge in this part is of course the fact that literature reviews are only up to date as of publishing, and the highly active nature of the field means that this review will be soon outdated. Where time allows, a future related effort is to instead make this review an open-source documentation webpage\footnote{Docusaurus (\url{https://docusaurus.io/}) is an easy-to-use and good option.}, where researchers can constantly update the page with more information procured from newer works, or even fill in gaps and add more detail on certain areas if there exists such a need. \section*{\autoref{testbench}: \nameref{testbench}} This part contributes two testbenches by first attempting to identify difficulties of evaluating score followers in \autoref{tb_preliminaries}. The quantitative testbench was then presented in \autoref{tb_quant} before its qualitative counterpart was detailed in \autoref{tb_qual}. Instead of attempting to come with a one-size-fits-all solution (which as mentioned in \autoref{tb_preliminaries} was quite impossible), the proposed pair of testbenches means that the score following research community could finally have open-source evaluation testbench solutions able to benchmark as many score followers as possible. The introduction of the novel way of procuring quantitative testbench data helps the community to more easily procure more quantitative datasets for benchmarking, and the \textit{QualScofo} dataset is a crucial component of the qualitative testbench. Adoption--and continuous development--of these testbenches will be a long-term challenge, but important to be surmounted to promote open and reproducible research. To this end, good engineering practices were introduced and upheld. The usage of the testbenches for score follower implementations in \autoref{impl} also served as demonstrations of the proposed testbenches. In the future, it would be interesting to use the proposed new way of creating quantitative testbench data to produce more data for benchmarking, as well as to extend the proposed \textit{QualScofo} dataset to include more musical pieces spanning a larger variety of music and performer skill levels, or to incorporate different performers' interpretations of a piece of music. \section*{\autoref{impl}: \nameref{impl}} The beat-tracking-based \textit{TuneApp Conductor} was the first score follower implementation described in \autoref{impl_beat}. User feedback indicated that it is a successful interactive feature for \textit{TuneApp}. Most importantly, it showed a viable and entertaining application of score following. Moreover, \textit{TuneApp Conductor} answered the \textit{Radio-Baton} engineering sophistication question posed in \autoref{impl_beattrack_backstory}; now that sensors that could deliver the same information as the \textit{Radio-Baton} are ubiquitous on mobile devices, a score-following-based reimplementation of the \textit{Radio-Baton} that is immensely less sophisticated is indeed possible. As conducting definitely goes beyond just indicating beats, further work in the \textit{TuneApp Conductor} can incorporate computer vision approaches, notably pose detection \cite{posenet}, in which the user's body pose is taken into account in the music performance: controlling the tempo, volume, balance and perhaps even musical texture. It is also regrettable that the MusicXML-based conductor had to be dropped--however it was mentioned that it could one day be released after optimisation. (In addition, an application that works on facial features\footnote{Leonard Bernstein conducting with only his eyebrows: \url{https://www.youtube.com/watch?v=G7_6Z33eCaY}.} would be interesting.) Further, an ASM aligner was introduced in \autoref{impl_asm} to complement the quantitative testbench (by producing high-quality ground-truth data for evaluation) and also to provide a gentle introduction for the concepts in music alignment. Results showed that the ASM aligner was robust and reliable in producing ground-truth alignments from widely available music performance datasets. Moreover, the aligner's relation to a real-time score follower was discussed, which not only helped develop ideas used in the DTW implementation, but also showed why ASM-based score followers were quickly made obsolete by their HMM- and DTW-based counterparts. As music performance datasets containing performance MIDI information mostly are for piano currently, in the future it would be interesting to evaluate the ASM aligner's ability based on datasets involving other instruments. Finally, a CQT-DTW score follower was implemented in \autoref{impl_dtw}. Evaluation results showed that the score follower performs well against four major challenges in score following detailed in \autoref{scofo_challenges}, namely \nameref{scofo_challenge_limitfe}, \nameref{scofo_challenges_perfdev}, \nameref{scofo_challenges_underspec} and \nameref{scofo_challenges_polyphonic}. Importantly, it was shown that the sliCQ CQT approach extracts significantly more reliable audio features for score following than a commonly used traditional FFT-based approach. The performance and design of the score follower were discussed at length in \autoref{impl_dtw_dicsuss}, and the potential future directions of the system were detailed in \autoref{impl_dtw_future}. \section*{Closing Thoughts} Score following is, no doubt, a challenging research topic that brings many useful applications in music practice, performance and production. The breadth and depth of knowledge required to overcome challenges to the problem are significant, encompassing the fields of music (theory and practical), mathematics (e.g. optimisation and stochastic methods), electrical engineering (e.g. signal processing, acoustical engineering and audio engineering) and computer science (e.g. computer vision, artificial intelligence and pattern recognition). These fields help bridge the gap between two infinitely complex human arts of music engraving and performance. This project, while long and extensive, is only a small, one-year foray into this field. Nevertheless, substantial work in the form of code\footnote{See \autoref{appendix_project_code_metrics} for code metrics.}--mostly open source--were written to attain the practical goals of this project in demonstrating the contributions listed in \autoref{intro:contrib}. There are myriad extensions possible to all the work done here, and it is with hope that this report helps further push the boundaries of knowledge in score following. \chapter{Challenges} \label{scofo_challenges} \epigraph{\itshape Where words fail, music speaks.}{Hans Christian Andersen} The wide and practical applications of score following detailed in \autoref{scofo_apps} and the ubiquity of powerful portable devices beg the question: \begin{displayquote} Why are score followers still not common? \end{displayquote} The apparent unpopularity is testament to the difficulty of building a robust score follower. This problem is well known in the research community \cite{sturm13,mullerdtw,dannerberg03,chen19,heijink00}. The epigraph by Hans Christian Andersen in the header of this chapter suggests that music can be seen as an extension of human expression beyond words. A more scientific insight can be derived: first, note that, on the one hand, music performance can be modelled as speech, and on the other hand, musical scores can be modelled as speech transcripts. This implies that not only there can exist cross-pollination of research and development in score following systems and their speech counterparts (which will be explored in \autoref{scofo_speechrecog}), score following's implementation challenges can be seen as a superset of those in speech recognition and tracking. It is no doubt that research in speech recognition and tracking is highly active \cite{rabiner93}. As the difficulties in speech-related research are generally easier to understand, relevant challenges in speech-related research are given to strengthen understanding of some challenges detailed below. Further, examples from two musical pieces--one for violin and the other for piano--will be drawn to explain the challenges. Contrary to popular belief shared by some authors in the field \cite{orio03,nakamuramerged14}, unaccompanied violin pieces \emph{can} be highly polyphonic. Musically informed readers might point to the highly technical works of Niccolo Paganini, but polyphonic violin music existed since Johann Sebastian Bach's time--the baroque period. Examples from Bach's \textit{Chaconne from Partita II, BWV1004} will be drawn--\autoref{fig:chaconnefirst10} shows that this piece is not an ordinary violin piece; it contains chords, rendering it highly polyphonic. Modern players usually play a chord in a technique called ``double-stopping'', i.e. playing two notes at a time with the bow, while baroque-era bows are differently shaped hence allowing the execution of such chords \cite{santos04}. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/partita/first10bars.png} \caption{The first 10 bars of Bach's \textit{Chaconne from Partita II, BWV1004}.} \label{fig:chaconnefirst10} \end{figure} The accompanying \textit{Fugue} to the previously presented \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846} is also used. While the \textit{Prelude} is low in polyphony (it is a sequence of broken \textit{arpeggios}), the \textit{Fugue} is highly polyphonic--it is written for four voices running parallel to each other. Bar 7 of that piece is shown in \autoref{fig:fuguebar7}, which shows the four voices running in parallel. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{misc/audio/welltempered/fugue/fugue-bar-7.png} \caption{Bar 7 of the \textit{Fugue} from Bach's \textit{Prelude and Fugue in C major, BWV 846}.} \label{fig:fuguebar7} \end{figure} \section{Limitations in Feature Extraction} \label{scofo_challenge_limitfe} Feature extraction is a core first step of the generic framework for score followers as covered in \autoref{scofo_generic}. Features can be extracted from the audio of the performance or its MIDI representation if the instrument is MIDI capable. It is clear that if the hardware or software responsible for extracting the feature from the performance data is limited, the subsequent procedures in the score follower would need to work with less complete data and hence come up with a match that is less ideal. Audio as mentioned in \autoref{scofo_mdr_audio} is a challenge to work with, especially if the system needs to be robust to corruption in the audio signal be it by noise, reverberation or hardware limitations. MIDI devices are more robust in this sense, but lower quality instruments producing subpar MIDI data exist. Relating to speech, speech recognition is also more difficult if the source audio is corrupted. \section{Performance Deviations} \label{scofo_challenges_perfdev} Mismatches between human performances and the corresponding score is possible and sometimes common. Music performance is, after all, a performance art subject to the infinite complexity of human expression and infallibility. Some of these deviations are unintentional, but some are not. \subsection{Unintentional Mistakes} Mistakes in performances, even at professional level, exist. This kind of deviation forms the basis of many improvements in score following (see \autoref{scofo_relatedwork}) to make systems more robust to human errors, such as unintentional note repeats, segment skips and pitch mistakes. \subsection{Intentional and Artistic Deviations} \label{scofo_challenges_perfdev_intentional} Artistic deviations stemming from musicians' expressing themselves exist--musicians could introduce temporal deviations such as variations in note onset, note duration or \textit{tempo}. To enrich the performance, musicians may also add ornaments or variations (examples include a \textit{trill}, \textit{glissando} and \textit{fioritura}) unspecified in the score. An example place where a performer can add an artistic \textit{trill} exists in the second last bar of the \textit{Chaconne}, shown in \autoref{fig:chaconnelast2}. Violinists can hold the second last note (\textit{E}) in the second last bar (marked in red and asterisk) longer and add a \textit{trill} on it to lead in to the final notes. \begin{figure}[h] \centering \includegraphics[width=0.25\columnwidth]{assets/partita/last2bars.png} \caption{The last two bars of Bach's \textit{Chaconne from Partita II, BWV1004}. The note marked in red (and also an asterisk) is a note where performers frequently add a \textit{trill} to. Also notice the \textit{fermata} symbol on the last note--this denotes ``hold''--violinists can choose however long they wish to hold that note.} \label{fig:chaconnelast2} \end{figure} There are also issues with some pieces that \emph{require} intended artistic or performance-driven deviations--the \textit{Chaconne} in \autoref{fig:chaconnefirst10} serves as a great example. In bar 1, the obvious impracticality of playing three notes is already covered (by ``double-stopping''), but another problem is that the bottom two notes (\textit{D} and \textit{E}) span the length of the two \textit{A} notes. For a bowed instrument like the violin, this is impossible to execute. Some violinists defer to shortening the first chord to the length of the first \textit{A} note, and some violinists do something called a ``rebound''--they replay the lower notes on the onset of the second \textit{A} note, to let the bottom two notes resonate further \cite{santos04}. In fact, this problem recurs frequently in the first 10 bars of the \textit{Chaconne}. In the context of speech, many professional actors also do not follow written scripts completely, and sometimes are even encouraged to improvise (which is another score following challenge worthy of separate mention in \autoref{scofo_challenge_music_improv}). A good and robust score follower therefore needs to take these intentional and artistic deviations into account, and as seen in the example above, these deviations can be very hard to track even for an experienced human expert. \section{Underspecified Musical Scores} \label{scofo_challenges_underspec} \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/partita/arpeggio.png} \caption{Bars 89-93 of Bach's \textit{Chaconne from Partita II, BWV1004}.} \label{fig:chaconnearp} \end{figure} Before beginning this section, the reader is referred to the epigraph by Hilary Hahn in \autoref{scofo_preliminaries}. Musical scores can be seen as a loose set of performance directions to the musician, similar to how some speech scripts can be merely a list of bullet points to be conveyed. Often, musical performance directions are abbreviated, and different performers may execute these directions differently. For instance, there exists different ways to execute a \textit{trill}--the most obvious is its \emph{speed}. A more extreme example again can be drawn from the \textit{Chaconne} (in fact, the \textit{fermata} symbol in \autoref{fig:chaconnelast2} is also an example), but now instead in bar 89, see \autoref{fig:chaconnearp}. Notice Bach's direction in the third beat: \textit{arpeggio}. This goes on from bars 89 to 120 and also bars 201 to 208. Bach indicated how to start the first passage by writing out how it should be performed, but it is impossible to follow this pattern for the entire passage. Numerous solutions for these \textit{arpeggios} were given by violinists, and there rarely exists any pair of professional violinists sharing the same treatment to these \textit{arpeggios} \cite{santos04}. In fact, Geminiani in 1751 \cite{geminiani1751} gave 18 systematic ways to execute \textit{arpeggios}--there is no agreed right way to execute them in the context of the \textit{Chaconne}. Thus, robust score followers must be able to track underspecified music scores and anticipate how an underspecified passage would be undertaken by a performer. There exists ``learning'' methods (see \autoref{scofo_relatedwork}) to get around this, but it is difficult for score followers to generalise to many types of underspecification. \section{Polyphonic Music} \label{scofo_challenges_polyphonic} Polyphonic music can be seen in the speech paradigm as multiple people speaking at the same time. Clearly, this is a difficult problem: recent work is still dealing with speaker identification \cite{tran20}. While it can be argued that polyphonic music is easier to deal with as the parallel voices are usually still structured (lines of melodies or harmonies should still form a lyrical sound with parallel voices), the problem of polyphonic music still remains difficult. In fact, it took over 20 years after the first publishing of the pioneering score following papers before the problem is properly tackled \cite{Dixon2005MATCHAM}, and recent approaches still strive to find new ways to address the challenge \cite{arzt16}. Polyphonic audio is difficult to deal with as multiple note events occurring at the same time leads to the notes' harmonic series to interfere. This increases the difficulty of identifying the similarity between an audio segment and its corresponding score \cite{chen19}. MIDI as a sequence of notes face a different challenge--notes come in one at a time, therefore making it difficult to determine which note of a set of parallel notes comes first based on the score. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/audio/welltempered/prelude/no-reverb-specgram.png} \caption{The spectrogram of the audio of Bar 1 of the \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846}.} \label{fig:preludespecgram} \end{figure} \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/audio/welltempered/fugue/specgram.png} \caption{The spectrogram of the audio of Bar 7 of the \textit{Fugue} from Bach's \textit{Prelude and Fugue in C major, BWV 846}.} \label{fig:fuguespecgram} \end{figure} Examples can again be drawn from the \textit{Chaconne}, a heavily polyphonic piece for the violin whose \textit{timbre} relates to many spectral features via harmonics. However, the \textit{Fugue} is instead used as it is a polyphonic piece that has a monophonic sibling (the \textit{Prelude}). The \emph{spectral analysis} of a sound signal is mentioned in \autoref{scofo_mdr_audio}. This is convenient in this case. Figures~\ref{fig:preludespecgram} and \ref{fig:fuguespecgram} show the spectrograms of the audio in Bar 1 of the \textit{Prelude} and Bar 7 of the \textit{Fugue} respectively\footnotemark. \footnotetext{These spectrograms are generated using \textit{Audacity}.} For reference, readers may find Bar 1 of the \textit{Prelude} in \autoref{fig:modern-staff-notation} and Bar 7 of the \textit{Fugue} in \autoref{fig:fuguebar7}. The spectrogram comprises two axes: the vertical axis represents frequency (in Hertz) and the horizontal axis represents time. The colour of the spectrogram contents is most intense (white) at areas in which the audio frequency at that time is the most intense. Readers familiar with the Fourier Transform could see that the spectrogram is a Short-time Fourier Transform (STFT) of the signal. \autoref{fig:modern-staff-notation} shows that even the monophonic \textit{Prelude} is already complex with many \textit{harmonic overtones} (represented by coloured lines) over the \textit{fundamental} pitches (represented by white lines). This is even more complex in the \textit{Fugue}, where numerous overtones stem from the many parallel fundamental pitches. The overtones interfere with each other, making it difficult to perform pitch-based score following. In fact, pitch detection is another field in MIR still under heavy research and development \cite{kim18}. So far, only polyphonic music stemming from one instrument was discussed, but note that polyphony from ensemble music is common--this further complicates the problem. Hence, robust score followers should be capable of following polyphonic music--produced by one instrument or many. \section{Music Improvisation} \label{scofo_challenge_music_improv} Improvisation relates to the direct creation or reinterpretation of music on the spot. Improvisation can be used as a way to respond to other people playing in a group (relevant to computer-aided accompaniment (\autoref{scofo_apps_caa})) and usually reflects the music style performed. The myriad different ways in which the \textit{Chaconne} can be performed can be considered music improvisation--performers often also add extra flair to make each performance ``special''. Interested readers may refer to Santos' 2004 work \cite{santos04} on more issues of the \textit{Chaconne} in practice and performance. The fact that even baroque violin pieces offer so much depth and breadth in musical freedom of expression (which is contrary to popular belief) implies that music from other genres and eras are also free and open to improvisation. In fact, Wang's 2017 survey \cite{wang17} demonstrated how Chinese music improvisation varies even across Chinese cities. Music improvisation already poses a challenge to human trackers--they need to be trained in the particular domain and performance style. ``Teaching'' or programming this into a score follower is difficult; however, if this is possible, it would open up new doors in computer music. Improvisation in speech is also common (a speaker may take a detour to tell a joke), but this is not a problem of wide interest in the speech community. \chapter{Literature Review} \label{scofo_litreview} \label{scofo_relatedwork} \epigraph{\itshape It is sobering to consider that when Mozart was my age he had already been dead for a year.}{Tom Lehrer} In this chapter, a summary of score following systems proposed in different eras--from pioneering work done in 1984 to recent state-of-the-art systems--is provided. In general, three eras of score following can be identified; as such, work in these three eras are segmented and presented. The first era (\autoref{scofo_earlywork}) mainly worked with pitch detection and string matching. Later, inspiration from speech recognition and advancements in statistical methods brought about approaches using Dynamic Time Warping (DTW) and Hidden Markov Models (HMMs) (\autoref{scofo_speechrecog}). Exploration in the second era went on for quite long, before researchers introduced recent methods that give new insights into the problem (\autoref{scofo_recent}). Finally, possible future directions of score following are proposed (\autoref{scofo_future}). Comparisons between all these approaches are very difficult for multiple reasons, which in part motivates testbenches introduced in \autoref{testbench}. Hence, not much focus is placed on comparing systems in this section--more focus is given to new contributions brought by each work. \textbf{A note on summary tables}: Summary tables covering notable works in the first two eras together with the works' attributes are provided. The attributes used are covered previously in chapters~\ref{scofo_apps} and \ref{scofo_preliminaries}. In these tables, the main author is named, along with the year in which the work is first published (and hence does not account for extensions). The type of each system is presented in initialised form (e.g. A-A for Audio-to-Audio). \textbf{PF} and \textbf{SF} denote the main performance feature and score feature extracted for alignment respectively (approaches clearly using a small part of a feature will not be listed with that feature). The primary alignment technique is provided, along with some notes, such as extensions. As most score followers are built for a particular purpose, its main application is also provided. \section{Early Work} \label{scofo_earlywork} \autoref{table_scofo_earlywork} provides a summary of research in this era. \afterpage{% \clearpag \thispagestyle{empty \begin{landscape \begin{table} \centering \caption{Summary of Early Score Followers (\autoref{scofo_earlywork})} \label{table_scofo_earlywork} \begin{tabularx}{\linewidth}{|l|l|l|L|L|L|L|L|l|} \hline \textbf{Author} & \textbf{Year} & \textbf{Type} & \textbf{PF} & \textbf{SF} & \textbf{Alignment} & \textbf{Notes} & \textbf{Application} & \textbf{Papers} \\ \hline Dannenberg & 1984 & S-S & Pitch & Pitch & String-matching & First definition, heuristics, heavy extensions & Computer-aided accompaniment & \cite{dannenberg84,bloch85,dannenberg88,allen90} \\ \hline Vercoe & 1984 & S-S & Pitch & Pitch & String-matching & First definition, \emph{Synthetic Performer}, ``cost'', ``learning'' & Computer-aided accompaniment & \cite{vercoe84, vercoe85} \\ \hline Baird & 1990 & S-S & Pitch & Pitch & String- and Phrase-matching & Segment definition, pre-performance heuristics & Computer-aided accompaniment & \cite{baird90,baird93} \\ \hline Puckette & 1990 & S-S & Pitch & Pitch & String-matching & \emph{EXPLODE}, jump heuristics & Computer-aided accompaniment & \cite{puckette90,puckette92,puckette95} \\ \hline Vantomme & 1995 & S-S & Temporal & Temporal & String-matching & Temporal matching via note onset and tempo & Computer-aided accompaniment & \cite{vantomme95} \\ \hline Desain & 1997 & S-S & Pitch & Pitch & String-matching & Supported by temporal structures (parallel vs. sequential voices) & - & \cite{desain97, heijink00} \\ \hline Toiviainen & 1998 & S-S & Temporal & Temporal & Beat tracking & Partial score following & Computer-aided accompaniment & \cite{toiviainen98} \\ \hline Pardo & 2001 & S-S & Temporal & Temporal & Beat tracking & Partial score following, Lead sheet following & Computer-aided accompaniment & \cite{pardo01} \\ \hline \end{tabularx} \end{table} \end{landscape} \clearpag } \subsection{The Pioneers} Score following was first presented at the 1984 International Computer Music Conference (ICMC) independently by Vercoe \cite{vercoe84} and Dannenberg \cite{dannenberg84}, initially geared towards computer-aided accompaniment. Dannenberg's initial work \cite{dannenberg84} focused on developing an efficient dynamic programming algorithm for flexible pitch matching. First, the score and audio input (which are MIDI events) are converted to strings and the best match between these strings is computed. This results in a system unsuitable for polyphonic audio produced by, for instance, a piano performance. Later on, Dannenberg's group extended the system to make it capable of handling polyphonic music \cite{bloch85}, correcting extreme mismatching \cite{dannenberg88, allen90} and detecting musical ornaments such as \textit{trills} and \textit{glissandi} \cite{dannenberg88}. Dannenberg also pioneered the idea of multiple matchers running at different locations and picking the matcher with the least error \cite{dannenberg88}. Vercoe's work in 1984 \cite{vercoe84}, the \emph{Synthetic Performer}, used pitch detection to obtain pitches from flute performances. However, pitch detection was not fast enough; hence, optical sensors are used to obtain fingering information. Vercoe used a matching method based on a theory of ``least cost'' \cite{vercoe85}. The main idea is that a performance deviation adds to the aforementioned cost--the greater the performer's deviation, the higher the cost. For each musical event received, four theories of a predicted position are computed using variations of the cost calculated (e.g. one with a higher weighting on pitch correctness). The theory with the least cost is considered the ``best fit'', i.e. the most likely score position. A notable achievement in Vercoe's system is that it incorporates offline capabilities--Vercoe \textit{et al.}{} introduced an improvement in 1985 \cite{vercoe85}: a non-real-time statistical learning algorithm that can ``rehearse'' and ``learn'' a performance to incorporate improvements in the next performance--this notion is later more commonly known as ``training''. \subsection{Continued Work on Pitch Detection and String Matching} \label{scofo_relatedwork_early_workcontinued} Early research in score following took heavy inspiration from the pioneers and continued work on extracting pitch features and performing similarity calculations via string matching. Basing their matching methods on Vercoe's \cite{vercoe84} and Dannenberg's \cite{dannenberg84}, Baird \textit{et al.}{} \cite{baird90,baird93} devised a new matching algorithm; instead of matching on single events (i.e. individual notes), the matching is performed on segments of a predefined length. The breakthrough for this system is that these segments, as well as a set of heuristics comprising meters, key signatures and a possible tonality, are calculated and analysed pre-performance, meaning that there is an increase of the system's \textit{a priori} knowledge. The use of these data makes it possible to produce cadence points--the system's knowledge of cadential motion means it knows where phrases begin, the system can hence skip to arbitrary phrases in the event of excessive performer error. The 1990 IRCAM score following system \cite{puckette90, puckette92}, \emph{EXPLODE}, is similar to many others in that time period except for the addition of a backward-skip feature. When a live note is played, a pitched-based system matches it with a note via comparing the pitch of the live note with pitches of skipped notes. Stored backward- and forward-skip times form the boundaries within which skipped notes can be referred to. Notably, compositions with \emph{EXPLODE} in mind were created; for instance, Philippe Manoury composed \emph{En Echo} for soprano and computer. It showed the limits of \emph{EXPLODE}--Puckette \textit{et al.}{} admitted that often compromises in the composition were forced to be made to ensure the score follower could follow the performance. In 1995, extensions to the system that address some of these problems were introduced \cite{puckette95}. Though not strictly a score follower but an aligner instead, an Approximate String Matching (ASM) aligner is introduced in \autoref{impl_asm}. Readers interested in the technical background of the problem are highly encouraged to refer to that chapter. The proposed approach is intended to produce high-quality reference data for the use of the quantitative testbench, detailed in \autoref{tb_quant}. \subsection{Breaking the Mould: Using temporal features} \label{scofo_relwork_temporal} After extensive research on pitch methods and realising their limitations, researchers eventually turned to rely more on temporal features. Vantomme developed in 1995 \cite{vantomme95} a system comprising a main and a backup matching phase--the former is based on note onset and tempo (therefore making it robust when presented with incorrect pitches that were still at their expected onset), and the latter is based on pitch (similar to Dannenberg's 1984 system \cite{dannenberg84}). This two-phased system, in principle, is robust to incorrect pitches with the right rhythm; however, the system fails when many incorrect pitches are received and a call to the backup pitch-based system is required. While still mainly using pitch information, Desain and Heijink \cite{desain97,heijink00} exploited the temporal structure annotated in the score, such as voices and chords, to predict note orders in the performance. The main idea is that notes in a melodic line are unlikely to be played in a different order, but parallel voices (such as chords) can be played independently of each other. Multiple alternative matches are performed and dynamic programming is used to select the best path and hence match. An approach based entirely on rhythm was introduced by Toiviainen in 1998 \cite{toiviainen98}. An adaptive oscillator is used to track the beat of a MIDI input. This implies that a specified score can be omitted, meaning that even improvisations can be tracked as well. While a beat tracker can be used as a score follower, it is suboptimal for non-improvisation pieces as scores can be used as a reliable additional source of knowledge. \subsection{Notable mention: Partial Score Following} \label{scofo_relwork_partial} Toiviainen's 1998 approach \cite{toiviainen98} showed that score followers can even be applied on incomplete scores. Pardo and Birmingham in 2001 \cite{pardo01} took that idea further and showed a system that can follow a lead sheet, common in folk music. Their approach is inspired by gene-sequence analysis, in which gaps between alignments of chords extracted from the MIDI performance and the lead sheet are allowed. Due to limited applications in partial score following, research, while present \cite{stark12}, is less active than that in normal score following. \section{Speech Recognition's Inspirations} \label{scofo_speechrecog} The field of speech recognition is closely related to score following's as mentioned in \autoref{scofo_challenges}. Instead of working with music performance audio and musical scores, speech recognition works with speech audio and speech text. As such, many techniques between these two fields are interchangeable. As speech recognition research--heavily driven by advancements in statistical methods--grew greatly in the 1980s and 1990s, score following researchers borrowed many ideas--the two most successful being Hidden Markov Models (HMMs) and Dynamic Time Warping (DTW). First, statistical methods which culminated into the use of HMMs (\autoref{scofo_stats}) are explored before diving into DTW methods (\autoref{scofo_dtw}). See \autoref{table_scofo_speechrecog} for a summary. \afterpage{% \clearpag \thispagestyle{empty \newgeometry{top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm} \begin{landscape \begin{table} \centering \caption{Summary of Speech Recognition-Inspired Score Followers (\autoref{scofo_speechrecog})} \label{table_scofo_speechrecog} \begin{tabularx}{\linewidth}{|L|l|l|L|L|L|L|L|l|} \hline \textbf{Author} & \textbf{Year} & \textbf{Type} & \textbf{PF} & \textbf{SF} & \textbf{Alignment} & \textbf{Notes} & \textbf{Application} & \textbf{Papers} \\ \hline Grubb & 1997 & S-S & Pitch \& Temporal & Pitch \& Temporal & Statistical model & Pioneer in statistical methods & Computer-aided accompaniment & \cite{grubb97} \\ \hline Pardo & 2002 & S-S & Pitch & Pitch & String-matching & String-matching extended with statistical methods & Computer-aided accompaniment & \cite{grubb97} \\ \hline Cano & 1999 & A-S & Audio (Mostly pitch) & Note model & HMM & Pioneer in HMM & - & \cite{cano99} \\ \hline Raphael & 1999 & A-S & Audio (Spectral) & Note model & HMM & \emph{Music Plus One}, Spectral features, Viterbi algorithm alternative & Computer-aided accompaniment & \cite{raphael99,musicplusone,raphael01,raphael03} \\ \hline IRCAM (Orio, Schwarz, Cont \textit{et al.}{}) & 2001 & A-S \& S-S & Audio & Note model & HMM & \emph{Antescofo}, \emph{Metronaut} Extensions for errors, Viterbi algorithm alternative, training, Polyphonic MIDI input & Computer-aided accompaniment & \cite{cont08, oriohmm1,schwarz04, cont04, cont06,cuvillier14,donat16} \\ \hline Pardo & 2005 & S-S & Audio & Note model & HMM & Model spontaneous changes in performance & - & \cite{pardo05} \\ \hline Dixon & 2005 & A-A & Audio (Spectral) & Audio (Spectral, Synthesised) & DTW & \emph{MATCH}, Pioneer in DTW score following, improvements in DTW computation & Performance Analysis & \cite{Dixon2005MATCHAM} \\ \hline Arzt & 2008 & A-A & Audio (Spectral) & Audio (Spectral, Synthesised) & DTW & Many new ideas and improvements (polyphony, DTW computation, orchestra following) & Performance Analysis, APT & \cite{arzt08,arzt10,arzt12,arzt15,arzt16} \\ \hline \end{tabularx} \end{table} \end{landscape} \clearpag } \restoregeometry \subsection{Statistical Approaches (including HMMs)} \label{scofo_stats} Even with perfect observations in the live performance, performer errors introduce a lot of uncertainty. Therefore, it is natural to consider probabilistic methods for score following. Many early approaches (\autoref{scofo_stats_early}) explored many possibilities brought by advancements in statistics, but HMMs (\autoref{scofo_stats_hmm}) proved seminal. Statistical methods researched did not stop at HMMs--work was done on other statistical models in recent years, which will instead be treated as recent work and covered in \autoref{scofo_recent}. \subsubsection{Early Approaches} \label{scofo_stats_early} In 1997, Grubb and Dannenberg \cite{grubb97} pioneered the use of a statistical approach. The idea in this system is that the position in the score is represented by a probability density function. Observation distributions, specifying the probability of observing any possible value of a detected feature when the performer is playing this event, were defined. New score position probability densities can be calculated using the current score position probability density and the observation densities. Pardo and Birmingham in 2002 \cite{pardo02} instead used statistical methods to extend string-matching. They defined a statistical model of the transcriber error based on match probabilities; then, an alignment is calculated by dynamic programming. \subsubsection{Hidden Markov Models (HMMs)} \label{scofo_stats_hmm} Hidden Markov Models (HMMs)--ideal models for sequential event recognition (a problem score following can be modelled after)--are immensely popular in speech recognition; interested readers may wish to refer to Rabiner's article on HMMs for speech recognition \cite{rabiner89}. HMMs are also known for their applications in computational finance \cite{petropoulos16} and bioinformatics \cite{li03}. In this context, score following can be formulated as a model containing a sequence of notes in the score, comprising an \emph{observed} feature sequence extracted from the audio signal and the \emph{hidden} state sequence (which maps to the score's notes) \cite{cano99}. Methods could then be used to compute an estimation for the \emph{hidden} sequence given the \emph{observed} sequences. Further, techniques for training HMMs exist \cite{milks05}. One of the first HMM-based score followers is Cano \textit{et al.}{}'s work in 1999 \cite{cano99}. Audio features--namely energy, zero crossing and fundamental frequency--are chosen as observed emissions in the model. The note model architecture is based on three HMMs: a note, a no-note and a silence model. Note lengths are modelled with self-transitions, and the well-known Viterbi algorithm \cite{viterbi67} is used to compute the hidden states which give the alignment on the score. 1999 also saw the early publications in score following of a prominent figure in score following: Christopher Raphael. Raphael's system, first introduced in 1999 \cite{raphael99}, is similar to Cano's except that Raphael's work does not rely on pitch tracking routines--it instead emits spectral features. An alternative decoding technique is also proposed in addition to using the Viterbi algorithm. Raphael \textit{et al.}{} would go on to create the \emph{Music Plus One} \cite{musicplusone} computer-aided accompaniment system, and his research group would continue to pioneer many solutions to problems of score following and computer-aided accompaniment with and without usage of HMMs \cite{raphael01,raphael03,raphael06,raphael10}. The HMM-based IRCAM score follower (not to be confused with its predecessor \emph{EXPLODE}), which eventually developed into \textit{Antescofo} \cite{cont08} and a startup named \textit{Metronaut}\footnote{\url{https://www.antescofo.com/}} providing computer-aided accompaniment applications, is based on Raphael's system. Orio and Dechelle in 2001 \cite{oriohmm1} extended Raphael's system by taking performer's errors into account via the introduction of ``ghost states'' corresponding to local mismatches. Instead of the Viterbi algorithm, another algorithm applied in molecular genetics is used, showing improvements in delay time and robustness in errors. A training method for the HMMs was also proposed. Further, in 2004, Schwarz \textit{et al.}{} \cite{schwarz04} showed how the system can be used with polyphonic MIDI data instead of the audio signal of the performance. Cont \textit{et al.}{} in 2004 and onwards \cite{cont04,cont06,cont08,cuvillier14,donat16} further extended the system, which is often regarded as the state-of-the-art score follower in its time. An interesting problem which can be solved by HMMs is the modelling of the possibilities of musicians' spontaneous change in performance, e.g. leaving out a repetition or repeating a part albeit not noted in the score. This idea was proposed by Pardo and Birmingham in 2005 \cite{pardo05}. Further studies in HMM-based score following up to recent times exist \cite{montecchio08,nakamura14,nakamuramerged14,sagayama14,hori19}, but they mainly dealt with improvements and extensions, such as training methods and better robustness to polyphonic music and mistakes, to pre-existing systems detailed here. \subsection{Dynamic Time Warping (DTW)} \label{scofo_dtw} DTW is a technique for aligning time series--a general introduction to DTW is provided in \cite{mullerdtw}, and a deeper technical background to DTW in the context of score following is given in \autoref{impl_dtw_tech}. DTW is not only used in speech recognition (where it is first introduced) \cite{rabiner93} and score following--it is also used for gesture recognition \cite{gavrila96}, handwriting recognition \cite{niels05} and score following's sibling: music alignment \cite{chen19,muller06,orio01}. In fact, a lot of music alignment approaches use DTW--this is due to the fact that music alignment allows the use of the entire performance audio, meaning that DTW can directly compute the global optimal match of the performance audio to the audio generated from the score \cite{chen19}. Also, note from here that DTW is in principle an audio-to-audio system. Further, DTW can be seen as a special case of HMMs--the cells of the distance matrix correspond to the states and the distances serve as output probabilities for a given state \cite{durbin98}. The primary computation in DTW is the \emph{minimum cost path} given a \emph{cost matrix}. Often, global path constraints such as the Sakoe-Chiba bound \cite{sakoe78} and Itakura parallelogram \cite{itakura75} are used to reduce the quadratic complexity of this computation. The pioneer of applying DTW in score following, Simon Dixon and Gerhard Widmer, extended the idea of such bounding in their 2005 score following work \emph{MATCH} \cite{Dixon2005MATCHAM}, resulting in a linear-time algorithm. Dixon and Widmer also proposed an interesting approach for extracting audio features--the method results in a low-level spectral representation generated via a windowed Fast Fourier Transform (FFT)--this is in contrast to some approaches in music alignment, such as Dannenberg and Hu's 2003 method \cite{dannerberg03} that uses a chroma representation of 12 elements (each representing the spectral energy corresponding to a pitch class). Following that, the spectral data is mapped into 84 frequency bins, linear at low frequencies and logarithmic at high frequencies to reduce the data and simulate the linear-log frequency sensitivity of the human auditory system. Arzt \textit{et al.}{} from 2008 took upon Dixon and Widmer's work and further improved it in many stages \cite{arzt08,arzt10,arzt12,arzt15}. Arzt's thesis in 2016 \cite{arzt16} provides a great summary of these improvements, which involve running multiple trackers simultaneously, introducing backtracking heuristics, using tempo models and computing adaptive distances. All these improvements contribute to a DTW algorithm that is robust--i.e. the minimum cost paths computed at the middle of the piece does not deviate too far from the ideal global minimum--and able to follow polyphonic and even orchestral music. More advancements in DTW are found in music alignment--examples include a three-dimensional DTW solution proposed by Wang \textit{et al.}{} \cite{wang15} that extends the 2-D \textit{cost matrix} into a 3-D \textit{cost tensor} capable of incorporating two performance sequences (which could be melody and accompaniment) to make it robust against asynchronies between musical voices in score-performance alignment. Recent papers working on DTW score following mostly involve improvements of Arzt \textit{et al.}{}'s work \cite{rodriguez16} or its applications in more contexts \cite{brazier20,lin20}. An interesting note is that all high-performers in the MIREX evaluation use advanced approaches involving DTW, see \autoref{scofo_recent_mirex}. \section{Recent approaches} \label{scofo_recent} While some researchers again took inspiration from advancements in existing work to form new approaches (such as combining other methods with existing work, common in top performers in the MIREX evaluation (\autoref{scofo_recent_mirex}) or using other stochastic approaches beyond HMMs (\autoref{scofo_stochastic})), more recent takes of the score following problem take on new paradigms and methods, some fuelled by recent advancements in Machine Learning (\autoref{scofo_sheetmusicimages}). As these approaches cover more recent and complicated methods that would require more technical background than this report can provide, references to good sources are left for the interested reader. \subsection{MIREX Evaluation: Top Performers (2010-2020)} \label{scofo_recent_mirex} As research interest grew in the area, there came a need for standardised evaluation for different algorithms. Since 2006, as part of the Music Information Retrieval Evaluation eXchange (MIREX) \cite{mirex}, annual evaluations for score following systems were held. The evaluation procedure consists of running score followers on a database of aligned audio to scores where the database contains the score, performance audio and a reference alignment \cite{cont07}. Unfortunately, the evaluation procedure is rather opaque (all links to sample data in the evaluation are now inaccessible), and it has evolved a lot in the early years to render early evaluation results (these were run on very few systems from 2006 to 2009 anyway) incomparable to those of later evaluations. Throughout the running of the evaluation, very few authors submitted their algorithms. From 2018 to 2020 no submissions were received. Further difficulties of running such evaluations (and evaluating score following in general) are covered in \autoref{testbench}--a discussion on the limited success of MIREX is provided in \autoref{tb_mirex_limited}. Nonetheless, it is interesting to study methods attaining stellar evaluation scores between 2010-2020 when evaluation methods somewhat stabilised. \autoref{table:scofo_recent_mirex} summarises methods scoring $\geq 70\%$ in the total precision score, the main evaluation metric for runs in the period showing precision across all the evaluated musical pieces. Authors who submitted more than one variant of an algorithm throughout the period will have their highest-scoring submission reported. Note that all high-performing algorithms covered here are DTW-based (\autoref{scofo_dtw}). These systems found improvements mostly in feature extraction, such as using both MIDI and synthesised score data for more score features to operate on \cite{orti15}, or by working on another feature extracted from audio, such as chromagrams \cite{suzuki10}. Worth noting is that Rodriguez-Serrano, Carabias-Orti and their group went on to found \textit{Beatik}\footnote{\url{https://www.beatik.com}}, a company that provides a mobile APT application. It is perhaps surprising that HMM-based methods were not seen here--that is due to the fact that no HMM-based methods entered. Only one stochastic model was submitted \cite{duan10}, which was an experiment for state-space models (see \autoref{scofo_stochastic}) scoring $49.11\%$--the relevant authors did not resubmit their work after improving it in \cite{duan11,li16}. Outside the 2010-2020 era, there exists two HMM-based method submissions, in 2008 \cite{montecchio08} and 2006 \cite{cont06}. It is interesting that 2006's running which has only two submissions featured Dannenberg's \cite{dannenberg84} original string-matching algorithm (which was significantly outperformed by Cont's 2006 HMM method \cite{cont06}). Cont \textit{et al.}{}'s research team continued to improve their HMM-based system (and in fact they also contributed to the running of this evaluation \cite{cont07}), but there is no apparent reason why they did not continue submitting improvements in their work \cite{cont08,cuvillier14,donat16}. On the same note, Arzt \textit{et al.}{} submitted only one DTW-based algorithm in 2010 (scoring $50.84\%$) \cite{arzt10}, and did not submit their improved work \cite{arzt12,arzt15,arzt16}. \afterpage{% \clearpag \thispagestyle{empty \begin{landscape \begin{table} \centering \caption{Summary of High-Performing (Total Precision $\geq 70\%$) Methods of the 2010-2020 MIREX Score Following Tasks (\autoref{scofo_recent_mirex})} \label{table:scofo_recent_mirex} \begin{tabularx}{\linewidth}{|L|l|l|L|L|L|L|L|l|l|} \hline \textbf{Author} & \textbf{Year} & \textbf{Type} & \textbf{PF} & \textbf{SF} & \textbf{Alignment} & \textbf{Notes} & \textbf{Papers} & \textbf{Score} \\ \hline Bris-Peñalver & 2017 & A-A \& A-S & Audio (Spectral) & Audio (Spectral) \& MIDI (States) & DTW & Utilises DTW to estimate Real State Sequences & \cite{orti15,alonso16,alonso17} & $92.41\%$ \\ \hline Rodriguez-Serrano & 2016 & A-A \& A-S & Audio (Spectral) & Audio (Spectral) \& MIDI (Score Information) & DTW & Uses Non-negative Matrix Factorisation (NMF), a low latency signal decomposition method and finally DTW. & \cite{orti15} & $97.43\%$ \\ \hline Carabias-Orti & 2013 & A-A \& A-S & Audio (Spectral) & Audio (Spectral) \& MIDI (States) & DTW & Introduces usage of Non-negative Matrix Factorisation (NMF) & \cite{carabias12} & $86.70\%$ \\ \hline Suzuki & 2010 & A-A & Audio (Chromagram) & Audio (Chromagram) & DTW & Extracts sum of chroma and delta chroma vectors from audio & \cite{suzuki10} & $73.97\%$ \\ \hline \end{tabularx} \end{table} \end{landscape} \clearpag } \subsection{Stochastic approaches beyond HMMs} \label{scofo_stochastic} Duan and Pardo in 2011 \cite{duan11} first showed the application of non-HMM state-space models \cite{koller09} in score following, which is improved and further applied in 2016 by Li and Duan \cite{li16}. This approach uses a 2-D state vector to model the underlying score position and tempo of each time frame in the audio performance. They found that a multi-pitch based audio frame model worked well in conjunction with particle filtering to infer the hidden states from observations. Another class of stochastic modelling methods, conditional random fields (CRFs) \cite{lafferty01}, was employed by Shinji, Yamamoto \textit{et al.}{}'s group in their 2013 and 2014 papers \cite{shinji14,yamamoto13}. In these works, the music performance is modelled by CRFs, allowing the usage of the delayed-decision Viterbi algorithm which utilises future information to determine past score positions reliably. Particle filtering (also known as Sequential Monte Carlo (SMC) methods) \cite{doucet09}--a minor role in Li and Duan's method \cite{li16}--is used as a primary method in three methods proposed in 2011-2013 \cite{otsuka11,montecchio11,korzeniowski13}. The main idea of particle filtering is that the hidden state can be continuous instead of discrete like in HMMs. Particle filtering approaches are also capable of modelling both audio-to-audio and audio-to-symbolic score following systems. \subsection{Paradigm Shift: Sheet Music Images} \label{scofo_sheetmusicimages} There exists other unique recent approaches outside the areas covered until this point \cite{jiang19, noto19, macrae10} such as integrating eye-gaze information \cite{noto19} or following different score formats \cite{macrae10}, but none are as ground-breaking as this paradigm shift. So far, all the methods described take in score information via MIDI, MusicXML or another similar format. An issue is that, often, MIDI or MusicXML representations are not available. Optical Music Recognition, OMR, can be used to convert scanned or image-based sheet music into these formats, but the faithfulness of the symbolic score to what is depicted on the sheet image strongly depends on the OMR system \cite{henkel19}. Gerhard Widmer's group at JKU Linz took another hard look at score following in 2016: this resulted in Matthias Dorfer \textit{et al.}'s 2016 paper on preliminary work for score following using sheet music images \cite{dorfer2016}. The authors proposed a multi-modal deep neural network to predict the position within a sheet snippet based on an audio excerpt. As part of this effort, the Multi-modal Sheet Music Dataset (MSMD) \cite{dorfer17} was created. Moreover, further work by the research group in 2018-2019 culminated in formulating score following as a reinforcement learning (RL) \cite{kaelbling96} problem \cite{dorfer18,henkel19}, where the RL agent's task is to adapt its reading speed in an unrolled sheet image conditioned on an audio excerpt. Henkel \textit{et al.}{} in 2019 \cite{henkel19unet} sought to solve a limitation in previous approaches: the scores were required to be represented in an unrolled form. Henkel \textit{et al.}{}'s 2019 work introduced a system that directly infers positions within full sheet images for monophonic piano music by treating score following as a \emph{referring image segmentation task}, but the system neglects the temporal aspect of score following. The authors' continuation work in 2020 \cite{henkel20} builds upon that foundation and incorporates long term audio context, proposing the first fully capable score following system working on entire sheet images without needing preprocessing steps. This data-driven approach, while exceptional, is still subject to limitations of the dataset used. The dataset unfortunately only contains synthesised, constant-\emph{tempo}, music; demonstrations of Henkel \textit{et al.}{}'s system on real performances show that the system has generalisation issues. Further, tests on scanned sheet music were not performed. To alleviate the problem of generalising to real-world audio, Henkel and Widmer in 2021 \cite{henkel21} applied \emph{Impulse Responses} (IRs) as an audio data augmentation technique, allowing the modelling of different recording conditions in the form of microphone and room characteristics. Further, the 2021 work, in contrast to the 2020 work \cite{henkel20}, treats score following as a \emph{bounding box regression task} instead of an image segmentation task. This means that the network predicts the coordinates as well as the width and height of the bounding box that matches the performance audio \emph{query}. While the 2021 work performs reasonably well with some real-world audio, it did not address the problem of generalising in the sheet-image domain. Besides, applying IRs to augment data only aids the network to generalise to different recording characteristics, not to performance deviations as discussed in \autoref{scofo_challenges_perfdev}. A better audio augmentation method would be to use more powerful DSP elements (such as filters, oscillators, reverberation etc.) to augment data, such as those presented in \cite{engel2020ddsp}. \section{Possible Future Directions} \label{scofo_future} The myriad papers published by authors since the pioneering pair in 1984 show how challenging and active the field of score following is. Also, note that the list of challenges in score following in \autoref{scofo_challenges} is extensive but not exhaustive. From the years of work, it is clear that score following is a multi-paradigm problem, requiring expertise from different fields outside of music technology and computer science. Advanced statistical methods, speech recognition ideas, signal processing techniques, machine learning and even computer vision approaches can play a part in solving this problem. It is important to note that even the best approaches contain future work and discussion sections. For instance, there is growing interest in audio preprocessing to improve the audio quality (e.g. via dereverberation \cite{naylor10} and denoising \cite{ghias95}) before audio is fed into the system. Further, newer approaches that learn from data can benefit from bigger and better datasets encompassing a wide range of music and performances \cite{dorfer17}. Existing systems and algorithms can also be further improved and extended via using new audio feature extraction methods \cite{holighaus13}; this project proposes a new method covered in \autoref{impl_dtw}. Moreover, evaluation and benchmarking of algorithms still pose a huge challenge, in which \autoref{testbench} will attempt to contribute solutions to. Novel algorithms in this field will no doubt require research teams with expertise in a wide range of techniques; moreover, they will also need to keep up with advancements in related fields. For instance, quantum computing's increased power (quantum image processing (QIP) is already a budding field \cite{qip}) might bring about a paradigm shift in this problem. As music engraving and performance are fine arts subject to the infinite complexity of humans, score following will likely never have a ``perfect'' solution. This implies that score following systems can always be further improved. \chapter{Applications} \label{scofo_apps} \epigraph{\itshape Creation exists only in the unforeseen made necessary.}{Pierre Boulez} A review of score following would not be complete without a foray into its practical applications in music practice, performance and production. Further, many score followers--in research or industry--are built for a specific application; thus, knowing the primary goal of a score follower helps give an overview of the problems the authors target. Here, notable applications of score followers are delineated with comprehensive background details for the problems to be solved. \section{Automatic Page Turning (APT)} \label{scofo_apps_apt} The problem of sheet music page turning for musicians while their hands are preoccupied with playing a musical instrument is well known. In piano performances, a common sighting is that of a human page turner who assists the pianist. However, the vast majority of playing time is actually during practice sessions where the employment of a page turner would prove impractical. The appreciation of the problem reflects well on the myriad commercial solutions that exist. While systems that operate on physical paper sheet music exist, these mechanical systems are impractical as they need to balance the speed of turning the page with the relative fragility of the paper to not tear the paper \cite{wolberg12}. Thus, solutions working on digital sheet music are more common. These solutions can be divided into two categories: \begin{enumerate} \item \textbf{Manual page turners} require user input to trigger a page turn. For instance, \textit{AirTurn}\footnote{\url{https://www.airturn.com/}} provides a foot pedal system, requiring the user to use their foot on the Bluetooth-powered pedal to trigger a page turn on a primary (usually tablet) device. A solution requiring no dedicated hardware, \textit{TuneApp}\footnote{\url{https://www.tuneapp.com/}}, operates similarly using any pair of web-enabled devices, with either touch or motion detection available as a trigger on the second device. These solutions, however, are not suitable for musicians playing instruments with foot pedals, such as organs. It is worth noting that \textit{TuneApp}, not limited by the range of Bluetooth, could lead to a solution where a human page turner could be offstage. These solutions do not fully solve the page turning problem; hence, automatic page turners are more desirable. \item \textbf{Automatic page turners} such as \textit{ClassicScore}\footnote{\url{https://blog.naver.com/earthcores/}}, \textit{MobileSheets}\footnote{\url{https://www.zubersoft.com/mobilesheets/}} and \textit{Musicnotes}\footnote{\url{https://www.musicnotes.com/apps/}} employ a score-scrolling feature. In \textit{ClassicScore}, the rate of the scrolling is determined from the tempo of a prerecorded playback of the music. \textit{MobileSheets} and \textit{Musicnotes} are similar, with the addition of the ability to adjust the performer's preferred speed. Notably, three score following applications exist: \textit{PhonicScore}\footnote{\url{https://www.phonicscore.com/}}, \textit{Beatik}\footnote{\url{https://www.beatik.com}} and \textit{Tido}\footnote{\url{https://www.tido-music.com/}}; however, real-life tests of these systems show that they are unreliable due to their susceptibility to noise \cite{arzt08}. \end{enumerate} Besides commercial solutions, there exists literature in the area that propose better approaches for APT. Eye-gaze tracking systems can actively monitor the musician's on-screen point of regard and turn or scroll pages \cite{tabone17}; however, musicians often look away from the score and toward their hands and elsewhere, leading to the requirement of an eye-gaze prediction model that adds to the computational complexity of the system while still being imperfect \cite{tabone20}. Moreover, eye-gaze systems have no other viable areas of application in the musical context, in contrast to score followers' wide range of applications. The requirements of an ideal page turning system, mainly supporting operation without additional gestures and being robust to errors or performance improvisations of the musician, strongly motivates the use of a score following system robust to performance deviations. \autoref{fig:arzt-pageturner} shows an APT system comprising a mechanical page turning device developed by the Viennese company \textit{Qidenus}\footnote{\url{http://qidenus.com/technologies/}} extended by Andreas Arzt to work automatically with a score follower system \cite{arzt16}. The work was demonstrated on a documentary shown on BR Alpha in January 2010. \begin{figure}[h] \centering \includegraphics[width=0.5\columnwidth]{assets/page-turner-arzt.jpg} \caption{Arzt's page turner shown in a documentary. Source: \cite{arzt16}.} \label{fig:arzt-pageturner} \end{figure} \section{Computer-aided Accompaniment} \label{scofo_apps_caa} Many live performances are performed accompanied or in ensembles. Musicians are trained to play their instruments in correspondence with others, even if the performance includes uncertainties in and deviations from the musical score. A computer-aided accompaniment system usually comprises an audio-to-symbolic score follower to follow the performance in real time while producing accompaniment music. \autoref{fig:caa} shows a generic structure for a computer-aided-accompaniment system--comprising a score follower--acting as a pianist in a violin-piano duet. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/computer-aided-accompaniment/caa.png} \caption{Structure of a computer-aided accompaniment system accompanying a human violinist as a pianist.} \label{fig:caa} \end{figure} In fact, the earliest score followers in 1984 were built as computer-aided accompaniment tools \cite{vercoe84,dannenberg84}. Music composers such as Manoury and Boulez among others composed music for such systems--these music performances involve electronically generated music synchronised (via basic score followers) with human-generated music \cite{tissot08, cont08}. However, early composers in these experiments are often forced to make compromises so that their music is followed in such a way that the electronic events in the score are correctly triggered \cite{puckette92}. More advanced score following systems would be capable of even richer, accurate and flexible interactions in live performances \cite{musicplusone, cont08, dannenberg06}. While trained musicians' accompaniment skills--including sensitivity to performance details from basic ones such as rhythm, volume and pitch to advanced ones like amount of breath and bow length left--are difficult for computer-based systems, the latter systems have nearly unlimited technical facility, allowing the coordination of arbitrarily fast notes and complex rhythms. Exploiting this advantage, Jack Beran and Nick Collins composed pieces with complex computer-based accompaniments for the \textit{Music Plus One} music accompaniment system \cite{musicplusone}. Commercial solutions providing computer-aided accompaniment exist too, such as \textit{CueTIME}\footnote{\url{https://hub.yamaha.com/cuetime-the-software-that-follows-you/}} and \textit{Metronaut}\footnote{\url{https://www.antescofo.com/}}. \textit{CueTIME} unfortunately works only on certain digital Yamaha keyboards, via aligning keying information to synthesised accompaniment music. \textit{Metronaut} is a relatively new solution (born in IRCAM--see \autoref{scofo_stats_hmm}) capable of following performance audio, but the system is limited to musical pieces (which are preprocessed manually) contained in its library. Computer-aided accompaniment systems are widely studied in research--in fact it motivated many early approaches to score following detailed in \autoref{scofo_earlywork}. Moreover, literature proposing more advanced systems based on score following for a wide array of instruments and genres exist \cite{xia17, hoffman11, kaliakatsos12, xia15}. \section{Performance Analysis} \label{scofo_apps_perfanal} In music education, training musicians often follow the performances or recordings of other musicians to study a piece of music. While listening to these performances, training musicians usually follow their own copy of the sheet music. To aid this form of training, many videos of aligned performance audio on a scrolling score, often with a marker denoting which note is being played at that point in time, were created. These videos are popular on YouTube; notable examples include \textit{The Scrolling Bach Project}\footnote{\url{https://www.youtube.com/channel/UCNAckPiDYxRWengUlRujs6Q/}}--followed by over 87,000 subscribers as of May 2021--which applies this concept to works by Bach. Usually, these videos are created by dedicated musicians who manually (or sometimes aided by a music alignment system) align notes in the performance audio with notes on a sheet music \cite{gerubach,ashishxiangyi}. If a reliable score following solution exists, this idea can be further extended to live performances: users can use this system in a live performance to follow the performance on sheet music. The existence of a reliable score follower also solves a notable problem of projects such as \textit{The Scrolling Bach Project}: users are forced to follow a performance and sheet music combination chosen by the authors. Some users may prefer an interpretation of a music piece by a different performer, or a different sheet music edition published by a different publisher. A score-follower-based system would enable on-the-fly and easy music alignment on any performance and sheet music combination. A Herculean effort in score following for this application is the work of Arzt \textit{et al.}{} \cite{arzt16} which introduced a score follower capable of tracking an orchestral performance of the \emph{Alpensinfonie} at the prestigious \emph{Concertgebouw} in Amsterdam \cite{arztconcert}. The system was capable of APT and also provided artistic visualisations and textual information provided by a musicologist to the audience. \section{Music Practice} As score following implies that a computer can pinpoint which part of the music is being played by a player, it can also be used in conjunction with musical analysis tools to provide feedback for music practice. This was spotted as an early application of score following; thus, solutions, some commercial, exist. In 1990, \textit{Piano Tutor} was designed by Dannenberg to model after a human music teacher \cite{dannenberg90}. The system follows the performance of the student via score following, and after the performance, a score alignment system provides feedback on the performance, such as numbers of notes missed or mistimed. \textit{SmartMusic}\footnote{\url{https://www.smartmusic.com/}} is a commercial solution that also offers accompaniment capabilities; notably, studies were carried out with \textit{SmartMusic}, indicating that students who practice with \textit{SmartMusic} accompaniment improve in terms of performance skill, motivation and practice time. A more recently introduced commercial product is \textit{PracticeBird}\footnote{\url{https://www.practicebird.com/}}, which gives real-time intonation and rhythm feedback. It unfortunately suffers from the same problem as the commercial score following APT solutions put forth in \autoref{scofo_apps_apt}: it is not robust enough in noisy environments. \section{Performance Cues} In performances where music plays an accompanying or background role such as theatre shows, live TV shows or opera performances, performance cues are often required to synchronise the performance with the music. Notably, in some opera houses and theatre stages, the accompanying orchestra is often seated below stage in an ``orchestra pit'' \cite{tronchin06}. Usually, a conductor is needed to synchronise musicians with the performance happening on stage; the synchronisation often involves cueing performers--sometimes both the musicians and the stage performers. The role of a conductor is often already heavy, and having to divide the conductor's attention between the orchestra and stage performance is not ideal. With a score follower, the job scope of the conductor could be reduced--stage performers could be automatically cued by the system that follows what the orchestra is playing. Further, for small music ensembles, the conductor could even be omitted. \section{Entertainment} Score followers can be used for entertainment beyond musical performances--there are many creative applications possible. This project provides an example in \autoref{impl_beat}, in which a beat tracking score follower system is applied to create an interactive conductor application, where users can wave their mobile devices to ``conduct'' music. Another application of score followers for entertainment was also introduced by the author. This application was timely with regard to the COVID-19 pandemic: 2021's Vienna New Year's Concert\footnote{\url{https://www.wienerphilharmoniker.at/en/newyearsconcert}} was the very first ran without an audience due to the pandemic. The \textit{Radetzky March} is a staple in every year's concert--usually it is the last encore piece played with the audience clapping along. Riccardo Muti, conductor of the 2021 edition, mentioned that 2021 was the very first time the audience can listen to the \textit{March} without the clapping. However, this performance felt empty and weird, prompting the author to create \textit{Radetzky}, a program that can add randomised and volume-sensitive claps to detected beats on any piece of music. An off-the-shelf beat tracking score follower \cite{bock14,krebs15} was used. The source code for \textit{Radetzky} can be found in \url{https://github.com/lhl2617/radetzky}, and 2021's \textit{Radetzky March} with added claps can be watched at \url{https://www.youtube.com/watch?v=dTrGnQCliWg}. \chapter{Preliminaries} \label{scofo_preliminaries} \epigraph{\itshape I think a lot of people have the impression with classical music because it’s written and it looks very specific on the page that it tells you exactly how to play it, but actually all it tells you is the relative things... nothing is really mathematical.}{Hilary Hahn} In this chapter, preliminaries of score followers are provided, starting from a definition (\autoref{scofo_definition}) and a generic framework (\autoref{scofo_generic}). Then, the different categories of score followers are covered in \autoref{scofo_types} before a short but important detour into different musical data representations in the context of score followers (\autoref{scofo_mdr}). \section{Definition} \label{scofo_definition} Practical definitions of score following have changed and evolved in the last 40 years, naturally as score following is an intersection of new demands from musicians and new scientific technologies. As such, subjective definitions for score following can lose its account over time. Arshia Cont from IRCAM, a research group active in this area, gave a clear and concise general definition for score following in 2004 \cite{cont04}: \begin{definition}[Score following] Score following serves as a real-time mapping interface from \emph{Audio abstractions} towards \emph{Music symbols} and from performer(s) live performance to the score in question. \end{definition} Score following results in a score-performance alignment, which relates to the also heavily researched sibling field of \emph{music alignment} \cite{chen19, chen14, wang16, sturm13, orio03, hu04, dannerberg03}. Music alignment does not have real-time constraints, which means it can use the entire performance data to perform alignment. Being less flexible, it is more commonly used in research, but practical applications do exist, such as audio querying for MIDI documents \cite{hu04} as well as timestamping of an audio recording according to the desired musical position in a music score \cite{dannerberg03}. These systems are worthy of mention in this context, as music aligners often provide good alignments and benchmarks useful for research and development of score followers. \section{Generic Framework} \label{scofo_generic} The standard approach in most score followers comprises three steps \cite{chen19}: \begin{enumerate} \item \textbf{Feature extraction}: Informative features in the performance data (either audio or other representations such as MIDI) are extracted to characterise the musical content, such as onsets, pitches or chords. \item \textbf{Similarity calculation}: Via a defined similarity function, the difference between features extracted in step 1 and the note events in the sheet music is measured. \item \textbf{Alignment}: An alignment algorithm is used to determine the closest match between feature sequences and note events. \end{enumerate} \autoref{fig:generic-framework} illustrates the three steps in a piano performance score following situation. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/framework/framework.png} \caption{Illustration of a generic framework used in most score followers. The numbers represent each of the three steps delineated in \autoref{scofo_generic}.} \label{fig:generic-framework} \end{figure} \section{Types} \label{scofo_types} Score followers can usually be categorised into three classes \cite{mullerdtw} defined as such: \begin{definition}[Audio-to-symbolic score followers] \textbf{Audio-to-symbolic} (A-S) systems, which include audio-to-score followers, analyse the content of the input performance audio at a given point in time and maps it to a corresponding time point on the score with a similar musical structure. \autoref{fig:audio-to-symbolic} illustrates this method. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/audio/welltempered/a-s.png} \caption{Illustration of audio-to-symbolic matching between an audio waveform and the sheet music of bar 1 of the \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846}. Direct score following from audio to sheet music images is a currently active research topic--see \autoref{scofo_sheetmusicimages}.} \label{fig:audio-to-symbolic} \end{figure} \end{definition} \begin{definition}[Audio-to-audio score followers] \textbf{Audio-to-audio} (A-A) systems matches a position in the audio of a music performance to the corresponding position in a separate audio recording. \autoref{fig:audio-to-audio} illustrates this method. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/audio/welltempered/a-a.png} \caption{Illustration of audio-to-audio matching between the audio waveforms of two different recordings of bar 1 of the \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846}. This method is common in DTW-based systems, covered in \autoref{scofo_dtw}. This figure also illustrates a problem for score followers: dealing with different performance \textit{tempo}.} \label{fig:audio-to-audio} \end{figure} \end{definition} \begin{definition}[Symbolic-to-symbolic score followers] \textbf{Symbolic-to-symbolic} (S-S) systems work by calculating the correlation between the musical structures of a performed musical note and its corresponding note in the score. \autoref{fig:symbolic-to-symbolic} illustrates this method. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{misc/audio/welltempered/s-s.png} \caption{Illustration of symbolic-to-symbolic matching (pitch-based string matching) between two strings representing a sequence of notes (each note is a concatenation of the pitch and octave number) of bar 1 of the \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846}. This method is common in early systems (\autoref{scofo_earlywork}). This figure also features two mistakes a robust score follower should be able to deal with: a wrong note (first asterisk) and a repeated note (second asterisk).} \label{fig:symbolic-to-symbolic} \end{figure} \end{definition} It is worth noting that there is overlap for some systems. For example, Orio \textit{et al.}{} \cite{orio01} showed an approach that synthesises the score's MIDI into an audio file before performing alignment with performance audio data; such a system would be an audio-to-symbolic system comprising an audio-to-audio system. Alonso \textit{et al.}{} \cite{alonso17} also proposed solutions using a hybrid approach where both symbolic MIDI data and audio of the performance can be used to improve score following. In this report, systems exhibiting compositional behaviour would be primarily referred by their \emph{inner} system to further emphasise their actual score following alignment method--Orio \textit{et al.}{}'s system would be classified as an audio-to-audio system. Systems that employ a hybrid approach would be classified using their primary mode of alignment. \section{Musical Data Representation} \label{scofo_mdr} As score followers are software based, computer-based music representations are required for both the performance and the score. In this section, preliminaries of the musical data representations score followers commonly work with are provided. A focus is placed on open formats popular with score followers, but other lesser-used or proprietary formats are mentioned as an aside. It is worth noting that lossless conversions between some formats listed is impossible. However, conversions between some formats here can be done easier than others. \autoref{fig:mdr-conv} shows the common conversion relationships among four common formats: audio (\autoref{scofo_mdr_audio}), sheet music (\autoref{scofo_mdr_sheetmusic}), MIDI (\autoref{scofo_mdr_midi}) and MusicXML (\autoref{scofo_mdr_musicxml}). \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/mdr-conv/mdr-conv.png} \caption{Illustration of common conversion methods between audio, sheet music, MIDI and MusicXML. Red (*-marked) conversions denote lossy and difficult conversions, green ($\dagger$-marked) conversions denote lossless and easy conversions and blue (unmarked) conversions denote lossy and easy conversions.} \label{fig:mdr-conv} \end{figure} \subsection{Audio} \label{scofo_mdr_audio} An obvious medium for score followers to work with is the audio of the performance. Score followers may also convert score data in other forms into its audio form via synthesisers, common for DTW-based score followers covered in \autoref{scofo_dtw}. In a musical context, training musicians are taught the three attributes of a note: loudness (\emph{piano} vs. \emph{forte}), length (\emph{semiquaver} vs. \emph{semibreve}) and pitch (\textit{A4} vs. \textit{A6}). Beyond that, notes coming together can form chords and, further, polyphonic music. Harmonics may form over notes, and each instrument has a unique \emph{timbre}, giving rise to unique sounds as different instruments' sounds blend together. It is clear that audio is very complex to work with. Simple notions relating to the music note can be brought over into audio processing rather easily to deal with temporal and pitch features, but more advanced signal processing techniques such as \emph{spectral analysis} are required to process more complex, polyphonic music. \Cref{scofo_speechrecog} contains information on how some score followers preprocess audio. Another problem of using audio is that microphones may be imperfect, and problems such as reverberation \cite{naylor10} and noise \cite{ali15} increase the difficulty of score following. Nevertheless, many score followers operate on the \emph{audio-to-audio} \cite{arzt08,Dixon2005MATCHAM} or \emph{audio-to-symbolic} \cite{henkel19unet,henkel20} paradigms; usually, authors would need to develop more robust audio models or techniques to deal with the imperfections in audio capture and the complexities of multi-instrument polyphonic music. The study of audio processing is of huge interest in the Musical Information Retrieval (MIR) community to deal with other interesting problems besides score following, such as Query by Humming (QbH) \cite{ghias95}. Audio can be \emph{transcribed} into MusicXML and MIDI via Automatic Music Transcription (AMT) \cite{benetos19} or by human transcription. On the one hand, AMT is a difficult problem, and--so far--no techniques can match the performance of human experts \cite{gowrishankar16}. Human transcription, on the other hand, is tedious. \subsection{Sheet Music} \label{scofo_mdr_sheetmusic} Sheet music may come in analogue (paper) or digital (images, PDF etc.) forms. Generally, analogue sheet music can be easily converted into its digital counterpart easily by scanning the sheet music. \begin{figure}[h] \centering \includegraphics[width=\columnwidth]{assets/sheetmusic.png} \caption{The first six bars of the \textit{Prelude} from Bach's \textit{Prelude and Fugue in C major, BWV 846} in modern staff notation, typeset using \textit{LilyPond}.} \label{fig:modern-staff-notation} \end{figure} There are many forms of musical notation used in sheet music; however, modern staff notation (also known as common Western music notation) is most commonly used by musicians of numerous genres throughout the world. \autoref{fig:modern-staff-notation} shows an example. Throughout this report, modern staff notation is used extensively. There exists variations on staff notation, e.g. percussion notation, figure bass notation, lead sheets and chord charts, but score following is mostly researched and developed for modern staff notation (rare exceptions include Pardo and Birmingham's 2001 work \cite{pardo01} on following lead sheets and Macrae and Dixon's 2010 \cite{macrae10} paper on following guitar tablature). Most score followers do not work directly with sheet music images; in fact, it is only in recent years that the challenge of directly working with sheet music images was tackled \cite{dorfer2016}. This is due to the difficulty of processing music notation--score following systems working with sheet music images require the incorporation of computer vision and image processing techniques, which are usually too slow and/or too complex for score following purposes. Score followers commonly work with symbolic music representations, such as MIDI and MusicXML. Most music creators notate their music in programs capable of outputting MIDI and MusicXML; however, in situations where this is not the case, human transcription from sheet music to symbolic music is possible, but tedious and difficult. Fortunately, there exists automatic methods to convert sheet music into MIDI, MusicXML and other forms of symbolic music representations. These methods fall under another active sibling field of score following in MIR: Optical Music Recognition (OMR) \cite{zaragoza20}, a superset of its closely named counterpart: Optical Character Recognition (OCR) \cite{awel19}. Nevertheless, even with recent developments incorporating state-of-the-art (and some data-driven) approaches, OMR is still not reliable enough for score following \cite{henkel19}. \subsection{MIDI} \label{scofo_mdr_midi} MIDI (Musical Instrument Digital Interface) is a technical standard, first introduced in 1981 and standardised in 1983, that describes standards for communications, interfaces and connectors that connect electronic instruments, computers and other audio devices \cite{midihistory}. MIDI is more commonly known as a popular computer music format that can represent both performance and score data; however, it has notable limitations. The main feature that MIDI brings to MIR is its file format, SMF (Standard MIDI File). SMF data records quantifiable musical data, such as note onsets, offsets, pitches and velocities. However, note that the MIDI protocol does not provide exact representations of musical performances--aspects such as timbre and spectral content are ignored. Further, certain performance directions, notes and auxiliary information (e.g. stem direction, beams, repeats, slurs etc.) usually available in modern sheet music cannot be contained within SMF. Nevertheless, for MIR research focusing on timing, tempo and articulation, MIDI does convey sufficient information and remains far easier to process than audio recordings \cite{gingras11}. Because a MIDI file contains so little information compared to audio, it also has tiny file sizes. MIDI is, therefore, a sufficiently good format for score followers. In fact, many early score followers (\autoref{scofo_earlywork}) perform string-matching based on score data extracted from MIDI representations of the score and on performance data extracted from MIDI-capable musical instruments. Some DTW-based score followers (\autoref{scofo_dtw}) also work with MIDI score data by first synthesising it into audio. Conversion of MIDI to audio is possible and common via synthesiser software; in fact, the instrument that synthesises the music can be easily changed, which adds to the flexibility and thus popularity of the format among music creators. However, do note that synthesis of audio from MIDI falls under computer-generated music, and thus will not be able to capture the ``expressiveness'' in performance of a human player. Moreover, music notation software are usually capable of outputting sheet music from MIDI files. Conversion from MIDI to MusicXML, which can be seen as a superset of MIDI (see \autoref{scofo_mdr_musicxml}), is straightforward. \subsection{MusicXML} \label{scofo_mdr_musicxml} As mentioned in \autoref{scofo_mdr_sheetmusic}, MusicXML is a format commonly exported by music notation software. MusicXML is an open digital sheet music interchange format that aims to supersede MIDI as a universal format for modern staff notation. In addition to being a superset of MIDI (i.e. containing data representing how a piece of music should sound), MusicXML also contains data representing how a piece of music should look like, hence capturing all the musical data available on modern sheet music \cite{good03}. Being a superset of MIDI, MusicXML contains all of MIDI's benefits in terms of representing musical data, and more. Performance direction information in MusicXML files can, in more advanced music synthesis software (such as \textit{Finale}\footnote{\url{https://www.finalemusic.com/}} and \textit{Sibelius}\footnote{\url{https://www.avid.com/sibelius}}), produce music that slightly more resembles what could be produced by a human performer. The fact that MusicXML also contains sheet music information also means it can be used as an alternative to sheet music--notably, MusicXML is the preferred format for music sheets in many applications displaying digital sheet music \cite{tido,phonicscore,musicnotes}. In fact, \textit{PhonicScore}\footnote{\url{https://www.phonicscore.com/}} and \textit{Tido}\footnote{\url{https://www.tido-music.com/}} are two APT (\autoref{scofo_apps_apt}) applications that work by showing a marker on MusicXML-generated sheet music. MusicXML can be easily synthesised to audio, extracted to MIDI and converted into sheet music. The main problem with MusicXML is that while it is widely adopted, many sheet music publishers do not publish music in that format, instead preferring paper or electronic (such as PDF) sheet music. This means that OMR methods, mentioned in \autoref{scofo_mdr_sheetmusic}, or manual ones, must be used to convert sheet music into MusicXML. \subsection{Other formats} Here, other formats that are used by score followers are listed. These formats are not as commonly used as the ones mentioned above. The lower popularity is due to multiple factors--the most prominent ones being the format's proprietary state, limitations in representing musical data and low adoption by the community. Proprietary formats are marked with a $\dagger$. \begin{itemize} \item \textbf{Graphic score editor formats}: \textit{Finale$\dagger$}, \textit{Sibelius$\dagger$}, \textit{NIFF}, \textit{Guido}, \textit{MuseScore}, \textit{Overture$\dagger$}, \textit{Cubase$\dagger$} \item \textbf{Typesetting/Mark-up language formats}: \textit{LilyPond\footnote{LilyPond \cite{lilypond} is used for typesetting most music in this report (e.g. \autoref{fig:modern-staff-notation}). It is also extensively used to generate sheet music in datasets \cite{dorfer18, seils,tuggener18}.}}, \textit{MusiXTeX} \item \textbf{Other machine-readable formats}: \textit{Music Encoding Initiative (MEI), IEEE1599, Humdrum} \end{itemize} \part{A Review of Score Following} \label{scofo} \input{02_parts/01_scofo/chapters/01_applications.tex} \input{02_parts/01_scofo/chapters/02_preliminaries.tex} \input{02_parts/01_scofo/chapters/03_challenges.tex} \input{02_parts/01_scofo/chapters/04_relatedwork.tex} \chapter{Extra notes to Figures} \label{appendix_extranotestofigures} \newenvironment{itemizefignotes} { \begin{itemize} \setlength{\itemsep}{0pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} } { \end{itemize} } \subsubsection{\autoref{fig:caa}} \begin{itemizefignotes} \item Icons made by \textit{Freepik} from \url{https://www.flaticon.com}. \item Music excerpt from Beethoven's \textit{Violin Sonata No. 9 in A Minor, Op. 47}. Public Domain. \end{itemizefignotes} \subsubsection{\autoref{fig:generic-framework}} \begin{itemizefignotes} \item Icons made by \textit{iconixar}, \textit{surang}, \textit{DinosoftLabs} and \textit{Eucalypt} from \url{https://www.flaticon.com}. \end{itemizefignotes} \subsubsection{\autoref{fig:mdr-conv}} \begin{itemizefignotes} \item Icons made by \textit{Pixel perfect} and \textit{iconixar} from \url{https://www.flaticon.com}. \item MIDI logo from the \textit{MIDI Manufacturers Association}. Public Domain. \item MusicXML logo from \url{https://www.musicxml.com}. \end{itemizefignotes} \subsubsection{\autoref{fig:generic-framework}, \autoref{fig:audio-to-symbolic}, \autoref{fig:modern-staff-notation}, \autoref{fig:fuguebar7}, \autoref{fig:qualbwv846}, \autoref{fig:846fugue13}, \autoref{fig:prelude33}} \begin{itemizefignotes} \item Music excerpts from Bach's \textit{Prelude and Fugue in C major, BWV 846}. Public Domain. \end{itemizefignotes} \subsubsection{\autoref{fig:chaconnefirst10}, \autoref{fig:chaconnelast2}, \autoref{fig:chaconnearp}} \begin{itemizefignotes} \item Music excerpts from Bach's \textit{Chaconne from Partita II, BWV1004}. ©2019 by Hajo Dezelski. Creative Commons Attribution ShareAlike 3.0 (Unported) License - free to distribute, modify and perform. \end{itemizefignotes} \newpage \chapter{Specifications of the System used for Evaluation and Benchmarks} \label{appendix_benchmark_system} \begin{table}[ht] \centering \begin{tabular}{l c} \hline\hline Component & Model/Version \\ [0.5ex] \hline CPU & Intel Core i7-8700 CPU (3.20GHz) \\ RAM & 16GB \\ Storage & 512GB SSD \\ OS & Ubuntu 20.04.2 LTS \\ \hline \end{tabular} \label{table:systemspec} \end{table} \chapter{Project Code Metrics} \label{appendix_project_code_metrics} Lines of Code (LoC) calculated using \textit{VS Code Counter}\footnote{\url{https://marketplace.visualstudio.com/items?itemName=uctakeoff.vscode-counter}}. \begin{table}[ht] \centering \begin{tabular}{l l r r} \hline\hline Repository & Language & LoC & Total \\ [0.5ex] \hline Quantitative Testbench (including ASM Aligner in \autoref{impl_asm})\footnote{\url{https://github.com/flippy-fyp/flippy-quantitative-testbench}} & Python & 3193 & 3193 \\ \hline Qualitative Testbench\footnote{\url{https://github.com/flippy-fyp/flippy-qualitative-testbench}} & TypeScript (React) & 1304 & \\ & Python & 71 & 1375 \\ \hline \textit{TuneApp Conductor} (\Cref{impl_beat}) & TypeScript (React) & 1471 & \\ & CSS & 69 & 1540 \\ \hline CQT-DTW Score Follower (\Cref{impl_dtw})\footnote{\url{https://github.com/flippy-fyp/flippy}} & Python & 3883 & \\ & Shell Script & 154 & 4037 \\ \hline \textbf{Total} & & & \textbf{10145} \\ \hline \end{tabular} \label{table:loc} \end{table}
\section{Introduction} Distinguishing between moving and static parts in the surrounding environment is an important task for autonomous vehicles. Compared with static objects that occupy most of the space, moving objects usually account for only a small part. This unbalance distribution increases the difficulty of the MOS task. In addition, considering the influence of the MOS accuracy on navigation safety, pose estimation, mapping, and path planning tasks, reliable and real-time moving object segmentation is actually a necessary and challenging task. \begin{figure}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{flowchart.eps}} \end{center} \caption{Range-based LiDAR segmentation methods. (a) Multiple-scan-based LiDAR semantic segmentation method. It uses consecutive range images as inputs and outputs corresponding semantic segmentation results, including moving information. (b) LiDAR-based moving object segmentation method. It takes range images and residual images as inputs and outputs the MOS results. (c) Our semantics-guided moving object segmentation method. It includes a single-scan-based semantic segmentation module and a multiple-scan-based MOS module. The latter takes range images and semantic features of the former as inputs. Note that to save space, only the middle size of 64 $\times$ 512 is displayed instead of the full size. This similarly applies to the rest figures of the paper.} \label{fig:flowchart} \end{figure} The existing MOS methods are mainly based on camera images. The LiDAR sensors are rarely used due to the lack of labeled MOS data. In recent years, with the release of the SemanticKITTI MOS dataset, the LiDAR-based MOS methods have gradually attracted more and more attention. In this paper, we focus on developing a MOS network with LiDAR data only. The MOS task can be regarded as a simplified version of the multiple-scan-based semantic segmentation one. The latter not only predicts the semantic classes of each LiDAR point but also determines whether it is moving or not. However, in practical applications, the semantic classes of the moving objects, such as vehicles and pedestrians, have no significant difference in the decision-making process of autonomous vehicles. Therefore, this paper only focuses on the separation of moving and static objects. The LiDAR-based MOS methods usually use range images and residual images as inputs and conduct the MOS task directly. By analyzing the multiple-scan-based semantic segmentation methods, we find that the semantic cues are more useful for the MOS task than the commonly used raw LiDAR data. Therefore, instead of dealing with the MOS task alone, we associate the MOS task with the single-scan-based semantic segmentation task. This is similar to the multiple-scan-based semantic segmentation methods. The unified method can predict not only the moving labels but also the semantic ones. Compared with the multiple-scan-based semantic segmentation methods, the combination of the MOS and single-scan-based semantic segmentation has the following advantages: First, the complex multiple-scan-based semantic segmentation task is divided into modules of commonly researched single-scan-based semantic segmentation and relatively simple moving object segmentation. This can make full use of the existing single-scan-based semantic segmentation network architectures. Second, the modular design allows us to directly use the pre-trained single-scan-based models, instead of training from scratch. This simplifies the training process, we can only train the MOS module. The single-scan-based semantic segmentation methods can also upgrade the MOS capability in a quick time without much modification. In addition, in order to effectively connect the single-scan-based semantic segmentation module and the MOS module, we propose a novel adjacent scan association (ASA) module to explore the semantic feature association of adjacent LiDAR scans. The ASA module can establish correspondences of the semantic features according to the relative poses between scans. This helps to accurately transfer information between scans. The semantic features are transformed into the same coordinate system and the semantic differences can be used in the MOS task. In sum, we propose a semantics-guided CNN model for the MOS task. The network consists of three modules: a single-scan-based semantic segmentation module, an adjacent scan association (ASA) module, and a moving object segmentation (MOS) module. As a key component, the ASA module associates the semantic features from the semantic segmentation module, then transforms and transmits them to the MOS module. The main contributions of this paper are: (i) The semantic aware MOS simplifies the training process by making use of the existing single-scan-based semantic segmentation network architectures and pre-trained models. (ii) The ASA module realizes accurate association between semantic features of different LiDAR scans. (iii) The modular design enables the upgrading of a single module. Experimental results on the SemanticKITTI MOS dataset show that the proposed network\footnote{https://competitions.codalab.org/competitions/28894\#results} can obtain accurate MOS performance in a simple and fast way. \section{Related Works} \begin{figure*}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{flowchart2.eps}} \end{center} \caption{The flowchart of the proposed semantics-guided moving object segmentation method from LiDAR point cloud. The whole network consists of three modules and conducts single-scan-based semantic segmentation and multiple-scan-based moving object segmentation in a cascaded way. The semantic segmentation module learns the semantic features of each LiDAR point. The adjacent scan association module converts the features of different scans to the same coordinate system. The moving object segmentation module combines the transformed semantic features and LiDAR range images to differentiate the moving objects. } \label{fig:flowchart2} \end{figure*} \subsection{LiDAR Data Representation} \label{sec:representation} LiDAR is an important sensor for autonomous vehicles. The typical LiDAR data representations can be roughly divided into three categories, including point-based, voxel-based, and projection-based techniques. The point-based methods process the unstructured LiDAR point clouds directly. PointNet\cite{QiSMG17} is the first point-based method that aggregates information through a permutation invariant operation on the raw LiDAR point clouds. Recent works focus on developing special convolution operations and kernels for point clouds, such as PointConv\cite{WuQL19}, TangentConv\cite{TatarchenkoPKZ18} and KPConv\cite{ThomasQDMGG19}. However, due to memory requirements and time complexity, most point-based methods still struggle on large-scale point clouds. The voxel-based methods transform the LiDAR point clouds into 3D volumetric grids. MinkowskiNet\cite{ChoyGS19} utilizes the sparse 3D convolutions to efficiently process the voxelized LiDAR data. SegCloud\cite{TchapmiCAGS17} applies a 3D Fully Convolutional Neural Network (FCNN) on the voxelized point clouds. Cylinder3D\cite{Zhu0WHM00L21} splits the raw point clouds into cylindrical grids. However, the 3D convolutions are computationally intensive and the voxels are usually sparse, which limits the resolution of voxels and the overall performance. The projection-based methods project the LiDAR point clouds onto regular 2D images and use the well-researched 2D CNNs. In SqueezeSeg\cite{WuWYK18}, SqueezeSegV2\cite{WuZZYK19} and RangeNet++\cite{MiliotoVBS19}, the spherical projection is performed on the LiDAR data. The point clouds can also be projected into cartesian bird’s eye view (BEV) (VolMap\cite{abs-1906-11873}) or polar BEV (PolarNet\cite{0035ZDYXGF20}). The projection-based methods can achieve real-time performance, but the accuracy is often limited due to the information loss in the projection process. Considering the computation and time cost, in this work, we use spherical projection to convert the LiDAR data into 2D range images. \subsection{LiDAR Semantic Segmentation} Semantic segmentation and MOS are closely relevant tasks. According to the number of scans used, the LiDAR-based semantic segmentation methods can be divided into single-scan-based semantic segmentation and multiple-scan-based ones. The single-scan-based semantic segmentation methods\cite{QiYSG17,LandrieuS18,Hu0XRGWTM20,ChengRTLL21} deal with the static LiDAR data and can only find the movable objects, such as vehicles and humans, not the real moving objects. The multiple-scan-based semantic segmentation methods\cite{ShiLWH020,DuerrPWB20,CaoLPLYL20,TangLZLLWH20} takes the continuous sequence of LiDAR scans as inputs. They fuse the spatial information of a single scan and the temporal information between adjacent scans to predict the semantic and moving characteristics of each LiDAR point. The multiple-scan-based semantic segmentation methods can be viewed as the combination of the single-scan-based semantic segmentation and the multiple-scan-based MOS. Inspired by the multiple-scan-based semantic segmentation methods, we use the off-the-shelf single-scan-based LiDAR semantic segmentation models to assist the MOS process. \subsection{LiDAR Moving Object Segmentation} A variety of approaches have been proposed for MOS based on camera images only\cite{BarnesMPP18,PatilBDM20} or with both camera and LiDAR data\cite{YanCMSM14,PosticaRM16}. Recently, the LiDAR-based MOS methods have achieved more and more attention. Some LiDAR-based MOS methods\cite{KimK20a,PagadANRKY20,SchauerN18} focus on classifying dynamic points by checking the inconsistency between the query scan and the pre-constructed map. However, the static map can only be built in an offline way, which affects the actual deployment of these methods. In recent years, the map-free MOS methods using only LiDAR data have achieved success. Ruchti et al.\cite{RuchtiB18} predict the point-wise probabilities of points belonging to moving objects by a learning-based method. Chen et al.\cite{ChenLMWGBS21} combines the LiDAR range images and the residual images to exploit the temporal information and differentiate the moving objects. He et al.\cite{HeERR22} proposes a sequential scene flow estimation method to learn the motion information of the point clouds. In this work, we propose a semantic-aware MOS model. The MOS task is reformulated as cascaded single-scan-based semantic segmentation and multiple-scan-based MOS task. The semantic features will greatly improve the MOS performance. \section{Method} The proposed network conducts a single-scan-based semantic segmentation and a multiple-scan-based MOS in turn as shown in Fig. \ref{fig:flowchart2}. \subsection{Semantic Segmentation} \label{sec:semantic} To achieve real-time performance, the single-scan-based semantic segmentation module uses LiDAR range images as inputs. The LiDAR points are projected onto a 2D image plane according to the yaw and pitch angles. Assuming the LiDAR point is $P=(x,y,z)$, the transformation is defined as follows, \begin{equation} \begin{cases} \theta_{yaw} = arctan(y,x)\\ \theta_{pitch} = arcsin(z/{\sqrt{x^2+y^2+z^2}}) \\ u = 0.5*[(1-\theta_{yaw}/\pi)] \cdot W\\ v = [1-(\theta_{pitch}-f_{down})/f] \cdot H \\ \end{cases} \label{equ:spherical} \end{equation} where $p=(u,v)$ are the corresponding coordinates in the LiDAR range image, $\theta_{yaw}$ and $\theta_{pitch}$ denoting the yaw and pitch angles, $W$ and $H$ representing the width and height of the range image, respectively. $f=f_{up}-f_{down}$ is the vertical field-of-view of the LiDAR sensor. Based on the correspondences between $P$ and $p$ in Eq.\ref{equ:spherical}, we can get the LiDAR range images of size $H\times W\times C$. $C$ denotes the channel of features. For the Velodyne HDL-64E LiDAR, the size is $64\times 2048\times 5$. The features include $range$ ($\sqrt{x^2+y^2+z^2}$), $x$, $y$, $z$ and the $intensity$. Figure \ref{fig:range} shows examples of the LiDAR range images. After the pre-processing step, the LiDAR range images are fed to the single-scan-based semantic segmentation module. To make full use of the existing semantic segmentation models, we directly test our method with the pre-trained models of RangeNet++\cite{MiliotoVBS19} and SalsaNext\cite{CortinhalTA20} in this paper. \begin{figure}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{range.eps}} \end{center} \caption{The LiDAR range images include $range$, $x$, $y$, $z$ and $intensity$ components. } \label{fig:range} \end{figure} \begin{figure}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{asa.eps}} \end{center} \caption{The adjacent scan association module. The arrows denote the correspondences between adjacent LiDAR range images. From top to bottom are the current range image, previous range image, and the transformed range image. } \label{fig:asa} \end{figure} \subsection{Adjacent Scan Association} After the single-scan-based semantic segmentation module, we can get high-level features of each LiDAR scan. In order to exploit the semantic features of each scan, an intuitive idea may be to concatenate them directly. However, this simple solution does not work because the semantic features are represented in different coordinate systems. In this paper, we propose an adjacent scan association module to convert the semantic features of adjacent scans into the same coordinate system and then feed them to the MOS module. The ASA module consists of three steps: coordinate system conversion, range image generation, and feature transformation. \textit{Coordinate System Conversion:} Assuming that we have a sequence of $N$ LiDAR scans, and the corresponding odometry information is known. $S_0$ denotes the current LiDAR scan and $S_i$ represents one previous scan $(0<i<=N)$. $T_i^0$ denotes the relative transformation between the previous scan $S_i$ and the current scan $S_0$. Given this information, we can convert a LiDAR point in a previous scan $S_i$ to the one in the current scan $S_0$ as follows, \begin{equation} \left[ \begin{array}{c} x_0^{i} \\ y_0^{i} \\ z_0^{i} \\ 1 \\ \end{array} \right] =T_{i}^{0} \cdot \left[ \begin{array}{c} x_i \\ y_i \\ z_i \\ 1 \\ \end{array} \right] \label{equ:coordinate} \end{equation} where $(x_0^{i}, y_0^{i}, z_0^{i}, 1)$ and $(x_i, y_i, z_i, 1)$ denote the coordinates of the same 3D point in the coordinate systems of scan $S_0$ and scan $S_i$, respectively. Considering the semantic features $F_i$ are represented in the form of range image, we only need to transform the LiDAR points lying in range image $R_i$ to the coordinate system of scan $S_0$. \textit{Range Image Generation:} After the coordinate system conversion step, we can get the transformed LiDAR point clouds. In this step, we use Eq. \ref{equ:spherical} to project the transformed scan $S_0^{i}$ onto the range image $R_0$ and generate a new range image $R_0^{i}$. Through this $R_i\Rightarrow S_0^{i}\Rightarrow R_0^{i}$ process, we can get a corresponding point $(u_0,v_0)$ in current range image $R_0$ if it exists. The association between the previous and current scans is beneficial to the subsequent MOS task. If the relative pose $T_{i}^{0}$ and the semantic segmentation results are accurate enough, we can even distinguish the moving points from the static by comparing the corresponding semantic segmentation results. The point is static if the semantic prediction in the current scan is the same as that in the previous scan, otherwise, it is moving. However, in practical applications, there exist errors in both relative pose and semantic segmentation results. That is why we use the semantic features rather than the semantic results in this paper. \textit{Feature Transformation:} In this step, we use the calculated point correspondence information to assist the feature transformation process. Assuming the association between the previous range image $R_i$ and the current range image $R_0$ is represented by $Tr$ with the size of $H\times W$, $(u_0,v_0)$ is the corresponding point of $(u_i,v_i)$ in $R_0$. The transformation $Tr$ is defined as follows, \begin{equation} Tr(u_i,v_i)= \begin{cases} u_0+v_0\cdot W\\ 0, \quad\text{no correspondences} \end{cases} \end{equation} where $Tr$ stores the index information from range image $R_i$ to range image $R_0$. Then, we use the $\mathit{reshape}$ and $\mathit{scatter}$ functions to transform the semantic features $F_i$ of the previous range images $R_i$ to the current range image $R_0$ according to the association information in $Tr$. \subsection{Moving Object Segmentation} Like the semantic segmentation module, we reuse the existing single-scan-based semantic segmentation models, RangeNet++\cite{MiliotoVBS19} and SalsaNext \cite{CortinhalTA20}, for the MOS module in this paper. Both RangeNet++ and SalsaNext follow the encoder-decoder architectures and can obtain accurate semantic segmentation results in real-time. After the ASA module, we can get the semantic features of the current range image and the transformed features of the previous range image. As mentioned earlier, the differences between these two semantic features already contain enough information about the movement. However, if only the semantic features are used as inputs, the accuracy of relative poses and semantic segmentation network will limit the MOS performance. Therefore, we also add the range images of the current scan to minimize the negative impact. The MOS module combines the semantic features and range images to differentiate the moving objects. Compared with the range-image-based MOS methods, the addition of transformed semantic features can bring significant improvement. After the MOS process, we can get the segmentation results in the form of a range image as shown in Fig. \ref{fig:flowchart2}. In order to further improve the performance, the results will be back-projected to the point cloud form. Then, a k-Nearest-Neighbor (kNN) search algorithm is applied to remove the artifacts caused by spherical projection. \section{Experiments} \subsection{SemanticKITTI MOS Dataset} The SemanticKITTI MOS dataset is a large-scale 3D LiDAR-based moving object segmentation benchmark for the MOS task in outdoor driving scenes. It is built upon KITTI\cite{GeigerLU12} and SemanticKITTI\cite{BehleyGMQBSG19} datasets. The MOS dataset has 22 sequences of LiDAR scans, where sequences 00-07 and 09-10 are used for training, sequence 08 for validation, and sequences 11-21 are used for testing. Only two classes, moving and static, are used in this dataset. The intersection-over-union (IoU) \cite{EveringhamGWWZ10} value on the moving objects is the primary metric used for comparison with other methods. \subsection{Experimental Setup} The proposed network is implemented on a server with 64GB RAM, an Intel(R) Xeon(R) E5-2650 CPU, and 2 NVIDIA Geforce RTX2080Ti GPUs under Ubuntu using PyTorch. The evaluation results on the SemanticKITTI MOS testing dataset are obtained based on all training data, with an epoch size of 150 and batch size of 8. The initial learning rate and the learning rate policy are set to be the same as the original networks (RangeNet++ and SalsaNext). If there is no special description, it indicates that both the single-scan-based semantic segmentation module and the MOS module use the SalsaNext network. The odometry information of each sequence is estimated with the LiDAR-based SLAM method SuMa\cite{BehleyS18}. \subsection{Different Transformation Designs} There are two kinds of data representation conversions in the network. One is the transformation of LiDAR scans to range images in the semantic segmentation module, and the other is the transformation of previous semantic features into the current range image in the ASA module. In this section, we will analyze the influences of data type, source data, and hardware on the process of data representation conversion. \subsubsection{Data Type} The coordinates of 3D LiDAR points and the relative pose matrices are saved as floating-point numbers, while the coordinates of range images are integer point numbers. This means that the range images in the current coordinate system generated based on previous scans are different from the range images generated based on the current scan. Even if the surrounding scene is static, the relative poses are accurate and there is no occlusion. \subsubsection{Source Data} The raw LiDAR scans and the corresponding range images have a different number of points. Therefore, the range images converted from previous scans and previous range images are different. \subsubsection{Hardware} Converting 3D LiDAR point clouds into 2D range images inevitably encounters the many-to-one problem, which means multiple LiDAR points may correspond to the same point in the range image. In the semantic segmentation module, we only save the points with minimum range values and perform the transformation on CPUs. However, in the ASA module, the feature transformation occurs on GPUs. Parallel computing cannot ensure that points with minimum range values are saved, and only random points among the multiple points are saved. This characteristic leads to differences between the range images generated based on CPUs and GPUs. \subsubsection{Analysis} Figure \ref{fig:rangedifference} shows the range images generated with different source data and hardware. Among them, Fig. \ref{fig:rangedifference} (a) and (c) are the range images of the current and previous scans generated based on CPUs, respectively. The differences between the two range images are caused by the data type, the inaccurate relative pose, and the moving objects. The occlusion also results in more holes at the edge of the objects. Figure \ref{fig:rangedifference} (c) and (e) are the results using the previous scan and previous range image on CPUs, respectively. We can find that due to the difference in point number, the range image generated by the previous range image is more sparse than the one generated by the previous scan. Figure \ref{fig:rangedifference} (a) and (b) are the range images of the current scan based on CPUs and GPUs, respectively. The difference between the two range images is visually negligible, which indicates that the influence of the hardware on the range image generation process can be ignored. Based on the above analysis and the qualitative comparison results in Fig. \ref{fig:rangedifference}, we finally use CPUs to convert the LiDAR scans into range images (like Fig. \ref{fig:rangedifference} (a)), and use GPUs to transform the features of the previous range images to the current range image (like Fig. \ref{fig:rangedifference} (f)). \begin{figure}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{range2.eps}} \end{center} \caption{The range images in the current coordinate system. They are generated with different hardware (CPUs or GPUs) and LiDAR point clouds (current scan, previous scan, or previous range image). (a) and (b) are range images with current scan and based on CPUs and GPUs, respectively. (c) and (d) are range images with the previous scan and based on CPUs and GPUs, respectively. (e) and (f) are results with previous range images and based on CPUs and GPUs, respectively. } \label{fig:rangedifference} \end{figure} \subsection{Evaluations on SemanticKITTI MOS Dataset} In this section, we compare our method with the state-of-the-art MOS networks. Since there are few LiDAR-based MOS approaches, we also compare our method with some methods of semantic segmentation and scene flow. Table \ref{tab:SOTA} shows the quantitative comparison results. \textit{SalsaNext(movable classes)} denotes the MOS result of directly marking all the movable classes as moving. \textit{SalsaNext(retrained)} retrains the SalsaNext network with binary MOS labels. \textit{SceneFlow}\cite{LiuQG19} uses the flow vector to determine the moving objects. \textit{SqSequence}\cite{ShiLWH020} and \textit{KPConv}\cite{ThomasQDMGG19} are multiple-scan-based LiDAR semantic segmentation networks. \textit{LMNet(N=1)}\cite{ChenLMWGBS21} uses range images and the precalculated residual image to differentiate the moving objects. \textit{LMNet(N=8 + Semantics)} represents the semantically enhanced version using 8 residual images. The proposed semantics-guided MOS network takes the semantic features of current range image, the transformed features of previous range image and the range images of current scan as inputs. As shown in Tab. \ref{tab:SOTA}, the performance of our semantics-guided MOS method is basically the same as \textit{KPConv}, slightly worse than the LMNet with 8 residual images and semantic information. The multiple-scan-based semantic segmentation method \textit{KPConv} is implemented based on point clouds, which requires high computational overhead and cannot achieve real-time performance. Our method only uses the compact LiDAR range images as inputs and can work in real-time. The \textit{LMNet(N=8 + Semantics)} is equivalent to using 9 consecutive scans. Considerable computational overhead and time are spent on the generation of 8 residual images on CPUs. Our method only uses two adjacent LiDAR scans, and the feature association process (the ASA module) is implemented on GPUs. Figure \ref{fig:mosresult} shows the ground truths and MOS results in the forms of range image and point cloud. \begin{figure*}[!t] \begin{center} \makebox[1pt]{\includegraphics[width=\linewidth]{result.eps}} \end{center} \caption{The MOS results in the forms of range image and point cloud. (b), (d), (f) and (h) are the MOS results predicted by our method. (a), (c), (e) and (g) are the corresponding ground truths. Red denotes the moving objects.} \label{fig:mosresult} \end{figure*} \begin{table}[!t] \caption{MOS Performance Compared with the State-of-the-art (Test)} \begin{center} \begin{tabular}{c c} \hline \textbf{Algorithms} & IoU\\ \hline SalsaNext(movable classes) & 4.4\% \\ SceneFlow\cite{LiuQG19} & 4.8\% \\ SqSequence\cite{ShiLWH020} & 43.2\% \\ SalsaNext(retrained) & 46.6\% \\ KPConv\cite{ThomasQDMGG19} & 60.9\% \\ LMNet(N=1) & 52.0\% \\ LMNet(N=8 + Semantics) & 62.5\% \\ Ours & 60.6\% \\ \hline \end{tabular} \end{center} \label{tab:SOTA} \end{table} \subsection{Ablation Study} In order to save the computational overhead and time cost, we only use the training data sampled at equal intervals of 4000 scans in the ablation study section. The epoch size and batch size are set as 30 and 2, respectively. \subsubsection{Effectiveness of Semantic Guidance} Most of the existing LiDAR-based MOS methods use the raw LiDAR data and conduct the MOS task directly. The proposed network introduces a semantic segmentation module to assist the MOS process. In this section, we will analyze the effectiveness of the semantic guidance from the semantic segmentation module. Table \ref{tab:guidance} shows the MOS results on the validation dataset. \textit{MOS(RXYZI + Range Residual)} only uses the MOS module and takes range images and residual image as inputs. \textit{MOS(RXYZI + Range Residual) + Semantics} represents its semantically enhanced version and uses the semantic segmentation results at the end. \textit{MOS(RXYZI + Features)} denotes the proposed method with range images and semantic features as inputs of the MOS module. Table \ref{tab:guidance} are the MOS results on the validation dataset with all training data. \textit{LMNet(N=1)} and \textit{LMNet(N=1 + Semantics)} use the precalculated residual image. The latter also uses the semantic segmentation results. \textit{MOS(RXYZI + Features)} represents the proposed network using range images and semantic features in the MOS module. It is obvious that semantic information can help improve the MOS performance. The single-scan-based semantic segmentation task is closely related to the MOS task. Compared with using the residual images or using semantic segmentation results at the end, our method with semantic features as the inputs of the MOS module is more effective. The pre-trained single-scan-based semantic segmentation model can not only simplify the training process but also improve the MOS performance. \begin{table}[!t] \caption{Effectiveness of Semantic Guidance (Validation)} \begin{center} \tabcolsep3pt \begin{tabular}{c c c} \hline \textbf{Algorithms} & Params & IoU\\ \hline MOS(RXYZI + Range Residual) & 6711043 & 38.6\% \\ MOS(RXYZI + Range Residual) + Semantics & 13422615 & 41.4\% \\ MOS(RXYZI + Features) & 13423863 & 60.5\% \\ \hline \end{tabular} \end{center} \label{tab:guidance} \end{table} \begin{table}[!t] \caption{Effectiveness of Semantic Guidance (Validation)} \begin{center} \tabcolsep3pt \begin{tabular}{c c c} \hline \textbf{Algorithms} & Params & IoU\\ \hline LMNet(N=1) & 6711043 & 59.9\% \\ LMNet(N=1 + Semantics) & 13422615 & 61.4\% \\ MOS(RXYZI + Features) & 13423863 & 68.4\% \\ \hline \end{tabular} \end{center} \label{tab:guidance2} \end{table} \subsubsection{Different MOS Inputs} In this section, we will compare the MOS performance of different inputs, including raw LiDAR data (RXYZI), range residual image, and semantic features. Table \ref{tab:inputs} shows the comparison results. \textit{RXYZI} gets the worst MOS performance due to the lack of temporal information. \textit{Features(current)} and \textit{RXYZI + Features(current)} also use the current LiDAR scan only, but obviously, semantic guidance without temporal information can still improve the results. \textit{RXYZI + Range Residual} and \textit{RXYZI + Features} combining the range images with the residual image or semantic features can increase the MOS accuracy. Compared with the residual image, the semantic features are more effective for the MOS task. However, using both residual image and semantic features at the same time degrades the performance. This may be caused by the conflicts between residual image and semantic features. A comparison between \textit{Features} and \textit{RXYZI + Features} shows that range images also contribute to the MOS task. Connecting the current semantic features with the transformed previous features can obtain better results than using the feature residuals or directly concatenating the semantic features without ASA operation. In summary, the transformed semantic features are more effective than the residual image and the original semantic features from previous scans. \begin{table}[!t] \caption{Different MOS Inputs (Validation)} \begin{center} \tabcolsep3pt \begin{tabular}{c c c} \hline \textbf{Algorithms} & Params & IoU\\ \hline RXYZI & 6711011 & 26.9\% \\ Features(current) & 13423063 & 45.2\% \\ RXYZI + Features(current) & 13423223 & 51.8\% \\ \hline RXYZI + Range Residual & 6711043 & 38.6\% \\ RXYZI + Features & 13423863 & 60.5\% \\ RXYZI + Range Residual + Features & 13423895 & 58.9\% \\ \hline Features & 13423703 & 56.1\% \\ RXYZI + Feature Residuals & 13423223 & 39.1\% \\ RXYZI + Features(concat) & 13423863 & 48.7\% \\ \hline \end{tabular} \end{center} \label{tab:inputs} \end{table} \subsubsection{Influence of Scan Numbers} In this section, we will analyze the influence of the LiDAR scans used on the MOS performance. It is similar to the residual image analysis in LMNet. Theoretically, more LiDAR scans bring more useful information and improve the MOS performance. Table \ref{tab:numbers} shows the MOS results with 2 to 8 consecutive LiDAR scans as inputs. It is obvious that the MOS accuracy does not increase with the increase of LiDAR scans. This is different from the residual images in LMNet. There may be two reasons. First, the semantic segmentation module is not accurate enough. The more LiDAR scans (semantic features), the more conflicts, which affects the improvement of the MOS result. Second, the relative poses between scans are also inaccurate. And this inaccuracy will increase with the increase of time interval. In addition, although the transformations from the previous range images to the current are performed on GPUs, it still affects the training time cost. Based on the above considerations, we only use two adjacent LiDAR scans in our MOS method. \begin{table}[!t] \caption{Influence of Scan Numbers (Validation)} \begin{center} \tabcolsep10pt \begin{tabular}{c c c} \hline \textbf{Scans} & Params & IoU\\ \hline 2 & 13423863 & 60.5\% \\ 3 & 13424503 & 59.3\% \\ 4 & 13425143 & 57.0\% \\ 5 & 13425783 & 59.0\% \\ 6 & 13426423 & 54.4\% \\ 7 & 13427063 & 60.0\% \\ 8 & 13427703 & 58.3\% \\ \hline \end{tabular} \end{center} \label{tab:numbers} \end{table} \subsubsection{Influence of Modular Design} The proposed network can be divided into the single-scan-based semantic segmentation module, the ASA module, and the MOS module. In order to analyze the benefits of modular design, we use different network architectures to replace the single-scan-based semantic segmentation module and the MOS module. Table \ref{tab:modular} shows the MOS results with different network architectures. \textit{SS(RangeNet++)} and \textit{MOS(RangeNet++)} represent the use of RangeNet++ network in the single-scan-based semantic segmentation module and the MOS module, respectively. \textit{SS(SalsaNext)} and \textit{MOS(SalsaNext)} indicate the use of SalsaNext network. The SalsaNext network has better semantic segmentation performance than the RangeNet++ network. The MOS results in Tab. \ref{tab:modular} shows that due to the modular design, the MOS performance can be improved by simply updating any trainable module in the network. \begin{table}[!t] \caption{Influence of Modular Design (Validation)} \begin{center} \begin{tabular}{c c c} \hline \textbf{Algorithms} & Params & IoU\\ \hline SS(RangeNet++) + MOS(RangeNet++) & 100761335 & 29.5\% \\ SS(RangeNet++) + MOS(SalsaNext) & 57089655 & 48.4\% \\ SS(SalsaNext) + MOS(SalsaNext) & 13423863 & 60.5\% \\ SS(SalsaNext) + MOS(RangeNet++) & 57095543 & 35.7\% \\ \hline \end{tabular} \end{center} \label{tab:modular} \end{table} \section{Conclusions} In this paper, we propose a moving object segmentation network with semantic information as guidance. The whole network includes three modules: a single-scan-based semantic segmentation module, an adjacent scan association (ASA) module, and a multiple-scan-based moving object segmentation module. The ASA module works as an intermediate to connect the semantic segmentation module and the MOS module. After the ASA process, we can obtain the correspondences and the difference information between the semantic features, which are beneficial to the MOS task. The experiment on the SemanticKITTI MOS dataset shows the effectiveness of the network. The modular design also facilitates the upgrading of a single module and further improves the MOS accuracy. \bibliographystyle{IEEEtran}
\section{Introduction} Public-key cryptography discovered in the 1970s of the last century provided a long-sought solution to the problem of secret key exchange \cite{DiffieHellman}. The ingenious breakthrough allowed for the promotion of ideas such as secure communication on the Internet. The security of public-key cryptography is based on the high computational complexity of the problem used, such as factorisation of composite numbers. When public-key cryptography has already been implemented on a global scale, it has been realised that the complexity of the problems used can be reduced if quantum computing resources are used \cite{Shor}. This raised concerns about the security of public-key cryptography with respect to hypothetical quantum attacks. However, the solution to the problem already existed (theoretically) and relied not on computational complexity-based security but on information-theoretic security (ITS). The solution is the quantum key distribution (QKD) \cite{Ekert91}. While extremely appealing from the theoretical viewpoint, technical difficulties precluded the wide implementation of QKD for decades, since its theoretical introduction in the 1980s of the last century. However, the situation has improved significantly in the last few years and QKD solutions are blossoming. However, the remaining significant obstacle is the distance on which the QKD can be performed. This is due to the suppression of photons in the optical medium. Therefore, ground-based optical fibre links allow for practical QKD (sufficiently high key exchange rate) over distances not longer than approximately 100 km \cite{range}. A possible, but costly and challenging, solution to the problem is to utilise space. Due to the much weaker suppression of photons in air and cosmic vacuum, QKD can be performed at much longer distances \cite{range}. The potential solution to the problem of the constraint on the distance at which the QKD can be performed on the ground is given by quantum repeaters. However, the technology is not mature enough to be implemented in the present realisations of the QKD solutions. As a consequence, in the current implementations of QKD networks (quantum networks), classical trusted nodes must be used. The QKD networks are, consequently, hybrid networks with quantum links and classical nodes. Examples of experimental realisations of such networks are: Tokio network \cite{tokio}, Beijing-Shanghai network \cite{Beijing-Shanghai}, Madrid network \cite{madrit}. However, the existence of the classical nodes raises security concerns. Although the QKD link has been shown to be ITS-safe, nodes can become a source of information leakage. The purpose of this article is to present a scheme that will significantly improve the security of hybrid QKD networks. Notably, at this point, QKD algorithms are also potentially vulnerable to the man-in-the-middle (MITM) attacks. Usually, this problem is resolved by applying the authentication of the classical nodes. Since the idea of employing QKD is to eliminate non-ITS protocols, the authentication of QKD nodes must be performed with the use of the Wegman-Carter protocol, which has been proven to be of the ITS class. More information about QKD authentication can be found in Ref. \cite{autentykacja}. Although the authentication problem can be successfully resolved in this way, this does not concern end-to-end encryption (E2EE). From a theoretical point of view, using QKD combined with a one-time pad (OTP) guarantees end-to-end ITS communication. However, with actual limitations on the key exchange rate, this approach is too slow to be used instead of classical communication. An alternative to OTP is to use weaker (non-ITS) symmetric cryptography algorithms that are generally resistant to quantum attacks \cite{post-quantum-crypto} and this seems to be the way the QKD network could be used. A completely different direction for preparing for quantum attacks, which does not rely on QKD network, is post-quantum public-key cryptography, which has been intensively developed in recent years \cite{post-quantum-crypto2}. In this work, we consider the potential vulnerability in the quantum network based on trusted nodes with multiple paths \cite{multipath}, we construct two models of possible attacks, the uncorrelated attack, in which each node has a certain probability of becoming compromised, and the correlated attack, in which the opponent owns certain resources that could be used to compromise the security of certain nodes. Furthermore, based on \cite{Zhou2019SecurityAA}, we extend the QKD multiple-path distribution protocol, assuming that the paths can overlap. Our analysis shows that to improve security, it is (under certain conditions) more optimal to add interlinks between disjoint paths, instead of adding a new path. A similar concept using overlapping paths has been presented in \cite{podobnypomysl}, where security is improved by introducing complete subgraphs (``cities''). While preparing this article, another work that addresses security issue of overlapping multiple paths has appeared \cite{securityrosjanie}. \section{The multiple paths protocol} \label{sec:protocol} One of the central concepts behind the design of a telecommunication network is redundancy. To marginalise the probability of a lack of connectivity between two nodes, there must be at least two alternative paths that connect arbitrary two nodes. Here, we assume that the same must concern QKD networks, in particular the hybrid QKD networks under consideration. This approach has been proposed in \cite{multipath} and recently explored in \cite{solomons2021scalable}, in which optimal key flooding is considered. Now to help the reader better understand further material, we introduce problems concerning security and concepts of multipath protocol. Consider a simple uncorrelated attack scheme, in which the possibility of a successful attack on any node is $p$ and $n$ is the total number of intermediate nodes on the path (excluding communicating nodes/parties). The probability that at least one node has been successfully attacked is $P_1=1-(1-p)^n \approx np$, where the approximation is valid for $p \ll \frac{1}{n}$. So, roughly the probability of an attack on the network grows with the number of nodes. If the network is a hybrid QKD network, this would be equivalent to leaking a secret key exchanged via the attacked node. Following this simple model, we find the probability that at least two nodes have been attacked: $P_2 \approx (np)^2$. Therefore, under the condition $p \ll \frac{1}{n}$, the probability of a successful simultaneous attack on at least two nodes is quadratically lower than in the previous case. Following the above observations, let us consider a scenario in which a secret key $K$ is composed of two parts $K_1$ and $K_2$ of equal length. For example, if the key $K$ is devoted to be applied in the symmetric AES-256 algorithm, both parts $K_1$ and $K_2$ are 256 bits long. Now, we require that knowing one of the keys gives us zero knowledge of the key $K$. This requirement can be easily satisfied by the One-Time Pad (OTP) applied to the two parts $K_1$ and $K_2$, so that: \begin{equation} K = (K_1,K_2) = K_1 \oplus K_2, \label{OTPKK} \end{equation} where $\oplus$ is the XOR operation (addition modulo two). Now, let us suppose that $K_1$ and $K_2$ are two bit strings that are distributed using two different paths in the QKD network. The two paths connect two parties (nodes $A$ and $B$), between which the key $K$ is exchanged (see Fig. \ref{SSQKDPlot1}). For every two adjoint nodes on the network $(i,j)$ a secret key $K_{ij}=K_{ji}$ is established via QKD. Then, in a \emph{hop-by-hop} approach, if node $i$ wants to send a secret message $M$ to the node $j$, the OTP encryption is used by evaluating the cipher $C=M\oplus K_{12}$. The classical ciphertext $C$ is transmitted to the subsequent node via the classical (untrusted) channel. Then, by evaluating $M=C\oplus K_{12}$, the ciphertext is decrypted at the node $j$. \begin{figure}[ht!] \centering \includegraphics[width=5cm,angle=0]{QKDNet} \caption{Pictorial representation of the exchange of a secret key $K=(K_1,K_2)$ shared in two paths connecting the communicating nodes $A$ (transmitter) and $B$ (receiver). Here, the part $K_1$ is exchanged via the nodes 1 and 2, while the part $K_2$ is exchanged via the nodes 3 and 4. In the first step the, the partial keys $K_1$ and $K_2$ are sent from the node $A$ to the nodes $2$ and $4$ respectively. In both cases the OTP encryption with the QKD keys ($K_{A2}$ and $K_{A4}$) are used. The procedure is then continued, via the nodes $1$ and $3$, to the end node $B$.} \label{SSQKDPlot1} \end{figure} The protocol introduced in this section quadratically improves the security of secret key exchange in a hybrid QKD network. However, this is achieved by the cost of doubling the number of keys exchanged. Therefore, we reduce the performance of the system by a factor of two. However, the quadratic improvement by the linear cost seems to be a beneficial solution. The decomposition of the secret key into two parts is an example of a secret sharing. It is worth emphasising that the idea can be generalised by splitting the secret key into three or more constituents. In this case, Eq. \ref{OTPKK} generalises to: \begin{equation} K = (K_1,K_2,\dots,K_N) = K_1 \oplus K_2\oplus \dots \oplus K_N, \label{OTPKN} \end{equation} where $N$ is the number of different paths. The realisation of the case with $N>2$ allows for a further reduction of the probability of the attack to $\sim (np)^N$. However, this is due to the cost of both much complex topology of the QKD network and its lower performance. In the next sections, we perform a detailed analysis of two types of attack on trusted nodes and in Sec. \ref{sec:multipathscheme} we present the concept in which key exchange can be done with paths that cross each other along with the discussion of performance of this new protocol. \section{Security considerations on Multiple Non-Overlapping Paths}\label{sec:attacks} We consider two models of possible attack, first for an uncorrelated attack that simulates leaking and publishing information (secret key) steaming from random failure of certain nodes, and second for a correlated attack where the party is assumed to have certain resources that can be used to take over some nodes and gain information. We model the QKD network by an unweighted graph, where two communicating nodes can always be connected by a certain number of disjoint paths. This is justified as a desired property of a real telecommunication network \cite{Elliott_2002}. \subsection{Uncorrelated attacks} \label{uncorrelated-attack} \subsubsection{General formulation} {\it Given a graph with two distinguished nodes named $A$ and $B$ (Alice and Bob), the $i$-th node is marked with a certain number $p_i$ representing the probability that during the protocol the $i$-th node will be hacked and publicly reveal secret key ($p_i=0$ represent complete trust while $p_i=1$ represent fully corrupted node). $A$ and $B$ can be connected with some disjoint paths, and to compromise security of protocol at least one node on each path must become untrusted. The task is to find a system of disjoint paths between $A$ and $B$ that minimise the probability of hacking communication.} For a predefined system, calculating the probability is an easy task. Let $\mathcal{R}$ be the family of all paths in the solution (where the path is considered to be a set of intermediate nodes, \emph{i.e.} excluding the $A$ and $B$ nodes). Then, the probability of hacking is given by: \begin{equation} P = \prod_{\mathcal{R}_j \in \mathcal{R}} \left(1-\prod_{i \in \mathcal{R}_j} (1-p_i)\right). \end{equation} Here, each node is identified with its label $i$. This task poses an algorithmic challenge, and to the best of our knowledge, there is no standard effective method to solve this in this form. Instead, we could search for a strategy that guarantees a certain threshold of security level and is flexible within this limit. As a benefit, this may also allow us to adjust the algorithm to network traffic. In the next paragraph, we present an approach to the problem with respect to the considerations mentioned above. \subsubsection{Simplified problem} Here, we assume that each node has the same probability $p$, which is small enough so that we can use the approximation $1-(1-p)^n \approx np $. The approximation is satisfied under the assumption that $np \ll 1$ and is further analysed in Sec. \ref{sec:error}. According to the model above, we can simply take $p :=\max\limits_{i} (p_i)$. If we consider $N :=|\mathcal{R}|$ paths each containing $n_j :=|\mathcal{R}_j|$ (intermediate) nodes, then the probability of hacking equals: \begin{equation} P=(n_1 p) (n_2 p) ... (n_N p) \leq p^N \left(\frac{\sum\limits_{1\leq j \leq N} n_j}{N} \right)^N = \left( \overline{n} p \right)^N, \end{equation} where $\overline{n}$ denotes the average path length (in the sense of the number of intermediate nodes), and we use a well-known inequality: \begin{equation} \label{ineqality} \sqrt[N]{a_1 a_2 ... a_N} \leq \frac{a_1+a_2 +... + a_N}{N}. \end{equation} Notice that the equality is satisfied for $a_1=a_2=...=a_N$, which in the case under consideration corresponds to the paths of equal length. In a real QKD network, we may expect that the lengths of the paths are similar, and in this case the given upper bound could be a good approximation. \subsubsection{Solution to the simplified problem} Now we can slightly reformulate the problem so that we do not minimise $P$ but $P':=(\overline{n} p)^N$ instead. This depends on two factors: the number of paths and the average length of these paths. In many analyses, equally length paths are considered, and therefore it is always optimal to use as many paths as possible, but it turns out that it may not be desired for an arbitrary network. The analysis of an educational example is provided in \nameref{sec:app_attack_example}. For fixed $N$ solution which is given and can be obtained by the minimum-cost flow algorithm (with unit capacities and certain transformation of graph), there also exist other simpler algorithms like Suurballe's algorithm (vertex disjoint path version) (see Ref. \cite{disjoint_paths}). We may assume that in realistic case $N$ will not exceed 10. Therefore, an efficient algorithm could be obtained by checking each possible number of paths separately. One last remark is about the practical aspect of the obtained solution. If we accept loss in security level (but within threshold bound), we can try to add traffic management within the algorithm simply by manipulating weights of edges. Undesired routes will be less likely to be chosen. However, in this article, we do not develop this concept further - it is left for future work. \subsubsection{Multiple communicating parties} The problem arises when we have more than two communicating parties, and we do not allow a path to share a link (for quantum networks the effectiveness of links is the main restriction). This is an extensively studied problem called $k$-EDP ($k$-edge-disjoint path problem) \cite{EILAMTZOREFF1998113} \begin{definition} Consider the following well-known problem, which is called the $k$-disjoint paths problem ($k$-DPP). For a given graph $G$ and a set of $k$ pairs of terminals in $G$, the objective is to find $k$ vertex-disjoint paths connecting given pairs of terminals or to conclude that such paths do not exist. \end{definition} It is proven that this problem is NP-complete \cite{k-DPP_KARP}. Therefore, finding many paths for each of the pairs $k$ is ``at least of class NP,'' as this problem can be reduced to $k$-DPP by adding an appropriate number of paths between distinguished pairs of terminals. However, if $k$ is fixed, polynomial solutions exist for $k$-DPP and even for shortest $k$-DPP \cite{lochet2020polynomial,KAWARABAYASHI2012424}, so we can hope to search for a solution while dividing the network into clusters. \subsection{Correlated attacks with finite resources} As in the previous section, let us first formulate a general problem: {\it Consider a graph with a distinguished pair of nodes $(A,B)$. We assume that there exists a system of (disjoint) paths connecting $A$, $B$ and the adversary knowing this system, having some resources which can be used to take control of nodes and extract keys. The following assumptions are made: \begin{itemize} \item Adversary has full knowledge about the arrangement of the system. \item Hacking one node on the path makes this path untrusted. \item Communication is hacked if each path is untrusted. \item Probability $p_i$ that the $i$-th node becomes untrusted depends on amount of allotted resources $r_i\geq 0$ and is given with proper continuous function $p_i = f_i(r_i)$ specified for this node. Because $f_i(r_i)$ has an interpretation of probability, it takes values from the range $[0,1]$. \item Resources are bounded, that is, $\sum\limits_i r_i \leq R$. \item For each node $f_i(0)=0$. \end{itemize} We seek tactics (system of paths) that minimise the probability of hacking communication.} \\ \indent As before, solving problem in this form poses a challenge, and even for a fixed system, calculating the minimal probability of hacking (corresponding to optimal redistribution of resources) is difficult due to the continuous character of variables and unknown functions. Therefore, again, we need simplification. \subsubsection{Simplified problem} We first make the following observation: \begin{lemat} Without loss of generality, we can assume that each function $f_i$ is not decreasing and the condition $\sum\limits_i r_i = R$ is used. \end{lemat} \begin{proof} We do not need to use all resources, so if it is optimal to use $x_2$ resources for a certain node and there exists a $x_1$, such that $x_1 <x_2$ and $f(x_1)>f(x_2)$, then it is optimal for the adversary to use $x_1$. The adversary will obtain the same result using the alternative function $f(x)=\max\limits_{y\leq x}(f(y))$. The second part of the lemma is straightforward. \end{proof} In real communication networks, we can assume that each node does not differ much in construction, and thus their characterisation will have much in common. At the same time, one shall not allow the adversary to easily take control of the node (than the mean $f(R) \ll 1 $), so the arguments of the function could be considered small, which allows us to expand the function $f$ in series and consider its linear approximation. Alternatively, for a given function $f(x)$, we can construct a new function $g(x)$ that is linear up to a certain point, then constant (equal 1) and satisfy $f(x) \leq g(x)$. We summarise this discussion with the following additional assumptions for the problem: \begin{itemize} \item The function $f$ is the same for all nodes, \emph{i.e.} $\forall_i f_i=f$. \item The function $f$ is not decreasing, and the opponent always uses all available resources. \item The function $f$ is expressed in following form: \[ f(x)= \begin{dcases} \alpha x,& x\leq \frac{1}{\alpha}\\ 1, & x\ge \frac{1}{\alpha} \end{dcases}. \] \end{itemize} With this simplification it turns out, that a sensible analysis can be made. We first develop optimal adversary strategy for a single path of length $n$. To solve this problem we use Lagrange multiplayer method. The function we want to maximize (probability of hacking) is: \begin{equation} P_{\text{sp}}(r_1,r_2...,r_n)=1-(1-f(r_1))(1-f(r_2))...(1-f(r_n)), \end{equation} with constrain $G(r_1,...,r_n)= \sum_i r_i -R = 0$. As a result, we see that among the candidates for the global extremum (points $(r_1,r_2,...,r_n)$) some of $r_i=0$ and the rest are equal to each other. Therefore, the set of extreme values is $\{ P_k | k \in {1,...,n} \}$, where $P_k=1-\left(1-\alpha \frac{R}{k}\right)^k$ and since this represents the Euler sequence that is decreasing, we obtain the global maximum for $k=1$, which corresponds to placing all available resources on a single node. \\ We summarise it in the following theorem: \begin{tw} Given a single path, the optimal strategy for an adversary is to attack a single node, and the probability of hacking is $\alpha R$. \end{tw} From this we obtain an important conclusion about the situation with many paths. \begin{corollary} Given $N$ disjoint paths, the optimal strategy for an adversary is to attack only one node on each path. \end{corollary} \begin{proof} Let us assume on the contrary that in optimal strategy for the opponent there exists a path on which two or more nodes are attacked. If we relocate resources from these nodes to a single node on this path, we will have a higher probability of hacking this path and, therefore, obtain a better strategy as the probability of hacking system is the product of probabilities for individual paths. \end{proof} If we have $N$ paths and $r_j$ are resources used to hack the $j$-th path (at a single node), then the probability of hacking the protocol is: \begin{equation} P(r_1,r_2,...,r_N) = (\alpha r_1)(\alpha r_2) ... (\alpha r_N) \leq \left(\frac{\alpha R}{N} \right)^{N}. \end{equation} Here, we assumed that $R \ll \frac{1}{\alpha}$, and we used Eq. \ref{ineqality}. \subsubsection{Solution} Choosing the hacking strategy, we can focus on minimising term $\left(\frac{\alpha R}{N} \right)^{N}$. There is only one variable to control: the number of disjoint paths. As $\alpha R$ in this approximation shall always be less than $1$ (otherwise, the approximation we used fails), we are interested in increasing $N$. The maximal number of disjoint paths between pair $A$ and $B$ is equal to the minimal size of the vertex cut of that pair, thanks to Menger's theorem. Through vertex cut is a notion that has no unique definition in the literature, we restate it here: \begin{definition} \textbf{A-B vertex cut} is a set of vertex that does not contain $A-B$ so that after the removal of this set from the graph, there is no path between $A$ and $B$. Later in the article, we will refer to it as cut, while the default vertex $A$ and $B$ will be sender and receiver (Alice and Bob). We say that the vertex cut is \textbf{minimal} if there is no cut with a smaller order. \end{definition} We summarise our conclusions with the following theorem: \begin{tw} To improve security against correlated attack for users $A$ and $B$, the desired strategy is to increase the order of the $A-B$ minimal vertex cut, that is, the number of disjoint paths. \end{tw} Finding order of minimal vertex cut is a problem equivalent to (after a simple transformation of graph) solving the \emph{max-flow problem}. \begin{comment} \subsubsection{general theory flow considerations solution} We consider most general case which mean we exchange information through all nodes (not necessarily with one path). In other words, we have parted key (only one for known) and send its fragment through net with our desire. We consider the attacker to have certain resources that can be used to take control of nodes and leak information. \begin{itemize} \item We define the information extracted by the attacker using an expectation value, each eleventh bit of a certain key path, if the probability of hacking its path is $P_i=1-(1-n_1)(1-n_2)...$ (where $n_i$ are the probability of hacking nodes belonging to this path), then the expectation value is $\sum P_i$. \item We seek a distribution of the information flow that minimises the expected value of the attacker of the information extracted for given resources \textit{x}. \end{itemize} \\Solving problem in this form is complicated and does not provide a satisfactory able to analyse result, which we present below. An analytical solution for this problem can be obtained by applying Langrange multipliers to marginalise the expectation value. For each possible path between two aforementioned nodes we can check how many bits are going through it and then calculate probability $P_i$ and take $n_i$ as variables. Although it will usually generate many nonlinear equations impossible to solve analytically, therefore to obtain a solution, numerous methods must be applied. The other way is to start with using numerical method for minimising the function. \subsubsection{Simplified solution for "linear" f} Useful solution for problem can be obtained with the additional assumption that f(x) is of the form Let us recall an idea from graph theory - minimal s-t is a subset of vertices that divide into two disjoint parts that are one ant t in another. \begin{tw} The attacker can restrict the attacked nodes to a minimal cut in the graph. \end{tw} \begin{proof} As we have full knowledge about information flow, let us take the following statistics, we know which percent of key goes through each node. \end{proof} \end{comment} \section{Multiple Overlapping Paths scheme} \label{sec:multipathscheme} We have performed an analysis of the security of multiple paths scheme models under the assumption that all paths are disjoint. We now present a Multiple Overlapping Paths scheme (MOPs), where additionally to system of disjoint of paths the interpath links exist. Such an extension can always be made without loss of security, with only slight modification of the well-known \emph{hop-by-hop} protocol. Unlike MNOPs, where each intermediate node has exactly two links, now it can have more. A similar problem was previously analysed in Ref. \cite{podobnypomysl}. However, to improve security, the total number of links is increased. In this article we follow an alternative idea, increasing security with the use of interlinks but without changing the number of links. Roughly, we can say that we completely remove one path and use its resources (links) to make interconnections between the rest. \begin{definition} In the MOPs communication scheme, each node in the network, except Alice and Bob, sends the $XOR$ result of all the keys from the neighbour connections to Bob via an unencrypted (but authenticated) channel (available to Eve). The shared key will be the $XOR$ of all such received messages for Bob, and for Alice $XOR$ of all subkeys Alice shares with intermediate nodes. \end{definition} This idea was originally published in \cite{Zhou2019SecurityAA}, where a detailed analysis is included. Here, we recall only the most important conclusions. For the case without interlinks between paths, this will work as in the classic scheme, with the difference that the message is transmitted to Bob instead of to the next node on the path, but in \nameref{sec:appNDMS_to_hopbyhop} we show that MOPs can be modified so that it mimics the hop-by-hop method, which is important for the practical use and efficiency of the network. \begin{property} In MOPs connection is secure only if there exist a path with node controlled by adversary. Therefore, to hack a communication between $A$ and $B$, adversary must control $A-B$ vertex cut. \end{property} There is no reward in using MOPs against uncorrelated attack. It can be shown that adding interlinks to a system of disjoint paths does not increase the order of minimal $A-B$ vertex cut (for example, because the number of nodes connected to Alice does not change and these nodes form a vertex cut). However, it can change the number of such cuts and, therefore, turns out to be useful against uncorrelated attack. In general, to calculate probability that protocol is compromised, one must know trustfulness of all nodes and calculate probability that at least one of $A-B$ cuts (not necessarily minimal) becomes untrusted. This can be really challenging problem in general. We managed to perform analytical analysis on certain special type of ``grid-like'' graph that could model real QKD network. The model is discussed in the following paragraphs. \subsection{Intuitive approach} \label{sec:intuitive_approach} We begin with an intuitive assertion that adding interlinks instead of a new path could perform better than MNOPs. If the probability of compromising the security of a node (and therefore leaking the key) is sufficiently small, we can take into account only the smallest (minimal) $A-B$ vertex cut. The number of such combinations of nodes in the classical scheme is \begin{equation} \prod\limits_{1\leq j \leq N}n_j \approx (\overline{n})^N, \end{equation} where $n_j$ is the number of intermediate nodes in $j$-th path and $N$ is the number of paths. We will improve security by reducing the number of $A-B$ vertex cuts in the graph by adding interlinks between paths. An example is shown in Fig. \ref{fig:schem-example}. \begin{figure}[h] \centering \includegraphics[scale=0.8]{classic2scheme.pdf} \includegraphics[scale=0.80]{l2scheme.pdf} \caption{MNOP network (above) with 2 disjoint paths and with additional interlinks (below).} \label{fig:schem-example} \end{figure} Let us assume that the number of intermediate nodes between $A$ and $B$ is $n$ (for every path) and we have initially 2 disjoint paths. The number of 2-cuts (cuts of size 2) is $\approx 3n$, for the MNOP scheme it would be $n^2$. If $p$ is sufficiently small, we can state that only minimal cuts influence the probability of hacking. Then, the probability of compromising the security of the MNOP scheme is $(np)^2$, while for MOPs: \begin{equation} \underbrace{{2 n \choose{2}}p^2(1-p)^{2n-2}}_{\text{probability of hacking pairs}} \times \underbrace{\frac{3n}{{2 n \choose{2}}}}_{\text{allowed pairs}} \approx 3np^2. \end{equation} Formula stems from binomial distribution (chance that we control 2 nodes) and the probability that these two nodes form the desired hacking cut. This can be a significant advantage when $n$ is large. However, we use additional links that, in turn, could be used to make another path. We now pose the question: ``Can adding interlinks, instead of a new path, be a desired strategy?''. It appears that in some cases, especially for large $n$, this can be true. Comparing the graph with interlinks and the MNOP scheme with one with one additional path, we obtain probability, respectively $(np)^3$ and $(3np^2)$. The ratio of probabilities is \begin{equation} \eta := \frac{P_{\text{MOP}}}{P_{\text{MNOP}}} \approx \frac{3n p^2}{(n p)^3} = \frac{3}{p n^2}. \end{equation} If $\eta <1$, it is optimal to use the proposed strategy. But this poses a condition on $p$, namely: \begin{equation} p> \frac{3}{n^2}. \end{equation} At the same time we have assumed that $p$ is ``sufficiently'' small (because we neglected the influence of non-minimal cuts), in fact, it must at least meet conditions as in chapter \ref{sec:protocol}, \emph{i.e.} $p \ll \frac{1}{n}$. Now, if $n$ is sufficiently large, these conditions do not lead to contradiction. In the next chapters, we formalize and generalize the above considerations. \subsection{Adding a single link} \label{sec:adding_single_link} After the discussion in the previous section, we could easily notice an important property, namely that adding just one link can reduce the probability of hacking by a factor of $\approx 1/2$. This approximation becomes more accurate as $n$ increases. Consider a MNOPs network with two disjoint paths as in Fig. \ref{fig:schem-example}, if we add a single intermediate link somewhere in the middle of the network and perform similar considerations as in Sec. \ref{sec:intuitive_approach}, we obtain that the number of 2-cuts is $\approx 2 \left( \frac{n}{2} \right)^2= \frac{n^2}{2}$. Consequently, for a network with $l$ paths, we can add $l-1$ links and reduce the probability of hacking by a factor $\left(\frac{1}{2}\right)^{l-1}$. This can be an important property, as by using only a few links, quite a good profit is obtained. Unfortunately, this effect does not stack: just from the example for two paths presented in Fig. \ref{fig:schem-example} we see that adding $n$ interlinks gives as probability reduction by factor $\frac{3}{n}$ not $\left(\frac{1}{2}\right)^n$. \subsection{Formal consideration}\label{subsec:formalconsiderations} Now, we want to compare two situations, MNOPs scheme with $l+1$ disjoint path and strategy presented in Sec. \ref{sec:intuitive_approach} (MOPs) where on the behalf of interlinks we remove one path. For the new strategy, Alice and Bob are connected through $l$ disjoint path each containing $n$ intermediate nodes and each vertex having the same trust level $(1-p)$. We introduce the numbering system of vertices: $A$, $B$ for two communicating vertex, $g_{i j}, \ i \in \{1,...,l\},\ j \in \{1,...,n\}$ for intermediate nodes where $i$ and $j$ denote row and column number, respectively. Adding interlinks can be realized on different strategies. Here, we develop a strategy called the \textit{MOPs l-scheme}, one that is probably not optimal but provides the possibility of analytical analysis. In the MOPs $l$-scheme we connect all vertically adjoined nodes in every ($l-1$)-th column (connecting take $l-1$ edges). Formally, new graph is obtained by adding a set of edges: \begin{equation} \mathcal{E} =\{ g_{ij} \leftrightarrow g_{(i+1)j} | j \equiv 0 \pmod{l-1} \; \wedge \; i<l \}. \end{equation} It can be easily seen that the number of interlinks created is at most $n$. The example is presented in Fig. (\ref{fig:l-scheme}). \begin{figure}[h] \hspace{1,5cm} \includegraphics[scale=0.7]{l4scheme.pdf} \caption{A network with interlinks placement in MOP 4-scheme. The configuration is an alternative to 5 disjoint paths (MNOP) scheme.} \label{fig:l-scheme} \end{figure} In the MNOPs scheme, the probability of hacking is $(1-(1-p)^n)^l \approx (n p)^{l}$. We will keep this approximation, but later, in Sec. \ref{sec:error}, we perform an analytical analysis and estimate its error. To calculate the probability of hacking the $l$-scheme we divide the sample probability space into events $H_k, \; 0 \leq k \leq nl$, where each event means that exactly $k$ of $nl$ nodes become corrupted. This is a complete and pairwise disjoint set of events. Therefore, according to the law of total probability and binomial distribution, probability of information leakage in the MOPs $l$-scheme is: \begin{equation} \label{eqn:gen-prob} P(H)=\sum_{k=0}^{n l} {{nl}\choose{k}} p^k (1-p)^{nl-k} P(H|H_k), \end{equation} where $H$ is an event related to hacking an $A-B$ vertex cut. Of course, $P(H|H_k)=0$ if $k<l$. Therefore, we must calculate $P(H|H_k)$ for $k\geq l$. This is rather a difficult task. Instead, we perform an estimation that provides a useful upper bound on $P(H)$. Let us denote the number of minimal cuts for $l$-scheme of length $l$ by \begin{equation} c(l,n) :=P(H|H_l) {{n l}\choose{l}}. \end{equation} Obviously, $c(l,n)=n$ if $l=1$, and for $l \ge 2 $ we have the following theorem: \begin{tw} \label{alpha} Define: \begin{equation} \alpha(l)= \frac{2^{-l} \left(\left(1+l+\sqrt{l^2+6 l-7}\right)^l-\left(1+l-\sqrt{l^2+6 l-7}\right)^l \right) }{\sqrt{l^2+6 l-7}}, \label{alphalformula} \end{equation} for $l \ge 2$ and $\alpha(1)=1$. Then \begin{equation} \label{eqn:alpha_estimation} \alpha(l) \times(n-2l^2) \leq c(l,n) \leq \alpha(l)\times n. \end{equation} \end{tw} The term $\alpha(l)$ gives the asymptotic average number of minimal cuts per column as $n \rightarrow \infty $. For real schemes, it serves as an upper bound. \begin{proof} The vertex cut requires hacking at least one vertex in each row, and each vertex belongs to at least one cut (each column forms a cut), and if we settle on one vertex, we can easily find all cuts containing this vertex. Let $g_{ij}$ be the settled vertex and \begin{equation} \label{cond} 1+l<j<n-l, \end{equation} we can formulate a procedure that determines all vertices of the next (or previous) row that can be used to form the cut: \begin{itemize} \item If degree $g_{ij}>2$, then the possible vertices are $g_{(i+1)(j+r)} ,\; r \in\{-l+1,-l+2,...,l-2,l-1\}$. \item If degree $g_{ij}=2$, then the possible vertices are $g_{(i+1) m} ,\; m\in \{a...b\},\;$ where $a$ and $b$ are determined by conditions: $deg( g_{ia} )>2 , \; deg (g_{ib})>2,\; b-a=l-1,\; a < j < b$. \end{itemize} So, we can say that each vertex ``produces'' certain new vertices in each row. For vertices that do not meet \eqref{cond}, which can be intuitively described as ``boundary vertexes'', the procedure above must be slightly modified, but it will result that the number of ``produced'' vertices is smaller. Then, we calculate $\alpha(l)$ with the following recursion: \begin{verbatim} f(n,dg2): if n==l return 1 if dg2==True return 3*f(n+1,1)+2(l-2)*f(n+1,0) if dg2==False return 2*f(n+1,1)+(l-2)*f(n+1,0) alpha(l): return (f(l,1)+(l-2)*f(l,0))/(l-1) \end{verbatim} This can be alternatively rewritten as a pair of related sequences and expressed in the following form with matrix multiplication: \begin{equation} \alpha(l)=\frac{1}{l-1} \begin{pmatrix} 1 & l-2 \end{pmatrix} \begin{pmatrix} 3 & 2(l-2) \\ 2 & (l-2) \end{pmatrix}^{l-1} \begin{pmatrix} 1 \\ 1 \end{pmatrix}. \label{AnalyticAlpha} \end{equation} The matrix in this formula can be diagonalized leading to Eq. \ref{alphalformula}. The expression in $\alpha(l)$ is overestimated because we neglected the ``boundary corrections''. Because the ranges of $r$ and $m$ are sometimes smaller (especially close to the sides of the graph), the estimation improves as $n$ increases. An underestimation is obtained if we do not count all vertex cuts that contain ``boundary vertices''. \end{proof} We now have analytical estimation for the first non-zero term in \eqref{eqn:gen-prob}, where we neglect ``boundary corrections''. In fact, it can also be calculated numerically in time $O(nl)$ using dynamic programming. The algorithm is presented in \nameref{sec:appdynprog}. Therefore, in the numerical calculation (for hypothetical testing of the algorithm), we will use the exact value of $\alpha(n,l)$, although for analysis it is convenient to use the upper bound as in Theorem \ref{alpha}. The difference is significant when $n$ has a similar order as $l$. Calculating higher terms in \ref{eqn:gen-prob} pose a problem. However, it turns out that if $nlp < 1$ it can be approximated by geometric series. To do that, we first derive important observation: \begin{lemat} \label{beta} Consider \begin{equation} \beta_{n,l}(k) :={{nl}\choose{k}} P(H|H_k), \end{equation} which is the number of cuts of size k in the MOPs l-scheme graph. The following inequality holds \begin{equation} \label{eqn:beta} \beta_{n,l}(k) \leq \beta_{n,l}(k-1)nl \text{ for } k-1 \geq l. \end{equation} Therefore: \begin{equation} \label{beta_estimated} \beta_{n,l}(k) \leq \alpha(l) n (nl)^{k-l}. \end{equation} \end{lemat} The Lemma \ref{beta} is obtained by numerical, not analytical analysis. We do not posses a proper proof of its validity, but for practical use, we only need to confirm its correctness with given $n$ and $l$. This could be done numerically with brute force, generating all possible vertex sets, and checking if it is cut. In fact, due to the computational complexity of this method, it can only be performed on small graphs. We performed such calculations with all possible schemes with graph size < 30 \emph{i.e} if $nl <30$. See more in \nameref{sec:betacalculation}. An alternative method that could substantiate these results is its statistical testing \emph{i.e} generating a sample consisting of random sets of nodes and calculating the ratio of $A-B$ cuts, generated this way versus the sample size. An important observation that is worth stressing is that the problem of calculating the number of cuts in such a graph (and calculating probability of that there exists a path between $A$ and $B$) looks similar to the percolation problem. We did not follow this lead, but it could be useful if one would try to prove the lemma \ref{beta}. With use of the above lemma we can now obtain: \begin{tw} \label{estimate_lscheme_prob} If $p$ is small enough, so it satisfies $n l p \leq r < 1$, then: \begin{equation} P(H)\leq \frac{1}{1-r} \alpha(l)n p^l. \end{equation} \end{tw} \begin{proof} First, from \eqref{beta_estimated} we derive \begin{equation} P(H|H_k) = \frac{\beta_nl(k)}{{ nl\choose k}} \leq \frac{ \alpha(l)n(nl)^{(k-l)}} {{nl\choose k}}. \end{equation} Then \eqref{eqn:gen-prob} can be estimated using a geometric progression formula with initial term $\alpha (l) n p^l$ and common ratio $nlp$. \end{proof} It will be useful to know how much our algorithm is better than the MNOPs. Thus, for a given network, we introduce efficiency coefficient $\eta$, which approximate ratio of probability of hacking of our algorithm vs MMOP scheme: \begin{equation}\label{eqn:eta-definition} \frac{P(H)}{(np)^{l+1}} \leq \frac{\frac{1}{1-r}\alpha(l)}{p n^{l}} :=\eta. \end{equation} As described before in Sec. \ref{sec:protocol}, we used the approximation $1-(1-p)^n \approx np$ for the classic scheme, which is not necessarily desired as is usually $1-(1-p)^n < np$. We refer to this concern in Sec. \ref{sec:error}, in which we show that due to this fact we shall introduce numerical correction for $\eta$. However, for ``reasonable'' graphs the corrected efficiency is in the worst cases only about $1.7$ grater than the one predicted by Eq.\ref{eqn:eta-definition}. Therefore, it has a really small impact and we omit it.The sufficient condition for the $l$-scheme to perform better than the classic scheme is: \begin{equation} \label{eqn:working} \eta < 1, \end{equation} Consequently, the risk of hacking is at least $\eta$ times smaller (if both schemes use the same amount of links). Equation \eqref{eqn:working} allows us to study the performance of the algorithm and we see that for the constant $p$ we can obtain, asymptotically for very large graphs, very low values of $\eta$. However, as trust of nodes grows (so $p$ becomes smaller), the effectiveness of the algorithm decreases. In the same time we need to keep assumed condition $nlp<r<1$. This may leads to concerns about upper bounds on $p$. However, for ``realistic networks'' we can assume that $n<100, l<10, r<1/2$ ($\frac{1}{1-r}<2$) what, in worst case, gives $p<1/2000$, which is not very restrictive. In Sec. \ref{sec:numerical_analysis} we present numerical analysis for \eqref{eqn:working} which shows exactly in which ranges of $n$ and $p$ our algorithm is useful. \subsection{Analysis of approximation in MNOPs scheme} \label{sec:error} Along chapters \ref{sec:attacks} and \ref{sec:multipathscheme} we use approximation $1-(1-p)^n \approx np$, which works for $np \ll 1$. Here, we analyse validity of this assumption and make correction to equation \eqref{eqn:working}. First, let us note that just for classic scheme we shall demand that $np < 1$. If this does not hold (so $p>\frac{1}{n}$), then the probability of hacking single path is: \begin{equation} \label{eqn:szacunki} P=1-(1-p)^n > 1-\left(1-\frac{1}{n}\right)^n > 1-\frac{1}{e} \approx 0.63, \end{equation} which is unacceptable for any real network called ``secure''. This can also substantiate reality of assumption made in Theorem \ref{estimate_lscheme_prob} that $nlp < 1$. We define parameter $\mu$ \begin{equation} \mu :=\frac{1}{n p} \geq 1, \end{equation} which is a certain constant fixed for a network (path), this divide all networks models (paths) on certain classes, with fixed value of $\mu$. Analysing validity of approximation $1-(1-p)^n \approx np$ as a function of $\mu$ gives us useful results, namely lower bound for probability of hacking. For a given class (characterized by $\mu$) consider: \begin{equation} v_n(\mu)= \frac{1-(1-p)^n - np}{np} = \frac{1-(1-\frac{1}{\mu n})^n - \frac{1}{\mu }}{\frac{1}{\mu }} = \mu \left(1-\left(1-\frac{1}{\mu n}\right)^n\right)-1. \end{equation} Clearly $$ P= 1-(1-p)^n= (1+v_n(\mu)) np .$$ We have two following properties: \begin{equation} v_n(\mu) > v_{n+1}(\mu), \end{equation} and \begin{equation} v(\mu):= \lim_{n \to \infty} v_n= -1 + \mu(1-e^{-1/\mu}). \end{equation} Let $\gamma(\mu) := 1+v(\mu )= \mu (1-e^{-1/\mu}) <1$. Then \begin{equation} 1-(1-p)^n \geq \gamma(\mu) np. \end{equation} And therefore putting $\gamma(\mu) np$ instead of $np$ in \eqref{eqn:working}, we get more restrictive condition on $\eta$ (that refer to situation that classic scheme works better than assumed). \begin{equation} \label{eqn:working-restrictive} \frac{P(H)}{(1-(1-p)^n )^{l+1}} \leq \frac{P(H)}{(np)^{l+1}} \frac{1}{\gamma(\mu)^{l+1}} \leq \eta \frac{1}{\gamma(\mu)^{l+1}} < 1. \end{equation} Function $\gamma(\mu)$ is presented on figure \ref{fig:gamma}. \begin{figure}[h] \centering \includegraphics[scale=0.6]{gamma.pdf} \caption{Plot of the function $\gamma(\mu)$.} \label{fig:gamma} \end{figure} We conclude that typically we shall deal with systems with parameter $\mu \ge 10$, this is done by posing arbitrarily but reasonable condition ($P<1/10$) and analysis as in equation \eqref{eqn:szacunki}. We assume that usually $l\leq 10$, otherwise communication will be very expensive in resources. For such assumption we can estimate maximal value of correction, namely $\frac{1}{\gamma(10)^{11}} \approx 1.72$. This section does not change our conclusions significantly but is required for completeness of analysis. \subsection{Numerical analysis} \label{sec:numerical_analysis} For given graph and parties communicating with $l$-scheme, parameters like $n$ and $l$ can be settled or easily estimated, but trust (equivalently probability of hacking) of intermediate nodes is very unclear to define and measure in reality. It can be connected with various events such as random failure of network , corrupted labours, hackers or it could change in time. Therefore, it is rather impossible to declare its value on the stage of theoretical considerations. But still we expect that this trust (and respectively probability of hacking $p$) must be in reasonable range, for example $p\approx 0.1$ or $p\approx {10^{-27}}$ are certainly not, of course for security purpose $p$ should be as least as possible. Another problem is to find this range but we can analyse conditions imposed on $p$ steaming from algorithm structure of $l$-scheme and our considerations, namely $nlp<r<1$ and $\eta <1$, in dependence of its parameters $n$, $l$, $r$. Those two conditions determine possible range of $p$ (first serves to establish upper bound and second for lower bound) in which MOPs $l$-scheme will work. Determined maximal and minimal values for $p$ in dependence for $l$ and $p$ with fixed parameter $r=1/10$ are presented in Figs. \ref{fig:minp}, \ref{fig:maxp} and \ref{fig:3D}. Taking plans concerning the future quantum network spanned \emph{e.g.} across Europe, we suppose its size will refer to average number of intermediate nodes in one path $n<40$ (as expected size of QKD link is about 100 km) and maximal number of disjoint path $l< 6$. Therefore, applicability of MOPs $l$-scheme is under question and depend on real value of $p$. \begin{figure}[H] \centering \includegraphics[scale=0.7]{wykres_l.pdf} \includegraphics[scale=0.7]{wykres_n.pdf} \caption{Minimum value of $p$ (expressed in logarithm of base 10) in dependence on $l$ and $n$ and $r=1/10$, satisfying condition $\eta<1$.} \label{fig:minp} \end{figure} \begin{figure}[H] \centering \includegraphics[scale=0.7]{wykres_l2.pdf} \includegraphics[scale=0.7]{wykres_n2.pdf} \caption{Maximal value of $p$ (expressed in logarithm of base 10) in dependence of $l$ and $n$ and , satisfying condition $nlp < r=1/10$.} \label{fig:maxp} \end{figure} \begin{figure}[H] \centering \includegraphics[scale=0.4]{wykres3Dopisany.png} \caption{Range of $p$ which fulfill conditions $\eta <1$ and $nlp < 1/10 $, expressed with logarithm of $p$ in dependence of different $l$ and $n$.} \label{fig:3D} \end{figure} \section{Summary} In this article, we have analyzed two scenarios of attack that can be performed on trusted nodes in the hybrid QKD network. First, describing the situation in which each trusted node could be compromised with a certain probability $p$ and second describing a correlated attack on a network with finite resources. For which case the risk of hacking is greater depends on individual parameters of network and attacking party, which are difficult to predict in reference to the real world. However, we can infer that with growing network size, the second scenario is less less vulnerable to attacks. Next, we have described the scheme of communication in the QKD network extending the multiple path scheme by the possibility of crossing communicating paths - the MOPs scheme. This scheme uses the same amount of resources (QKD links) and can perform better under certain conditions, as analyzed in \ref{sec:numerical_analysis}. The graphic visualization of the most restrictive constraint (\emph{i.e.} on minimal value of $p$) is presented in Fig. \ref{fig:summary}. \begin{figure}[H] \centering \includegraphics[scale=0.4]{summary_opisane.png} \caption{Regions of the allowed value of $p$ as a function of $l$ (number of paths) and $n$ (number of nodes in a path), under the condition $\gamma < 1$. The condition guarantees that the probability of hacking the MOP scheme is smaller than for the MNOP scheme. The colors represent degree of usefulness of the algorithm with green as the most useful and red as not useful.} \label{fig:summary} \end{figure} Unfortunately, these constraints are possible to fulfill for distant users in large-scale networks. The concept presented in Sec. \ref{sec:adding_single_link} is worth studying. It does not present a groundbreaking idea but introduces an interesting and inexpensive improvement to the QKD network. This work develops a new way of thinking about QKD multiple path algorithms in hybrid networks with trusted nodes. The proposed algorithm is not an optimal one. Considering different topology of interlinks could perform better but the simple model under investigation enabled analytical analysis. For this moment it is difficult to judge whether the presented concept will be useful in practice, yet it opens a new path for future development of QKD networks. \section*{\label{sec:app_attack_example}Appendix 1} \begin{figure}[h] \centering \includegraphics[scale=0.5]{edu-example.pdf} \caption{Example of network for which single path protocol is more optimal than multi-path one.} \label{fig:example} \end{figure} Here, we present an example where for the uncorrelated attack (even with uniform probability $p$ for each vertex), it is not always optimal to use as many paths as possible. We adopt the assumptions made in the discussion of this type of attack in Sec. \ref{uncorrelated-attack}. Consider the network presented in Fig. \ref{fig:example}, and let the number of intermediate nodes on path $A-2$ and $1-B$ (a path that goes from $A$ to $2$ and $1$ to $B$ but omits $1$ and $2$, respectively) be $n$, and the probability that any (intermediate) node becomes compromised is $p$. If we use one or two paths, then the probability of hacking is, respectively: \begin{align} &P_1= 2p, \\ &P_2= \left((n+1)p \right)^2 . \end{align} It is possible to satisfy the inequality $P_1<P_2$, which leads to the condition: \begin{equation}\label{eqn:ap1} \frac{2}{(n+1)^2} < p . \end{equation} But for $n$ large enough, we can find $p$ small enough so Eq. \ref{eqn:ap1} do not contradict the condition assumed before, namely$ np \ll 1$. Therefore, even for the simplified version of the correlated attack model, it is not always optimal to use as many paths as possible. \section*{Appendix 2}\label{sec:appNDMS_to_hopbyhop} In the MNOPs scheme, each intermediate node has a connection to two other nodes and passes a secret key from one to another in a hop-by-hop fashion using a one-time pad. In the MOPs scheme, each node sends a classical message to Bob, which may be not efficient (since it generates a lot of traffic in the classic network), and we now show a certain alternative that reduces impact on key rate. \begin{lemat} \label{lem:alterhop-by-hop} Alternatively to the hop-by-hop scheme, we can use the following procedure: In path $A-1-2...n-B$ vertex number 1 take the $XOR$ of keys $K_{A1}$ and $K_{12}$ and send it to the next node. If node $i \in{2...n}$ receives the message $M_{i-1}$ from the previous node, it takes $XOR$ of his shared keys and the message and sends it forward \emph{i.e.} $ M_i = M_{i-1} \bigoplus K_{i-1,i} \bigoplus K_{i,i+1} $. The difference is that instead of decoding and encoding operations, we do it in single step. \end{lemat} \begin{lemat} Alternatively, to the MOPs method, we can use the following procedure. Having a graph, we find system of disjoint paths that cover all vertexes. This system will determine the next node for each vertex. While communicating, each node uses the procedure described in Lemma \ref{lem:alterhop-by-hop} with difference we additionally $XOR$ all interlinks key. Consequently, the message sent forward is: $M_i = M_{i-1} \prod_{(j,i)} \bigoplus K_{i,j} $, where $(j,i)$ denotes adjointness of the nodes $j$ and $i$. \end{lemat} One can check that this extension of the MOPs scheme omits unwanted procedure in which each node sends message to Bob and at the same time keeps benefits of utilization of interlinks. A useful example is presented in Fig. \ref{fig:NDMShop}. \begin{figure}[H] \hspace{-1cm} \includegraphics[scale=1]{NDMStohop.pdf} \caption{Example of graph for classic and NDMS scheme, red links represent additional interlinks in NDMS scheme. In NDMS following messages will be created: $M_{12}=K_{A1} \bigoplus K_{12} \bigoplus K_{14}$, $M_{23}=M_{12} \bigoplus K_{23} \bigoplus K_{25} \bigoplus K_{12} $, $M_{3B}=M_{23} \bigoplus K_{3B} \bigoplus K_{36} \bigoplus K_{23} $, $M_{45}=K_{A4} \bigoplus K_{45} \bigoplus K_{14} $, $M_{56}=M_{45} \bigoplus K_{56} \bigoplus K_{25} \bigoplus K_{45} $, $M_{6B}=M_{56} \bigoplus K_{6B} \bigoplus K_{36} \bigoplus K_{56}$. } \label{fig:NDMShop} \end{figure} \section*{Appendix 3} \label{sec:appdynprog} Here, we present a dynamical programming algorithm to calculate the exact value of $c(l,n)$, the greatest discrepancy in the result shows up when $n$ is close to $l$: \begin{verbatim} algorithm alpha is input: n and l parameters of graph output: number of minimal cuts separating A and B create two dimensional array tab[l,n] for j in 1.. n : tab[1,j]=1 for each row i in 2...n: for each cell in given row tab[i,j] , j in 1,n : calculate range of possible k (a,b) such that nodes(i,j) and (i-1,k) can be in vertex cut for k in a...b : tab[i,j]+=tab[i-1,k] return sum of tab[l,i] \end{verbatim} \begin{comment} $$\left( \begin{array}{cccccccccc} 1.07 & 1.03 & 1.02 & 1.02 & 1.01 & 1.01 & 1.01 & 1.01 & 1.01 & 1.01 \\ 1.21 & 1.10 & 1.06 & 1.05 & 1.04 & 1.03 & 1.03 & 1.02 & 1.02 & 1.02 \\ 1.31 & 1.17 & 1.11 & 1.06 & 1.06 & 1.05 & 1.03 & 1.04 & 1.04 & 1.02 \\ 1.69 & 1.29 & 1.16 & 1.13 & 1.09 & 1.08 & 1.06 & 1.06 & 1.05 & 1.05 \\ 2.35 & 1.42 & 1.25 & 1.17 & 1.14 & 1.11 & 1.09 & 1.08 & 1.07 & 1.06 \\ 3.42 & 1.48 & 1.33 & 1.24 & 1.15 & 1.14 & 1.12 & 1.09 & 1.09 & 1.08 \\ 3.82 & 1.92 & 1.35 & 1.32 & 1.16 & 1.18 & 1.15 & 1.12 & 1.12 & 1.08 \\ 3.89 & 2.07 & 1.62 & 1.36 & 1.22 & 1.21 & 1.20 & 1.15 & 1.11 & 1.12 \\ 3.84 & 2.00 & 1.59 & 1.42 & 1.34 & 1.28 & 1.24 & 1.20 & 1.16 & 1.10 \\ \end{array} \right)$$ Values of theoretical calculation of the ratio vs. numerical, with $l$ increasing from 2 to 10 (vertically), and $n$ increasing from 10 to 100 with step 10 (horizontally) \end{comment} \section*{Appendix 4} \label{sec:betacalculation} Here, we present the numerical calculation performed to substantiate the lemma \ref{beta} from Sec. \ref{subsec:formalconsiderations}. For each graph, each subset of size k can be generated and checked to see whether it separates $A$ and $B$ (if $A$ and $B$ are in disjoint components). The numerical values of the function $\beta_{n,l}(k)$ for small graphs are presented in Fig. \ref{fig:matrices}. \begin{figure}[H] \begin{center} \centering \includegraphics[scale=0.6]{ima.pdf} \vspace{0.3cm} \includegraphics[scale=0.6]{imb.pdf} \vspace{0.3cm} \includegraphics[scale=0.6]{imc.pdf} \vspace{0.3cm} \includegraphics[scale=0.6]{imd.pdf} \vspace{0.3cm} \caption{Values of function $\beta_{n,l}(k)$. Column number (starting from 1) depict value of $k$ , and row number value of $n$, and $l$ is constant within given matrix respectively $l=2, 3, 4, 5$. Through computation time is exponential in the size of the system (which equals $nl$), calculations were made for graphs of size maximal size about 30.} \label{fig:matrices} \end{center} \end{figure} From this analysis, one can deduce that the ratio $\frac{\beta_{n,l}(k+1)}{\beta_{n,l}(k)}$ is maximal for $k=l$. We also derive numerical observations suggesting that inequality $\eqref{eqn:beta}$ ``cannot be strengthened'', by which we mean that: \begin{equation} \frac{\frac{\beta_{nl}(l+1)}{\beta_{nl}(l)}}{nl} \rightarrow 1, \end{equation} as $n$ grows. In Fig \ref{fig:limit} the numerical result obtained for $l=2$ are shown. For $l>3$, the above thesis seems to hold but collecting data for many points is too time consuming and, therefore, we do not present more results. \begin{figure}[H] \centering \includegraphics[scale=0.8]{bnlk.pdf} \caption{Function $\frac{\frac{\beta_{nl}(l+1)}{\beta_{nl}(l)}}{nl}$ with $l=2$ in dependence of $n$.} \label{fig:limit} \end{figure} \begin{comment} \begin{proof}[Proof of lemma \ref{beta}] Proof is made by induction on $l$:. \begin{itemize} \item \emph{Base case}: \\ For $l=1$ we can construct exact formula, $\beta_{n,1}(k)=\binom{n}{k}$ , one can easy check that formula holds. \item \emph{Induction step}: \\ We first note property of $\beta$ that will be used later \begin{property} \label{propbeta} \beta_{n,l-1}(k-1) \leq \frac{1}{2} \beta_{n,l}(k) \end{property} \\ Let us distinguish two types of cuts: \begin{definition} Let K be set of vertex of certain cut, is called irreducible if and only if it have following property: no subset of K is a cut \end{definition} \begin{property} If cut K is not irreducible there exist vertex $g_{ij} \in K : K-g_{ij}$ is cut \end{property} \begin{property}\label{proper2} Irreducible cut can have only vertex on first or last line.\\ \end{property} \begin{property} \label{dwal} If $\beta^{ir}_{n,l}(k)$ is number of irreducible cuts of size k than $\beta^{ir}_{n,l}(k) \leq \beta^{ir}_{n,l-1}(k-1)*2l$ \end{property} \begin{proof}[Proof of \ref{proper2} ] Let us consider scheme with $l-1$ lines with a given cut , then we add one side line without loss of generality let it be $l$-th line of new scheme. Then removing one vertex from this line is enough to form a cut on $l$-scheme (maybe not proper). Than removing one more vertex on this line will not affect connection and new cut will not be proper \\. \end{proof} Now we can estimate number of cuts, separately for proper and not proper cuts. \begin{itemize} \item Not irreducible cut can be obtainted by choosing existing cut of size (k-1) and adding one vertex, thus number of not irreducible cuts is at most $\beta_{n,l}(k-1)*(nl-(k-1))$ , note that in this estimation we often count some cuts multiple times. For counting irreducible cut we first prove some properties: \begin{equation} (n_{pc}) \leq \beta_{n,l-1}(k-1)*2l \leq \alpha(l-1)l*n *2l (n (l-1))^{k-l} \leq \alpha(l)*n* (n l)^{k-l} *2 \leq \beta_{n,l}(k-1) *2. \end{equation} \end{itemize} Finally: $$\beta_{n,l}(k) \leq \beta_{n,l}(k-1)*(nl-(k-1)) + \beta_{n,l}(k-1)*2 \leq \beta_{n,l}(k-1)*n l $$ \end{itemize} \end{proof} \end{comment} \bibliographystyle{unsrt}
\section{Introduction} The chaotic long-term behaviour of the planetary orbits in the inner Solar System (ISS) emerged when the numerical integration of analytically averaged equations of motion revealed a maximum Lyapunov exponent (MLE) of about (5 million years)$^{-1}$ \citep{Laskar1985,Laskar1989}. Previously, the existence of secular resonances among the precession frequencies of planet perihelia and nodes had been shown to generate small divisors, which prevent the representation of the orbits as quasi-periodic series \citep{Laskar1984,Laskar1988}. Investigating the origin of chaos, J.L. measured the libration period of the Fourier harmonic $\theta_{2:1} = 2(g_3-g_4)-(s_3-s_4)$, which involves the fundamental frequencies of Earth and Mars, to be about 4.6 Myr \citep{Laskar1990}. He then proposed the libration--circulation transitions of the corresponding argument as a source of the observed MLE. Evidence of a large chaotic zone bridging the resonances $\theta_{2:1}$ and $\theta_{1:1} = (g_3-g_4)-(s_3-s_4)$ was later given \citep{Laskar1992}. Nevertheless, when the integration of the full equations of motion confirmed the MLE of the averaged ones, the chaotic nature of the $\theta_{2:1}$ dynamics was questioned \citep{Sussman1992}. As a consequence, a claim remains in literature that an undisputed dynamical mechanism for the observed chaos is missing \citep{Lecar2001,Murray2001,Hayes2007}. In the meantime, the alternating librations of $\theta_{2:1}$ and $\theta_{1:1}$ have been confirmed by direct integrations \citep{Laskar2004} and supported by geological records \citep{Ma2017,Olsen2019,Zeebe2019}. The high-dimensional dynamics of the inner planets probably discouraged systematic analytical studies of its resonant structure. A couple of analyses have focused on the long-term motion of Mercury, by freezing all the other planets on quasi-periodic orbits \citep{Lithwick2011,Batygin2015}, but this simplification leads to predictions that conflict with the findings of realistic models \citep{Mogavero2021}. Nevertheless, a Trojan horse against the curse of dimensionality affecting the ISS dynamics is offered by computer algebra, which allows the formal manipulation of the analytical series of celestial mechanics and the implementation of canonical perturbation theory in particular. Computer algebra has produced some remarkable results, such as the reproduction of Delaunay's monumental lunar theory \citep{Deprit1970} and the application of the Kolmogorov–Arnold–Moser theory to the three-body problem \citep{Robutel1995,Locatelli2000}, in addition to the demonstration of the chaotic behaviour of the Solar System itself \citep{Laskar1985,Laskar1989}. Still, its use in celestial mechanics may seem limited given its potential. We have recently proposed a forced model of the long-term dynamics in the ISS \citep{Mogavero2021}. It allows the secular phase space of the Solar System to be restricted in a consistent way to the eight degrees of freedom (DOFs) dominated by the inner planets. In this study we employ the computer algebra system TRIP \citep{Gastineau2011,TRIP} to carry out an unbiased analysis of the Fourier harmonics that constitute its Hamiltonian \suppref{supp:trip}. \section{Forced secular inner Solar System} The long-term dynamics of the Solar System planets essentially consists of the slow precession of their perihelia and nodes, driven by secular, that is, orbit-averaged, gravitational interactions \citep{Laskar1990,Laskar2004}. The precession frequencies of the outer planet orbits are practically constant over billions of years when compared to those of the ISS \citep{Laskar1990,Laskar2004,Hoang2021}. Built on these facts, the model of forced secular ISS consists in predetermining a quasi-periodic secular solution for the giant planets, with the inner ones moving in the resulting time-dependent gravitational potential \citep{Mogavero2021}. The quasi-periodic form of the giant planet orbits is established through frequency analysis \citep{Laskar2005} of the orbital solution of a comprehensive model of the Solar System \citep{Laskar2004}. The low planetary masses and the absence of strong mean-motion resonances in the ISS allow us to simply consider first-order secular averaging of the $N$-body Hamiltonian. This corresponds to Gauss's dynamics of Keplerian rings \citep{Gauss1818}, which we correct for the leading secular contribution of general relativity. The pertinence of our model has been thoroughly demonstrated \citep{Mogavero2021}. It matches reference orbital solutions of the Solar System over timescales shorter than or comparable to the Lyapunov time, with an average discrepancy in the fundamental frequencies of only a few hundredths of an arcsecond per year over the next 20 Myr. Moreover, it correctly reproduces the MLE and the statistics of the high eccentricities of Mercury over the next 5 billion years (Gyr). \paragraph{Dynamical model.} The secular Hamiltonian of the Solar System planets at first order in planetary masses and corrected for the leading contribution of general relativity reads \citep{Mogavero2021} \begin{equation} \label{eq:ham_sec} \widehat{H} = - \sum_{k=1}^8 G \frac{m_0 m_k}{a_k} \left[ \sum_{\ell=1}^{k-1} \frac{m_\ell}{m_0} \left< \frac{a_k}{\| \vec{r}_k - \vec{r}_\ell \|} \right> + 3 \frac{G m_0}{c^2 a_k} \frac{1}{\sqrt{1-e_k^2}} \right] .\end{equation} The planets are indexed in order of increasing semi-major axis, $(m_k)_{k=1}^8$ are the planetary masses, $a_k$ and $e_k$ are the (secular) semi-major axes and eccentricities, respectively, $G$ is the gravitational constant, and $c$ is the speed of light. The vectors $\vec{r}_k$ are the planet heliocentric positions, and the bracket operator represents the averaging over the mean longitudes of the planets $\lambda_k$, which results from the suppression of the non-resonant Fourier harmonics of the $N$-body Hamiltonian at first order in planetary masses \citep{Mogavero2021}. The semi-major axes $a_k$ are constants of motion in the secular dynamics. A suitable set of canonically conjugate momentum-coordinate pairs of variables for the secular dynamics are the Poincar\'{e}{} rectangular coordinates in complex form, $(x_k, -j \bar{x}_k; $ $y_k, -j \bar{y}_k)_{k=1}^8$, with \begin{equation} \label{eq:poincare_vars} \begin{aligned} &x_k = \sqrt{\Lambda_k} \sqrt{1 - \sqrt{1- e_k^2}} \, \mathrm{E}^{j \varpi_k}, \\ &y_k = \sqrt{2 \Lambda_k} \left(1- e_k^2\right)^{\frac{1}{4}} \sin(\mathcal{I}_k/2) \, \mathrm{E}^{j \Omega_k}, \end{aligned} \end{equation} where $\Lambda_k = \mu_k [G(m_0 + m_k) a_k]^{1/2}$, $m_0$ and $\mu_k = m_0 m_k / (m_0 + m_k)$ are the Sun mass and the reduced masses of the planets, respectively, $\mathcal{I}_k$ are the planet inclinations, $\varpi_k$ are the longitudes of the perihelia, and $\Omega_k$ are the longitudes of the nodes \citep{Poincare1896,Laskar1991,Laskar1995}. The model of forced ISS consists of the choice of an explicit quasi-periodic time dependence for the orbits of the outer planets \citep{Mogavero2021}, \begin{equation} \label{eq:qp_decomposition} x_k(t) = \sum_{\ell=1}^{M_k} \tilde{x}_{k\ell} \, \mathrm{E}^{j \vec{m}_{k\ell} \cdot \vec{\phi}(t)}, \quad y_k(t) = \sum_{\ell=1}^{N_k} \tilde{y}_{k\ell} \, \mathrm{E}^{j \vec{n}_{k\ell} \cdot \vec{\phi}(t)} ,\end{equation} for $k \in \{5,6,7,8\}$, where $t$ denotes the time, $\tilde{x}_{k\ell}$ and $\tilde{y}_{k\ell}$ are complex amplitudes, $\vec{m}_{k\ell}$ and $\vec{n}_{k\ell}$ are integer vectors, and $\vec{\phi}(t) = \out{\vec{\omega}} t$, with $\out{\vec{\omega}} = (g_5,g_6,g_7,g_8,s_6,s_7,s_8)$ representing the septuple of the constant fundamental frequencies of the outer orbits \citep{Laskar1990}. Gauss's dynamics of the forced ISS is obtained by substituting this predetermined time dependence into Eq.~\eqref{eq:ham_sec}, \begin{equation} \label{eq:ham_sec_inn} \mathcal{H}[(x_k,y_k)_{k=1}^4,t] = \widehat{H}[(x_k,y_k)_{k=1}^4, (x_k = x_k(t), y_k = y_k(t))_{k=5}^8] .\end{equation} The resulting Hamiltonian system consists of two DOFs for each inner planet, corresponding to the $x_k$ and $y_k$ variables, respectively. The forced secular ISS is thus characterised by eight DOFs. As a result of the forcing from the outer planets, its orbital solutions live in a 16-dimensional phase space since no trivial integrals of motion, such as the total energy or angular momentum, exist. The development of the two-body perturbing function \citep{Laskar1995}, when implemented in TRIP, allows the Hamiltonian $\mathcal{H}$ to be systematically expanded by exploiting the low eccentricities and inclinations of the planets \citep{Mogavero2021}. This development provides truncated Hamiltonians $\mathcal{H}_{2n}$ that are multivariate polynomials of total degree $2n$ in the Poincar\'{e}{} variables of the inner planets \suppref{supp:model}. At the lowest degree, $\mathcal{H}_2$ produces a forced Laplace-Lagrange (LL) dynamics, which can be analytically integrated by introducing complex proper mode variables, $(u_k, v_k)_{k=1}^4$. By introducing action-angle variables through $u_k = \sqrt{X_k} \mathrm{E}^{-j \chi_k}$ and $v_k = \sqrt{\Psi_k} \mathrm{E}^{-j \psi_k}$, the truncated Hamiltonians expressed in the proper modes can be expanded as finite Fourier series, \begin{equation} \label{eq:hamiltonian} \mathbb{H}_{2n}(\vec{I},\vec{\theta},t) = \sum_{\vec{k} \in \mathbb{Z}^8} \sum_{\vec{\ell} \in \mathbb{Z}^7} \fourcoeff{2n}{k}{\ell} (\vec{I}) \mathrm{E}^{j \left( \vec{k} \cdot \vec{\theta} + \vec{\ell} \cdot \out{\vec{\omega}} t \right)} ,\end{equation} where $\vec{I} = (\vec{\Chi},\vec{\Psi})$ and $\vec{\theta} = (\vec{\chi},\vec{\psi})$ are the eight-dimensional vectors of the action and angle variables, respectively, and $(\vec{k}, \vec{\ell})$ is the wave vector of a given harmonic. There are 2\,748 harmonics with a non-null amplitude $\fourcoeff{2n}{k}{\ell}$ at degree four and more than ten million at degree ten \citep{Mogavero2021}. \section{Maximum Lyapunov exponent} Computing the MLE is fundamental to the determination of the origin of chaos, as its value can be compared to the half-width of the leading resonant harmonics of the Hamiltonian, which constitute the dynamical sources of chaoticity \citep{Chirikov1979}. The non-null probability of unstable orbital evolutions in the ISS \citep{Laskar2009} makes the definition of the MLE as an infinite-time limit \citep{Oseledec1968,Benettin1980} not pertinent. We numerically compute a finite-time MLE (FT-MLE) employing the standard algorithm of \citet{Benettin1980} (faster chaoticity detectors have been developed starting from the fast Lyapunov indicator of \citealt{Froeschle1997}). The FT-MLE is time-asymptotically a stochastic function of the initial conditions of the system, and its computation acquires full physical significance for an ensemble of orbital solutions \citep{Mogavero2021}. Manipulation of the truncated Hamiltonians $\mathcal{H}_{2n}$ in TRIP allows us to systematically derive the equations of motion and the corresponding variational equations, which we integrate through an Adams PECE method of order 12 and a timestep of 250 years. Figure \ref{fig:lyap} shows the FT-MLE expressed as an angular frequency over the next 5 Gyr for different degrees of truncation of the Hamiltonian. In each case, the FT-MLE is computed for 128 stable (i.e. non-collisional) solutions, with initial conditions very close to the nominal values of Gauss's dynamics and for different initial tangent vectors \suppref{supp:nomsol}. The figure shows the [5$^{\textrm{th}}$, 95$^{\textrm{th}}$] percentile range of the probability distribution function (PDF) of the FT-MLE estimated from each ensemble of solutions. We also report the PDF from the full Hamiltonian $\mathcal{H}$, computed in \citet{Mogavero2021}, along with the FT-MLE of its nominal solution $\mathcal{S}${} for nine different initial tangent vectors, to manifest its asymptotic behaviour. In a few hundred million years, each FT-MLE becomes independent of the initial tangent vector, the renormalisation time, and the norm chosen for the phase-space vectors. Its distribution only reveals the intricate dependence on the initial position of the system in the phase space. At 5 Gyr, the FT-MLE roughly ranges from 0.15 to 0.5$^{\prime\prime} \,{\textrm{yr}}^{-1}${} with a 90\% probability. Figure \ref{fig:lyap} shows that the truncated Hamiltonians $\mathcal{H}_{2n}$ reproduce the asymptotic distribution of the FT-MLE of the full dynamics $\mathcal{H}$, even at the lowest degree. It suggests, in particular, that the dynamical interaction of the Fourier harmonics at degree four constitutes the primary source of the observed FT-MLE. \begin{figure} \includegraphics[width=\columnwidth]{lyap_v2.pdf} \caption{Finite-time MLE of the forced secular ISS over 5 Gyr for different degrees of truncation of the Hamiltonian and the corresponding Lyapunov time FT-MLE$^{-1}$. The bands represent the [5$^{\textrm{th}}$, 95$^{\textrm{th}}$] percentile range of the PDF estimated from ensembles of 128 ($\mathcal{H}_{2n}$) and 1148 ($\mathcal{H}$) stable orbital solutions with very close initial conditions. The black lines denote the nominal solution $\mathcal{S}${} for nine different initial tangent vectors.} \label{fig:lyap} \end{figure} \section{Leading harmonics} Significant insight into the ISS dynamics is provided by the knowledge of the leading harmonics of the Hamiltonian, that is, those that drive the system trajectory in the action space the most, without necessarily being resonant. The action variables in turn control the essential long-term variation in the frequencies of motion (and therefore the activation of a specific web of resonances) through the mean frequencies $\overline{\vec{\omega}}_{2n}(\vec{I}) = \partial \fourcoeff{2n}{0}{0} / \partial \vec{I}$ that derive from the integrable part $\fourcoeff{2n}{0}{0}$ of the Hamiltonian in Eq.~\eqref{eq:hamiltonian}. The contribution of the harmonic $\vec{k},\vec{\ell}$ to the action vector $\vec{I}(t)$ is \begin{equation} \label{eq:harmonic_ranking_1} \Delta \vec{I}_{\vec{k},\vec{\ell}}(t) = 2 \vec{k} \operatorname{Im} \int_0^t dt^\prime \ \fourcoeff{2n}{k}{l}(\vec{I}(t^\prime)) \mathrm{E}^{j \left( \vec{k} \cdot \vec{\theta}(t^\prime) + \vec{\ell} \cdot \out{\vec{\omega}} t^\prime \right)} .\end{equation} We ranked the 69\,339 harmonics of $\mathbb{H}_6$ according to the time median of the relative Euclidean norm $\delta\vec{I}_{\vec{k},\vec{\ell}}(t) = \Vert \Delta \vec{I}_{\vec{k},\vec{\ell}}(t) \Vert / \left\Vert \vec{I}(t) \right\Vert$ along the nominal solution $\mathcal{S}${} of Gauss's dynamics, spanning 5 Gyr \suppref{supp:leading_harm}. We report the first 30 harmonics in Table~\ref{tab:leading_harmonics}. As usual, each harmonic is identified by the corresponding combination of frequency labels $(g_i, s_i)_{i=1}^8$ \citep{Laskar1990}. Given the absence of harmonics of order six, Table~\ref{tab:leading_harmonics} confirms the leading role of those of order two and four, which enter the truncated Hamiltonian $\mathbb{H}_{2n}$ at degree four. The harmonics $\theta_{1:1}$ and $\sigma_{1:1} = (g_1 - g_5) - (s_1 - s_2)$ appear among the very leading terms, confirming their dynamical relevance, as suggested in previous studies \citep{Laskar1990,Laskar1992,Lithwick2011,Boue2012,Batygin2015}. Among the top terms, there are harmonics that couple more extensively the DOFs of the inner planets, with the remarkable examples of $(g_1 - g_4) + (s_1 - s_4),$ associating the proper modes of Mercury and Mars and $(s_1 - s_2) + (s_3 - s_4),$ which concatenates all the inclination DOFs. A non-negligible role of the Saturn-dominated eccentricity mode $g_6$ also emerges. Even though these harmonics are not all necessarily resonant, they suggest that the dynamical entanglement of all the DOFs is significant along the nominal solution $\mathcal{S}${}. This consideration is supported by the study of partial Hamiltonians constructed from a limited number of Fourier harmonics \suppref{supp:partial_harm}. As Fig. \ref{fig:lyap_partials} shows, while the harmonics in Table~\ref{tab:leading_harmonics} allow the asymptotic FT-MLE of Fig.~\ref{fig:lyap} to be robustly reproduced, simplified Hamiltonians based on the selection of specific DOFs may provide inconsistent predictions, with too low values down to a non-chaotic dynamics. This notably indicates that the resonant nature of a Fourier harmonic should only be established along the orbital solution of a realistic Hamiltonian. \begin{table} \caption{Leading Fourier harmonics of $\mathbb{H}_6$ along the nominal solution $\mathcal{S}${} spanning 5 Gyr.} \label{tab:leading_harmonics} \centering \begin{tabular}{r r c | r r c} \hline\hline \rule{0pt}{2.ex} $i$ & Harmonic $[\mathcal{F}_i]$ & $\delta\vec{I}_{\vec{k},\vec{\ell}}$ & & & \\ \hline \rule{0pt}{2.1ex} \input{files/harm_table_twocolumns.out} \hline \end{tabular} \tablefoot{First 30 harmonics ranked according to the time median of their relative contribution $\delta\vec{I}_{\vec{k},\vec{\ell}}(t)$ to the action vector $\vec{I}(t)$. The 5$^{\mathrm{th}}$ and 95$^{\mathrm{th}}$ percentiles are reported as subscripts and superscripts, respectively.} \end{table} \begin{figure*} \includegraphics[width=2\columnwidth]{phase_space_multiplot_v2.pdf} \caption{Reduced phase spaces $(p,\varphi)$ of the harmonics $\theta_{1:1}$, $\theta_{2:1}$, and $\theta_{3:2}$ along the Lie-transformed nominal solution $\mathcal{S}_{10}^\prime(t)$ as deduced from the Lie-transformed Hamiltonian $\Huv^\prime_{10}$. The phase spaces correspond to the $t_0$ times indicated in the upper-right boxes. The black dots reproduce the level curves of the reduced Hamiltonian, and the orange dots represent its fixed points. The separatrices are shown by red dots, and the level curve corresponding to the resonant variables at time $t_0$ is shown in blue. The right-hand-side axes report the projection of the mean frequencies $\vecomegamean^\prime_{2n}(p) = \partial \liefourcoeff{0}{0} / \partial \vecI^\prime$ along the normal $\vec{k}$ to the resonance plane.} \label{fig:phase_space_1} \end{figure*} \section{Resonant harmonics} Figure~\ref{fig:lyap} and Table~\ref{tab:leading_harmonics} suggest that the non-linear interaction of the Fourier harmonics at degree four constitutes the primary source of chaos. In the framework of canonical perturbation theory, we constructed a Lie transform to define a change of variables that eliminates the terms of degree four from the truncated Hamiltonian $\mathbb{H}_{2n}$ \suppref{supp:lie}. In the Lie-transformed Hamiltonian, $\Huv^\prime_{2n}$, which is in Birkhoff normal form to degree four, these terms are replaced with the chain of high-order harmonics that arise from their dynamical interaction. Very importantly, the aim of this procedure is not to set up successive analytical approximations of the dynamics, which would be a vain goal. We simply define new canonical variables that let the interactions of the terms of degree four appear explicitly in the amplitudes of the Fourier harmonics at higher degrees. To reveal the resonant harmonics of the Hamiltonian $\Huv^\prime_{2n}$, we first retrieved those that present episodes of libration along the Lie-transformed nominal solution, $\mathcal{S}_{2n}^\prime$. Following \citet{Mogavero2021}, we defined time-dependent fundamental frequencies for the inner orbits $(g_i^\prime(t), s_i^\prime(t))_{i=1}^4$ \suppref{supp:librating_harm}. For each harmonic of $\Huv^\prime_{2n}$, we then evaluated the corresponding combination of frequencies along the nominal solution. When this combination becomes null at least once over the time span of the solution, we consider the harmonic to be librating. This procedure filters out a majority of the Fourier harmonics as they never librate. The appearance of libration episodes, and thus the existence of libration islands in the phase space, does not guarantee the resonant nature of a harmonic, as this is connected to the presence of both stable and unstable manifolds. Therefore, we employed the classic divide-et-impera approach of \citet{Chirikov1979} and considered a reduced Hamiltonian for each librating harmonic: \begin{equation} \label{eq:reduced_hamiltonian} \hslash_{2n}^{\vec{k},\vec{\ell}}(p,\varphi) = \liefourcoeff{0}{0}(\vecI^\prime(p)) + \Omega \, p + 2 \operatorname{Re} \{ \liefourcoeff{k}{\ell}(\vecI^\prime(p)) \, \mathrm{E}^{j \varphi} \} .\end{equation} The resonant variables $p,\varphi$ are related to the Lie-transformed action-angle variables $\vecI^\prime,\vectheta^\prime$ by $\vecI^\prime(p) = \vecI^\prime_0 + p \vec{k}$ and $\varphi = \vec{k} \cdot \vectheta^\prime + \Omega t$, where we denote $\Omega = \vec{\ell} \cdot \out{\vec{\omega}}$ \suppref{supp:reduced_ham}. We therefore inspected the fictitious one-DOF dynamics that would be generated if $\vec{k},\vec{\ell}$ were the only harmonic appearing in $\Huv^\prime_{2n}$. The topology of the reduced phase space $(p,\varphi)$ depends on seven integrals of motion, whose values relate to the position $\vecI^\prime_0$ of the system in the full-dimensional action space. For a given librating harmonic, our study considers the one-parameter family of the reduced phase spaces that arise at each point along the nominal solution $\mathcal{S}_{2n}^\prime(t) = (\vecI^\prime_{2n}(t), \vectheta^\prime_{2n}(t))$, that is, $\vecI^\prime_0 = \vecI^\prime_{2n}(t=t_0)$ \suppref{supp:reduced_ham}. This family of phase spaces is therefore spanned by the time $t_0$. As an example, Fig.~\ref{fig:phase_space_1} shows, for different $t_0$ times along $\mathcal{S}_{10}^\prime(t)$, the phase spaces of the harmonics $\theta_{1:1}$, $\theta_{2:1}$, and $\theta_{3:2}$, with $\theta_{m:n} = m(g_3-g_4)-n(s_3-s_4)$, as deduced from the Hamiltonian $\Huv^\prime_{10}$. The times were chosen across the first transition of $\theta_{2:1}$ from libration to circulation, which occurs at about 340 Myr along the nominal solution $\mathcal{S}_{10}^\prime$, and corresponds to the point where its FT-MLE starts to increase in Fig.~\ref{fig:lyap}. The figure shows the level curves of the reduced Hamiltonian reconstructed by numerical integration as well as its fixed points, computed semi-analytically with TRIP. For a resonant harmonic, separatrices emerge from the hyperbolic fixed points and enclose libration islands. The level curve corresponding to the value of the resonant variables at time $t_0$ along $\mathcal{S}_{10}^\prime(t)$ is also shown and used to define the temporary libration or rotation state of the harmonic. Figure \ref{fig:phase_space_1} shows how a resonant phase space can significantly differ from that of a simple pendulum, which is the universal model of non-linear resonance and is often invoked to perform analytical computations. While the pendulum approximation turns out to be well suited for the majority of the resonant harmonics, it does not apply in general to the leading resonances, which are our main interest. We therefore discarded this approximation and performed systematic algebraic manipulations with TRIP to retrieve the fixed points of the reduced phase spaces through the roots of a univariate polynomial in the action $p$ \suppref{supp:reduced_ham}. Relying on a polynomial solver \citep[Appendix~\ref{supp:reduced_ham},][]{Bini1996,Bini2000,Bini2014}, we established the resonant nature of each harmonic along the nominal solution in a numerically robust and efficient way. We retrieved, in particular, the characteristic frequencies of the motion $\omega_\mathrm{ell}$ and $\omega_\mathrm{hyp}$ around the elliptic and hyperbolic fixed points, respectively. These frequencies are related to the square root of the eigenvalues of the variational matrix that governs the linear stability of the fixed points. Via a similar procedure, we retrieved the extrema of the action $p$ along a level curve of the reduced Hamiltonian, which are employed to determine the libration-rotation state of the harmonic and the resonance half-width, $\Delta\omega$. Following \citet{Chirikov1979}, we considered the projection of the frequency vector $\vec{\omega}^\prime = d\vectheta^\prime/dt$ along the normal to the resonance plane $\vec{k} \cdot \vec{\omega}^\prime + \Omega = 0$, that is, $\omega = \lVert\vec{k}\rVert^{-1} \vec{k} \cdot \vec{\omega}^\prime$. The reduced dynamics in Eq.~\eqref{eq:reduced_hamiltonian} induces a variation in this projection equal to $\Delta\omega = \lVert\vec{k}\rVert^{-1} \Delta \dot{\varphi}$. Building on ideas behind frequency analysis \citep{Laskar1993}, we then defined the resonance half-width $\Delta\omega$ from the variation in the rotational frequency of the angle $\varphi$ across the separatrix \suppref{supp:reduced_ham}. In the pendulum approximation we have, up to a constant factor close to one, \begin{equation} \label{eq:chirikov_halfwidth} \Delta\omega \sim 2 \omega_\mathrm{hyp} \lVert\vec{k}\rVert^{-1} ,\end{equation} which is the \citet{Chirikov1979} half-width (recall that $\omega_\mathrm{ell} = \omega_\mathrm{hyp}$ for the pendulum). \section{Origin of chaos} To establish a meaningful connection between the resonant phase spaces and the observed FT-MLE, we assumed that the time distribution of physical observables along the nominal solution spanning 5 Gyr is representative of their ensemble distribution (that is, over a set of stable orbital solutions with very close initial conditions) at some large time of the order of billions of years. Based on this sort of finite-time ergodic assumption, we systematically retrieved for each librating harmonic of $\Huv^\prime_{2n}$ the samples of the fixed point frequencies $\omega_\mathrm{hyp}$, $\omega_\mathrm{ell}$ and of the resonance half-width $\Delta\omega$ along the nominal solution $\mathcal{S}_{2n}^\prime$. Table~\ref{tab:resonant_harmonics} shows the first 30 resonant harmonics, along with their time statistic, as deduced from the truncation of the Lie transform at degree ten. We report for each frequency its time median as well as the 5$^{\textrm{th}}$ and 95$^{\textrm{th}}$ percentiles as subscript and superscript, respectively. The resonances are ranked according to their median half-width. To measure the overall dynamical impact of the terms, we denote as $\tau_\mathrm{res}$ the fraction of time a harmonic is resonant and as $\tau_\mathrm{libr}$ the fraction of libration states in the resonant case. Table~\ref{tab:resonant_harmonics} shows the harmonics that are resonant for more than 1\% of the time. \begin{table*} \caption{First 30 resonant harmonics of $\Huv^\prime_{10}$ along the nominal solution $\mathcal{S}^\prime_{10}$ spanning 5 Gyr.} \label{tab:resonant_harmonics} \centering \begin{tabular}{r c r | c r | c r | c} \hline\hline \rule{0pt}{2.1ex} $i$ & & Fourier harmonic $[\mathcal{F}_i]$ & $\omega_\mathrm{hyp}$ & $\tau_\mathrm{res}$ & $\omega_\mathrm{ell}$ & $\tau_\mathrm{libr}$ & $\Delta\omega$ \\ \hline \rule{0pt}{2.1ex} \input{files/resonance_table_H10_final.out} \hline \end{tabular} \tablefoot{Time median of the fixed point frequencies $\omega_\mathrm{hyp}$, $\omega_\mathrm{ell}$ and of the resonance half-width $\Delta\omega$ in ${\textrm{arcsec yr}}^{-1}${}. The 5$^{\mathrm{th}}$ and 95$^{\mathrm{th}}$ percentiles are reported as subscripts and superscripts, respectively. The fraction of time the harmonic is resonant is $\tau_\mathrm{res}$, and $\tau_\mathrm{libr}$ represents the fraction of libration states in the resonant case. The resonances are ranked according to their median half-width.} \end{table*} \begin{figure*} \centering \includegraphics[width=1.54\columnwidth]{overlaps_v3.pdf} \caption{Overlaps of secular resonances from Table~\ref{tab:resonant_harmonics}. Left panel: Starred resonances $\theta_{m:n} = m(g_3-g_4)-n(s_3-s_4)$ in the frequency subspace spanned by $g_4-g_3$ and $s_4-s_3$. Right panel: Daggered resonances as integer combinations of $(g_1-g_5)-(s_1-s_2)$ and $(g_1-g_2)+(s_1-s_2)$ (the harmonic $\mathcal{F}_{66} = 3g_1-g_2-2g_5-(s_1-s_2)$ is not shown in Table~\ref{tab:resonant_harmonics}). The dashed lines represent the resonance centres, and the coloured regions correspond to the time median of the signed half-widths. The nominal solution $\mathcal{S}^\prime_{10}$, which spans 5 Gyr, is shown after low-pass filtering with a cutoff frequency of $(\textrm{5 Myr})^{-1}$, the cross indicating the current position of the ISS. Frequencies are in ${\textrm{arcsec yr}}^{-1}${}.} \label{fig:overlaps} \end{figure*} It is perhaps hopeless to obtain, for high-dimensional dynamical systems, a precise formula connecting the FT-MLE to the half-width of the leading resonances or to their fixed point frequencies. Nevertheless, studies of the periodically forced pendulum \citep{Chirikov1979,Holman1996,Murray1997,Li2014} suggest that these quantities should differ only by a factor of order unity from one another, that is, \begin{equation} \label{eq:MLE_halfwidth} 2\pi \, \textrm{FT-MLE} \sim \Delta\omega .\end{equation} To fix ideas, we also assumed that Eq.~\eqref{eq:chirikov_halfwidth} holds beyond pendulum approximation. For the top resonances of Table~\ref{tab:resonant_harmonics}, the statistical intervals of both $\Delta\omega$ and $\omega_\mathrm{hyp}$ extensively overlap the range spanned by the asymptotic FT-MLE of the nominal solution in Fig.~\ref{fig:lyap}. Moreover, they are significantly compatible with the long-term ensemble distribution of the FT-MLE. A statistical connection between the leading resonances of the Hamiltonian and the MLE thus emerges, even in the absence of relations more precise than Eqs.~\eqref{eq:MLE_halfwidth} and \eqref{eq:chirikov_halfwidth}. It indicates the dynamical sources of the observed chaos. One may appreciate the low number of resonances with $\Delta\omega \gtrsim 0.1$$^{\prime\prime} \,{\textrm{yr}}^{-1}${}, which constitutes a sounding explanation for the large width of the FT-MLE distribution, while the dense set of terms with $\Delta\omega < 0.1$$^{\prime\prime} \,{\textrm{yr}}^{-1}${} explains why the exponent never goes below this value. We point out the absence of resonances of order two. The harmonic $g_1-g_5$, in particular, is known to be involved in the very high eccentricities of Mercury \citep{Boue2012} and is not expected to become resonant along a stable solution. The resonances marked by a star in Table~\ref{tab:resonant_harmonics} only involve the proper modes 3 and 4, while those distinguished by a dagger exclusively concern the proper modes 1, 2, and 5. The first group of harmonics is composed of $\theta_{1:1}$, $\theta_{2:1}$, $\theta_{3:1}$, and $\theta_{3:2}$ and is associated with the chaotic zone proposed in \citet{Laskar1992}. The second group belongs to the frequency subspace spanned by the combinations $g_1-g_5$, $g_2-g_5$, and $s_1-s_2$ and includes the well-known resonance $\sigma_{1:1}$. We first point out that the libration frequencies of 0.28 and 0.12$^{\prime\prime} \,{\textrm{yr}}^{-1}${} associated with $\theta_{2:1}$ and $\sigma_{1:1}$ in \citet{Laskar1990} are consistent with the corresponding statistics of the elliptic fixed point frequency $\omega_\mathrm{ell}$. We then show that each of these two sets of harmonics constitutes a source of chaoticity. The emergence of chaos from resonant one-DOF phase spaces, as in Fig.~\ref{fig:phase_space_1}, can be stated in two ways. As time changes and the system moves along its nominal trajectory, the phase-space region swept by the separatrices forms a chaotic zone. In an equivalent way, a chaotic zone results, at fixed time $t_0$, from separatrix-splitting when one restores the harmonics of $\Huv^\prime_{2n}$ that are suppressed in the reduced Hamiltonian. In any case, chaos derives from the interaction of resonant harmonics. Figure \ref{fig:overlaps} represents such an interaction in terms of resonance overlap \citep{Chirikov1979} for the groups of starred and daggered harmonics. It shows the resonance planes in the frequency space along with asymmetric resonance layers, defined by the time median of the signed half-widths $\Delta\omega^+$, $\Delta\omega^-$ \suppref{supp:reduced_ham}. The reported half-widths are meaningful in the region visited by the nominal solution, which is also shown. The existence of the chaotic zone suggested in \citet{Laskar1992} is indeed supported by a statistically robust overlap. The resonance $\theta_{2:1}$, in particular, appears right in the centre of the resonance network, in agreement with its large $\tau_\mathrm{res}$ value. Its amplitude results to a large extent from the interaction of $\theta_{1:1}$ and $\theta_{1:0} = g_3-g_4$ at degree four (see Table~\ref{tab:leading_harmonics}). The resonance overlap in the $g_1-g_5$, $g_2-g_5$, $s_1-s_2$ subspace is shown in Fig.~\ref{fig:overlaps} in terms of integer combinations of $\sigma_{1:1}$ and $(g_1-g_2)+(s_1-s_2)$. It appears to be more relevant, at least for our nominal solution, than the restriction to the subspace spanned by $g_1-g_5$ and $s_1-s_2$ investigated in previous studies \citep{Lithwick2011,Batygin2015}. A relevant dynamical role of the proper mode $g_2$, hinted at in \citet{Lithwick2011} and \citet{Batygin2015}, is confirmed. Figure \ref{fig:overlaps} also suggests a long-term diffusion mainly perpendicular to the resonance planes, while Arnold's diffusion along them seems negligible \citep{Laskar1993}, at least for the present regular (i.e. non-collisional) solution. Right after the top resonances, harmonics with $\Delta\omega < 0.1$$^{\prime\prime} \,{\textrm{yr}}^{-1}${} significantly couple all the proper modes, confirming the implications of Table~\ref{tab:leading_harmonics}. Coupling resonances such as $(g_2-g_4)+(s_2-s_4)$, $(g_1-g_3)+(s_2-s_3)$ and $(g_1-g_4)+(s_1-s_4)$, along with high-order ones resulting from their interaction with leading harmonics, strongly suggest that resonance overlap takes place extensively in the full-dimensional frequency space. Even though we have isolated low-dimensional sources of chaoticity, the large-scale chaos in the ISS is probably best understood as a high-dimensional phenomenon. The statistical nature of these findings suggests that the harmonics of Table~\ref{tab:resonant_harmonics} should be found statistically in resonance over an ensemble of sufficiently long orbital solutions of the Solar System, independently of the precise proper modes and dynamical model employed. A vivid example is provided by the term $(g_1-g_2)+(s_1-s_2)$ that we found among the top resonances: it enters libration at around 1 Gyr in \citet{Lithwick2011} but was not mentioned for the much shorter solutions of previous studies \citep{Laskar1990,Sussman1992,Laskar1992,Laskar2004}. More generally, we show in Fig.~\ref{fig:librations} examples of libration episodes for a number of harmonics in Table~\ref{tab:resonant_harmonics} along the direct integrations of the Solar System presented in \citet{Laskar2009} and spanning 5 Gyr, when one uses the proper modes $\vec{z}^\bullet, \vec{\zeta}^\bullet$ defined in \citet{Laskar1990}. Despite the different dynamical model and proper modes, one systematically confirms the librations predicted by the theory by inspecting just a few solutions. We point out the remarkable case of $(g_1-g_3)+(s_2-s_3)$, which will surely be librating over the next few tens of millions of years. Clearly, the chaotic zone of the ISS may extend to resonances that are barely, or not at all, active along our nominal solution and thus do not appear in Table~\ref{tab:resonant_harmonics}. In any case, Fig.~\ref{fig:librations} suggests that, despite being deduced from the forced secular dynamics, the web of resonances pictured here should underlie the chaotic dynamics of the inner planets in every realistic model of the Solar System. \begin{figure} \includegraphics[width=\columnwidth]{librations_v3.pdf} \caption{Combination of angle variables for different harmonics of Table~\ref{tab:resonant_harmonics} as a function of time along direct integrations $\mathcal{S}^{\textrm{LG}}_n$ of the Solar System presented in \citet{Laskar2009} ($n=0$ is the nominal solution). The angle variables correspond to the proper modes $\vec{z}^\bullet, \vec{\zeta}^\bullet$ defined in \citet{Laskar1990}. The time series are low-pass-filtered with a cutoff frequency of $(\textrm{500 kyr})^{-1}$.} \label{fig:librations} \end{figure} \begin{acknowledgements} We are truly indebted to M.~Gastineau for his support with TRIP. We acknowledge the precious help of L.~Robol for the integration of MPSolve in TRIP, and the fruitful discussions with N.~H.~Hoàng and M.~Saillenfest. F.~M. has been supported by a PSL post-doctoral fellowship and by a grant of the French Agence Nationale de la Recherche (AstroMeso ANR-19-CE31-0002-01). This project has been supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation program (Advanced Grant AstroGeo-885250). This work was granted access to the HPC resources of MesoPSL financed by the Region Île-de-France and the project Equip@Meso (reference ANR-10-EQPX-29-01) of the programme Investissements d’Avenir supervised by the Agence Nationale pour la Recherche. \end{acknowledgements} \bibliographystyle{aa}
\section{Introduction} \IEEEPARstart{T}{he} LiDAR-IMU (LI) system has prevailed in recent years~\cite{zhang2014loam,shan2018lego,ye2019tightly,Zuo2020IROS,shan2020lio,lin2020decentralized,lv2021clins}, as an increasing number of robotic applications require accurate and robust LI-navigation solutions. Accurate LiDAR-IMU extrinsic calibration is a prerequisite of LI navigation. Manually measuring the spatial extrinsic parameters (relative translation and rotation) between the LiDAR and IMU might be inaccurate or impractical, demanding an easy-to-use, automatic calibration approach. Besides the extrinsic calibration, calibrating the intrinsics of both sensors is equally important. IMU intrinsics~\cite{li2014high,schneider2019observability} modeling scale imperfection and axis misalignment between the gyroscope and accelerometer, are recommended to calibrate offline~\cite{yang2020online}. Similarly, LiDAR intrinsics~\cite{atanacio2011lidar,levinson2014unsupervised} such as each beam’s horizontal and vertical angles and range offset, have been shown to be better calibrated for accurate registration and mapping rather than using factory default. Therefore, in this paper, we perform both intrinsic and extrinsic calibration for LI systems. Many calibration methods rely on infrastructure (e.g., fiducial targets, or turntables) to aid calibration~\cite{rehder2016extending, liu2019error, liu2019novel}, which however increases the technical barrier for the widespread deployment of LI systems. LI sensors used in practical applications may not be perfectly time synchronized, necessitating the temporal calibration to compute the time offset between the two sensors. While discrete-time representation of states is most commonly used in calibration, its discretization introduces approximation when fusing asynchronous measurements and incurs a higher computational cost when processing high-rate data. Building upon our prior work~\cite{lv2020targetless}, in this work, we develop a continuous-time LI calibration method that computes both intrinsic and extrinsic (spatial and temporal) LI sensing parameters without using dedicated infrastructure. It is well understood that (infrastructure-free) sensor calibration can be heavily affected by the environment and motion because of observability (e.g., see \cite{Zuo2020IROS,yang2020online,mirzaei20123d}). In order to make the calibration tool easy-to-use for an end user, it is desirable to enable our LI calibration method to automatically address observability issues. To this end, we first perform observability-aware automatic selection of informative data for offline calibration; that is, we select only the most informative trajectory segments (rather than an uninformative long-session trajectory with weakly-excited motions). This is primarily due to the fact that if a calibration-data-collection trajectory is not fully excited, some calibration parameters may become unobservable and thus, cannot be computed or result in inconsistent results~\cite{yang2020online,mirzaei20123d}. However, how to collect informative data for calibration is not trivial for non-expert users. To alleviate this technology barrier, the proposed observability-aware data selection will automatically select informative trajectory segments, which in turn significantly reduces the computational cost as less data is needed for accurate calibration. On the other hand, if degenerate or weakly-excited motions inevitably occur -- for example, in the autonomous-driving case, straight-line translation without rotation, and single-axis rotation -- we also proposed to perform observability-aware state update during optimization so that no spurious information would influx into unobservable parameters. As a result, the proposed observability-aware calibration method, termed as \textit{OA-LICalib}, is able to perform efficient and robust LI calibration with challenging motions and scenes. In particular, the main contributions of this work include: \begin{itemize} \item The proposed OA-LICalib is among the first to perform full LI calibration that is able to calibrate all sensing parameters including the spatial (i.e., rigid-body transformation between the sensors) and temporal (i.e., time offset between the sensors) extrinsics, and the intrinsics of LiDAR and IMU. \item We propose the information-theoretic metrics to select informative trajectory segments for the LI calibration, instead of naively processing all available data regardless its observability, which significantly reduces the computational cost. \item We develop the observability-aware state update during optimization by updating only the identifiable directions of state space under degenerate motions (e.g., planar motion and constant velocity). \item Extensive experiments in simulations and real world are conducted to examine the feasibility and accuracy of the proposed OA-LICalib method, whose codebase is also open sourced to broadly benefit the robotics community. \end{itemize} The remainder of this paper is organized as follows: After reviewing the literature in Section~\ref{sec:related_work}, we provide the background materials of continuous-time batch optimization and present the sensor models in Section~\ref{sec:sensor_model}. The problem formulation is given in Section~\ref{sec:method}, while the proposed observability-aware calibration method is presented in Section~\ref{sec:observability}. Simulated and real-world experiments are carried out in Section~\ref{sec:simu_experiment} and Section~\ref{sec:real_experiment}, respectively. Finally, the paper is concluded in Section~\ref{sec:conclusion}. \section{Related Work} \label{sec:related_work} Sensor calibration has a rich literature. Instead of providing a comprehensive literature review, in this section, we only review the closely related work of LI calibration. \subsection{Spatial-temporal LI Calibration} In order to calibrate the rigidly-connected LiDAR and IMU, Geiger et al.~\cite{geiger2013vision} proposed a motion-based calibration approach that performs the extrinsic calibration by hand-eye calibration~\cite{horaud1995hand}. However, their approach expects each sensor’s trajectory to be estimated independently and accurately, which is difficult for the consumer-grade IMU. Gentil et al.~\cite{le20183d} formulated the LI calibration as a factor graph optimization problem. Gaussian progress (GP) regression~\cite{williams2006gaussian} was adopted to up-sample IMU measurements for pose interpolation at every time instants of capturing LiDAR points. Although the IMU data is continuously modeled based on GP, only the states at some specific time instants are optimized in the discrete-time factor graph, which may reduce accuracy. Recently, Mishra et al.~\cite{mishra2021target} presented an EKF-based LI extrinsic calibration method integrated into the visual-inertial navigation framework OpenVINS~\cite{Geneva2020ICRA}. Online extrinsic LI calibration approaches are also available. In~\cite{Zuo2019IROS,Zuo2020IROS}, LiDAR, IMU, and camera are tightly fused with a lightweight EKF, where the extrinsic parameters between the sensors are estimated online. Ye et al.~\cite{ye2019tightly} presented a tightly coupled LI odometry with online extrinsic parameters estimation, and adopted a linear motion model to eliminate motion distortion during the sweep. Qiu et al.~\cite{qiu2020real} developed an IMU-centric temporal offset and extrinsic rotation calibration method for the LI system based on the motion correlation. Recently, Xu et al.~\cite{xu2021fast} proposed FAST-LIO2, which is a tightly-coupled LiDAR-inertial odometry with online extrinsic calibration in an iterated-EKF framework. Note that online calibration often assumes reasonable initial values in order to guarantee convergence and may have extra unobservable directions because of including calibration parameters into the state vector~\cite{rehder2016general,Zuo2020IROS}. Continuous-time batch optimization with temporal basis functions is also widely studied in calibration problems. Furgale et al.~\cite{furgale2012continuous} detailed the derivation and realization for a full SLAM problem based on B-spline basis functions and evaluated the proposed framework within a camera-IMU calibration problem, which was further extended to support both temporal and spatial calibration~\cite{furgale2013unified}. Rehder et al.~\cite{rehder2014spatio} adopted a similar framework for calibrating the extrinsics between a camera-IMU system and a single-beam LiDAR in two steps: the camera-IMU system is first calibrated with a chessboard, and then the single-beam LiDAR is calibrated with respect to the camera-IMU system. \subsection{Intrinsic Calibration} Li et al.~\cite{li2014high} proposed an online state estimation framework using a multi-state-constraint Kalman filter (MSCKF) which simultaneously estimates extrinsic parameters of a visual-inertial system, time offset, and intrinsics of IMU and camera. Rehder et al.~\cite{rehder2016extending} extended the previous work~\cite{furgale2013unified} to support the calibration of extrinsics and intrinsics of multiple IMUs in the visual-inertial system. Yang et al.~\cite{yang2020online} investigated the necessity of online IMU intrinsic calibration in the visual-inertial system and performed observability analysis for different IMU intrinsic models. As the closest to our work, Liu et al.~\cite{liu2019error} proposed to calibrate a LI system's spatial extrinsics and intrinsics by discrete-time bundle adjustment optimization. A specially designed target composed of a cone and a cylinder is required to determine the intrinsics of 3D LiDAR and formulate the constraints involved with the rigid transformation between LiDAR and IMU. A high-precision 3-axis-adjustable turntable platform with accurate attitude readings is also necessary to calibrate the IMU intrinsics. A close follow-up work~\cite{liu2019novel} simplifies the method~\cite{liu2019error} by removing the dedicated target requirement and providing the concept to calibrate with the multiple geometric features naturally existing in human-made environments. Point/sphere, line/cylinder, and plane features are extracted and leveraged for providing valid constraints. However, reliable and automatic geometric features extraction from real-world scenes can be error-prone and susceptible; the extra facility of a high-precision turntable platform remains necessary for IMU intrinsic calibration. \subsection{Observability Awareness in Calibration} It is known that we can assess the information content of trajectory segments for camera and IMU calibration~\cite{schneider2019observability}. As such, Maye et al.~\cite{maye2013self} proposed information-theoretic metrics to select informative data and discard redundant data for calibration. A truncated QR decomposition of the Fisher information matrix is employed to update estimates in only observable directions. Zhang et al.~\cite{zhang2016degeneracy} analyzed the geometric structures in optimized problem for point cloud registration and determined well-conditioned directions to solve them partially. Schneider et al.~\cite{schneider2019observability} developed an online self-calibration method in discrete-time batch optimization for a visual-inertial system with the extended capability of calibrating IMU intrinsics. Multiple types of information metrics, including the trace, the determinant, and the maximal eigen value of the covariance matrix, are investigated for informative segment selection. The selected informative segments are fully excited with general motion, making the calibrated parameters observable and solvable. Jiao et al.~\cite{jiao2021robust} designed a sliding window-based multi-LiDAR odometry system with the capability of online extrinsic calibration between multiple LiDARs, and the singular values of Hessian matrix are leveraged to examine the convergence of rotational extrinsic calibration. \subsection{Extension of Our Previous Conference Publication~\cite{lv2020targetless}} While this paper is evolved from our prior work on continuous-time extrinsic LI calibration of~\cite{lv2020targetless}, there are significant contributions differentiating this work from~\cite{lv2020targetless} and others. To the best of our knowledge, the proposed OA-LICalib is among the first to fully calibrate all the sensing parameters of the LI sensors, including not only the spatial extrinsics as in~\cite{lv2020targetless}, but the temporal extrinsics (time offset) as well as the intrinsic parameters of the LiDAR and IMU. As it is often required to fully excite the sensor platform during data collection in order for calibration results to converge, which however might not be possible for some commonly-seen applications such as self-driving cars~\cite{Zuo2020IROS}, in this paper, we have proposed two observability-aware strategies to address this issue to make the proposed OA-LICalib method more easy-to-use for non-expert end users. Specifically, (i) the information-theoretic based data selection policy selects the most informative trajectory segments for calibration, which eases the effort in calibration data collection and improves the calibration efficiency. (ii) The observability-aware state update scheme only updates the states (including calibration parameters) lying along the observable directions while preventing an influx of spurious information in the unobservable directions. \section{Problem Formulation} \label{sec:sensor_model} \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/sketch/li-frame.pdf} \caption{Illustration of different frames of reference used in the paper. The trajectory of LiDAR can be represented with the IMU trajectory, the 6-DoF rigid transformation ${}^I_L\mathbf{T}$, and the time offset $t_c$ between LiDAR and IMU, by ${}^M_L\mathbf{T}(\tau)= \left({}^G_I\mathbf{T}(\tau_0+t_c){}^I_L\mathbf{T}\right)^{\top}{}^G_I\mathbf{T}(\tau+t_c)\ {}^I_L\mathbf{T}$.} \label{fig:li_calib_frames} \end{figure} \begin{figure*}[t] \centering \includegraphics[width=1.0\textwidth]{figures/sketch/lidar_intrinsic.pdf} \caption{The intrinsics of an individual laser comprising a multi-beam 3D LiDAR. The left figure depicts the ideal model, while the three figures on the right illustrate the intrinsics arising from correction factors and offsets.} \label{fig:lidar_intrinsic} \end{figure*} We first present our notations used throughout the paper. We denote the 6-DoF rigid transformation by ${}^B_A\mat{T}\in \SE(3) \subset \R^{4\times4}$, which transforms the point ${}^A\vect{p}\in \R^3$ in frame $\{A\}$ into frame $\{B\}$. ${}^B_A\mat{T} = \begin{bmatrix} {}^B_A\mat{R} & {}^B\vect{p}_A \\ \mathbf{0} & 1\end{bmatrix}$ consists of rotational part ${}^B_A\mat{R}\in \SO(3)$ and translational part ${}^B\vect{p}_A\in \R^3$. For simplicity, we omit the homogeneous conversion in the rigid transformation by $ {}^B\vect{p} = {}^B_A\mat{T} {}^A\vect{p}$. ${}^B_A\bar{q}$ is the quaternion of rotation corresponding to the rotation matrix ${}^B_A\mathbf{R}$. In our formulation, IMU reference frame $\{I\}$ is assumed to be rigidly connected to the LiDAR frame $\{L\}$. The map frame $\{M\}$ of LiDAR point cloud is determined by the first LiDAR frame $\{L_0\}$ when the calibration starts. Similarly, the global frame $\{G\}$ is determined as the first IMU frame $\{I_0\}$. The spatial extrinsics, including the relative rotation and translation from the LiDAR frame to the IMU frame, are denoted by ${}^I_L\bar{q}$ and ${}^I\mathbf{p}_L$, respectively. The temporal extrinsic parameter modeling the time offset between LiDAR and IMU is $t_c$. The LiDAR scan labeled with timestamp $\tau_L$ corresponds to IMU time instant $t_I = \tau_L + t_c$. Figure~\ref{fig:li_calib_frames} visualizes the different frames of reference used in this paper. The extrinsic and intrinsic LI calibration considered in this paper aims to estimate the following states: \begin{align} \mathcal{X} = \{ \bx_p, \bx_q, \bx_{Is}, \bx_I, \bx_L, {}^{I}_{L}\bar{q}, {}^{I}\mathbf{p}_{L}, t_{c}\} \end{align} which includes the control points of B-splines $\{\bx_p, \bx_q\}$ to represent the continuous-time trajectory, the IMU navigation states $\bx_{Is}$, the IMU intrinsics $\bx_I$, the LiDAR intrinsics $\bx_L$, and the LiDAR-IMU spatiotemporal extrinsic parameters $ \{{}^{I}_{L}\bar{q}, {}^{I}\mathbf{p}_{L}, t_{c}\} $. Based on the LI sensor data collected during the calibration process, we formulate the following nonlinear least-squares (NLS) problem: \begin{align} \label{eq:least-squares} \hat{\mathcal{X}} = \underset{\mathcal{X}}{\operatorname{argmin}} \;r, \;\; r= r_I + r_L \text{,} \end{align} where $r_I$ is the IMU measurement residual cost function which will be derived in detail in \eqref{eq:imuloss} and $r_L$ is the LiDAR measurement residual cost function as derived in \eqref{eq:lidarloss}. \subsection{Continuous-time Trajectory Representation} \label{sec:trajectory_represetation} We employ B-spline to parameterize trajectory as it provides closed-form analytic derivatives~\cite{sommer2019efficient}, enabling the effortless fusion of high-frequency measurements for state estimation. B-spline also has the good property of being locally controllable, which means the update of a single control point only impacts certain consecutive segments of the spline~\cite{furgale2012continuous}. This trait yields a sparse system with a limited number of control points. To parameterize the continuous-time 6-DoF trajectory, we leverage the split representation~\cite{haarbach2018survey} which represents the 3D translation and the 3D rotation with uniform B-splines separately. Both the translation and the rotation splines are parameterized with cumulative form. To be specific, the translation $\mathbf{p}(t)$ of $d$ degrees over time $t\in [t_i, t_{i+1})$ is controlled by the temporally uniformly distributed translational control points $\mathbf{p}_i$, $\mathbf{p}_{i+1}$, $\dots$, $\mathbf{p}_{i+d}$, and the matrix format could be expressed: \begin{align} \label{Eq:p_curve_cumu} \mathbf{p}(t) = \mathbf{p}_i + \sum_{j=1}^{d} \mathbf{u}^{\top}{\Tilde{\mathbf{M}}}^{(d+1)}_{(j)} \left(\mathbf{p}_{i+j}-\mathbf{p}_{i+j-1} \right) \end{align} where $\mathbf{u}^{\top} = \begin{bmatrix} 1 & u & \dots & u^d \end{bmatrix}$ and $u=(t-t_i)/(t_{i+1}-t_i)$. $\Tilde{\mathbf{M}}^{(4)}_{(j)}$ is the j-th column of the cumulative spline matrix $\Tilde{\mathbf{M}}^{(4)}$ which only depends on the corresponding degree of uniform B-spline. In this paper, cubic ($d=3$) B-spline is employed, thus the corresponding cumulative spline matrix is \begin{align} \Tilde{\mathbf{M}}^{(4)} = \frac{1}{6} \begin{bmatrix} 6 & 5 & 1 & 0 \\ 0 & 3 & 3 & 0 \\ 0 & -3 & 3 & 0 \\ 0 & 1 & -2 & 1 \\ \end{bmatrix} \text{.} \end{align} Besides, we adopt the cumulative representation of B-spline to parameterize the rotation on $\mathit{SO}(3)$ like~\cite{ovren2019trajectory,haarbach2018survey,sommer2020efficient}, and quaternions are served as the rotational control points of B-splines~\cite{kim1995general}: \begin{align} \label{Eq:q_curve_cumu} \bar{q}(t) = \bar{q}_i \otimes \prod_{j=1}^{d} exp\left(\mathbf{u}^{\top}{\Tilde{\mathbf{M}}}^{(4)}_{(j)}log(\bar{q}_{i+j-1}^{-1}\otimes\bar{q}_{i+j})\right) \end{align} where $\otimes$ denotes quaternion multiplication. $\bar{q}_i$ denotes the rotational control point. $exp\left(\cdot\right)$ is the operation that mapping Lie algebra elements to $\mathit{S}^3$, and $log\left(\cdot\right)$ is its inverse operation~\cite{kim1995general}. In this calibration system, the continuous 6-DOF poses of IMU ${}_I^{G}\bar{q}(t), {}^{G}{\mathbf{p}}_I(t)$ are represented in the global frame $\{G\}$ by splines in the format of \eqref{Eq:p_curve_cumu} and \eqref{Eq:q_curve_cumu} with parameters of control points $\bx_p$ and $\bx_q$ for 3D translation and rotation, respectively. The derivatives of the splines with respect to time can be easily computed \cite{sommer2020efficient}, which lead to linear accelerations ${}^I\mathbf{a}(t)$ and angular velocities ${}^I\bomega(t)$ in the local IMU reference frame: \begin{align} \label{eq:spline_accel} {}^I\mathbf{a}(t) &= {}_I^{G}\mathbf{R}^{\top}(t) \left( {}^{G}\ddot{\mathbf{p}}_I(t) - {}^{G}\mathbf{g}\right) \\ \label{eq:spline_omega} {}^I\bomega(t) &= {}_I^{G}\mathbf{R}^{\top}(t) {}_I^{G}\dot{\mathbf{R}}(t) \end{align} where $^G\mathbf{g} \in \mathbb{R}^3$ denotes the gravity vector in global frame. $^G\mathbf{g}$ has only two degrees of freedom since its norm is assumed to be a constant $\|{}^G\mathbf{g}\| \simeq 9.8$ in the system. \subsection{IMU Model} IMU comprises a 3-axis gyroscope and a 3-axis accelerometer. Inspired by~\cite{li2014high,rehder2016extending,yang2020online}, the IMU measurements are modeled as: \begin{align} {}^{\omega}\bomega &= \mathbf{S}_{\omega} \mathbf{M}_{\omega}\ {}^\omega_I\mathbf{R} {}^{I}\bomega(t)+\mathbf{A}_{\omega}{}^{I}\mathbf{a}(t)+ \mathbf{b}_{\omega}+\mathbf{n}_{\omega} \notag \\ &= h_{I_\omega}(t,\bx_q, ^G\mathbf{g}, \mathbf{S}_{\omega}, \mathbf{M}_{\omega}, {}^\omega_I\mathbf{R}, \mathbf{A}_{\omega}, \mathbf{b}_{\omega}) \label{eq:imu_w_model} \\ {}^{a}\ba &= \mathbf{S}_{a} \mathbf{M}_{a}\ {}^a_I\mathbf{R} {}^{I}\mathbf{a}(t) +\mathbf{b}_a+\mathbf{n}_a \notag \\ &= h_{I_a}(t, \bx_p, \bx_q, ^G\mathbf{g}, \mathbf{S}_{a}, \mathbf{M}_{a}, {}^a_I\mathbf{R}, \mathbf{b}_{a} ) \label{eq:imu_a_model} \end{align} where $\bx_p$ and $\bx_q$ are the translational and rotational control points of B-splines, respectively. $\mathbf{b}_\omega, \mathbf{b}_a$ are the biases of gyroscope and accelerometer, which are assumed to be under Gaussian random walk. $\mathbf{n}_\omega$ and $\mathbf{n}_a$ are the zero-mean white Gaussian noise with covariance matrix ${\Sigma_\omega}$ and ${\Sigma_a}$, respectively, which can be obtained from IMU noise model without approximation or propagation. $\mathbf{S}_{\omega/a}$ is a diagonal matrix modeling the scale imperfection as \begin{align} \mathbf{S}_{\omega} = \begin{bmatrix} S_{w1} & 0 & 0 \\ 0 & S_{w2} & 0 \\ 0 & 0 & S_{w3} \\ \end{bmatrix}\text{,}\ \mathbf{S}_{a} = \begin{bmatrix} S_{a1} & 0 & 0 \\ 0 & S_{a2} & 0 \\ 0 & 0 & S_{a3} \\ \end{bmatrix}\text{.} \end{align} $\mathbf{M}_{\omega/a}$ accounting for axis misalignment is an upper-triangular matrix with diagonal elements as identity \begin{align} \mathbf{M}_{\omega} = \begin{bmatrix} 1 & M_{w1} & M_{w2} \\ 0 & 1 & M_{w3} \\ 0 & 0 & 1 \\ \end{bmatrix}\text{,}\ \mathbf{M}_{a} = \begin{bmatrix} 1 & M_{a1} & M_{a2} \\ 0 & 1 & M_{a3} \\ 0 & 0 & 1 \\ \end{bmatrix}\text{.} \end{align} $\bA_\omega$ is a full $3\times3$ matrix accounting for the acceleration dependence (g-sensitivity) of the measurements. Since the gyroscope $\{\omega\}$ and accelerometer $\{a\}$ inside the IMU are individual sensors, there is a misalignment between them and the base IMU frame $\{I\}$. ${}^{\omega/a}_I\mathbf{R}$ compensates for the rotational misalignment, and the translational misalignment is omitted for calibration since it is close to zero for single-chip MEMS sensors~\cite{zachariah2010joint,schneider2019observability, yang2020online}. We can only calibrate ${}^{\omega}_I\mathbf{R}$ or ${}^{a}_I\mathbf{R}$ since the base IMU frame $\{I\}$ is aligned with either $\{\omega\}$ or $\{a\}$, and calibrating both makes the system unobservable~\cite{yang2020online}. In this paper, we choose to calibrate ${}^{\omega}_I\mathbf{R}$ only. Additionally, we ignore the calibration of gravity sensitivity in analogy to~\cite{yang2020online}. Usually, IMU measurements are given at discrete time instants. The measurements at timestamp $t_k$ are denoted as ${}^{\omega_k}\bomega_m, {}^{a_k}\ba_m$. Since the trajectory is formulated in continuous time, we can readily get ${}^I\mathbf{a}(t_k), {}^I\bomega(t_k)$ from \eqref{eq:spline_accel} and \eqref{eq:spline_omega} by computing differentials of the trajectory. The IMU induces cost functions, $r_I$, related to estimated variables including the control points of the trajectory $\{\bx_p, \bx_q\}$, the IMU navigation states $\bx_{Is} = \{^G\mathbf{g}, \mathbf{b}_{\omega}, \mathbf{b}_{a}\}$, and the IMU intrinsics $\bx_{I} = \{\mathbf{S}_{\omega}, \mathbf{M}_{\omega}, {}^\omega_I\mathbf{R}, \mathbf{S}_{a}, \mathbf{M}_{a}\}$ are formulated as: \begin{align} &r_I = r_{\omega} + r_a\text{,} \quad \text{where} \label{eq:imuloss}\\ &r_{\omega} = \sum_{k} \frac{1}{2}\|{}^{\omega_k}\bomega_m \!-\! h_{I_\omega}(t_k, \bx_q, \bx_I, \bx_{Is}) \|^2_{\Sigma_\omega} \text{,} \label{eq:gyro_loss} \\ &r_a = \frac{1}{2} \| {}^{a_k}\ba_m \!-\! h_{I_a}(t_k, \bx_p, \bx_q, \bx_I, \bx_{Is} ) \|^2_{\Sigma_a}\text{,}\label{eq:accel_loss} \end{align} $\|\mathbf{e} \|^2_\Sigma = \mathbf{e}^\top \Sigma^{-1} \mathbf{e}$ denotes the squared energy norm weighted by the inverse of the covariance matrix $\Sigma$, and $r_{\omega}, r_a $ are residuals of angular velocity and linear acceleration according to \eqref{eq:imu_w_model} and \eqref{eq:imu_a_model}, respectively. \subsection{3D LiDAR Model} \label{sec:lidar model} A mechanical 3D LiDAR with multiple laser beams~\cite{glennie2010static} measures the ranges given by individual laser heads pointing to different elevation angles. A LiDAR scan is captured when the rigidly connected laser heads rotate around a mechanical central axis. A laser head $i$ with elevation angle $\phi_{i}$ at LiDAR time instant $\tau_k$ (with azimuth angle $\theta_{ik}$) gets a range measurement $\rho_{ik}$, then the LiDAR point measurement transferred from the spherical coordinate system can be denoted by: \begin{align} {}^{L_{k}}\bp_{ik} = \begin{bmatrix} {}^{L_{k}} x_{ik} \\ {}^{L_{k}} y_{ik} \\ {}^{L_{k}} z_{ik} \end{bmatrix} = \begin{bmatrix} \rho_{ik} \cos\phi_i\cos\theta_{ik} \\ \rho_{ik} \cos\phi_i\sin\theta_{ik} \\ \rho_{ik}\sin\phi_{i} \end{bmatrix}\text{.} \end{align} However, the above ideal model does not hold in practical manufacture since spatial offsets exist between laser heads, and non-negligible errors exist in both the range measurement and the azimuth angle $\theta_{ik}$. As shown in Fig.~\ref{fig:lidar_intrinsic}, the intrinsics of an individual laser head $i$ consist of: \begin{itemize} \item Elevation angle correction factor $\delta \phi_i$ and azimuth angle correction factor $\delta \theta_i$. \item Vertical spatial offset $V_i$ and horizontal spatial offset $H_i$. \item Scale factor of range measurement $s_i$ and range measurement offset $ \delta \rho_{i}$. \end{itemize} Given the intrinsics, the zero-mean Gaussian measurement noise $n_{\rho,ik}$ over the range measurement, and defining the following factors: \begin{equation} \left\{ \begin{array}{c} \bar{\phi}_i = \phi_i + \delta \phi_i \\ \bar{\theta}_{ik} = \theta_{ik} + \delta \theta_i \\ \bar{\rho}_{ik} = s_i \rho_{ik} + \delta \rho_{i} + n_{\rho,ik} \end{array} \right. \end{equation} The position of LiDAR point measurement is given by: \begin{align} {}^{L_{k}}\bp_{ik} = \begin{bmatrix} \bar{\rho}_{ik} \cos\bar{\phi}_i\cos\bar{\theta}_{ik} + H_i \sin\bar{\theta}_{ik} \\ \bar{\rho}_{ik} \cos\bar{\phi}_i\sin\bar{\theta}_{ik} + H_i \cos\bar{\theta}_{ik} \\ \bar{\rho}_{ik}\sin\bar{\phi}_{i} + V_i \end{bmatrix}\text{.} \end{align} The intrinsics of a 3D LiDAR with $l$ beams are denoted by \begin{align} \bx_L = \{\delta \phi_i, \delta \theta_i, V_i, H_i, s_i, \delta \rho_{i}\}_{|_{i=0,1,\cdots,l-1}}\text{.} \end{align} For a LiDAR point measurement ${}^{L_k}\bp_{ik}$ with an associated 3D plane with closest point parameterization~\cite{geneva2018lips}, ${}^{M}\bpi_j = {}^{M}d_{\pi,j}{}^{M}\bn_{\pi,j}$, where ${}^{M}d_{\pi,j}$ and ${}^{M}\bn_{\pi,j}$ denote the distance of the plane to origin and unit normal vector expressed in map frame, respectively. The point to plane distance is given by: \begin{align} {}^{M}\bp_{ik} &= {}^{M}_{L_{k}}\mathbf{R}(\tau_k) {}^{L_{k}}\bp_{ik} + {}^{M}\mathbf{p}_{L_{k}}(\tau_k) \\ \bz_{ijk} &= {}^{M}\bn^\top_{\pi,j} {}^{M}\bp_{ik} + {}^{M}d_{\pi,j} \notag\\ &=h_L(\tau_k, \bx_p, \bx_q, \bx_L, {}^{I}_{L}\bar{q}, {}^{I}\mathbf{p}_{L}, t_{c}) \text{.} \label{eq:point2planedis} \end{align} The distance measurement above is related to variables including the control points of trajectory $\{\bx_p, \bx_q\}$, LiDAR intrinsics $\bx_L$, and spatial-temporal parameters $ \{{}^{I}_{L}\bar{q}, {}^{I}\mathbf{p}_{L}, t_{c}\} $. The 3D plane is extracted from LiDAR point cloud map, detailed in Sec.\ref{sec:data_association}, and assumed free of noise when computing $\bz_{ijk}$. Thus, ${\Sigma_{z_{ijk}}}$, the covariance of the distance measurement $\bz_{ijk}$, can be easily propagated from the Gaussian noise $n_{\rho,ik}$ by first-order approximation. The relative pose $\{{}^{M}_{L_{k}} \mathbf{R}(\tau_k), {}^{M}\mathbf{p}_{L_{k}}(\tau_k)\}$ in \eqref{eq:point2planedis} is involved with the following equations from parameterized IMU continuous-time trajectory: \begin{align} {}^M_{L_k}\mathbf{T}(\tau_k) = \left( {}^G_I\mathbf{T}(\tau_0+t_c){}^I_L\mathbf{T}\right)^{\top}{}^G_I\mathbf{T}(\tau_k+t_c)\ {}^I_L\mathbf{T} \text{.} \end{align} It is easy to find that the time offset $t_{c}$ between LiDAR and IMU is also involved in the process of fetching pose ${}^{M}_{L_{k}} \mathbf{T}(\tau_k)$ from continuous-time trajectory parameterized in the IMU time axis. In practice, the LiDAR point measurement at timestamp $\tau_k$ is denoted as $\bz_{m,ijk}$. By minimizing the point to plane distance, we have the following cost functions from LiDAR points associated with 3D planes: \begin{align} \label{eq:lidarloss} r_L \!=\! \scalemath{0.9}{\frac{1}{2} \sum_{i} \sum_{j}\sum_{k} \|\bz_{m,ijk} - h_L(\tau_k, \bx_p, \bx_q, \bx_L, {}^{I}_{L}\bar{q}, {}^{I}\mathbf{p}_{L}, t_{c}) \|^2_{\Sigma_{z_{m,ijk}}}} \end{align} where $i,j,k$ denote the indexes of LiDAR beams, 3D planes and points in a scanned ring by a laser beam, respectively. \begin{figure*}[t] \centering \includegraphics[width=1.0\textwidth]{figures/sketch/li-calib-pipline.pdf} \caption{The pipeline of proposed LiDAR-IMU calibration method, which allows leveraging all the raw measurements from IMU and LiDAR sensor in a continuous-time batch optimization framework. Details are provided in Section~\ref{sec:method} and Section~\ref{sec:observability}. } \label{fig:pipline} \end{figure*} \section{Continuous-time Full LI Calibration} \label{sec:method} In this section, we present in detail the proposed continuous-time full LI calibration method. Before diving into details, we first provide an overview of the overall architecture as shown in Fig.~\ref{fig:pipline}. Specifically, we first initialize the control points of rotation B-splines with the IMU angular velocities, and the extrinsic rotation ${}^I_L\bar{q}$ by aligning the IMU rotations with the LiDAR odometry (rotations) computed with NDT registration~\cite{magnusson2009three}. By reducing the rotational distortion effect in LiDAR scans, we re-compute the LiDAR odometry to improve its accuracy. We then initialize the LiDAR surfels by fusing LiDAR scans with the computed LiDAR odometry and find the point-to-surfel correspondences. With the LI measurements, we perform batch optimization to estimate the considered states including B-splines control points and spatial-temporal extrinsics, whose optimal estimates are used to refine the surfels map and point-to-plane data association. \subsection{State Initialization} \label{sec:rotation_init} Initial guesses of the calibrated parameters are needed for the iterative non-linear least-squares optimization. For initialization, we set IMU navigation states as $\hat{\bx}_{{Is}_0} = \{\|^G \mathbf{g}\|\be_3, \mathbf{0}_3, \mathbf{0}_3\}$ and IMU intrinsics as $\hat{\bx}_{I_0} = \{\bI_3, \bI_3, \bI_3, \bI_3, \bI_3\}$, where $\be_3 = [ 0, 0, 1]^\top$, $\bI_3$ and $\mathbf{0}_3$ represent the $3 \times 3$ identity matrix and zero matrix, respectively. As for the initial values of LiDAR intrinsics, $\hat{\bx}_{L_0} $ is initialized as $ \{0, 0, 0, 0, 1, 0\}_i{|_{i=1,\cdots,l}}$. The time offset $t_{c}$ between LiDAR and IMU is initialized as zero, which means the timestamp $t_k$ of IMU is equal to the timestamp $\tau_k$ of LiDAR at the beginning. The initialization of control points and extrinsic parameters are described in detail below. Prior to detailing the initialization process, we clarify the inputs for initialization including discrete poses at about 10 Hz from LiDAR odometry, angular velocities and linear accelerates at typically 400 Hz from IMU. We adopt NDT registration to implement simple scan-to-map LiDAR odometry, sufficient for sequences with a few seconds, and build a global map consists of keyframed LiDAR scans determined according to the pose changes. \subsubsection{Initialize Control Points of Continuous-time Trajectory} \label{sec:initialization of control points} Before detailing the concrete initialization method, we emphasize that the spline trajectory is employed to represent the IMU trajectory rather than LiDAR's. If we model the continuous-time trajectory in LiDAR sensor, the predicted linear acceleration and angular velocity in IMU frame need to be transformed from LiDAR frame as \begin{align} {}^I\vect{a}(t) &= {}^I_L\mat{R} ( {}^M_L\mat{R}(t)^{\top}\left({}^M\vect{a}(t) - {}^M\vect{g}\right) \notag \\ & + \lfloor{{}^L\dot{\bm{\omega}}(t)}\rfloor {}^I\vect{p}_L + \lfloor{{}^L{\bm{\omega}(t)}}\rfloor^{2}\ {}^I\vect{p}_L )\\ {}^I\bm{\omega}(t) &= {}^I_L\mat{R} {}^L\bm{\omega}(t) \text{,} \end{align} where $\lfloor \cdot \rfloor$ represents the skew-symmetric matrix of a 3D vector. Note that angular accelerations ${}^L\dot{\bm{\omega}}(t)$ are required to be computed, which makes the system complicated. Therefore, we choose to parameterize the trajectory in IMU frame instead of LiDAR frame. Given the raw angular velocity measurements from the IMU sensor, a series of rotational control points $\bx_q$ of the rotational trajectory can be initialized by solving the following least-square problem: \begin{align} \label{eq:solveq_knot} \hat{\bx}_q \!&=\! \underset{\bx_q}{\operatorname{argmin}} \; r_{\omega} \notag \\ \!&=\! \underset{\bx_q}{\operatorname{argmin}} \; \sum_{k} \frac{1}{2}\|{}^{\omega_k}\bomega_m \!-\! h_{I_\omega}(t_k, \bx_q, \bx_I, \bx_{Is}) \|^2_{\Sigma_\omega} \text{,} \end{align} where $r_{\omega}$ is defined in \eqref{eq:gyro_loss} and here we ignore the intrinsics of IMU and the angular velocity bias of IMU. It is important to note that ${}^{G}_{I}\bar{q}(t_0)$ is fixed to the identity quaternion during the optimization. In \eqref{eq:solveq_knot}, we try to initialize the rotational trajectory by the raw IMU measurements rather than the integrated IMU poses, since the latter are inaccurate and always affected by drifting IMU biases and noises. For the initialization of translational control points $\bx_p$, we first utilize the LiDAR odometry to get descrete-time LiDAR poses. Then we formulate and solve the following linear problem: \begin{align} \hat{\bx}_p \!=\! \underset{\bx_p}{\operatorname{argmin}} \sum_k \| {}^G_M\mathbf{T} {}^{M}\hat{\bm{p}}_{L_k} \!-\! {}^G_I\hat{\mathbf{R}}(t_k,\hat{\bx}_q ) {}^{I}\bm{p}_{L} \!-\! {}^G\bm{p}_I(t_k, \bx_p) \| \text{,} \end{align} where ${}^{M}\hat{\bm{p}}_{L_k}$ is the estimated position of scan at timestamp $\tau_k$ from the LiDAR odometry; ${}^G_I\hat{\mathbf{R}}(t_k, \hat{\bx}_q )$ controlled by $\hat{\bx}_q $ has been initialized in \eqref{eq:solveq_knot} and ${}^G\bm{p}_I(t_k, \bx_p)$ controlled by $\bx_p$ is the translational trajectory to be initialized. Considering map frame and global frame are determined as the first measurements from LiDAR and IMU, respectively, ${}^G_M\mathbf{T}$ is equivalent to ${}^{I_0}_{L_0}\mathbf{T}$, that is ${}^{I}_{L}\mathbf{T}$. The initial values of ${}^{I}_{L}\mathbf{T}$ computed in Sec.~\ref{sec:extrinsic ini} are used here. This initialization method of control points is relatively coarse, but it can effectively improve the convergence speed of the optimization problem, compared to leave $\bx_p$ uninitialized as zeros. \subsubsection{Extrinsic Initialization}\label{sec:extrinsic ini} Inspired by~\cite{yang2016monocular}, we initialize the extrinsic rotation by aligning two rotation sequences from LiDAR and IMU. With discrete LiDAR poses from LiDAR odometry, it is easy to get the relative rotation between two consecutive LiDAR scans, ${}^{L_{k}}_{L_{k+1}}\bar{q}$. Besides, the relative rotation between time interval $[t_k, t_{k+1}]$ in the IMU frame can also be obtained from the initialized rotational trajectory as ${}_{I_{k+1}}^{I_k}\bar{q}={}_I^{G}\bar{q}^{-1}(t_k) \otimes{}_I^{G}\bar{q}(t_{k+1})$. The relative rotations at any $k$ from two sensors should satisfy the following equation: \begin{align} \label{Eq:RXXB} {}^{I_k}_{I_{k+1}}\bar{q}\otimes {}_L^I\bar{q} = {}_L^I\bar{q}\otimes {}^{L_{k}}_{L_{k+1}}\bar{q} \text{.} \end{align} The above equation can be transferred into another equivalent representation~\cite{trawny2005indirect}: \begin{align} & \mathcal{L}({}^{I_k}_{I_{k+1}}\bar{q}) {}^{I}_{L}\bar{q} = \mathcal{R}({}^{L_k}_{L_{k+1}}\bar{q}) {}^{I}_{L}\bar{q} \notag \\ \label{eq:initializeR} \Rightarrow & \left( \mathcal{L}({}^{I_k}_{I_{k+1}}\bar{q}) - \mathcal{R}({}^{L_k}_{L_{k+1}}\bar{q}) \right) {}^{I}_{L}\bar{q} = \mathbf{0} \text{.} \end{align} For a unit quaternion $\bar{q} = \begin{bmatrix} \bq_v & q_w\end{bmatrix}^\top$ with imaginary part $\bq_v$ and real part $q_w$, $\mathcal{L}(\bar{q})$ and $\mathcal{R}(\bar{q})$ are multiplication matrices defined as follow: \begin{align} \mathcal{L}({\bar{q}})&=\begin{bmatrix} q_{w} \mathbf{I}_{3}-\lfloor\mathbf{q}_v\rfloor & \mathbf{q}_v \\ -\mathbf{q}^{T}_v & q_{w} \end{bmatrix} \notag \\ \mathcal{R}({\bar{q}})&=\begin{bmatrix} q_{w} \mathbf{I}_{3}+\lfloor\mathbf{q}_v \rfloor & \mathbf{q}_v \\ -\mathbf{q}^{T}_v & q_{w}\end{bmatrix} \notag \text{.} \end{align} Equation~\eqref{eq:initializeR} is in a form of ${}^k_{k+1}\bA {}^{I}_{L}\bar{q} = \mathbf{0}$. By stacking a series of relative rotation measurements ${}^k_{k+1}\bA$ row by row into a big matrix $\mathbf{A}$, we have $\mathbf{A} {}^{I}_{L}\bar{q} = \mathbf{0}$, then ${}^{I}_{L}\hat{\bar{q}}$ can be computed as the right unit singular vector corresponding to the smallest singular value of $\mathbf{A}$. For the initialization of extrinsic translation ${}^I\bm{p}_L$, the initial values of ${}^I\bm{p}_L$ are simply set to zeros, and the proposed method is able to converge to reasonable values in practical experiments when enough motion excitation exists. \begin{figure}[t] \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=0.8\columnwidth]{./figures/304c1} \caption{The surfels map in the first iteration.} \label{fig:surfel_map1} \end{subfigure} \\ \vspace{1em} \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=0.8\columnwidth]{./figures/304c12} \caption{The surfels map in the second iteration.} \label{fig:surfel_map2} \end{subfigure} \caption{Typical surfels map in an indoor scenario. The initial surfels map suffers from motion distortion with the initialized LiDAR poses. With the estimated states after just one iteration of batch optimization, the quality of refined surfels map becomes significantly better. Points in different surfels are colorized differently.} \label{fig:surfel_map} \end{figure} \subsection{Data Association of LiDAR Measurements} \label{sec:data_association} With the estimated rotational extrinsics ${}^{I}_{L}\hat{\bar{q}}$, we can transfer the rotational continuous-time curve in IMU frame into LiDAR frame and remove the rotational motion distortion in LiDAR scans. Subsequently, we perform the NDT-based LiDAR odometry again with the initial rotational guess retrieved from the rotational continuous-time curve transformed. Since LiDAR scans are partially undistorted and better initial guesses are provided, NDT-based LiDAR odometry can generate more accurate estimated poses. With the odometry results, a LiDAR point cloud map can be constructed by assembling multiple LiDAR scans into an identical frame. We further uniformly discretize the LiDAR point cloud map into 3D cells and compute the point distribution in every 3D cell to identify surfels based on a plane-likeness coefficient~\cite{bosse2009continuous}: \begin{equation} \mathcal{P}=2 \frac{\lambda_{1}-\lambda_{0}}{\lambda_{0}+\lambda_{1}+\lambda_{2}} \text{,} \end{equation} In the above equation, $\lambda_{0} \leq \lambda_{1} \leq \lambda_{2}$ are the point distribution eigen values in a 3D cell. For the cell with planar point distribution, $\mathcal{P}$ will be close to 1. The cell with plane-likeness coefficient $\mathcal{P}$ larger than a threshold is determined as a surfel cell, and the points inside this cell are used to fitting a plane. The estimated plane is parameterized by the closest point as mentioned in Sec. \ref{sec:lidar model}. Some LiDAR points are associated with surfels if the point-to-plane distance is less than a threshold, whereas the others are discarded. As mentioned in Sec.~\ref{sec:lidar model}, the plane parameters are assumed to be perfect and keep constant when we perform least-squares optimization, so are the surfels map and the data associations. This is in a fashion of Expectation–maximization algorithm. After the optimization, the surfels map, the data associations, and the plane parameters will be updated with updated estimated states, which will be detailed in Sec.~\ref{sec:refine}. Additionally, two practical tricks are engaged to repress the effect of outlier data associations on optimization: firstly, only the point and plane correspondence with a distance below 5 centimeters will be taken into the continuous-time batch optimization; secondly, we rely on the M-estimation~\cite{de2021review} idea and apply the Huber robust kernel to deal with outliers. \subsection{Refinement} \label{sec:refine} After the continuous-time batch optimization, the estimated states including the extrinsics become more accurate. Thus, we leverage the current best estimates to remove the motion distortion in the raw LiDAR scans, rebuild the LiDAR surfels map, and update the point-to-surfel data associations. Note that results from NDT-based LiDAR odometry are only utilized at the very beginning for initializing the LiDAR poses and LiDAR map. The refinement step with iterative batch-optimization will generate more accurate estimations and reliable data association. The typical LiDAR surfels maps in the first and second iterations of the batch optimization are shown in Fig.~\ref{fig:surfel_map}. The quality of the map can be improved in a significant margin after one iteration in the batch optimization. As for the intrinsic calibration, a 16-beam LiDAR contains 96 parameters (6 parameters per beam), and some parameters of the first laser are fixed as a reference during the calibration process. Only the distance offset and distance scale are estimated for the first laser. Additionally, there are 15 parameters of IMU intrinsic parameters. Considering the large number of intrinsic parameters to be estimated, to prevent the system from falling into local optimum and reduce the complexity of the problem, we optimize the spatial-temporal parameters only and fix the intrinsics at the initial values firstly, and allow optimizing the intrinsic parameters a few iterations later when the estimates of the trajectory and extrinsic parameters converge. Furthermore, we correct the raw measurements of IMU and LiDAR based on the estimated intrinsic parameters after they have gradually converged, instead of using the poor intrinsic estimates to correct the measurements at the beginning, which may hurt the calibration results. Throughout the experiments, we start to calibrate the intrinsic parameters after 2 iterations of batch optimization and correct raw measurements based on the estimated intrinsic parameters after 11 iterations. \section{Observability-Aware LI Calibration} \label{sec:observability} In this section, we describe in detail the observability-aware strategies used in the proposed LI calibration in order to improve its robustness to degenerate motions and thus make it more easy-to-use for practitioners. \subsection{Information-Theoretic Data Selection}\label{sec:data segment selection} Note that some data segments collected without sufficient motion excitation or scene constraints may degrade the calibration~\cite{hausman2017observability}, and blindly processing all the available data may result in unnecessarily high computational cost. As such, the proposed method seeks to automatically select the most informative data segments for calibration. In particular, to facilitate the ensuing derivations, assuming the white Gaussian noise and independent measurements, the NLS problem \eqref{eq:least-squares} is equivalent to the maximum likelihood estimation (MLE) problem and can be re-formulated as follows (see~\cite{kaess2012isam2,eckenhoff2019closed}): \begin{align} \label{eq:leastsaures} \hat{\bx} = \underset{\bx}{\operatorname{argmin}} \sum_{i} \frac{1}{2} \|\be_i(\bx)\|^2_{\Sigma_i} \end{align} where $\be_i$ denotes the residual induced from the $i$-th measurement with covariance ${\Sigma_i}$. An iterative method such as Gaussian-Newton and Levenberg-Marquard is often used to solve this problem. That is, at each iteration, by linearizing the above nonlinear system at the current estimate $\hat{\bx}$, $\be_i(\bx) = \be_i(\hat{\bx}) + \bJ_i \delta \bx$, with the Jacobian matrix $\bJ_i$, we have the following linear least-squares problem with respect to the update increment (or error state estimate) $\delta \hat{\bx}$: \begin{align} \delta\hat{\bx} = \underset{\delta\bx}{\operatorname{argmin}} \sum_{i} \frac{1}{2} \|\be_i(\hat{\bx}) + \bJ_i \delta \bx \|^2_{\Sigma_i} \end{align} The optimal solution is given by the following normal equation: \begin{align} \underbrace{ \left( \sum_{i} \bJ^\top_i {\Sigma^{-1}_i} \bJ_i \right) }_{\mathbf A} \delta \bx &= \underbrace{ - \sum_i \bJ_i^{\top} {\Sigma^{-1}_i} \be_i(\hat{\bx}) }_{\mathbf b} \label{eq:Ax=b} \end{align} Once $\delta\hat{\bx}$ is computed, we update the estimate as $\hat{\bx} \leftarrow \hat{\bx} \boxplus \delta\bx$, where $\boxplus$ denotes the addition operation on manifold. Note that $\bA_{k\times k}$ in \eqref{eq:Ax=b} is the Fisher information matrix of the MLE (or NLS) problem~\eqref{eq:leastsaures} and encapsulates all the information contained in the measurements. It is also important to note that $\bA$ might be rank deficient, for example, due to the lack of motion excitation and/or environmental constraints (see \cite{Zuo2020IROS}). It thus is critical to collect informative data ensuring full-rank $\bA$ (or observability~\cite{Jauffret2007TAES}). To this end, we first partition the entire collected data into multiple segments with constant-time length. We then perform Singular Value Decomposition (SVD) of $\bA$ for each segment: \begin{align} \label{eq:svd} \bA = \bU \bS \bU^\top \end{align} where $\bS = \operatorname{diag}(\sigma_1, \sigma_2, \cdots, \sigma_k)$ is the diagonal matrix of singular values in decreasing order, and $\bU = \begin{bmatrix} \bu_1, \bu_2, \cdots, \bu_k \end{bmatrix}$ is an orthogonal matrix. As in \cite{Jauffret2007TAES}, we employ the information metric (or observability index) of an individual segment based on the minimum singular value -- that is, a larger one implies a more informative segment. With that, for a specific sequence of collected data, we first evaluate the information metric of each segment and then select the most informative ones for LI calibration. \subsection{Observability-Aware Update} \label{sec:tsvd} While we have tried to collect the most informative data for calibration, it still might be the case that the selected data cannot guarantee observability and thus some states cannot be estimated. For example, when a ground vehicle moves on planar surfaces in an urban environment, the lack of pitch and roll rotation and translation on the vertical direction often leads to part of states unobservable. As shown in~\cite{Zuo2020IROS}, one-axis rotation is a so-called degenerate motion causing the translation of extrinsics ${}^I\bp_L$ partially unobservable. If this unobservability issue is not properly addressed, the calibration performance would be largely degraded. To make the proposed LI calibration robust to (weak) unobservability, we explicitly enforce observability constraints during each iteration; that is, only updating the states lying on the observable directions. To this end, we employ the truncated SVD (TSVD)~\cite{hansen1987truncatedsvd,maye2016online} to perform low-rank approximation of the information matrix, i.e., selecting the singular values $(\sigma_1, \sigma_2, \cdots,\sigma_l)$ over an information threshold $\epsilon$ that is a design choice. With this observability-assurance information matrix and SVD-based matrix pseudo-inverse, we have the following solution [see \eqref{eq:Ax=b}]: \begin{align} \delta \hat{\bx} = \sum^{l}_{i=1} \frac{\bu^\top_i \mathbf{b} \bu_i}{\sigma_i}. \label{eq:tsvd} \end{align} As a result, as compared to solving for $\delta \hat{\bx}$ by using all the singular values of the full information matrix -- which may erroneously introduce observable directions due to numerical issues -- we here explicitly avoid updating the unobservable (or weakly observable) parameters, thus conservatively ensuring observability. \section{Simulation Results} \label{sec:simu_experiment} To validate the performance of the proposed continuous-time batch optimization based LI calibration method, we conduct a series of simulations with ground truth of all estimated parameters to examine the accuracy of intrinsic and extrinsic calibration results, and also numerically study the sensitivity of the system to the time offset in simulations. \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/simu_env.pdf} \caption{The simulated environmental setup filled with planes in different colors. The colored points indicate a simulated 3D LiDAR scan. Left: The sinusoidal trajectory for testing calibration in full excitation motion. Right: Figure-8-shape trajectory for testing calibration in degenerate motion.} \label{fig:simu_env} \end{figure} \begin{table}[t] \centering \caption{Standard deviations for generating random LiDAR and IMU intrinsics in simulation experiments.} \begin{adjustbox}{width=\columnwidth,center} \begin{tabular}{cccc} \toprule \textbf{Parameter} & \textbf{Value} & \textbf{Parameter} & \textbf{Value} \\ \hline Elevation angle correction $\delta\phi$ (${}^\circ$) & 0.1 & Vertical spatial offset $V$ ($m$) & 0.005 \\ Azimuth angle correction $\delta\theta$ (${}^\circ$) & 0.05 & Horizontal spatial offset $H$ ($m$) & 0.005 \\ Range scale factor$s$ (\%) & 0.005 & Range offset $\delta \rho$ ($m$) & 0.01 \\ Gyro. Non-linearity (\%) & 0.01 & Accel. Non-linearity (\%) & 0.1 \\ Gyro. Non-orthogonality (${}^\circ$) & 0.05 & Accel. Non-orthogonality (${}^\circ$) & 0.05 \\ \bottomrule \end{tabular} \end{adjustbox} \label{tab:sensor_intrinsic_setting} \end{table} For the results presented below, we simulate an Xsens-100 IMU\footnote{\url{https://www.xsens.com/products/mti-100-series/}} and a 16-beam 3D LiDAR VLP-16\footnote{\url{https://velodyneLiDAR.com/vlp-16.html}}. The synthetic noises in measurement are consistent with the real-world sensors. IMU measurements are reported at 400Hz. LiDAR scans are received at 10Hz and the laser rays cover 360${}^\circ$ horizontally and $\pm$15${}^\circ$ vertically. The motion distortion effect is also simulated to match reality. The intrinsic parameters of IMU and LiDAR are randomly generated from normal distributions with standard deviations provided in Table~\ref{tab:sensor_intrinsic_setting}. The extrinsic parameters from LiDAR to IMU are set as $[0.3,0.15,0.05]^{\top}$ meter in translation and $[1,2,5]^{\top}$ degree in rotation in all simulation experiments. Note that the extrinsic translation has a minimum component of 0.05 meters and a maximum component of 0.3 meters to verify the calibration accuracy of the proposed method for different magnitudes of the translation. For the simulated trajectories, a sinusoidal trajectory and a figure-8-shape trajectory are introduced. The sinusoidal trajectory is formulated as: \begin{equation} \left\{ \begin{array}{l} p_x(t) = 2.0 \cdot \cos(\frac{\pi}{5}\cdot t) + 5 \\ p_y(t) = 1.5 \cdot \sin(\frac{\pi}{5}\cdot t) + 5\\ p_z(t) = 0.8 \cdot \cos(\frac{4\pi}{5}\cdot t) + 5\\ r_x(t) = 0.4 \cdot \cos(t) \\ r_y(t) = 0.6 \cdot \sin(t) \\ r_z(t) = 0.7\cdot t \end{array} \right. \label{eq:simu_traj1} \end{equation} and the trajectory of figure-8-shape is as follows: \begin{equation} \left\{ \begin{array}{l} p_x(t) = 2.0 \cdot \cos(\frac{\pi}{5}\cdot t) \\ p_y(t) = 1.5 \cdot \sin(\frac{\pi}{5}\cdot t)\cdot\cos(\frac{\pi}{5}\cdot t) + 5\\ p_z(t) = 2 \\ r_x(t) = r_y(t) = 0 \\ r_z(t) = 0.4 \cdot \sin(t) \\ \end{array} \right. \label{eq:simu_traj2} \end{equation} where $t\in[0,10]$, $\bp(t)=[p_x(t)\ \ p_y(t)\ \ p_z(t)]^{\top}$ is the translational trajectory in meter and $\vect{r}_{\text{euler}}(t) = [r_z(t)\ \ r_y(t)\ \ r_z(t)]^{\top}$ represents the euler angles in rad. The sinusoidal trajectory is with fully-excited motions, while the figure-8-shape trajectory is a simulation of planar motion, where the robot moves on the $x$-$y$ plane, and orientations change along $z$-axis only. For both simulated trajectories, it is straightforward to derive the linear acceleration and angular velocity at any time in order to generate synthetic IMU readings. Note that in each experiment, we perform 10 Monte Carlo experiments with the same time span of 10 seconds. The simulated environment is a room constructed with many planes and a volume of $12\times10\times10 \ m^3$ as shown in Fig.~\ref{fig:simu_env}, where the two types of trajectories are also plotted. The sinusoidal trajectory evaluates the intrinsic and extrinsic calibration in full motion excitation while the figure-8-shape trajectory for analyzing the extrinsic calibration performance in degenerate motion. To evaluate the impact of LiDAR intrinsic calibration on the accuracy of map reconstruction, we introduce the \textit{mean map entropy} (MME) metric~\cite{droeschel2014local}, which evaluates the sharpness of a map. The entropy $h$ for a map point $\mathbf{p}_k$ is calculated by \begin{align} h(\mathbf{p}_k) = \frac{1}{2} \ln{|2\pi e \Sigma(\mathbf{p_k})|} \end{align} where $\Sigma(\mathbf{p_k})$ is the sample covariance of map points within a local radius $r$ around $\mathbf{p_k}$. Local radius $r$ is 0.3 meters in our experimental evaluations. The MME $H(Q)$ is averaged over all map points $Q$: \begin{align} H(Q) = \frac{1}{n} \sum_{k=1}^{n}h(\mathbf{p_k}) \text{.} \end{align} The smaller the MME value the sharper the map is (i.e., the better map reconstruction). \begin{table}[t] \centering \caption{Results of 10 Monte-Carlo simulations with the sinusoidal trajectory: mean and standard deviation of the extrinsic calibration results with and without calibrating the intrinsics of LiDAR and IMU. Note that the best results are marked in bold.} \begin{tabular}{rcr@{}c@{}lr@{}c@{}l} \toprule Parameter & Gt & \multicolumn{3}{c}{W/ Calib. Intr.} & \multicolumn{3}{c}{W/O Calib. Intr.} \\ \midrule $p_x$ (cm) & 30 & \textbf{29.81} & ~$\pm$~ & 0.54 & 35.15 & ~$\pm$~ & 0.51 \\ $p_y$ (cm) & 15 & \textbf{14.86} & ~$\pm$~ & 0.25 & 22.14 & ~$\pm$~ & 0.73 \\ $p_z$ (cm) & 5 & \textbf{4.68} & ~$\pm$~ & 0.28 & 1.67 & ~$\pm$~ & 0.14 \\ roll (deg) & 1 & \textbf{1.16} & ~$\pm$~ & 0.02 & 1.97 & ~$\pm$~ & 0.02 \\ pitch (deg) & 2 & \textbf{1.91} & ~$\pm$~ & 0.02 & 2.41 & ~$\pm$~ & 0.03 \\ yaw (deg) & 5 & \textbf{5.02} & ~$\pm$~ & 0.05 & 5.44 & ~$\pm$~ & 0.05 \\ \bottomrule \end{tabular} \label{tab:simu_extrinsic} \end{table} \begin{table}[t] \centering \caption{Results of simulations with the sinusoidal trajectory: time offset calibrations.} \resizebox{\columnwidth}{!}{% \begin{tabular}{cccccccc} \toprule & \multicolumn{7}{c}{Time offset (ms)} \\ \midrule \rowcolor[HTML]{EFEFEF} True value& 1 & 2 & 3 & 5 & 8 & 12 & 21 \\ Estimated & 1.01 & 1.86 & 2.77 & 4.79 & 7.87 & 12.94 & 20.63 \\ \rowcolor[HTML]{EFEFEF} Error & 0.01 & -0.14 & -0.23 & -0.21 & -0.13 & -0.06 & -0.37 \\ \bottomrule \end{tabular} } \label{tab:simu_t_offset} \end{table} \begin{figure*}[th] \centering \includegraphics[width=1.0\textwidth]{figures/simu_imu_intrinsic.pdf} \caption{Results of 10 Monte-Carlo simulations with the sinusoidal trajectory: the IMU intrinsic parameters change with the increased number of iterations. The ground truth is denoted with the red dashed line. Each row from top to bottom represents scale and misalignment parameters of gyroscope, and scale and misalignment parameters of accelerometer, and euler angles of ${}^\omega_I\bR$ in \eqref{eq:imu_w_model}, respectively. } \label{fig:simu_IMU_intrinsic} \end{figure*} \begin{figure*}[th] \centering \includegraphics[width=1.0\textwidth]{figures/simu_lidar_intrinsic.pdf} \caption{Results of 10 Monte-Carlo simulations with the sinusoidal trajectory: the intrinsic calibration results of a simulated 16-beam 3D LiDAR. For the first laser, only the distance offset and distance scale are estimated while the other parameters are fixed as a reference during the calibration process. The blue dots are the ground truth and red lines are the mean of each parameter.} \label{fig:simu_lidar_intrinsic} \end{figure*} \subsection{Calibration With Full Motion Excitation} \subsubsection{{Spatial-Temporal Calibration}} The extrinsic calibration results with and without calibrating the intrinsic parameters of LiDAR and IMU in 10 simulated sequences are shown in Table~\ref{tab:simu_extrinsic}. We can find that with the awareness of intrinsic parameters, the proposed method OA-LICalib achieves an accuracy of 0.40 cm in translation and 0.18 degree in rotation, and the calibration errors extremely increase without intrinsic calibrations of LiDAR and IMU. % It also confirms OA-LICalib's capability of calibrating extrinsic parameters with components at different magnitudes, e.g., translation varies from 5cm to 30 cm, and rotation varies from 1 degree to 5 degrees in this experiment. It is also interesting to note that the magnitudes of the rotational and translational trajectories in \eqref{eq:simu_traj1} affect the accuracy of the extrinsic calibration results. In the $x$-axis translation and $z$-axis rotation, OA-LICalib gives calibrated parameters with much lower relative error. This phenomenon agrees with the observability analysis in~\cite{kelly2011visual} that calibration trajectory with strong motion excitation, i.e., large accelerations and angular velocities, can lead to more accurate calibrations of extrinsic parameters than weal excitation. Furthermore, the temporal calibration results in 7 trails are shown in Table~\ref{tab:simu_t_offset}. Note that time offsets vary from 1 ms to 21 ms, are manually added to one of the simulated sequences and calibrated. For the precision of temporal calibration, the proposed method can achieve millisecond-level accuracy. \begin{table}[t] \centering \caption{Results of 10 Monte-Carlo simulations with the sinusoidal trajectory: mean and error of IMU intrinsic parameters after 14 iterations.} \begin{tabular}{@{}ccr@{}c@{}lc@{}} \toprule Parameter & Gt & \multicolumn{3}{c}{Estimated} & Error \\ \midrule Sw0 & 0.99738 & 0.99714 & {$\pm$} & {0.00020} & -0.00024 \\ Sw1 & 0.99885 & 0.99882 & {$\pm$} & {0.00031} & -0.00003 \\ Sw2 & 1.00329 & 1.00169 & {$\pm$} & {0.00132} & -0.00160 \\ Sa0 & 0.98487 & 0.98374 & {$\pm$} & {0.00071} & -0.00113 \\ Sa1 & 1.01851 & 1.01780 & {$\pm$} & {0.00164} & -0.00071 \\ Sa2 & 0.97975 & 0.97936 & {$\pm$} & {0.00037} & -0.00039 \\ \midrule Mw0 & -0.00127 & -0.00117 & {$\pm$} & {0.00015} & 0.00010 \\ Mw1 & -0.00279 & -0.00388 & {$\pm$} & {0.00193} & -0.00109 \\ Mw2 & 0.00254 & 0.00577 & {$\pm$} & {0.00254} & 0.00323 \\ Ma0 & 0.01607 & 0.01553 & {$\pm$} & {0.00129} & -0.00054 \\ Ma1 & 0.02197 & 0.02238 & {$\pm$} & {0.00049} & 0.00041 \\ Ma2 & -0.00825 & -0.00825 & {$\pm$} & {0.00052} & 0.00001 \\ \midrule I.roll (deg) & 0.80000 & 0.81411 & {$\pm$} & {0.01924} & 0.01411 \\ I.pitch (deg) & 0.50000 & 0.48720 & {$\pm$} & {0.02066} & -0.01280 \\ I.yaw (deg) & 0.30000 & 0.31130 & {$\pm$} & {0.03401} & 0.01130 \\ \bottomrule \end{tabular} \label{tab:simu_imu_intrinsic} \end{table} \begin{table}[t] \centering \caption{Results of 10 Monte-Carlo simulations with the sinusoidal trajectory: the averaged absolute errors of the estimated LiDAR intrinsic parameters after 14 iterations. } \begin{tabular}{@{}cr@{}c@{}llr@{}c@{}l@{}} \toprule Parameter & \multicolumn{3}{c}{Error} & \multicolumn{1}{c}{Parameter} & \multicolumn{3}{c}{Error} \\ \midrule $s\ (\%)$ & 0.0058 & {$\pm$} & {0.0023} & $\delta \rho \ (mm)$ & 0.3048 & {$\pm$} & {0.2167} \\ $\delta \phi \ (deg)$ & 0.0075 & {$\pm$} & {0.0081} & $V\ (mm)$ & 0.6383 & {$\pm$} & {0.7838} \\ $\delta \theta \ (deg)$ & 0.0029 & {$\pm$} & {0.0019} & $H\ (mm)$ & 0.2111 & {$\pm$} & {0.1106} \\ \bottomrule \end{tabular} \label{tab:simu_lidar_intrinsic} \end{table} \begin{figure}[ht] \centering \includegraphics[width=\columnwidth]{figures/simu_map_MME.pdf} \caption{The MME evaluation of the LiDAR map quality along with the number of iterations in a typical simulated experiment. The evaluated point cloud map is initially assembled with the poses from NDT-based LiDAR odometry, then assembled with iteratively refined poses and intrinsics from the continuous-time batch optimization.} \label{fig:simu_map_MME} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{figures/sketch/simu_degenerate_dir.pdf} \caption{Simulation to examine observability awareness: three mounting setups with different relative orientations between the robot and the LiDAR-IMU sensor rig are tested (LiDAR and IMU are rigidly connected, while LiDAR is not shown in this figure). From left to right: case A, case B, case C. Among these three cases, the robots move in a shared trajectory of figure-8 shape as \eqref{eq:simu_traj2}, while the unobservable extrinsic directions in local IMU frames are different. } \label{fig:simu_degenerate_dir} \end{figure} \begin{table}[t] \centering \caption{Results of simulation with the figure-8 trajectory: the ground truth and the automatically-detected unobservable extrinsic directions under three mounting cases are shown in Fig.~\ref{fig:simu_degenerate_dir}. The head part corresponds to extrinsic rotation and the tail part corresponds to extrinsic translation.} \resizebox{\columnwidth}{!}{% \begin{tabular}{@{}cccccccc@{}} \toprule Case & & \multicolumn{6}{c}{Degenerate direction} \\ \midrule & Truth & 0.00000 & 0.00000 & 0.00000 & 0.00000 & 0.00000 & 1.00000 \\ \multirow{-2}{*}{Case A} & \cellcolor[HTML]{EFEFEF}Detected & \cellcolor[HTML]{EFEFEF}-0.00001 & \cellcolor[HTML]{EFEFEF}0.00000 & \cellcolor[HTML]{EFEFEF}0.00005 & \cellcolor[HTML]{EFEFEF}0.00165 & \cellcolor[HTML]{EFEFEF}-0.00110 & \cellcolor[HTML]{EFEFEF}1.00000 \\ & Truth & 0.00000 & 0.00000 & 0.00000 & 0.50000 & 0.00000 & 0.86603 \\ \multirow{-2}{*}{Case B} & \cellcolor[HTML]{EFEFEF}Detected & \cellcolor[HTML]{EFEFEF}0.00000 & \cellcolor[HTML]{EFEFEF}0.00000 & \cellcolor[HTML]{EFEFEF}-0.00001 & \cellcolor[HTML]{EFEFEF}0.50117 & \cellcolor[HTML]{EFEFEF}-0.00023 & \cellcolor[HTML]{EFEFEF}0.86535 \\ & Truth & 0.00000 & 0.00000 & 0.00000 & 0.50000 & 0.43301 & 0.75000 \\ \multirow{-2}{*}{Case C} & \cellcolor[HTML]{EFEFEF}Detected & \cellcolor[HTML]{EFEFEF}0.00006 & \cellcolor[HTML]{EFEFEF}0.00004 & \cellcolor[HTML]{EFEFEF}0.00007 & \cellcolor[HTML]{EFEFEF}0.50070 & \cellcolor[HTML]{EFEFEF}0.43296 & \cellcolor[HTML]{EFEFEF}0.74957 \\ \bottomrule \end{tabular} } \label{tab:simu_fig8_dir} \end{table} \begin{table}[t] \centering \caption{Results of 10 Monte-Carlo simulations with the figure-8 trajectory: mean of the estimated extrinsic parameters in three mounting cases with or without observability-aware calibration.} \resizebox{\columnwidth}{!}{% \begin{tabular}{|cccccccccc|} \hline & & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}${}^I\bp_L$ (cm)} & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}RMSE} \\ \cline{3-10} \multirow{-2}{*}{Seq.} & \multirow{-2}{*}{Method} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \cellcolor[HTML]{E0EFD4}$p_z$ & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \cellcolor[HTML]{E0EFD4}yaw & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline \multicolumn{2}{|c}{Groundtruth} & 30.00 & 15.00 & 5.00 & 1.00 & 2.00 & 5.00 & & \\ \hline & \cellcolor[HTML]{EFEFEF}W/O Obser. & \cellcolor[HTML]{DDDDDD}27.24 & \cellcolor[HTML]{DDDDDD}11.49 & \cellcolor[HTML]{DDDDDD}7.17 & \cellcolor[HTML]{DDDDDD}0.85 & \cellcolor[HTML]{DDDDDD}2.40 & \cellcolor[HTML]{DDDDDD}4.83 & \cellcolor[HTML]{DDDDDD}2.87 & \cellcolor[HTML]{DDDDDD}0.27 \\ \multirow{-2}{*}{Case A} & W Obser. & 30.97 & 12.09 & 8.05 & 0.95 & 2.44 & 4.89 & \textbf{2.50} & \textbf{0.26} \\ \hline & \cellcolor[HTML]{EFEFEF}W/O Obser. & \cellcolor[HTML]{DDDDDD}26.50 & \cellcolor[HTML]{DDDDDD}11.53 & \cellcolor[HTML]{DDDDDD}6.88 & \cellcolor[HTML]{DDDDDD}0.76 & \cellcolor[HTML]{DDDDDD}2.27 & \cellcolor[HTML]{DDDDDD}4.88 & \cellcolor[HTML]{DDDDDD}3.04 & \cellcolor[HTML]{DDDDDD}0.22 \\ \multirow{-2}{*}{Case B} & W Obser. & 29.73 & 11.94 & 5.69 & 1.01 & 2.27 & 4.81 & \textbf{1.82} & \textbf{0.19} \\ \hline & \cellcolor[HTML]{EFEFEF}W/O Obser. & \cellcolor[HTML]{DDDDDD}26.32 & \cellcolor[HTML]{DDDDDD}11.20 & \cellcolor[HTML]{DDDDDD}6.03 & \cellcolor[HTML]{DDDDDD}0.08 & \cellcolor[HTML]{DDDDDD}2.28 & \cellcolor[HTML]{DDDDDD}4.86 & \cellcolor[HTML]{DDDDDD}3.11 & \cellcolor[HTML]{DDDDDD}0.56 \\ \multirow{-2}{*}{Case C} & W Obser. & 29.67 & 10.42 & 5.56 & 0.18 & 2.28 & 4.88 & \textbf{2.67} & \textbf{0.50} \\ \hline \end{tabular} } \label{tab:simu_fig8} \end{table} \subsubsection{{Intrinsic Calibration}} Figure~\ref{fig:simu_IMU_intrinsic} illustrates the convergence process of IMU intrinsic parameters along with iterations and visualizes the distribution of calibration results for 10 simulated trials. Note that I.roll, I.pitch and I.yaw are the corresponding Euler angles of ${}^\omega_I\bR$ in \eqref{eq:imu_w_model}. The intrinsic parameters remain unchanged during the first iteration and start to be optimized in the second iteration, and the results gradually stabilize after about 8 iterations. Since the 11th iteration, the raw measurements are corrected based on the estimated intrinsic parameters (as mentioned in Sec.~\ref{sec:refine}). We can see that the estimated intrinsic parameters finally converge to near the true value, and the final estimated intrinsic results are summarized in Table~\ref{tab:simu_imu_intrinsic}. The experiment indicates that the proposed method has high accuracy and repeatability in intrinsic calibration. The final calibration results of the simulated 16-beam LiDAR intrinsic parameters in 10 trails are shown in Fig.~\ref{fig:simu_lidar_intrinsic}. Besides, the averaged absolute errors of the estimated LiDAR intrinsic parameters in 6 types are summarized in Table~\ref{tab:simu_lidar_intrinsic}. The proposed method can identify six types of intrinsic parameters of multi-beam LiDAR and estimate accurate results. We further evaluate the quality of LiDAR point cloud map which is affected by both the estimated trajectory and the calibrated parameters. Figure~\ref{fig:simu_map_MME} shows the MME metric in a typical simulated experiment. The evaluated point clouds consisting of around $215k$ points are assembled by the poses from NDT-based LiDAR odometry firstly, and refined poses from the continuous-time batch optimization. The map becomes more accurate with increased iterations due to the batch optimization over the continuous-time trajectory and calibrated parameters. Notably, a significant improvement in map accuracy after the 11th iteration due to the correction of the raw LiDAR points based on the current best estimation of LiDAR intrinsics. It is obvious that intrinsic parameters calibration significantly affects both the LiDAR map quality and the extrinsic calibration. Therefore, we advocate calibrating the intrinsic parameters to enable highly accurate LIDAR localization and mapping. \subsection{Calibration Under Degenerate Motion} In the same simulation environment with figure-8-shape trajectory, shown in the right picture of Fig.~\ref{fig:simu_env}, we investigate the extrinsic calibration accuracy of OA-LICalib in the degenerate case. With the trajectory in \eqref{eq:simu_traj2}, where rotation happens along the $z$-axis only, the LiDAR-IMU extrinsic translation along the rotation axis is unobservable according to the analysis in~\cite{Zuo2020IROS}. In order to examine whether the proposed OA-LICalib is able to automatically identify the unobservable directions, we also simulate three different mounting cases (A, B, C) as shown in Fig.~\ref{fig:simu_degenerate_dir}, where the LiDAR-IMU sensor rig is rigidly attached to the robot platform at three different relative orientations. Among the three cases, the robots move in the same trajectory (as Eq.~\eqref{eq:simu_traj2}), thus the unobservable directions of the extrinsic translation are the identical vertical axis in the robot coordinate frame. However, due to the different relative rotations between robot platform and the LiDAR-IMU sensor rigs, the unobservable directions of the extrinsic translation, ${}^{I}\mathbf{p}_{L}$, are different when represented in local IMU frame. Table~\ref{tab:simu_fig8_dir} summarizes the unobservable direction of the three mounting cases in Fig.~\ref{fig:simu_degenerate_dir}. For case A where the IMU $z$-axis is aligned with the vertical axis, the unobservable direction is purely in the $z$-axis of extrinsic translation, ${}^{I}\mathbf{p}_{L}$. For a typical trial, OA-LICalib identifies the singular value of the information matrix corresponding to extrinsics as $[41760,\ 22193,\ 3525,\ 491,\ 295,\ 0.000]^{\top}$, and it's obvious that there exists one unobservable direction. The eigen vectors corresponding to the minimum singular value (deemed as the detected unobservable direction) in the three cases are also summarized in Table~\ref{tab:simu_fig8_dir}. We can see that the detected unobservable directions are consistent with the truths. To verify the effectiveness of the observability scheme in Section.~\ref{sec:tsvd}, we conduct the ablation experiments on extrinsic calibration by starting from perturbed initial extrinsic parameters (with perturbations of around 3 degrees and 3 centimeters on rotations and translations, respectively). Table~\ref{tab:simu_fig8} shows the extrinsic calibration results ($\{ {}^I_L\bar{q}, \, {}^I \bp_{L} \}$) of 10 Monte-Carlo trials, and the Root Mean Square Error (RMSE) is calculated by comparing the mean calibration results to the ground truths. OA-LICalib with observability awareness keeps the unobservable directions of extrinsic translation around the initial values, and outperforms the method without observability awareness. \section{Real-world Experiments} \label{sec:real_experiment} \begin{table*}[t] \caption{The details of sequences used in real-world experiments.} \label{tab:real_datasets} \centering \resizebox{0.9\linewidth}{!}{ { \begin{tabular}{@{}cccccccc@{}} \toprule Dataset & Sequence & Config & Duration & Env. & \begin{tabular}[c]{@{}c@{}}Ave. Angular\\ Velocity (rad/s)\end{tabular} & Motion Type & Excitation Type \\ \midrule & \textit{\begin{tabular}[c]{@{}c@{}}Vicon-\\ (01,02,...,10)\end{tabular}} & Hand-held & 15 & Indoor & 0.983 & Random Shaking & Full \\ & \textit{\begin{tabular}[c]{@{}c@{}}Stairs-\\ (01,02)\end{tabular}} & Hand-held & 60 & Indoor & 1.118 & Random-Shaking & Full \\ & \textit{\begin{tabular}[c]{@{}c@{}}Lab-\\ (01,02)\end{tabular}} & Hand-held & 60 & Indoor & 1.215 & Random Shaking & Full \\ & \textit{SKG-01} & On-Vehicle & 120 & Outdoor & 0.407 & Planar Motion & Degenerate \\ \multirow{-5}{*}{\begin{tabular}[c]{@{}c@{}}Self \\ collection\end{tabular}} & \textit{YQ-01} & Hand held & 271 & Outdoor & 0.760 & \begin{tabular}[c]{@{}c@{}}Casual Walking \&\\ occasional Random Shaking\end{tabular} & Occasionally full \\ \midrule LIO-SAM~\cite{shan2020lio} & \textit{Casual-walk} & Hand held & 655 & Outdoor & 0.521 & \begin{tabular}[c]{@{}c@{}}Casual Walking \&\\ occasional Random Shaking\end{tabular} & Occasionally full \\ \midrule & \textit{IC\_Office} & Hand held & 200 & Indoor & 0.348 & Casual Walking & Occasionally full \\ & \textit{Office\_Mitte} & Hand held & 264 & Indoor & 0.350 & Casual-Walking & Occasionally full \\ \multirow{-3}{*}{\begin{tabular}[c]{@{}c@{}}Hilti SLAM \\ challenge~\cite{helmberger2021hilti} \end{tabular}} & \textit{Basement}${{}^1}$ & On-Vehicle & 330 & Indoor & 0.116 & Planar Motion & Degenerate \\ \bottomrule \\[-10pt] \multicolumn{7}{l}{${}^1$ Corresponding to Basement\_3 sequence in Hilti dataset.} \end{tabular} } } \end{table*} In the real-world experiments, we validate the proposed method on multiple our own datasets as well as two public datasets. Table~\ref{tab:real_datasets} summarizes the sequences in terms of collection configuration, duration, environment, motion type, etc. For the motion type: \begin{itemize} \item Random Shaking: We hold the sensor by hand and shake the sensor suite aggressively both in rotations and translations; \item Casual Waking: We hold the sensor and walk around; \item Planar Motion: The sensor rig is mounted on moving wheeled robots, see Fig.~\ref{fig:car} (right). \end{itemize} The self-collected datasets are collected in both indoor and outdoor scenarios by the self-assembled sensor rig shown in the left of Fig.~\ref{fig:car}, which consists of 3 Xsens-100 IMUs sampled at 400 Hz and a Velodyne VLP-16 LiDAR sampled at 10 Hz. The \textit{Casual-walk} sequence \footnote{Available at \url{http://www.udel.edu/009352}} is from LIO-SAM~\cite{shan2020lio} and is collected by a Microstrain 3DM-GX5-25 IMU sampled at 500 Hz and a Velodyne VLP-16 LiDAR sampled at 10 Hz. The Hilti SLAM challenge dataset~\cite{helmberger2021hilti} is intended for assessing the accuracy of state estimation in challenging environments and it contains a number of visual, LiDAR and inertial sensors. In the experiments, the data from Bosch BMI085 IMU sampled at 200 Hz and the Ouster OS0-64 LiDAR sampled at 10 Hz are utilized for evaluation. The proposed method is extensively tested on the \textit{Stairs} and \textit{Lab} sequences to examine the accuracy and repeatability of calibrated results. Due to the absence of ground-truth extrinsic transformation between LiDAR and IMU in real-world experiments, the relative poses of three components IMU inferred from CAD assembly drawings are introduced as references. Additionally, the proposed observability-aware calibration method incorporating the informative data selection and observability-aware state update mechanism is thoroughly evaluated. On the one hand, we examine the feasibility of the proposed method in degenerate motion cases over the \textit{SKG-01} sequence and \textit{Basement} sequence, which are collected on the vehicles under planar motion. On the other hand, we also analyze the proposed informative segment selection algorithm in the \textit{YQ-01}, \textit{Casual-walk}, \textit{IC\_Office}, \textit{Office\_Mitte} sequences, among which the former two sequences are outdoors while the latter two are indoors. Note that only one of the three IMUs (Fig.~\ref{fig:car}), IMU1, is utilized to evaluate the \textit{SKG-01} and \textit{YQ-01} sequences. We also compare the proposed method with the open-source LiDAR-IMU calibration toolkit Imu\_Lidar\_Calibration~\cite{mishra2021target} (abbreviated as ILC) and our previous method LI-Calib~\cite{lv2020targetless}. Notably, LI-Calib~\cite{lv2020targetless} does not have the observability-aware scheme described in Sec.~\ref{sec:observability} or the explicit initialization of control points (Sec.~\ref{sec:initialization of control points}), compared to the proposed OA-LICalib. In addition, two online calibration methods, LIO-Mapping~\cite{ye2019tightly} (abbreviated as LIOM) and FAST-LIO2~\cite{xu2021fast}, are also included for the comparisons. LIOM and FAST-LIO2 are LiDAR-IMU odometry and simultaneously calibrate the extrinsic parameters between LiDAR and IMU. In practice, online calibration methods estimate the whole trajectory of the entire calibration sequence, and the final converged values of the extrinsic parameters are deemed the calibration results, as are the ILC method. Since the ILC method particularly requires the sensor to keep static for seconds to initialize the system, we skip some data segments at the beginning in order to satisfy the static initialization requirements in some sequences. Notably, under general motion scenarios, the proposed OA-LICalib and our previous method LI-Calib are initialized from the identity extrinsic rotation matrix and zero extrinsic translations without bells and whistles. However, for the initial values of the extrinsics for these compared methods, including ILC, LIOM, and FAST-LIO2, the extrinsic rotation parameters are initialized by the reference parameters provided by the dataset, while the translation extrinsic parameters are initialized as zero. These compared methods fail to converge when starting from the identity extrinsic rotation matrix due to the lack of an extrinsic initialization module. \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/real/car.png} \caption{Left: The self-assembled sensor rig used in real-world experiments. Right: The ground wheeled robot for collecting \textit{SKG-01} sequence.} \label{fig:car} \end{figure} \begin{figure}[t] \centering \begin{subfigure}{0.49\columnwidth} \includegraphics[width=\columnwidth]{figures/real/vicon-1.png} \end{subfigure} \hfill \begin{subfigure}{0.49\columnwidth} \includegraphics[width=\columnwidth]{figures/real/vicon-2.png} \end{subfigure} \begin{subfigure}{1.0\columnwidth} \includegraphics[width=\columnwidth]{figures/real/vicon-1-fitting-x.png} \end{subfigure} \caption{Top: Estimated continuous-time trajectories aligned with the ground-truth. The color of the trajectory indicates ATE. Bottom: The corresponding fitting results of the top-left trajectory. Only the $x$-axis is plotted. The fitting errors almost have the same order of magnitude as the IMU measurement noises.} \label{fig:trajApe} \end{figure} \subsection{Trajectory Representation Capability} In the \textit{Vicon} sequences, ground truth poses are provided by the Vicon system at 100 Hz, with a duration of about 15 seconds to evaluate the accuracy of estimated trajectories and the representation capability of the splines. Comparing the estimated trajectories with the motion-capture system's reported trajectories, the average absolute trajectory error (ATE) ~\cite{grupp2017evo} overall ten sequences are 0.0183 m. Figure~\ref{fig:trajApe} shows two typical estimated trajectories aligned with the ground truth and also illustrates fitting results. The estimated B-Spline trajectory fits well with the ground-truth trajectory and the acceleration measurements and angular velocity measurements, indicating the B-Spline's high representation capability. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{figures/real/6dof-position.png} \caption{Extrinisc translation calibration results from OA-LICalib over \textit{Stairs} and \textit{Lab} sequences. Top: Top view of the calibration results. The three black rectangular boxes represent the actual mounting positions of three IMUs, respectively. Bottom: Front view of the calibration results.} \label{fig:6dof-position} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{figures/real/6dof-rotation.png} \caption{Extrinsic Rotation calibration results from OA-LICalib over \textit{Stairs} and \textit{Lab} sequences.} \label{fig:6dof-rotation} \end{figure} \begin{table*}[t] \caption{The mean and standard deviation of the calibration results from different methods on \textit{Stairs} and \textit{Lab} sequences. The units for translation and rotation are in `cm' and `degree', respectively. The non-converged results of ILC and LIOM are excluded from the statistics. } \centering { \begin{tabular}{|c|c|r@{}c@{}lr@{}c@{}lr@{}c@{}lr@{}c@{}lr@{}c@{}lr@{}c@{}l|cc|} \hline & & \multicolumn{9}{c|}{\cellcolor[HTML]{E0EFD4}${}^L\bp_I$ (cm)} & \multicolumn{9}{c|}{\cellcolor[HTML]{E0EFD4}${}^L_I\bar{q}$ in Euler (deg)} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}RMSE} \\[1pt] \cline{3-22} \multirow{-2}{*}{Method} & \multirow{-2}{*}{IMU} & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}$p_x$} & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}$p_y$} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}roll} & \multicolumn{3}{c}{\cellcolor[HTML]{E0EFD4}pitch} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}yaw} & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline & IMU1 & \multicolumn{3}{c}{0} & \multicolumn{3}{c}{-10} & \multicolumn{3}{c}{-13} & \multicolumn{3}{c}{0} & \multicolumn{3}{c}{0} & \multicolumn{3}{c|}{-90} & - & - \\ & IMU2 & \multicolumn{3}{c}{10} & \multicolumn{3}{c}{0} & \multicolumn{3}{c}{-13} & \multicolumn{3}{c}{0} & \multicolumn{3}{c}{0} & \multicolumn{3}{c|}{-90} & - & - \\ \multirow{-3}{*}{CAD Reference} & IMU3 & \multicolumn{3}{c}{-7} & \multicolumn{3}{c}{8} & \multicolumn{3}{c}{-13} & \multicolumn{3}{c}{0} & \multicolumn{3}{c}{0} & \multicolumn{3}{c|}{135} & - & - \\ \hline & IMU1 & 9.61 & $\pm$ & 0.79 & -13.00 & $\pm$ & 4.78 & -7.34 & $\pm$ & 6.75 & 7.78 & $\pm$ & 0.47 & -4.95 & $\pm$ & 5.83 & -95.82 & $\pm$ & 2.18 & 11.65 & 5.04 \\ & IMU2 & 19.65 & $\pm$ & 5.63 & -1.69 & $\pm$ & 3.36 & -4.44 & $\pm$ & 3.54 & 9.73 & $\pm$ & 1.40 & -3.48 & $\pm$ & 3.35 & -93.59 & $\pm$ & 1.59 & 6.67 & 6.30 \\ \multirow{-3}{*}{ILC} & IMU3 & 7.74 & $\pm$ & 2.13 & 7.20 & $\pm$ & 2.33 & -10.95 & $\pm$ & \textbf{0.49} & -6.63 & $\pm$ & 2.04 & 7.69 & $\pm$ & 2.05 & 127.47 & $\pm$ & 1.35 & 7.51 & 6.32 \\ \hline & IMU1 & -0.74 & $\pm$ & 3.77 & -12.87 & $\pm$ & 2.40 & -2.91 & $\pm$ & 4.31 & 9.64 & $\pm$ & 1.19 & 0.09 & $\pm$ & 0.25 & -93.31 & $\pm$ & 2.37 & 8.60 & 7.30 \\ & IMU2 & 7.70 & $\pm$ & 6.42 & -5.85 & $\pm$ & 2.63 & -2.68 & $\pm$ & 2.71 & 9.82 & $\pm$ & 1.71 & 0.19 & $\pm$ & 0.29 & -94.06 & $\pm$ & 2.50 & 6.98 & 6.13 \\ \multirow{-3}{*}{LIOM} & IMU3 & -2.64 & $\pm$ & 2.54 & 11.21 & $\pm$ & 7.15 & 6.43 & $\pm$ & 3.96 & 7.89 & $\pm$ & 4.09 & 0.32 & $\pm$ & 0.27 & 131.30 & $\pm$ & 2.97 & 11.65 & 5.04 \\ \hline & IMU1 & -1.56 & $\pm$ & 1.28 & -10.56 & $\pm$ & 3.24 & -12.94 & $\pm$ & 2.78 & -0.52 & $\pm$ & 1.65 & 1.49 & $\pm$ & 1.06 & -91.00 & $\pm$ & 0.92 & 0.96 & 1.08 \\ & IMU2 & 6.76 & $\pm$ & 1.89 & -3.08 & $\pm$ & 2.40 & -12.39 & $\pm$ & 1.96 & -1.05 & $\pm$ & 2.00 & 1.45 & $\pm$ & 0.89 & -91.34 & $\pm$ & 1.32 & 2.61 & 1.29 \\ \multirow{-3}{*}{FAST-LIO2} & IMU3 & -7.84 & $\pm$ & 1.58 & 4.48 & $\pm$ & 2.72 & -10.41 & $\pm$ & 0.85 & -0.34 & $\pm$ & 1.03 & -0.7 & $\pm$ & 2.13 & 132.96 & $\pm$ & 0.78 & 2.57 & 1.26 \\ \hline & IMU1 & -0.97 & $\pm$ & 2.37 & -9.80 & $\pm$ & 1.49 & -12.98 & $\pm$ & 1.41 & 0.47 & $\pm$ & 0.40 & 0.18 & $\pm$ & 0.87 & -90.90 & $\pm$ & 0.29 & 0.57 & 0.60 \\ & IMU2 & 9.64 & $\pm$ & 2.09 & -1.08 & $\pm$ & 1.10 & -12.47 & $\pm$ & 1.25 & 0.36 & $\pm$ & 0.39 & 0.42 & $\pm$ & 0.83 & -91.56 & $\pm$ & 0.27 & 0.73 & 0.96 \\ \multirow{-3}{*}{LI-Calib} & IMU3 & -6.73 & $\pm$ & 2.03 & 7.09 & $\pm$ & 1.33 & -12.66 & $\pm$ & 1.11 & -0.56 & $\pm$ & 0.60 & 0.89 & $\pm$ & 0.81 & 133.14 & $\pm$ & 0.31 & 0.58 & 1.23 \\ \hline & IMU1 & -0.22 & $\pm$ & \textbf{0.50} & -9.92 & $\pm$ & \textbf{0.31} & -13.48 & $\pm$ & \textbf{0.44} & 0.23 & $\pm$ & \textbf{0.04} & 0.21 & $\pm$ & \textbf{0.06} & -90.89 & $\pm$ & \textbf{0.07} & \textbf{0.31} & \textbf{0.54} \\ & IMU2 & 10.16 & $\pm$ & \textbf{0.36} & -1.00 & $\pm$ & \textbf{0.31} & -12.83 & $\pm$ & \textbf{0.54} & 0.16 & $\pm$ & \textbf{0.07} & 0.46 & $\pm$ & \textbf{0.17} & -91.53 & $\pm$ & \textbf{0.05} & \textbf{0.59} & \textbf{0.93} \\ \multirow{-3}{*}{OA-LICalib} & IMU3 & -7.19 & $\pm$ & \textbf{0.53} & 7.46 & $\pm$ & \textbf{0.34} & -12.89 & $\pm$ & 0.61 & -0.43 & $\pm$ & \textbf{0.04} & 0.68 & $\pm$ & \textbf{0.05} & 133.14 & $\pm$ & \textbf{0.09} & \textbf{0.33} & \textbf{1.17} \\ \hline \end{tabular} } \label{tab:real_full_motion_compare} \end{table*} \begin{table}[t] \caption{The OA-LICalib's time consumption of main stages. Two segments from \textit{Lab-01} and \textit{SKG-01} sequence are evaluated, respectively. The former segment is under fully-excited motion, while the latter is under degeneration motion.} \centering { \resizebox{\linewidth}{!}{ \begin{tabular}{@{}ccccccc@{}} \toprule \multirow{2}{*}{Step} & \multicolumn{3}{c}{\begin{tabular}[c]{@{}c@{}}Fully-excited Seq.\\ {[}0,15{]} of \textit{Lab-01}\end{tabular}} & \multicolumn{3}{c}{\begin{tabular}[c]{@{}c@{}}Degenerate Seq.\\ {[}0,15{]} of \textit{SKG-01}\end{tabular}} \\ \cmidrule(l){2-7} & Count & \begin{tabular}[c]{@{}c@{}}Processing\\ /Step(s)\end{tabular} & Total(s) & Count & \begin{tabular}[c]{@{}c@{}}Processing\\ /Step(s)\end{tabular} & Total(s) \\ \midrule Extri. Init. \& Rerun Odom. & 1 & 15.73 & 15.73 & 1 & 12.25 & 12.25 \\ Data Association & 1 & 1.80 & 1.80 & 1 & 3.31 & 3.31 \\ Init. Traj. \& First Opt. & 1 & 4.47 & 4.47 & 1 & 6.54 & 6.54 \\ Refinement & 5 & 6.73 & 33.64 & 5 & 8.03 & 40.17 \\ TSVD & 0 & - & - & 5 & 0.03 & 0.13 \\ \midrule Total & - & - & 55.65 & - & - & 64.40 \\ \bottomrule \end{tabular} } } \label{tab:time_consumption} \end{table} \subsection{Calibration with Full Motion Excitation} We gathered four sequences of a 60-second duration with full excitation in structured environments, \textit{Stairs-01 and Stairs-02} collected at the stairway, \textit{Lab-01 and Lab-02} in the laboratory, verifying the calibration accuracy of the full motion excitation data. Each sequence is split into four segments of 15 seconds and calibrated independently for calibration test. The extrinsic calibration results of three IMUs with respect to the LiDAR by the proposed OA-LICalib are shown in Fig.~\ref{fig:6dof-position} and Fig.~\ref{fig:6dof-rotation}, where the black rectangles indicate the CAD sketch of three IMUs. We can intuitively find that the translational calibration results are distributed within rectangles, with the distribution range in translation at around 2cm. The distribution range of rotation concentrates within 0.2 degrees for each IMU. These results demonstrate the proposed method's high repeatability and reliability in practical deployments. Additionally, the quantitative comparison results are summarized in Table~\ref{tab:real_full_motion_compare}, where RMSE is calculated by comparing it to the CAD reference. Note that LIOM fails to converge on the \textit{Stairs} sequences and ILC does not converge on the \textit{Lab} sequences in our experiments. Failing to convergence means rotational RMSE is greater than 30 degrees. The non-converged results are excluded from the statistics in Table~\ref{tab:real_full_motion_compare}. Although the discrete-time methods, ILC, LIOM and FAST-LIO are initialized from the reference extrinsic rotation, the continuous-time based methods LI-Calib and OA-LICalib show apparent advantages over all of them, while starting from the identity extrinsic rotation matrix. In addition, compared to LI-Calib, OA-LICalib takes more effort on the initialization of control points (Sec.~\ref{sec:initialization of control points}), which benefits the convergence and improves the accuracy of calibrations. It is worthwhile to mention that the calibration results of OA-LICalib are with high calibration accuracy yet low standard deviations, which demonstrate its great reliability. To give an impression of the efficiency, the proposed OA-LICalib's time consumption of main stages in two typical 15s segment over the sequence \textit{Lab-01} (under fully-excited motion) and sequence \textit{SKG-01} (under degenerate motion) are summarized in Table~\ref{tab:time_consumption}. Basically, the proposed method takes about only one minute to generate the highly-accurate calibration results automatically on a 15s calibration segment. \begin{figure}[t] \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=1.0\columnwidth]{figures/segment/skg-casual_walk-01-imu.pdf} \end{subfigure} \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=1.0\columnwidth]{figures/segment/skg-traj.pdf} \end{subfigure} \caption{Evaluation in \textit{YQ-01} sequence. Top: The informativeness of every individual segment of \textit{YQ-01} sequence, which has a total trajectory length of 363 meters; the corresponding three-axis angular velocity curves. Bottom: The whole trajectory is plotted in dashed line and the selected segments in bright colors. The trajectory direction is counterclockwise. } \label{fig:segment_skg} \end{figure} \begin{table}[t] \caption{The estimated spatial parameters $\{{}^I_L\bar{q},{}^I\bp_{L}\}$ and time offset $t_c$ using one segment (Segment-$n$) or multi-segment ($n$ Segments) over \textit{YQ-01} sequence. } \label{table:segment_skg} \centering \resizebox{\linewidth}{!} { \begin{tabular}{|c|ccccccc|cc|} \hline & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I\bp_{L}$ (cm)} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)} & \cellcolor[HTML]{E0EFD4} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}RMSE} \\ \cline{2-7} \cline{9-10} \multirow{-2}{*}{Data} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}yaw} & \multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}\begin{tabular}[c]{@{}c@{}}Time\\Offset (ms)\end{tabular}} & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline CAD Reference & -10 & 0 & 13 & 180 & -180 & -90 & - & & \\ \hline Segment-1 & -11.0 & 0.3 & 14.6 & 179.75 & -179.76 & -89.25 & 7.4 & 1.10 & 0.48 \\ Segment-2 & -11.0 & -0.2 & 14.0 & 179.77 & -179.81 & -89.23 & 7.6 & 0.82 & \textbf{0.48} \\ Segment-3 & -11.2 & 0.7 & 13.5 & 179.77 & -179.8 & -89.18 & 7.4 & 0.85 & 0.51 \\ Segment-4 & -11.0 & 0.0 & 14.7 & 179.73 & -179.77 & -89.2 & 7.8 & 1.14 & 0.51 \\ Segment-5 & -9.7 & 0.3 & 12.8 & 179.71 & -179.81 & -89.18 & 7.4 & \textbf{0.27} & 0.51 \\ Segment-6 & -10.6 & -0.2 & 15.1 & 179.78 & -179.82 & -89.19 & 7.9 & 1.27 & 0.50 \\ \hline 2 Segments & -11.3 & 0.2 & 14.4 & 179.76 & -179.77 & -89.25 & - & 1.11 & \textbf{0.47} \\ 3 Segments & -11.3 & 0.3 & 14.2 & 179.76 & -179.77 & -89.24 & - & 1.04 & 0.48 \\ 4 Segments & -11.2 & 0.2 & 14.3 & 179.75 & -179.77 & -89.23 & - & 1.03 & 0.49 \\ 5 Segments & -11.1 & 0.2 & 14.1 & 179.75 & -179.79 & -89.23 & - & \textbf{0.91} & 0.48 \\ 6 Segments & -11.1 & 0.2 & 14.3 & 179.76 & -179.8 & -89.23 & - & 0.99 & 0.48 \\ \hline \end{tabular} } \vspace{-1em} \end{table} \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/hilti/hilti-segment-ic-office.pdf} \caption{Top: The informativeness of every individual segment of \textit{IC-Office} sequence. Bottom: the corresponding linear acceleration curves and angular velocity curves.} \label{fig:hilti_ic_office} \end{figure} \begin{table}[h] \caption{Comparison results of different methods on Hilti dataset. LIOM fails to give reasonable results, thus not listed in the table. } \centering { \resizebox{\linewidth}{!} { \begin{tabular}{|cc|cccccccc|cc|} \hline & & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}} & \cellcolor[HTML]{E0EFD4} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}} \\ & & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}${}^I\bp_L$ (cm)}} & \multicolumn{3}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)}} & \cellcolor[HTML]{E0EFD4} & \multicolumn{2}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{EECC89}RMSE}} \\ \cline{4-9} \cline{11-12} \multirow{-3}{*}{Method} & \multirow{-3}{*}{Sequence} & \multicolumn{1}{c|}{\multirow{-3}{*}{Data}} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}yaw} & \multirow{-3}{*}{\cellcolor[HTML]{E0EFD4}\begin{tabular}[c]{@{}c@{}}Time\\ Offset\\ (ms)\end{tabular}} & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline \multicolumn{2}{|c|}{Reference} & & 1.00 & -0.66 & 9.47 & 0.02 & -0.37 & -0.14 & $\sim$1ms & & \\ \hline \multicolumn{1}{|c|}{} & \textit{Office\_Mitte} & All data & 0.43 & -1.02 & 6.58 & 0.05 & -0.02 & -0.35 & - & 1.71 & 0.24 \\ \cline{2-12} \multicolumn{1}{|c|}{\multirow{-2}{*}{FAST-LIO2}} & IC\_Office & All data & 0.69 & -1.21 & 5.02 & 0.03 & 0.12 & -0.59 & - & 2.59 & 0.39 \\ \hline \multicolumn{1}{|c|}{} & \textit{Office\_Mitte} & All data & -0.02 & -1.09 & 11.95 & 1.54 & -0.50 & 0.12 & -3.86 & 1.57 & 0.89 \\ \cline{2-12} \multicolumn{1}{|c|}{\multirow{-2}{*}{ILC}} & IC\_Office & All data & -0.24 & 3.65 & 10.95 & -0.01 & 0.97 & 5.16 & -11.90 & 2.73 & 3.15 \\ \hline \multicolumn{1}{|c|}{} & & Segment-1 & 0.20 & -0.70 & 9.10 & 0.12 & -0.07 & -0.26 & 1.62 & \textbf{0.51} & 0.20 \\ \multicolumn{1}{|c|}{} & & Segment-2 & 0.71 & 0.86 & 5.57 & 0.25 & -0.31 & 0.45 & 1.76 & 2.42 & 0.37 \\ \multicolumn{1}{|c|}{} & & Segment-3 & -0.44 & -0.66 & 6.96 & 0.04 & -0.20 & -0.08 & 1.65 & 1.67 & \textbf{0.10} \\ \multicolumn{1}{|c|}{} & & Segment-4 & -2.64 & -1.74 & 9.73 & 0.00 & 0.10 & 0.09 & 1.53 & 2.20 & 0.30 \\ \cline{3-12} \multicolumn{1}{|c|}{} & & 2-Segment & -0.15 & 0.16 & 7.21 & 0.16 & -0.14 & -0.11 & - & 1.54 & 0.16 \\ \multicolumn{1}{|c|}{} & & 3-Segment & -0.22 & 0.25 & 7.72 & 0.12 & -0.15 & -0.15 & - & 1.34 & \textbf{0.14} \\ \multicolumn{1}{|c|}{} & \multirow{-7}{*}{\textit{Office\_Mitte}} & 4-Segment & -0.20 & 0.02 & 7.69 & 0.11 & -0.13 & -0.18 & - & \textbf{1.30} & 0.15 \\ \cline{2-12} \multicolumn{1}{|c|}{} & & Segment-1 & 1.16 & -2.30 & 6.33 & -0.05 & -0.20 & -0.43 & 1.55 & 2.05 & 0.20 \\ \multicolumn{1}{|c|}{} & & Segment-2 & -1.49 & 0.58 & 8.81 & -0.03 & -0.42 & -0.02 & 0.96 & 1.65 & 0.08 \\ \multicolumn{1}{|c|}{} & & Segment-3 & 0.77 & 2.17 & 5.67 & 0.10 & -0.31 & -0.09 & 1.30 & 2.74 & \textbf{0.06} \\ \multicolumn{1}{|c|}{} & & Segment-4 & -0.17 & 0.17 & 7.34 & -0.20 & -0.25 & -0.07 & 1.43 & \textbf{1.48} & 0.15 \\ \cline{3-12} \multicolumn{1}{|c|}{} & & 2-Segment & 0.48 & -0.86 & 7.37 & -0.03 & -0.27 & -0.45 & - & \textbf{1.25} & 0.19 \\ \multicolumn{1}{|c|}{} & & 3-Segment & 0.64 & 0.24 & 6.76 & 0.01 & -0.27 & -0.27 & - & 1.66 & 0.09 \\ \multicolumn{1}{|c|}{\multirow{-14}{*}{OA-LICalib}} & \multirow{-7}{*}{\textit{IC\_Office}} & 4-Segment & 0.53 & 0.30 & 6.91 & -0.02 & -0.27 & -0.23 & - & 1.60 & \textbf{0.08} \\ \hline \end{tabular} } } \label{tab:hilti_multi_segment} \end{table} \begin{table}[t] \caption{Multiple-segment calibration using non-informative segment in \textit{IC-Office} sequences. The segments \colorbox[HTML]{C4FFC4}{[60,75]} and \colorbox[HTML]{C4FFC4}{[105,120]} are identified as informative segments and segment \colorbox[HTML]{FFCCC9}{[15,30]} is identified as non-informative segment, as shown in Fig.~\ref{fig:hilti_ic_office}. } \centering { \resizebox{\linewidth}{!}{ \begin{tabular}{|c|ccccccc|cc|} \hline & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}} & \cellcolor[HTML]{E0EFD4} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}} \\ & \multicolumn{3}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}${}^I\bp_L$ (cm)}} & \multicolumn{3}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)}} & \cellcolor[HTML]{E0EFD4} & \multicolumn{2}{c|}{\multirow{-2}{*}{\cellcolor[HTML]{EECC89}RMSE}} \\ \cline{2-7} \cline{9-10} \multirow{-3}{*}{Data} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}yaw} & \multirow{-3}{*}{\cellcolor[HTML]{E0EFD4}\begin{tabular}[c]{@{}c@{}}Time \\ Offset\\ (ms)\end{tabular}} & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline Reference & 1.00 & -0.66 & 9.47 & 0.02 & -0.37 & -0.14 & $\sim$1ms & & \\ \hline \cellcolor[HTML]{C4FFC4}{[}60,75{]} & 1.16 & -2.30 & 6.33 & -0.05 & -0.20 & -0.43 & 1.55 & 2.05 & 0.20 \\ \cellcolor[HTML]{C4FFC4}{[}105,120{]} & -1.49 & 0.58 & 8.81 & -0.03 & -0.42 & -0.02 & 0.96 & 1.65 & \textbf{0.08} \\ \cellcolor[HTML]{FFCCC9}{[}15,30{]} & 0.68 & -2.84 & 1.47 & 0.09 & -0.45 & 0.01 & 0.66 & 4.79 & 0.11 \\ \hline {[}60,75{]}+{[}105,120{]} & 0.48 & -0.86 & 7.37 & -0.03 & -0.27 & -0.45 & - & \textbf{1.25} & 0.19 \\ {[}60,75{]}+{[}15,30{]} & 0.69 & -2.75 & 3.91 & -0.01 & -0.33 & -0.42 & - & 3.43 & 0.16 \\ \hline \end{tabular} } } \label{tab:hilti_non_informative_segment} \vspace{-1em} \end{table} \subsection{Calibration with Informative Segments} There is a relatively common situation in practice where some datasets provide a large number of various data sequences yet without accurate extrinsic parameters. There's no possibility of collecting new sequences with the sensors used in the existing datasets. Hence, if users want to get more accurate extrinsic parameters, they need to complete the calibration based on the existing data sequences. Special care should be taken when identifying informative sequences for accurate calibration. Regarding the implementation details about multi-segment calibration, we firstly perform single segment calibration and identify informative segments; afterward, with all the measurements from selected informative segments, we conduct a total continuous-time batch optimization to simultaneously estimate each segment's individual states (including the continuous-time trajectory, time offset $t_c$, IMU navigation states $\bx_{Is}$), and the shared spatial extrinsic parameters $\{{}^I_L\bar{q},{}^I\bp_{L}\}$. We evaluate the proposed informativeness-aware segment selection algorithm in the self-collected sequence \textit{YQ-01} and public-available sequence \textit{Casual-walk} \textit{and Office\_Mitte}, \textit{IC\_Office} from the Hilti dataset. Like the \textit{Casual-walk} sequence collection process, we walk in a circle profile with the occasional shake of the sensor to collect \textit{YQ-01} sequence. Again, we split sequences into segments with a duration of 15-second for each segment. \subsubsection{\textit{YQ-01} Sequence} Figure~\ref{fig:segment_skg} details the shape of the trajectory and the corresponding angular velocity curves of the \textit{YQ-01} sequence. The top figure in Fig.~\ref{fig:segment_skg} illustrates each segment's information metrics and angular velocities. The segments with minimal singular value (see Sec.~\ref{sec:data segment selection}) above 100 (black dash line) are selected as the informative segments and the relative location of these segments are shown in bright colors at the bottom of Fig.~\ref{fig:segment_skg}. It is interesting to see the amplitudes of angular velocity can indistinctly reflect the information metrics. The extrinsic calibration results with data of one segment (Segment-$n$) and multi-segment ($n$ Segments) are summarized in Table~\ref{table:segment_skg}. Note that ``$n$ Segments" means we take the first $n$ informative segments, e.g., ``3 Segments" represents Segment-1, Segment-2 and Segment-3 are jointly utilized for calibration. The evaluation results show that the selected single-segment calibration is able to generate reasonable calibration results, which demonstrate the effectiveness of the informative segment selection. Besides, multi-segment calibration is generally stable compared to single-segment calibration, and four informative segments are enough to get a reliable estimation of the extrinsics. \subsubsection{Hilti Sequences} Furthermore, we test the multi-segment calibration on two handheld sequences of the Hilti dataset, the comparison results are reported in Table~\ref{tab:hilti_multi_segment}. Figure~\ref{fig:hilti_ic_office} reports the information metrics of every individual segment, linear acceleration curves, and angular velocity curves in the \textit{IC\_Office} sequence, and we pick out the four most informative segments for multi-segment calibration. The results in Table~\ref{tab:hilti_multi_segment} suggest multi-segment calibration is more stable and more accurate than single-segment calibration. The proposed OA-LICalib with multi-segment calibration also significantly outperforms ILC and FAST-LIO2. Note that using minimal singular value to measure the informativeness of each individual segment within a single sequence is feasible, however it is not meaningful to compare the minimal singular values of different sequences under significantly different scenarios. Minimal singular value is not a general information metric~\cite{schneider2019observability}, and it is affected by the sensory observations, trajectory profile, surrounding environment, etc. This is reflected by the different amplitudes of minimal singular values over different sequences, as shown in Fig.~\ref{fig:segment_skg} and Fig.~\ref{fig:hilti_ic_office}. On the positive side, a minimal-singular-value-based information metric is sufficient for informative segments selection from a given sequence and leads to reasonable calibration results. We further investigate the performance of non-informative segments and their effect on multi-segment calibration results. Table~\ref{tab:hilti_non_informative_segment} shows the calibration results using multiple segments in \textit{IC-Office} sequences. The segments [60, 75] and [105, 120] are identified as informative segments, while the segment [15, 30] is a non-informative segment automatically by OA-LICalib, as shown in Fig.~\ref{fig:hilti_ic_office}. The results in Table~\ref{tab:hilti_non_informative_segment} suggest that the non-informative segment generates a much bigger calibration error. When the non-informative segments are included for multi-segment calibration, the calibration results may be degraded compared to calibration using only informative segments. The multi-segment calibration result is more like a weighted average of the calibration results from their component segments, thus the calibration result is more stable than single-segment calibration. \subsubsection{\textit{Casual-walk} Sequence} The \textit{Casual-walk} sequence is one of the common cases where the dataset is publicly available but without providing carefully calibrated extrinsic parameters. The rough extrinsic parameters are $[0,0,0]^{\top}$ in translation and identity matrix in rotation. We try to conduct multi-segment calibration on this sequence. This sequence was collected by randomly walking around the campus and occasionally shaking the sensor vigorously, meaning that the sequence is coupled with a number of segments suitable for calibration. We perform multi-segment data calibration using only half of the sequence which is divided into 20-second segments, and the results are shown in Table~\ref{tab:segment_mit}. Since there are no reliable reference values for the dataset's extrinsics or ground truth trajectory, we can only evaluate the quality of the LiDAR point cloud map, which implicitly reflects the calibration accuracy. The MMEs of the maps are -2.141, -2.163, and -2.185 for the rough extrinsics, the calibrated spatial extrinsics, and the calibrated spatial-temporal extrinsics, respectively. The map quality obtained from the calibrated spatial-temporal extrinsics is the best, which verifies the effectiveness and accuracy of the multi-segment calibration. \begin{table}[t] \caption{Evaluation of calibration results using single or multi informative segments over the \textit{Casual-walk} sequence. } \centering \resizebox{\linewidth}{!} { \begin{tabular}{|c|ccccccc|} \hline & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I\bp_{L}$ (cm)} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)} & \cellcolor[HTML]{E0EFD4} \\ \cline{2-7} \multirow{-2}{*}{Data} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}yaw} & \multirow{-2}{*}{\cellcolor[HTML]{E0EFD4}\begin{tabular}[c]{@{}c@{}}Time \\Offset (ms)\end{tabular}} \\ \hline Segment-1 & -0.9 & 0.4 & -4.7 & 178.88 & 179.83 & 178.52 & 8.3 \\ Segment-2 & -0.8 & 0.7 & -2.9 & 178.92 & 179.81 & 178.53 & 8.1 \\ Segment-3 & -1.6 & -0.1 & -3.2 & 178.98 & 179.90 & 178.50 & 9.1 \\ Segment-4 & -0.2 & 0.0 & -1.2 & 178.91 & 179.77 & 178.72 & 8.5 \\ \hline 2 Segments & -1.0 & 0.5 & -3.8 & 178.89 & 179.81 & 178.52 & - \\ 3 Segments & -1.3 & 0.4 & -3.7 & 178.91 & 179.83 & 178.52 & - \\ 4 Segments & -1.1 & 0.7 & -3.3 & 178.91 & 179.83 & 178.54 & - \\ \hline \end{tabular} } \label{tab:segment_mit} \end{table} \begin{figure}[t] \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=1.0\columnwidth]{figures/real/skg-fig8-01-map.png} \end{subfigure} \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=\columnwidth]{figures/real/fig8_path-01.pdf} \end{subfigure} \begin{subfigure}{1.0\columnwidth} \centering \includegraphics[width=\columnwidth]{figures/skg-fig8-imu.pdf} \end{subfigure} \caption{The details about the \textit{SKG-01} sequence. Top: The environment for collecting \textit{SKG-01} sequence and the actual figure-8-shape trajectory. Middle: Concrete trajectories for each 15-second segment, the red stars indicate the start and end position of the trajectory, respectively. Bottom: Corresponding three-axis angular velocity curves.} \label{fig:real_fig8_data} \end{figure} \begin{table}[t] \centering \begin{tabular}{ccccccc} \toprule \textbf{Time} & \multicolumn{6}{c}{\textbf{Singular values in a decreasing order}} \\ \midrule \rowcolor[HTML]{EFEFEF} {[}0,15{]} & 5545 & 4659 & 3664 & 958 & 282 & 0.010 \\ {[}15,30{]} & 33595 & 16045 & 6844 & 930 & 724 & 0.016 \\ \rowcolor[HTML]{EFEFEF} {[}30,45{]} & 27126 & 10997 & 7585 & 1915 & 678 & 0.016 \\ {[}45,60{]} & 47269 & 25342 & 5606 & 726 & 365 & 0.009 \\ \rowcolor[HTML]{EFEFEF} {[}60,75{]} & 9332 & 9186 & 3634 & 929 & 452 & 0.008 \\ {[}75,90{]} & 60975 & 15907 & 5675 & 563 & 234 & 0.004 \\ \rowcolor[HTML]{EFEFEF} {[}90,105{]} & 18542 & 7932 & 760 & 290 & 125 & 0.006 \\ {[}105,120{]} & 20997 & 10650 & 3940 & 811 & 8 & 0.012 \\ \bottomrule \end{tabular} \caption{The singular value of each segment in \textit{SKG-01} sequence identified by OA-LICalib. The secondary minimum singular value of the segments [90,105] and [105,120] are relatively small. } \label{tab:real_fig8_singular_value} \vspace{-1em} \end{table} \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/real/fig8_result.pdf} \caption{Comparison of the estimated ${}^I\bp_L$ under degenerate case over \textit{SKG-01} sequence: using OA-LICalib with and without observability-aware calibration. References are from the CAD sketch.} \label{fig:real_fig8_result} \vspace{-1em} \end{figure} \begin{figure}[t] \centering \includegraphics[width=1.0\columnwidth]{figures/hilti/hilti-basement.pdf} \caption{Comparison of the estimated ${}^I\bp_L$ under degenerate case over \textit{Basement} sequence: using OA-LICalib with and without observability awareness. The beginning of the sequence is skipped due to less motion. } \label{fig:hilti_basement_calib} \vspace{-1em} \end{figure} \begin{table}[t] \caption{Comparison of the calibration results under degenerate case over \textit{SKG-01} and \textit{Basement} sequences.} \resizebox{\linewidth}{!}{ \begin{tabular}{|c|c|ccccccc|cc|} \hline & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I\bp_L$ (cm)} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}RMSE} \\ \cline{4-11} \multirow{-2}{*}{Seq.} & \multicolumn{1}{c|}{\multirow{-2}{*}{Method}} & \multicolumn{1}{c|}{\multirow{-2}{*}{Data}} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \cellcolor[HTML]{E0EFD4}yaw & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline & Reference & & -10.00 & 0.00 & 13.00 & 0.00 & 0.00 & 90.00 & & \\ \cline{2-11} & FAST-LIO2 & {[}0,120{]} & 4.24 & 2.09 & 11.79 & 0.59 & 0.97 & 90.77 & 8.34 & 0.79 \\ & ILC & {[}0,120{]} & -10.50 & -0.60 & 15.35 & -0.51 & 0.13 & 91.13 & \textbf{1.43} & \textbf{0.72} \\ \cline{2-11} & W/O Obser. & {[}0,15{]} & -10.85 & -2.50 & 27.39 & -0.16 & 0.29 & 90.81 & 8.45 & 0.50 \\ & W/O Obser. & {[}15,30{]} & -10.30 & -0.82 & 18.39 & -0.12 & 0.31 & 90.64 & 3.15 & 0.42 \\ & W/O Obser. & {[}30,45{]} & -10.24 & -0.56 & 16.41 & -0.19 & 0.28 & 91.01 & \textbf{2.00} & 0.61 \\ & W/O Obser. & {[}45,60{]} & -12.10 & -0.48 & 22.39 & -0.10 & 0.26 & 90.56 & 5.56 & \textbf{0.36} \\ \cline{2-11} & W/ Obser. & {[}0,15{]} & -10.88 & 0.68 & 10.78 & -0.16 & 0.29 & 90.80 & 1.43 & 0.50 \\ & W/ Obser. & {[}15,30{]} & -10.34 & 0.61 & 10.84 & -0.12 & 0.31 & 90.64 & 1.31 & 0.41 \\ & W/ Obser. & {[}30,45{]} & -10.29 & 0.51 & 10.86 & -0.19 & 0.28 & 91.01 & \textbf{1.28} & 0.61 \\ \multirow{-11}{*}{\textit{SKG-01}} & W/ Obser. & {[}45,60{]} & -12.15 & 1.69 & 11.04 & -0.10 & 0.26 & 90.56 & 1.94 & \textbf{0.36} \\ \hline \hline & & \multicolumn{1}{c|}{} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I\bp_L$ (cm)} & \multicolumn{3}{c|}{\cellcolor[HTML]{E0EFD4}${}^I_L\bar{q}$ in Euler (deg)} & \multicolumn{2}{c|}{\cellcolor[HTML]{EECC89}RMSE} \\ \cline{4-11} \multirow{-2}{*}{Seq.} & \multirow{-2}{*}{Method} & \multicolumn{1}{c|}{\multirow{-2}{*}{Data}} & \cellcolor[HTML]{E0EFD4}$p_x$ & \cellcolor[HTML]{E0EFD4}$p_y$ & \multicolumn{1}{c|}{\cellcolor[HTML]{E0EFD4}$p_z$} & \cellcolor[HTML]{E0EFD4}roll & \cellcolor[HTML]{E0EFD4}pitch & \cellcolor[HTML]{E0EFD4}yaw & \cellcolor[HTML]{EECC89}Pos (cm) & \cellcolor[HTML]{EECC89}Rot (deg) \\ \hline & Reference & & 1.00 & -0.66 & 9.47 & 0.02 & -0.37 & -0.14 & & \\ \cline{2-11} & FAST-LIO2 & {[}85,325{]} & 0.96 & 1.53 & 7.33 & 1.22 & 0.91 & 1.51 & \textbf{1.77} & \textbf{1.39} \\ & ILC & {[}85,325{]} & 11.05 & 10.67 & -46.97 & 4.42 & 5.38 & 9.01 & 33.74 & 6.74 \\ \cline{2-11} & W/O Obser. & {[}85,100{]} & 0.34 & 0.27 & 26.72 & 0.16 & -0.34 & 0.27 & 9.98 & 0.25 \\ & W/O Obser. & {[}100,115{]} & -0.04 & 1.53 & 7.28 & 0.31 & -0.46 & -0.29 & \textbf{1.88} & 0.19 \\ & W/O Obser. & {[}115,130{]} & -2.78 & -1.65 & 64.22 & 0.10 & -0.41 & 1.25 & 31.69 & 0.80 \\ & W/O Obser. & {[}130,145{]} & -0.70 & -0.08 & -1.99 & 0.19 & -0.22 & -0.12 & 6.70 & \textbf{0.13} \\ \cline{2-11} & W/ Obser. & {[}85,100{]} & 0.21 & 0.25 & 7.52 & 0.16 & -0.34 & 0.26 & \textbf{1.32} & 0.24 \\ & W/ Obser. & {[}100,115{]} & 0.06 & 1.37 & 7.47 & 0.31 & -0.45 & -0.29 & 1.73 & 0.19 \\ & W/ Obser. & {[}115,130{]} & -3.32 & -1.71 & 7.56 & 0.10 & -0.41 & 1.30 & 2.79 & 0.83 \\ \multirow{-11}{*}{\textit{Basement}} & W/ Obser. & {[}130,145{]} & -0.68 & -0.06 & 7.51 & 0.19 & -0.22 & -0.12 & 1.53 & \textbf{0.13} \\ \hline \end{tabular} } \label{tab:degenerate_seqs_compare} \vspace{-1em} \end{table} \subsection{Calibration in Degenerate Case} In practical applications, the on-vehicle situation is a common case with motion degeneration and there are high demands for accurate calibrations in this scenario. In this section, we also test the extrinsic calibration in on-vehicle conditions over the self-collected \textit{SKG-01} sequence and the publicly-available \textit{Basement} sequence. { Regarding the initialization under degenerate cases, since the compared methods ILC, LIOM, and FAST-LIO2 fail to be initialized with the identity extrinsic rotation matrix, all the methods are initialized with the perturbed extrinsics, with rotational perturbations of 2 degrees per axis and translational perturbations of 2 cm per axis. In general, all the methods start from the same initial extrinsic parameters for fair comparisons. } \subsubsection{\textit{SKG-01} Sequence} To ensure the LiDAR sensor has sufficiently large visibility of the ground for localization, we mount the sensor suite at a slight incline downwards as shown in Fig.~\ref{fig:car}. We collect the \textit{SKG-01} sequence with a duration of 120 seconds, while the ground robot moves on a planar ground surface. This sequence is split into six 15-second segments, which are individually used for calibration. Figure~\ref{fig:real_fig8_data} illustrates the details of \textit{SKG-01} sequence and Fig.~\ref{fig:real_fig8_result} displays translation calibration results of OA-LICalib with and without observability awareness (Section~\ref{sec:tsvd}). Table~\ref{tab:real_fig8_singular_value} reports the singular value of each segment in \textit{SKG-01} sequence identified by OA-LICalib. For the first 6 segments, the eigen vector corresponding to the minimum singular value is almost the same that is $[0.000,\ 0.000,\ 0.000,\ 0.007,\ -0.187,\ 0.982]$. Note that the head part of the eigen vector corresponds to extrinsic rotation and the tail part corresponds to extrinsic translation, which is determined by the stack order of parameters $\delta \bx$ in \eqref{eq:Ax=b}. The identified degradation direction by the eigen vector is close to the $z$-axis, which is reasonable and coincides with the fact that a certain angular offset exists between the sensor frame and the ground plane. As shown in Fig.~\ref{fig:real_fig8_result}, translation results in the $z$-axis of OA-LICalib without observability awareness has a large deviation from the reference value. With the awareness of observability, OA-LICalib is able to keep the main degenerate axis, $z$-axis, as a prior and eliminate the coupled errors in the $x$-axis, resulting in more accurate calibrated extrinsic parameters. However, for segments at time intervals [90, 105] and [105,120], OA-LICalib estimates poor results which is most likely due to insufficient excitation. From the angular velocities curves of the \textit{SKG-01} sequence shown in Fig.~\ref{fig:real_fig8_data}, we can find that the magnitudes of angular velocity are relatively small for these two segments, leading to a deterioration of the observability, which is also reflected by the singular values shown in Table~\ref{tab:real_fig8_singular_value}. \subsubsection{\textit{Basement} Sequence} We further test in the on-vehicle \textit{Basement} sequence of the Hilti dataset. The beginning of the \textit{Basement} is skipped due to less motion. Fig.~\ref{fig:hilti_basement_calib} reports the calibration results. OA-LICalib with observability awareness automatically identifies the principal non-observable direction as the $z$-axis of extrinsic translation and succeeds in keeping it to the initial value. Besides, we notice that the errors of final calibration results in the observable $x$-axis and $y$-axis of translations are larger than those on the \textit{SKG-01} sequence. Because the Hilti dataset is not specifically collected for calibration, and the motion excitation in this sequence is insufficient, which is also reflected by the small magnitude of averaged angular velocity shown in Table~\ref{tab:real_datasets}. Table~\ref{tab:degenerate_seqs_compare} reports the calibration results for the different methods. Again, LIOM fails to give reasonable results thus are excluded from the table. The main degenerate direction of \textit{SKG-01} and \textit{Basement} sequences is the extrinsic translation along the $z$-axis. Without the observability-aware module, our method, FAST-LIO2, and ILC fail to give good calibrations along the $z$-axis of extrinsic translation. With observability awareness, OA-LICalib is able to generate accurate calibration results in on-vehicle conditions. \subsection{Remarks} \label{sec:disscussion} \rev{It is clear from the previous simulation and experimental results that fully-excited motions, whenever possible, are generally recommended for accurate LI calibration, which agrees with the calibration literature~\cite{yang2020online,kelly2011visual,furgale2012continuous}. For example, the proposed OA-LICalib is able to provide accurate calibration results from any segment with fully-excited motion in sequence \textit{Lab} and \textit{Stairs}, as shown in Fig.~\ref{fig:6dof-position} and Fig.~\ref{fig:6dof-rotation} and Table~\ref{tab:real_full_motion_compare}. Among the sequences with occasional fully-excited motion, e.g., \textit{YQ-01}, \textit{IC\_Office} and \textit{Office\_Mitte} sequences, the automatically-selected informative segments can also generate reasonable calibration results as summarized in Table~\ref{table:segment_skg}, ~\ref{tab:hilti_multi_segment}. In contrast, the OA-LICalib has larger errors on segments under degenerate planar motions, such as [90,105] of the \textit{SKG-01} sequence (see Fig.~\ref{fig:real_fig8_result}) and [115,130] of the \textit{Basement} sequence (see Fig.~\ref{fig:hilti_basement_calib}), which are the segments with small angular velocities (see Fig.~\ref{fig:real_fig8_data}). } \rev{While the fully-exited motions are recommended, they might not be feasible in practice and it thus becomes necessary to address degeneracy. The proposed OA-LICalib with observability-awareness is able to select informative segments based on the singular values of the information matrix and tackle the degeneracy via TSVD. Notably, the information metric of singular values is affected by the sensory observations, motion profiles and environments. Some other information metrics, for example, the trace, determinant, and maximal eigenvalue of the information matrix can also be used~\cite{schneider2019observability}. } \rev{It should be noted that the proposed OA-LICalib relies on the point-to-surfel constraints, which well constrain the LI calibration problem in structured environments. This implies that planar patches (surfels) exist in the environments and can be identified. From our experience, no matter it is indoors or outdoors, the OA-LICalib usually works well when there are enough man-made structures (e.g., walls, buildings, staircases) within 50 meters and the calibration data collection with fully-excited motion lasts for 10-20 seconds. However, in some cluttered environments without clear planar regions or some scenarios with fairly sparse structures, the proposed approach would have degraded performance. For example, it may fail to provide reasonable results on some outdoor sequences of the Hilti dataset~\cite{helmberger2021hilti}, in which the scenarios are nearly empty without clear human-made structures. To address this issue, resulting from insufficient point-to-surfel constraints from LiDAR data, some ideas from advanced point cloud registration methods~\cite{huang2021comprehensive} could be leveraged, such as Sdrsac~\cite{le2019sdrsac}, Teaser++~\cite{yang2019polynomial, yang2020teaser}, OPRANSAC~\cite{li2021point}, CVO~\cite{zhang2021new}, and deep-learning-based methods~\cite{huang2021predator}. } \section{Conclusions and Future Work} \label{sec:conclusion} \rev{ In this paper, we have developed an observability-aware targetless LiDAR-IMU calibration method, termed OA-LICalib, within the continuous-time batch optimization framework. The proposed OA-LICalib calibrates not only the spatial-temporal extrinsic parameters but also the intrinsic parameters of both IMU and LiDAR sensors, while enforcing observability constraints during update to address possible degeneracy. Specifically, two observability-aware strategies are employed: (i) the informative data segment selection, and (ii) the observability-aware update in back-end optimization. The former selects the most informative data segments automatically for calibration among the long-session data sequence, which lowers the computational consumption for calibration as well as helps non-expert end users. The latter addresses the degenerate motions via truncated SVD (TSVD) that is used to update only the observable directions of the sensing parameters. The proposed method has been extensively validated on both Monte-Carlo simulations and real-world experiments, showing that the proposed OA-LICalib is able to provide accurate spatial-temporal extrinsic and intrinsic calibration with high repeatability, even under certain degenerate cases. } For future work, the active calibration guiding users to collect informative data deserves to be investigated. \section*{Acknowledgments} This work is supported by a Grant from the National Natural Science Foundation of China (No. U21A20484) and Huang was partially supported by the University of Delaware College of Engineering.
\section{} The clustering of dark matter halos depends on the assembly history of halos at fixed halo mass; a phenomenon referred to as \textit{halo assembly bias}. Halo assembly bias is readily observed in cosmological simulations of dark matter. However, it is difficult to detect it in observations. The identification of galaxy or cluster properties correlated with the formation time of the halo at fixed halo mass and the ability to select galaxy clusters free from projection effects are the two most significant hurdles in the observational detection of halo assembly bias. The latter, in particular, can cause a misleading detection of halo assembly bias by boosting the amplitude of lensing and clustering on large scales. This study uses twelve different properties of central galaxies of SDSS redMaPPer clusters derived from spectroscopy to divide the clusters into sub-samples. We test the dependence of the clustering amplitude on these properties at fixed richness. We first infer halo mass and bias using weak lensing signals around the clusters using shapes of galaxies from the SDSS survey. We validate the bias difference between the two subsamples using cluster-galaxy cross-correlations. This methodology allows us to decouple the contamination due to the projection effects from the halo assembly bias signals. We do not find any significant evidence of a difference in the clustering amplitudes correlated with any of our explored properties. Our results indicate that central galaxy properties may not correlate significantly with the halo assembly histories at fixed richness. \fontsize{8}{11}\helveticabold { \section{Keywords:} the large-scale structure of Universe -- cosmology: theory -- cosmology: observation} \end{abstract} \section{Introduction} In the cold dark matter (CDM) paradigm, massive cluster-sized halos form at rare peaks in the initial density field. Such massive halos are biased tracers of the matter density and cluster more strongly than the underlying matter distribution. The spatial distribution of dark matter halos primarily depends upon the halo mass \citep[e.g.,][]{Kaiser1984, Efstathiou1988, MoWhite1996}. However, there have been several studies that show that the clustering of halos at fixed halo mass can further depend upon secondary properties related to their assembly history \citep[e.g.,][]{gao_etal05, wechsler06, gao_white07, faltenbacher_white10, dalal_etal08}. This dependence of the halo clustering amplitude on secondary properties other than the halo mass is commonly referred to as \textit{halo assembly bias}, and can be traced back to the fact that halos of the same mass in different environments have different assembly histories and cluster differently. Having different assembly histories also affects the internal structure of halos \citep{bullock01,wechsler02,hahn_etal07,faltenbacher_white10}. This, in turn, results in a clustering dependence on the structural properties of a halo such as concentration. Even though halo assembly bias is sensitive to the specific definition of the property considered and can vary with halo mass \citep[e.g.,][]{Mao_etal2018} , several studies reveal that the low-concentration halos, which are the late-forming halos, cluster more strongly than the high-concentration halos at massive end \citep[e.g.,][]{dalal_etal08}. Since the halo assembly bias is a well-known phenomenon in simulations and has been studied extensively, several groups have attempted an observational detection of halo assembly bias with galaxies or galaxy groups, but they were inconclusive \citep[e.g.,][]{yang_etal06a, wang_etal13, Dvornik_etal2017, Niemiec_etal2018} or controversial \citep{Lin2016}. The difficulty of detecting halo assembly bias arises from the search for observational proxies of the halo mass and the formation time of halos due to our inability to measure the structure and mass of individual halos directly. There are mainly two approaches used to define such proxies. One is to use the spatial distribution of member galaxies in groups and clusters, while another is to use the properties of central galaxies in groups/clusters. On galaxy cluster scales, \citet{Miyatake2016} and \citet{More2016} claimed evidence of halo assembly bias using the optically selected redMaPPer galaxy cluster catalogue \citep{Rykoff_etal2014}. They split the cluster sample based on the richness (i.e., the number counts weighted by their membership probabilities) as a proxy of halo mass and the compactness of member galaxies in the clusters as a proxy of halo concentration. They used weak gravitational lensing to confirm that the halo masses of these cluster subsamples were consistent with each other, and yet the clustering amplitudes were significantly different. The difference in the clustering amplitude of the two subsamples was almost $60\%$, much larger than the difference expected from N-body simulations. Because the detected signal was significantly larger than the signal expected from simulations, several studies investigated the cause of this significant signal \citep{Zu2017, BuschWhite2017, SunayamaMore2019}. All these studies concluded that the signal detected in \citet{Miyatake2016} and \citet{More2016} is likely a result of projection effects, where interloper galaxies along the line of sight to a cluster are mistaken as genuine members of the cluster. The compactness of member galaxies, which was used as a proxy of concentration, was strongly correlated with the fraction of interloper galaxies. Therefore, using member galaxies in optically selected galaxy clusters to define the proxies of halo mass and formation time inevitably suffers from optical projection effects. Using only central galaxies to detect the halo assembly bias is another way to avoid misidentifying member galaxies and the resulting contamination from the projection effects. \citet{Lin2016} used the galaxy group catalog from \citet{yang_etal06a}. They used the stellar mass and the specific star formation rate of central galaxies as proxies of halo mass and formation time, respectively. They split central galaxies into two subsamples such that they have equal distribution in stellar masses but different specific star formation rates. However, they attribute the difference in the clustering amplitude of the two subsamples to the halo mass difference of the subsamples using weak gravitational lensing measurements. Therefore, they do not claim evidence for the detection of halo assembly bias. Recently, \citet{Zu_etal2021} investigated the origin of the scatter in the stellar-to-halo mass relation (SHMR) of the redMaPPer clusters and found possible evidence of halo assembly bias. They first derived photometric stellar masses for all the brightest central galaxies (BCGs) in the redMaPPer cluster catalogue. They then split the sample into two subsamples based on their richness and stellar masses. The two subsamples were confirmed to have equal weak lensing halo masses but different concentrations and clustering amplitudes. The difference in the clustering amplitudes was about 10\%, albeit with a significant error, which is consistent with the size of cluster-sized halo assembly bias predicted from the simulations. Their result implies that the scatter in the stellar mass of the BCGs at fixed halo mass could be closely related to the halo concentration and the cosmic overdensities on large scales. One caveat in this analysis is that they did not investigate the possible contamination from the projection effects, which can bias the measurement of the clustering amplitude like \citet{Miyatake2016} and \citet{More2016}. This biased measurement is a result of preferential selection of halos with filaments aligned along the line-of-sight (LOS) \citep{Sunayama_etal2020}. In other words, the projection effects cause anisotropies in the large-scale structure distribution around optically selected clusters and boost the amplitude of cluster lensing and clustering signals on large scales. Cluster-galaxy cross-correlations can be used to measure these anisotropies in the large-scale structure. However, \citet{Zu_etal2021} use photometric redshifts of BCGs to infer stellar masses. 21\% of the BCGs in their sample do not have spectroscopic redshifts and these BCGs without $z_{\rm spec}$ mostly have a stellar-mass below $10^{11}h^{-2}{\rm M_{\odot}}$ and some of them have above $3\times10^{11}h^{-2}{\rm M_{\odot}}$ \citep{Zu2020}. Including more low stellar mass BCGs implies more low-mass halos, whose richness could be affected by projection effects. The motivation of this study is to investigate further the possible correlation between central galaxy properties and the assembly history of halos in clusters while decoupling the physical correlation and the projection effects. To do so, we only use the redMaPPer clusters with spectroscopic redshifts. We will also discuss possible systematic biases due to spectroscopic incompleteness. This paper is organized in the following manner. Section 2 describes the cluster and galaxy catalogues we use in our analysis. Section 3 presents the computation of cluster-galaxy cross-correlation functions and weak lensing measurements and the Bayesian inference methods to infer halo mass from the weak lensing measurements. We present our main results in Section 4 and conclude in Section 5. \section{Data} We use the redMaPPer cluster catalogue \citep{Rykoff_etal2014} derived from the Sloan Digital Sky Survey (SDSS) Data Release 8 (DR8) photometric galaxy catalogue \citep{Aihara_etal2011} and cross-match the central galaxies to the Wisconsin PCA-based value-added galaxy catalogue \citep{Chen_etal2012} to obtain galaxy properties for the central galaxies of the redMaPPer clusters. Also, we use the BOSS DR12 LOWZ sample to compute the cluster-galaxy cross-correlation functions. \label{sec:data} \subsection{redMaPPer galaxy clusters} \begin{table} \centering \caption{List of central galaxy properties used to find the correlation with halo assembly history.} \label{tab:parameter} \scalebox{0.85}{ \begin{tabular}{cc} \hline\hline Parameter & Description \\ \hline ${\rm D}_{n}4000$ & the 4000$\text{\normalfont\AA}$ break strength\\ $H{\delta}_{A}$ & the strength of Balmer absorption line\\ $M_{*}/L$ & estimates of stellar mass-to-light ratio\\ age & the r-band luminosity-weighted age\\ $\mu \times \tau$ & the dust parameters $\mu$ and $\tau$\\ $\sigma_v$ & the stellar velocity dispersion\\ $\Gamma_F$ & fraction of stars formed in recent bursts \\ $Z$ & metallicity \\ $R_{{\rm deV},r}$ & de Vaucouleurs fit scale radius in $r$ band\\ $(a/b)_{{\rm deV},r}$ & de Vaucouleurs fit a/b in $r$ band\\ $\phi_{{\rm deV},r}$ & de Vaucouleurs fit position angle in $r$ band\\ $M_{*}$ & stellar mass\\ \hline \hline \end{tabular}} \end{table} The red-sequence Matched-filter Probabilistic Percolation (redMaPPer) cluster finding algorithm was developed by \citet{Rykoff_etal2014} to identify galaxy clusters using red-sequence galaxies in optical imaging surveys \citep{Rykoff_etal2014, Rozo2014, Rozo2015, Rozo2015_2}. We use the redMaPPer galaxy cluster catalogue version 5.10 derived from the SDSS DR8 photometric galaxy catalogue \citep{Aihara_etal2011}. The redMaPPer algorithm assigns redshift and richness, the number count of red galaxies weighted by their cluster membership probabilities. We choose galaxy clusters with richness $20\leq\lambda\leq200$ at $0.1 \leq z \leq 0.33$. This selection ensures that the redMaPPer cluster catalog is approximately volume-complete. We limit ourselves to using the clusters whose central galaxies have a measured spectroscopic redshift and thus avoid uncertainties due to photometric redshift in the measurement of cluster lensing and clustering as well as to quantify the possible contamination by optical projection effects. In total, we have 7637 clusters which pass these cuts, while there are 1040 clusters without spectroscopic redshifts, merely $12\%$ of all the sample. \footnote{In the original redMaPPer catalogue, there are 2009 central galaxies which do not have spectroscopic redshift. These galaxies correspond to $23\%$ of all the clusters. To increase the number of the central galaxies with spectroscopic redshift, we carried out a further cross-match of the redMaPPer central galaxies to those in the SDSS DR17 catalogue. We thus obtain another 969 central galaxies with spectroscopic redshift.} \begin{figure} \centering \includegraphics[width=0.45\textwidth]{sample_cut.png} \caption{\label{fig:mcut} We select redMaPPer clusters whose absolute magnitude is $M_{i}<-22.4$.} \end{figure} \cite{Zu2020} point out the spectroscopic incompleteness of the redMaPPer central galaxies -- the clusters without spectroscopic redshift are either the lowest or the highest stellar mass galaxies at fixed richness. To avoid such incompleteness, we decided to select further our cluster sample based on the absolute magnitude of the central galaxies. Fig.~\ref{fig:mcut} shows the detection fraction of the redMaPPer central galaxies by the spectroscopic observation as a function of $i$ band absolute magnitude $M_{i}$. As is consistent with Fig. 2 in \cite{Zu2020}, Fig.~\ref{fig:mcut} shows the declines towards zero at both ends of $M_{i}$. The cut-off at the high end of absolute magnitude is relatively sharp and happens at $M_{i}\sim -22.4$. To make sure that our cluster sample does not suffer from spectroscopic incompleteness, we only use the central galaxies whose absolute magnitude is $M_{i}\leq-22.4$. With this absolute magnitude cut, we lose another 4.5 per cent of the clusters, resulting in a sample of 7287 clusters we use in this study. \footnote{We repeat the same analysis for the $M_*$-split subsamples without imposing the luminosity cut, and we did not find any significant changes in the result (see Appendix~\ref{app:no_lum}).} To detect the halo assembly bias effect from the galaxy cluster sample, we need to split the sample into subsamples and find evidence for a dependence of the large scale clustering amplitude on any secondary property other than the halo mass. We match the most probable central galaxy of the redMaPPer clusters to the galaxies in the Wisconsin PCA-based value-added galaxy catalogue \citep{Chen_etal2012}. The value-added catalogue provides the values of each of the PCA coefficients, and we map these coefficients to 12 physical parameters based on the results of \citet{Chen_etal2012}. We list the corresponding physical parameters in Table~\ref{tab:parameter}, and we will use them as a proxy for concentration/formation time. This paper aims to find parameters that exhibit the assembly bias effect. We use ten equally spaced bins both in redshift and richness to obtain the median value of the chosen parameter X. We use a spline fit for the median of $X$ as a function of redshift and richness. Based on this fit, we define the two subsamples as "large-$X$ clusters" with $X>\overline{X}(z,\lambda)$ and "small-$X$ clusters" with $X<\overline{X}(z,\lambda)$. This selection makes sure that the two cluster subsamples have the same richness and redshift distributions. We use the random catalogues corresponding to the redMaPPer cluster catalogue for the clustering and weak lensing measurements. These catalogues contain corresponding position information, redshift, richness, and a weight for each random cluster. \subsection{BOSS DR12 LOWZ sample} We will cross-correlation of the redMaPPer galaxy clusters with spectroscopic galaxies to study halo assembly bias. We use the spectroscopic galaxies in the large-scale structure catalogues constructed from SDSS DR12 (\citet{Alam2015}). In particular, we will use the LOWZ sample since it has considerable overlap in the redshift range with our galaxy cluster sample. We restrict ourselves to LOWZ galaxies with redshifts between $0.1<z<0.33$, the same redshift range as our galaxy clusters. The galaxy catalogue also comes with associated random galaxy catalogues that we use to perform our cross-correlation analysis. \section{Methods} \subsection{Detecting Halo Assembly Bias Without Projection Effects} \label{sec:method:basic} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{fig1.png} \caption{\label{fig:logic1} The logic to detect halo assembly bias often used in other studies.} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{fig2.png} \caption{\label{fig:logic2} The logic to detect halo assembly bias by decoupling from the projection effects.} \end{figure} We take a two-step approach to detect halo assembly bias using cluster subsamples - i) we confirm that the difference in the biases is not due to halo mass differences in the subdivided samples, or, ii) arising due to contamination of the cluster subsamples due to LOS projection effects. We use the weak gravitational lensing signal to measure the halo mass for two cluster subsamples split based on the parameter $X$. Although the weak lensing signal can also be used to infer the large scale bias of the cluster subsamples, the weak lensing signal (or the cluster-cluster auto-correlation) has a lower signal-to-noise ratio than the cross-correlation of the cluster subsamples with galaxies. Therefore we use the galaxy cluster-galaxy cross-correlation to detect the halo biases of the two sub-samples. Fig.~\ref{fig:logic1} shows the simple logical flow used in previous studies to detect halo assembly bias. If the two subsamples have equal halo masses but have different halo biases, it is typically considered evidence favouring halo assembly bias. However, this test on its own does not guarantee that the observed bias difference between the two sub-samples could be due to projection effects \citep[e.g.,][]{Miyatake2016}. To decouple the bias difference caused by the projection effects from the halo assembly bias, we instead use the logical flow described in Fig.~\ref{fig:logic2}. The first step in this revised logical flow is the same as that shown in Fig.~\ref{fig:logic1}: measure the halo masses of the two subsamples from lensing and the bias from cross-correlations. However, our new logical flow includes an extra check. We compute the cluster-galaxy projected cross-correlations with two different integration limits $\pi_{\rm max,1}$ and $\pi_{\rm max,2}$. The projected cross-correlation function is given by, \begin{equation} w_{\rm p,cg}(R, \pi_{\rm max}) = 2\int_{0}^{\pi_{\rm max}}\xi_{\rm cg}(R, \pi) d\pi\,. \end{equation} In the absence of any projection effects, or redshift space distortions, the quantity $\xi_{\rm cg}(R, \pi)$ in the above equation would be equal to the 3-dimensional cross-correlation $\xi_{\rm cg}\left[(R^2+\pi^2)^{1/2}\right] \propto b_{\rm c}b_{\rm g}$. The ratio of the cross-correlations of galaxies with the two cluster subsamples will be equal to $b_{\rm c1}/b_{\rm c2}$. Redshift space distortions ought to cancel out in the limit that $\pi_{\rm max}\rightarrow \infty$. However as pointed out in \citet{vdBosch_etal2013}, the finite integration length can result in residual redshift space distortions in a scale dependent manner. For $R/\pi_{\rm max}\leq 1$, the residual RSDs are small, while these corrections become larger on scales $R/\pi_{\rm max}\sim 1$. By using the formalism in \citet{vdBosch_etal2013}, and using fiducial bias ratios $3$ and $2.5$, we have computed the effect of the residual redshift space distortions on the ratio of the biases for $\pi_{\rm max}=[50, 100] h^{-1}{\rm Mpc}$. Such residual redshift space distortions can cause a scaled dependent bias ratio but within $\sim 2$ percent, which is much smaller than our errors. Projection effects in the sample selection can cause an anisotropic distribution of matter/galaxies around clusters \citep{BuschWhite2017, SunayamaMore2019, Sunayama_etal2020, Park_etal2021}. Such projection effects can lead to differences between the structure of the correlation function in redshift space. This anisotropic distribution lead to projected cluster-galaxy cross-correlations that depend upon the LOS integration length scale \citep{Sunayama_etal2020}. Differences in projection effects can amplify the inferred bias ratios of the cluster subsamples, when smaller projection lengths ($\pi_{\rm max}=50 h^{-1}{\rm Mpc}$ versus $100h^{-1}{\rm Mpc}$) are used compared to larger ones. Ignoring residual redshift space distortions, in the presence of projection effects, \begin{align} w_{\rm p,cg}(R,\pi_{\rm max})=[1+\Pi(\pi_{\rm max})]w_{\rm iso,cg}(R) \label{eq:inertia} \end{align} where $\Pi$ is the anisotropic enhancement of the clustering amplitude, and $w_{\rm iso, cg}(R)$ is the expected projected cross-correlation function of galaxies and clusters, in the absence of any projection effects that correlated with the property used for subsample selection. This $\Pi(\pi_{\rm max})$ can be modeled as constantly increasing function of $\pi_{\rm max}$ \citep{Park_etal2021}. If one cluster subsample is heavily affected by the projection effects (denote as "sample1") but not the other (denote as "sample2"), then the bias ratio between these two subsamples will show a strong dependence on the choice of the integral scale such as \begin{align} \frac{b_{\rm sample1}}{b_{\rm sample2}}(\pi_{\rm max})=(1+\Pi_{\rm sample1}(\pi_{\rm max}))\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}, \label{eq:inertia} \end{align} where $b_{\rm sample,iso}$ is an expected bias for the case of isotropically distributed clusters with the same halo masses and $b_{\rm sample2}=b_{\rm sample2,iso}$. If two cluster subsamples are equally affected by the projection effects, the effects will be canceled out such as \begin{align} \frac{b_{\rm sample1}}{b_{\rm sample2}}(\pi_{\rm max})=\frac{(1+\Pi_{\rm sample1}(\pi_{\rm max}))}{(1+\Pi_{\rm sample2}(\pi_{\rm max}))}\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}=\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}, \label{eq:inertia} \end{align} if $\Pi_{\rm sample1}(\pi_{\rm max})=\Pi_{\rm sample2}(\pi_{\rm max})$. Therefore, we study the dependence of the bias ratio. We will use any statistically significant dependence of the bias difference on the choice of the integral scale $\pi_{\rm max}$ to flag projection effects. If such a dependence is not found, a difference in the halo bias between two subsamples at fixed weak lensing halo mass can be construed as evidence of halo assembly bias. \subsection{Galaxy-Galaxy Lensing Measurements} \label{sec:lensing} Weak gravitational lensing provides a way to infer the mean halo masses of galaxy clusters and bias on large scales. The excess surface mass density profile $\Delta\!\Sigma$, which is a direct observable of cluster lensing, is given by \begin{align} \Delta\! \Sigma(R)&\equiv \avrg{\Sigma}\!(<R)-\Sigma(R)\nonumber\\ &= \frac{2}{R^2} \int_0^R\! \mathrm{d}R' R' \Sigma(R') - \Sigma(R), \label{eq:DeltaSigma} \end{align} where $\avrg{\Sigma_i}\!(<R)$ and $\Sigma_{i}(R)$ denote the average surface mass density within a circle of radius $R$ and the surface mass density at $R$ respectively. The surface mass density $\Sigma_{i}(R)$ is computed from the halo-mass cross correlation function $\xi_{\rm cm}(r)$, \begin{align} \Sigma(R)=\bar{\rho}_{\rm m0}\int_{-\infty}^{\infty}\!\!\mathrm{d}\pi~ \left[1+\xi_{\rm cm}\!\left(\sqrt{R^2+\pi^2}\right)\right], \label{eq:Sigma} \end{align} where $\bar{\rho}_{\rm m0}$ is the mean matter density today, $\pi$ and $R$ are the separations parallel and perpendicular to the LOS direction from the cluster center, respectively. To compute the weak lensing signal for our cluster sample, we follow the methodology described in \citet{Mandelbaum_etal2013} and \citet{Miyatake2016}. We use the shape catalogue of \citet{Reyes_etal2012} which is based on the photometric galaxy catalogue from the SDSS DR8. The shape measurements were calibrated using detailed image simulations \citep[see][for details]{mandelbaum_etal2012}. The galaxy shapes are measured by the re-Gaussianization technique \citep{hirata_seljak03}. \citet{mandelbaum05} extensively investigate the systematic uncertainties in the shape measurements of SDSS galaxies. The redshift of source galaxies is estimated based on the photo-$z$ code ZEBRA \citep{Feldmann2006, Nakajima_etal2012}. We measure the average projected mass density profile $\Delta \Sigma(R)$ as \begin{equation} \Delta \Sigma(R)=\frac{\Sigma_{ls} w_{ls} e_{t,ls}\left<\Sigma_{\rm crit}^{-1}\right>_{ls}^{-1}}{(1+\hat{m}(R))\Sigma_{ls} w_{ls}}, \end{equation} where the summation runs over all the lens-source pairs separated by R and the subscript "$l$" and "$s$" represent lens and source galaxies, respectively. $e_{t,ls}$ is tangential components of ellipticities and $w_{ls}$ is given by \begin{equation} w_{ls} = w_l w_s \left<\Sigma_{\rm crit}^{-1}\right>_{ls}^{2}, \end{equation} where $w_l$ and $w_s$ are the weight given by the redMaPPer cluster catalog and the source catalog, respectively. The overall factor $(1+\hat{m}(R))$ is to correct for a multiplicative shear bias \citep{miller12} and is computed as an average of the lens-source pairs at a distance $R$. To measure the lensing signal accurately, we apply several corrections to remove the residual systematics. The first of such correction corresponds to the photometric redshift bias following Eqn. 5 in \cite{mandelbaum08a}. When $z_l$ and $z_s$ are photometric redshifts, the measured critical surface density $\Sigma_{\rm crit}$ is biased such as \begin{equation} 1+b_z(z_l) =\frac{\Delta \Sigma}{\tilde{\Delta \Sigma}}=\frac{\Sigma_{s} w_{ls} \Sigma_{\rm{crit},ls} \tilde{\Sigma}_{\rm{crit},ls}^{-1}}{\Sigma_{s} w_{ls}}, \end{equation} where $\tilde{\Sigma}_{\rm{crit},ls}$ is the true critical surface mass density measured by \cite{Nakajima_etal2012} for which we used spectroscopic redshifts for source galaxies. This quantity $1+b_z$ is a function of lens redshift $z_l$. We measured the photo-$z$ bias as a function of lens redshift and computed an average photo-$z$ bias for the redMaPPer clusters. The average value of the bias parameter over the redshift range of our lensing sample is about $8.3\%$. We divide the measured lensing signal by $1+b_z$. The second is a dilution of the lensing signal due to source galaxies which are physically associated with the lens galaxy and can be corrected by a boost factor $B(R)$ given by \begin{equation} B(R)=\frac{\sum_i w_r}{\sum_i w_l} \frac{\Sigma_{ls} w_l w_s}{\Sigma_{rs} w_r w_s}, \end{equation} where the superscript “$r$” stands for random catalogs and $w_r$ is the weight of the random provided by the catalog. If there is no physical correlation between lens and source galaxies, $B(R)=1$. The boost factor $B(R)$ deviates from 1 on small scales but converges to 1 on large scales. By multiplying the measured signal by the boost factor, it corrects for the dilution of the signal. The third is a possible residual systematic in the shape measurements due to imperfect optical distortion corrections across the field of view. If we measure the lensing signal around the random points, we should not detect any coherent tangential distortions. Any coherent tangential distortion around the randoms arises due to imperfect corrections that translate into systematics in the shape measurements. We correct for such effects by subtracting the lensing signal around the randoms from that around the lenses. We perform halo model fits to the measurements of the weak lensing signal of each cluster subsample. To model $\Delta\! \Sigma(R)$, we use a halo model assuming NFW profile with the off-centering effect. We use a five parameter model to the weak lensing signal following \cite{Miyatake2016}, \begin{align} \Delta\! \Sigma(R; M_{\rm 200m}, c_{\rm 200m}, q_{\rm cen},\alpha_{\rm off},b)\nonumber\\ = q_{\rm cen} \Delta\! \Sigma^{\rm NFW}(R;M_{\rm 200m},c_{\rm 200m},\alpha_{\rm off})\nonumber\\ +(1-q_{\rm cen})\Delta\! \Sigma^{\rm NFW,off}(R;M_{\rm 200m},c_{\rm 200m},\alpha_{\rm off}) \nonumber\\ +\Delta\! \Sigma^{*}(R;M_{*})+\Delta\! \Sigma^{\rm 2-halo}(R;b). \label{eq:dSigma_model} \end{align} The first term is the halo mass profile for the clusters whose centre is correctly identified, while the second term is the halo mass profile for these clusters whose centres are misidentified. The parameter $1-q_{\rm cen}$ represents the fraction of the off-centring clusters, and $\alpha_{\rm off}$ describes the ratio of the three-dimensional off-centring radius to $R_{\rm 200m}$. The normalized profile of the off-centering clusters with respect to their true center is given by $u_{\rm off}(r) \propto \exp[-r^2/(2\alpha_{\rm off}^2 R_{\rm 200m}^2)]$. Note that we truncate the off-centring profile to zero at $r>R_{\rm 200m}$. The third term models a stellar-mass contribution from the central galaxies assuming a point mass, and we use the mean value of $M_{*}$ in the cluster subsamples. The fourth term models the lensing contribution from two-point correlation functions between the clusters and the mass distribution around the clusters, which is given by \begin{align} \Delta\! \Sigma^{\rm 2-halo}(R)=b \int k dk/(2\pi) \bar{\rho}_{\rm m0} P_{\rm m}^{\rm L}(k,z_{\rm cl})J_2(kR), \label{eq:two-halo} \end{align} where $b$ is a linear galaxy bias, $P_{\rm m}^{\rm L}$ is the linear matter power spectrum and $J_2(x)$ is the second-order Bessel function. We perform Bayesian parameter inferences using the likelihoods with the measured lensing signal and the model prediction as in Eqn.~\ref{eq:dSigma_model} to obtain the posterior distribution of the parameters. To do that, we use the affine invariant Monte Carlo Markov Chain (MCMC) ensemble sampler \textit{emcee} \citep{emcee}. We use flat priors for all the parameters: $M_{\rm 200m}/[]10^{14}h^{-1}M_\odot \in [0.5,50]$, $c_{\rm 200m} \in [1,10]$, $q_{\rm cen} \in [0.6,1]$, $\alpha_{\rm off} \in [10^{-4},1]$, and $b \in [0,10]$. The background cosmology assumed for the lensing and clustering measurements is based on \textit{Planck} 2018 \cite{Planck2018} under a flat $\Lambda$CDM model: $\Omega_{\rm m}=0.315$ and $\sigma_8=0.811$. \subsection{Correlation function measurements} \label{sec:corr} Once we find the cluster subsamples with equal halo masses but different large scale amplitudes, we examine whether the clustering difference indicates halo assembly bias or is a result of projection effects. We use the cluster-galaxy cross-correlation function to differentiate between these possibilities. The cluster-galaxy cross-correlation function can be computed using the Landy-Szalay estimator \citep{landyszalay93} as, \begin{equation} \xi_{\rm cg}=\frac{\left <D_c D_g \right >-\left <D_g R_c \right >-\left <D_c R_g \right >+\left <R_c R_g \right >}{\left <R_c R_g \right >},\label{eq:landy-szalay} \end{equation} where $\left <DD \right >$,$\left <DR \right >$, and $\left <RR \right >$ are the normalized numbers of pairs for data-data, data-random, and random-random respectively. The subscripts $c$ and $g$ represent the samples of clusters and galaxies. We measure the cluster-galaxy cross-correlation functions $\xi_{cg}$ in two dimensions $(R,\pi)$ where $R$ and $\pi$ are the separations perpendicular to and along the LOS direction. Then, we compute the projected correlation functions by integrating $\xi_{cg}$ along the LOS direction up to the maximum integral scale $\pi_{\rm max}$, \begin{equation} w_{\rm p}(R,\pi_{\rm max})=\int_{0}^{\pi_{\rm max}}d\pi \xi_{\rm cg}(R,\pi)\,.\label{eq:wp_cg} \end{equation} We use $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$. If the bias difference between two subsamples is due to the projection effects, the bias ratios $w^{\rm large}_{\rm p,cg}(R)/w^{\rm small}_{\rm p,cg}(R)$ will have different values for a different choice of $\pi_{\rm max}$. To check this, we compute the ratio of ratio $R=\frac{w^{\rm large}_{\rm p,cg1}}{w^{\rm small}_{\rm p,cg1}}/\frac{w^{\rm large}_{\rm p,cg2}}{w^{\rm small}_{\rm p,cg2}}$, where the subscripts $1$ and $2$ correspond to the used maximum integral scales $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$. If this $R$ is unity, the bias difference between the two subsamples is not likely due to projection effects and therefore signifies evidence for halo assembly bias. \section{Results} \label{sec:results} In this section, we first present our approach to the detection of halo assembly bias for the case of stellar mass $M_*$ in Sec.~\ref{sec:res:mstar} and then we show the results for other parameters listed in Table~\ref{tab:parameter} in Sec.~\ref{sec:res:others}. \subsection{Subsamples divide by BCG stellar mass} \label{sec:res:mstar} \begin{figure}[h!] \centering \includegraphics[width=0.8\textwidth]{lum_mstar.contour.pdf} \caption{\label{fig:triangle_mstar} Posterior constraint from the modelling of $\Delta \Sigma(R)$ for the high-$M_*$ (blue) and low-$M_*$ (green) subsamples. Each histogram in the diagonal panels are the 1D marginalised posterior distribution of the parameters, while each contour plot in the off-diagonal panels indicate the 1$\sigma$ and 2$\sigma$ confidence regions of the matching parameter pairs.} \end{figure} We show the posterior distribution of our model parameters inferred from the measurement of the cluster subsamples divided by high-$M_*$ (blue) and low-$M_*$ (green) of the BCGs in Fig.~\ref{fig:triangle_mstar}. The diagonal panels show the marginalized posterior distributions for the five parameters used in the model, while the off-diagonal panels are the 1$\sigma$ and 2$\sigma$ credible regions for the parameter combinations. The mean halo masses of the high-$M_*$ and low-$M_*$ subsamples are ${\rm log}_{10} M_h^{\rm high}=14.30 \pm 0.03 h^{-1}M_\odot$ and ${\rm log}_{10} M_h^{\rm low}=14.28 \pm 0.03 h^{-1}M_\odot$, respectively. At fixed $\lambda$, the result implies that the two stellar mass BCG subsamples reside in halos of similar masses at fixed richness \citep{Zu_etal2021, Zu_etal2022}. The measured halo bias ratio from lensing signals is $b_{\rm high}/b_{\rm low}=1.20\pm 0.12$, while the expected halo bias ratio based on the measured halo masses using \textit{Colossus} is $b_{\rm high}/b_{\rm low}= 1.04 \pm 0.03$ The measured bias ratio is consistent with the expected bias ratio based on the estimate of the halo masses, implying that this does not constitute substantial evidence of halo assembly bias. On careful inspection, this seems consistent with the results shown in Fig.~4 of \cite{Zu_etal2021}; within the errors, the mass and bias differences between the two subsamples are consistent. \cite{Zu_etal2021} further show that the cross-correlation between SDSS photometric galaxies and the cluster subsamples shows a difference in clustering of order $10\%$. On the other hand, the cross-correlation with spectroscopic galaxies gives a noisy result. Given the larger errors, we cannot entirely rule out such a difference. We do not, however, see consistent differences in the inferred posteriors of concentration and bias (contrast the second panel in the bottom row of Fig.~\ref{fig:triangle_mstar} with the bias-concentration subpanel in Fig. 4 of \citet{Zu_etal2021}). One of the differences between our sample selection and that of \cite{Zu_etal2021} is that they use all redMaPPer clusters with $\lambda \geq 20$ at $0.17 <z< 0.3$, while we limit ourselves to the clusters with spectroscopic redshift and with $M_i \leq -22.4$. As we would like to test for projection effects, we do not conduct a cross-correlation analysis with photometric galaxies where we cannot test for projections. \footnote{We tested a similar cluster sample selection as is \cite{Zu_etal2021}. We select redMaPPer clusters at $0.17 \leq z_{\lambda} \leq 0.3$ with richness $\lambda \geq 20$ and the luminosity cut of $M_i \leq -22.4$ and repeat the analysis. We obtained a similar result that low-$M_*$ subsample has a lower value of concentration and with similar halo masses and halo biases.} While the fractions of centered clusters $q_{\rm cen}$ are consistent with the fraction of the clusters with the centering probability $p_{\rm cen} \geq 0.8$, which is roughly $\sim 76\%$, our results show a degeneracy between the concentration parameter $c$ and the off-centering kernel size $\alpha_{\rm off}$. The degeneracy results in $c^{\rm high}=5.31 \pm 1.01$ and $c^{\rm low}=3.28 \pm 0.60$. The expected values of concentration using the model by \cite{diemer_joyce2019} from \textit{Colossus} are $c^{\rm high}=4.94 \pm 0.02$ and $c^{\rm low}=4.98 \pm 0.03$. Since the low-$M_*$ subsample contains more low-mass clusters, $c^{\rm low}$ is expected to be slightly larger than $c^{\rm high}$. The cause of this opposite result can be a degeneracy with the off-centring parameter $\alpha_{\rm off}$. To suppress the contribution from the off-centred clusters, we select the redMaPPer clusters whose central probability $p_{\rm cen}$ is larger than 0.9 and repeat the same analysis. \footnote{Posterior constraints of the model parameters for the cluster subsamples with $p_{\rm cen}\geq0.9$ are in Appendix~\ref{app:pcen}.} While we do see the increase of $q_{\rm cen}$ to $0.95^{+0.04}_{-0.03}$ for both subsamples (i.e., decrease in the fraction of the off-centered clusters) and the shift of the off-centering location $\alpha^{\rm high}_{\rm off}=0.55^{+0.31}_{-0.35}$ and $\alpha^{\rm low}_{\rm off}=0.51^{+0.34}_{-0.34}$, we do not see significant changes in concentration, $c_{\rm high}=4.91^{+0.50}_{-0.45}$ and $c_{\rm low}=3.57^{+0.45}_{-0.41}$. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{wp_mstar.pdf} \caption{\label{fig:ror_mstar} Top: Cluster-galaxy projected cross-correlation functions integrated up to $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ for the high/low-$M_*$ subsamples. Middle:The ratio $w_{\rm p,cg}^{\rm high}(R)$ and $w_{\rm p,cg}^{\rm low}(R)$ computed with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ (blue dash-dot) and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ (orange solid). Bottom: The ratio of $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ at $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ denoted as $R$ which is defined in Sec.~\ref{sec:corr}.} \end{figure} To examine whether the $M_*$-split subsamples are affected unevenly by projection effects, we compute the cluster-galaxy projected cross-correlation functions $w_{\rm p,cg}(R)$ with different LOS integral lengths $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$, respectively. The bottom panel of Fig.~\ref{fig:ror_mstar} shows the ratio of $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ at $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$ denoted as $R$. If this ratio is one, the bias difference between the subsamples is less likely to result from projection effects. However, Fig.~\ref{fig:ror_mstar} shows $1\sigma$ deviation from unity, which is $1.09 \pm 0.09$ on $10h^{-1}{\rm Mpc} \leq R \leq 30 h^{-1}{\rm Mpc}$. This result implies that the high/low-$M_*$ subsamples are likely affected differently by projection effects. The middle panel of Fig.~\ref{fig:ror_mstar} shows the ratio $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ (blue dashed-dot) and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ (orange solid). While the ratio with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ is almost one, the ratio with $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ is $0.94 \pm 0.11$. This is opposite of the bias ratio from lensing ($1.20 \pm 0.12$) and is consistent with the result of \cite{Zu_etal2021} that the low-$M_*$ subsample has a larger bias. However, we must note that the $R$ value and the bias ratios measured with two different integral lengths are all unity within $~1\sigma$ and therefore the projection effects contaminate the bias measurements only mildly. However, as we see hints of subsamples affected by projection with the cross-correlation with spectroscopic data, we do not further explore cross-correlations with photometric galaxies. \subsection{Subsamples based on other parameters} \label{sec:res:others} This section presents the results obtained from the cluster subsamples split based on other parameters. The posterior distributions of the model parameters for all the subsamples are summarized in Table~\ref{tab:result_flat}. Fig.~\ref{fig:bias} shows the ratio of the biases of the two subsamples split by different properties. The blue symbols correspond to the theoretical expectation of the ratio of biases given the constraint on halo masses from weak lensing. The orange and green symbols correspond to bias ratios obtained from cluster weak lensing and cross-correlation with spectroscopic galaxies, respectively. The signal-to-noise ratio of the weak lensing signal is smaller than that of the cross-correlation. Therefore, we primarily compare the green symbols with the blue ones. Overall we see reasonably good agreement between the bias ratios obtained from cross-correlation and that expected from the theoretical expectations, with differences between the two always less than 3$\sigma$. We make some further observations about these results below. \begin{table} \centering \caption{Posterior constraints of the model parameters for the subsamples split on various central galaxy properties listed in Table~\ref{tab:parameter}. The uncertainties are the 1$\sigma$ confidence regions derived from the 1D posterior probability distributions. For these analysis, we use flat priors for all the parameters.} \label{tab:result_flat} \scalebox{0.85}{ \begin{tabular}{ccccccc} \hline\hline Subsample & $M_h[10^{14}h^{-1}M_\odot]$ & $c$ & $b$ & $q_{\rm cen}$ & $\alpha_{\rm off}$ & $\chi^2$(dof=15)\\ \hline high-$D_n 4000$ & $1.89^{+0.16}_{-0.14}$ & $4.33^{+0.93}_{-0.68}$ & $2.04^{+0.30}_{-0.30}$ & $0.83^{+0.11}_{-0.12}$ & $0.55^{+0.30}_{-0.34}$ & $11.39$ \\ low-$D_n 4000$ & $1.90^{+0.11}_{-0.11}$ & $4.69^{+0.70}_{-0.52}$ & $2.96^{+0.30}_{-0.30}$ & $0.76^{+0.18}_{-0.12}$ & $0.10^{+0.27}_{-0.04}$ & $13.97$ \\ \hline high-$H_{\delta}A$ & $2.04^{+0.13}_{-0.12}$ & $4.17^{+0.78}_{-0.49}$ & $2.83^{+0.35}_{-0.36}$ & $0.83^{+0.12}_{-0.16}$ & $0.17^{+0.40}_{-0.11}$ & $12.59$ \\ low-$H_{\delta}A$ & $1.83^{+0.15}_{-0.13}$ & $4.84^{+0.92}_{-0.70}$ & $2.36^{+0.25}_{-0.24}$ & $0.85^{+0.10}_{-0.11}$ & $0.61^{+0.27}_{-0.36}$ & $27.33$ \\ \hline high-$M_*/L$ & $1.89^{+0.14}_{-0.13}$ & $4.32^{+0.72}_{-0.54}$ & $3.19^{+0.32}_{-0.32}$ & $0.87^{+0.09}_{-0.15}$ & $0.27^{+0.50}_{-0.22}$ & $18.73$ \\ low-$M_*/L$ & $1.78^{+0.12}_{-0.11}$ & $4.62^{+1.00}_{-0.61}$ & $2.26^{+0.29}_{-0.30}$ & $0.84^{+0.12}_{-0.16}$ & $0.20^{+0.44}_{-0.12}$ & $26.29$ \\ \hline high-age & $1.81^{+0.11}_{-0.10}$ & $5.30^{+0.90}_{-0.64}$ & $1.91^{+0.40}_{-0.39}$ & $0.87^{+0.09}_{-0.14}$ & $0.30^{+0.48}_{-0.23}$ & $14.59$ \\ low-age & $1.91^{+0.14}_{-0.12}$ & $3.52^{+0.60}_{-0.45}$ & $3.19^{+0.29}_{-0.29}$ & $0.85^{+0.10}_{-0.16}$ & $0.25^{+0.51}_{-0.19}$ & $15.76$ \\ \hline high-$\sigma_v$ & $2.07^{+0.14}_{-0.13}$ & $4.95^{+0.89}_{-0.64}$ & $2.13^{+0.31}_{-0.31}$ & $0.86^{+0.09}_{-0.13}$ & $0.34^{+0.44}_{-0.25}$ & $16.75$ \\ low-$\sigma_v$ & $1.79^{+0.12}_{-0.11}$ & $4.39^{+0.85}_{-0.60}$ & $2.85^{+0.30}_{-0.30}$ & $0.86^{+0.10}_{-0.13}$ & $0.45^{+0.37}_{-0.35}$ & $14.09$ \\ \hline high-$\mu \times \tau$ & $2.09^{+0.16}_{-0.14}$ & $4.20^{+0.95}_{-0.61}$ & $2.23^{+0.27}_{-0.28}$ & $0.83^{+0.11}_{-0.13}$ & $0.46^{+0.36}_{-0.32}$ & $18.48$ \\ low-$\mu \times \tau$ & $1.81^{+0.13}_{-0.12}$ & $4.54^{+0.82}_{-0.57}$ & $2.56^{+0.33}_{-0.32}$ & $0.86^{+0.10}_{-0.14}$ & $0.39^{+0.41}_{-0.32}$ & $12.43$ \\ \hline high-$\Gamma_F$ & $2.06^{+0.13}_{-0.12}$ & $3.75^{+0.63}_{-0.44}$ & $3.14^{+0.35}_{-0.35}$ & $0.82^{+0.13}_{-0.15}$ & $0.14^{+0.41}_{-0.08}$ & $16.83$ \\ low-$\Gamma_F$ & $1.76^{+0.12}_{-0.11}$ & $4.98^{+0.88}_{-0.65}$ & $2.16^{+0.29}_{-0.30}$ & $0.87^{+0.09}_{-0.12}$ & $0.47^{+0.36}_{-0.37}$ & $27.09$ \\ \hline high-Z & $1.88^{+0.13}_{-0.12}$ & $3.35^{+0.63}_{-0.43}$ & $2.50^{+0.27}_{-0.27}$ & $0.85^{+0.11}_{-0.15}$ & $0.31^{+0.46}_{-0.24}$ & $13.28$ \\ low-Z & $1.96^{+0.14}_{-0.12}$ & $5.29^{+0.91}_{-0.65}$ & $2.62^{+0.37}_{-0.37}$ & $0.86^{+0.10}_{-0.16}$ & $0.23^{+0.50}_{-0.16}$ & $21.10$ \\ \hline high-$R_{\rm deV,r}$ & $2.19^{+0.15}_{-0.13}$ & $4.97^{+0.86}_{-0.54}$ & $2.29^{+0.34}_{-0.34}$ & $0.87^{+0.09}_{-0.14}$ & $0.32^{+0.43}_{-0.24}$ & $15.24$ \\ low-$R_{\rm deV,r}$ & $1.61^{+0.12}_{-0.11}$ & $3.52^{+0.59}_{-0.46}$ & $2.48^{+0.31}_{-0.31}$ & $0.80^{+0.14}_{-0.15}$ & $0.13^{+0.45}_{-0.07}$ & $8.80$ \\ \hline high-$(a/b)_{\rm deV,r}$ & $2.12^{+0.17}_{-0.15}$ & $3.87^{+0.83}_{-0.57}$ & $2.19^{+0.36}_{-0.36}$ & $0.84^{+0.10}_{-0.12}$ & $0.56^{+0.30}_{-0.36}$ & $8.79$ \\ low-$(a/b)_{\rm deV,r}$ & $1.79^{+0.13}_{-0.12}$ & $5.28^{+0.94}_{-0.62}$ & $2.47^{+0.32}_{-0.31}$ & $0.86^{+0.10}_{-0.15}$ & $0.27^{+0.47}_{-0.19}$ & $11.16$ \\ \hline high-$\phi_{\rm deV,r}$ & $2.10^{+0.16}_{-0.14}$ & $4.46^{+0.94}_{-0.59}$ & $2.34^{+0.32}_{-0.32}$ & $0.86^{+0.10}_{-0.14}$ & $0.36^{+0.41}_{-0.24}$ & $5.36$ \\ low-$\phi_{\rm deV,r}$ & $1.77^{+0.10}_{-0.10}$ & $4.83^{+0.87}_{-0.67}$ & $2.61^{+0.30}_{-0.29}$ & $0.73^{+0.19}_{-0.10}$ & $0.11^{+0.13}_{-0.05}$ & $20.22$ \\ \hline high-$M_*$ & $2.01^{+0.13}_{-0.12}$ & $5.31^{+1.01}_{-0.61}$ & $2.74^{+0.32}_{-0.32}$ & $0.85^{+0.10}_{-0.14}$ & $0.28^{+0.46}_{-0.19}$ & $13.63$ \\ low-$M_*$ & $1.83^{+0.12}_{-0.12}$ & $3.28^{+0.60}_{-0.45}$ & $2.29^{+0.29}_{-0.30}$ & $0.80^{+0.14}_{-0.15}$ & $0.14^{+0.43}_{-0.08}$ & $14.12$ \\ \hline \hline \end{tabular} } \end{table} Among the 12 parameters we tested for splitting the subsamples, ten resulted in halo masses for the subsamples, consistent within 2$\sigma$. The parameters $D_n 4000$ split gives the closest match in the central values of the posterior distribution of masses for the two subsamples with ${\rm log}_{10}M_h^{\rm high}=14.28^{+0.04}_{-0.03} h^{-1}M_\odot$. The ratio of the large scale biases based on lensing is $b_{\rm high}/b_{\rm low}=0.69 \pm 0.12$. We will discuss the case with $D_n 4000$ separately below. The parameter $R_{\rm deV,r}$, the size of the central galaxy in the $r$-band, results in a comparatively large difference in halo masses for the two subsamples. The clusters with larger BCGs at fixed richness result in a subsample with ${\rm log}_{10}M_h^{\rm high}=14.34\pm 0.03 h^{-1}M_\odot$, while that with smaller BCGs have halo mass ${\rm log}_{10}M_h^{\rm low}=14.21 \pm 0.03 h^{-1}M_\odot$. Albeit at smaller significance, this difference is consistent with the recent study by \cite{song_etal2021} that the outer profiles of massive galaxies are sensitive to halo mass even at fixed richness. \begin{table} \centering \caption{Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm Tinker}$ is the predicted halo bias based on halo mass using the Tinker bias model. The columns $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use two different integral scales $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$.} \label{tab:bias} \scalebox{0.85}{ \begin{tabular}{ccccc} \hline\hline Parameter & $b_{\rm Tinker}$ & $b_{\rm lens}$ & $b_{\rm clust}(\pi_{\rm max}=50h^{-1}{\rm Mpc})$ & $b_{\rm clust}(\pi_{\rm max}=100h^{-1}{\rm Mpc})$ \\ \hline $D_n 4000$ & $1.00^{+0.03}_{-0.03}$ & $0.69^{+0.12}_{-0.12}$ & $0.94^{+0.03}_{-0.03}$ & $0.93^{+0.08}_{-0.08}$ \\ $H_{\delta}A$ & $1.05^{+0.03}_{-0.03}$ & $1.20^{+0.12}_{-0.12}$ & $1.02^{+0.10}_{-0.10}$ & $1.05^{+0.12}_{-0.12}$ \\ $M_*/L$ & $1.02^{+0.03}_{-0.03}$ & $1.41^{+0.11}_{-0.11}$ & $0.95^{+0.03}_{-0.03}$ & $1.02^{+0.08}_{-0.08}$ \\ age & $0.98^{+0.03}_{-0.03}$ & $0.60^{+0.13}_{-0.13}$ & $0.97^{+0.04}_{-0.04}$ & $1.03^{+0.09}_{-0.09}$ \\ $\sigma_v$ & $1.06^{+0.03}_{-0.03}$ & $0.75^{+0.12}_{-0.12}$ & $0.98^{+0.05}_{-0.05}$ & $0.94^{+0.04}_{-0.04}$ \\ $\mu \times \tau$ & $1.06^{+0.03}_{-0.03}$ & $0.87^{+0.13}_{-0.13}$ & $1.02^{+0.11}_{-0.11}$ & $0.96^{+0.12}_{-0.12}$ \\ $\Gamma_F$ & $1.07^{+0.03}_{-0.03}$ & $1.45^{+0.12}_{-0.12}$ & $1.01^{+0.03}_{-0.03}$ & $1.04^{+0.05}_{-0.05}$ \\ Z & $0.98^{+0.03}_{-0.03}$ & $0.95^{+0.13}_{-0.13}$ & $1.00^{+0.04}_{-0.04}$ & $1.02^{+0.09}_{-0.09}$ \\ $R_{\rm deV,r}$ & $1.14^{+0.03}_{-0.03}$ & $0.92^{+0.14}_{-0.14}$ & $0.96^{+0.05}_{-0.05}$ & $0.90^{+0.09}_{-0.09}$ \\ $(a/b)_{\rm deV,r}$ & $1.07^{+0.03}_{-0.03}$ & $0.89^{+0.15}_{-0.14}$ & $0.98^{+0.05}_{-0.05}$ & $0.95^{+0.07}_{-0.07}$ \\ $\phi_{\rm deV,r}$ & $1.08^{+0.03}_{-0.03}$ & $0.90^{+0.12}_{-0.12}$ & $0.96^{+0.08}_{-0.08}$ & $0.93^{+0.11}_{-0.11}$ \\ $M_*$ & $1.04^{+0.03}_{-0.03}$ & $1.20^{+0.12}_{-0.12}$ & $1.01^{+0.07}_{-0.07}$ & $0.94^{+0.11}_{-0.11}$ \\ \hline \hline \end{tabular} } \end{table} \begin{figure} \centering \includegraphics[width=0.85\textwidth]{bias1.pdf} \caption{\label{fig:bias}Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm Tinker}(M)$ is the predicted halo bias based on halo mass using the Tinker bias model. The symbols $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use $\pi_{\rm max}=100h^{-1}{\rm Mpc}$.} \end{figure} We do not observe significant projection effects among all the parameters we consider. Since central galaxy properties are unlikely to be contaminated by interlopers, we expect the contamination due to the projection effects should not be significant For parameters which show significant differences in halo masses, one could iterate over the sample split criteria and use the weak lensing to ensure subsamples have equal halo mass \citep[see, e.g.,][]{Lin2016}. We leave such investigations for future work. \begin{table}[h!] \centering \caption{Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use several different scales to fit. Note that the unit for $R$ is $[h^{-1}{\rm Mpc}]$.} \label{tab:bias_scale} \scalebox{0.85}{ \begin{tabular}{ccccc} \hline\hline Parameter & $b_{\rm lens}$ & $b_{\rm clust}:R \in [10,50]$ & $b_{\rm clust}:R \in [5,50]$ & $b_{\rm clust}:R \in [2,50]$ \\ \hline $M_*$ & $1.20^{+0.12}_{-0.12}$ & $0.94^{+0.11}_{-0.11}$ & $0.98^{+0.09}_{-0.09}$ & $0.91^{+0.09}_{-0.09}$ \\ \hline $D_n 4000$ & $0.69^{+0.12}_{-0.12}$ & $0.93^{+0.08}_{-0.08}$ & $0.91^{+0.08}_{-0.08}$ & $0.89^{+0.08}_{-0.08}$ \\ \hline $M_*/L$ & $1.41^{+0.11}_{-0.11}$ & $1.02^{+0.08}_{-0.08}$ & $1.10^{+0.08}_{-0.08}$ & $1.04^{+0.08}_{-0.08}$ \\ \hline age & $0.60^{+0.13}_{-0.13}$ & $1.03^{+0.09}_{-0.09}$ & $0.94^{+0.09}_{-0.09}$ & $0.96^{+0.09}_{-0.09}$ \\ \hline $\Gamma_F$ & $1.45^{+0.12}_{-0.12}$ & $1.04^{+0.05}_{-0.05}$ & $1.12^{+0.06}_{-0.06}$ & $1.06^{+0.07}_{-0.07}$ \\ \hline \hline \end{tabular} } \end{table} Finally, we also comment on the consistency of bias ratios of sub-samples between lensing and clustering, which appear consistent for most of the properties. The parameters $M_*/L$, $age$ and $\Gamma_F$ show that the bias ratio measured from clustering is almost one, while the bias ratio measured from lensing for these parameters shows more than $30\%$ gap between the two subsamples. It is not clear what causes this difference. We cross-check if this difference could result from the choice of scale for clustering. We measure the bias ratio on several different scales using the clustering as shown in Table~\ref{tab:bias_scale}. However, we do not see significant differences in the biases measured from the different scales. Another possibility is our choice of cosmology; the amplitude of lensing can be lower than that of clustering by assuming a \textit{Planck} cosmology \citep{amon_etal2022}. The difference between lensing and clustering amplitudes can be $\sim 20\%$. However, if this inconsistency persists on both subsamples, taking the ratio should cancel out. We could potentially investigate this issue using shape measurements from the Hyper Suprime Cam SSP (HSC) survey \citep{li_etal2022} due to its deeper photometry and better image quality than the SDSS source catalogue. We select all the source galaxies behind the lens galaxies in the current work. However, due to the shallow depth of SDSS, we cannot completely rule out source-cluster member confusion. We will leave the investigation of such effects to future work. \begin{figure}[h!] \centering \includegraphics[width=0.8\textwidth]{lum_Dn4000.contour.pdf} \caption{\label{fig:triangle_dn4000} Posterior constraint from the modelling of $\Delta \Sigma(R)$ for the high-$D_n 4000$ (blue) and low-$D_n 4000$ (green) subsamples. Each histogram in the diagonal panels are the 1D marginalised posterior distribution of the parameters, while each contour plot in the off-diagonal panels indicate the 1$\sigma$ and 2$\sigma$ confidence regions of the matching parameter pairs.} \end{figure} Finally, we focus on the results for the subsamples split by $D_n 4000$. Fig.~\ref{fig:triangle_dn4000} shows the derived posterior constraints of our model parameters for the high-$D_n 4000$ (blue) and low-$D_n 4000$ (green) subsamples, similar to Fig.~\ref{fig:triangle_mstar}. The parameter $D_n 4000$, which is a measure of the flux break at the 4000 $\text{\normalfont\AA}$ break strength, is sensitive to the average of the stellar population and is a good tracer of the long-term star formation histories (e.g., \cite{paulino-afonso_etal2020}). The mean halo masses of the high-$D_n 4000$ and low-$D_n 4000$ subsamples are almost equal, and the corresponding halo biases from lensing for these subsamples are different by $\sim 40\%$ (although the bias ratio is consistent with unity at less than 3 $\sigma$). At last, we compare the bias ratio measured from lensing and clustering. While the bias ratio from lensing is $\sim 40\%$, the one from clustering is $\sim 5\%$. Therefore, we cannot plausibly claim that subsamples split by $D_n 4000$ show halo assembly bias. \section{Conclusions} Halo assembly bias is the correlation between the large scale clustering of halos and secondary properties of the halos at fixed mass. It has been studied extensively using numerical simulations but has been difficult to confirm in observations. In this paper, we have searched for signs of halo assembly bias based on the central galaxy properties of SDSS redMaPPer clusters. Our research work can be summarized as follows: \begin{itemize} \item We used 12 different properties of the central galaxies in SDSS redMaPPer clusters derived from the analysis of their SDSS spectra by \citet{Chen_etal2012}. We subdivided redMaPPer clusters using the median of the relationship between these parameters and the cluster richness. \item We measured the weak lensing signals for each cluster sub-samples and modelled it to infer the average halo mass of these sub-samples and their large scale biases from the cluster weak lensing signal. \item We also measured the cross-correlations between galaxy clusters and spectroscopic galaxies from SDSS to obtain a higher signal-to-noise ratio estimate for the large scale clustering. \item For sub-samples obtained by using ten out of the twelve properties we considered, the halo masses are consistent with each other within 2$\sigma$. We computed the theoretically expected ratios of biases based on the halo mass estimates for all sub-sample splits. \item The halo bias ratios of each sub-samples as obtained by the cross-correlations and the expectations based on halo mass difference are consistent with each other. \item We do not see significant evidence of contamination by projection effects in sub-sample splits based on central galaxy properties. \end{itemize} In addition to the above findings, we also find some cases, albeit at low significance, where the bias ratio measured from the lensing signal differs from the ratio measured from clustering for some parameters. Such inconsistencies between lensing and clustering signals require further investigation as they could potentially signal issues in the contamination of clusters. In future work, we will use the shape catalogue from the HSC survey \citep{li_etal2022}, which overlaps with the footprint of the redMaPPer clusters. \section*{Acknowledgements} We thank Eduardo Rozo and Elisabeth Krause for their suggestions. TS is supported by Grant-in-Aid for JSPS Fellows 20J01600 and JSPS KAKENHI Grant Number 20H05855. HM is supported by JSPS KAKENHI Grant Numbers JP21H05456. Funding for SDSS-III has been provided by the Alfred P. Sloan Foundation, the Participating Institutions, the National Science Foundation, and the U.S. Department of Energy Office of Science. The SDSS-III web site is \url{http://www.sdss3.org/.} SDSS-III is managed by the Astrophysical Research Consortium for the Participating Institutions of the SDSS-III Collaboration including the University of Arizona, the Brazilian Participation Group, Brookhaven National Laboratory, Carnegie Mellon University, University of Florida, the French Participation Group, the German Participation Group, Harvard University, the Instituto de Astrofisica de Canarias, the Michigan State/Notre Dame/JINA Participation Group, Johns Hopkins University, Lawrence Berkeley National Laboratory, Max Planck Institute for Astrophysics, Max Planck Institute for Extraterrestrial Physics, New Mexico State University, New York University, Ohio State University, Pennsylvania State University, University of Portsmouth, Princeton University, the Spanish Participation Group, University of Tokyo, University of Utah, Vanderbilt University, University of Virginia, University of Washington, and Yale University. \section{} The clustering of dark matter halos depends on the assembly history of halos at fixed halo mass; a phenomenon referred to as \textit{halo assembly bias}. Halo assembly bias is readily observed in cosmological simulations of dark matter. However, it is difficult to detect it in observations. The identification of galaxy or cluster properties correlated with the formation time of the halo at fixed halo mass and the ability to select galaxy clusters free from projection effects are the two most significant hurdles in the observational detection of halo assembly bias. The latter, in particular, can cause a misleading detection of halo assembly bias by boosting the amplitude of lensing and clustering on large scales. This study uses twelve different properties of central galaxies of SDSS redMaPPer clusters derived from spectroscopy to divide the clusters into sub-samples. We test the dependence of the clustering amplitude on these properties at fixed richness. We first infer halo mass and bias using weak lensing signals around the clusters using shapes of galaxies from the SDSS survey. We validate the bias difference between the two subsamples using cluster-galaxy cross-correlations. This methodology allows us to decouple the contamination due to the projection effects from the halo assembly bias signals. We do not find any significant evidence of a difference in the clustering amplitudes correlated with any of our explored properties. Our results indicate that central galaxy properties may not correlate significantly with the halo assembly histories at fixed richness. \fontsize{8}{11}\helveticabold { \section{Keywords:} the large-scale structure of Universe -- cosmology: theory -- cosmology: observation} \end{abstract} \section{Introduction} In the cold dark matter (CDM) paradigm, massive cluster-sized halos form at rare peaks in the initial density field. Such massive halos are biased tracers of the matter density and cluster more strongly than the underlying matter distribution. The spatial distribution of dark matter halos primarily depends upon the halo mass \citep[e.g.,][]{Kaiser1984, Efstathiou1988, MoWhite1996}. However, there have been several studies that show that the clustering of halos at fixed halo mass can further depend upon secondary properties related to their assembly history \citep[e.g.,][]{gao_etal05, wechsler06, gao_white07, faltenbacher_white10, dalal_etal08}. This dependence of the halo clustering amplitude on secondary properties other than the halo mass is commonly referred to as \textit{halo assembly bias}, and can be traced back to the fact that halos of the same mass in different environments have different assembly histories and cluster differently. Having different assembly histories also affects the internal structure of halos \citep{bullock01,wechsler02,hahn_etal07,faltenbacher_white10}. This, in turn, results in a clustering dependence on the structural properties of a halo such as concentration. Even though halo assembly bias is sensitive to the specific definition of the property considered and can vary with halo mass \citep[e.g.,][]{Mao_etal2018} , several studies reveal that the low-concentration halos, which are the late-forming halos, cluster more strongly than the high-concentration halos at massive end \citep[e.g.,][]{dalal_etal08}. Since the halo assembly bias is a well-known phenomenon in simulations and has been studied extensively, several groups have attempted an observational detection of halo assembly bias with galaxies or galaxy groups, but they were inconclusive \citep[e.g.,][]{yang_etal06a, wang_etal13, Dvornik_etal2017, Niemiec_etal2018} or controversial \citep{Lin2016}. The difficulty of detecting halo assembly bias arises from the search for observational proxies of the halo mass and the formation time of halos due to our inability to measure the structure and mass of individual halos directly. There are mainly two approaches used to define such proxies. One is to use the spatial distribution of member galaxies in groups and clusters, while another is to use the properties of central galaxies in groups/clusters. On galaxy cluster scales, \citet{Miyatake2016} and \citet{More2016} claimed evidence of halo assembly bias using the optically selected redMaPPer galaxy cluster catalogue \citep{Rykoff_etal2014}. They split the cluster sample based on the richness (i.e., the number counts weighted by their membership probabilities) as a proxy of halo mass and the compactness of member galaxies in the clusters as a proxy of halo concentration. They used weak gravitational lensing to confirm that the halo masses of these cluster subsamples were consistent with each other, and yet the clustering amplitudes were significantly different. The difference in the clustering amplitude of the two subsamples was almost $60\%$, much larger than the difference expected from N-body simulations. Because the detected signal was significantly larger than the signal expected from simulations, several studies investigated the cause of this significant signal \citep{Zu2017, BuschWhite2017, SunayamaMore2019}. All these studies concluded that the signal detected in \citet{Miyatake2016} and \citet{More2016} is likely a result of projection effects, where interloper galaxies along the line of sight to a cluster are mistaken as genuine members of the cluster. The compactness of member galaxies, which was used as a proxy of concentration, was strongly correlated with the fraction of interloper galaxies. Therefore, using member galaxies in optically selected galaxy clusters to define the proxies of halo mass and formation time inevitably suffers from optical projection effects. Using only central galaxies to detect the halo assembly bias is another way to avoid misidentifying member galaxies and the resulting contamination from the projection effects. \citet{Lin2016} used the galaxy group catalog from \citet{yang_etal06a}. They used the stellar mass and the specific star formation rate of central galaxies as proxies of halo mass and formation time, respectively. They split central galaxies into two subsamples such that they have equal distribution in stellar masses but different specific star formation rates. However, they attribute the difference in the clustering amplitude of the two subsamples to the halo mass difference of the subsamples using weak gravitational lensing measurements. Therefore, they do not claim evidence for the detection of halo assembly bias. Recently, \citet{Zu_etal2021} investigated the origin of the scatter in the stellar-to-halo mass relation (SHMR) of the redMaPPer clusters and found possible evidence of halo assembly bias. They first derived photometric stellar masses for all the brightest central galaxies (BCGs) in the redMaPPer cluster catalogue. They then split the sample into two subsamples based on their richness and stellar masses. The two subsamples were confirmed to have equal weak lensing halo masses but different concentrations and clustering amplitudes. The difference in the clustering amplitudes was about 10\%, albeit with a significant error, which is consistent with the size of cluster-sized halo assembly bias predicted from the simulations. Their result implies that the scatter in the stellar mass of the BCGs at fixed halo mass could be closely related to the halo concentration and the cosmic overdensities on large scales. One caveat in this analysis is that they did not investigate the possible contamination from the projection effects, which can bias the measurement of the clustering amplitude like \citet{Miyatake2016} and \citet{More2016}. This biased measurement is a result of preferential selection of halos with filaments aligned along the line-of-sight (LOS) \citep{Sunayama_etal2020}. In other words, the projection effects cause anisotropies in the large-scale structure distribution around optically selected clusters and boost the amplitude of cluster lensing and clustering signals on large scales. Cluster-galaxy cross-correlations can be used to measure these anisotropies in the large-scale structure. However, \citet{Zu_etal2021} use photometric redshifts of BCGs to infer stellar masses. 21\% of the BCGs in their sample do not have spectroscopic redshifts and these BCGs without $z_{\rm spec}$ mostly have a stellar-mass below $10^{11}h^{-2}{\rm M_{\odot}}$ and some of them have above $3\times10^{11}h^{-2}{\rm M_{\odot}}$ \citep{Zu2020}. Including more low stellar mass BCGs implies more low-mass halos, whose richness could be affected by projection effects. The motivation of this study is to investigate further the possible correlation between central galaxy properties and the assembly history of halos in clusters while decoupling the physical correlation and the projection effects. To do so, we only use the redMaPPer clusters with spectroscopic redshifts. We will also discuss possible systematic biases due to spectroscopic incompleteness. This paper is organized in the following manner. Section 2 describes the cluster and galaxy catalogues we use in our analysis. Section 3 presents the computation of cluster-galaxy cross-correlation functions and weak lensing measurements and the Bayesian inference methods to infer halo mass from the weak lensing measurements. We present our main results in Section 4 and conclude in Section 5. \section{Data} We use the redMaPPer cluster catalogue \citep{Rykoff_etal2014} derived from the Sloan Digital Sky Survey (SDSS) Data Release 8 (DR8) photometric galaxy catalogue \citep{Aihara_etal2011} and cross-match the central galaxies to the Wisconsin PCA-based value-added galaxy catalogue \citep{Chen_etal2012} to obtain galaxy properties for the central galaxies of the redMaPPer clusters. Also, we use the BOSS DR12 LOWZ sample to compute the cluster-galaxy cross-correlation functions. \label{sec:data} \subsection{redMaPPer galaxy clusters} \begin{table} \centering \caption{List of central galaxy properties used to find the correlation with halo assembly history.} \label{tab:parameter} \scalebox{0.85}{ \begin{tabular}{cc} \hline\hline Parameter & Description \\ \hline ${\rm D}_{n}4000$ & the 4000$\text{\normalfont\AA}$ break strength\\ $H{\delta}_{A}$ & the strength of Balmer absorption line\\ $M_{*}/L$ & estimates of stellar mass-to-light ratio\\ age & the r-band luminosity-weighted age\\ $\mu \times \tau$ & the dust parameters $\mu$ and $\tau$\\ $\sigma_v$ & the stellar velocity dispersion\\ $\Gamma_F$ & fraction of stars formed in recent bursts \\ $Z$ & metallicity \\ $R_{{\rm deV},r}$ & de Vaucouleurs fit scale radius in $r$ band\\ $(a/b)_{{\rm deV},r}$ & de Vaucouleurs fit a/b in $r$ band\\ $\phi_{{\rm deV},r}$ & de Vaucouleurs fit position angle in $r$ band\\ $M_{*}$ & stellar mass\\ \hline \hline \end{tabular}} \end{table} The red-sequence Matched-filter Probabilistic Percolation (redMaPPer) cluster finding algorithm was developed by \citet{Rykoff_etal2014} to identify galaxy clusters using red-sequence galaxies in optical imaging surveys \citep{Rykoff_etal2014, Rozo2014, Rozo2015, Rozo2015_2}. We use the redMaPPer galaxy cluster catalogue version 5.10 derived from the SDSS DR8 photometric galaxy catalogue \citep{Aihara_etal2011}. The redMaPPer algorithm assigns redshift and richness, the number count of red galaxies weighted by their cluster membership probabilities. We choose galaxy clusters with richness $20\leq\lambda\leq200$ at $0.1 \leq z \leq 0.33$. This selection ensures that the redMaPPer cluster catalog is approximately volume-complete. We limit ourselves to using the clusters whose central galaxies have a measured spectroscopic redshift and thus avoid uncertainties due to photometric redshift in the measurement of cluster lensing and clustering as well as to quantify the possible contamination by optical projection effects. In total, we have 7637 clusters which pass these cuts, while there are 1040 clusters without spectroscopic redshifts, merely $12\%$ of all the sample. \footnote{In the original redMaPPer catalogue, there are 2009 central galaxies which do not have spectroscopic redshift. These galaxies correspond to $23\%$ of all the clusters. To increase the number of the central galaxies with spectroscopic redshift, we carried out a further cross-match of the redMaPPer central galaxies to those in the SDSS DR17 catalogue. We thus obtain another 969 central galaxies with spectroscopic redshift.} \begin{figure} \centering \includegraphics[width=0.45\textwidth]{sample_cut.png} \caption{\label{fig:mcut} We select redMaPPer clusters whose absolute magnitude is $M_{i}<-22.4$.} \end{figure} \cite{Zu2020} point out the spectroscopic incompleteness of the redMaPPer central galaxies -- the clusters without spectroscopic redshift are either the lowest or the highest stellar mass galaxies at fixed richness. To avoid such incompleteness, we decided to select further our cluster sample based on the absolute magnitude of the central galaxies. Fig.~\ref{fig:mcut} shows the detection fraction of the redMaPPer central galaxies by the spectroscopic observation as a function of $i$ band absolute magnitude $M_{i}$. As is consistent with Fig. 2 in \cite{Zu2020}, Fig.~\ref{fig:mcut} shows the declines towards zero at both ends of $M_{i}$. The cut-off at the high end of absolute magnitude is relatively sharp and happens at $M_{i}\sim -22.4$. To make sure that our cluster sample does not suffer from spectroscopic incompleteness, we only use the central galaxies whose absolute magnitude is $M_{i}\leq-22.4$. With this absolute magnitude cut, we lose another 4.5 per cent of the clusters, resulting in a sample of 7287 clusters we use in this study. \footnote{We repeat the same analysis for the $M_*$-split subsamples without imposing the luminosity cut, and we did not find any significant changes in the result (see Appendix~\ref{app:no_lum}).} To detect the halo assembly bias effect from the galaxy cluster sample, we need to split the sample into subsamples and find evidence for a dependence of the large scale clustering amplitude on any secondary property other than the halo mass. We match the most probable central galaxy of the redMaPPer clusters to the galaxies in the Wisconsin PCA-based value-added galaxy catalogue \citep{Chen_etal2012}. The value-added catalogue provides the values of each of the PCA coefficients, and we map these coefficients to 12 physical parameters based on the results of \citet{Chen_etal2012}. We list the corresponding physical parameters in Table~\ref{tab:parameter}, and we will use them as a proxy for concentration/formation time. This paper aims to find parameters that exhibit the assembly bias effect. We use ten equally spaced bins both in redshift and richness to obtain the median value of the chosen parameter X. We use a spline fit for the median of $X$ as a function of redshift and richness. Based on this fit, we define the two subsamples as "large-$X$ clusters" with $X>\overline{X}(z,\lambda)$ and "small-$X$ clusters" with $X<\overline{X}(z,\lambda)$. This selection makes sure that the two cluster subsamples have the same richness and redshift distributions. We use the random catalogues corresponding to the redMaPPer cluster catalogue for the clustering and weak lensing measurements. These catalogues contain corresponding position information, redshift, richness, and a weight for each random cluster. \subsection{BOSS DR12 LOWZ sample} We will cross-correlation of the redMaPPer galaxy clusters with spectroscopic galaxies to study halo assembly bias. We use the spectroscopic galaxies in the large-scale structure catalogues constructed from SDSS DR12 (\citet{Alam2015}). In particular, we will use the LOWZ sample since it has considerable overlap in the redshift range with our galaxy cluster sample. We restrict ourselves to LOWZ galaxies with redshifts between $0.1<z<0.33$, the same redshift range as our galaxy clusters. The galaxy catalogue also comes with associated random galaxy catalogues that we use to perform our cross-correlation analysis. \section{Methods} \subsection{Detecting Halo Assembly Bias Without Projection Effects} \label{sec:method:basic} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{fig1.png} \caption{\label{fig:logic1} The logic to detect halo assembly bias often used in other studies.} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\textwidth]{fig2.png} \caption{\label{fig:logic2} The logic to detect halo assembly bias by decoupling from the projection effects.} \end{figure} We take a two-step approach to detect halo assembly bias using cluster subsamples - i) we confirm that the difference in the biases is not due to halo mass differences in the subdivided samples, or, ii) arising due to contamination of the cluster subsamples due to LOS projection effects. We use the weak gravitational lensing signal to measure the halo mass for two cluster subsamples split based on the parameter $X$. Although the weak lensing signal can also be used to infer the large scale bias of the cluster subsamples, the weak lensing signal (or the cluster-cluster auto-correlation) has a lower signal-to-noise ratio than the cross-correlation of the cluster subsamples with galaxies. Therefore we use the galaxy cluster-galaxy cross-correlation to detect the halo biases of the two sub-samples. Fig.~\ref{fig:logic1} shows the simple logical flow used in previous studies to detect halo assembly bias. If the two subsamples have equal halo masses but have different halo biases, it is typically considered evidence favouring halo assembly bias. However, this test on its own does not guarantee that the observed bias difference between the two sub-samples could be due to projection effects \citep[e.g.,][]{Miyatake2016}. To decouple the bias difference caused by the projection effects from the halo assembly bias, we instead use the logical flow described in Fig.~\ref{fig:logic2}. The first step in this revised logical flow is the same as that shown in Fig.~\ref{fig:logic1}: measure the halo masses of the two subsamples from lensing and the bias from cross-correlations. However, our new logical flow includes an extra check. We compute the cluster-galaxy projected cross-correlations with two different integration limits $\pi_{\rm max,1}$ and $\pi_{\rm max,2}$. The projected cross-correlation function is given by, \begin{equation} w_{\rm p,cg}(R, \pi_{\rm max}) = 2\int_{0}^{\pi_{\rm max}}\xi_{\rm cg}(R, \pi) d\pi\,. \end{equation} In the absence of any projection effects, or redshift space distortions, the quantity $\xi_{\rm cg}(R, \pi)$ in the above equation would be equal to the 3-dimensional cross-correlation $\xi_{\rm cg}\left[(R^2+\pi^2)^{1/2}\right] \propto b_{\rm c}b_{\rm g}$. The ratio of the cross-correlations of galaxies with the two cluster subsamples will be equal to $b_{\rm c1}/b_{\rm c2}$. Redshift space distortions ought to cancel out in the limit that $\pi_{\rm max}\rightarrow \infty$. However as pointed out in \citet{vdBosch_etal2013}, the finite integration length can result in residual redshift space distortions in a scale dependent manner. For $R/\pi_{\rm max}\leq 1$, the residual RSDs are small, while these corrections become larger on scales $R/\pi_{\rm max}\sim 1$. By using the formalism in \citet{vdBosch_etal2013}, and using fiducial bias ratios $3$ and $2.5$, we have computed the effect of the residual redshift space distortions on the ratio of the biases for $\pi_{\rm max}=[50, 100] h^{-1}{\rm Mpc}$. Such residual redshift space distortions can cause a scaled dependent bias ratio but within $\sim 2$ percent, which is much smaller than our errors. Projection effects in the sample selection can cause an anisotropic distribution of matter/galaxies around clusters \citep{BuschWhite2017, SunayamaMore2019, Sunayama_etal2020, Park_etal2021}. Such projection effects can lead to differences between the structure of the correlation function in redshift space. This anisotropic distribution lead to projected cluster-galaxy cross-correlations that depend upon the LOS integration length scale \citep{Sunayama_etal2020}. Differences in projection effects can amplify the inferred bias ratios of the cluster subsamples, when smaller projection lengths ($\pi_{\rm max}=50 h^{-1}{\rm Mpc}$ versus $100h^{-1}{\rm Mpc}$) are used compared to larger ones. Ignoring residual redshift space distortions, in the presence of projection effects, \begin{align} w_{\rm p,cg}(R,\pi_{\rm max})=[1+\Pi(\pi_{\rm max})]w_{\rm iso,cg}(R) \label{eq:inertia} \end{align} where $\Pi$ is the anisotropic enhancement of the clustering amplitude, and $w_{\rm iso, cg}(R)$ is the expected projected cross-correlation function of galaxies and clusters, in the absence of any projection effects that correlated with the property used for subsample selection. This $\Pi(\pi_{\rm max})$ can be modeled as constantly increasing function of $\pi_{\rm max}$ \citep{Park_etal2021}. If one cluster subsample is heavily affected by the projection effects (denote as "sample1") but not the other (denote as "sample2"), then the bias ratio between these two subsamples will show a strong dependence on the choice of the integral scale such as \begin{align} \frac{b_{\rm sample1}}{b_{\rm sample2}}(\pi_{\rm max})=(1+\Pi_{\rm sample1}(\pi_{\rm max}))\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}, \label{eq:inertia} \end{align} where $b_{\rm sample,iso}$ is an expected bias for the case of isotropically distributed clusters with the same halo masses and $b_{\rm sample2}=b_{\rm sample2,iso}$. If two cluster subsamples are equally affected by the projection effects, the effects will be canceled out such as \begin{align} \frac{b_{\rm sample1}}{b_{\rm sample2}}(\pi_{\rm max})=\frac{(1+\Pi_{\rm sample1}(\pi_{\rm max}))}{(1+\Pi_{\rm sample2}(\pi_{\rm max}))}\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}=\frac{b_{\rm sample1,iso}}{b_{\rm sample2,iso}}, \label{eq:inertia} \end{align} if $\Pi_{\rm sample1}(\pi_{\rm max})=\Pi_{\rm sample2}(\pi_{\rm max})$. Therefore, we study the dependence of the bias ratio. We will use any statistically significant dependence of the bias difference on the choice of the integral scale $\pi_{\rm max}$ to flag projection effects. If such a dependence is not found, a difference in the halo bias between two subsamples at fixed weak lensing halo mass can be construed as evidence of halo assembly bias. \subsection{Galaxy-Galaxy Lensing Measurements} \label{sec:lensing} Weak gravitational lensing provides a way to infer the mean halo masses of galaxy clusters and bias on large scales. The excess surface mass density profile $\Delta\!\Sigma$, which is a direct observable of cluster lensing, is given by \begin{align} \Delta\! \Sigma(R)&\equiv \avrg{\Sigma}\!(<R)-\Sigma(R)\nonumber\\ &= \frac{2}{R^2} \int_0^R\! \mathrm{d}R' R' \Sigma(R') - \Sigma(R), \label{eq:DeltaSigma} \end{align} where $\avrg{\Sigma_i}\!(<R)$ and $\Sigma_{i}(R)$ denote the average surface mass density within a circle of radius $R$ and the surface mass density at $R$ respectively. The surface mass density $\Sigma_{i}(R)$ is computed from the halo-mass cross correlation function $\xi_{\rm cm}(r)$, \begin{align} \Sigma(R)=\bar{\rho}_{\rm m0}\int_{-\infty}^{\infty}\!\!\mathrm{d}\pi~ \left[1+\xi_{\rm cm}\!\left(\sqrt{R^2+\pi^2}\right)\right], \label{eq:Sigma} \end{align} where $\bar{\rho}_{\rm m0}$ is the mean matter density today, $\pi$ and $R$ are the separations parallel and perpendicular to the LOS direction from the cluster center, respectively. To compute the weak lensing signal for our cluster sample, we follow the methodology described in \citet{Mandelbaum_etal2013} and \citet{Miyatake2016}. We use the shape catalogue of \citet{Reyes_etal2012} which is based on the photometric galaxy catalogue from the SDSS DR8. The shape measurements were calibrated using detailed image simulations \citep[see][for details]{mandelbaum_etal2012}. The galaxy shapes are measured by the re-Gaussianization technique \citep{hirata_seljak03}. \citet{mandelbaum05} extensively investigate the systematic uncertainties in the shape measurements of SDSS galaxies. The redshift of source galaxies is estimated based on the photo-$z$ code ZEBRA \citep{Feldmann2006, Nakajima_etal2012}. We measure the average projected mass density profile $\Delta \Sigma(R)$ as \begin{equation} \Delta \Sigma(R)=\frac{\Sigma_{ls} w_{ls} e_{t,ls}\left<\Sigma_{\rm crit}^{-1}\right>_{ls}^{-1}}{(1+\hat{m}(R))\Sigma_{ls} w_{ls}}, \end{equation} where the summation runs over all the lens-source pairs separated by R and the subscript "$l$" and "$s$" represent lens and source galaxies, respectively. $e_{t,ls}$ is tangential components of ellipticities and $w_{ls}$ is given by \begin{equation} w_{ls} = w_l w_s \left<\Sigma_{\rm crit}^{-1}\right>_{ls}^{2}, \end{equation} where $w_l$ and $w_s$ are the weight given by the redMaPPer cluster catalog and the source catalog, respectively. The overall factor $(1+\hat{m}(R))$ is to correct for a multiplicative shear bias \citep{miller12} and is computed as an average of the lens-source pairs at a distance $R$. To measure the lensing signal accurately, we apply several corrections to remove the residual systematics. The first of such correction corresponds to the photometric redshift bias following Eqn. 5 in \cite{mandelbaum08a}. When $z_l$ and $z_s$ are photometric redshifts, the measured critical surface density $\Sigma_{\rm crit}$ is biased such as \begin{equation} 1+b_z(z_l) =\frac{\Delta \Sigma}{\tilde{\Delta \Sigma}}=\frac{\Sigma_{s} w_{ls} \Sigma_{\rm{crit},ls} \tilde{\Sigma}_{\rm{crit},ls}^{-1}}{\Sigma_{s} w_{ls}}, \end{equation} where $\tilde{\Sigma}_{\rm{crit},ls}$ is the true critical surface mass density measured by \cite{Nakajima_etal2012} for which we used spectroscopic redshifts for source galaxies. This quantity $1+b_z$ is a function of lens redshift $z_l$. We measured the photo-$z$ bias as a function of lens redshift and computed an average photo-$z$ bias for the redMaPPer clusters. The average value of the bias parameter over the redshift range of our lensing sample is about $8.3\%$. We divide the measured lensing signal by $1+b_z$. The second is a dilution of the lensing signal due to source galaxies which are physically associated with the lens galaxy and can be corrected by a boost factor $B(R)$ given by \begin{equation} B(R)=\frac{\sum_i w_r}{\sum_i w_l} \frac{\Sigma_{ls} w_l w_s}{\Sigma_{rs} w_r w_s}, \end{equation} where the superscript “$r$” stands for random catalogs and $w_r$ is the weight of the random provided by the catalog. If there is no physical correlation between lens and source galaxies, $B(R)=1$. The boost factor $B(R)$ deviates from 1 on small scales but converges to 1 on large scales. By multiplying the measured signal by the boost factor, it corrects for the dilution of the signal. The third is a possible residual systematic in the shape measurements due to imperfect optical distortion corrections across the field of view. If we measure the lensing signal around the random points, we should not detect any coherent tangential distortions. Any coherent tangential distortion around the randoms arises due to imperfect corrections that translate into systematics in the shape measurements. We correct for such effects by subtracting the lensing signal around the randoms from that around the lenses. We perform halo model fits to the measurements of the weak lensing signal of each cluster subsample. To model $\Delta\! \Sigma(R)$, we use a halo model assuming NFW profile with the off-centering effect. We use a five parameter model to the weak lensing signal following \cite{Miyatake2016}, \begin{align} \Delta\! \Sigma(R; M_{\rm 200m}, c_{\rm 200m}, q_{\rm cen},\alpha_{\rm off},b)\nonumber\\ = q_{\rm cen} \Delta\! \Sigma^{\rm NFW}(R;M_{\rm 200m},c_{\rm 200m},\alpha_{\rm off})\nonumber\\ +(1-q_{\rm cen})\Delta\! \Sigma^{\rm NFW,off}(R;M_{\rm 200m},c_{\rm 200m},\alpha_{\rm off}) \nonumber\\ +\Delta\! \Sigma^{*}(R;M_{*})+\Delta\! \Sigma^{\rm 2-halo}(R;b). \label{eq:dSigma_model} \end{align} The first term is the halo mass profile for the clusters whose centre is correctly identified, while the second term is the halo mass profile for these clusters whose centres are misidentified. The parameter $1-q_{\rm cen}$ represents the fraction of the off-centring clusters, and $\alpha_{\rm off}$ describes the ratio of the three-dimensional off-centring radius to $R_{\rm 200m}$. The normalized profile of the off-centering clusters with respect to their true center is given by $u_{\rm off}(r) \propto \exp[-r^2/(2\alpha_{\rm off}^2 R_{\rm 200m}^2)]$. Note that we truncate the off-centring profile to zero at $r>R_{\rm 200m}$. The third term models a stellar-mass contribution from the central galaxies assuming a point mass, and we use the mean value of $M_{*}$ in the cluster subsamples. The fourth term models the lensing contribution from two-point correlation functions between the clusters and the mass distribution around the clusters, which is given by \begin{align} \Delta\! \Sigma^{\rm 2-halo}(R)=b \int k dk/(2\pi) \bar{\rho}_{\rm m0} P_{\rm m}^{\rm L}(k,z_{\rm cl})J_2(kR), \label{eq:two-halo} \end{align} where $b$ is a linear galaxy bias, $P_{\rm m}^{\rm L}$ is the linear matter power spectrum and $J_2(x)$ is the second-order Bessel function. We perform Bayesian parameter inferences using the likelihoods with the measured lensing signal and the model prediction as in Eqn.~\ref{eq:dSigma_model} to obtain the posterior distribution of the parameters. To do that, we use the affine invariant Monte Carlo Markov Chain (MCMC) ensemble sampler \textit{emcee} \citep{emcee}. We use flat priors for all the parameters: $M_{\rm 200m}/[]10^{14}h^{-1}M_\odot \in [0.5,50]$, $c_{\rm 200m} \in [1,10]$, $q_{\rm cen} \in [0.6,1]$, $\alpha_{\rm off} \in [10^{-4},1]$, and $b \in [0,10]$. The background cosmology assumed for the lensing and clustering measurements is based on \textit{Planck} 2018 \cite{Planck2018} under a flat $\Lambda$CDM model: $\Omega_{\rm m}=0.315$ and $\sigma_8=0.811$. \subsection{Correlation function measurements} \label{sec:corr} Once we find the cluster subsamples with equal halo masses but different large scale amplitudes, we examine whether the clustering difference indicates halo assembly bias or is a result of projection effects. We use the cluster-galaxy cross-correlation function to differentiate between these possibilities. The cluster-galaxy cross-correlation function can be computed using the Landy-Szalay estimator \citep{landyszalay93} as, \begin{equation} \xi_{\rm cg}=\frac{\left <D_c D_g \right >-\left <D_g R_c \right >-\left <D_c R_g \right >+\left <R_c R_g \right >}{\left <R_c R_g \right >},\label{eq:landy-szalay} \end{equation} where $\left <DD \right >$,$\left <DR \right >$, and $\left <RR \right >$ are the normalized numbers of pairs for data-data, data-random, and random-random respectively. The subscripts $c$ and $g$ represent the samples of clusters and galaxies. We measure the cluster-galaxy cross-correlation functions $\xi_{cg}$ in two dimensions $(R,\pi)$ where $R$ and $\pi$ are the separations perpendicular to and along the LOS direction. Then, we compute the projected correlation functions by integrating $\xi_{cg}$ along the LOS direction up to the maximum integral scale $\pi_{\rm max}$, \begin{equation} w_{\rm p}(R,\pi_{\rm max})=\int_{0}^{\pi_{\rm max}}d\pi \xi_{\rm cg}(R,\pi)\,.\label{eq:wp_cg} \end{equation} We use $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$. If the bias difference between two subsamples is due to the projection effects, the bias ratios $w^{\rm large}_{\rm p,cg}(R)/w^{\rm small}_{\rm p,cg}(R)$ will have different values for a different choice of $\pi_{\rm max}$. To check this, we compute the ratio of ratio $R=\frac{w^{\rm large}_{\rm p,cg1}}{w^{\rm small}_{\rm p,cg1}}/\frac{w^{\rm large}_{\rm p,cg2}}{w^{\rm small}_{\rm p,cg2}}$, where the subscripts $1$ and $2$ correspond to the used maximum integral scales $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$. If this $R$ is unity, the bias difference between the two subsamples is not likely due to projection effects and therefore signifies evidence for halo assembly bias. \section{Results} \label{sec:results} In this section, we first present our approach to the detection of halo assembly bias for the case of stellar mass $M_*$ in Sec.~\ref{sec:res:mstar} and then we show the results for other parameters listed in Table~\ref{tab:parameter} in Sec.~\ref{sec:res:others}. \subsection{Subsamples divide by BCG stellar mass} \label{sec:res:mstar} \begin{figure}[h!] \centering \includegraphics[width=0.8\textwidth]{lum_mstar.contour.pdf} \caption{\label{fig:triangle_mstar} Posterior constraint from the modelling of $\Delta \Sigma(R)$ for the high-$M_*$ (blue) and low-$M_*$ (green) subsamples. Each histogram in the diagonal panels are the 1D marginalised posterior distribution of the parameters, while each contour plot in the off-diagonal panels indicate the 1$\sigma$ and 2$\sigma$ confidence regions of the matching parameter pairs.} \end{figure} We show the posterior distribution of our model parameters inferred from the measurement of the cluster subsamples divided by high-$M_*$ (blue) and low-$M_*$ (green) of the BCGs in Fig.~\ref{fig:triangle_mstar}. The diagonal panels show the marginalized posterior distributions for the five parameters used in the model, while the off-diagonal panels are the 1$\sigma$ and 2$\sigma$ credible regions for the parameter combinations. The mean halo masses of the high-$M_*$ and low-$M_*$ subsamples are ${\rm log}_{10} M_h^{\rm high}=14.30 \pm 0.03 h^{-1}M_\odot$ and ${\rm log}_{10} M_h^{\rm low}=14.28 \pm 0.03 h^{-1}M_\odot$, respectively. At fixed $\lambda$, the result implies that the two stellar mass BCG subsamples reside in halos of similar masses at fixed richness \citep{Zu_etal2021, Zu_etal2022}. The measured halo bias ratio from lensing signals is $b_{\rm high}/b_{\rm low}=1.20\pm 0.12$, while the expected halo bias ratio based on the measured halo masses using \textit{Colossus} is $b_{\rm high}/b_{\rm low}= 1.04 \pm 0.03$ The measured bias ratio is consistent with the expected bias ratio based on the estimate of the halo masses, implying that this does not constitute substantial evidence of halo assembly bias. On careful inspection, this seems consistent with the results shown in Fig.~4 of \cite{Zu_etal2021}; within the errors, the mass and bias differences between the two subsamples are consistent. \cite{Zu_etal2021} further show that the cross-correlation between SDSS photometric galaxies and the cluster subsamples shows a difference in clustering of order $10\%$. On the other hand, the cross-correlation with spectroscopic galaxies gives a noisy result. Given the larger errors, we cannot entirely rule out such a difference. We do not, however, see consistent differences in the inferred posteriors of concentration and bias (contrast the second panel in the bottom row of Fig.~\ref{fig:triangle_mstar} with the bias-concentration subpanel in Fig. 4 of \citet{Zu_etal2021}). One of the differences between our sample selection and that of \cite{Zu_etal2021} is that they use all redMaPPer clusters with $\lambda \geq 20$ at $0.17 <z< 0.3$, while we limit ourselves to the clusters with spectroscopic redshift and with $M_i \leq -22.4$. As we would like to test for projection effects, we do not conduct a cross-correlation analysis with photometric galaxies where we cannot test for projections. \footnote{We tested a similar cluster sample selection as is \cite{Zu_etal2021}. We select redMaPPer clusters at $0.17 \leq z_{\lambda} \leq 0.3$ with richness $\lambda \geq 20$ and the luminosity cut of $M_i \leq -22.4$ and repeat the analysis. We obtained a similar result that low-$M_*$ subsample has a lower value of concentration and with similar halo masses and halo biases.} While the fractions of centered clusters $q_{\rm cen}$ are consistent with the fraction of the clusters with the centering probability $p_{\rm cen} \geq 0.8$, which is roughly $\sim 76\%$, our results show a degeneracy between the concentration parameter $c$ and the off-centering kernel size $\alpha_{\rm off}$. The degeneracy results in $c^{\rm high}=5.31 \pm 1.01$ and $c^{\rm low}=3.28 \pm 0.60$. The expected values of concentration using the model by \cite{diemer_joyce2019} from \textit{Colossus} are $c^{\rm high}=4.94 \pm 0.02$ and $c^{\rm low}=4.98 \pm 0.03$. Since the low-$M_*$ subsample contains more low-mass clusters, $c^{\rm low}$ is expected to be slightly larger than $c^{\rm high}$. The cause of this opposite result can be a degeneracy with the off-centring parameter $\alpha_{\rm off}$. To suppress the contribution from the off-centred clusters, we select the redMaPPer clusters whose central probability $p_{\rm cen}$ is larger than 0.9 and repeat the same analysis. \footnote{Posterior constraints of the model parameters for the cluster subsamples with $p_{\rm cen}\geq0.9$ are in Appendix~\ref{app:pcen}.} While we do see the increase of $q_{\rm cen}$ to $0.95^{+0.04}_{-0.03}$ for both subsamples (i.e., decrease in the fraction of the off-centered clusters) and the shift of the off-centering location $\alpha^{\rm high}_{\rm off}=0.55^{+0.31}_{-0.35}$ and $\alpha^{\rm low}_{\rm off}=0.51^{+0.34}_{-0.34}$, we do not see significant changes in concentration, $c_{\rm high}=4.91^{+0.50}_{-0.45}$ and $c_{\rm low}=3.57^{+0.45}_{-0.41}$. \begin{figure} \centering \includegraphics[width=0.45\textwidth]{wp_mstar.pdf} \caption{\label{fig:ror_mstar} Top: Cluster-galaxy projected cross-correlation functions integrated up to $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ for the high/low-$M_*$ subsamples. Middle:The ratio $w_{\rm p,cg}^{\rm high}(R)$ and $w_{\rm p,cg}^{\rm low}(R)$ computed with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ (blue dash-dot) and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ (orange solid). Bottom: The ratio of $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ at $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ denoted as $R$ which is defined in Sec.~\ref{sec:corr}.} \end{figure} To examine whether the $M_*$-split subsamples are affected unevenly by projection effects, we compute the cluster-galaxy projected cross-correlation functions $w_{\rm p,cg}(R)$ with different LOS integral lengths $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$, respectively. The bottom panel of Fig.~\ref{fig:ror_mstar} shows the ratio of $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ at $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$ denoted as $R$. If this ratio is one, the bias difference between the subsamples is less likely to result from projection effects. However, Fig.~\ref{fig:ror_mstar} shows $1\sigma$ deviation from unity, which is $1.09 \pm 0.09$ on $10h^{-1}{\rm Mpc} \leq R \leq 30 h^{-1}{\rm Mpc}$. This result implies that the high/low-$M_*$ subsamples are likely affected differently by projection effects. The middle panel of Fig.~\ref{fig:ror_mstar} shows the ratio $w_{\rm p,cg}^{\rm high}(R)/w_{\rm p,cg}^{\rm low}(R)$ with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ (blue dashed-dot) and $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ (orange solid). While the ratio with $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ is almost one, the ratio with $\pi_{\rm max}=100h^{-1}{\rm Mpc}$ is $0.94 \pm 0.11$. This is opposite of the bias ratio from lensing ($1.20 \pm 0.12$) and is consistent with the result of \cite{Zu_etal2021} that the low-$M_*$ subsample has a larger bias. However, we must note that the $R$ value and the bias ratios measured with two different integral lengths are all unity within $~1\sigma$ and therefore the projection effects contaminate the bias measurements only mildly. However, as we see hints of subsamples affected by projection with the cross-correlation with spectroscopic data, we do not further explore cross-correlations with photometric galaxies. \subsection{Subsamples based on other parameters} \label{sec:res:others} This section presents the results obtained from the cluster subsamples split based on other parameters. The posterior distributions of the model parameters for all the subsamples are summarized in Table~\ref{tab:result_flat}. Fig.~\ref{fig:bias} shows the ratio of the biases of the two subsamples split by different properties. The blue symbols correspond to the theoretical expectation of the ratio of biases given the constraint on halo masses from weak lensing. The orange and green symbols correspond to bias ratios obtained from cluster weak lensing and cross-correlation with spectroscopic galaxies, respectively. The signal-to-noise ratio of the weak lensing signal is smaller than that of the cross-correlation. Therefore, we primarily compare the green symbols with the blue ones. Overall we see reasonably good agreement between the bias ratios obtained from cross-correlation and that expected from the theoretical expectations, with differences between the two always less than 3$\sigma$. We make some further observations about these results below. \begin{table} \centering \caption{Posterior constraints of the model parameters for the subsamples split on various central galaxy properties listed in Table~\ref{tab:parameter}. The uncertainties are the 1$\sigma$ confidence regions derived from the 1D posterior probability distributions. For these analysis, we use flat priors for all the parameters.} \label{tab:result_flat} \scalebox{0.85}{ \begin{tabular}{ccccccc} \hline\hline Subsample & $M_h[10^{14}h^{-1}M_\odot]$ & $c$ & $b$ & $q_{\rm cen}$ & $\alpha_{\rm off}$ & $\chi^2$(dof=15)\\ \hline high-$D_n 4000$ & $1.89^{+0.16}_{-0.14}$ & $4.33^{+0.93}_{-0.68}$ & $2.04^{+0.30}_{-0.30}$ & $0.83^{+0.11}_{-0.12}$ & $0.55^{+0.30}_{-0.34}$ & $11.39$ \\ low-$D_n 4000$ & $1.90^{+0.11}_{-0.11}$ & $4.69^{+0.70}_{-0.52}$ & $2.96^{+0.30}_{-0.30}$ & $0.76^{+0.18}_{-0.12}$ & $0.10^{+0.27}_{-0.04}$ & $13.97$ \\ \hline high-$H_{\delta}A$ & $2.04^{+0.13}_{-0.12}$ & $4.17^{+0.78}_{-0.49}$ & $2.83^{+0.35}_{-0.36}$ & $0.83^{+0.12}_{-0.16}$ & $0.17^{+0.40}_{-0.11}$ & $12.59$ \\ low-$H_{\delta}A$ & $1.83^{+0.15}_{-0.13}$ & $4.84^{+0.92}_{-0.70}$ & $2.36^{+0.25}_{-0.24}$ & $0.85^{+0.10}_{-0.11}$ & $0.61^{+0.27}_{-0.36}$ & $27.33$ \\ \hline high-$M_*/L$ & $1.89^{+0.14}_{-0.13}$ & $4.32^{+0.72}_{-0.54}$ & $3.19^{+0.32}_{-0.32}$ & $0.87^{+0.09}_{-0.15}$ & $0.27^{+0.50}_{-0.22}$ & $18.73$ \\ low-$M_*/L$ & $1.78^{+0.12}_{-0.11}$ & $4.62^{+1.00}_{-0.61}$ & $2.26^{+0.29}_{-0.30}$ & $0.84^{+0.12}_{-0.16}$ & $0.20^{+0.44}_{-0.12}$ & $26.29$ \\ \hline high-age & $1.81^{+0.11}_{-0.10}$ & $5.30^{+0.90}_{-0.64}$ & $1.91^{+0.40}_{-0.39}$ & $0.87^{+0.09}_{-0.14}$ & $0.30^{+0.48}_{-0.23}$ & $14.59$ \\ low-age & $1.91^{+0.14}_{-0.12}$ & $3.52^{+0.60}_{-0.45}$ & $3.19^{+0.29}_{-0.29}$ & $0.85^{+0.10}_{-0.16}$ & $0.25^{+0.51}_{-0.19}$ & $15.76$ \\ \hline high-$\sigma_v$ & $2.07^{+0.14}_{-0.13}$ & $4.95^{+0.89}_{-0.64}$ & $2.13^{+0.31}_{-0.31}$ & $0.86^{+0.09}_{-0.13}$ & $0.34^{+0.44}_{-0.25}$ & $16.75$ \\ low-$\sigma_v$ & $1.79^{+0.12}_{-0.11}$ & $4.39^{+0.85}_{-0.60}$ & $2.85^{+0.30}_{-0.30}$ & $0.86^{+0.10}_{-0.13}$ & $0.45^{+0.37}_{-0.35}$ & $14.09$ \\ \hline high-$\mu \times \tau$ & $2.09^{+0.16}_{-0.14}$ & $4.20^{+0.95}_{-0.61}$ & $2.23^{+0.27}_{-0.28}$ & $0.83^{+0.11}_{-0.13}$ & $0.46^{+0.36}_{-0.32}$ & $18.48$ \\ low-$\mu \times \tau$ & $1.81^{+0.13}_{-0.12}$ & $4.54^{+0.82}_{-0.57}$ & $2.56^{+0.33}_{-0.32}$ & $0.86^{+0.10}_{-0.14}$ & $0.39^{+0.41}_{-0.32}$ & $12.43$ \\ \hline high-$\Gamma_F$ & $2.06^{+0.13}_{-0.12}$ & $3.75^{+0.63}_{-0.44}$ & $3.14^{+0.35}_{-0.35}$ & $0.82^{+0.13}_{-0.15}$ & $0.14^{+0.41}_{-0.08}$ & $16.83$ \\ low-$\Gamma_F$ & $1.76^{+0.12}_{-0.11}$ & $4.98^{+0.88}_{-0.65}$ & $2.16^{+0.29}_{-0.30}$ & $0.87^{+0.09}_{-0.12}$ & $0.47^{+0.36}_{-0.37}$ & $27.09$ \\ \hline high-Z & $1.88^{+0.13}_{-0.12}$ & $3.35^{+0.63}_{-0.43}$ & $2.50^{+0.27}_{-0.27}$ & $0.85^{+0.11}_{-0.15}$ & $0.31^{+0.46}_{-0.24}$ & $13.28$ \\ low-Z & $1.96^{+0.14}_{-0.12}$ & $5.29^{+0.91}_{-0.65}$ & $2.62^{+0.37}_{-0.37}$ & $0.86^{+0.10}_{-0.16}$ & $0.23^{+0.50}_{-0.16}$ & $21.10$ \\ \hline high-$R_{\rm deV,r}$ & $2.19^{+0.15}_{-0.13}$ & $4.97^{+0.86}_{-0.54}$ & $2.29^{+0.34}_{-0.34}$ & $0.87^{+0.09}_{-0.14}$ & $0.32^{+0.43}_{-0.24}$ & $15.24$ \\ low-$R_{\rm deV,r}$ & $1.61^{+0.12}_{-0.11}$ & $3.52^{+0.59}_{-0.46}$ & $2.48^{+0.31}_{-0.31}$ & $0.80^{+0.14}_{-0.15}$ & $0.13^{+0.45}_{-0.07}$ & $8.80$ \\ \hline high-$(a/b)_{\rm deV,r}$ & $2.12^{+0.17}_{-0.15}$ & $3.87^{+0.83}_{-0.57}$ & $2.19^{+0.36}_{-0.36}$ & $0.84^{+0.10}_{-0.12}$ & $0.56^{+0.30}_{-0.36}$ & $8.79$ \\ low-$(a/b)_{\rm deV,r}$ & $1.79^{+0.13}_{-0.12}$ & $5.28^{+0.94}_{-0.62}$ & $2.47^{+0.32}_{-0.31}$ & $0.86^{+0.10}_{-0.15}$ & $0.27^{+0.47}_{-0.19}$ & $11.16$ \\ \hline high-$\phi_{\rm deV,r}$ & $2.10^{+0.16}_{-0.14}$ & $4.46^{+0.94}_{-0.59}$ & $2.34^{+0.32}_{-0.32}$ & $0.86^{+0.10}_{-0.14}$ & $0.36^{+0.41}_{-0.24}$ & $5.36$ \\ low-$\phi_{\rm deV,r}$ & $1.77^{+0.10}_{-0.10}$ & $4.83^{+0.87}_{-0.67}$ & $2.61^{+0.30}_{-0.29}$ & $0.73^{+0.19}_{-0.10}$ & $0.11^{+0.13}_{-0.05}$ & $20.22$ \\ \hline high-$M_*$ & $2.01^{+0.13}_{-0.12}$ & $5.31^{+1.01}_{-0.61}$ & $2.74^{+0.32}_{-0.32}$ & $0.85^{+0.10}_{-0.14}$ & $0.28^{+0.46}_{-0.19}$ & $13.63$ \\ low-$M_*$ & $1.83^{+0.12}_{-0.12}$ & $3.28^{+0.60}_{-0.45}$ & $2.29^{+0.29}_{-0.30}$ & $0.80^{+0.14}_{-0.15}$ & $0.14^{+0.43}_{-0.08}$ & $14.12$ \\ \hline \hline \end{tabular} } \end{table} Among the 12 parameters we tested for splitting the subsamples, ten resulted in halo masses for the subsamples, consistent within 2$\sigma$. The parameters $D_n 4000$ split gives the closest match in the central values of the posterior distribution of masses for the two subsamples with ${\rm log}_{10}M_h^{\rm high}=14.28^{+0.04}_{-0.03} h^{-1}M_\odot$. The ratio of the large scale biases based on lensing is $b_{\rm high}/b_{\rm low}=0.69 \pm 0.12$. We will discuss the case with $D_n 4000$ separately below. The parameter $R_{\rm deV,r}$, the size of the central galaxy in the $r$-band, results in a comparatively large difference in halo masses for the two subsamples. The clusters with larger BCGs at fixed richness result in a subsample with ${\rm log}_{10}M_h^{\rm high}=14.34\pm 0.03 h^{-1}M_\odot$, while that with smaller BCGs have halo mass ${\rm log}_{10}M_h^{\rm low}=14.21 \pm 0.03 h^{-1}M_\odot$. Albeit at smaller significance, this difference is consistent with the recent study by \cite{song_etal2021} that the outer profiles of massive galaxies are sensitive to halo mass even at fixed richness. \begin{table} \centering \caption{Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm Tinker}$ is the predicted halo bias based on halo mass using the Tinker bias model. The columns $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use two different integral scales $\pi_{\rm max}=50h^{-1}{\rm Mpc}$ and $100h^{-1}{\rm Mpc}$.} \label{tab:bias} \scalebox{0.85}{ \begin{tabular}{ccccc} \hline\hline Parameter & $b_{\rm Tinker}$ & $b_{\rm lens}$ & $b_{\rm clust}(\pi_{\rm max}=50h^{-1}{\rm Mpc})$ & $b_{\rm clust}(\pi_{\rm max}=100h^{-1}{\rm Mpc})$ \\ \hline $D_n 4000$ & $1.00^{+0.03}_{-0.03}$ & $0.69^{+0.12}_{-0.12}$ & $0.94^{+0.03}_{-0.03}$ & $0.93^{+0.08}_{-0.08}$ \\ $H_{\delta}A$ & $1.05^{+0.03}_{-0.03}$ & $1.20^{+0.12}_{-0.12}$ & $1.02^{+0.10}_{-0.10}$ & $1.05^{+0.12}_{-0.12}$ \\ $M_*/L$ & $1.02^{+0.03}_{-0.03}$ & $1.41^{+0.11}_{-0.11}$ & $0.95^{+0.03}_{-0.03}$ & $1.02^{+0.08}_{-0.08}$ \\ age & $0.98^{+0.03}_{-0.03}$ & $0.60^{+0.13}_{-0.13}$ & $0.97^{+0.04}_{-0.04}$ & $1.03^{+0.09}_{-0.09}$ \\ $\sigma_v$ & $1.06^{+0.03}_{-0.03}$ & $0.75^{+0.12}_{-0.12}$ & $0.98^{+0.05}_{-0.05}$ & $0.94^{+0.04}_{-0.04}$ \\ $\mu \times \tau$ & $1.06^{+0.03}_{-0.03}$ & $0.87^{+0.13}_{-0.13}$ & $1.02^{+0.11}_{-0.11}$ & $0.96^{+0.12}_{-0.12}$ \\ $\Gamma_F$ & $1.07^{+0.03}_{-0.03}$ & $1.45^{+0.12}_{-0.12}$ & $1.01^{+0.03}_{-0.03}$ & $1.04^{+0.05}_{-0.05}$ \\ Z & $0.98^{+0.03}_{-0.03}$ & $0.95^{+0.13}_{-0.13}$ & $1.00^{+0.04}_{-0.04}$ & $1.02^{+0.09}_{-0.09}$ \\ $R_{\rm deV,r}$ & $1.14^{+0.03}_{-0.03}$ & $0.92^{+0.14}_{-0.14}$ & $0.96^{+0.05}_{-0.05}$ & $0.90^{+0.09}_{-0.09}$ \\ $(a/b)_{\rm deV,r}$ & $1.07^{+0.03}_{-0.03}$ & $0.89^{+0.15}_{-0.14}$ & $0.98^{+0.05}_{-0.05}$ & $0.95^{+0.07}_{-0.07}$ \\ $\phi_{\rm deV,r}$ & $1.08^{+0.03}_{-0.03}$ & $0.90^{+0.12}_{-0.12}$ & $0.96^{+0.08}_{-0.08}$ & $0.93^{+0.11}_{-0.11}$ \\ $M_*$ & $1.04^{+0.03}_{-0.03}$ & $1.20^{+0.12}_{-0.12}$ & $1.01^{+0.07}_{-0.07}$ & $0.94^{+0.11}_{-0.11}$ \\ \hline \hline \end{tabular} } \end{table} \begin{figure} \centering \includegraphics[width=0.85\textwidth]{bias1.pdf} \caption{\label{fig:bias}Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm Tinker}(M)$ is the predicted halo bias based on halo mass using the Tinker bias model. The symbols $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use $\pi_{\rm max}=100h^{-1}{\rm Mpc}$.} \end{figure} We do not observe significant projection effects among all the parameters we consider. Since central galaxy properties are unlikely to be contaminated by interlopers, we expect the contamination due to the projection effects should not be significant For parameters which show significant differences in halo masses, one could iterate over the sample split criteria and use the weak lensing to ensure subsamples have equal halo mass \citep[see, e.g.,][]{Lin2016}. We leave such investigations for future work. \begin{table}[h!] \centering \caption{Bias ratio for the subsamples split by the central galaxy properties. $b_{\rm lens}$ and $b_{\rm clust}$ are the halo biases measured from lensing and clustering, respectively. For the bias ratio measured from clustering, we use several different scales to fit. Note that the unit for $R$ is $[h^{-1}{\rm Mpc}]$.} \label{tab:bias_scale} \scalebox{0.85}{ \begin{tabular}{ccccc} \hline\hline Parameter & $b_{\rm lens}$ & $b_{\rm clust}:R \in [10,50]$ & $b_{\rm clust}:R \in [5,50]$ & $b_{\rm clust}:R \in [2,50]$ \\ \hline $M_*$ & $1.20^{+0.12}_{-0.12}$ & $0.94^{+0.11}_{-0.11}$ & $0.98^{+0.09}_{-0.09}$ & $0.91^{+0.09}_{-0.09}$ \\ \hline $D_n 4000$ & $0.69^{+0.12}_{-0.12}$ & $0.93^{+0.08}_{-0.08}$ & $0.91^{+0.08}_{-0.08}$ & $0.89^{+0.08}_{-0.08}$ \\ \hline $M_*/L$ & $1.41^{+0.11}_{-0.11}$ & $1.02^{+0.08}_{-0.08}$ & $1.10^{+0.08}_{-0.08}$ & $1.04^{+0.08}_{-0.08}$ \\ \hline age & $0.60^{+0.13}_{-0.13}$ & $1.03^{+0.09}_{-0.09}$ & $0.94^{+0.09}_{-0.09}$ & $0.96^{+0.09}_{-0.09}$ \\ \hline $\Gamma_F$ & $1.45^{+0.12}_{-0.12}$ & $1.04^{+0.05}_{-0.05}$ & $1.12^{+0.06}_{-0.06}$ & $1.06^{+0.07}_{-0.07}$ \\ \hline \hline \end{tabular} } \end{table} Finally, we also comment on the consistency of bias ratios of sub-samples between lensing and clustering, which appear consistent for most of the properties. The parameters $M_*/L$, $age$ and $\Gamma_F$ show that the bias ratio measured from clustering is almost one, while the bias ratio measured from lensing for these parameters shows more than $30\%$ gap between the two subsamples. It is not clear what causes this difference. We cross-check if this difference could result from the choice of scale for clustering. We measure the bias ratio on several different scales using the clustering as shown in Table~\ref{tab:bias_scale}. However, we do not see significant differences in the biases measured from the different scales. Another possibility is our choice of cosmology; the amplitude of lensing can be lower than that of clustering by assuming a \textit{Planck} cosmology \citep{amon_etal2022}. The difference between lensing and clustering amplitudes can be $\sim 20\%$. However, if this inconsistency persists on both subsamples, taking the ratio should cancel out. We could potentially investigate this issue using shape measurements from the Hyper Suprime Cam SSP (HSC) survey \citep{li_etal2022} due to its deeper photometry and better image quality than the SDSS source catalogue. We select all the source galaxies behind the lens galaxies in the current work. However, due to the shallow depth of SDSS, we cannot completely rule out source-cluster member confusion. We will leave the investigation of such effects to future work. \begin{figure}[h!] \centering \includegraphics[width=0.8\textwidth]{lum_Dn4000.contour.pdf} \caption{\label{fig:triangle_dn4000} Posterior constraint from the modelling of $\Delta \Sigma(R)$ for the high-$D_n 4000$ (blue) and low-$D_n 4000$ (green) subsamples. Each histogram in the diagonal panels are the 1D marginalised posterior distribution of the parameters, while each contour plot in the off-diagonal panels indicate the 1$\sigma$ and 2$\sigma$ confidence regions of the matching parameter pairs.} \end{figure} Finally, we focus on the results for the subsamples split by $D_n 4000$. Fig.~\ref{fig:triangle_dn4000} shows the derived posterior constraints of our model parameters for the high-$D_n 4000$ (blue) and low-$D_n 4000$ (green) subsamples, similar to Fig.~\ref{fig:triangle_mstar}. The parameter $D_n 4000$, which is a measure of the flux break at the 4000 $\text{\normalfont\AA}$ break strength, is sensitive to the average of the stellar population and is a good tracer of the long-term star formation histories (e.g., \cite{paulino-afonso_etal2020}). The mean halo masses of the high-$D_n 4000$ and low-$D_n 4000$ subsamples are almost equal, and the corresponding halo biases from lensing for these subsamples are different by $\sim 40\%$ (although the bias ratio is consistent with unity at less than 3 $\sigma$). At last, we compare the bias ratio measured from lensing and clustering. While the bias ratio from lensing is $\sim 40\%$, the one from clustering is $\sim 5\%$. Therefore, we cannot plausibly claim that subsamples split by $D_n 4000$ show halo assembly bias. \section{Conclusions} Halo assembly bias is the correlation between the large scale clustering of halos and secondary properties of the halos at fixed mass. It has been studied extensively using numerical simulations but has been difficult to confirm in observations. In this paper, we have searched for signs of halo assembly bias based on the central galaxy properties of SDSS redMaPPer clusters. Our research work can be summarized as follows: \begin{itemize} \item We used 12 different properties of the central galaxies in SDSS redMaPPer clusters derived from the analysis of their SDSS spectra by \citet{Chen_etal2012}. We subdivided redMaPPer clusters using the median of the relationship between these parameters and the cluster richness. \item We measured the weak lensing signals for each cluster sub-samples and modelled it to infer the average halo mass of these sub-samples and their large scale biases from the cluster weak lensing signal. \item We also measured the cross-correlations between galaxy clusters and spectroscopic galaxies from SDSS to obtain a higher signal-to-noise ratio estimate for the large scale clustering. \item For sub-samples obtained by using ten out of the twelve properties we considered, the halo masses are consistent with each other within 2$\sigma$. We computed the theoretically expected ratios of biases based on the halo mass estimates for all sub-sample splits. \item The halo bias ratios of each sub-samples as obtained by the cross-correlations and the expectations based on halo mass difference are consistent with each other. \item We do not see significant evidence of contamination by projection effects in sub-sample splits based on central galaxy properties. \end{itemize} In addition to the above findings, we also find some cases, albeit at low significance, where the bias ratio measured from the lensing signal differs from the ratio measured from clustering for some parameters. Such inconsistencies between lensing and clustering signals require further investigation as they could potentially signal issues in the contamination of clusters. In future work, we will use the shape catalogue from the HSC survey \citep{li_etal2022}, which overlaps with the footprint of the redMaPPer clusters. \section*{Acknowledgements} We thank Eduardo Rozo and Elisabeth Krause for their suggestions. TS is supported by Grant-in-Aid for JSPS Fellows 20J01600 and JSPS KAKENHI Grant Number 20H05855. HM is supported by JSPS KAKENHI Grant Numbers JP21H05456. Funding for SDSS-III has been provided by the Alfred P. Sloan Foundation, the Participating Institutions, the National Science Foundation, and the U.S. Department of Energy Office of Science. The SDSS-III web site is \url{http://www.sdss3.org/.} SDSS-III is managed by the Astrophysical Research Consortium for the Participating Institutions of the SDSS-III Collaboration including the University of Arizona, the Brazilian Participation Group, Brookhaven National Laboratory, Carnegie Mellon University, University of Florida, the French Participation Group, the German Participation Group, Harvard University, the Instituto de Astrofisica de Canarias, the Michigan State/Notre Dame/JINA Participation Group, Johns Hopkins University, Lawrence Berkeley National Laboratory, Max Planck Institute for Astrophysics, Max Planck Institute for Extraterrestrial Physics, New Mexico State University, New York University, Ohio State University, Pennsylvania State University, University of Portsmouth, Princeton University, the Spanish Participation Group, University of Tokyo, University of Utah, Vanderbilt University, University of Virginia, University of Washington, and Yale University.
\section{Introduction} In the past few decades, many solutions of integrable equations have been studied, including soliton solutions, breather solutions, rogue wave solutions and so on\cite{VAE-1978-ZETF,KN-1978-JMP,VAK-1989-PD,LB-2020-ND,ZL-2013-PRE}. These solutions are obtained by classical inverse scattering method, Riemann-Hilbert method under the condition of no reflection\cite{JH-2018-JNMP,YB-2019-NAR,LT-2022-NAR}. However, for continuous spectrum or reflection, it is necessary to analyze the asymptotic behavior of the solution. In fact, as early as 1973, Manakov et al. first studied the long-time asymptotic behavior of the solution of the fast decay initial value problem for nonlinear integrable systems by using the inverse scattering method\cite{M-1974-SPJ,AN-1973-JMP}. In 1976, Zakharov and Manakov gave the first term asymptotic expression that the solution of the initial value problem for nonlinear Schr\"{o}dinger (NLS) equation which depends explicitly on the initial value \cite{ZM-1976-SPJ}. In 1981, Its transformed the long-time behavior of the solution for the initial value problem of the NLS equation into the local Riemann-Hilbert problem(RHP) in the small neighborhood of the steady-state phase point by using the single value deformation theory, which provided a set of feasible and strict ways to analyze the long-term behavior of the integrable equation\cite{Its-1981-DAN}. In 1993, Deift and Zhou developed the nonlinear descent method for solving oscillatory RHP based on the classical descent method, and studied the asymptotic properties of the solution for mKdV equation with decaying initial value \cite{DZ-1993-AM}. Since then, more and more scholars have paid attention to the nonlinear descent method to study the long-time asymptotic behavior of the solution for the initial value problem of integrable systems, and many equations have been studied by this method \cite{XD-1994-UT,KG-2009-MPAG,AD-2013-N,PJ-1999-CPDE,LJ-2018-JDE,JE-2015-JDE,XFC-2013-MPAG,AA-2009-JMA}. Later, McLaughlin and Miller extended the classical Deift-Zhou steepest descent method to Dbar steepest descent method, which was successfully used to study the asymptotic stability of NLS multiple soliton solutions \cite{MM-2006-IMRN,MM-2008-IMRN,DM-2019-FIC}, and the long-time proximity of KdV equation and NLS equation \cite{SR-2016-CMP,MR-2018-AN,RJ-2018-CMP,LP-2018-AI,P-2017-N}. TheDbar steepest descent method is to transform the discontinuous part on the jump line into the form of Dbar problem, rather than the analysis of the asymptotic properties of orthogonal polynomials in singular integrals on the jump line. Then it became a more powerful tool in the study of long-time asymptotic for integrable equations, such as NLS equation \cite{DM-2019-N}, the Hirota equation \cite{YTL-2021-ar}, the Fokas-Lenells equation \cite{CF-2022-JDE}, the modified Camassa-Holm equation \cite{YF-2022-AM}, the short-pulse equation \cite{YF-2021-JDE} and so on. The coupled dispersion AB system \cite{JD-1979-PRSL} \begin{equation}\label{AB} \begin{array}{l} A_{x t}-\alpha A-\beta A B=0, \\ B_{x}+\frac{\gamma}{2}\left(|A|^{2}\right)_{t}=0, \end{array} \end{equation} describes the evolution of micro stable or unstable wave packets in baroclinic shear flow through a quasi geostrophic two-layer model on a beta-plane, where $A\equiv A(x,t)$ is the complex function representing the amplitude of the data packet, the real function $B\equiv B(x,t)$ is the measure of the average flow change caused by the baroclinic wave packet, and $\alpha$ represents the critical situation of shear and the real parameter $\beta,\gamma$ represent the nonlinear coefficient. And system (\ref{AB}) meets the following compatibility condition: $$ \frac{\gamma}{\beta}\left|A_{t}\right|^{2}+B^{2}+\frac{2 \alpha}{\beta} B=f(t), $$ where $f(t)$ is an integral function of time. If $A(x, t)=1 / \sqrt{\beta \gamma} \psi_{x}(x, t)$ and $B(x,t)=\pm[\cos (\psi(x, t))-\alpha] / \beta \text { with } \beta \gamma>0$, system (\ref{AB}) can reduce to $\psi_{x t}=\pm \sin \psi.$ If $A(x, t)=1 / \sqrt{-\beta \gamma} \psi_{x}(x, t)$ and $B(x,t)=\pm[\cos (\psi(x, t))-\alpha] / \beta \text { with } \beta \gamma<0$, system (\ref{AB}) can reduce to $\psi_{x t}=\pm \sinh \psi.$ In recent years, many studies have been done for system (\ref{AB}). For example, the soliton solutions of system (\ref{AB}) are obtained by the inverse scattering method \cite{JD-1979-PS}. Kamchatnov and Pavlov found the periodic wave solution of system (\ref{AB})\cite{AM-1995-JPA}. Guo et al. have studied its classical Darboux transformation(DT) and N-flod DT and obtained breather solutions and multi-soliton solutions \cite{GR-2013-ND,GL-2015-AMC}. The rogue wave solution of system (\ref{AB}) was also obtained by generalized DT under the condition $\alpha=0, \beta=\gamma=1,f(t)=1$\cite{WX-2015-CN}. In addition, the high-order strange wave and modulation instability of system (\ref{AB}) were further given via generalized DT \cite{WY-2015-CHAOS}. Recently, Yan et al. studied the long-time asymptotic behavior of solutions whose initial values belong to Schwarz space through the classical Deift-Zhou descent method \cite{SZ-2021-JMAA}. In this paper, we mainly study the long-time asymptotic behavior of the solution of system (1) satisfying the following initial value problem $$ A{(x,0)}=A_0(x)\in H^{1,1}(\mathbb{R}), B{(x,0)}=B_0(x)\in H^{1,1}(\mathbb{R}), $$ where $H^{1,1}(\mathbb{R})$ is the weighted Sobelev space, its expression is $$ H^{1,1}(\mathbb{R})=\left\{f(x) \in L^{2}(\mathbb{R}): f^{\prime}(x), x f(x) \in L^{2}(\mathbb{R})\right\}. $$ The main tool used here is the Dbar steepest descent method. Compared with Deift-Zhou steepest descent method, Dbar method avoids estimating Cauchy integral operator in $L^P$ space and rewrites the discontinuous part of RHP into Dbar problem which can be solved by integral equation. Compared with previous studies \cite{SZ-2021-JMAA}, we consider the initial value in a wider space instead of in Schwarz space and allow the existence of soliton solutions. The context of this paper is as follows: In section 2, we analyze the spectrum of the system (\ref{AB}) based on Lax pair. The analyticity, symmetry and asymptotic behavior of characteristic function and scattering matrix are studied. In terms of asymptotic behavior, two singular points $k=0$ and $k=\infty$ need to be considered. We also prove that when the initial value belongs to weighted Sobelev space, $r(k)$ belongs to $H^{1,1}(\mathbb{R})$. In section 3, the RHP of system (\ref{AB}) is constructed by the piecewise smooth property of matrix $M(x,t)$. In section 4, we prove the existence and uniqueness of the solution of RHP by using vanishing lemma. In section 5, by introducing $T(k)$ function, we change $M(x,k)$ into $M^{(1)}(x,k)$ and get a new RHP about $M^{(1)}(x,k)$. This is mainly to allow the jump matrix near the phase points to have two triangular decomposition. In section 6, the contour is deformed near the phase points, and a mixed $\bar{\partial}$-RHP is obtained by defining $\mathcal{R}^{(2)}$. In section 7, we decompose the mixed $\bar{\partial}$-RHP into a model RHP of $M_{rhp}(k)$ and the pure $\bar{\partial}$ problem of $ M^{(3)}(k)$. In section 8, the RHP about $M_{rhp}(k)$ is studied and the long-time behavior of the soliton solution is analyzed. It is obtained that the soliton solution can be represented by a ring region, and the applicability near the phase points is also explained. Secondly, the error function is calculated with RHP of a small norm. In section 9, the pure $\bar{\partial}$ problem for $M^{(3)}(k)$ is analyzed. In section 10, using the above deformation and results, Eq.(\ref{mt}) is obtained, and then the long-time behavior of the solution of the coupled dispersion AB system (\ref{AB}) in the case of weighted Sobelev initial value is obtained, which is given in the form of theorem. \section{The spectral analysis} System (\ref{AB}) has Lax pair is \cite{JD-1981-PRSLA} \begin{equation} \begin{array}{l} \phi_{x}=\hat{U} \phi=\left(\begin{array}{cc} -i k & \frac{\sqrt{\beta \gamma}}{2}A \\ -\frac{\sqrt{\beta \gamma}}{2} {A}^{*} & i k \end{array}\right) \phi, \\ \phi_{t}=\hat{V} \phi=\left(\begin{array}{cc} \frac{i(\alpha+\beta B)}{4 k} & -\frac{i \sqrt{\beta \gamma}}{4 k} A_{t} \\ -\frac{i \sqrt{\beta \gamma}}{4 k}{A}^{*}_{t} & -\frac{i(\alpha+\beta B)}{4 k} \end{array}\right) \phi. \end{array} \end{equation} In order to better facilitate the presentation of the results, we mainly consider the case of $\beta\gamma=1$. At this time, the Lax pair of Eq.(\ref{AB}) can be simplified to \begin{equation} \Phi_{x}=X\Phi, ~~~\Phi_{t}=T\Phi,\label{lax} \end{equation} where \begin{equation} \begin{array}{l} X=-ik\sigma_3+U,~~~~ T= \frac{i\alpha}{4k} \sigma_{3}+T_1, \end{array} \end{equation} with \begin{equation} \begin{array}{l} \sigma_{3}=\left[\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array}\right], \quad U(x,t)=\frac{1}{2}\left(\begin{array}{cc} 0 & A \\ -A^{*} & 0 \end{array}\right), \quad T_1(x, t, k)=\frac{i}{4 k}\left(\begin{array}{cc} \beta B & -A_{t} \\ -{A}^{*}_{t} & - \beta B \end{array}\right). \end{array} \end{equation} The spectral parameter $k\in \mathbb{C}$, under the rapidly decaying initial condition $$ A_{0}(x),B_0(x) \rightarrow 0 \quad \text {as} \quad x \rightarrow \infty, $$ make the following correction transformation \begin{equation} \Phi=\Psi e^{-ikx\sigma_3+ \frac{i\alpha}{4k}t\sigma_3},\label{pp} \end{equation} the modified Lax pair can be obtained \begin{equation} \begin{aligned}\label{ut} \Psi_{x}+i k\left[\sigma_{3}, \Psi\right] &=U \Psi, \\ \Psi_{t}-\frac{i\alpha}{4k}\left[\sigma_{3}, \Psi\right] &=T_1 \Psi, \end{aligned} \end{equation} which can be written in full derivative form $$ d(e^{i\left(k x-\frac{\alpha}{4k} t\right)\widehat{\sigma}_{3}} \Psi(x, t, k))=e^{i\left(k x-\frac{\alpha}{4k} t\right)\widehat{\sigma}_{3}}[Udx+T_1dt)\Psi]. $$ From the above Lax pair (\ref{ut}), we can see that it has two singular points $k = 0$ and $k = \infty$. Therefore, we need to investigate the different expansion forms of the characteristic function at two singular points. After simple calculation, the following form is obtained $$ \begin{aligned} &\Psi(x, t, k)=I+\frac{\Psi^1}{k}+\mathcal{O}\left(k^{-2}\right), \quad k \rightarrow \infty, \\ &\Psi(x, t, k)=\Psi^{0}+\Psi^{1}k+\mathcal{O}\left(k^2\right), \quad k \rightarrow 0, \end{aligned} $$ where \begin{equation}\label{po} \Psi^{0}(x,t)=\left(\begin{array}{cc} e^{\frac{1}{2}\int_{-\infty}^{x}\frac{\beta A B}{A_t}dx} & e^{\frac{1}{2}\int_{x}^{\infty}\frac{ AA^{*}_t }{\beta B }dx} \\ e^{\frac{1}{2}\int_{x}^{\infty}\frac{ A^{*}A_t }{\beta B }dx} & e^{\frac{1}{2}\int_{-\infty}^{x}\frac{\beta A^{*} B}{A^{*}_t}dx} \end{array}\right), \Psi^1_{12}=-\frac{i}{4}A, \Psi^1_{21}=-\frac{i}{4}A^{*}. \end{equation} The asymptotic solution $\Psi(x,t,k)$ satisfies $$ \Psi_{\pm}(x, t, k) \rightarrow I, \quad x \rightarrow \pm \infty, $$ the modified solution satisfies the following integral equation \begin{equation} \Psi_{\pm}(x, t, k)=I+\int_{\pm \infty}^{x} \mathrm{e}^{-i k(x-y) \sigma_{3}} U(y, t) \Psi_{\pm}(y, t, k) \mathrm{e}^{i k(x-y) \sigma_{3}} \mathrm{~d} y.\label{jost} \end{equation} Dividing $\Psi_{\pm}$ into columns as $\Psi_{\pm}=\left(\Psi_{\pm}^{(1)}, \Psi_{\pm}^{(2)}\right)$, due to the structure of the potential $U$, and Volterra integral equation (\ref{jost}), we have \begin{proposition} For $A(x),B(x) \in H^{1,1}(\mathbb{R})$ and $t \in \mathbb{R}^{+}$, there exist unique eigenfunctions $\Psi_{\pm}$ which satisfy Eq.(\ref{jost}), respectively, and have the following properties: $\bullet$ $\text{det} \Psi_{\pm}(x,t,k)=1, x, t \in \mathbb{R}$; $\bullet$ $\left[\Psi_{-}\right]_{1},\left[\Psi_{+}\right]_{2}$ are analytic in $\mathbb{C}^{+}$ and continuous in $\mathbb{C}^{+}\cup \mathbb{R}$; $\bullet$ $\left[\Psi_{+}\right]_{1},\left[\Psi_{-}\right]_{2}$ are analytic in $\mathbb{C}^{-}$, and continuous in $\mathbb{C}^{-}\cup \mathbb{R}$. \end{proposition} The partition of $\mathbb{C}^{\pm}$ is shown in Fig.\ref{1t}. \begin{figure} \center \begin{tikzpicture}\usetikzlibrary{arrows} \coordinate [label=0: Im $k$] ()at (0,2.8); \coordinate [label=0: Re $k$] ()at (3,-0.2); \coordinate [label=0:] ()at (2,0.1); \coordinate [label=0:] ()at (-2.6,0.1); \path [fill=pink] (-3.5,2.5)--(3.5,2.5) to (3.5,0)--(-3.5,0); \coordinate [label=0: $\mathbb{C}^{+}$] ()at (1,1); \coordinate [label=0: $\mathbb{C}^{-}$] ()at (1,-1); \draw[->, ] (3,0)--(3.5,0); \draw[->,] (0,2)--(0,2.5); \draw[thin](0,2)--(0,-2.3); \draw[thin](3.5,0)--(-3.5,0); \end{tikzpicture} \caption{\small Definition of the $\mathbb{C}^{+}=\{k \mid \operatorname{Im} k>0\},~\mathbb{C}^{-}=\{k \mid \operatorname{Im} k<0\}$ }\label{1t} \end{figure} It can be seen from the equation that $\Psi_{+}e^{-ikx\sigma_3+ \frac{i\alpha}{4k}t\sigma_3}$ and $\Psi_{-} e^{-ikx\sigma_3+ \frac{i\alpha}{4k}t\sigma_3}$ are the solutions of Lax equation (\ref{jost}), so they are linearly related \begin{equation} \Psi_{-}e^{-ikx\sigma_3+ \frac{i\alpha}{4k}t\sigma_3} =\Psi_{+} e^{-ikx\sigma_3+ \frac{i\alpha}{4k}t\sigma_3}S(t,k), \quad k \in \mathbb{R},\label{ss} \end{equation} where $$ S(t,k)=\left[\begin{array}{rr} s_{11} & s_{12} \\ s_{21} & s_{22} \end{array}\right]. $$ \begin{proposition} $\Psi(x,t,k)$ and $S(t,k)$ satisfy the symmetry relation \begin{equation} \Psi(x,t,k)=\sigma_{0} \Psi^{*}\left(x,t,k^{*}\right)\sigma_{0}^{-1},~~~S(t,k)=\sigma_{0} S^{*}\left(t,k^{*}\right)\sigma_{0}^{-1}, \end{equation} where $$ \sigma_{0}=\left[\begin{array}{rr} 0 & 1 \\ -1 & 0 \end{array}\right]. $$ \end{proposition} \begin{proof} The symmetry of $\Phi$ can be easily obtained from Lax equation $$ \Phi(x,t,k)=\sigma_{0} \Phi^{*}\left(x,t,k^{*}\right)\sigma_{0}^{-1}, $$ then contact transformation (\ref{pp}), which is easy to verify $$ \Psi(x,t,k)=\sigma_{0} \Psi^{*}\left(x,t,k^{*}\right)\sigma_{0}^{-1}. $$ Then according to the relationship (\ref{ss}), there are $$ S(t,k)=\sigma_{0} S^{*}\left(t,k^{*}\right)\sigma_{0}^{-1}. $$ \end{proof} Based on the symmetry condition of $S(k)$, we can get $$ s_{11}(k)=s_{22}^{*}(k^{*}), s_{12}(k)=-s_{21}^{*}(k^{*}). $$ $S(t,k)$ is called scattering matrix and $s_{i,j}(i,j=1,2)$ are usually called scattering data. Moreover, Eq.(\ref{ss}) leads to \begin{equation}\label{s112} s_{11}(k)=\operatorname{det}\left(\left[\Psi_{-}\right]_{1},\left[\Psi_{+}\right]_{2}\right), ~s_{12}(k)=e^{2ikx-\frac{i\alpha}{2k}t} \operatorname{det}\left(\left[\Psi_{-}\right]_{2},\left[\Psi_{+}\right]_{2}\right). \end{equation} On the basis of the properties of $\Psi$ in Proposition 1, we can get \begin{proposition} The scattering matrix $S(t,k)$ and scattering data $s_{11}(k),s_{12}(k)$ satisfies: $\bullet$ $\text{det} S(k)=1, \quad x, t \in \mathbb{R}$; $\bullet$ $|s_{11}(k)|^{2}+|s_{12}(k)|^{2}=1$ for $k \in \mathbb{R}$; $\bullet$ $s_{11}(k)$ is analytic in $\mathbb{C}^{+}$ and continuous in $\mathbb{C}^{+}\cup \mathbb{R} ;$ $\bullet$ $s_{12}(k)$ is continuous on the real $k$; $\bullet$ $s_{11}(k) =1+\mathcal{O}(k^{-1})$ as $k \rightarrow \infty; ~~s_{12}(k) = \mathcal{O}(k^{-1})$ as $k \rightarrow \infty;$ $\bullet$ $s_{11}(k) = \varphi_0+\mathcal{O}(k^2)$ as $k \rightarrow 0; ~~s_{12}(k) =\mathcal{ O}(k^2)$ as $k \rightarrow 0, $ where $\varphi_0=e^{\frac{1}{2}\int_{-\infty}^{\infty}\frac{\beta A^{*}B}{A^{*}_t}dx}-e^{\frac{1}{2}\int_{-\infty}^{\infty}\frac{A^{*} A_t}{\beta B}dx}.$ \end{proposition} The reflection coefficient is described below, which is usually defined as \begin{equation}\label{rk} r(k)=\frac{s_{12}(k)}{s_{11}(k)}, \end{equation} using the first two properties in proposition 3, we have $$ 1+|r(k)|^{2}=\frac{1}{|s_{11}(k)|^{2}}. $$ In order to deal with our future work, we assume that the initial data meets the following assumptions. \begin{assume} The initial data $A,B\in H^{1,1}(\mathbb{R})$ and it generates generic scattering data which satisfy that: $\bullet$ $s_{11}(k)$ has no zeros on $\mathbb{R}$; $\bullet$ $s_{11}(k)$ only has finite number of simple zeros. \end{assume} Based on the above analysis, we can get the following theorem about $r(k)$. \begin{theorem} For any given initial value $A,B\in H^{1,1}(\mathbb{R})$, we have $r(k) \in H^{1,1}(\mathbb{R})$. \end{theorem} \begin{proof} According to the definition of $r(k)$ we have and the asymptotic behavior of $s_{11}$ and $s_{21}$ at singular points in Proposition 3, we can obtain $$ r(k)=\mathcal{O}(k^{-1}),k\rightarrow \infty;~~~~~r(k)=\mathcal{O}(k^{2}),k\rightarrow 0. $$ From the proposition estimation in Appendix A that $$ s_{11}(k), s_{12}(k) \in L^{2}(\mathbb{R}), $$ which lead to $$ r(k) \in L^{2}(\mathbb{R}). $$ In addition, it can also be obtained $s_{11}^{\prime}(k), s_{12}^{\prime}(k) \in L^{2}(\mathbb{R})$. Therefore $$ r^{\prime}(k)=\frac{s_{12}^{\prime}(k) s_{11}(k)-s_{11}^{\prime}(k) s_{12}(k)}{s_{11}^{2}(k)} \in L^{2}(\mathbb{R}). $$ Finally come to the map $A_0,B_0\rightarrow r(k)$ is Lipschitz continuous from $H^{1,1}(\mathbb{R})$ into $H^{1,1}$. \end{proof} \section{The construction of a RHP} Suppose $s_{11}(k)$ has N simple zeros $\mathcal{K}=\left\{k_{j}\right\}_{j=1}^ {N} \subset \mathbb{C}^{+}$, reviewing the symmetry of $S$, we can see that there are also $N$ simple zeros $\mathcal{K}^{*}=\{k_{j}^{*}\}_{j=1}^ {N} \subset \mathbb{C}^{-}$. Then define a meromorphic function $M(x,t,k)$ as \begin{equation} M(x, t, k)=\left\{\begin{array}{ll} \left(\frac{[\Psi_{-}]_{1}}{s_{11}(k)}, [\Psi_{+}]_{2}\right), & k \in \mathbb{C}^{+}, \\ \left([\Psi_{+}]_{1}, \frac{[\Psi_{-}]_{2}}{s_{22}(k)}\right), & k \in \mathbb{C}^{-}, \end{array}\right. \end{equation} which solves the following RHP. \begin{rhp}\label{r1} Find a matrix-valued function $M(x,t,k)$ which satisfies: $\bullet$ Analyticity: $M(x,t,k)$ is meromorphic in $\mathbb{C}\backslash\mathbb{R}$ and has single poles; $\bullet$ Symmetry: $M(x,t,k)=\sigma_{0} M^{*}\left(x,t,k^{*}\right)\sigma_{0}^{-1};$ $\bullet$ Jump condition: $M(x,t,k)$ has continuous boundary values $M_{\pm}(x,t,k)$ on $\mathbb{R}$ and \begin{equation} M_{+}(x, t, k)=M_{-}(x, t, k) V(k), \quad k \in \mathbb{R}, \end{equation} where \begin{equation} V(k)=\left(\begin{array}{cc} 1+|r(k)|^2 & r^{*}(k^{*}) e^{-2 i t \theta(k)} \\ r(k) e^{2 i t \theta(k)} & 1 \end{array}\right);\label{vv} \end{equation} $\bullet$ Asymptotic behaviors: $$ M(x, t, k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty; $$ $\bullet$ Residue conditions: $M$ has simple poles at each point in $k_j\in \mathbb{C}^{+}$ and $k_j^{*}\in \mathbb{C}^{-}$ with: \begin{equation} \begin{array}{l} \operatorname{Res}_{k=k_{j}} M(z)=\lim _{k \rightarrow k_{j}} M(k)\left(\begin{array}{cc} 0 & 0 \\ c_{j} e^{2 i t \theta\left(k_{j}\right)} & 0 \end{array}\right), \\ \operatorname{Res}_{k={k}_{j}^{*}} M(k)=\lim _{k \rightarrow {k}_{j}^{*}} M(k)\left(\begin{array}{cc} 0 & -{c}_{j}^{*} e^{-2 i t \theta\left(k_j^{*}\right)} \\ 0 & 0 \end{array}\right), \end{array} \end{equation} where $\theta=k\frac{x}{t}-\frac{\alpha}{4k},c_{j}=\frac{s_{12}(k_j)}{s_{11}'(k_j)}$. \end{rhp} \underline{}The solution of the coupled dispersion AB system (\ref{AB}) can be expressed by \begin{equation} A= 4 i\lim _{k \rightarrow \infty} (k M)_{12}(x, t, k),~~B=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}(k M)_{11}. \end{equation} \section{Existence and uniqueness of solution of RH problem} In this chapter, we will mainly focus on the existence and uniqueness of the solution of the RH problem constructed above. Our idea here is to use the vanishing lemma to show that the integral equation has only zero solution to the homogeneous equation, and then show that the equation has a unique solution. In order to facilitate the application of the subsequent lemma, we focus all the residue conditions in RHP \ref{r1} on the circle $\{ \kappa_j,\kappa^{*}_j\}$ centered on the pole $\{k_j\in \mathbb{C}^{+},k^{*}_j\in\mathbb{C}^{-}\}$. As long as these circles are small enough, they will not intersect. See Fig. \ref{2t} for details. \begin{figure}[htpb] {\includegraphics[width=6.9cm,height=5.5cm]{yuan.jpg}} \centering \caption{\small Distribution of $\Sigma^{(1)}$.}\label{2t} \end{figure} Let $$ \Sigma^{(1)}=\mathbb{R}\cup \left\{\kappa_{j}\right\}_{j=1}^{ N} \cup\left\{\kappa^{*}_{j}\right\}_{j=1}^{ N}, $$ and rewrite RHP \ref{r1} as follows: \begin{rhp}\label{r111} Find a matrix-valued function $M(x,t,k)$ which satisfies: $\bullet$ Analyticity: $M(x,t,k)$ is analytic in $\mathbb{C}\backslash\Sigma^{(1)}$; $\bullet$ Symmetry: $M(x,t,k)=\sigma_{0} M^{*}\left(x,t,k^{*}\right)\sigma_{0}^{-1};$ $\bullet$ Jump condition: $M(x,t,k)$ has continuous boundary values $M_{\pm}(x,t,k)$ on $\Sigma^{(1)}$ and \begin{equation}\label{v1} M_{+}(x, t, k)=M_{-}(x, t, k) V^{\prime}(k), \quad k \in \mathbb{R}, \end{equation} where \begin{equation} V^{\prime}(k)= \begin{cases}\left(\begin{array}{ll} 1+|r(k)|^{2} & r^{*}(k^{*}) e^{-2 i k x} \\ r(k) e^{2 i k x} & 1 \end{array}\right), & k \in \mathbb{R}, \\ \left(\begin{array}{cc} 1 & 0 \\ \frac{c_{j} e^{2 i k x}}{k-k_{j}} & 1 \end{array}\right), & k \in \kappa_{j}, \\ \left(\begin{array}{cc} 1 & \frac{{c}^{*}_{j} e^{-2 i k x}}{k-{k}^{*}_{j}} \\ 0 & 1 \end{array}\right), & k \in \kappa^{*}_{j};\end{cases} \end{equation} $\bullet$ Normalization: $$ \begin{aligned} &(a)~~M(k,x)=I+\mathcal{O}\left(k^{-1}\right),\quad k \rightarrow \infty,\\ &(b)~~ M(k,x)=\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty.\\ \end{aligned} $$ \end{rhp} Here, we deliberately turn $t$ into a gray variable, mainly to better show the importance of $x$ in the proof process. In normalization (a) is mainly to reconstruct the potential $A,B$. The role of (b) is to illustrate the existence and uniqueness of solutions to the RHP of type (a). As we all know, $V^{\prime}(k)$ has the following decomposition $$ V^{\prime}(k)=\left(I-\Lambda^{-}\right)^{-1}\left(I+\Lambda^{+}\right). $$ Bring it into (\ref{v1}) and define it as $\omega$ \begin{equation}\label{w1} \omega=M_{+}\left(I+\Lambda^{+}\right)^{-1}=M_{-}\left(I-\Lambda^{-}\right)^{-1}, \end{equation} the above formula can be rewritten as $$ M_{+}-M_{-}=\omega(\Lambda^{+}+\Lambda^{-}). $$ Using Plemelj formula, it is easy to give the solution of solvable RHP(\ref{r111}) equation with regularized boundary (a) in the form of \begin{equation} M(x, k)=I+\frac{1}{2\pi i} \int_{\Sigma^{(1)}} \frac{\omega(\Lambda^{+}+\Lambda^{-})}{s-k} d s, \end{equation} the solution of the equation with boundary condition (b), \begin{equation}\label{mb} M(x, k)=\frac{1}{2\pi i} \int_{\Sigma^{(1)}} \frac{\omega(\Lambda^{+}+\Lambda^{-})}{s-k} d s. \end{equation} The following main task is to prove that the solution with boundary condition (b) tends to 0, that is, Eq.(\ref{mb}) tends to 0, which is also obvious. Write $M(x,k)$ expansion as \begin{equation}\label{mr} M(x, k)=\frac{1}{2\pi i} \left(\int_{\mathbb{R}} \frac{\omega(\Lambda^{+}+\Lambda^{-})}{s-k} d s+\int_{\Sigma^{(1)}\backslash \mathbb{R}} \frac{\omega(\Lambda^{+}+\Lambda^{-})}{s-k}d s\right). \end{equation} Here we define $$ \mathcal{N}(k)=M(k) M({k}^{*})^{H}, $$ where $'H'$ represents conjugate transpose of the matrix, and we only need to prove \begin{equation}\label{n1} \int_{\mathbb{R}} \mathcal{N}_{\pm}(k) d k=0 \end{equation} below. Obviously, according to Schwartz's reflection principle, $\mathcal{N}$ is analytical in $\mathbb{C}\backslash \Sigma^{(1)}$. For $k\in \mathbb{R}$, we have $$ \mathcal{N}_{+}(k)=M_{+}(k)M_{-}(k)^{H}=M_{-}(k) V^{\prime}(k) M_{-}(k)^{H}, $$ $$ \mathcal{N}_{-}(k)=M_{-}(k) M_{+}(k)^{H}=M_{-}(k) V^{\prime}(k)^{H} M_{-}(k)^{H}. $$ Therefore, if Eq.(\ref{n1}) is satisfied, there is $$ \int_{\mathbb{R}} M_{-}(k)\left(V^{\prime}(k)+V^{\prime}(k)^{H}\right) M_{-}(k)^{H}=0, $$ since $k\in \mathbb{R}$, so $V^{\prime}(k)=V^{\prime}(k)^{H}$. Then we know that $V^{\prime}(k)+V^{\prime}(k)^{H}$ is also an Hermite and is positive definite. Therefore, if the above formula holds, there must be $M_{-}(k)=0$ on $\mathbb{R}$. So $$ M_{+}(k)=M_{-}(k) V^{\prime}(k)=0, ~~~~~k \in \mathbb{R}. $$ According to Morera's theorem, we know that $M(k)$ is analytic in the neighborhood of each point on $\mathbb{R}$. And $M(k)$ tends to disappear. For $k\in \Sigma^{(1)}\backslash \mathbb{R}$. then we have $$ \begin{aligned} \mathcal{N}_{+}(k)&=M_{+}(k) M_{-}(k^{*})^{H}=M_{-}(k) V^{\prime}(k)\left(\mathcal{N}_{-}(k^{*})^{-1}\right)^{H} M_{+}(k^{*})^{H} \\ &=M_{-}(k) M_{+}(k^{*})^{H}=\mathcal{N}_{-}(k). \end{aligned} $$ Similarly, it can be seen from the Morera's theorem that $\mathcal{N}(k)$ is analytic in $\Sigma^{(1)}\backslash \mathbb{R}$. And $M_{\pm}(x, \cdot) \in L^{2}(\mathbb{R})$, we know that $\mathcal{N}(k)$ is integrable. According to the integral form of Eq.(\ref{mr}), $$ \begin{aligned} M(x, k)&=\frac{1}{2\pi i} \int_{\Sigma^{(1)}\backslash \mathbb{R}} \frac{\omega(\Lambda^{+}+\Lambda^{-})}{s-k}d s\\ &=\frac{1}{2 k \pi i} \int_{\Sigma^{(1)}\backslash \mathbb{R}} \frac{s}{s-k} \omega(x, s)\left(\Lambda^{+}+\Lambda^{-}\right) d s-\frac{1}{2 k \pi i} \int_{\Sigma^{(1)}\backslash \mathbb{R}}\omega(x, s)\left(\Lambda^{+}+\Lambda^{-}\right) d s, \end{aligned} $$ the Taylor expansion of $k$ shows that $M(x, k) \sim \mathcal{O}\left(k^{-1}\right), k \in \mathbb{C} \backslash \mathbb{R}$. And then we know that $\mathcal{N}(k) \sim \mathcal{O}\left(k^{-2}\right), k \in \mathbb{C} \backslash \mathbb{R}$. Then the Eq.(\ref{n1}) can be obtained by Cauchy's integral theorem and Jordon's theorem. We can apply the same argument $k\in \mathbb{R}$ to $k\in \Sigma^{(1)}\backslash \mathbb{R}$, and we can also get $M(x, k)=0$. Therefore, it is concluded that $M(x, k)=0$ is on the whole complex plane. So using the vanishing lemma and Fredholm alternative theorem can get the following proposition. \begin{proposition} Assuming that the initial date $A,B \in H^{1,1}(\mathbb{R})$, then the RHP(\ref{r111}) with normalization boundary condition (a) has a unique solution $M(x, k)$. \end{proposition} \section{Conjugation} Through the form of the jump matrix and the residual condition, it can be found that the long-term asymptotic of RHP1 is affected by the growth and attenuation of the exponential function $e^{\pm2 i t \theta(k)}$. Therefore, it is necessary to deal with the jump matrix in Eq. (\ref{vv}) and the oscillation term in the residual condition, and decompose the jump matrix according to the sign change graph of $Re(i\theta)$ to ensure that any jump matrix is bounded in a given area. We further rewrite $\theta$ in the form $$ \theta=-\frac{\alpha k}{4k_0^2}-\frac{\alpha}{4k}=-\frac{\alpha}{4}(\frac{k}{k_0^2}+\frac{1}{k}), $$ which leads to \begin{equation}\label{itheta} Re(i\theta)=\frac{Im(k)\alpha}{4}(\frac{1}{k_0^2}-\frac{1}{|k|^2}). \end{equation} For convenience, we mainly consider $\alpha x<0,t>0$,and can be treated similarly for $t<0$. Without losing generality, it can be assumed that $\alpha<0$ and $x>0$. Based on this, we find two phase points of function $\theta(k)$ are $\pm k_0$, where $k_0=\sqrt{-\frac{\alpha t}{4 x}}$. According to the sign change of $Re(i\theta)$, the attenuation region of oscillation term $e^{2\pm it\theta}$ can be obtained when $t\rightarrow\infty$. which is shown in Fig. \ref{3t}. \begin{figure}[htpb] \centering {\includegraphics[height=0.4\textwidth]{ex.jpg}} ~~~~~~~~~~~~\caption{\small Decay domains of exponential oscillatory terms.}\label{3t} \end{figure} The jump matrix $V(k)$ in RHP1 has the following decomposition $$ V(k)=\left(\begin{array}{cc} 1 & {r}^{*}(k^{*}) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right)\left(\begin{array}{cc} 1 & 0 \\ r(k) e^{2 i t \theta} & 1 \end{array}\right),~~~ |k|>k_0, $$ and $$ V(k)=\left(\begin{array}{cc} 1 & 0 \\ \frac{r(k)}{1+|r(k)|^{2}} e^{2 i t \theta} & 1 \end{array}\right)\left(\begin{array}{cc} 1+|r(k)|^{2} & 0 \\ 0 & \frac{1}{1+|r(k)|^{2}} \end{array}\right)\left(\begin{array}{cc} 1 & \frac{{r}^{*}(k^{*})}{1+|r(k)|^{2}} e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), |k|<k_0. $$ In order to remove the diagonal matrix in the second decomposition, we introduce a scalar RHP about $\delta(k)$ by using the method in Ref. \cite{CF-2022-JDE}. \begin{rhp}\label{brh} Find a scalar function $\delta(k)$ which satisfies: $\bullet$ $\delta(k)$ is analytic in $\mathbb{C}\backslash\mathbb{R}$; $\bullet$ $ \delta_{+}(k)=\delta_{-}(k)\left(1+|r(k)|^{2}\right), \quad |k|<k_0;$ ~~$\delta_{+}(k)=\delta_{-}(k), \quad |k|>k_0 $; $\bullet$ $\delta(k) \rightarrow 1, \quad \text { as } k \rightarrow \infty.$ \end{rhp} Using the Plemelij formula, it is easy to write the unique solution of the above RHP \ref{brh} as \begin{equation} \delta(k)=\exp \left[i \int_{-k_0}^{k_0} \frac{\nu(s)}{s-k} d s\right], \end{equation} where $\nu(s)=-\frac{1}{2 \pi} \log \left(1+|r(s)|^{2}\right)$. The trace formula can be given directly according to the calculation \begin{proposition} \begin{equation} s_{11}(k)=\prod_{j=1}^{N} \frac{k-k_{j}}{k-{k}^{*}_{j}} \exp \left[-i \int_{-\infty}^{+\infty} \frac{\nu(z)}{z-k} d z\right], \end{equation} \begin{equation} s_{22}(k)=\prod_{j=1}^{N} \frac{k-{k}^{*}_{j}}{k-k_{j}} \exp \left[i \int_{-\infty}^{+\infty} \frac{\nu(z)}{z-k} d z\right]. \end{equation} \end{proposition} \begin{proof} From the above, we know that $s_{11}(k)$ and $s_{22}(k)$ are analytic on $\mathbb{C}^{+}$ and $\mathbb{C}^{-}$ respectively, and according to the assumption, the discrete zeros of $s_{11}(k)$ and $s_{12}(k)$ are $k_j$ and $k^{*}_j$ respectively, so let \begin{equation} \beta^{+}(k)=s_{11}(k) \prod_{j=1}^{N} \frac{k-{k}^{*}_{j}}{k-k_{j}}, \quad \beta^{-}(k)=s_{22}(k) \prod_{j=1}^{N} \frac{k-k_{j}}{k-{k}^{*}_{j}},\label{s22} \end{equation} they are still analytic on $\mathbb{C}^{+}$, $\mathbb{C}^{-}$, but they no longer have zeros. And have $\beta^{+}(k) \beta^{-}(k)=s_{11}(k) s_{22}(k), k \in \mathbb{R}.$ It can be obtained that $$ \beta^{+}(k) \beta^{-}(k)=s_{11} s_{22}=\frac{1}{1+|r(k)|^{2}}, \quad k \in \mathbb{R} $$ through $$ \operatorname{det} S(k)=s_{11}(k) s_{22}(k)-s_{21}(k) s_{12}(k)=1, $$ which can leads to that $$ \log \beta^{+}(k)-\left(-\log \beta^{-}(k)\right)=-\log \left(1+|r(k)|^{2}\right), \quad k \in \mathbb{R} $$ using Plemelj formula, we can get \begin{equation} \beta^{\pm}(k)=\exp \left(\pm i \int_{-\infty}^{\infty} \frac{\nu(z)}{z-k} d z\right), \quad k \in \mathbb{C}^{\pm}.\label{s11} \end{equation} Therefore, the trace formula can be obtained by bringing Eq.(\ref{s11}) into (\ref{s22}). \end{proof} Next, for the convenience of follow-up research, we first introduce some notations \begin{equation} \begin{array}{l} \Delta_{k_{0}}^{+}=\left\{j \in\{1, \ldots, N\} \mid |k_j|>k_0 \right\}, \\ \Delta_{k_{0}}^{-}=\left\{j \in\{1, \ldots, N\} \mid |k_j|<k_0\right\}.\\ \end{array} \end{equation} In addition, the function is introduced \begin{equation} T(k)=\prod_{j \in \Delta_{k_0^{-}}} \frac{k-{k}^{*}_{j}}{k-k_{j}} \delta(k).\label{tk} \end{equation} \begin{proposition} The function $T(k)$ defined by Eq.(\ref{tk}) has the following properties: $\bullet$ $T(k)$ is meromorphic function in $\mathbb{C}\backslash(-k_0,k_0)$. For $j\in\Delta_{k_{0}}^{-}$, it is a simple pole at $k_j$ and a simple zero at $k_j^{*}$. Other places are non-zero and analytic; $\bullet$ $T^{*}(k^{*})T(k)=1$, for $\mathbb{C}\backslash(-k_0,k_0)$; $\bullet$ For $k\in(-k_0,k_0)$, the boundary values $T_{\pm}(k)$ satisfy $$ T_{+}(k)=T_{-}(k)\left(1+|r(k)|^{2}\right), k \in\left(-k_0,k_0\right); $$ $\bullet$ When $|k|\rightarrow\infty$, $|\arg (k)| \leq c<\pi$ $$ T(k)=1+\frac{i}{k}\left[2 \sum_{j \in \Delta_{k_0}^{-}} \operatorname{Im} k_{j}-\int_{-k_0}^{k_0} \nu(s) d s\right]+O\left(k^{-2}\right); $$ $\bullet$ $k \rightarrow\pm k_0,$ along any ray $\pm k_0+e^{i\phi}\mathbb{R}_{+}$ with $|\phi| \leq c<\pi$ $$ \left|T(k)-T_{0}\left(\pm k_0\right)\left(k\mp k_{0}\right)^{i \nu\left(\pm k_0\right)}\right| \leq c\left|k\mp k_{0}\right|^{\frac{1}{2} } $$ where $$ \begin{aligned} &T_{0}\left(\pm k_0\right)=\prod_{j \in \Delta_{k_{0}}^{-}}\left(\frac{\pm k_0-{k}^{*}_{j}}{\pm k_0-k_{j}}\right) e^{i \beta\left(k, \pm k_0\right)},\\ &\beta(k,-k_0)=\left(i \int_{-k_0}^{-k_0+1} \frac{\nu\left(-k_0\right)}{z-k} d z+i \int_{-k_0}^{k_0} \frac{\nu(z)-\chi_1(z) \nu\left(-k_0\right)}{z-k} d z\right),\\ &\beta(k,k_0)=\left(i \int_{k_0-1}^{k_0} \frac{\nu\left(k_0\right)}{z-k} d z+i \int_{-k_0}^{k_0} \frac{\nu(z)-\chi_2(z) \nu\left(k_0\right)}{z-k} d z\right),\\ &\chi_{1}(k)=\left\{\begin{array}{lc} 1, & -k_0<k<-k_0+1, \\ 0, & \text { elsewhere }, \end{array} \quad \chi_{2}(k)=\left\{\begin{array}{lc} 1, & k_0-1<k<k_0 ,\\ 0, & \text { elsewhere }. \end{array}\right.\right. \end{aligned} $$ \end{proposition} Through the defined $T(k)$, the following transformation can be done to eliminate the diagonal matrix in the decomposition of the jump matrix in the interval $[-k_0,k_0]$. \begin{equation} M^{(1)}(k)=M(k) T(k)^{-\sigma_{3}}, \end{equation} which satisfies the following RHP: \begin{rhp}\label{4r} Find a matrix $M^{(1)}(k)$ that satisfies: $\bullet$ $M^{(1)}$ is analytic within $\mathbb{C}\backslash \mathbb{R}\cup\mathcal{K}\cup\mathcal{K}^{*};$ $\bullet$ $M^{(1)}(k)=\sigma_{0} (M^{(1)})^{*}\left(k^{*}\right)\sigma_{0}^{-1};$ $\bullet$$M^{(1)}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty;$ $\bullet$ $M^{(1)}_{+}( k)=M^{(1)}_{-}( k) V^{(1)}(k), \quad k \in \mathbb{R},$ where $$ V^{(1)}(k)=\left\{\begin{array}{c} \left(\begin{array}{cc} 1 & 0 \\ \frac{r}{1+|r|^{2}} T_{-}^{-2} e^{2 i t \theta(k)} & 1 \end{array}\right)\left(\begin{array}{cc} 1 & \frac{{r}^{*}}{1+|r|^{2}} T_{+}^{2} e^{-2 i t \theta(k)} \\ 0 & 1 \end{array}\right), \quad |k|<k_0, \\ \left(\begin{array}{cc} 1 & r^{*} T^{2} e^{-2 i t \theta(k)} \\ 0 & 1 \end{array}\right)\left(\begin{array}{cc} 1 & 0 \\ r T^{-2} e^{2 i t \theta(k)} & 1 \end{array}\right), \quad |k|>k_0; \end{array}\right. $$ $\bullet$ $M^{(1)}(k)$ has simple poles at each point in $k_j\in \mathbb{C}^{+}$ and $k_j^{*}\in \mathbb{C}^{-}$ with: \begin{equation} \begin{array}{l} \underset{k={k}_{j}}{\operatorname{Res}} M^{(1)}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow k_{j}}\lim M^{(1)}(k)\left(\begin{array}{cc} 0 & c_{j}^{-1}\left(\frac{1}{T}\right)^{\prime}\left(k_{j}\right)^{-2} e^{-2 i t \theta\left(k_{j}\right)} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow k_{j}}\lim M^{(1)}(k)\left(\begin{array}{cc} 0 & 0 \\ c_{j} T\left(k_{j}\right)^{-2} e^{2 i t \theta\left(k_{j}\right)} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+}. \end{array}\right.\\ \underset{k={k}^{*}_{j}}{\operatorname{Res}} M^{(1)}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow {k}^{*}_{j}}\lim M^{(1)}(k)\left(\begin{array}{cc} 0 & 0 \\ -({c}^{*}_{j})^{-1} {T^{\prime}}^{-2}({k}^{*}_{j}) e^{2 i t \theta({k}^{*}_{j})} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow {k}^{*}_{j}}\lim M^{(1)}(k)\left(\begin{array}{cc} 0 & -{c}^{*}_{j} T^{2}({k}^{*}_{j}) e^{-2 i t \theta({k}^{*}_{j})} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+} . \end{array}\right. \end{array} \end{equation} \end{rhp} In addition, due to $T(k)^{-\sigma3}\rightarrow I$, as $k\rightarrow\infty$, so the solution of the coupled dispersion AB system can be expressed as \begin{equation} A= 4 i\lim _{k \rightarrow \infty} (k M^{(1)}(k))_{12},~~B=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}(k M^{(1)}(k))_{11}. \end{equation} \section{Contour deformation} The next idea is to eliminate the jump on the real axis and open it at a small angle at the steady-state phase point to deform the contour of RHP \ref{4r}. According to the number of steady-state phase points and spectral singularity points, the following contours can be considered \begin{equation} \Sigma^{(2)}=\Sigma_{1} \cup \Sigma_{2}^{\pm} \cup \Sigma_{3}^{\pm} \cup \Sigma_{4} \cup \Sigma_{5} \cup \Sigma_{6}^{\pm} \cup \Sigma_{7}^{\pm} \cup \Sigma_{8}, \end{equation} shown in Fig. \ref{4t}. \begin{figure}[htpb] \centering \includegraphics[ width=8.6cm,height=3.3cm]{sigma2.jpg} \caption{\small Deformation from $\mathbb{R}$ to $\Sigma^{(2)}$.}\label{4t} \end{figure} In order to facilitate later applications, new tokens are introduced $$ \varrho=\frac{1}{2} \min _{k, \mu \in \mathcal{K} \cup \mathcal{K}^{*}}|k-\mu|. $$ Because of the symmetry, and the pole is not on the real axis, then for any $k_j=u_j+iv_j\in \mathcal{K}$, obviously there is $k^{*}_j=u_j-iv_j\in \mathcal{K}^{*}$. according to the above representation, there must be $|k_j-k^{*}_j|=2|v_j|>\varrho$. So there must be $\operatorname{dis}\left(k, \mathbb{R}\right)=\left|v\right| \geq \varrho>0$, here is due to the arbitrariness of $j$. In order to keep the residual condition unchanged during contour deformation, an eigenfunction is defined near the discrete spectrum \begin{equation} \Upsilon_{\mathcal{K}}(k)= \begin{cases}1 , \operatorname{dist}\left(k, \mathcal{K} \cup \mathcal{K}^{*}\right)<\varrho / 3, \\ 0 , \operatorname{dist}\left(k, \mathcal{K} \cup \mathcal{K}^{*}\right)>2 \varrho / 3.\end{cases} \end{equation} Now we find a matrix $R_j \rightarrow \mathbb{C}$ with the following boundary conditions, \begin{equation}\label{R1} R_{1}(k)= \begin{cases}r(k) T^{-2}(k), & k \in\left(-\infty,-k_0 \right), \\ r\left(-k_0\right) T_{0}^{-2}\left(-k_0\right)\left(k+k_0\right)^{-2 i v\left(-k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{1},\end{cases} \end{equation} \begin{equation}\label{R2} R_{3}(k)= \begin{cases}\frac{r^{*}(k^{*}) T_{+}^{2}(k)}{1+|r(k)|^{2}}, & k \in\left(-k_0, k_0\right), \\ \frac{r^{*}\left(-k_0\right) T_{0}^{2}\left(-k_0\right)}{1+\left|r\left(-k_0\right)\right|^{2}}\left(k+k_0\right)^{2 i v\left(-k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma^{+}_{2},\\ 0,& k \in \Sigma^{-}_{2},\end{cases} \end{equation} \begin{equation}\label{R3} R_{4}(k)= \begin{cases}\frac{r^{*}(k^{*}) T_{+}^{2}(k)}{1+|r(k)|^{2}}, & k \in\left(-k_0, k_0\right), \\ \frac{r^{*}\left(k_0\right) T_{0}^{2}\left(k_0\right)}{1+\left|r\left(k_0\right)\right|^{2}}\left(k-k_0\right)^{2 i v\left(k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{3}^{+},\\ 0,& k \in \Sigma^{-}_{3}, \end{cases} \end{equation} \begin{equation}\label{R4} R_{5}(k)= \begin{cases}r(k) T^{-2}(k), & k \in\left(k_0,\infty \right), \\ r\left(k_0\right) T_{0}^{-2}\left(k_0\right)\left(k-k_0\right)^{-2 i v\left(k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{4},\end{cases} \end{equation} \begin{equation}\label{R5} R_{6}(k)= \begin{cases}r^{*}(k^{*}) T^{2}(k), & k \in\left(k_0,\infty \right),\\ r^{*}\left(k_0\right) T_{0}^{2}\left(k_0\right)\left(k-k_0\right)^{2 i v\left(k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{5},\end{cases} \end{equation} \begin{equation}\label{R6} R_{7}(k)= \begin{cases}\frac{r(k) T_{-}^{-2}(k)}{1+|r(k)|^{2}}, & k \in\left(-k_0, k_0\right), \\ \frac{r\left(k_0\right) T_{0}^{-2}\left(k_0\right)}{1+\left|r\left(k_0\right)\right|^{2}}\left(k-k_0\right)^{-2 i v\left(k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{6}^{+},\\ 0,& k \in \Sigma^{-}_{6},\end{cases} \end{equation} \begin{equation}\label{R7} R_{8}(k)= \begin{cases}\frac{r(k) T_{-}^{-2}(k)}{1+|r(k)|^{2}}, & k \in\left(-k_0, k_0\right), \\ \frac{r\left(-k_0\right) T_{0}^{-2}\left(-k_0\right)}{1+\left|r\left(-k_0\right)\right|^{2}}\left(k+k_0\right)^{-2 i v\left(-k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{7}^{+},\\ 0,& k \in \Sigma^{-}_{7},\end{cases} \end{equation} \begin{equation}\label{R8} R_{9}(k)= \begin{cases}r^{*}(k) T^{2}(k), & k \in\left(-\infty,\xi_{1}\right), \\ r^{*}\left(-k_0\right) T_{0}^{2}\left(-k_0\right)\left(k+k_0\right)^{2 i v\left(-k_0\right)}\left(1-\Upsilon_{\mathcal{K}}(k)\right), & k \in \Sigma_{8}.\end{cases} \end{equation} And meet the following estimates \begin{equation} \left|R_{j}\right| \lesssim \sin ^{2}\left(\arg \left(k\pm k_0\right)\right)+\langle\operatorname{Re}(k)\rangle^{-\frac{1}{2}}.~~j=1,3,...,9 \end{equation} In this way, the original jump in $\pm k_0$ will become as shown in Fig. \ref{5t} and Fig. \ref{6t}. \begin{figure}[h] {\includegraphics[width=10cm,height=5.5cm]{fk.jpg}} \centering \caption{\small Matrix $\mathcal{R}^{(2)}$ around stationary phase point $-k_0$.}\label{5t} \end{figure} \begin{figure}[h] {\includegraphics[width=10cm,height=5.5cm]{zk.jpg}} \centering \caption{\small Matrix $\mathcal{R}^{(2)}$ around stationary phase point $k_0$.}\label{6t} \end{figure} In order to facilitate future calculation and estimation, the region needs to be divided appropriately, as shown in the Fig.\ref{7t} below. \begin{figure}[h] {\includegraphics[width=10cm,height=4.5cm]{sigma2fen.jpg}} \centering \caption{\small Region segmentation.}\label{7t} \end{figure} And making some marks $$ \begin{array}{ll} p_{1}(k)=p_{5}(k)=r(k), & p_{6}(k)=p_{9}(k)=r^{*}(k) \\ p_{3}(k)=p_{4}(k)=\frac{r^{*}(k)}{1+|r(k)|^{2}}, & p_{7}(k)=p_{8}(k)=\frac{r(k)}{1+|r(k)|^{2}}, \end{array} $$ further estimates of $\bar{\partial}R_{j}$ in different regions can be obtained \begin{lemma} Suppose $r\in H^{1,1}(\mathbb{R})$, $\bar{\partial}R_{j}$ defined by (\ref{R1})-(\ref{R8}) satisfies \begin{equation} \left|\bar{\partial} R_{j}(k)\right| \lesssim\left|\bar{\partial} \Upsilon_{\mathcal{K}}(k)\right|+\left|p_j^{\prime}(\operatorname{Re}(k))\right|+\left|k\pm k_0\right|^{-\frac{1}{2}}, \end{equation} on $D_1,D_5,D_6,D_9$ and $D_3^{+},D_4^{+},D_7^{+},D_8^{+}$. $\bar{\partial}R_{j}$ satisfies \begin{equation} \left|\bar{\partial} R_{j}(k)\right| \lesssim\left|\bar{\partial} \Upsilon_{\mathcal{K}}(k)\right|+\left|p_j^{\prime}(\operatorname{Re}(k))\right|+\left|k\right|^{-\frac{1}{2}} \end{equation} on $D_3^{-},D_4^{-},D_7^{-},D_8^{-}$. \end{lemma} Correspondingly, the jump line is transformed into $\Sigma^{(3)}$. Here, two jump lines are added, which are in the following form \begin{equation} \tilde{v}=\left(\begin{array}{ll} I, & k \in\left(\frac{-ik_0}{2}\tan\frac{\pi}{24}, \frac{ik_0}{2}\tan\frac{\pi}{24}\right), \\ \left(\begin{array}{cc} 1 & \left(R_{2}^{+}-R_{2}^{-}\right) e^{-2 i \theta} \\ 0 & 1 \end{array}\right), & k \in\left(\frac{ik_0}{2}\tan\frac{\pi}{24}-\frac{k_0}{2}, \frac{i k_0}{2\sqrt{3}} -\frac{k_0}{2}\right), \\ \left(\begin{array}{cc} 1 & 0 \\ \left(R_{7}^{+}-R_{7}^{-}\right) e^{2 i \theta} & 1 \end{array}\right) & k \in\left(-\frac{ik_0}{2}\tan\frac{\pi}{24}-\frac{k_0}{2}, -\frac{i k_0}{2\sqrt{3}} -\frac{k_0}{2}\right), \\ \left(\begin{array}{ccc} 1 & \left(R_{3}^{-}-R_{3}^{+}\right) e^{-2 i \theta} \\ 0 & 1 & \end{array}\right), & k \in\left(\frac{ik_0}{2}\tan\frac{\pi}{24}+\frac{k_0}{2}, \frac{i k_0}{2\sqrt{3}} +\frac{k_0}{2}\right), \\ \left(\begin{array}{ccc} \left(R_{6}^{-}-R_{6}^{+}\right) e^{2 i \theta} & 1 \end{array}\right), & k \in\left(-\frac{ik_0}{2}\tan\frac{\pi}{24}+\frac{k_0}{2}, -\frac{i k_0}{2\sqrt{3}} +\frac{k_0}{2}\right). \end{array}\right. \end{equation} The jump line $\Sigma^{(3)}$ is shown in Fig. \ref{8t}. \begin{figure}[h] {\includegraphics[width=9.6cm,height=3.5cm]{s3.jpg}} \centering \caption{\small The contour of $\Sigma^{(3)}$.}\label{8t} \end{figure} At the same time, similar to Ref.\cite{CLL-2009-ar}, we can get $\tilde{v}$ subjects to the following estimate $$ \left|\tilde{v}-I\right| \lesssim e^{-t}. $$ Therefore, the following changes can be made \begin{equation} M^{(2)}(k)=M^{(1)}(k) \mathcal{R}^{(2)}, \end{equation} where $$ \mathcal{R}^{(2)}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ (-1)^{m_j}R_{j}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in D_{ j},\quad j=1,5,7,8 \\ \left(\begin{array}{cc} 1 & (-1)^{m_j}R_{j}(k) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in D_{j},\quad j=3,4,6,9 \\ \left(\begin{array}{ll} 1 & 0 \\ 0 & 1 \end{array}\right), & k \in D_{2} \cup D_{10},\end{cases} $$ where $ m_1=m_3=m_4=m_5=1, m_6=m_7=m_8=m_9=0$. Matrix $M^{(2)}(k)$ satisfies the following RHP: \begin{rhp}\label{5r} The $M^{(2)}(k)$ obtained from $M^{(1)}(k)$ and $\mathcal{R}^{(2)}(k)$ above is expected to satisfy the following properties: $\bullet$ $M^{(2)}$ is analytic within $\mathbb{C}\backslash \Sigma^{(2)}\cup\mathcal{K}\cup\mathcal{K}^{*};$ $\bullet$ $M^{(2)}(k)=\sigma_{0} (M^{(2)}(k^{*}))^{*}\sigma_{0}^{-1};$ $\bullet$$M^{(2)}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty;$ $\bullet$ $M^{(2)}_{+}(k)=M^{(2)}_{-}(k) V^{(2)}(k), \quad k \in \Sigma^{(2)},$ where $$ V^{(2)}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ R_{1}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{1}, \\ \left(\begin{array}{cc} 1 & R_{3}(k) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{2}, \\ \left(\begin{array}{cc} 1 & R_{4}(k) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{3} ,\\ \left(\begin{array}{cc} 1 & \\ R_{5}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{4}, \\ \left(\begin{array}{cc} 1 & R_{6}(k) e^{-2 i t \theta}\\ 0 & 1 \end{array}\right), & k \in \Sigma_{5},\\ \left(\begin{array}{cc} 1 & 0\\ R_{7}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{6},\\ \left(\begin{array}{cc} 1 & 0\\ R_{8}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{7},\\ \left(\begin{array}{cc} 1 & R_{9}(k) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{8}. \end{cases} $$ $\bullet$ $M^{(2)}(k)$ has simple poles at each point in $\mathcal{K}\cup\mathcal{K}^{*}$ with: \begin{equation} \begin{array}{l} \underset{k={k}_{j}}{\operatorname{Res}} M^{(2)}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow k_{j}}\lim M^{(2)}(k)\left(\begin{array}{cc} 0 & c_{j}^{-1}\left(\frac{1}{T}\right)^{\prime}\left(k_{j}\right)^{-2} e^{-2 i t \theta\left(k_{j}\right)} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow k_{j}}\lim M^{(2)}(k)\left(\begin{array}{cc} 0 & 0 \\ c_{j} T\left(k_{j}\right)^{-2} e^{2 i t \theta\left(k_{j}\right)} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+}. \end{array}\right.\\ \underset{k={k}^{*}_{j}}{\operatorname{Res}} M^{(2)}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow {k}^{*}_{j}}\lim M^{(2)}(k)\left(\begin{array}{cc} 0 & 0 \\ -({c}^{*}_{j})^{-1} T^{\prime}({k}^{*}_{j})^{-2} e^{2 i t \theta({k}^{*}_{j})} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-},\\ \underset{k \rightarrow {k}^{*}_{j}}\lim M^{(2)}(k)\left(\begin{array}{cc} 0 & -{c}^{*}_{j} T({k}^{*}_{j})^{2} e^{-2 i t \theta({k}^{*}_{j})} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+}. \end{array}\right. \end{array} \end{equation} $\bullet$ For $\mathbb{C}\backslash \Sigma^{(2)}\cup\mathcal{K}\cup\mathcal{K}^{*}$, we have the $\bar{\partial}$ derivative \begin{equation} \bar{\partial} M^{(2)}(k)=M^{(2)}(k) \bar{\partial} \mathcal{R}^{(2)}(k),\label{4.1} \end{equation} where $$ \mathcal{R}^{(2)}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ (-1)^{m_j}\bar{\partial}R_{j}(k) e^{2 i t \theta} & 1 \end{array}\right), & k \in D_{ j},\quad j=1,5,7,8 \\ \left(\begin{array}{cc} 1 & (-1)^{m_j}\bar{\partial}R_{j}(k) e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in D_{j},\quad j=3,4,6,9 \\ \left(\begin{array}{ll} 0 & 0 \\ 0 & 0 \end{array}\right), & k \in D_{2} \cup D_{10},\end{cases} $$ where $m_1=m_3=m_4=m_5=1, m_6=m_7=m_8=m_9=0$. \end{rhp} The relationship between the solution of the coupled dispersion AB system and $M^{(2)}(k)$ is \begin{equation} A(x,t)= 4 i\lim _{k \rightarrow \infty} (k M^{(2)}(k))_{12},~~B(x,t)=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}(k M^{(2)}(k))_{11}. \end{equation} The $\bar{\partial}$ derivative appears in the above RHP, so it is also called mixed $\bar{\partial}$-$RHP$. \section{Decomposition of the RHP \ref{5r}} The following is mainly about the classification of RHP \ref{5r}. For the case of $\bar{\partial} \mathcal{R}^{(2)}(k)=0$, it is called a pure RH problem, and for the case of $\bar{\partial} \mathcal{R}^{(2)}(k)\neq0$, it is called a pure $\bar{\partial}$ problem. In the process of classification, consider the transformation $M^{(2)}(k)=M^{(3)}(k)M^{(2)}_{rhp}(k)$, if $\bar{\partial} \mathcal{R}^{(2)}(k)=0$, it corresponds to $M^{(2)}_{rhp}(k)$, if $\bar{\partial} \mathcal{R}^{(2)}(k)\neq0$, it corresponds to $M^{(3)}(k)=M^{(2)}(k)(M^{(2)}_{rhp}(k))^{-1}$. For $M^{(2)}_{rhp}(k)$, its jump is the same as $M^{(2)}(k)$, and its more properties are \begin{rhp}\label{r6} Find a matrix-valued function $M^{(2)}_{rhp}(k)$ with following properties: $\bullet$ $M^{(2)}_{rhp}(k)$ is analytic within $\mathbb{C}\backslash \Sigma^{(2)}\cup\mathcal{K}\cup\mathcal{K}^{*};$ $\bullet$ Symmetry: $M^{(2)}_{rhp}(k)=\sigma_{0} (M^{(2)}_{rhp})^{*}(k^{*})\sigma_{0}^{-1};$ $\bullet$ Analytic behavior: \begin{equation}M^{(2)}_{rhp}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty,\end{equation} $\bullet$ Jump condition: \begin{equation} M^{(2)}_{rhp+}(k)=M^{(2)}_{rhp-}( k) V^{(2)}(k), \quad k \in \Sigma^{(2)}; \end{equation} $\bullet$ Residue conditions: $M^{(2)}_{rhp}(k)$ has simple poles at each point in $\mathcal{K}\cup\mathcal{K}^{*}$ with \begin{equation} \begin{array}{l} \underset{k=k_{j}}{\operatorname{Res}}M^{(2)}_{rhp}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow k_{j}}\lim M^{(2)}_{rhp}(k)\left(\begin{array}{cc} 0 & c_{j}^{-1}\left(\frac{1}{T}\right)^{\prime}\left(k_{j}\right)^{-2} e^{-2 i t \theta\left(k_{j}\right)} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow k_{j}}\lim M^{(2)}_{rhp}(k)\left(\begin{array}{cc} 0 & 0 \\ c_{j} T\left(k_{j}\right)^{-2} e^{2 i t \theta\left(k_{j}\right)} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+}. \end{array}\right.\\ \underset{k={k}^{*}_{j}}{\operatorname{Res}} M^{(2)}_{rhp}(k)=\left\{\begin{array}{ll} \underset{k \rightarrow k^{*}_{j}}\lim M^{(2)}_{rhp}(k)\left(\begin{array}{cc} 0 & 0 \\ -\left({c}^{*}_{j}\right)^{-1} T^{\prime}\left({k}^{*}_{j}\right)^{-2} e^{2 i t \theta\left({k}^{*}_{j}\right)} & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow k^{*}_{j}}\lim M^{(2)}_{rhp}(k)\left(\begin{array}{cc} 0 & -{c}^{*}_{j} T\left({k}^{*}_{j}\right)^{2} e^{-2 i t \theta\left({k}^{*}_{j}\right)} \\ 0 & 0 \end{array}\right), \quad j \in \Delta_{k_{0}}^{+} . \end{array}\right.\label{5.3} \end{array} \end{equation} $\bullet$ $\bar{\partial}$-Derivative: $\bar{\partial} R^{(2)}(k)=0$ for $k \in \mathbb{C}$. \end{rhp} When $\bar{\partial} \mathcal{R}^{(2)}(k)\neq0$, we use the above $M^{(2)}_{rhp}(k)$ to construct a transformation: $M^{(3)}(k)=M^{(2)}(k)(M^{(2)}_{rhp}(k))^{-1}$, which is a pure $\bar{\partial}$ problem. For $M^{(3)}(k)$, we have the following properties: \begin{rhp}\label{7r} Find a matrix-valued function $M^{(3)}(k)$ with following properties: $\bullet$ $M^{(3)}(k)$ is continuous in $\mathbb{C}$, continuous first partial derivatives in $\mathbb{C}\backslash \Sigma^{(2)}\cup\mathcal{K}\cup\mathcal{K}^{*};$ $\bullet$ Symmetry: $M^{(3)}(k)=\sigma_{0} (M^{(3)}(k^{*}))^{*}\sigma_{0}^{-1};$ $\bullet$ Jump condition: $M^{(3)}_{+}(k)=M^{(3)}_{-}(k) , \quad k \in \Sigma^{(2)}$; $\bullet$ Analytic behavior: $M^{(3)}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty$; $\bullet$ $\bar{\partial}$-Derivative: $\bar{\partial} M^{(3)}(k)=M^{(3)}(k) M^{(2)}_{rhp}(k) \bar{\partial} R^{(2)}(k) M^{(2)}_{rhp}(k)^{-1}.$ \end{rhp} For the above proof, we can refer to Ref.\cite{YT-2021-ar}. Here we avoid repetition and do not present it again. The next focus is to find $M^{(2)}_{rhp}(k)$. First, two open intervals are defined \begin{equation} \begin{aligned} &\mathcal{A}_{1}=\left\{k:\left|k+k_0\right| \leq \min \left\{\frac{k_0}{2}, \rho / 3\right\} \triangleq \varepsilon\right\}, \\ &\mathcal{A}_{2}=\left\{k:\left|k-k_0\right| \leq \min \left\{\frac{k_0}{2}, \rho / 3\right\} \triangleq \varepsilon\right\}. \end{aligned} \end{equation} Then $M^{(2)}_{rhp}(k)$ is divided into three parts \begin{equation} M^{(2)}_{rhp}(k)= \begin{cases}M^{err}(k) M^{o u t}(k), & k \notin\left\{\mathcal{A}_{1} \cup \mathcal{A}_{2}\right\}, \\ M^{err}(k) M^{\left(-k_0\right)}(k), & k \in \mathcal{A}_{1}, \\ M^{err}(k) M^{\left(k_0\right)}(k), & k \in \mathcal{A}_{2}.\end{cases}\label{mout} \end{equation} Due to $\operatorname{dist}(\mathcal{K} \cup \mathcal{K}^{*}, \mathbb{R})>\varrho$, $M^{(2)}_{rhp}(k)$ , $M^{\left(-k_0\right)}(k)$ and $M^{\left(k_0\right)}(k)$ have no poles in $\mathcal{A}_{1}$ and $\mathcal{A}_{2}$. The matrix $M^{(2)}_{rhp}(k)$ is divided into three parts by decomposition: one part can be called the external model RH problem, represented by $M^{o u t}(k)$, which can be solved directly by considering the standard RH problem without reflection potential. The other two parts are near the phase points $M^{\left(-k_0\right)}(k)$ and $M^{\left(k_0\right)}(k)$ , which can be matched to the known PC model, namely the parabolic cylinder model in $\mathcal{A}_{1}$ and $\mathcal{A}_{2}$, to be solved in Section 8.4. In addition, matrix $M^{err}(k)$ is an error function, which can be solved by the small norm RH problem in Section 8.5. Let's define $L_{\epsilon}$ for a fixed $\epsilon$ $$ \begin{gathered} L_{\epsilon}=\left\{k: k=k_0+A k_0 e^{\frac{3 i \pi}{4} }, \epsilon \leq A \leq \frac{1}{\sqrt{2}}\right\} \\ \cup\left\{k: k=k_0+A k_0 e^{\frac{i \pi}{4}}, \epsilon \leq A \leq \infty\right\} \\ \cup\left\{k: k=-k_0+A k_0 e^{\frac{i \pi}{4} }, \epsilon \leq A \leq \frac{1}{\sqrt{2}}\right\} \\ \cup\left\{k: k=-k_0+A k_0 e^{\frac{3 i \pi}{4} }, \epsilon \leq A \leq \infty\right\}. \end{gathered} $$ Through the above definition, we can write the estimation of $V^{(2)}(k)$ as follows \begin{equation} \begin{aligned}\label{VI} &\left\|V^{(2)}(k)-I\right\|_{L^{\infty}\left(\Sigma_{+}^{(2)} \cap \mathcal{A}_{2}\right)}=\mathcal{O}\left(e^{\frac{\sqrt{2}t}{4}\alpha\left|k -k_0\right|}\left(k_{0}^{-2}-|k|^{-2}\right)\right), \\ &\left\|V^{(2)}(k)-I\right\|_{L^{\infty}\left(\Sigma_{-}^{(2)} \cap \mathcal{A}_{1}\right)}=\mathcal{O}\left(e^{\frac{\sqrt{2}t}{4}\alpha\left|k +k_0\right|}\left(k_{0}^{-2}-|k|^{-2}\right)\right), \\ &\left\|V^{(2)}(k)-I\right\|_{L^{\infty}\left(\Sigma^{(2)} \backslash\left(\mathcal{A}_{1} \cup \mathcal{A}_{2}\right)\right)}=O\left(e^{-2 t \epsilon}\right), \end{aligned} \end{equation} where the contours are defined by $$ \Sigma_{+}^{(2)}=\Sigma_{3} \cup \Sigma_{4} \cup \Sigma_{5} \cup \Sigma_{6}, \quad \Sigma_{-}^{(2)}=\Sigma_{1} \cup \Sigma_{2} \cup \Sigma_{7} \cup \Sigma_{8}. $$ This implies that the jump matrix $V^{(2)}(k)$ goes to $I$ on both $\Sigma^{(2)} \backslash\left(\mathcal{A}_{1} \cup \mathcal{A}_{2}\right)$. $M^{o u t}(k)$ is the solution on the soliton region of $M^{(2)}(k)$, which is defined as no jump on $\mathbb{C}$, only discrete spectral points, and analytical in $\mathcal{A}_{1}\cup\mathcal{A}_{2}$ and outside discrete spectral points, that is, the following RHP \begin{rhp}\label{8r} Find a matrix-valued function $M^{out}(k)$ with following properties: $\bullet$ Analyticity: $M^{out}(k)$ is is analytical in $\mathbb{C}\backslash \Sigma^{(2)}\cup\mathcal{K}\cup\mathcal{K}^{*};$ $\bullet$ Symmetry: $M^{out}(k)=\sigma_{0} (M^{out}(k^{*}))^{*}\sigma_{0}^{-1};$ $\bullet$ Analytic behavior: $M^{out}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty$, $\bullet$ Residue conditions:~$M^{out}(k)$ has simple poles at each point in $\mathcal{K}\cup\mathcal{K}^{*}$ satisfying the same residue relations with (\ref{5.3}) of $M^{(2)}_{rhp}{(k)}$. \end{rhp} \section{Pure RHP and its asymptotic behavior} In this segment, we will probe into the asymptotic behavior of the external soliton region and the internal non soliton region. \subsection{External soliton solution region} As we all know, solitons are generated when the reflection data is equal to 0, that is, $r(k) = 0$. At this time, the trace function is simplified to \begin{equation} s_{11}(k)=\prod_{j=1}^{N} \frac{k-k_{j}}{k-{k}^{*}_{j}},~~~s_{22}(k)=\prod_{j=1}^{N} \frac{k-{k}^{*}_{j}}{k-k_{j}}. \end{equation} And the jump matrix $V (k)=I$, then RHP \ref{r1} can be simplified to \begin{rhp}\label{9r} For a given scattering data $\mathcal{P}=\left\{\left(k_{j}, c_{j}\right)\right\}_{j=1}^{N}$, a matrix $M(k|\mathcal{P})$ can be found to satisfy: $\bullet$ Analyticity: $M(k|\mathcal{P})$ is analytical in $\mathbb{C} \backslash\left(\Sigma^{(2)} \cup \mathcal{K} \cup \mathcal{K}^{*}\right)$; $\bullet$ Symmetry: $M(k|\mathcal{P})=\sigma_{0} M^{*}(k^{*}|\mathcal{P})\sigma_{0}^{-1};$ $\bullet$ Asymptotic behaviors: $M(k|\mathcal{P})=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty,$ $\bullet$ Residue conditions: $M(k|\mathcal{P})$ has simple poles at each point in $k_j\in \mathbb{C}^{+}$ and $k_j^{*}\in \mathbb{C}^{-}$ with: \begin{equation} \begin{array}{l} \underset{k=k_{j}}{\operatorname{Res}}M(k|\mathcal{P})=\underset{k \rightarrow k_{j}}\lim M(k|\mathcal{P})\left(\begin{array}{cc} 0 & 0 \\ c_{j} e^{2 i t \theta\left(k_{j}\right)} & 0 \end{array}\right), \\ \underset{k={k}_{j}^{*}}{\operatorname{Res}}M(k|\mathcal{P})=\underset{k \rightarrow k^{*}_{j}}\lim M(k|\mathcal{P})\left(\begin{array}{cc} 0 & -{c}_{j}^{*} e^{-2 i t \theta\left(k_j^{*}\right)} \\ 0 & 0 \end{array}\right). \end{array} \end{equation} \end{rhp} The uniqueness of RHP \ref{9r} solution can be easily proved by using Liouville theorem. In order to facilitate future research, we divide the scattering data into two parts. Note $\nabla\subseteq\{1,...,N\}$, and define $$ {s_{11}}_{\nabla}(k)=\prod_{j\in\nabla} \frac{k-k_{j}}{k-{k}^{*}_{j}}. $$ Next, make a modified transformation of $M(k|\mathcal{P})$ defined above as follows \begin{equation} M_{\nabla}(k \mid \mathcal{D})=M(k \mid \mathcal{P}) s_{11,\nabla}(k)^{\sigma_{3}},\label{ms} \end{equation} where the scattering data are given by $$ \mathcal{D}=\left\{\left(k_{j}, c_{j}^{\prime}\right)\right\}_{j=1}^{ N}, \quad c_{j}^{\prime}=c_{j} s_{11,\nabla}(k)^{2}. $$ Therefore, $M_{\nabla}(k \mid \mathcal{D})$ satisfies the following modified discrete RHP: \begin{rhp}\label{10r} For a given scattering data $\mathcal{D}=\{(k_{j}, c_{j}^{\prime})\}_{j=1}^{N}$, a matrix $M_{\nabla}(k \mid \mathcal{D})$ can be found to satisfy: $\bullet$ Analyticity: $M^{\nabla}(k \mid \mathcal{D})$ is analytical in $\mathbb{C} \backslash\left(\Sigma^{(2)} \cup \mathcal{K} \cup \mathcal{K}^{*}\right)$; $\bullet$ Symmetry: $M^{\nabla}(k \mid \mathcal{D})=\sigma_{0} M^{*}_{\nabla}(k^{*} \mid \mathcal{D})\sigma_{0}^{-1};$ $\bullet$ Asymptotic behaviors: $ M_{\nabla}(k \mid \mathcal{D})=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty; $ $\bullet$ Residue conditions: $M_{\nabla}(k \mid \mathcal{D})$ has simple poles at each point in $k_j\in \mathbb{C}^{+}$ and $k_j^{*}\in \mathbb{C}^{-}$ with: \begin{equation}\label{91} \begin{array}{l} \underset{k=k_{j}}{\operatorname{Res}} M_{\nabla}(k \mid \mathcal{D})=\left\{\begin{array}{ll} \underset{k \rightarrow k_{j}}\lim M_{\nabla}(k \mid \mathcal{D})\left(\begin{array}{cc} 0 & \varpi_j^{-1}(s_{11,\nabla}^{\prime})^{-2}(k_{j})\\ 0 & 0 \end{array}\right), j \in \nabla ,\\ \underset{k \rightarrow k_{j}}\lim M_{\nabla}(k \mid \mathcal{D})\left(\begin{array}{cc} 0 & 0 \\ \varpi_js_{11,\nabla}^2(k_j) & 0 \end{array}\right), \quad j \notin \nabla. \end{array}\right.\\ \underset{k={k}^{*}_{j}}{\operatorname{Res}} M_{\nabla}(k \mid \mathcal{D})=\left\{\begin{array}{ll} \underset{k \rightarrow {k}^{*}_{j}} \lim M_{\nabla}(k \mid \mathcal{D})\left(\begin{array}{cc} 0 & 0 \\ -\varpi_j^{*-1}(s^{*,\prime}_{11,\nabla})^{-2}(k^{*}_j) & 0 \end{array}\right), j \in \nabla, \\ \underset{k \rightarrow {k}^{*}_{j}}\lim M_{\nabla}(k \mid \mathcal{D})\left(\begin{array}{cc} 0 &-\varpi_j^{*} (s_{11,\nabla}^{*})^{2}(k^{*}_{j}) \\ 0 & 0 \end{array}\right), j \notin \nabla . \end{array}\right. \end{array} \end{equation} where $\varpi_j=c_{j} e^{2 i t \theta\left(k_{j}\right)}$. \end{rhp} \begin{proposition} If $ A_{s o l}(x,t)=A_{s o l}\left(x, t |\mathcal{D}\right), B_{s o l}(x,t)=B_{s o l}\left(x, t |\mathcal{D}\right) $ denote the N-soliton solution of the system (\ref{AB}), for the scattering data without reflection $\mathcal{D}=\{(k_{j}, c_{j}^{\prime})\}_{j=1}^{N}$, RHP \ref{10r} has a unique solution and $$ \begin{aligned} A_{s o l}\left(x, t |\mathcal{D}\right)&=4 i \lim _{k \rightarrow \infty}\left[k M_{\nabla}(k \mid \mathcal{D})\right]_{12}\\ &=4 i \lim _{k \rightarrow \infty}\left[k M(k \mid \mathcal{P})\right]_{12}=A_{s o l}\left(x,t|\mathcal{P}\right), \end{aligned} $$ $$ \begin{aligned} B_{s o l}(x, t|\mathcal{D})&=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}[k M_{\nabla}(k \mid \mathcal{D})]_{11} \\ &=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}[k M(k \mid \mathcal{P})]_{11}=B_{s o l}(x, t|\mathcal{P}). \end{aligned} $$ \end{proposition} \subsection{Existence and uniqueness of solutions for external RH problems} We see that $M^{out}(k)$ is a reflection soliton solution, and the reflection mainly comes from $T(k)$. In order to connect $M^{out}(x,t,k)$ with the case of non reflection scattering $\mathcal{D}=\{(k_{j}, c_{j}^{\prime})\}_{j=1}^{N}$, an idea is to take $\nabla=\triangle_{k_0}^{-}$ in Eq.(\ref{ms}). So there are $$ \begin{aligned} &T(k)=\prod_{j \in \Delta^{-}_{k_{0}}} \frac{k-k^{*}_{j}}{k-k_{j}} \exp \left(i \int_{-k_0}^{k_0} \frac{\nu(s)}{s-k} d k\right)=s_{11,\Delta^{-}_{k_{0}}} \delta(k),\\ &T\left(k_{j}\right)^{-2}=s_{11,\Delta^{-}_{k_{0}}}(k_{j})^{2} \delta(k_{j})^{-2}, \quad(\frac{1}{T} )^{\prime}\left(k_{j}\right)^{-2}=s_{11,\Delta^{-}_{k_{0}}}^{\prime}\left(k_{j}\right)^{-2} \delta\left(k_{j}\right)^{2}. \end{aligned} $$ The scattering data can be written as \begin{equation}\label{db} \widetilde{\mathcal{D}}=\left\{\left(k_{j}, \widetilde{c}_{j}\right)\right\}_{j=1}^{N}, \quad \widetilde{c}_{j}= \begin{cases}c_{j}^{-1} s_{11,\Delta_{k^{-}_{0}}}^{\prime}\left(k_{j}\right)^{-2} \delta\left(k_{j}\right)^{2}, & j \in \Delta_{k_{0}}^{-} \\ c_{j} s_{11,\Delta_{k^{-}_{0}}}\left(k_{j}\right)^{2} \delta\left(k_{j}\right)^{-2}, & j \notin \Delta_{k_{0}}^{-}\end{cases}. \end{equation} Therefore, RHP \ref{10r} is rewritten as \begin{rhp}\label{11r} For a given scattering data $\mathcal{\tilde{D}}=\left\{\left(k_{j}, \tilde{c}_{j}\right)\right\}_{j=1}^{N}$, a matrix $M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})$ can be found to satisfy: $\bullet$ $M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})$ is analytical in $\mathbb{C} \backslash\left( \mathcal{K} \cup \mathcal{K}^{*}\right)$; $\bullet$ $M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})=\sigma_{0} M^{*}_{\Delta_{k_{0}}^{-}}(k^{*} \mid \mathcal{\tilde{D}})\sigma_{0}^{-1};$ $\bullet$ $M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty$; $\bullet$ $M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})$ has simple poles at each point in $k_j\in \mathbb{C}^{+}$ and $k_j^{*}\in \mathbb{C}^{-}$ with: \begin{equation}\label{r101} \begin{array}{l} \underset{k=k_{j}}{\operatorname{Res}} M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})=\left\{\begin{array}{ll} \underset{k \rightarrow k_{j}}\lim M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})\left(\begin{array}{cc} 0 & \Lambda^{-1}_j s_{11,\Delta_{k^{-}_{0}}}^{\prime-2}(k_j) \\ 0 & 0 \end{array}\right) , j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow k_{j}}\lim M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})\left(\begin{array}{cc} 0 & 0 \\ \Lambda_j s_{11,\Delta_{k^{-}_{0}}}^{2}(k_j)& 0 \end{array}\right), j \notin \Delta_{k_{0}}^{-}, \end{array}\right.\\ \underset{k={k}^{*}_{j}}{\operatorname{Res}} M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})=\left\{\begin{array}{ll} \underset{k \rightarrow {k}^{*}_{j}}\lim M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})\left(\begin{array}{cc} 0 & 0 \\ -\Lambda^{*-1}_j s^{*\prime-2}_{11,\Delta_{k_{0}}^{-}}(k^{*}_j) & 0 \end{array}\right), j \in \Delta_{k_{0}}^{-}, \\ \underset{k \rightarrow {k}^{*}_{j}}\lim M_{\Delta_{k_{0}}^{-}}(k \mid \mathcal{\tilde{D}})\left(\begin{array}{cc} 0 & -\Lambda_j s_{11,\Delta_{k_{0}}^{-}}^{*^-2}(k^{*}_{j})\\ 0 & 0 \end{array}\right), j \notin \Delta_{k_{0}}^{-}. \end{array}\right. \end{array} \end{equation} where $\Lambda_j=c_{j}\delta^{-2} e^{2 i t \theta\left(k_{j}\right)}$. \end{rhp} So we have the following corollary \begin{corollary} There exists and unique solution for the RHP \ref{8r}, moreover $$ M^{out}(x,t,k)=M_{\Delta_{k_{0}}^{-}}(x,t,k \mid \tilde{\mathcal{D}}), $$ where scattering data $\tilde{\mathcal{D}}$ is given by (\ref{db}) and $$ \begin{aligned} A_{sol}\left(x, t|\mathcal{D}\right)&=4 i \lim _{k \rightarrow \infty}\left[k M^{out}(x,t,k \mid \mathcal{D})\right]_{12}\\ &=4 i \lim _{k \rightarrow \infty}\left[k M_{\Delta_{k_{0}}^{-}}(x,t,k \mid \tilde{\mathcal{D}})\right]_{12}=A_{s o l}\left(x, t|\tilde{\mathcal{D}}\right),\\ B_{sol}\left(x, t|\mathcal{D}\right)&=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}[k M^{out}(x,t,k \mid \mathcal{D})]_{11}\\ &=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty} \frac{d}{d t}[k M_{\Delta_{k_{0}}^{-}}(x,t,k \mid \tilde{\mathcal{D}})]_{11}=B_{s o l}\left(x, t|\tilde{\mathcal{D}}\right). \end{aligned} $$ \end{corollary} \subsection{The long-time behavior of soliton solution} This section mainly considers the asymptotic behavior of soliton solutions. On the basis of the residue condition (\ref{r101}), let $N=1,k=\zeta+i\eta$, under the condition of no scattering, the soliton solution of the coupled dispersion AB system is \begin{equation} \begin{aligned} &A(x,t)=4\eta sech(2\eta(x+\frac{\alpha}{4|k|^2}t))e^{i\zeta(-2x+\frac{\alpha}{2|k|^2}t)},\\ &B(x,t)=-\frac{2\alpha\eta^2}{\beta|k|^2}sech(\eta(2x+\frac{\alpha}{2|k|^2}t))^2. \end{aligned} \end{equation} It can be seen that the velocity of soliton solution is $v=-\frac{\alpha}{4|k|^2}.$ Suppose $x_1 < x_2$ with $x_1,x_2\in \mathbb{R}$ and $v_1 < v_2$ with $v_1,v_2\in \mathbb{R}^{-}$, a conical region can be defined as $$ \mathcal{C}\left(x_{1}, x_{2}, v_{1}, v_{2}\right)=\left\{(x, t) \in \mathbb{R}^{2} \mid x=x_{0}+v t, x_{0} \in\left[x_{1}, x_{2}\right], v \in\left[v_{1}, v_{2}\right]\right\}. $$ \begin{figure} {\includegraphics[width=9.2cm,height=5cm]{xv.jpg}} \centering \caption{\small The cone $\mathcal{C}(x_1, x_2, v_1, v_2).$}\label{9t} \end{figure} Then make the following marks \begin{equation} \begin{aligned} &\mathcal{I}=\left\{k: f\left(v_{2}\right)<|k|<f\left(v_{1}\right)\right\}, \quad f(v) \doteq\left(-\frac{\alpha}{4v}\right)^{\frac{1}{2}}, \\ &\mathcal{K}(\mathcal{I})=\left\{k_{j} \in \mathcal{K}: k_{j} \in \mathcal{I}\right\}, \quad N(\mathcal{I})=|\mathcal{K}(\mathcal{I})|, \\ &\mathcal{K}^{+}(\mathcal{I})=\left\{k_{j} \in \mathcal{K}:\left|k_{j}\right|>f\left(v_{1}\right)\right\}, \\ &\mathcal{K}^{-}(\mathcal{I})=\left\{k_{j} \in \mathcal{K}:\left|k_{j}\right|<f\left(v_{2}\right)\right\}, \\ &c_{j}^{\pm}(\mathcal{I})=c_{j} \prod_{\operatorname{Re} k_{n} \in I_{\pm} \backslash \mathcal{I}}\left(\frac{k_{j}-k_{n}}{k_{j}-k^{*}_{n}}\right)^{2} \exp \left[\pm \frac{1}{\pi i} \int_{I_{\pm}} \frac{\log [1+r(\varsigma) {r^{*}({\varsigma}^{*})]}}{\varsigma-k_{j}} d \varsigma\right]. \end{aligned} \end{equation} \begin{figure}[htpb] \centering {\includegraphics[width=7.5cm,height=5cm]{ki.jpg}} ~~~~~~~~~~~~\caption{\small Here, the original data has eight pairs zero points of discrete spectrum, but insider the cone $\mathcal{C}$ only two pairs points with $\mathcal{K}(\mathcal{I})=\left\{k_{j} \in \mathcal{K}: k_{j} \in \mathcal{I}\right\},j=2,3$.}\label{t10} \end{figure} \begin{proposition} Let $ \nabla=\Delta_{k_{0}}^{\mp}$ in $\mathcal{C}\left(x_{1}, x_{2}, v_{1}, v_{2}\right)$ on RHP \ref{10r}, and ensure the following estimation when $t\rightarrow\infty$: \begin{equation} \left\|\Theta_{j}^{\Delta^\mp_{k_{0}}}\right\|=\left\{\begin{array}{ll} \mathcal{O}(1), & k_{j} \in \mathcal{K}(\mathcal{I}), \\ \mathcal{O}\left(e^{-2 \mu t}\right), & k_{j} \in \mathcal{K} \backslash \mathcal{K}(\mathcal{I}), \end{array} \quad t \rightarrow \infty\right. \end{equation} where $$\mu=\min _{k_{j} \in \mathcal{K} \backslash \mathcal{K}(\mathcal{I})}\left\{\operatorname{Im} k_{j}\operatorname{dist}\left(v_{k_{j}}-v\right)\right\},~~ v_j=-\frac{\alpha}{4|k_j|^2}, $$ and in the formula, $v_j-v$ represents the difference between the speed of a soliton and the speed corresponding to $k$. \end{proposition} \begin{proof} Here we take $\nabla=\triangle_{k_0}^{-}$ as an example to prove the above estimation. When $k=k_j\in\mathcal{K}^{-}(\mathcal{I})$ and $(x,t)\in \mathcal{C}(x_1,x_2,t_1,t_2)$, then the remainder condition for equation (\ref{91}) $$ |\varpi_j(x_0+vt,k_j)|\leq c|e^{-2i\theta(k_j)t}|. $$ Next, focus on the index part $$ -2i\theta(k_j)t=-2i(k_j\frac{x}{t}-\frac{\alpha}{4k_j})t=-2i(k_j\frac{x_0+vt}{t}-\frac{\alpha}{4k_j})t\\ =-2ik_jx_0-2i(k_jv-\frac{\alpha}{4k_j})t. $$ Its real part is $$ Re(-2i\theta(k_j)t)=2Imk_jx_0-2Imk_jt(v_j-v), $$ so there $$ |e^{-2i\theta(k_j)t}|=e^{2Imk_jx_0}e^{-2Imk_jt(v_j-v)}\leq ce^{-2\mu t}. $$ \end{proof} For the discrete spectrum $k_{j} \in \mathcal{K} \backslash \mathcal{K}(\mathcal{I})$, make a disk $D_{k}$ with a sufficiently small radius at each point and do not intersect each other, and define the function \begin{equation} \Gamma(k)= \begin{cases}I-\frac{1}{k-k_{j}} \Theta^{j}_{\Delta_{\mathcal{K}}^{\pm}}, & k \in D_{k}, \\ I-\frac{1}{k-{k^{*}_{j}}} \sigma_{2} \Theta^{*j}_{\Delta_{\mathcal{K}}^{\pm}} \sigma_{2}, & k \in \bar{D_{k}}, \\ I, & elsewhere \end{cases} \end{equation} where $$ \Theta^{j}_{\Delta_{\mathcal{K}}^{\pm}}=\begin{cases}\left(\begin{array}{cc} 0 & \varpi_j^{-1}(s_{11,\nabla}^{\prime})^{-2}(k_{j})\\ 0 & 0 \end{array}\right), j \in \nabla ,\\ \left(\begin{array}{cc} 0 & 0 \\ \varpi_js_{11,\nabla}^2(k_j) & 0 \end{array}\right), \quad j \notin \nabla. \end{cases} $$ Make transformation $$ \widetilde{M}_{\Delta_{k_{0}}^{\pm}}\left(k \mid \widetilde{D}_{\Delta_{k_{0}}^{\pm}}\right)=M_{\Delta_{k_{0}}^{\pm}}\left(k \mid \widetilde{D}_{\Delta_{k_{0}}^{\pm}}\right) \Gamma(k), $$ and $\widetilde{M}_{\Delta_{k_{0}}^{\pm}}\left(k \mid \widetilde{D}_{\Delta_{k_{0}}^{\pm}}\right)$ satisfies the following relationship \begin{equation}\label{M} \widetilde{M}_{\Delta_{k_{0}}^{\pm}}\left(k \mid \widetilde{D}_{\Delta_{k_{0}}^{\pm}}\right)=M_{\Delta_{k_{0}}^{\pm}}\left(k \mid \widetilde{D}_{\Delta_{k_{0}}^{\pm}}\right) \widetilde{V}{(k)},k \in \widetilde{\Sigma}=\underset{k_{j} \in \mathcal{K} \backslash \mathcal{K}(\mathcal{I})}\bigcup\partial D_{k} \cup \partial \bar{D}_{k}. \end{equation} The jump matrix $\widetilde{V}(k)=\Gamma(k) $ is known based on the above proposition 8 \begin{equation}\label{vk} \|\widetilde{V}(k)-I\|_{L^{\infty}(\widetilde{\Sigma})}=\mathcal{O}\left(e^{-2 \mu t}\right). \end{equation} In addition, let \begin{equation}\label{m0} M_0(k)=\widetilde{M}_{\Delta_{k_{0}}^{-}}\left(k \mid \widetilde{\mathcal{D}}_{\Delta_{k_{0}}^{-}}\right)\left[M_{\Delta^{-}_{k_0}}\left(k \mid \widetilde{\mathcal{D}}(\mathcal{I})\right)\right]^{-1}, \end{equation} where $\widetilde{\mathcal{D}}(\mathcal{I})=\{k_j,c_j(\mathcal{I})\},~c_{j}(\mathcal{I})=c_{j} \prod_{\operatorname{Re} k_{n} \in I_{\pm} \backslash \mathcal{I}}\left(\frac{k_{j}-k_{n}}{k_{j}-{k}^{*}_{n}}\right)^{2}$. it is obvious that $\widetilde{M}_{\Delta^{-}_{k_0}}(k|\widetilde{\mathcal{D}})$ and $M_{\Delta^{-}_{k_0}}(k|\widetilde{\mathcal{D}}) $ have the same residue condition, so $M_0(k)$ has no poles, its jump is \begin{equation}\label{m0v} M_{0}^{+}(k)=M_{0}^{-}(k) V_{M_{0}}(k),~~~~k\in \widetilde{\Sigma}. \end{equation} Further, the form of jump matrix $V_{M_{0}}(k)$ is \begin{equation} V_{M_{0}}(k)=M_{\Delta_{k_{0}}^{-}}\left(k \mid \widetilde{\mathcal{D}}(\mathcal{I})\right) \widetilde{V}(k) M_{\Delta_{k_{0}}^{-}}\left(k \mid \widetilde{\mathcal{D}}(\mathcal{I})\right)^{-1}, \end{equation} according to equation (\ref{vk}) \begin{equation} \left\|V_{M_{0}}(k)-I\right\|_{L^{\infty}(\widetilde{\Sigma})}=\|\tilde{V}(k)-I\|_{L^{\infty}(\widetilde{\Sigma})}=\mathcal{O}\left(e^{-2 \mu t}\right), \quad t \rightarrow \infty. \end{equation} Due to the small norm RH property, it is known that $M_0(k)$ exists and $$ M_0(k)=I+\mathcal{O}\left(e^{-2 \mu t}\right), \quad t \rightarrow \infty. $$ So there are \begin{equation} M_{\Delta_{k_0}^{\pm}}\left(k \mid \widetilde{\mathcal{D}}\right)=\left(I+\mathcal{O}\left(e^{-2 \mu t}\right)\right) M_{\Delta_{k_0}^{\pm}}\left(k \mid \widetilde{\mathcal{D}}(\mathcal{I})\right). \end{equation} \begin{corollary} $\widetilde{\mathcal{D}}$ represents the scattering data of the equation (\ref{AB}), corresponding to the N-soliton solution of the coupled dispersion AB system, and $\widetilde{\mathcal{D}}(\mathcal{I})$ represents the scattering data on $\mathcal{K}(\mathcal{I})$, when $x,t\in \mathcal{C}(x_1,x_2,v_1,v_2)$ $$ \begin{aligned} A_{s o l}\left(x, t|\widetilde{\mathcal{D}}\right)&=4 i \lim _{k \rightarrow \infty}\left[k M_{\Delta_{k_{0}}^{\pm}}(x,t,k \mid \widetilde{\mathcal{D}})\right]_{12}\\ &=4 i \lim _{k \rightarrow \infty}\left[k M_{\Delta_{k_{0}}^{\pm}(\mathcal{I})}(x,t,k \mid \widetilde{\mathcal{D}}({\mathcal{I}})\right]_{12}+\mathcal{O}\left(e^{-2 \mu t}\right), \quad t \rightarrow \infty, \end{aligned} $$ $$ \begin{aligned} B_{s o l}\left(x, t|\widetilde{\mathcal{D}}\right)&=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty}\frac{d}{dt}\left[k M_{\Delta_{k_{0}}^{\pm}}(x,t,k \mid \widetilde{\mathcal{D}})\right]_{11}\\ &=-\frac{4 i}{\beta} \lim _{k \rightarrow \infty}\frac{d}{dt}\left[k M_{\Delta_{k_{0}}^{\pm}(\mathcal{I})}(x,t,k \mid \widetilde{\mathcal{D}}({\mathcal{I}})\right]_{11}+\mathcal{O}\left(e^{-2 \mu t}\right), \quad t \rightarrow \infty. \end{aligned} $$ \end{corollary} \subsection{Solvable RHP near phase point} From Eq.(\ref{VI}), we can see that $||V(k)-I||$ has no consistent small jump in the neighborhood $\mathcal{A}_1$ and $\mathcal{A}_2$ when $t\rightarrow\infty$, so we need to establish a local model $M^{in}(k)$, which completely matches the jump of $M_{rhp}(k)$ on $(\Sigma^{(2)}\cap \mathcal{A}_1)\cup (\Sigma^{(2)}\cap \mathcal{A}_2)$ of the error function $M^{err}(k)$, so as to achieve a consistent estimation of the attenuation of the transition. \begin{rhp}\label{12r} For a matrix $M^{AB}(k)$, the following properties are satisfied:\\ ~~~~~~~~$\bullet$ $M^{AB}(k)$ is analyticity in $\mathbb{C} \backslash \Sigma^{AB},$ $\Sigma^{AB}=\cup_{j}\Sigma^{j}, $ $j=1,2^{+},3^{+},4,5,6^{+}$,$7^{+},8;$ $\bullet$ $M^{AB}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty$; $\bullet$ $M^{AB}(k)$ has continuous boundary values $M^{AB}_{\pm}(k)$ on $\Sigma^{AB}$ and $$ M_{+}^{AB}(k)=M_{-}^{AB}(k) V^{AB}|_{\mathcal{A}_1\cup \mathcal{A}_2}(k), \quad k \in \Sigma^{AB}, $$ where $$ V^{AB}|_{\mathcal{A}_1\cup \mathcal{A}_2}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ r\left(-k_0\right) \delta^{-2}\left(-k_0\right)\left(k+k_0\right)^{-2 i v\left(-k_0\right)} e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{1}, \\ \left(\begin{array}{cc} 1 & \frac{r^{*}\left(-k_0\right) \delta^{2}\left(-k_0\right)}{1+\left|r\left(-k_0\right)\right|^{2}}\left(k+k_0\right)^{2 i v\left(-k_0\right)}e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{2}^{+}, \\ \left(\begin{array}{cc} 1 & \frac{r^{*}\left(k_0\right) \delta^{2}\left(k_0\right)}{1+\left|r\left(k_0\right)\right|^{2}}\left(k-k_0\right)^{2 i v\left(k_0\right)} e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{3}^{+}, \\ \left(\begin{array}{cc} 1 & 0 \\ r\left(k_0\right) \delta^{-2}\left(k_0\right)\left(k-k_0\right)^{-2 i v\left(k_0\right)} e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{4}, \\ \left(\begin{array}{cc} 1 & r^{*}\left(-k_0\right) \delta^{2}\left(-k_0\right)\left(k+k_0\right)^{2 i v\left(-k_0\right)} e^{-2 i t \theta} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{8}, \\ \left(\begin{array}{cc} 1 & 0\\ \frac{r\left(-k_0\right) \delta^{-2}\left(-k_0\right)}{1+\left|r\left(-k_0\right)\right|^{2}}\left(k+k_0\right)^{-2 i v\left(-k_0\right)} e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{7}^{+},\\ \left(\begin{array}{cc} 1 & 0\\ \frac{r\left(k_0\right) \delta^{-2}\left(k_0\right)}{1+\left|r\left(k_0\right)\right|^{2}}\left(k-k_0\right)^{-2 i v\left(k_0\right)} e^{2 i t \theta} & 1 \end{array}\right), & k \in \Sigma_{6}^{+},\\ \left(\begin{array}{cc} 1 & r^{*}\left(k_0\right)\delta^{2}\left(\xi_{2}\right)\left(k-k_0\right)^{2 i v\left(k_0\right)} e^{-2 i t \theta}\\ 0 & 1 \end{array}\right), & k \in \Sigma_{5}. \end{cases} $$ This is mainly because when there is no discrete spectrum, $T_0{(\pm k_0)}$ can be reduced to $\delta(\pm k_0)$ and $1-\Upsilon_{\mathcal{K}}(k)=1$. \end{rhp} Here, we need to consider the well-known PC model near the two phase points, as shown in Fig.\ref{10t}. \begin{figure}[h] {\includegraphics[width=9.5cm,height=2.8cm]{zfk.jpg}} \centering \caption{\small The jump contour Jump profile of local RHP near phase points $\pm k_0$}\label{10t} \end{figure} First, expand $\theta(k)$ at $k_0$ point \begin{equation} \theta(k)=-\frac{1}{2}\frac{\alpha}{k_0}-\frac{1}{4}\frac{\alpha}{k_0^3}(k-k_0)^2+\frac{1}{4}\frac{\alpha}{k_0^4}(k-k_0)^3, \end{equation} then define the following transformation \begin{equation}\label{tf} \mathbb{T}: f(k) \rightarrow(\mathbb{T }f)(k)=f\left(\sqrt{\frac{-k_0^3}{\alpha t}}\zeta+k_0\right), \end{equation} so there is on $\Sigma_4$ $$ \begin{aligned} &r\left(k_0\right) \delta^{-2}\left(k_0\right)\left(k-k_0\right)^{-2 i v\left(k_0\right)} e^{2 i t \theta}\\ &=r\left(k_0\right) \delta^{-2}\left(k_0\right)(\sqrt{\frac{-k_0^3}{\alpha t}}\zeta_1)^{-2 i v\left(k_0\right)} e^{2 i t (-\frac{1}{2}\frac{\alpha}{k_0}-\frac{1}{4}\frac{\alpha}{k_0^3}(k-k_0)^2+\frac{1}{4}\frac{\alpha}{k_0^4}(k-k_0)^3)}\\ &=r\left(k_0\right) \delta^{-2}\left(k_0\right) e^{i \nu\left(k_0\right)\left(\ln (k_0^3)-\ln(-\alpha t)\right)}\zeta_1^{-2i\nu(k_0)}e^{\frac{i\zeta_1^2}{2}} e^{-i \alpha t [\frac{1}{k_0}-\frac{1}{2}\frac{1}{k_0^4}(k-k_0)^3]}, \end{aligned} $$ we set \begin{equation} r_{k_0}=r\left(k_0\right) \delta^{-2}\left(k_0\right) e^{i \nu\left(k_0\right)\left(\ln (k_0^3)-\ln(-\alpha t)\right)} e^{-i \alpha t [\frac{1}{k_0}-\frac{1}{2}\frac{1}{k_0^4}(k-k_0)^3]}, \end{equation} in the same way, we can calculate the values of $\Sigma_{2}^{+},\Sigma_{3}^{+},\Sigma_4,\Sigma_{6}^{+},\Sigma_{7}^{+}$ and $\Sigma_8$. Therefore, the jump matrix of $V^{AB}$ in $\mathcal{A}_1\cup \mathcal{A}_2$ can be rewritten as $$ V^{AB}|_{\mathcal{A}_1\cup \mathcal{A}_2}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ r_{-k_0} \zeta^{-2 i \nu\left(-k_0\right)} e^{i \zeta^{2} / 2} & 1 \end{array}\right), & k \in \Sigma_{1}, \\ \left(\begin{array}{cc} 1 & \frac{{r}^{*}_{-k_0}}{1+\left|r_{-k_0}\right|^{2}} \zeta^{2 i \nu\left(-k_0\right)} e^{-i \zeta^{2} / 2} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{2}^{+}, \\ \left(\begin{array}{cc} 1 & \frac{{r}^{*}_{k_0}}{1+\left|r_{k_0}\right|^{2}} \zeta^{2 i \nu\left(k_0\right)} e^{-i \zeta^{2} / 2} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{3}^{+}, \\ \left(\begin{array}{cc} 1 & \\ r_{k_0} \zeta^{-2 i \nu\left(k_0\right)} e^{i \zeta^{2} / 2} & 1 \end{array}\right), & k \in \Sigma_{4}, \\ \left(\begin{array}{cc} 1 & {r}^{*}_{-k_0} \zeta^{2 i \nu\left(-k_0\right)} e^{-i \zeta^{2} / 2} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{8},\\ \left(\begin{array}{cc} 1 & 0\\ \frac{r_{-k_0}}{1+\left|r_{-k_0}\right|^{2}} \zeta^{-2 i \nu\left(-k_0\right)} e^{i \zeta^{2} / 2} & 1 \end{array}\right), & k \in \Sigma_{7}^{+},\\ \left(\begin{array}{cc} 1 & 0\\ \frac{r_{k_0}}{1+\left|r_{k_0}\right|^{2}} \zeta^{-2 i \nu\left(k_0\right)} e^{i \zeta^{2} / 2} & 1 \end{array}\right), & k \in \Sigma_{6}^{+},\\ \left(\begin{array}{cc} 1 & {r}^{*}_{k_0} \zeta^{2 i \nu\left(k_0\right)} e^{-i \zeta^{2} / 2}\\ 0 & 1 \end{array}\right), & k \in \Sigma_{5}. \end{cases} $$ If the PC model considered in $k_0$ is expanded in the following form $$ M_{k_0}^{PC}(\zeta)=I+\frac{M_{1}^{p c}\left(k_0\right)}{i\zeta}+\mathcal{O}\left(\zeta^{-2}\right), $$ where $$ \begin{aligned} &M_{1}^{PC}\left(k_0\right)=\left(\begin{array}{cc} 0 & \Xi_{12}\left(k_0\right) \\ -\Xi_{21}\left(k_0\right) & 0 \end{array}\right), \\ &\Xi_{12}\left(k_0\right)=\frac{\sqrt{2 \pi} e^{i \pi / 4} e^{-\pi \nu\left(k_0\right) / 2}}{r_1 \Gamma\left(-i \nu\left(k_0\right)\right)}, \\ &\Xi_{21}\left(k_0\right)=-\frac{\sqrt{2 \pi} e^{-i \pi / 4} e^{-\pi \nu\left(k_0\right) / 2}}{{r^{*}_1} \Gamma\left(i \nu\left(k_0\right)\right)}. \end{aligned} $$ The same is true for $-k_0$. According to the transformation equation (\ref{tf}), the relationship between $M^{AB}$ and $M^{PC}$ is $$ M^{AB}=I+\frac{1}{ i\zeta} ( M_{1}^{PC}\left(k_0\right)+M_{1}^{PC}\left(-k_0\right))+\mathcal{O}\left(\zeta^{-2}\right), $$ further can be written as \begin{equation}\label{mabi} M^{AB}(x, t ,k)=I+\sqrt{\frac{-k_0^3}{\alpha t}} \frac{M_1^{P C}\left(k_0\right)}{k-k_0}+\sqrt{\frac{-k_0^3}{\alpha t}}\frac{M_1^{P C}\left(-k_0\right)}{k+k_0}+\mathcal{O}(\zeta^{-2}) . \end{equation} From this, we get a consistent estimate \begin{equation}\label{mab} \left|M^{AB}-I\right| \lesssim O\left(t^{-\frac{1}{2}}\right). \end{equation} Near the local circle of $\pm k_0$ have $$ \left|\frac{1}{k\mp k_0}\right|<c, $$ where $c$ is a constant. Finally, we use $M^{AB}$ to define a local model in $\pm k_0$ $$ M^{(i n)}(k)=M^{o u t}(k) M^{AB}(k), $$ it has the same jump matrix as $M_{rhp}$ and is a bounded function in ${\mathcal{A}_1}$ and ${\mathcal{A}_2}$. \subsection{Small norm RH problem of $M^{err}(k)$} In the disk ${\mathcal{A}_1}\cup{\mathcal{A}_2}$, $M^{PC}(k)$ is consistent with the jump matrix of $M^{(2)}_{rhp}(k)$, but $M^{out}(k)$ does not have a jump. Therefore, the matrix $M^{err}(k)$ defined by (\ref{mout}) erases the jump of $M^{(2)}_{rhp}(k)$ inside the disk ${\mathcal{A}_1}\cup {\mathcal{A}_2}$, and there is still a jump from $M^{(2)}_{rhp}(k)$ outside the disk $\mathbb{C}\setminus{\mathcal{A}_1\cup\mathcal{A}_2}$. Therefore, the jump path of $M^{err}(k)$ is $$ \Sigma^{err}=\cup_{n=1}^{2} \partial \mathcal{A}_{n} \cup\left(\Sigma^{(2)} \backslash \cup_{n=1}^{2} \mathcal{A}_{n}\right), $$ where $\partial \mathcal{A}_{n}$ is clockwise, see Fig.\ref{11t}. $M^{err}(k)$ can be directly verified to meet the following RHP: \begin{figure} {\includegraphics[width=9cm,height=3.23cm]{ek.jpg}} \centering \caption{\small The jump contour $\Sigma^{err}$ for the $M^{err}(k)$.}\label{11t} \end{figure} \begin{rhp}\label{13r} For a matrix $M^{err}(k)$, the following properties are satisfied: $\bullet$ $M^{err}(k)$ is analytical in $\mathbb{C} \backslash \Sigma^{err}$; $\bullet$ $M^{err}(k)=\sigma_{0} (M^{err}(k^{*}))^{*}\sigma_{0}^{-1};$ $\bullet$ $M^{err}(k)=I+\mathcal{O}\left(k^{-1}\right), \quad k \rightarrow \infty$; $\bullet$ $M^{err}(k)$ has continuous boundary values $M_{\pm}^{err}(k)$ on $\Sigma^{err}$ and $$ M^{err}_{+}(k)=M^{err}_{+}(k) V^{err}(k), \quad k \in \Sigma^{err}, $$ where $$ V^{err}(k)= \begin{cases}M^{out}(k) V^{(2)}(k) M^{out}(k)^{-1}, & k \in \Sigma^{(2)} \backslash \cup_{n=1}^{2} \mathcal{A}_{n}, \\ M^ {out}(k) M^{AB}(k) M^{out}(k)^{-1}, & k \in \cup_{n=1}^{2} \partial \mathcal{A}_{n}.\end{cases} $$ \end{rhp} \begin{proof} Here we mainly prove the form of $V^{err}(k)$. When $k \in \Sigma^{(2)} \backslash \cup_{n=1}^{2} \mathcal{A}_{n}$, $M^{err}(k)=M^{(2)}_{rhp}(k)(M^{out}(k))^{-1}$ and $M^{out}(k)$ does not jump in (\ref{mout}), then $$ \begin{aligned} M^{err}_{+}(k)&=M^{(2)}_{rhp+}(k)(M^{out}(k))^{-1}=M^{(2)}_{rhp-}(k)V^{(2)}(k)(M^{out}(k))^{-1}\\ &=M^{err}_{-}(k)V^{err}(k)=M^{2}_{rhp-}(k)M^{out}(k)^{-1}V^{err}(k) , \end{aligned} $$ obviously, $$ V^{err}=M^{out}(k)V^{(2)}(M^{out}(k))^{-1},~~~k \in \Sigma^{(2)} \backslash \cup_{n=1}^{2} \mathcal{A}_{n}. $$ When $k \in\cup_{n=1}^{2} \mathcal{A}_{n}$, we have $$M^{err}=M^{(2)}_{rhp}(k)(M^{(in)}(k))^{-1}=M^{(2)}_{rhp}(k)(M^{AB}(k))^{-1}(M^{out}(k))^{-1},$$ and $M^{(2)}_{rhp}(k)$ does not jump in $\cup_{n=1}^{2} \partial \mathcal{A}_{n}$, then $$ M^{err}_{-}(k)=M^{(2)}_{rhp}(k) (M^{AB}(k))^{-1}(M^{out}(k))^{-1}. $$ For $k \in \cup_{n=1}^{2} \partial \mathcal{A}_{n}$, $$ M^{err}_{+}(k)=M^{(2)}_{rhp}(k) (M^{out}(k))^{-1}, $$ so from $$M^{err}_{+}(k)=M^{err}_{-}(k)V^{err}(k),~~~~k \in \cup_{n=1}^{2} \partial \mathcal{A}_{n},$$ we get $$ V^{err}(k)=M^ {out}(k) M^{AB}(k) (M^{out}(k))^{-1},~~~k \in \cup_{n=1}^{2} \partial \mathcal{A}_{n}. $$ \end{proof} Next, we will show that the small norm RH problem can be well solved by the error function $M^{err}(k)$ for large time. It is known from equations $(\ref{itheta})$ and $(\ref{VI})$ that the jump matrix satisfies the following estimation \begin{equation}\label{veii} \left\|V^{err}-I\right\| \lesssim O\left(e^{-2 t \varepsilon}\right),~~~k \in \Sigma^{(2)} \backslash\left(\mathcal{A}_{1} \cup \mathcal{A}_{2}\right). \end{equation} In addition, it is known from equations (\ref{mab}) that when $k \in \cup_{n=1}^{2} \partial \mathcal{A}_{n} $, $V^{err}(k)$ satisfies the following estimation \begin{equation}\label{vei} \left\|V^{err}(k)-I\right\|=\left|M^{out }(k)^{-1}\left(M^{AB}(k)-I\right) M^{out}(k)\right|=\mathcal{O}\left(t^{-\frac{1}{2}}\right). \end{equation} \begin{proposition} $RHP \ref{13r}$ has a unique solution in the form of \begin{equation} M^{err}(k)=I+\frac{1}{2 \pi i} \int_{\Sigma^{err}} \frac{\mu^{err}(s)\left(V^{err}(s)-I\right)}{s-k} d s, \end{equation} where $\mu^{err}\in L^{2}\left(\Sigma^{err}\right)$, meet $\left(1-C_{err}\right) \mu^{err}=I$, $C_{err}$ is Cauchy projection operator, defined as $$ C_{err} f(z)=\lim _{k^{\prime} \rightarrow k \in \Sigma^{err}} \frac{1}{2 \pi i} \int_{\Sigma^{err}} \frac{f(s)}{s-k^{\prime}} d s. $$ \end{proposition} \begin{proof} It can be seen from Eq.(\ref{vei}) that the operator is bounded. It can be seen from Ref.\cite{CF-2022-JDE} \begin{equation}\label{ul} \|\mu\|_{L^{2}\left(\Sigma^{err}\right)} \lesssim \frac{\left\|C_{err}\right\|}{1-\left\|C_{err}\right\|} \lesssim t^{-\frac{1}{2} }, \end{equation} obviously, $1-C_{err}$ is reversible, so $M^{err}$ is unique. \end{proof} \begin{proposition} Consider the asymptotic expansion of $M^{err}$ when $k\rightarrow\infty$ \begin{equation} M^{err}(k)=I+\frac{M^{err}_{1}}{k}+\mathcal{O}\left(\frac{1}{k^{2}}\right), \end{equation} where $$ \begin{aligned} M^{err}_{1}&=\frac{1}{i}\sqrt{\frac{-k_0^3}{\alpha t}}M^{out}(k_0)M_1^{P C}\left(k_0\right)(M^{out})^{-1}(k_0)\\ &-\frac{1}{i}\sqrt{\frac{-k_0^3}{\alpha t}} M^{out}(-k_0)M_1^{P C}\left(-k_0\right)(M^{out})^{-1}(-k_0)+\mathcal{O}(t^{-1}). \end{aligned} $$ \end{proposition} \begin{proof} From Proposition 10, $$ M^{err}_{1}=-\frac{1}{2 \pi i} \int_{\Sigma^{err}} \mu^{err}(s)\left(V^{err}(s)-I\right) d s , $$ then there are \begin{equation} \begin{aligned} M^{err}_{1}&=-\frac{1}{2 \pi i} \int_{\Sigma^{err}}\left(V^{err}-I\right) d s-\frac{1}{2 \pi i} \int_{\Sigma^{err}}\left(\mu^{err}(s)-I\right)\left(V^{err}-I\right) d s \\ &=-\frac{1}{2 \pi i} \oint_{\cup_{n=1}^{2} \partial \mathcal{A}_{n} }\left(V^{err}-I\right) d s-\frac{1}{2 \pi i} \int_{\Sigma^{err} \backslash \cup_{n=1}^{2} \partial \mathcal{A}_{n} }\left(V^{err}-I\right) d s \\ &-\frac{1}{2 \pi i} \int_{\Sigma^{err}}\left(\mu^{err}(s)-I\right)\left(V^{err}-I\right) d s . \end{aligned} \end{equation} Using equations (\ref{veii}), (\ref{ul}), $M^{err}_{1}$ can be written as $$ M^{err}_{1}=-\frac{1}{2 \pi i} \oint_{\cup_{n=1}^{2} \partial \mathcal{A}_{n}}\left(V^{err}(s)-I\right) d s+O\left(t^{-1}\right). $$ And using equations (\ref{mabi}) and (\ref{vei}), and residue theorem there are $$ \begin{aligned} M^{err}_{1}&=\frac{1}{i}\sqrt{\frac{-k_0^3}{\alpha t}}M^{out}(k_0)M_1^{P C}\left(k_0\right)(M^{out})^{-1}(k_0)\\ &-\frac{1}{i}\sqrt{\frac{-k_0^3}{\alpha t}} M^{out}(-k_0)M_1^{P C}\left(-k_0\right)(M^{out})^{-1}(-k_0)+\mathcal{O}(t^{-1}). \end{aligned} $$ \end{proof} \section{Asymptotic analysis on the pure $\bar{\partial}$-problem} In this section, we mainly solve the part of $\bar{\partial} \mathcal{R}^{(2)}(k)\neq0$ in $M^{(3)}(k)$, that is, RHP \ref{7r}. Its solution can be expressed in the following form \begin{equation}\label{m3} M^{(3)}(k)=I-\frac{1}{\pi} \iint_{\mathbb{C}} \frac{M^{(3)} W^{(3)}}{s-k} \mathrm{~d} A(s), \end{equation} where $W^{(3)}=M^{(2)}_{rhp}(k) \bar{\partial} R^{(2)} M^{(2)}_{rhp}(k)^{-1},$ and $dA(s)$ is the Lebesgue measure on the real plane. In fact, Eq.(\ref{m3}) can also be written in the form of an operator \begin{equation} (I-\mathbb{S}) M^{(3)}(k)=I, \end{equation} where $\mathbb{S}$ is Cauchy-Green operator, $$ \mathbb{S}[f](k)=-\frac{1}{\pi} \iint_{\mathbb{C}} \frac{f(s) W(s)}{s-k} \mathrm{~d} A(s). $$ If the operator $(I-\mathbb{S})^{-1}$ exists, then the above equation has a solution. Next, we will prove the existence of operator $(I-\mathbb{S})^{-1}$ in regions $D_5$ and $D_4^{\pm}$, which can be proved by similar methods in other regions. Before proving the existence of operator $(I-\mathbb{S})^{-1}$, we give the following lemma \begin{lemma} \begin{equation} \begin{aligned} \left|\bar{\partial} R_{5}^{(2)} e^{2 i \theta t}\right| \lesssim\left(\left|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right|+\left|p_5^{\prime}(\operatorname{Re}(k))\right|+\left|k-k_0\right|^{-\frac{1}{2}}\right) e^{-c_1|u||v| t},~~~k \in D_{5}\\ \left|\bar{\partial} R_{7}^{(3)} e^{-2 i \theta t}\right| \lesssim\left\{\begin{array}{l} \left(\left|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right|+\left|p_4^{\prime}(\operatorname{Re}(k))\right|+\frac{1}{|k|^{1/2}}\right) e^{-c_2|v| t},~~~k \in D_{4}^{-} \\ \left(\left|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right|+\left|p_4^{\prime}(\operatorname{Re}(k))\right|+\left|k-k_0\right|^{-\frac{1}{2}}\right) e^{-c_1|u||v| t}.~~~ k \in D_{4}^{+} \end{array}\right. \end{aligned}\label{l2} \end{equation} \end{lemma} \begin{proof} Recalling the above condition $\alpha<0$, for the convenience of analysis, the exponential part can be written as $-\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})$, which is a decreasing function of $u$. In the $D_5$ region, the index part has $$ \begin{aligned} -\frac{\alpha v t}{2}\left(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2}\right)&=-\frac{\alpha v t}{2}\left(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2}\right)\\ &=-\frac{\alpha v t}{2}\left(\frac{-u^2-2k_0u-v^2}{((u+k_0)^2+v^2)(k_0^2)}\right)\\ &\leq -c_1|u||v|t. \end{aligned} $$ There is a similar analysis in area $D_4^{+}$. In region $D_4^{-}$, $k=u+iv$ and $0\leq v <u$ the index part has $$ \begin{aligned} \frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})&=\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})\\ &\leq -c_2|v|t. \end{aligned} $$ The overall conclusion is summarized as equation (\ref{l2}). \end{proof} Therefore, our next goal is to prove the existence of $(I-\mathbb{S})^{-1}$. \begin{proposition} For sufficiently large $t$, operator $\mathbb{S}$ is a small norm and has \begin{equation}\label{sl} \|\mathbb{S}\|_{L^{\infty} \rightarrow L^{\infty}} \leqslant c t^{-\frac{1}{4}}, \end{equation} therefore, $(I-\mathbb{S})^{-1}$ exists. \end{proposition} \begin{proof} This is discussed in detail in the $D_5$ region, and other regions can be obtained similarly. Let $s=u+k_0+iv,k=\zeta+i\eta $, for any $f \in L^{\infty}$, we have \begin{equation} \begin{aligned} |\mathbb{S}(f)| &\leq \frac{1}{\pi} \iint_{D_5} \frac{\left|f M_{rhp}^{(2)} \bar{\partial} R^{(2)} M_{rhp}^{(2)}{ }^{-1}\right|}{|s-k|} d A(s)\\ &\leq \frac{1}{\pi}\|f\|_{L^{\infty}}\left\|M_{rhp}^{(2)}\right\|_{L^{\infty}}\left\|M_{rhp}^{(2)}{ }^{-1}\right\|_{L^{\infty}} \int_{0}^{\infty} \int_{k_0+v}^{\infty}\frac{\left|\bar{\partial} R_{5}\right| e^{\frac{\alpha v t}{2}(\frac{1}{k_0^2}-\frac{1}{(u+k_0)^2+v^2})}}{|s-k|} du dv \\ &\leq c\left(\Omega_{1}+\Omega_{2}+\Omega_{3}\right), \end{aligned} \end{equation} where $$ \begin{aligned} &\Omega_{1}=\int_{0}^{\infty} \int_{k_0+v}^{\infty}\frac{\left|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right|e^{\frac{\alpha v t}{2}(\frac{1}{k_0^2}-\frac{1}{(u+k_0)^2+v^2})}}{|s-k|}du dv,\\ &\Omega_{2}=\int_{0}^{\infty} \int_{k_0+v}^{\infty}\frac{\left|r^{\prime}(\operatorname{Re}(s))\right|e^{\frac{\alpha v t}{2}(\frac{1}{k_0^2}-\frac{1}{(u+k_0)^2+v^2})}}{|s-k|}du dv,\\ &\Omega_{3}=\int_{0}^{\infty} \int_{k_0+v}^{\infty}\frac{\left|s-k_0\right|^{-\frac{1}{2} }e^{\frac{\alpha v t}{2}(\frac{1}{k_0^2}-\frac{1}{(u+k_0)^2+v^2})}}{|s-k|} du dv. \end{aligned} $$ Next, the main idea is to estimate $\Omega_{j},j=1,2,3$. An important inequality to know in advance is \begin{equation}\label{sk} \begin{aligned} \left\|\frac{1}{s-k}\right\|_{L^{2}\left(v+k_0, \infty\right)}^{2}&=\int_{v+k_0}^{\infty} \frac{1}{|s-k|^{2}} d u \leq \int_{-\infty}^{\infty} \frac{1}{|s-k|^{2}} d u \\ &=\int_{-\infty}^{\infty} \frac{1}{(u-\zeta)^{2}+(v-\eta)^{2}} d u=\frac{1}{|v-\eta|} \int_{-\infty}^{\infty} \frac{1}{1+y^{2}} d y=\frac{\pi}{|v-\eta|}, \end{aligned} \end{equation} where $y=\frac{u-\zeta}{v-\eta}$. For $\Omega_1$, it can be obtained by direct calculation using Eq.(\ref{sk}) \begin{equation} \begin{aligned} \Omega_{1} &\leq \int_{0}^{\infty} \left\|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right\|_{L^{2}}\left\|\frac{1}{s-k}\right\|_{L^{2}} d v \leq c_{3} \int_{0}^{\infty} \frac{e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2})}}{\sqrt{|\eta-v|}}d v\\ &\leq c_3 \int_{0}^{\infty} \frac{e^{-c_1|u||v|t}}{\sqrt{|\eta-v|}}d v \leq c_3 \int_{0}^{\infty} \frac{e^{-c_1|v|^2 t}}{\sqrt{|\eta-v|}}d v\\ &\leq c t^{-\frac{1}{4}}. \end{aligned} \end{equation} Use the same method to estimate $\Omega_2$. For the estimation of $\Omega_3$, Here we need the help of H\"{o}lder inequality with $ p> 2$ and $\frac{1}{p}+\frac{1}{q}=1$. \begin{equation}\label{slp} \begin{aligned} \left\||s-k_0|^{-\frac{1}{2}}\right\|_{L^{p}(k_0+v,\infty)}&=\left(\int_{k_0+v}^{\infty} |u-k_0+i v|^{-\frac{p}{2}} d u\right)^{\frac{1}{p}} \\ &=\left(\int_{v}^{\infty} {|u+i v|^{-\frac{p}{2} }} d u\right)^{\frac{1}{p} }=\left(\int_{v}^{\infty} {\left(u^{2}+v^{2}\right)^{-\frac{p}{4}}} d u\right)^{\frac{1}{p}} \\ &=v^{\frac{1}{p}-\frac{1}{2}}\left(\int_{1}^{\infty} {\left(1+x^{2}\right)^{-\frac{p}{4}}} d x\right)^{\frac{1}{p}} \leq c v^{\frac{1}{p}-\frac{1}{2}}. \end{aligned} \end{equation} Similar estimates can be proved $$ \left\|\frac{1}{s-k}\right\|_{L^{q}(v, \infty)} \leq c|v-\eta|^{\frac{1}{q}-1}, \quad \frac{1}{q}+\frac{1}{p}=1. $$ Then we have \begin{equation} \begin{aligned} \Omega_{3} &\leq c \int_{0}^{+\infty}\left\||s-k_0|^{-\frac{1}{2}}\right\|_{L^{p}}\left\|\frac{1}{s-k}\right\|_{L^{q}}e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2})-\frac{1}{k_0^2}}d v\\ &\leq c \int_{0}^{+\infty}\left\||s-k_0|^{-\frac{1}{2}}\right\|_{L^{p}}\left\|\frac{1}{s-k}\right\|_{L^{q}}e^{-c_1|u||v|t}d v\\ &\leq c \int_{0}^{+\infty}\left\||s-k_0|^{-\frac{1}{2}}\right\|_{L^{p}}\left\|\frac{1}{s-k}\right\|_{L^{q}}e^{-c_1v^2t}d v\\ &\leq c\left[\int_{0}^{\eta} v^{\frac{1}{p}-\frac{1}{2}}|v-\eta|^{\frac{1}{q}-1}e^{-c_1v^2t} d v+\int_{\eta}^{\infty} v^{\frac{1}{p}-\frac{1}{2}}|v-\eta|^{\frac{1}{q}-1}e^{-c_1v^2t} d v\right]\\ &\leq H_1+H_2, \end{aligned} \end{equation} the following is the estimation of the two integrals. For $H_1$, since $0\leq v<\eta$, the following estimates are obtained by replacing $v=w\eta$ with variables $$ \begin{aligned} H_1=&\int_{0}^{\eta} v^{\frac{1}{p}-\frac{1}{2}}(\eta-v)^{\frac{1}{q}-1} e^{-c_1v^2t}d v\\ &=\int_{0}^{1} \eta^{\frac{1}{2}}w^{\frac{1}{p}-\frac{1}{2}}(1-w)^{\frac{1}{q}-1} e^{-c_1w^2\eta^2t}d w \\ &\leq c t^{-\frac{1}{4}}. \end{aligned} $$ For $H_2$, we let $w=v-\eta$, then $$ \begin{aligned} H_2=&\int_{\eta}^{\infty} v^{\frac{1}{p}-\frac{1}{2}}(v-\eta)^{\frac{1}{q}-1} e^{-c_1v^2t}d v\\ &=\int_{0}^{\infty} (w+\eta)^{\frac{1}{p}-\frac{1}{2}}w^{\frac{1}{q}-1} e^{-c_1(w+\eta)^2t}d w\\ &\leq c t^{-\frac{1}{4}}\int_{0}^{\infty} w^{-\frac{1}{2}} e^{-c_1(w)^2t}d w\\ &\leq c t^{-\frac{1}{4}}. \end{aligned} $$ So combining the estimates of $H_1$ and $H_2$, we get $\Omega_3\leq ct^{-\frac{1}{4}}$. In the $D_4^{-}$ region, the estimation is still divided into three parts, at this time, there is $s=u+iv$. \begin{equation} \begin{aligned} |\mathbb{S}(f)| &\leq \frac{1}{\pi} \iint_{D_4^{-}} \frac{\left|f M_{rhp}^{(2)} \bar{\partial} R^{(2)} M_{rhp}^{(2)}{ }^{-1}\right|}{|s-k|} d A(s)\\ &\leq \frac{1}{\pi}\|f\|_{L^{\infty}}\left\|M_{rhp}^{(2)}\right\|_{L^{\infty}}\left\|M_{rhp}^{(2)}{ }^{-1}\right\|_{L^{\infty}} \iint_{D_{4}^{-}} \frac{\left|\bar{\partial} R_{3}\right| e^{\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})}}{|s-k|} d A(s) \\ &\leq c\left(\Omega^{\prime}_{1}+\Omega^{\prime}_{2}+\Omega^{\prime}_{3}\right), \end{aligned} \end{equation} where $$ \begin{aligned} &\Omega^{\prime}_{1}=\int_{0}^{\frac{k_0}{2}} \int_{v}^{\frac{k_0}{2}}\frac{\left|\bar{\partial} \Upsilon_{\mathcal{K}}(s)\right|e^{\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})}}{|s-k|}dudv,\\ &\Omega^{\prime}_{2}=\int_{0}^{\frac{k_0}{2}} \int_{v}^{\frac{k_0}{2}}\frac{\left|r^{\prime}(\operatorname{Re}(s))\right|e^{\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})}}{|s-k|}dudv,\\ &\Omega^{\prime}_{3}=\int_{0}^{\frac{k_0}{2}} \int_{v}^{\frac{k_0}{2}}\frac{\left|s\right|^{-\frac{1}{2} }e^{\frac{\alpha v t}{2}(\frac{1}{u^2+v^2}-\frac{1}{k_0^2})}}{|s-k|} dudv. \end{aligned} $$ Combined with lemma (\ref{l2}) and Eq.(\ref{sk}), we can estimate each integral. For $\Omega^{\prime}_{1}$, \begin{equation} \begin{aligned}\label{o1} \Omega^{\prime}_{1} & \lesssim \int_{0}^{\frac{k_0}{2}} e^{-c_2|v|t} \int_{v}^{\frac{k_0}{2}} \frac{r^{\prime}(u)}{|s-k|} d u d v \\ & \leq c \int_{0}^{\frac{k_0}{2}} \left\|\frac{1}{s-k}\right\|_{L^{2}}e^{-c_2|v|t} d v\\ & \leq c \int_{0}^{\infty} \frac{e^{-c_2|v|t}}{\sqrt{|\eta-v|}}d v\\ & \leq c t^{-\frac{1}{2}}. \end{aligned} \end{equation} The estimation of $ \Omega^{\prime}_{2}$ is similar to that of $\Omega^{\prime}_{1}$, the estimation method of $\Omega^{\prime}_{3}$ is similar to that of $\Omega_{3}$, and can get \begin{equation} \Omega^{\prime}_{j}\leq c t^{-\frac{1}{2}},~~~j=2,3. \end{equation} Therefore, this proves that all regions meet (\ref{sl}). \end{proof} Next, consider the expansion of $M^{(3)}$, $$ M^{(3)}(k)=I+\frac{M_{1}^{(3)}(x, t)}{k}+\mathcal{O}\left(k^{-2}\right), \quad k \rightarrow \infty, $$ from the previous equation (\ref{m3}), it is easy to know $$ M_{1}^{(3)}(x, t)=\frac{1}{\pi} \int_{\mathbb{C}} M^{(3)}(s) W^{(3)}(s) d A(s). $$ Further, we can prove that \begin{proposition} For a large t, we have \begin{equation}\label{m13} \left|M_{1}^{(3)}\right| \leq c t^{-\frac{3}{4} }. \end{equation} \end{proposition} \begin{proof} Owing to $M_{rhp}^{(2)}$ is bounded outside the pole, there is \begin{equation} \begin{aligned} \left|M_{1}^{(3)}\right| &\leq \frac{1}{\pi} \iint_{D_5} \left|M^{(3)} M_{rhp}^{(2)} \bar{\partial} R^{(2)} M_{rhp}^{(2)}{ }^{-1}\right| d A(s)\\ &\leq \frac{1}{\pi}\left\|M^{(3)}\right\|_{L^{\infty}}\left\|M_{rhp}^{(2)}\right\|_{L^{\infty}}\left\|\left(M_{rhp}^{(2)}\right)^{-1}\right\|_{L^{\infty}} \iint_{D_5}\left|\bar{\partial} R_{5} e^{2 i t \theta}\right| d A(s) \\ &\leq c(\iint_{D_{5}}|\bar{\partial}\Upsilon_{\mathcal{K}}(s)| e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2})} d A(s)+\iint_{D_5}|p_5^{\prime}(u)| e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2})} d A(s)\\ &~~~~~+\iint_{D_{5}} \frac{1}{\left|s-k_0\right|^{1 / 2}} e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2})} d A(s)) \\ &\leq c\left(\Omega_{4}+\Omega_{5}+\Omega_{6}\right). \end{aligned} \end{equation} We constrain $\Omega_{4}$ by using the Cauchy-Schwarz inequality $$ \begin{aligned} \left|\Omega_{4}\right| \leq & \int_{0}^{\infty}\left\|\bar{\partial} \Upsilon_{\mathcal{K}}\right\|_{L_{u}^{2}\left(v+k_0, \infty\right)}\left(\int_{v}^{\infty}e^{-c_1 t |u| |v|} d u\right)^{\frac{1}{2}} d v \\ \leq & c t^{-\frac{1}{2}} \int_{0}^{\infty} \frac{e^{-4 t v^{2}}}{\sqrt{v}} dv \\ \leq & c t^{-\frac{1}{4}} \int_{0}^{\infty} \frac{e^{-4 w^{2}}}{\sqrt{w}} d w \leq c t^{-\frac{3}{4}}. \end{aligned} $$ Similar constraints can be done for $\Omega_{5}$. For the constraint of $\Omega_{6}$, we follow the method of $\Omega_{3}$ and use H\"{o}lder inequality and Eq.(\ref{slp}) to obtain $$ \begin{aligned} I_{3}=& \int_{0}^{+\infty} \int_{k_0+v}^{+\infty}\left(\left(u-k_0\right)^{2}+v^{2}\right)^{-\frac{1}{4}} e^{-\frac{\alpha v t}{2}(\frac{1}{(u+k_0)^2+v^2}-\frac{1}{k_0^2})} d u d v \\ & \leq \int_{0}^{+\infty}\left\|\left(\left(u-k_0\right)^{2}+v^{2}\right)^{-1 / 4}\right\|_{L^{p}}\left(\int_{k_0+v}^{+\infty} e^{-c_1q |u| |v| t}du \right)^{\frac{1}{q}} d v\\ & \leq \int_{0}^{+\infty}v^{\frac{1}{p}-\frac{1}{2}}\left(\int_{k_0+v}^{+\infty} e^{-c_1q |u| |v| t}du \right)^{\frac{1}{q}} d v\\ &\leq c t^{-\frac{1}{q} } \int_{0}^{+\infty} v^{\frac{2}{p}-\frac{3}{2}} e^{-c_1q |v+k_0| |v| t} d v,\\ &\leq c t^{-\frac{3}{4} } \int_{0}^{\infty} w^{\frac{2}{p} -\frac{3}{2} } e^{-c_1q w^2 t} d w \leq c t^{-\frac{3}{4}} \end{aligned} $$ Here we replace the variable $v=wt^{-\frac{1}{2}}$. Notice that here $2<p<4$ and $-1<\frac{2}{p} -\frac{3}{2}<-\frac{1}{2}$. \end{proof} \section{Long time asymptotic behavior of soliton solution region for the coupled dispersive AB system} After many deformations above, we now begin to construct the long-term asymptotic properties of the coupled dispersive AB system (\ref{AB}). Looking back at the previous transformation, we have \begin{equation}\label{mt} M(k)=M^{(3)}(k) M^{err}(k) M^{out}(k) \mathcal{R}^{(2)}(k)^{-1} T(k)^{\sigma_{3}}, \quad k \in \mathbb{C} \backslash\mathcal{A}_1\cup\mathcal{A}_2. \end{equation} In particular, in the vertical direction $k\in D_2,D_{10}$, there is $\mathcal{R}^{(2)} = I$, so we consider $k\rightarrow\infty$ in this region, so $$ M=\left(I+\frac{M_{1}^{(3)}}{k}+\ldots\right)\left(I+\frac{M^{err}_{1}}{k}+\ldots\right)\left(I+\frac{M_{1}^{out}}{k} +\ldots\right)\left(I+\frac{T_{1}^{\sigma_{3}}}{k}+\ldots\right). $$ In order to recover the potential, the coefficient of ${k}^{-1}$ needs to be collected $$ M_{1}=M_{1}^{o u t}+M^{err}_{1}+M_{1}^{(3)}+T_{1}^{\sigma_{3}}, $$ so there \begin{equation} \begin{aligned} &A= 4 i(M_{1}^{o u t}+M_{1}^{err})_{12}+\mathcal{O}(t^{-\frac{3}{4}}),\\ &B=-\frac{4 i}{\beta}\frac{d}{dt} (M_{1}^{o u t}+M_1^{err})_{11}+\mathcal{O}(t^{-\frac{3}{4}}). \end{aligned} \end{equation} Based on the above formula, the specific asymptotic state can be written in the form of the following theorem \begin{theorem} Suppose $A_0,B_0\in H^{1,1}(\mathbb{R})$ have general scattering data, and $A(x,t)$ and $B(x,t)$ are the solutions of equation (\ref{AB}). For fixed $x_1 < x_2$ with $x_1,x_2\in \mathbb{R}$ and $v_1 < v_2$ with $v_1,v_2\in \mathbb{R}^{-}$, a conical region can be defined as $$ \mathcal{C}\left(x_{1}, x_{2}, v_{1}, v_{2}\right)=\left\{(x, t) \in \mathbb{R}^{2} \mid x=x_{0}+v t, x_{0} \in\left[x_{1}, x_{2}\right], v \in\left[v_{1}, v_{2}\right]\right\}. $$ Then we define two regions for the spectral parameters $$\mathcal{I}=\left\{k: f\left(v_{2}\right)<|k|<f\left(v_{1}\right)\right\}, \quad f(v) \doteq\left(-\frac{\alpha}{4v}\right)^{1 / 2},$$ as is shown in Fig. \ref{t10}. Using $A_{s o l}(x, t,k|\widetilde{\mathcal{D}})$ and $B_{s o l}(x, t,k|\widetilde{\mathcal{D}})$ for the coupled dispersive AB system corresponding to $N(\mathcal{I}) \leq N$ modulated non reflection scattering data $$ \widetilde{D}(\mathcal{I})=\{k_j,c_j(\mathcal{I})\},~c_{j}(\mathcal{I})=c_{j}\prod_{k_n\in \mathcal{K}( \mathcal{I})}\left(\frac{k_{j}-k_{n}}{k_{j}-{k}^{*}_{n}}\right)^{2}. $$ Then when $t\rightarrow\infty$ and $(x, t)\in \mathcal{C} (x_1, x_2, v_1, v_2)$, there is $$ \begin{aligned} &A(x, t)=A_{s o l}(x, t|\widetilde{D}(\mathcal{I}))+t^{-\frac{1}{2}}(g_1+g_2)+\mathcal{O}(t^{-\frac{3}{4}}),\\ &B(x, t)=B_{s o l}(x, t|\widetilde{D}(\mathcal{I}))+t^{-\frac{1}{2}}(h_1+h_2+f_1+f_2)+\mathcal{O}(t^{-\frac{3}{4}}), \end{aligned} $$ where $$ M^{out}\left(\pm k_0\right)=\left(\begin{array}{cc} m_{11}(\pm k_0) & m_{12}(\pm k_0) \\ m_{21}(\pm k_0) & m_{22}(\pm k_0) \end{array}\right), ~j=1,2\\ $$ $$ \begin{aligned} &g_1=4\sqrt{\frac{-k_0^3}{\alpha}}(m^2_{12}(-k_0)\Xi_{21}(-k_0)+m^2_{11}(-k_0)\Xi_{12}(-k_0)),\\ &g_2=4\sqrt{\frac{-k_0^3}{\alpha}}(m^2_{12}(k_0)\Xi_{21}(k_0)+m^2_{11}(k_0)\Xi_{12}(k_0)),\\ &h_1=\frac{4}{\beta}\sqrt{\frac{-k_0^3}{\alpha}}\frac{d}{dt}(m_{12}(-k_0)m_{22}(-k_0)\Xi_{21}(-k_0)+m_{11}(-k_0)m_{21}(-k_0)\Xi_{12}(-k_0)),\\ &h_2=\frac{4}{\beta}\sqrt{\frac{-k_0^3}{\alpha}}\frac{d}{dt}(m_{12}(k_0)m_{22}(k_0)\Xi_{21}(k_0)+m_{11}(k_0)m_{21}(k_0)\Xi_{12}(k_0)),\\ &f_1=\frac{2}{\beta t}\sqrt{\frac{-k_0^3}{\alpha}}m_{12}(-k_0)m_{22}(-k_0)\Xi_{21}(-k_0)+m_{11}(-k_0)m_{21}(-k_0)\Xi_{12}(-k_0),\\ &f_2=\frac{2}{\beta t}\sqrt{\frac{-k_0^3}{\alpha}}m_{12}(k_0)m_{22}(k_0)\Xi_{21}(k_0)+m_{11}(k_0)m_{21}(k_0)\Xi_{12}(k_0). \end{aligned} $$ \end{theorem} \section*{Appendix A: Estimation of characteristic function} In the previous assumption 2.1, there is no zero point of $s_{11}$ on $\mathbb{R}$, so there is no pole of $r(k)$ on $\mathbb{R}$. From Volterra integral formula (\ref{jost}) $$ \begin{aligned} &\psi_{11}^{\pm}(x,0,k)=1+\int_{\pm\infty}^{x}\frac{1}{2}A(y,k)\psi_{21}^{\pm}dy,\\ &\psi_{21}^{\pm}(x,0,k)=\int_{\pm\infty}^{x}-\frac{1}{2}A^{*}(y,k)\psi_{11}^{\pm}e^{2ik(x-y)}dy. \end{aligned} $$ Let $$ \Psi_1^{-}=(\psi_{11}^{-},~~\psi_{21}^{-})^{T}. $$ For $k \in \mathbb{R}$, we introduce an operator mapping $$ \Re_0 f=\int_{-\infty}^{x}T_0f(y)dy, $$ and $$ T_0=\left(\begin{array}{rr} 0 & \frac{1}{2}A \\ -\frac{1}{2}A^{*}e^{2ik(x-y)} & 0 \end{array}\right). $$ It can be seen from this that $$ |\Re_0f(x)| \leq \int_{-\infty}^{x}\frac{1}{2}\left|A(y)\right| d y\|f\|_{\left(L^{\infty}(-\infty, 0]\right)}, $$ which means that $\Re_0$ is a bounded linear operator on $L^{\infty}(-\infty, 0]$. Further, it can be obtained by mathematical induction that $$ \left|\Re_0^{n} f(x)\right| \leq \frac{1}{n !}\left(\int_{-\infty}^{x}\frac{1}{2}\left|A(y)\right| d y\right)^{n}\|f\|_{\left(L^{\infty}(-\infty, 0]\right)}. $$ Therefore, the following series is uniformly convergent on $x\in(-\infty, 0]$, \begin{equation} \Psi_1^{-}(x,k)=\sum_{n=0}^{\infty} \Re_0^{n}\left(\begin{array}{l} 1 \\ 0 \end{array}\right).\label{p1} \end{equation} So for $k \in \mathbb{R}$ and $x\in(-\infty, 0]$, $$ \left|\Psi_{1}(x, k)^{-}_{1}\right| \leq e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}. $$ Similarly, we can get $$ \begin{aligned} &\left|\Psi^{-}_{2}(x,k)\right| \leq e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}, x \in(-\infty, 0]; \\ &\left|\Psi^{+}_{1}(x,k)\right| \leq e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}, x \in[0, \infty); \\ &\left|\Psi^{+}_{2}(x,k)\right| \leq e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}, x \in[0, \infty). \end{aligned} $$ Let's look at the derivative of the characteristic function with respect to $k$. According to the uniform convergence property of series (\ref{p1}), we have $$ \begin{aligned} \Psi^{-}_{1,k}(x, k) &=\sum_{n=0}^{\infty} \partial_{k}\Re_0^{n}\left(\begin{array}{l} 1 \\ 0 \end{array}\right)=\sum_{n=1}^{\infty} \sum_{m=0}^{n} \Re_0^{m} \Re_0^{\prime} \Re_0^{n-m-1}\left(\begin{array}{l} 1 \\ 0 \end{array}\right) \end{aligned}, $$ where the form of $\Re_0^{\prime}$ is $$ \Re_0^{\prime}f(x)=\int_{-\infty}^{x}\left(\begin{array}{ll} 1 & 0 \\ 0 & e^{2 i k(x-y)} \end{array}\right)\left(\begin{array}{c} \frac{1}{2}A(y) f_{2} \\ - i(x-y) A^{*} f_{1} \end{array}\right) d y. $$ Similarly, $\Re_0^{\prime}$ is a bounded liner operator on $x\in(-\infty, 0]$ with $$ \left\|\Re_0^{\prime}\right\|_{L^{\infty}(-\infty, 0]} \leq \left\|A\right\|_{L^{1,1}(\mathbb{R})}. $$ So there is $$ \begin{aligned} \Psi^{-}_{1,k}(x, k)& \leq \sum_{n=1}^{\infty}\left|\partial_{k}\Re_0^{n}\left(\begin{array}{l} 1 \\ 0 \end{array}\right)\right|\leq \sum_{n=0}^{\infty} \frac{1}{2}\frac{\left\|A\right\|_{L^{1}(\mathbb{R})^{n-1}}}{(n-1) !} \left\|A\right\|_{L^{1,1}(\mathbb{R})} \\ & \leq \left\|A\right\|_{L^{1,1}(\mathbb{R})} e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}} \end{aligned} $$ for $k \in \mathbb{R}$ and $x\in(-\infty, 0]$. In similar steps, we can also get $$ \Psi^{-}_{2,k}(x, k)\leq \left\|A\right\|_{L^{1,1}(\mathbb{R})} e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}; $$ $$ \Psi^{+}_{1,k}(x, k)\leq \left\|A\right\|_{L^{1,1}(\mathbb{R})} e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}; $$ $$ \Psi^{+}_{2,k}(x, k)\leq \left\|A\right\|_{L^{1,1}(\mathbb{R})} e^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}. $$ Next, we will estimate the characteristic function $(\Psi^{\pm})_{ij}(x, k),(i,j=1,2)$ respectively. In fact, there are the following lemma \begin{lemma}\label{l3} For $k \in \mathbb{R}$, we have the following estimates $$ \begin{aligned} &\left\|\psi_{21}^{-}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{-}, L^{2}\left(I_{0}\right)\right)} \lesssim\|A\|_{H^{1,1}}; \\ &\left\|\psi_{21}^{-}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{-} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}};\\ &\left\|\psi_{12}^{-}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{-}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}}; \\ &\left\|\psi_{12}^{-}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{-} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}};\\ &\left\|\psi_{12}^{+}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{+}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}}; \\ &\left\|\psi_{12}^{+}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{+} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}};\\ &\left\|\psi_{21}^{+}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{+}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}}; \\ &\left\|\psi_{21}^{+}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{+} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}}. \end{aligned} $$ \end{lemma} \begin{proof} From the above integral form, we can know that $$ \psi_{21}^{-}(x,0,k)=\int_{-\infty}^{x}-\frac{1}{2}A^{*}(y,k)\psi_{11}^{-}e^{2ik(x-y)}dy, $$ then for $k \in \mathbb{R}$, $\forall \sigma \in C_{0}\left(\mathbb{R}\right)$, we compute $$ \begin{aligned} \left\| \int_{-\infty}^{x}-\frac{1}{2}A^{*}\psi_{11}^{-}e^{2ik(x-y)}dy\right\|_{L^{2}\left(I_{0}\right)}^{2}&=s u p{ }_{\|\phi\|=1} \int_{I_{0}} \sigma(k) \int_{-\infty}^{x} -\frac{1}{2}A^{*}\psi_{11}^{-}e^{2ik(x-y)}dy\\ &\lesssim ce^{\frac{1}{2}\left\|A\right\|_{L^{1}(\mathbb{R})}}\left\|A\right\|_{L^{1}}, \end{aligned} $$ this estimate is direct. In addition, $$ \int_{\mathbb{R}^{+}} \int_{\mathbb{R}}\left|\int_{-\infty}^{x}-\frac{1}{2}A^{*}\psi_{11}^{-}e^{2ik(x-y)}dy\right|^{2} d k d x \lesssim \int_{\mathbb{R}^{+}}\left|\int_{-\infty}^{x}-\frac{1}{2}A^{*}\psi_{11}^{-}e^{2ik(x-y)}dy\right|^{2} d x \lesssim\|A\|_{L^{1,1}}, $$ which implies that for $k \in \mathbb{R}$ $$ \begin{aligned} &\left\|\psi_{21}^{-}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{-}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}}, \\ &\left\|\psi_{21}^{-}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{-} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}}. \end{aligned} $$ Similarly, others can also be obtained. \end{proof} Its derivative form for $k$ has $$ \psi_{21,k}^{-}(x,0,k)=\int_{-\infty}^{x}-\frac{1}{2}A^{*}2i(x-y)\psi_{11}^{-}e^{2ik(x-y)}dy+\int_{-\infty}^{x}-\frac{1}{2}A^{*}\psi_{11,k}^{-}e^{2ik(x-y)}dy, $$ Similarly, the following estimates can be obtained $$ \begin{aligned} &\left\|\psi_{21,k}^{-}(x,0,k)\right\|_{C^{0}\left(\mathbb{R}^{-}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}} \\ &\left\|\psi_{21,k}^{-}(x,0,k)\right\|_{L^{2}\left(\mathbb{R}^{-} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}} \end{aligned} $$ According to Eq.(\ref{s112}) $$ \begin{aligned} &s_{11}(k)-1=(\psi^{-}_{11}-1)(\psi^{+}_{22}-1)+(\psi^{-}_{11}-1)+(\psi^{+}_{22}-1)-\psi^{-}_{21}\psi^{+}_{12}.\\ &s_{12}(k)=e^{2ikx}(\psi^{-}_{12}\psi^{+}_{22}-\psi^{-}_{22}\psi^{+}_{12}). \end{aligned} $$ Let's examine $\psi^{-}_{11}-1$ and $\psi^{+}_{22}-1$. $$ \begin{aligned} &\psi^{-}_{11}-1=\int_{-\infty}^{x}\frac{1}{2}A(y)\psi_{21}^{-}dy,\\ &\psi^{+}_{22}-1=\int_{-\infty}^{x}-\frac{1}{2}A^{*}(y)\psi_{12}^{+}dy, \end{aligned} $$ it's easy to know that $\psi^{-}_{11}-1$ is bounded and can be obtained by using Lemma \ref{l3} that $$ \begin{aligned} &\left\|\psi_{11}^{-}(x,0,k)-1\right\|_{C^{0}\left(\mathbb{R}^{-}, L^{2}\left(\mathbb{R}\right)\right)} \lesssim\|A\|_{H^{1,1}} \\ &\left\|\psi_{11}^{-}(x,0,k)-1\right\|_{L^{2}\left(\mathbb{R}^{-} \times \mathbb{R}\right)} \lesssim\|A\|_{H^{1,1}}. \end{aligned} $$ The estimation of $\psi^{+}_{22}-1$ can be obtained similarly. For $$ s_{11,k}=\psi^{-}_{11,k}\psi^{+}_{22}+\psi^{-}_{11}\psi^{+}_{22,k}-\psi^{-}_{21,k}\psi^{+}_{12}-\psi^{-}_{21}\psi^{+}_{12,k} $$ where $$ \psi^{-}_{11,k}=\int_{-\infty}^{x}\frac{1}{2}A(y,k)\psi_{21,k}^{-}dy, ~~~\psi^{+}_{22,k}=\int_{\infty}^{x}\frac{1}{2}A(y,k)\psi_{12,k}^{+}dy. $$ A similar operation is performed on $s_{12}(k)$. Tracing back to the above estimates, when $k \in \mathbb{R}$ and initial value $A \in H^{1,1}$, there is $$ \begin{aligned} s_{11}(k)\in L^{2}(\mathbb{R}),~~~s_{11,k}(k)\in L^{2}(\mathbb{R}),\\ s_{12}(k)\in L^{2}(\mathbb{R}),~~~s_{12,k}(k)\in L^{2}(\mathbb{R}).\\ \end{aligned} $$ \section*{Appendix B: Solvable parabolic cylinder model} Here we mainly describe the solution of the parabolic cylinder model introduced above. For the cAB equation studied in this paper, since there are two steady-state phase points, we need two parabolic cylinders to describe it. but their expansion forms are the same, using the following model. For $r_0\in \mathbb{R}$, if $\nu=-\frac{1}{2 \pi} \log \left(1+\left|r_{0}\right|^{2}\right)$, define the contour $\Sigma^{PC}=\bigcup_{j=1}^{4} \Sigma_{j}$, $$ \Sigma_{j}=\{\xi \in \mathbb{C}: \arg \xi=(2 j-1) \pi / 4\}, \quad j=1,2,3,4 $$ These four contours divide the plane into six areas $D_j,j=1..6$, as shown in Fig. \ref{16t}. \begin{figure}[htpb] {\includegraphics[width=9cm,height=4.5cm]{vpc.jpg}} \centering \caption{\small The jump contour $V^{PC}$ for the $M^{PC}(k)$.}\label{16t} \end{figure} Therefore, we can consider the RHP corresponding to the following parabolic cylinder model. \begin{rhp}\label{14r} Find a matrix-valued function $M^{PC}(x,t,k)$ which satisfies: $\bullet$ Analyticity: $M(x,t,k)$ is analytic in $\mathbb{C}\backslash\Sigma^{PC}$; $\bullet$ Asymptotic behaviors: $M^{PC}(k)=I+\frac{M_{1}^{PC}}{ik}+O\left(k^{-2}\right), \quad k \rightarrow \infty;$ $\bullet$ Jump condition: $M^{PC}(x,t,k)$ has continuous boundary values $M^{PC}_{\pm}(x,t,k)$ on $\mathbb{R}$ and \begin{equation} M^{PC}_{+}(x, t, k)=M^{PC}_{-}(x, t, k) V^{PC}(k), \quad k \in \mathbb{R}, \end{equation} where \begin{equation} V^{PC}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ r_{0} k^{-2 i \nu} e^{ \frac{ik^{2}}{2}} & 1 \end{array}\right), & k \in \Sigma_{1}, \\ \left(\begin{array}{cc} 1 & \frac{\bar{r}_{0}}{1+\left|r_{0}\right|^{2}} k^{2 i \nu} e^{- \frac{ik^{2}}{2}} \\ 0 & 1 \end{array}\right), & k \in \Sigma_{2}, \\ \left(\begin{array}{cc} 1 & 0 \\ \frac{r_{0}}{1+\left|r_{0}\right|^{2}}k^{-2 i \nu} e^{ \frac{ik^{2}}{2}} & 1 \end{array}\right), & k \in \Sigma_{3}, \\ \left(\begin{array}{cc} 1& \bar{r}_{0} k^{2 i \nu} e^{- \frac{ik^{2}}{2}} \\ 0&1 \end{array}\right), & k \in \Sigma_{4}.\end{cases} \end{equation} \end{rhp} Make changes \begin{equation}\label{pc} M^{PC}=\vartheta \mathcal{P} k^{-i \nu \sigma_{3}} e^{\frac{ik^{2}}{4} \sigma_{3}}, \end{equation} where $$ \mathcal{P}(k)= \begin{cases}\left(\begin{array}{cc} 1 & 0 \\ -r_{0} & 1 \end{array}\right), & k \in D_{1}, \\ \left(\begin{array}{cc} 1 & \frac{-\bar{r}_{0}}{1+\left|r_{0}\right|^{2}} \\ 0 & 1 \end{array}\right), & k \in D_{3}, \\ \left(\begin{array}{cc} 1 & 0 \\ \frac{r_{0}}{1+\left|r_{0}\right|^{2}} & 1 \end{array}\right), & k \in D_{4}, \\ \left(\begin{array}{cc} 1 & \bar{r}_{0} \\ 0 & 1 \end{array}\right), & k \in D_{6}, \\ \left(\begin{array}{ll} 1 & 0 \\ 0 & 1 \end{array}\right), & k \in D_{2} \cup D_{5}.\end{cases} $$ Then we can get a standard RHP with jump only in $k=0$. \begin{rhp}\label{15r} Find a matrix-valued function $\vartheta(x,t,k)$ which satisfies: $\bullet$ Analyticity: $\vartheta(x,t,k)$ is analytic in $\mathbb{C}\backslash \mathbb{R}$; $\bullet$ Asymptotic behaviors: $\vartheta(k) e^{\frac{i k^{2}}{4} \sigma_{3}} k^{-i \nu \sigma_{3}} =I+O\left(k^{-1}\right), \quad k \rightarrow \infty;$ $\bullet$ Jump condition: $ \vartheta_{+}(x,t,k)=\vartheta_{-}(x,t,k)v(0)$. \end{rhp} The above RH problem can be reduced to Weber equation, $$ \partial_{z}^{2} D_{a}(z)+\left[\frac{1}{2}-\frac{z^{2}}{4}+a\right] D_{a}(z)=0, $$ where $$ \begin{aligned} &z=e^{-\frac{3 i \pi}{4}} k,~~~ a=i \Xi_{12} \Xi_{21}=i \nu,\\ &\Xi_{12}=\frac{\sqrt{2 \pi} e^{i \pi / 4 e^{-\pi \nu / 2}}}{r_{0} \Gamma(-a)}, \quad \Xi_{21}=\frac{-\sqrt{2 \pi} e^{-i \pi / 4 e^{-\pi \nu / 2}}}{\bar{r}_{0} \Gamma(a)}=\frac{\nu}{\Xi_{12}}. \end{aligned} $$ The solution of parabolic cylindrical explicit solution $\vartheta(k)$ can be given by parabolic cylindrical function. Obtained from Eq.(\ref{pc}) $$ M^{PC}(k)=I+\frac{M_{1}^{PC}}{ik}+O\left( k^{-2}\right), $$ where $$ M_{1}^{PC}=\left(\begin{array}{cc} 0 & \Xi_{12} \\ -\Xi_{21} & 0 \end{array}\right). $$
\section{Related Work}\label{sec:related} Matching works over the years assume superiority of humans over algorithmic matchers. Traditional crowdsourcing and pay-as-you-go frameworks use humans in-the-loop to validate algorithmic matching solutions~\cite{wang2012crowder,gokhale2014corleone,Crowdmap,zhang2018reducing,dragisic2016user,li2019user,zhang2019invest,lertvittayakumjorn2020find}. Others aim to improve the quality of human labelers~\cite{shraga2021powarematch,yang2018cost}. Alternative research directions aim to surpass the need for humans in-the-loop by introducing unsupervised learning solutions~\cite{kolyvakis2018deepalignment,zhang2020unsupervised,wu2020zeroer} and transfer learning methods~\cite{jin2021deep,shraga12020} or limiting the amount of labels for training using active learning mechanisms~\cite{meduri2020comprehensive,kasai2019low,jain2021deep} and few-shot learning~\cite{kasai2019low,ye2019multi}. In this work we analyze and aim to improve the quality of labels provided in a crowdsourcing setting. Also, we analyze more than one matching task under the same methodology. More general literature on assessing human expertise and quality suggest to identify low quality crowd workers~\cite{callison2009fast,ipeirotis2010quality} mainly relying on gold questions to infer quality in practice~\cite{daniel2018quality}. Similar to our approach, Rzeszotarski and Kittur~\cite{rzeszotarski2011instrumenting} and follow up works~\cite{wu2016novices,goyal2018your} feature engineer human behavior to assess quality. Different from these approaches, we use the extracted features, not only to understand and assess, but also to improve the quality of labels for matching tasks. Recently, Ackerman et al. detected human cognitive biases affecting matching quality~\cite{ackerman2019cognitive}. These biases were used in the scope of open-ended crowdsourcing~\cite{parameswaran2016optimizing} for the task of improving human schema matching~\cite{shraga2020learning,shraga2021powarematch}. The current work focuses on boolean crowdsourcing aiming to address multiple human matching tasks. \section{Discussion and Future Directions}\label{sec:con} In this work, we presented a novel approach to treat humans input, focusing on the labels they provide. We showed that using a cognitive-aware feature extraction of decisions, we can generate better labels. Our experiments further suggested that given a new (matching) dataset to be labeled, the most significant improvement is achieved when a model is pre-trained in the same domain (different users and samples). Moreover, the experiment also indicated HumanAL ability to support cross-domain labeling such that if one's pre-trained model happens to be trained on a different domain they would still benefit from increased label quality. The main idea of this paper is to provide a vision regarding the way human input should be addressed. As an early stage research, there is still room for improvement and future works. One straight-forward idea is to also include non-matching domains, for example, classification tasks, for which, we believe, the observations from this paper can applied to. A recent study~\cite{northcutt2021pervasive} highlighted that even well-known benchmarks suffer from label errors, and we believe that using our methodology for the next generation of benchmark labeling might reduce such errors. We would also like to extend and polish the feature sets to better reflect human decision making process. For example, IncognitoMatch, also includes mouse movements which were shown to be predictive to determine expertise~\cite{shraga2020learning}. Another interesting line of research would be setting more demanding prerequisites for the participants. Some previous works, e.g., Magellan~\cite{konda2016magellan,doan2017human}, use undergrad and grad students as labelers, while in this paper (and more others) the focus is on crowd workers. We initiated an experiment with varying expertise levels (crowd workers, pre-screened crowd workers, undergrads, grads, researchers) to examine these differences. Finally, with IncognitoMatch we can also control the context presented to the user. Another future direction would be the examine this context and its assistance to users in completing the task. \section*{Acknowledgments} This work was supported in part by the National Science Foundation (NSF) under award numbers IIS- 1956096. We thank Gal Goldstein for his assistance in conducting the empirical evaluation and Coral Scharf for IncognitoMatch maintenance. \section{Empirical Evaluation} We now describe our empirical evaluation which provides the following main take-aways: \begin{enumerate} \item The suggested behavioral profile (Section~\ref{sec:modelMain}), aided by a pre-trained black-box machine learning, improves label quality of text matching, schema matching and entity matching. \item Majority decision and the user decision (Figure~\ref{fig:features}) are the most significant features. \item Different from the observations in the setting of open-ended crowdsourced matching~\cite{ackerman2019cognitive,shraga2020learning,shraga2021powarematch}, decision times are less significant in boolean crowdsourcing. \end{enumerate} \subsection{Experimental Settings}\label{sec:setup} We now describe the interface and specific matching tasks we use. \subsubsection{Interface}\label{sec:incognito} We adopt the interface of IncognitoMatch~\cite{shraga2020incognitomatch}, which was originally designed for schema matching problems. IncognitoMatch is a crowdsourcing platform that also gathers cognitive information such as decision times. Confidence is reported on the scale from 0 to 100 (which, in our setting, is normalized to scale between 0 and 1) such that 0 means fully confident no match, 50 means unknown and 100 means fully confident match (see Eq.~\ref{eq:sconf} for a smoothed variation of confidence). Please refer to the demonstration paper~\cite{shraga2020incognitomatch} for additional details. As each task differs in the context it provides, we created a different interface variation for each task. Figure~\ref{fig:inteface} provides screenshots from IncognitoMatch. The sample (element pair) panel for each task is given on top. The decision panel, illustrated at the bottom, is the same for all tasks. \begin{figure}[h] \centering \includegraphics[width=.5\textwidth]{./Figures/interface} \caption{IncognitoMatch Interface for each Task. The sample panel, which is different for each task, is illustrated at the top. The decision panel, same for all tasks, is given at the bottom.} \label{fig:inteface} \end{figure} \subsubsection{Matching Tasks Datasets}\label{sec:matching} For the current study we use three datasets each representing a different matching task. The tasks are publicly accessible. \noindent\textbf{Schema Matching:}\footnote{\url{https://agp.iem.technion.ac.il/incognitomatch/SchemaMatching/}} For the schema matching task we use the traditional well-known Purchase Order dataset~\cite{DO2002a}. The schemata used from this dataset contain high information content (data types and instance examples) to be presented (see Figure~\ref{fig:inteface} for example). \noindent\textbf{Entity Matching:}\footnote{\url{https://agp.iem.technion.ac.il/incognitomatch/ER/}} For the entity matching task we use a Beer structured dataset~\cite{beer} from Magellan~\cite{konda2016magellan}. The entities in this dataset are composed of four elements (please refer to Figure~\ref{fig:example} and~\ref{fig:inteface}) which are available to the user. \noindent\textbf{Text Matching:}\footnote{\url{https://agp.iem.technion.ac.il/incognitomatch/QQP/}} For the text matching task we use the quora question pairs dataset~\cite{qqp}, which is included in the GLUE benchmark~\cite{wang2018glue}. For this domain\footnote{We use domain and task interchangeably, refering to diffrent matching tasks.} the user is provided solely with the question text. \subsection{Human Matchers}\label{sec:participants} We use Prolific Academic\footnote{\url{https://www.prolific.co/}} as a crowdsourcing application from which the participants are directed to IncognitoMatch. We accepted only users using a desktop (no mobile devices) with English as a first language and at least 95\% approval rate. Each participant was provided with 30-50 matching decisions, each annotated with decision time and confidence. For privacy and confidentiality, participants' personal information (age, gender, etc.) is not used or shared. For each dataset we gathered 100 valid participants by screening low performance participants and experiments that had technical issues and errors (e.g., the user left the task in the middle). The full dataset consists of about 12,000 matching decisions. On average a participant spent $\sim$15 minutes on the experiments out of which $\sim$5 minutes spent on instructions and riddles and $\sim$10 minutes on answering matching questions. A typical decision time is between 5 and 15 seconds (average of 11.5 seconds) with an average reported confidence of 0.59 and smoothed confidence (absolute confidence level disregarding the binary decision, see Eq.~\ref{eq:sconf}) of 0.5. This observation is different than the setting of open-ended crowdsourcing~\cite{ackerman2019cognitive,shraga2020learning,shraga2021powarematch} where most participants had more extreme confidence levels (close to 1 for match and close to 0 for no-match). Average decision times regarding a SM sample task are the longest among the tasks (14.5 seconds) and are taken with the lowest average confidence (0.48). An average ER decision is taken faster (10 seconds) than an average TM decision (12 seconds), but with lower confidence (0.6 for EM and 0.65 for TM). \begin{figure}[h] \centering \includegraphics[width=.45\textwidth]{./Figures/time_confidence.jpg} \caption{Time vs. Confidence for each Matching Task} \label{fig:time_conf} \end{figure} Figure~\ref{fig:time_conf} provides an analysis of the relationship between (normalized) decision times and (bucketed) reported confidence, similar to the one presented in~\cite{ackerman2019cognitive}, by matching task. It is quite clear that a negative correlation between the two is also present in our setting, especially for the task of schema matching. In general (using all the decisions from all tasks) a negative statistically significant correlation of $-.103$ (p-val$<0.001$) is observed between decision times and reported confidence. As illustrated in Figure~\ref{fig:time_conf}, the highest (absolute) correlation exist in SM ($-.098$). Milder correlation is observed for EM ($-.091$) and TM ($-.084$). All reported correlations are statistically significant with p-val$<0.001$. One factor that may explain the difference between the different tasks is the context provided to the user. The decision time encodes the exploration of the provided context which is far richer in the SM, reasonably present for EM and does not exist for TM. We note that our feature analysis (to be presented in Section~\ref{sec:ablation}) suggests that, different from the observation by Ackerman et al.~\cite{ackerman2019cognitive}, decision times are less predictive when it comes to correctness. \subsection{Experimental Methodology}\label{sec:method} The overall methodology assumes the existence of some real ground truth labels, i.e., annotated decisions of users. This assumption is realistic since existing benchmarks usually include labels that are validated and corrected over the years. Using such a set, we train a model that can later be used to calibrate the labels provided for unseen decision (what is referred to as a test set). Since we experiment with different types of tasks (domain), we create 4 cross validation settings, varying over three dimensions of train-test splits (Table~\ref{tab:TrainTest}), namely same domain, same samples, and same users. \noindent\textbf{V1:} A na\"ive approach would be to split the users that solved the same matching task (same domain) with the same set of samples into a training set and test set. In other words this simplifying variation assumes we aim to \emph{calibrate new users on a known task}. In this case the majority voting feature (see Section~\ref{sec:ML}) must be excluded since the same samples are used. \noindent\textbf{V2:} We fix the users in the domain and change the the sample set, i.e., we now have \emph{known users solving a different task from the same domain}. \noindent\textbf{V3:} Here we still use the same matching task (domain) for both training and testing; yet we now also see \emph{new users solving a diffrent task from the same domain}. \noindent\textbf{V4:} The most challenging setting is V4 where in testing time we see \emph{new users solving a diffrent task from a diffrent domain} In all settings we use 70\% of samples for training and 30\% were reserved for testing (over which we report the results). \begin{table}[H] \caption{Cross Validation Settings} \label{tab:TrainTest} \centering \begin{tabular}{l c c c} \multicolumn{1}{r}{\textbf{Setting}$\rightarrow$} & \multirow{2}{*}{Same Domain} & \multirow{2}{*}{Same Samples} & \multirow{2}{*}{Same Users}\\ $\downarrow$\textbf{Name} & & & \\ \toprule V1 & \cmark & \cmark & \xmark\\ V2 & \cmark & \xmark & \cmark\\ V3 & \cmark & \xmark & \xmark\\ V4 & \xmark & \xmark & \xmark\\ \end{tabular} \end{table} \noindent\textbf{Implementation:} We use python's Sklearn\footnote{\url{https://scikit-learn.org/}} for the implementation of the classifiers. Specifically, we trained ten different classifiers\footnote{KNN, Linear SVM, RBF SVM, Decision Tree, Random Forest, FC Neural Net, AdaBoost, Naive Bayes, QDA, and SGD} out of which we chose the best performing one over the training set to apply over the test set. Reported results are averaged over 20 different runs for each model. \noindent\textbf{Metrics:} Different from traditional matching evaluation, in our setting we are equally interested in true positives and true negatives. The reason for that is the objective of this study, that is, to account for the human in-the-loop. Specifically, in our setting, we assess the performance using the accuracy measure, i.e., the proportion of correctly labeled samples out of all samples. The intuition is that we want to evaluate the ability to correctly label both match (true positives) and non-match (true negatives) decisions. \noindent\textbf{Baseline:} For the current study we are interested in providing a proof-of-concept for calibrating human labels. In what follows, our baseline is defined as $l_i$ (see Section~\ref{sec:model}), i.e., the binary label provided by the user. In the IncognitoMatch setting, using $l_i$ means that the reported confidence is greater than 0.5, which is also equivalent to a likelihood-based baseline~\cite{shraga2021powarematch}. We also note that we pre-screen low performing matchers. An alternative would be to consider the screening as an additional baseline as in related works~\cite{callison2009fast,ipeirotis2010quality,daniel2018quality}. \subsection{Results (Over V1-V4)}\label{sec:res} We now analyze the effectiveness of our approach. Table~\ref{tab:res} provides an aggregated comparison between our method and the baseline by cross validation setting (see Table~\ref{tab:TrainTest}). \begin{table}[H] \caption{Results per Setting (Aggregated)} \label{tab:res} \centering \begin{tabular}{l|c|c} \textbf{Setting} & Baseline & Our Method (HumanAL)\\ \toprule V1 & 0.751 & \textbf{0.766} (+2.0\%) \\ V2 & 0.744 & \textbf{0.813} (+9.3\%)\\ V3 & 0.750 & \textbf{0.903} (+20.4\%) \\ V4 & 0.751 & \textbf{0.787} (+4.8\%) \\ \end{tabular} \end{table} Our suggested method is able to provide improvements over all settings. Among settings, V1 and V4 demonstrated the lowest improvement rates over the baseline (2\% and 4.8\%, respectively). This observation is not surprising regarding V4 as the most challenging setting where we examine \emph{cross-domain} abilities. In fact, a 4.8\% cross-domain improvement is quite encouraging and shows that modeling human behavior can be generalized beyond a single (matching) domain. In the case of V1, the ablation study (see Section~\ref{sec:ablation}) will reveal the majority voting as a very important feature set, which is excluded in this setting (see Section~\ref{sec:setup}). V3 demonstrated the most improvement, which can be attributed to its ability to generalize (new users and samples yet same domain). In what follows, \emph{the results suggest that if we want to extend, for example, the QQP dataset, training our method on the existing QQP benchmark can provide high quality labels for new (unseen) data, even if the initial labels are not that accurate.} We now analyze the results by domain using Figure~\ref{fig:accuracy_all}. For V4, the indicated domain is the one used for testing. For example, the bars for SM represent that the model was trained on EM and TM and tested on SM. \begin{figure}[t] \centering \includegraphics[width=.45\textwidth]{./Figures/Accuracy_all-eps-converted-to-page-001.jpg} \caption{Results per Setting for Each Domain Seperatly.} \label{fig:accuracy_all} \end{figure} Unsurprisingly, on average, baseline human performance (red bars) over SM (0.642) is lower than over EM (0.825) and TM (0.781). The difference between EM and TM is quite surprising and can be explained by the similarity between tasks and fact that EM provides additional context. The largest average improvement (+38.2\%) is also achieved in the EM domain and smallest for the TM domain (+17.7\%). An interesting peak is observed for V3 setting in the SM domain where HumanAL provide 79.5\% improvement, while only 1\% improvement is achieved in the V1 setting for the TM domain. Finally, the largest variance is observed in the V2 setting which may be associated with varying complicatedness of samples within the same domain. We now turn our efforts to analyze the feature space over the most challenging setting of V4. \subsection{Ablation Study (Over V4)}\label{sec:ablation} We analyze the importance of features as sets using an ``isolating'' and ``dropping'' methodology. For the former (Figure~\ref{fig:ablation_iso}) we isolate each feature set and only use its features for training. For the latter (Figure~\ref{fig:ablation_drop}) we exclude a feature set from training. \emph{Higher} accuracy in isolation means \emph{more important} feature set while for dropping, \emph{lower} accuracy means \emph{more important} feature set. We use a color coding (green for improvement and red for decrease) to enhance readability. \begin{figure}[h] \begin{subfigure}{.45\linewidth} \centering \caption{``Isolating'' Features} \includegraphics[width=\linewidth]{./Figures/ablation_iso.pdf} \label{fig:ablation_iso} \end{subfigure} \begin{subfigure}{.45\linewidth} \centering \caption{``Dropping'' Features} \includegraphics[width=\linewidth]{./Figures/ablation_drop.pdf} \label{fig:ablation_drop} \end{subfigure} \centering \caption{Ablation Study of the feature set using a isolating (a) and dropping (b) methodology. The indicated percentages are improvements over the baseline.} \label{fig:main} \end{figure} When dropping features (Figure~\ref{fig:ablation_drop}), Majority decision and User decision are significant as the results decrease when excluding them. On the other hand, time is not significant and may actually decrease the accuracy. This observation comes as a surprise since previous works indicated its importance~\cite{ackerman2019cognitive,shraga2020learning,shraga2021powarematch}. The main difference between ours that previous works setting is the crowdsourcing setup (here we focus on boolean instead of open-ended). In what follows, as the decisions are not \emph{elective} (found and selected by users), the time for a given decision is less significant. Also, we can see that the priors are not as important. Looking at isolating features, we observe that none of the sets is able to perform well independently. We note that although it seems that the priors work well, they simply learn to predict the binary label (same as the baseline), thus they do not provide any additional meaningful information. \section{Introduction}\label{sec:intro} The basic setting of machine learning, supervised learning, provides an algorithm with a set of human-labeled data instances from which it can ``learn'' a model. Nevertheless, for many tasks, relying on human-labeled examples to support learning may be problematic due to several reasons that include, among others, the existence of label noise~\cite{frenay2013classification,northcutt2021pervasive}, and the costly acquisition of high-quality labels~\cite{sheng2008get}. Consequently, human-in-the-loop solutions~\cite{li2017human,NoyMMA13,Crowdmap,fan2014hybrid,McCann2008,Hung2014,pinkel2013incmap,zhang2019invest,lertvittayakumjorn2020find}, such as crowdsourcing, were developed to enable cheaper acquisition of labels from a large number of annotators in a short time. However, the increasing availability of human-labeled data may also yield variation in the reliability and proficiency of these human annotators~\cite{dragisic2016user,zhang2018reducing,Ross2010,HILDA18,ackerman2019cognitive,shraga2020learning}, which, in turn, impair the quality of the generated labels. This variation may arise due to different expertise levels~\cite{dragisic2016user,zhang2018reducing,HILDA18}, mood changes~\cite{DBLP:conf/vldb/Shraga20}, various cognitive biases~\cite{ackerman2019cognitive,shraga2020learning} and more. In this work we offer a novel view on the use of human input as labels, acknowledging that humans may err. Building on top of meta-cognition research, we adopt cognitive biases that may affect the ability of humans to provide accurate answers. For example, previous research, in the context of matching, shows that decision times are associated with the decision confidence and correctness~\cite{ackerman2019cognitive}. In what follows, we build a behavioral profile for human annotators' decisions which is used as a feature representation of the provided input. We show that utilizing black-box machine learning, we can take into account human behavior and calibrate their input to improve the labeling quality. To support our claims and provide a proof-of-concept, we use matching tasks of three different flavors. Specifically, we perform an empirical study with the structurally rich database task of schema matching (SM)~\cite{RAHM2001,BELLAHSENE2011}, the structured task of entity matching (EM)~\cite{elmagarmid2006duplicate,getoor2012entity,christen2012data} and the textually rich NLP task of labeling semantically equivalent sentences (text matching, TM)~\cite{pang2016text,guo2019matchzoo}. SM is characterized as a very challenging task~\cite{shraga2020learning} and was shown in literature to require expert skills~\cite{shraga2020learning,zhang2018reducing,dragisic2016user}. EM usually depends on context and may be confusing for humans (e.g., what it means to be a match)~\cite{doan2017human,doan2018human}. For NLP tasks, human performance (aka ``Human Baselines'') is usually used as the verge of success for machine-based methods~\cite{nangia2019human,wang2019superglue}. We demonstrate that using our methodology we can improve (raw) human performance by acknowledging their imperfection to provide valuable labels. \begin{figure}[h] \centering \includegraphics[width=.5\textwidth]{./Figures/example-page-001.jpg} \caption{Example of each task that we consider in this paper, namely Text Matching (TM, top), Entity Matching (EM, middle), and Schema Matching (SM, bottom).} \label{fig:example} \end{figure} Matching can be seen as a classification problem of pairs of elements (sentences for TM, entities for EM, and attributes for SM). In the context of this paper, we consider that these tasks are provided for human matchers either as labelers or additional problem solvers in the loop. Figure~\ref{fig:example} provides an example sample for each task. At the top, we illustrate an example of TM, specifically taken from the quora question pairs matching dataset~\cite{qqp}, a well-known task from the GLUE benchmark~\cite{wang2018glue}\footnote{GLUE (\url{https://gluebenchmark.com/}) is a standard collection of benchmarks for natural language understanding, widely used in the NLP community.}. TM tasks are usually provided without context, i.e., each sentence pair is evaluated independently. Below the TM example, an EM example is provided taken from Magellan's~\cite{konda2016magellan} Beer dataset~\cite{beer}. In EM, the context of an entity pair usually includes its schema (in this case, \texttt{Beer\_Name, Brew\_Factory\_Name, Style, ABV}) and, sometimes, additional entities in the table. At the bottom, a SM task example is provided, for which, as illustrated, the autonomous attribute alignment task (\texttt{telephone} $\leftrightarrow$ \texttt{contactPhone}) is provided within the context of their respective schemata. \subsection{Contributions} This paper presents an ongoing study of the way we calibrate human input to generate HumanAL (\textbf{Human} \textbf{A}ugmented \textbf{L}abels). The main take-away is, that by training a calibration model on a labeled matching benchmark, we can improve the quality of (unknown) labelers on new (unseen) benchmarks from multiple domains. Our main contributions include: \begin{enumerate} \item A novel behavioral profile of human matchers decisions in a crowdsourcing setting. \item A machine-learning based calibration model to improve the quality of labels for matching tasks. \item An empirical study using over 300 participants providing 12,000 matching decisions ranging over three different matching tasks using well known benchmarks showing the effectiveness of our approach \end{enumerate} In Section~\ref{sec:con} we provide a discussion regarding the current state of research and elaborate on future directions. \section{Learning to Calibrate Human Input}\label{sec:modelMain} The setup for this paper is \emph{boolean crowdsourcing}, i.e., a user is required to solve a sequence of binary matching questions. While this is a typical setup for multiple human-in-the-loop matching~\cite{li2017human}, we now focus on human labelers. We model human input and provide a feature set to be used to calibrate these binary decisions and generate new human augmented labels (HumanAL). \subsection{Modeling Human Input}\label{sec:model} We consider a machine learning-like model for labeling defined as follows. Let $\mathcal{X}$ be the space of samples. For the scope of this paper, a sample $x\in \mathcal{X}$ represents a pair of elements, \emph{e.g.,} pair of sentences. We further denote by $X = \{x_1, x_2, \dots\}$ a sequence of samples.\footnote{we use a \emph{sequence} of samples rather than \emph{set} of sample since in this setting the samples are presented to a user in a given order.} We assume that there exists some ``true'' label (sometimes referred to as ground truth) for each sample in the space $\mathcal{X}$, in a space $\mathcal{Y}$. Our objective is classify pairs of elements (samples) as match (1) or non-match (0) and, thus, consider $\mathcal{Y} = \{0,1\}$. The sequence $Y = \{y_1, y_2, \dots\}$ denotes $X$'s respective labels. Finally, a labeled dataset $D = \{(x_1, y_1), (x_2, y_2), \dots\}$ is a sequence of pairs $(x_i, y_i)$ such that $x_i$ is a sample and $y_i$ is its label (denoting whether the pair matches, i.e., $y_i = 1$ or not, i.e., $y_i = 0$). In a traditional setting, the construction of a labeled dataset $D$ involves \emph{human labelers} and it is usually assumed that given an instance $x$, the label provided by a labeler is \emph{correct}. Instead, we view human labeling as \emph{predictions} and use the notation $\hat{y}_i$ for human input regarding a sample $x_i$. In a perfect world, where humans do not err, we can simply set $y_i = \hat{y}_i$ assuming that the provided label is always correct. Alternatively, we can also include multiple labelers for each sample and use a majority voting mechanism. When dealing with human labelers in a real (not perfect) world, our objective is to utilize $\hat{y}_i$ and the properties of human decision making. Each decision regarding a sample involves additional essential components, for example, the \emph{decision time}, which was shown to be predictive for both confidence and accuracy in matching~\cite{ackerman2019cognitive}. In addition, instead of solely requesting a binary decision from a labeler, we also query their \emph{confidence level} regarding the sample~\cite{dragisic2016user}. In what follows, instead of viewing the human provided label $\hat{y}_i$ as a binary indicator, we view it as a triplet $\hat{y}_i = \langle l_i, c_i, t_i\rangle$, where $l_i\in \mathcal{Y}$ is the provided label for $x_i$, $c_i\in {\rm I\!R}$ is the associated confidence, and $t_i\in{\rm I\!R}$ is the decision time. Next, we show how this representation is used for feature extraction. \subsection{From Human Behavior to Feature Extraction to Calibration}\label{sec:ML} In this work, we use the aforementioned triplets to extract five classes of features which associate to human decision making. The full list of generated features is provided in Figure~\ref{fig:features}. The clear extraction that consists of the decision time $t_i$, binary decision $l_i$ and reported confidence $c_i$ can be seen as \emph{local} (extracted only from the current decision of the user) and \emph{internal} (determined only based on the user behavior). Another local internal feature we consider is the smoothed confidence, defined as follows. \begin{equation}\label{eq:sconf} \tilde{c}_i = \begin{cases} 2\cdot(c_i-0.5) & c_i \geq 0.5 \\ 2\cdot(0.5-c_i) & c_i < 0.5 \end{cases} \end{equation} \noindent The idea of the smoothed confidence is to encode the decisive nature into the confidence by dividing the scale into match/no-match ([0,0.5)/[0.5-1.0]). For example, when comparing a reported confidence of $0.7$ (associated with a match decision) to the one of $0.1$ (associated with a no-match decision), the latter, while lower in actual value, represents a higher confidence in the decision. In this case the respective smoothed confidences will be $0.4$ ($(0.7-0.5)\cdot 2$) and $0.8$ ($(0.5-0.1)\cdot 2$), respectively, suggesting that the latter decision (saying no-match) is made with higher confidence than that of the former (saying match). Finally, aiming to address the fatigue in sequential making, we also include the position of the currect decision in the pool of decisions provided to the user. For example, the confidence provided to the first seen sample might be different than the one reported for the tenth decision, even if they reflect the same internal confidence. \begin{figure}[t] \centering \includegraphics[width=.45\textwidth]{./Figures/feature_list} \caption{A behavioral profile of a human matcher decision} \label{fig:features} \end{figure} We also consider \emph{external} local features which use information regarding other users facing the same matching decision. Specifically, we normalize the decision time with respect to the decision times of other users over the same decision. In addition, all majority decision features are external and local with respect to the user decision features. For example, the average reported confidence of other users for the same matching decision. The overall time and (internal) normalized decision time with respect to other decisions made by the user are internal \emph{global} features. This set also includes a prior intelligence estimation using psychometric riddles~\cite{anastasi1997psychological,shraga2020incognitomatch}. Using the generated features, we use a black-box machine learning strategy. Specifically, using the feature extraction, each user decision is now encoded into a feature space over which we wish to determine a new human augmented label. To do so, we position the problem as a classification problem, aiming to classify the new representation to a match (1)/no-match (0) decision. During training, we assume that there exists some ground truth label $y_i$ over which we train a classifier to map the suggested features into a human augmented label $\hat{y}^{*}_i$.
\section{Introduction} \label{sec:intro} For $\Sigma$ a compact connected oriented surface and $G$ a Lie group, its character variety is $$X(\Sigma,G)=\lbrace \rho:\pi_1(\Sigma)\longrightarrow G\rbrace \sslash G,$$ where $G$ acts by conjugation. One of the simplest and most intruiging character variety is obtained when $G=\mathrm{SL}_2(\mathbb{C}),$ as the character variety is then well-understood algebraically while connected to hyperbolic geometry, knot theory and $3$-dimensional topology, with many beautiful applications. Concretely speaking, $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ is just an algebraic variety of dimension $6g-6+3n$ when $\Sigma$ is a surface with negative Euler characteristic of genus $g$ with $n$ boundary components, and the ring of regular functions on the character variety $\mathbb{C}[X(\Sigma,\mathrm{SL}_2(\mathbb{C}))]$ is just a commutative algebra. Skein algebras and skein modules, introduced independently by Przytycki \cite{Prz91} and by Turaev\cite{Tur88}, give a quantization of character varieties. The skein module $S(M)$ of a compact oriented $3$-manifold $M$ is a $\mathbb{Z}[A^{\pm 1}]$-module which is the quotient of the free module spanned by isotopy classes of framed links in the interior of $M,$ modulo the famous Kauffman relations: \begin{align*} \begin{minipage}{0.6in}\includegraphics[width=0.7in]{Lx}\end{minipage} & = A \begin{minipage}{0.7in}\includegraphics[width=0.7in]{Li} \end{minipage} + A^{-1} \begin{minipage}{0.7in} \includegraphics[width=0.7in]{L0} \end{minipage} \\ L \cup U & = (-A^2-A^{-2}) L \end{align*} where the first relation relates $3$ framed links in $M$ that are identical except in a small ball, and in the second relation $U$ is the unframed unknot. In the case where $M=\Sigma \times [0,1],$ with $\Sigma$ a compact oriented surface, the skein module has a natural structure of algebra given by the stacking operation. We will write $S(\Sigma)$ for the skein algebra of a surface (i.e. the skein module of $\Sigma\times [0,1],$ with its natural algebra structure). We recall also that when $M$ is a compact oriented surface, the skein module $S(M)$ is a module over the skein algebra $S(\partial M),$ again for the natural stacking operation. A result of Bullock \cite{Bul97} and Przytycki--Sikora \cite{PS00} asserts that setting the parameter $A$ to $-1,$ the skein algebra $S(\Sigma)\otimes_{A=-1} \mathbb{C}$ is isomorphic to the commutative algebra $\mathbb{C}[X(\Sigma,\mathrm{SL}_2(\mathbb{C}))],$ and a further result of Turaev \cite{Tur91} states that $S(\Sigma)$ is actually a deformation quantization of that algebra in the direction of the Atiyah--Bott--Goldmann Poisson bracket. Moreover, the skein algebras of surfaces have deep ties with much of quantum topology, in particular with the Jones polynomials, the Witten--Reshetikhin--Turaev invariants of $3$-manifolds and their associated TQFTs. A better understanding of skein algebras (or their $3$-dimensional counterparts: skein modules) seems to be key for working on many of the open conjectures in quantum topology \cite{LZ17}\cite{MS21}\cite{BWY21}. Contrary to functions on the $\mathrm{SL}_2(\mathbb{C})$-character variety, skein algebras are a difficult object to tackle, in part due to being non-commutative algebras. For instance, except for a few small surfaces, there is at the moment no-known presentations of $S(\Sigma)$ besides the definition. However, pioneering work of Bonahon and Wong \cite{BW11}\cite{BW16}\cite{BW17}\cite{BW19} led to a breakthrough in our understanding of skein algebras. They constructed an embedding, the \textit{quantum trace map} from the skein algebras of a surface $\Sigma$ with $n\geq 1$ punctures to a quantum torus. A quantum torus is a non-commutative algebra of the form $\mathbb{Z}[A^{\pm 1}]\langle X_i, i \in I\rangle/\lbrace X_iX_j=A^{\sigma_{ij}}X_jX_i \rbrace;$ in a way, quantum tori are the simplest possible non-commutative algebras. Bonahon and Wong used the Chekov--Fock quantization of the Teichmüller space as their target space to define their quantum trace map, then they managed to quantize the map from character variety to shear coordinates. Some difficult computations are required to check that their formulas indeed yield an algebra morphism. Their method of defining a quantum trace map has since been simplified by L\^e in \cite{Le19}, and recently extended by L\^e and Yu to $\mathrm{SL}_n$ character variety. The first result of this paper is to propose an alternative way of defining an embedding of the skein algebra into a quantum torus; or rather in our case a \textit{localized} quantum torus. Let $\mathcal{P}$ be a pants decomposition of $\Sigma$ consisting of $n$ curves non parallel to the boundary and $b$ curves parallel to the boundary. We write $\hat{\Sigma}$ for the closed surface obtained from $\Sigma$ by filling the boundary components by disks. We consider the quantum torus $\mathcal{T}(\mathcal{P})$ over $\mathbb{Z}[A^{\pm 1}]$ with $2n+b$ variables $E_1,\ldots,E_n,Q_1,\ldots,Q_n,C_1,\ldots,C_b$ where all variables commute except $Q_i$ and $E_i$ (for all $i \in \{1,\ldots,n\}$) that satisfy $Q_i E_i = A E_i Q_i$. Viewed as a ring, the quantum torus $\mathcal{T}(\mathcal{P})$ is an integral domain so we can define $\mathcal{A}(\mathcal{P})$ to be a $\mathbb{Z}[A^{\pm 1}]$-algebra containing $\mathcal{T}(\mathcal{P})$ where $A^k Q_i^2-A^{-k} Q_i^{-2}$ is invertible for all $1 \le i \le n$ and $k \in \mathbb{Z}$. The algebra $\mathcal{A}(\mathcal{P})$ will be called a localized quantum torus. \begin{theorem}\label{thm:embeddingIntro} There is an injective $\mathbb{Z}[A^{\pm 1}]$-algebra homomorphism $$\sigma : S(\Sigma) \to \mathcal{A}(\mathcal{P})$$ that factors through the natural action $S(\Sigma) \longrightarrow \mathrm{End}(S(H,\mathbb{Q}(A)))$ where $H$ is a handlebody with boundary $\hat{\Sigma},$ such that curves in $\mathcal{P}$ bound a disk in $H.$ Moreover for any curve $\alpha \in \mathcal{P}$ there exists $Q \in \{Q_1,\ldots,Q_n,C_1,\ldots,C_b \}$ such that $$\sigma(\alpha) = -(A^2 Q^2+A^{-2} Q^{-2})$$ \end{theorem} We remark that when $\Sigma$ has boundary, $S(H,\mathbb{Q}(A))$ is the sum of relative skein modules of $H$ where we add a colored point in each filling disk of $\hat{\Sigma}.$ Note that in particular, we recover a theorem of L\^e \cite{Le21} about the faithfulness of the natural action of $S(\Sigma)$ on $S(H).$ The precise definition of the embedding will be given in Definition \ref{def:embedding}; it is based on the study of coefficients of \textit{curve operators} on $S(H,\mathbb{Q}(A))$ where $H$ is a handlebody with boundary $\Sigma,$ in some basis given by trivalent colored graphs (see Lemma \ref{lemma:basis}), which are the skein module version of the basis of WRT-TQFTs given by Blanchet--Habegger--Masbaum and Vogel \cite{BHMV}. Morally speaking our embedding could be thought as the quantization of Fenchel--Nielsen coordinates associated to a pair of pants decomposition, while Bonahon--Wong's quantum trace map is based on a quantization of shear coordinates on the Teichmüller space. Compared with Bonahon--Wong's result our embedding has the drawback of landing in a localized quantum torus instead of just a quantum torus, but in exchange we get several nice features. First, our result applies to closed surfaces as well as surfaces with boundary, whereas Bonahon--Wong's embedding needs punctures to be defined, since they have to start with ideal triangulations of the surface $\Sigma.$ Secondly, our embedding arises in a more natural way, by studying the action of $S(\Sigma)$ on the skein module $S(H)$ of a handlebody with boundary $\Sigma,$ in the graph basis of $S(H)$ associated to the pair of pants decomposition $\mathcal{P}.$ The proof that we get an embedding does not require to check difficult formulas, and will be a simple by-product of the fact that $S(H)$ is a module over $S(\Sigma).$ Finally, a nice feature of this new embedding is that it is in a way almost surjective: the localized quantum torus can be viewed as a finite degree extension of the image of $\sigma$. Indeed we see in Theorem \ref{thm:embeddingIntro} that the elements $Q_1,\ldots,Q_n,C_1,\ldots,C_b$ satisfy a degree $4$ polynomial equation with coefficients in $\sigma(S(\Sigma))$. The next proposition says that a similar property holds for the elements $E_1,\ldots,E_n$. \begin{proposition}\label{prop:finite_ext} There exists a finite index subgroup $\Lambda$ of $\mathbb{Z}^n$ such that all $k=(k_1,\ldots,k_n) \in \Lambda$ : $$E_1^{k_1}\cdots E_n^{k_n} = \sum_{j \in I} \sigma(\gamma_j) G_j $$ where $\{\gamma_j \, \, j \in I \}$ is a finite set of multicurves on $\Sigma$ and $\{G_j \, , \, j \in I \}$ are rational fractions in $Q_1,\ldots,Q_n,C_1,\ldots,C_b$. \end{proposition} An other important aspect of Bonahon--Wong work is the study of irreducible finite dimensional complex representations of $S_{\xi}(\Sigma) = S(\Sigma) \otimes_{A=\xi} \mathbb{C}$ when $\xi$ is root of unity. More precisely, when $\xi$ is root of unity of order twice an odd number, Bonahon--Wong associate in \cite{BW16} to any such representation $\rho$ of $S_{\xi}(\Sigma)$ a canonical point $r_{\rho} \in X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ called the classical shadow of $\rho$. A natural and important question is to know if points in $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ completely classify irreducible finite dimensional representations of $S_{\xi}(\Sigma)$. In \cite{BW17}, Bonahon--Wong proved that if $\Sigma$ has at least one boundary component, any point in $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ satisfying a geometric condition are the classical shadow of an irreducible representation of $S_\xi(\Sigma)$. When $\Sigma$ has no boundary component they removed this geometric condition to prove that $\rho \mapsto r_{\rho}$ is sujective in \cite{BW19}. They asked the question which points in $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ have a single preimage by the map $r_{\rho};$ the \textit{unicity conjecture} that they formulated was that for a open dense subset of $X(\Sigma,\mathrm{SL}_2(\mathbb{C})),$ the classical shadow determines the representation. In this paper we prove: \begin{theorem}\label{thm:lift_rep} Suppose that $\Sigma$ has at most one boundary component. Let $\xi$ be a $2p$-th primitive root of unity with $p \ge 3$ an odd number and $\rho : S(\Sigma) \to \mathrm{End}(V)$ be an irreducible representation with classical shadow $r$. Let $\mathcal{P}$ be a pants decomposition of $\Sigma$ in the same orbit, under the action of the mapping class group of $\Sigma$, as the one shown in Figure \ref{fig_sausage}. Suppose that for $\alpha_1,\alpha_2,\alpha_3 \in \mathcal{P}$ bounding a pair of pants : \begin{equation} \label{eqG1} 2+\sum_{k=1}^3 \mathrm{Tr}(r(\alpha_k^2))- \prod_{k=1}^3 \mathrm{Tr}(r(\alpha_k)) \neq 0 \end{equation} and for all $\alpha \in \mathcal{P}$ \begin{equation} \label{eqG2} \mathrm{Tr}(r(\alpha)) \neq \pm 2 \end{equation}Then there is a representation $\tilde{\rho} : \mathcal{A}_{\xi}(\Gamma)^0 \to \mathrm{End}(V)$ such that $\tilde{\rho} \circ \sigma_{\xi} = \rho.$ \end{theorem} In this theorem $\mathcal{A}(\Gamma)^0$ is a $\mathbb{Z}[A^{\pm 1}]$-subalgebra of $\mathcal{A}(\mathcal{P})$ containing $\sigma(S(\Sigma))$. The definition of $\mathcal{A}(\Gamma)^0$ is given in Definition \ref{A0}, it is isomorphic to a localized quantum torus (see Lemma \ref{gen_t}). The notation $\mathcal{A}_{\xi}(\Gamma)^0$ stands for $\mathcal{A}(\Gamma)^0 \otimes_{A=\xi} \mathbb{C}$ and $\sigma_{\xi}$ is the induced map $S_{\xi}(\Sigma) \to \mathcal{A}_{\xi}(\Gamma)^0$. As representations of $\mathcal{A}_{\xi}(\Gamma)^0$ are well understood, we have the following corollary : \begin{corollary} \label{cor:unicity} Let $\rho_1$ and $\rho_2$ be two irreducible complex finite dimensional representations of $S_{\xi}(\Sigma)$ with same classical shadow $r$ satisfying the hypothesis of Theorem \ref{thm:lift_rep}. Moreover if $\Sigma$ has a boundary component, we suppose that $\rho_1$ and $\rho_2$ have the same scalar value on any simple closed curve parallel to the boundary. Then $\rho_1$ and $\rho_2$ are isomorphic with dimension $p^{3g-2}$ when $\Sigma$ has a boundary component and $p^{3g-3}$ when $\Sigma$ has no boundary (here $g$ is the genus of $\Sigma$). \end{corollary} Notice that the conditions satisfied by the classical shadow $r$ in Theorem \ref{thm:lift_rep} defined a Zariski open dense of $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$. Therefore Corollary \ref{cor:unicity} recovers a theorem of Frohman, Kania-Bartoszynska and L\^e \cite{FKBL19} that showed that there is a Zariski open dense subset of $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ on which points have a single preimage. Our proof thus gives an alternative proof of the unicity conjecture of Bonahon and Wong. We note that the proof in \cite{FKBL19} used abstract arguments about Azumaya algebras and facts about the center of skein algebras at roots of unity, and produced an unexplicit Zariski open subset of $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ where the unicity conjecture holds. An alternative (and more constructive) approach to the unicity conjecture had been initiated by Takenov \cite{Takenov}, in the case of where $\Sigma$ is the one-holed torus and the 4-holed sphere. It involved explicitely extending the representations of $S_{\xi}(\Sigma)$ to a quantum torus in which it embeds. The present paper will take advantage of the embedding defined by Theorem \ref{thm:embeddingIntro} to extend Takenov's strategy for compact oriented surfaces that are closed or have one boundary component. We show that a representation of classical shadow $r$ can be extended to a representation of a localized quantum torus and use an argument of Bonahon and Liu about the uniqueness of representations of quantum tori to deduce the unicity of the representation of $S_{\xi}(\Sigma)$ with classical shadow $r$. We note that this construction also allows one to reconstruct the representation from the classical shadow, recovering the surjectivity proved in \cite{BW19}, on the open dense subset of $X(\Sigma,\mathrm{SL}_2(\mathbb{C}))$ described above. The theorem of \cite{FKBL19} has since been improved by Ganev, Jordan and Safronov \cite{GJS19}: building upon Frohman--Kania-Bartoszynska--L\^e's result, they prove that the unicity conjecture actually holds over the set of all irreducible representations. In a forthcoming paper of the two authors with Thomas Le Fils, we prove: \begin{theorem}\label{thm:compatible_pants}\cite{DLFS} Let $\Sigma$ be a closed surface. The set of conjugacy classes of representations $r:\pi_1(\Sigma) \to \mathrm{SL}_2(\mathbb{C})$ satisfying the hypothesis of Theorem \ref{thm:lift_rep} is equal to the set of irreducible representations minus representations whose image is isomorphic to the quaternion group with $8$ elements. \end{theorem} This theorem together with Theorem \ref{thm:lift_rep} almost recovers the result of \cite{GJS19}. The fact that we have to exclude the representations with quaternionic image is due to the specific type of pair of pants decomposition we use in Theorem \ref{thm:lift_rep}. Indeed a representation with quaternionic image has trace $\pm 2$ on any separating closed curve on $\Sigma.$ We believe that the same arguments starting with a pair of pants decomposition using only non-separating curves would cover also the case of quaternionic irreducible representations. We end this introduction with the following question: \begin{question} \label{question:integrality} Can one define an embedding similar to that of Theorem \ref{thm:embeddingIntro}, but with values in a quantum torus instead of a localized quantum torus ? \end{question} A possible approach towards this question would be to use basis for the skein module modeled on the integral basis of $\mathrm{SO}(3)$-TQFTs given by Gilmer and Masbaum \cite{GM07}. Note that it is however unlikely that one could both get an integral version of the embedding of Theorem \ref{thm:embeddingIntro}, while keeping the nice "finite extension" feature described in Proposition \ref{prop:finite_ext}. This last property is key for lifting representations as in Theorem \ref{thm:lift_rep}. The paper is organized in two largely independent parts. Section \ref{sec:embedding} is devoted to the definition of the map $\sigma$ of Theorem \ref{thm:embeddingIntro}, and of the proof that it is an embedding. The short Section \ref{sec:sausage_case} introduces a special kind of pair of pants decompositions that are used in the next section and serves as a transition between the two parts of the paper. Section \ref{sec:representations} is devoted to the proof of Theorem \ref{thm:lift_rep} and Corollary \ref{cor:unicity}, and could in principle be read independently of Section \ref{sec:embedding}, although some formulas are deeply inspired by it. \textbf{Acknowledgements:} Over the course of this work, the first author was partially supported by the project “AlMaRe” (ANR-19-CE40-0001-01) and by the EIPHI Graduate School (ANR-17-EURE-0002). The authors thank Thang L\^e, Thomas Le Fils, Julien March\'e and Maxime Wolff for helpful conversations. \section{Embeddings of skein algebras of surfaces into localized quantum tori} \label{sec:embedding} \subsection{Localized quantum tori} \label{sec:qTorus} Consider the $\mathbb{Z}[A^{\pm 1}]$-module $$\tilde{\mathcal{A}}_{n,b} = \mathbb{Z}[A^{ \pm 1}][E_1^{\pm 1},\ldots,E_{n}^{\pm 1}] \underset{\mathbb{Z}[A^{ \pm 1}]}{\otimes} \mathbb{Q}(A)(Q_1,\ldots,Q_{n},C_{1}, \ldots,C_{b}) $$ For convenience, we write an element of $\tilde{\mathcal{A}}_{n,b}$ as $$ \sum_{k \in \mathbb{Z}^n} \, E_1^{k_1}\cdots E_n^{k_n} R_k $$ where $R_k \in \mathbb{Z}[A^{\pm 1}](Q_1,\ldots,Q_{n},C_{1}, \ldots,C_{b}), \, \forall k \in \mathbb{Z}^n $ and all but finitely many $R_k$' are zero. Also $E^k$ denotes $E_1^{k_1}\cdots E_{n}^{k_{n}}$. For $P\in \mathbb{Q}(A)(Q_1,\ldots,Q_n,C_{1}, \ldots,C_{b})$ and $k \in \mathbb{Z}^n$ we define $$\hat{P}^{(k)} = P(A^{k_1}Q_1,\ldots,A^{k_n}Q_n,C_1,\ldots,C_b).$$ Now we set the following multiplication on $\tilde{\mathcal{A}}_{n,b}$ $$\Big(\sum_{k \in \mathbb{Z}^n} \, E^k R_k \Big) \Big(\sum_{l \in \mathbb{Z}^n} \, E^l S_l \Big) = \sum_{k,l \in \mathbb{Z}^n} \, E^{k+l} \hat{R}_k^{(l)} S_l $$ This multiplication makes $\tilde{\mathcal{A}}_{n,b}$ a non-commutative algebra over the ring $\mathbb{Z}[A^{\pm 1}]$. Let $\mathcal{R}$ be the subring of $\mathbb{Q}(A)(Q_1,\ldots ,Q_n,C_1,\ldots ,C_b)$ consisting of all elements of the form $\dfrac{U}{V}$ where $U \in \mathbb{Z}[A^{\pm 1}][Q_1^{\pm 1},\ldots Q_n^{\pm 1},C_1^{\pm 1},\ldots,C_b^{\pm 1}]$ and $V$ is a finite product (possibily empty) of elements of the form $A^m Q_j^2-A^{-m} Q_j^{-2}$ for $m \in \mathbb{Z}$ and $1 \le j \le n$. Let $\mathcal{A}_{n,b}$ be the sub-module of $\tilde{\mathcal{A}}_{n,b}$ generated by elements of the form $E^k R$ where $k \in \mathbb{Z}^n$ and $R \in \mathcal{R}$. It is clear from the multiplicative structure of $\tilde{\mathcal{A}}_{n,b}$ that $\mathcal{A}_{n,b}$ is a $\mathbb{Z}[A^{\pm 1 } ]$-subalgebra of $\tilde{\mathcal{A}}_{n,b}$. The non-commutative algebra $\mathcal{A}_{n,b}$ will be called the \textbf{localized quantum torus}. \subsection{An embedding of skein algebras through curve operators} \label{sec:embeddingCurveOp} Let $\Gamma \subset \mathbb{S}^3$ be a planar banded uni-trivalent graph, we denote by $\mathcal{E}$ its set of edges. Let $\mathcal{U} \subset \mathcal{E}$ be the set of univalent edges of $\mathcal{E}$ and $\mathcal{E}' = \mathcal{E} \backslash \mathcal{U}$. Let $n$ be the total number of edges of $\Gamma$ joining two trivalent vertices and $b$ be the the number of univalent edges of $\Gamma$. We number edges in $\mathcal{E}'$ from $1$ to $n$ and edges in $\mathcal{U}$ from $n+1$ to $n+b$. We will also write $\mathcal{A}(\Gamma)$ for the localized quantum torus $\mathcal{A}_{n,b}$. Finally, let $P$ be the set of triples $(e,f,g)\in \mathcal{E}^3$ such that the corresponding edges are adjacent to the same trivalent vertex. Let $H \subset \mathbb{S}^3$ be a tubular neighborhood of $\Gamma$. We denote by $\hat{\Sigma}$ the boundary of $H$, we suppose that the genus of $\hat{\Sigma}$ is at least $1$. The univalent vertices of $\Gamma$ define banded points on $\hat{\Sigma}$ : $x_1,\ldots,x_b$. Let $\Sigma$ be the surface obtained from $\hat{\Sigma}$ by removing small open disks around each $x_j$. We suppose that $\Sigma$ has negative Euler characteristic. For $c_1,\ldots,c_b$ a coloring of the banded points $x_1,\ldots,x_b,$ the relative skein module $S(H,\mathbb{Q}(A),c)$ will be the module generated by tangles with $c_i$ boundary points on the banded point $x_i$ and with the Jones-Wenzl idempotent $f_{c_i}$ inserted, modulo the Kauffman relations. Moreover the relative skein module $S(H,\mathbb{Q}(A))$ will be the direct sum of all $S(H,\mathbb{Q}(A),c)$ over all possible colorings $c$ of the banded points $x_1,\ldots,x_b.$ We denote by $S(\Sigma)$ the skein algebra of $\Sigma$ over $\mathbb{Z}[A^{\pm 1}]$. The algebra $S(\Sigma)$ acts on $S(H,\mathbb{Q}(A))$ by the stacking operation. For $\gamma$ a multicurve, we denote by $T^{\gamma}$ the action of $\gamma$ on $S(H,\mathbb{Q}(A))$. A map $c: \mathcal{E} \to \mathbb{N}$ is called an admissible coloring if $\forall (e,f,g) \in P$, we have triangular inequalities $c(e)\leq c(f)+c(g)$ and $c(e)+c(f)+c(g)$ is even. We also introduce a lattice $\Lambda \subset \mathbb{Z}^{\mathcal{E}}$ by $$\Lambda=\lbrace k\in \mathbb{Z}^{\mathcal{E}} \ | \ \forall (e,f,g)\in P, \ k(e)+k(f)+k(g)\in 2\mathbb{Z} \rbrace.$$ Given an admissible coloring $c : \mathcal{E} \to \mathbb{N}$ of $\Gamma$, we denote by $\varphi_c \in S(H,\mathbb{Q}(A))$ the vector obtained by cabling each edge $e$ of $\Gamma$ using the Jones-Wenzl indempotents $f_{c(e)}.$ It is well known that \begin{lemma}\label{lemma:basis} $\{ \varphi_c \, | \, c : \mathcal{E} \to \mathbb{N} \, \, \text{admissible} \}$ is a basis of $S(H,\mathbb{Q}(A))$. \end{lemma} \begin{proof} The handlebody $H$ with banded points $x_1,\ldots,x_b$ is homeomorphic to the thickened surface $\Gamma \times [0,1],$ with banded points corresponding the univalent vertices. Fix a coloring $\hat{c}$ of the banded points. For thickened surfaces, the skein module is generated by disjoint unions of arcs and non-trivial simple closed curves with boundary $\hat{c}_i$ points on the $i$-th banded point and the $\hat{c}_i$-th Jones-Wenzl idempotent inserted at that banded point. Such tangles are completely determined by their intersection number with the co-core of each internal edge of $\Gamma.$ Let $\psi_c$ be the basis element which has $c_e$ intersections with the co-core of the edge $e.$ Now consider the vectors $\varphi_c$ corresponding to admissible colorings of $\Gamma$ that coincides with $\hat{c_i}$ on the boundary. The recursive formula for the Jones-Wenzl idempotents shows that $\varphi_c$ is a linear combination of the vectors $\psi_d$ with with $d_e\leq c_e$ for all $e \in \mathcal{E'}.$ Moreover, $\varphi_c$ has nonzero coefficient along $\psi_c.$ This implies that the $\varphi_c$ are linearly independent and moreover an easy induction shows that any $\psi_c$ is a linear combination of the $\varphi_c,$ therefore the $\varphi_c$ are also a basis of $S(\Sigma,\mathbb{Q}(A)).$ \end{proof} The action of curve operators $T^{\gamma}$ in the basis $\varphi_c$ can be computed using the so-called fusion rules derived in \cite{MV94}. A complete set of fusion rules is described in Figure \ref{fig:fusion}, where coefficients are expressed in terms of $A$ and quantum integers $\lbrace n \rbrace=A^{2n}-A^{-2n}.$ \begin{figure}[!h] \centering \def .75\columnwidth{.6\columnwidth} \input{fusion2.pdf_tex} \caption{Fusion rules for computing curve operators in the basis $\varphi_c.$ Thick edges represent edges of the trivalent graph $\Gamma,$ which are colored by integers, while dashed arcs are colored by 1. We let $\lbrace n \rbrace=A^{2n}-A^{-2n}.$} \label{fig:fusion} \end{figure} Before studying the form of curve operators in the basis $\varphi_c,$ we will need the following lemma and definition: \begin{lemma}\label{lemma:largeset} Let $\Delta$ be the set of admissible colorings of $\Gamma$, then for all $v_1, \ldots,v_n \in \Lambda$ we have $$\bigcap_{j=1}^n \, \Delta + v_j \, \neq \emptyset.$$ \end{lemma} We will call any subset of $\mathbb{N}^{\mathcal{E}}$ containing a subset of the form $\bigcap_{j=1}^n \, \Delta + v_j$ where $v_j\in \Lambda,$ a \textit{large subset} of $\mathbb{N}^{\mathcal{E}}.$ \begin{proof} For any $w\in \mathbb{Z}^{\mathcal{E}}$ and $r\in \mathbb{N}$ let us write $B(w,r)$ be the ball around $w$ for $||\cdot||_{\infty}.$ Notice that for any $k \in \mathbb{N},$ the set $\Delta$ contains $B((2k,\ldots,2k), 2\lfloor \frac{k}{3}\rfloor)\cap \Lambda.$ Let $r\geq 1,$ then if $2\lfloor \frac{k}{3} \rfloor>\mathrm{max}(||v_1||_{\infty},\ldots,||v_n||_{\infty})+r,$ then $\bigcap_{j=1}^n \, \Delta + v_j$ contains $B((2k,\ldots,2k), r)\cap \Lambda.$ As $r$ can be chosen arbitrary large, this shows $\bigcap_{j=1}^n \, \Delta+v_j\neq \emptyset.$ \end{proof} We can now describe the structure of curve operators $T^{\gamma}$ associated to multicurves on $\Sigma:$ \begin{proposition} \label{prop:expand} Let $\gamma$ be a multicurve on $\Sigma$. There exists a large subset $V_{\gamma} \subset \mathbb{N}^{\mathcal{E}}$ and $F_k^{\gamma} \in \mathcal{R}$ (for $k : \mathcal{E}' \to \mathbb{Z}$) such that for all $c \in V_{\gamma}$ $$ T^{\gamma} \varphi_c = \sum_{k : \mathcal{E}' \to \mathbb{Z}} F_k^{\gamma}(A^{c(1)},\ldots,A^{c(n)},A^{c(n+1)},\ldots,A^{c(n+b)}) \varphi_{c+k}$$ Moreover if $\mathcal{P} = \{\alpha_1,\ldots,\alpha_n\}$ is a pants decomposition of $\Sigma$ dual to $\Gamma$ (with numbering corresponding to the one of $\mathcal{E}$) then \begin{enumerate} \item $F_k^{\gamma} = 0$ when $|k(j)| > i(\gamma,\alpha_j)$ or $k(j)\not\equiv i(\gamma,\alpha_j) \ (\mathrm{mod} \ 2)$ for some $1 \le j \le n$. \item If $k = (\pm i(\gamma,\alpha_1),\ldots,\pm i(\gamma,\alpha_{n}))$ then $F_k^{\gamma} \neq 0$. \end{enumerate} \end{proposition} The proof of Proposition \ref{prop:expand} involves fusion calculations to compute coefficients of curve operators, and will be done in Section \ref{sec:curveOpCoeff}. \begin{lemma}\label{lemma:uniqueCoeff} Assume that for some multicurve $\gamma$ on $\Sigma,$ there exists two large subsets $V$ and $V'$ of $\mathbb{N}^{\mathcal{E}}$ and coefficients $F_k$ and $G_k \in \mathcal{R}$ such that for any $c \in V$ (resp. $V'$) $T^{\gamma}\varphi_c$ admits a decomposition as in Proposition \ref{prop:expand}. Then $F_k=G_k$ for all $k:\mathcal{E}'\rightarrow \mathbb{Z}.$ \end{lemma} \begin{proof} Indeed, the intersection $V\cap V'$ will be also be a large subset of $\mathbb{N}^{\mathcal{E}}$ and thus will contain by the proof of Lemma \ref{lemma:largeset} subsets of the form $B(v,r)\cap \Lambda$ where $v\in \mathbb{N}^{\mathcal{E}}$ and $r$ can be arbitrary large. Notice that $\Lambda$ contains the lattice $2\mathbb{Z}^{\mathcal{E}}.$ Assume that $r$ is strictly larger than $d,$ the maximum of the degrees of the rational fractions $F_k-G_k$ (which we define as the maximum of the degree of their numerator and denominator). By Proposition \ref{prop:expand} the rational fractions $F_k$ and $G_k$ coincide on the set of all $(A^{c(1)},\ldots A^{c(n+b)})$ where $c \in B(v,r)\cap 2\mathbb{Z}^{\mathcal{E}},$ which is a product of sets that contains more than $d$ elements. By an easy induction on the number of variables $n$ of $F_k$ and $G_k,$ we can deduce that $F_k=G_k.$ \end{proof} Thanks to Lemma \ref{lemma:uniqueCoeff}, we can make the following definition: \begin{definition}\label{def:embedding} For $\gamma$ a multicurve, we define $$\sigma(\gamma) = \sum_{k : \mathcal{E}' \to \mathbb{Z}} E^k F_k^{\gamma}(Q_1,\ldots,Q_{n},C_1,\ldots,C_b) \in \mathcal{A}(\Gamma)$$ and we extend linearly this definition to a $\mathbb{Z}[A^{\pm 1}]$-module morphism $$\sigma : S(\Sigma) \to \mathcal{A}(\Gamma)$$ \end{definition} \begin{lemma} $\sigma : S(\Sigma) \to \mathcal{A}(\Gamma)$ is a $\mathbb{Z}[A^{\pm 1}]$-algebra morphism. \end{lemma} \begin{proof} Note that the map $\gamma \in S(\Sigma,\mathbb{Z}[A^{\pm 1}])\longmapsto T^{\gamma}\in \mathrm{End}(S(H,\mathbb{Q}(A)))$ is a morphism of algebra. The lemma will follow from the fact that $\sigma(\gamma)$ encodes the action of $T^{\gamma} \in \mathrm{End}(S(H,\mathbb{Q}(A)))$ in the basis $\varphi_c$ and that the multiplication in $\mathcal{A}(\Gamma)$ corresponds to the composition of operators. Indeed, let $\gamma$ and $\delta$ be two multicurves, and assume that $$T^{\gamma}\varphi_c=\underset{k:\mathcal{E}'\rightarrow \mathbb{Z}}{\sum}F_k^{\gamma}(A^{c(1)},\ldots,A^{c(n+b)})\varphi_{c+k}$$ for any $c\in V_{\gamma}$ and $$T^{\delta}\varphi_c=\underset{k:\mathcal{E}'\rightarrow \mathbb{Z}}{\sum}F_k^{\delta}(A^{c(1)},\ldots,A^{c(n+b)})\varphi_{c+k}$$ for any $c\in V_{\delta}.$ Let $V=\underset{k\in \Lambda, |k_i|\leq i(\gamma,\alpha_i)}{\bigcap} V_{\delta}+k.$ Then $V$ is a large subset of $\mathbb{N}^{\mathcal{E}'}$ and for any $c\in V$ and any $k\in \Lambda$ such that $F_k^{\gamma} \neq 0,$ we have $c+k\in V_{\delta}.$ Hence we get \begin{multline*}T^{\delta\cdot\gamma}\varphi_c=T^{\delta}\left(\underset{k:\mathcal{E}'\rightarrow \mathbb{Z}}{\sum}F_k^{\gamma}(A^{c(1)},\ldots,A^{c(n+b)})\varphi_{c+k}\right) \\=\underset{k,l:\mathcal{E}'\rightarrow \mathbb{Z}}{\sum}F_l^{\delta}(A^{c(1)+k(1)},\ldots,A^{c(n)+k(n)},A^{c(n+1)},\ldots,A^{c(n+b)})F_k^{\gamma}(A^{c(1)},\ldots,A^{c(n+b)})\varphi_{c+k+l}. \end{multline*} Therefore, comparing with the formula for the product in $\mathcal{A}(\Gamma)$ in Section \ref{sec:qTorus}, we get that $\sigma(\delta\cdot \gamma)=\sigma(\delta)\sigma(\gamma).$ The general case of $\gamma,\delta \in S(\Sigma,\mathbb{Z}[A^{\pm 1}])$ follows by linearity. \end{proof} \subsection{Injectivity of $\sigma$} \label{sec:injectivity} Let $\gamma$ be a multicurve, from now on, for any $k : \mathcal{E}' \to \mathbb{Z}$, the element $F_k^{\gamma}(Q_1,\ldots,Q_{n-b},C_1,\ldots,C_b) \in \mathcal{R}$ will be simply denoted by $F_k^{\gamma}$. \begin{lemma} \label{lemma:fracdehn} Let $\gamma$ be a multicurve, and let $k:\mathcal{E'}\rightarrow \mathbb{Z}.$ We assume that $|k_j| =\varepsilon k_j = i(\gamma,\alpha_j) \neq 0$ with $\epsilon = \pm 1$. Let $\gamma_+$ be the curves obtained from $\gamma$ by applying a positive fractional twist along $\alpha_j$. We have $$F_k^{\gamma_+} = -A^{2\varepsilon+|k_j|} Q_j^{2\varepsilon} F_k^{\gamma}$$ \end{lemma} \begin{proof}We will treat only the case $\varepsilon=+1,$ the case $\varepsilon=-1$ being completely similar. Let $\gamma_-$ be the curves obtained from $\gamma$ by applying negative fractional twist along $\alpha_j$. We have : $\alpha_j \gamma = A^{k_j} \gamma_+ + A^{-k_j} \gamma_- + \text{lower order curves},$ where by lower order we mean less geometric intersection with $\alpha_j.$ Hence by identifying the terms in $E^k$ in $\sigma(\alpha_j \gamma)$ we have $-(A^2 Q_j^2+A^{-2} Q_j^{-2}) E^k F_k^{\gamma} = A^{k_j} E^k F^{\gamma_+} + A^{-k_j} E^k F_k^{\gamma_-}$ using $Q_j^2 E^k = A^{2k_j} E^k Q_j^2$ and simplify by $E^k$, we get $$- (A^{2+2k_j} Q_j^2+A^{-2-2k_j} Q_j^{-2})F_k^{\gamma} = A^{k_j} F_k^{\gamma_+} + A^{-k_j} F_k^{\gamma_-}$$ Similarly if we expand $\gamma \alpha_j$, we get $$- (A^{2} Q_j^2+A^{-2} Q_j^{-2})F_k^{\gamma} = A^{-k_j} F_k^{\gamma_+} + A^{k_j} F_k^{\gamma_-}$$ We conclude by solving the system of two equations. \end{proof} \begin{proposition} $\sigma : S(\Sigma) \to \mathcal{A}(\Gamma)$ is injective. \end{proposition} \begin{proof} Let $C$ be a finite set of multicurves and $x = \underset{\gamma \in C}{\sum} \lambda_{\gamma} \gamma \in S(\Sigma)$ such that $\sigma(x) =0$. Let us consider an element $k$ of the set of $n$-uples of the form $(i(\gamma,\alpha_1),\ldots ,i(\gamma,\alpha_n))$ where $\gamma \in C$ which is maximal for the lexicographical order. Notice that by Proposition \ref{prop:expand}, only the multicurves $\gamma$ such that $(i(\gamma,\alpha_1),\ldots,i(\gamma,\alpha_n))=k$ contribute to the coefficient in $E^k.$ Let $C'$ be the subset of $C$ of those maximal multicurves, and let us prove that $\lambda_{\gamma}=0$ for all $\gamma\in C'.$ Note that in the Dehn-Thurston coordinates associated to the pair of pants decomposition $(\alpha_1,\ldots,\alpha_n),$ the multicurves in $C'$ differ only by their twist coordinates. If we identify the terms in $E^k$ in $\sigma(x)$, we get : $$\sum_{\gamma \in C'} \lambda_{\gamma} F_k^{\gamma} = 0$$ Let $\delta$ be a multicurve satisfying the following conditions \begin{enumerate} \item for all $1 \le j \le n$, $i(\delta,\alpha_j) = k_j$, \item if $k_j = 0$ then the $j$-th twist coordinate of $\delta$ is trivial. \end{enumerate} By Lemma \ref{lemma:fracdehn}, for each $\gamma \in C$, there exists $R_{\gamma} \in \mathbb{Q}(A)[Q_e^{\pm 1}]$ such that $F_k^{\gamma} = R_{\gamma} F_k^{\delta}$. It is easy to see that $\{ R_{\gamma} \, | \, \gamma \in C' \}$ are linearly independent (this follows from Lemma \ref{lemma:fracdehn} and the fact that elements in $C'$ have distinct twist coordinates). Hence from the egaility $$\sum_{\gamma \in C'} \lambda_{\gamma} R_{\gamma} F_k^{\delta} = 0,$$ we can conclude that $\lambda_{\gamma} = 0$ for all $\gamma \in C'$. An easy induction then proves that $\lambda_{\gamma}=0$ for all $\gamma \in C,$ therefore $x = 0$. \end{proof} We note that the embedding $\sigma$ is not surjective onto $\mathcal{A}(\Gamma).$ Indeed, as a consequence of Proposition \ref{prop:expand}-(1), the image of the morphism $\sigma$ is included in the $\mathbb{Q}(A)(Q_1,\ldots,Q_n)[C_1^{\pm 1},\ldots,C_b^{\pm 1}]$-subalgebra generated by elements of the form $E^k$ where $k\in \Lambda.$ In the following proposition, we show that the image of $\sigma$ is a kind of lattice in this subalgebra. Indeed the next proposition implies Proposition \ref{prop:finite_ext} in the introduction. \begin{proposition}\label{prop:image} Let $\mathcal{F}=\mathbb{Q}(A)(Q_1,\ldots,Q_n)[C_1^{\pm 1},\ldots,C_b^{\pm 1}],$ then $$\mathrm{Im}(\sigma)\underset{\mathcal{R}}{\otimes} \mathcal{F}=\underset{k\in \Lambda}{\bigoplus} \mathcal{F}E^k.$$ \end{proposition} \begin{proof} For $k\in \Lambda$ let $|k|=(|k_1|,\ldots,|k_n|).$ We will prove by induction on $|k|$ in the lexicographical order, that $E^k$ is a linear combination over $\mathcal{F}$ of symbols $\sigma(\gamma)$ of multicurves. The image of the empty multicurve settles the case $|k|=0.$ Next we note that since $k\in \Lambda,$ there is a multicurve $\gamma$ on $\Sigma$ such that $i(\gamma,\alpha_i)=|k_i|$ for any $1\leq i \leq n.$ For $\varepsilon\in \lbrace 0,1 \rbrace^n,$ let $\gamma_{\varepsilon}$ be the multicurve obtained from $\gamma$ by shifting its $i$-th twist coordinate by $\varepsilon_i$ if $\gamma$ has non-zero intersection with $\alpha_i.$ The curves $\gamma_{\varepsilon}$ all have $|k|$ geometric intersections with the curve $\lbrace \alpha_1,\ldots,\alpha_n\rbrace.$ For any $\mu \in \lbrace \pm 1\rbrace^n,$ and any $\varepsilon\in \lbrace 0,1 \rbrace^n,$ the coefficient $F_{\mu |k|}^{\gamma_{\varepsilon}}$ is non zero by Proposition \ref{prop:expand}-(2). Let us assume for simplicity that $\gamma$ has non-zero intersection with the curves $\alpha_1,\ldots,\alpha_d$ and is disjoint from the curves $\alpha_{d+1},\ldots,\alpha_n.$ By Lemma \ref{lemma:fracdehn}, we have $$F_{\mu |k|}^{\gamma_{\varepsilon}}=\underset{1\leq i \leq d}{\prod} (-A^{2\mu_i+|k_i|}Q_i^{2\mu_i})^{\varepsilon_i} F_{|k|}^{\gamma}$$ for any $\mu,\varepsilon.$ The matrix $$M=\left(\underset{1\leq i \leq d}{\prod} (-A^{2\mu_i+|k_i|}Q_i^{2\mu_i})^{\varepsilon_i} \right)_{\varepsilon \in \lbrace 0,1\rbrace^d, \mu \in \lbrace \pm 1\rbrace^d}$$ is the tensor product of matrices $\begin{pmatrix} 1 & 1 \\ -A^{2+|k_i|}Q_i^2 & -A^{-2+|k_i|}Q_i^{-2} \end{pmatrix}$ and therefore is invertible. Hence for any $\mu,$ there is an $\mathcal{F}$-linear combination of the multicurves $\gamma_{\varepsilon}$ such that its image by $\sigma$ has coefficient $1$ along $E^{\mu |k|}$ and zero coefficient along each other $E^{\mu'|k|}$ where $\mu'\neq \mu \in \lbrace \pm 1 \rbrace^d.$ As a result, we get an $\mathcal{F}$-linear combination of multicurves $x=\sum \lambda_{\varepsilon} \gamma_{\varepsilon}$ so that $\sigma(x)=E^{\mu |k|}$ up to lower order terms, and by induction hypothesis we can add another linear combination of multicurves to eliminate those lower order terms. \end{proof} \begin{remark}\label{rk:finExt} In some sense, the embedding is analogous to the Frohman-Gelca embedding \cite{FG00} of the skein algebra of the closed torus into the quantum torus $\mathbb{Z}[A^{\pm 1}]\langle Q,E\rangle/_{QE=AEQ}.$ The image of the Frohman-Gelca embedding is the symmetric part of the quantum torus; that is elements invariant under the action of the $\mathbb{Z}[A^{\pm 1}]$-algebra automorphism $\theta : Q,E\longmapsto Q^{-1},E^{-1}.$ Here, since $\sigma(\alpha_e)=-A^2Q_e^2-A^{-2}Q_e^{-2},$ , we have that the localized quantum torus is a kind of "finite extension" of the skein algebra by Proposition \ref{prop:image}. \end{remark} \subsection{Proof of Proposition \ref{prop:expand}} \label{sec:curveOpCoeff} \begin{figure}[!h] \centering \def .75\columnwidth{.7\columnwidth} \input{dehncoor.pdf_tex} \caption{A multicurve in Dehn-Thurston position follows one of the above patterns in the pants and annuli of the decomposition.} \label{fig:DehnThurston} \end{figure} \begin{figure}[h] \centering \def .75\columnwidth{.75\columnwidth} \input{patterns.pdf_tex} \caption{On the top the different patterns of the intersection of a multicurve (in black) with an annulus or pants piece of the decomposition. The trivalent graph $\Gamma$ is shown in red. On the bottom the remaining patterns after fusion.} \label{fig:Patterns} \end{figure} In this section, we will prove Proposition \ref{prop:expand}. Let $\Sigma$ be a compact oriented surface of genus $g$ and with $b$ boundary components with negative Euler characteristic, $\mathcal{P}=\lbrace \alpha_1,\ldots,\alpha_{3g-3+b}\rbrace$ be a pair of pants decomposition of $\Sigma$ and $\Gamma$ be a trivalent banded graph dual to $\mathcal{P}.$ We also view $\Sigma$ as the boundary of a handlebody $H,$ thus vectors $\varphi_c$ associated to colorings of $\Gamma$ give a basis of $S(H,\mathbb{Q}(A))$ by Lemma \ref{lemma:basis}. Taking two parallel copies of each curve in $\mathcal{P},$ we get a decomposition of $\Sigma$ into pair of pants and annuli. We will call $\alpha_i$ and $\alpha_i'$ the two parallel copies, with no particular convention for the choice of $\alpha_i.$ Note that the pair of pants in the decomposition have boundary either the curves $\alpha_i$,$\alpha_i'$ or the boundary curves of $\Sigma.$ If $\gamma$ is a multicurve on $\Sigma,$ then up to isotopy $\gamma$ can be put into Dehn-Thurston position. By this we mean that the geometric intersection number $i(\gamma,\alpha_i)$ of $\gamma$ with each curve in $\mathcal{P}$ is exactly the number of intersection points of $\gamma$ with $\alpha_i$ and also with $\alpha_i',$ and that in each pair of pants or annuli of the decomposition the curve $\gamma$ looks like one of the patterns described in Figure \ref{fig:DehnThurston}. The computation of the coefficients of the operator $T^{\gamma}$ in the basis $\varphi_c$ can be done as follows. First we can remove any component $\beta$ in $\gamma$ that is parallel to a curve in $\mathcal{P}$ or a boundary curve, at the price of multiplying $\varphi_c$ by the scalar $-A^{2c_e+2}-A^{-2c_e-2}=-A^2Q_e^2-A^{-2}Q_e^{-2}$ where $e$ is the edge encircled by $\beta.$ Secondly we apply the first fusion rule for each intersection point of $\gamma$ with a curve $\alpha_i$ or $\alpha_i'.$ Each fusion shifts the color of the corresponding edge by $\pm 1.$ After fusion, it only remains to simplify one of the patterns described in Figure \ref{fig:Patterns} to express the coefficients of $T^{\gamma}\varphi_c$ on the basis $\lbrace \varphi_c \rbrace.$ Note that as the skein module of the sphere with two colored points is one-dimensional if the two colors agree and zero else, to obtain a non-zero vector we need that the sums of shifts at intersection points with $\alpha_i$ and $\alpha_i'$ coincide. Furthermore, the skein module of a sphere with three points colored by $c_1,c_2,c_3$ is one-dimensional if the colors satisfy the admissibility conditions $c_i\leq c_j+c_k$ and $c_1+c_2+c_3$ even, and zero-dimensional else. By the assumption that $c$ is in the set $V_{\gamma},$ that is always the case after fusion. Therefore, each of the terms we obtain after fusion at the intersection points of $\gamma$ with $\alpha_i$ and $\alpha_i'$ is just a scalar multiple of a vector $\varphi_{c+k}.$ The color shift $k_e$ at edge $e$ is the common sum of the $\pm 1$ shifts at either intersection points in $\gamma\cap \alpha_i$ or at intersection points in $\gamma\cap \alpha_i'$. This shows that $T^{\gamma}\varphi_c$ has non-zero coefficient along $\varphi_{c+k}$ only when $k \in \Lambda$ and $|k_e|\leq i(\gamma,c_e)$ for each edge $e.$ Next we claim that the coefficients are in the ring $\mathcal{R}.$ Notice that the remaining patterns after fusion at intersection points $\gamma\cap(\alpha_e\cup \alpha_e')$ shown in Figure \ref{fig:Patterns} can be reduced to remove all black arcs using the fusion rules in Figure \ref{fig:fusion}. Furthermore, all of the fusion rules in Figure \ref{fig:fusion} involve only rationals functions of $A^{c_e}$ and $A,$ where $c_e$ are the colors of edges $e\in \mathcal{E}.$ Moreover, the denominators appearing in the fusion rules are all of the form $\lbrace c_e+k \rbrace=A^{2c_e+2k}-A^{-2c_e-2k}$ where $k\in \mathbb{Z}.$ (We remark that the first fusion rules will shift colors of $\Gamma$ but only by a fixed amount). We also claim that if $e$ is an external edge, we will never need to use any rule involving a denominator $\lbrace c_e+k\rbrace,$ since the geometric intersection of $\gamma$ and $\alpha_e$ is zero. Those rules correspond the rules that create or erase a black arc with an endpoint on the edge $e.$ Therefore, the coefficients are in the ring $\mathcal{R}.$ It remains to be seen that the extremal coefficients are non-zero. This is a consequence of Theorem 1.3 of \cite{Det16} and Lemma 4.3 of \cite{CM12}. This first theorem studies the matrix coefficients of the action of curve operators on $\mathrm{SU}_2$ TQFT spaces of surfaces. A subset of the basis $\varphi_c$ of the skein module of the handlebody, corresponding to colors $c$ satisfying the additional "$r$-admissibility conditions" gives a basis of the $\mathrm{SU}_2$ TQFT space of the surface $(\Sigma,c_i)$ with colored points. The curve operators on $\mathrm{S}$ induce curve operators $T_r^{\gamma}$ on the TQFT spaces at level $r$, and their matrix coefficients $F_k^{\gamma,\mathrm{SU}_2}(\frac{c}{r},\frac{1}{r})$ are obtained from the coefficients of $T^{\gamma}$ in the $E^k$ by sending $A$ to a $2r$-th root of unity and applying some renormalization. Theorem 1.3 of \cite{Det16} then shows that $F_k^{\gamma,\mathrm{SU}_2}(x,0)$ is the $k$-th Fourier coefficient of the trace function $f_{\gamma} : \rho \mapsto \underset{i\in I}{\prod} (-\mathrm{Tr}(\rho(\gamma_i))$ defined on the subset $\lbrace \forall e\in \mathcal{E}', \mathrm{Tr}(\rho(\alpha_e))=2\mathrm{cos}(\pi x_e)) \rbrace$ of the $\mathrm{SU}(2)$ moduli space of $\Sigma.$ Lemma 4.3 of \cite{CM12} shows that the extremal Fourier coefficients are non-zero as long as $x$ is taken in the interior of the image of the momentum map $\rho \mapsto \left(\mathrm{arcos}(\frac{\mathrm{Tr}(\rho(\alpha_e))}{2})\right)_{e\in \mathcal{E}'}.$ This implies that the coefficients $F_k^{\gamma,\mathrm{SU}_2}$ are non-zero when $k_e=\pm i(\gamma,\alpha_e)$ for all $e\in \mathcal{E}',$ and the same is true for the coefficients $F_k^{\gamma}$. \section{Localized quantum torus associated to a sausage graph} \label{sec:sausage_case} In this section, as well as the remaining of the paper, we introduce the notation $U(x)=x-x^{-1}$ when $x$ is an invertible element in a ring. Let $\Sigma$ be a surface with at most one boundary component with negative Euler characteristic. Consider the pants decomposition of $\Sigma$ as in Figure \ref{fig_sausage}. \begin{figure}[h!] \centering \includegraphics[scale = 0.35]{saucisson_alg.png} \caption{When $\partial \Sigma = \emptyset$, the two rightmost curves coincide.} \label{fig_sausage} \end{figure} Let $\Gamma$ be the graph dual to this pants decomposition : $$\includegraphics[scale = 0.45]{graph_saucisson.png}$$ When $\partial \Sigma = \emptyset$, $a_{g-1} = b_{g-1}$ and $c_g$ does not exist. Finally let $\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}$ be the curves shown in Figure \ref{fig_beta_gamma}. \begin{figure}[h!] \centering \includegraphics[scale = 0.45]{cycle_saucisson.png} \caption{The $\beta$ and $\gamma$ curves} \label{fig_beta_gamma} \end{figure} For $k : \mathcal{E}' \to \mathbb{Z}$, we define $E^k$ to be $\prod_{e \in \mathcal{E}'} E_e^{k(e)}$ and $\Lambda$ be the set of maps $k : \mathcal{E}' \to \mathbb{Z}$ such that if $e_1,e_2,e_3 \in E(\Gamma)$ meet at a vertex then $k(e_1)+k(e_2)+k(e_3)$ is even. \begin{definition} \label{A0} Let $\mathcal{R}^0$ be the set of Laurent polynomial with coefficients in $Z[A^{ \pm 1}]$ in the variables $Q_{a_0}^2,Q_{a_1} Q_{b_1}, Q_{a_1} Q_{b_1}^{-1}, \ldots, Q_{a_{g-1}} Q_{b_{g-1}}, Q_{a_{g-1}} Q_{b_{g-1}}^{-1}, Q_{c_1},\ldots,Q_{c_g}$. We define $\mathcal{A}(\Gamma)^0$ be the sub-algebra of $\mathcal{A}(\Gamma)$ defined by the set of $$\sum_{k \in \Lambda} E^k F_k$$ where $F_k = V/W$ with a $V \in \mathcal{R}^0$ and $W$ is a finite (possibly empty) product of $A^n Q_{\alpha}^2-A^{-n} Q_{\alpha}^{-2}$ for $n \in \mathbb{Z}$ and $\alpha \in \mathcal{P}$. \end{definition} We define also the \textit{non localized} version $\mathcal{A}(\Gamma)^0$ : $$\mathcal{T}(\Gamma)^0 = \left\{ \sum_{k \in \Lambda} E^k F_k \, ; \, F_k \in \mathcal{R}^0 \right\} \subset \mathcal{A}(\Gamma)^0$$ \begin{lemma} \label{gen_t} $\mathcal{T}(\Gamma)^0$ is generated by the following sets \begin{align*} \mathcal{X}= & \{Q_{a_0}^2,Q_{a_1} Q_{b_1}, Q_{a_1} Q_{b_1}^{-1}, \ldots, Q_{a_{g-1}} Q_{b_{g-1}}, Q_{a_{g-1}} Q_{b_{g-1}}^{-1}, Q_{c_1},\ldots,Q_{c_{g-1}} \} \\ \mathcal{Y} = & \{E_{a_0},E_{a_1} E_{b_1}, E_{a_1} E_{b_1}^{-1}, \ldots, E_{a_{g-1}} E_{b_{g-1}}, E_{a_{g-1}} E_{b_{g-1}}^{-1}, E_{c_1}^2,\ldots,E_{c_{g-1}}^2 \} \\ \mathcal{Z} = & \{Q_{c_g} \} \end{align*} and the inverses of the elements of these sets. \end{lemma} \noindent \textbf{Convention :} From now on, we will use the same symbol for an edge of $\Gamma$ and the unique curve in $\mathcal{P}$ encircling it. \\ Recall that $\sigma : S(\Sigma) \to \mathcal{A}(\Gamma)$ is an embedding. We see that for $e \in \mathcal{P}$ $$\sigma(e) = -(A^2 Q_e^2 + A^{-2} Q_e^{-2})$$ Let us give an explicit expression of $\sigma(\gamma)$ for $\gamma \in \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$. There are three local configurations for $\gamma$ as shown in Figure \ref{fig_cycle}. \begin{center} \begin{figure} \centering \subfigure[One-cycle \qquad]{\includegraphics[width=3cm]{sous-graphe0}} \qquad \subfigure[Two cycle]{\includegraphics[width=3.5cm]{sous-graphe1}} \qquad \subfigure[Separating edge curve]{\includegraphics[width=4cm]{sous-graphe3}} \qquad \caption{Three configurations for the curve $\gamma$} \label{fig_cycle} \end{figure} \end{center} Suppose that $\gamma$ is a one-cycle as in Figure \ref{fig_cycle} (a). The fusion rules say that : \begin{equation} \label{emb_1_cycle} \sigma(\gamma) = E_e+E_e^{-1}F \end{equation} where $$F = U(A^2 Q_e^2 Q_f)U(Q_e^2 Q_f^{-1})U(A^2 Q_e^2)^{-1}U(Q_e^2)^{-1}$$ and we recall the notation $U(x)=x-x^{-1}.$ Suppose that $\gamma$ is a two-cycle as in Figure \ref{fig_cycle} (b). The fusion rules say that : \begin{equation} \label{emb_2_cycle} \sigma(\gamma) = E_b E_b +E_b E_c^{-1} F_{1,-1}+E_b^{-1} E_c F_{-1,1} + E_b^{-1} E_c^{-1} F_{-1,-1} \end{equation} where \begin{align*} F_{-1,1} & = -\dfrac{U(Q_{a'} Q_{b} Q_{c}^{-1}) U(Q_{a} Q_{b} Q_{c}^{-1})}{U(A^2 Q_{b}^2)U(Q_{b}^2)} \\ F_{1,-1} & = -\dfrac{U(Q_{a'} Q_{c} Q_{b}^{-1}) U(Q_{a} Q_{c} Q_{b}^{-1})}{U(A^2 Q_{c}^2)U(Q_{c}^2)} \\ F_{-1,-1} & = \dfrac{U(A^2 Q_{a'} Q_{c} Q_{b}) U(A^2 Q_{a} Q_{c} Q_{b}) U(Q_{b} Q_{c} Q_{a'}^{-1})U(Q_{b} Q_{c} Q_{a}^{-1})}{U(A^2 Q_{c}^2)U(Q_{c}^2)U(A^2 Q_{b}^2)U(Q_{b}^2)} \end{align*} Finally suppose that $\gamma$ is a separating edge curve as in Figure \ref{fig_cycle} (c), we have : \begin{equation} \label{emb_sep} \sigma(\gamma) = E_c^2 G_2+ G_0+ E_c^{-2} G_{-2} \end{equation} where \begin{align*} G_0 = & \frac{(d_1 d_3 +d_2 d_4)c +(A^2+A^{-2})(d_1 d_2 + d_3 d_4)}{U(Q_c^2) U(A^4 Q_c^2)}\\ & \\ G_{-2} =& -\dfrac{U(A^2 Q_{d_1}Q_{d_4} Q_c)U(Q_{d_1}Q_c Q_{d_4}^{-1})U(Q_{d_4}Q_c Q_{d_1}^{-1})}{U(A^{-2}Q_c^2) U(Q_c^2)^2 U(A^2 Q_c^2)} \\ & \times U(A^2 Q_{d_2}Q_{d_3} Q_c)U(Q_{d_2}Q_c Q_{d_3}^{-1})U(Q_{d_3}Q_c Q_{d_2}^{-1})\\ & \\ G_2 = & -U(Q_{d_1} Q_{d_4} Q_{c}^{-1}) U(Q_{d_2} Q_{d_3} Q_{c}^{-1}) \end{align*} with $d_j = -A^2 Q_{d_j}^2-A^{-2} Q_{d_j}^{-2}$ for $j \in \{1,2,3,4\}$. \begin{proposition} If $\xi$ is a non zero complex number such that $\xi^4 \neq 1$ then the image $\sigma_{\xi} : S_{\xi}(\Sigma) \to \mathcal{A}_{\xi}(\Gamma)$ lies in $\mathcal{A}_{\xi}(\Gamma)^0$. \end{proposition} \begin{proof} Let $\alpha \in \mathcal{P}$, $\sigma_{\xi}(\alpha) = -(\xi^2 Q_e^2+\xi^{-2} Q_e^{-2})$ for some edge $e \in E(\Gamma)$, therefore $\sigma_{\xi}(\alpha) \in \mathcal{A}_{\xi}(\Gamma)^0$. Also $\sigma_{\xi}(\gamma) \in \mathcal{A}_{\xi}(\Gamma)^0$ for any $\gamma \in \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ according to Formulas \ref{emb_1_cycle},\ref{emb_2_cycle} and \ref{emb_sep}. Since the set of Dehn twists associated to the curves in $\mathcal{P}\cup \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ generate the mapping class group of $\Sigma$, the set $\mathcal{P}\cup \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ generate $S_{\xi}(\Sigma)$ by \cite[Thm 1.1]{San}. We can then conclude. \end{proof} \begin{figure}[t] \centering \includegraphics[scale = 0.35]{tau} \caption{The curve $\tau$} \label{fig_tau} \end{figure} The next proposition is an explicit version of Proposition \ref{prop:finite_ext}. \begin{proposition} Let $\gamma \in \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$. If $\gamma$ is a one-cycle as in Figure \ref{fig_cycle} (a), then \begin{equation} \label{1_cycle_lift} \left\{ \begin{array}{llll} E_e & = - \Big(t_{e}(\gamma)+A^{-1}\gamma Q_e^{-2}\Big)A^{-1} U(A^2 Q_e^2)^{-1} \\ E_e^{-1} & =\quad \Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big)A^{-1} U(A^2 Q_e^2)^{-1}F^{-1} \end{array} \right. \end{equation} where $F$ was defined in Equation (\ref{emb_1_cycle}). If $\gamma$ is a two-cycle as in Figure \ref{fig_cycle} (b), then \begin{align} &E_b E_c = \Big( \sigma(\gamma) A^{-2} Q_b^{-2} Q_c^{-2}+ \sigma(t_b(\gamma)) A^{-1} Q_c^{-2} + \sigma(t_c(\gamma)) A^{-1} Q_b^{-2} +\sigma(t_b t_c(\gamma)) \Big) D^{-1} \label{2_cycle_lift1} \\ &E_b E_c^{-1} F_{1,-1} = -\Big( \sigma(\gamma) A^{2} Q_b^{-2} Q_c^{2}+ \sigma(t_b(\gamma)) A^{3} Q_c^{2} + \sigma(t_c(\gamma)) A^{-1} Q_b^{-2} +\sigma(t_b t_c(\gamma)) \Big) D^{-1} \label{2_cycle_lift2} \\ &E_b^{-1} E_c F_{-1,1} = -\Big( \sigma(\gamma) A^{2} Q_b^{2} Q_c^{-2}+ \sigma(t_b(\gamma)) A^{-1} Q_c^{-2} + \sigma(t_c(\gamma)) A^{3} Q_b^{2} +\sigma(t_b t_c(\gamma)) \Big) D^{-1} \label{2_cycle_lift3} \\ &E_b^{-1} E_c^{-1}F_{-1,-1} = \Big( \sigma(\gamma) A^{6} Q_b^{2} Q_c^{2}+ \sigma(t_b(\gamma)) A^{3} Q_c^{2} + \sigma(t_c(\gamma)) A^{3} Q_b^{2} +\sigma(t_b t_c(\gamma)) \Big) D^{-1} \label{2_cycle_lift4} \end{align} where $D = A^2 U(A^2 Q_c^2) U(A^2 Q_b^2)$ and where $F_{-1,1},F_{1,-1},F_{-1,-1}$ were defined in Equation (\ref{emb_2_cycle}). Finally if $\gamma$ is a separating edge curve as in Figure \ref{fig_cycle} (c), then \begin{align} & E_c^2 G_2 = -\left[\gamma Q_c^{-2} + \tau - \dfrac{A^{-2} \delta_1 Q_c^{-2}-A^2 \delta_2}{U(A^4 Q_c^2)}\right] A^{-2} U(A^2 Q_c^2)^{-1} \label{sep_lift1} \\ & E_c^{-2} G_{-2} = \left[\gamma A^2 Q_c^2 + A^{-2} \tau + \dfrac{ \delta_1 Q_c^2-\delta_2}{U(Q_c^2)}\right] U(A^2 Q_c^2)^{-1} \label{sep_lift2} \end{align} where $\delta_1 = d_1 d_3+d_2 d_4$, $\delta_2 = d_1 d_2+d_3 d_4$ and $\tau$ is as in Figure \ref{fig_tau}. \end{proposition} \begin{proof} Suppose that $\gamma$ is a one-cycle. Recall that $\sigma(e) = -(A^2 Q_e^2+A^{-2} Q_e^{-2})$ and $ Q_e E_e = A E_e Q_e$. Moreover in the skein algebra of $\Sigma$, we have $A e \gamma -A^{-1} \gamma e = (A^2-A^{-2})t_e(\gamma)$. Using Equation (\ref{emb_1_cycle}) we obtain the following $\sigma(t_{e}(\gamma)) = -A^3 E_e Q_e^2 - A^{-1} E_e^{-1} Q_e^{-2} F$ and therefore the following system $$\left\{ \begin{array}{llll} \sigma(\gamma) & = E_e + E_e^{-1} F \\ \sigma(t_{e}(\gamma)) & = -A^3 E_e Q_e^2 - A^{-1} E_e^{-1} Q_e^{-2} F \end{array} \right. $$ Solving this system gives Equations (\ref{1_cycle_lift}). In the case where $\gamma$ is a two-cycle, the strategy is very similar. In this case, we apply $t_b$, $t_c$ and $t_b t_c$ to the curve $\gamma$ to get a system of four equations whose resolution gives (\ref{2_cycle_lift1}), (\ref{2_cycle_lift2}),(\ref{2_cycle_lift3}), (\ref{2_cycle_lift4}). Suppose now that $\gamma$, is separating edge curve. In the Skein algebra of $\Sigma$ we have $$A^2 c \gamma - A^{-2} \gamma c = (A^4-A^{-4}) \tau + (A^2-A^{-2}) (d_1 d_3 +d_2 d_4)$$ Applying this to Equation (\ref{emb_sep}), one gets the following system $$\left\{ \begin{array}{llll} \sigma(\gamma) -G_0 & = E_c^2 G_2+ E_c^{-2} G_{-2} \\ \sigma(\tau) + \dfrac{\sigma(d_1 d_3+d_2 d_4)-G_0 \sigma(c)}{A^2+A^{-2}} & = -E_c^{2}G_2 A^4 Q_c^2 - E_c^{-2}G_{-2} Q_c^{-2} \end{array} \right. $$ Solving this system gives Equation (\ref{sep_lift1}) and (\ref{sep_lift2}). \end{proof} We finish this section by analyzing irreducible representations of $\mathcal{A}(\Gamma)^0$ at root of unity. Let $\xi$ be a $2p$-th primitive root of unity with $p$ odd and let $\rho : \mathcal{A}_{\xi}(\Gamma)^0 \to \mathrm{End}(V)$ be a complex irreducible finite dimensional representation. Let $x \in \mathcal{X} \cup \mathcal{Y}$, notice that $x^p$ is a central element of $\mathcal{A}_{\xi}(\Gamma)^0$, hence $\rho(x^p)$ is a scalar times the identity of $V$ (because $\rho$ is irreducible). Let us denote by $\lambda_{x,\rho}$ this scalar. Note that $Q_{c_g}$ is also central so $\rho(Q_{c_g}) = \lambda_{\rho} \mathrm{Id}_V$ for some $\lambda_{\rho} \in \mathbb{C}$. \begin{proposition} \label{rep_Q_t} Let $\rho_1$ and $\rho_2$ be two complex irreducible finite dimensional representations of $\mathcal{A}_{\xi}(\Gamma)^0$. If $\lambda_{\rho_1} = \lambda_{\rho_2}$ and $\lambda_{x,\rho_1}=\lambda_{x,\rho_2}$ for all $x \in \mathcal{X} \cup \mathcal{Y}$ then $\rho_1$ and $\rho_2$ are isomorphic. Any irreducible representation of $\mathcal{A}_{\xi}(\Gamma)^0$ has dimension $p^{3g-2}$ when $\Gamma$ has an univalent vertex and dimension $p^{3g-3}$ otherwise. \end{proposition} \begin{proof} It is enough to prove that the restrictions of $\rho_1$ and $\rho_2$ to $\mathcal{T}_{\xi}(\Gamma)^0$ are isomorphic. Let $\mathcal{W}$ be the complex algebra defined by the generators $U^{\pm 1}$, $V^{\pm 1}$ and by the relation $UV = \xi^2 V U$. From the generators of Lemma \ref{gen_t} it is easy to see that $\mathcal{T}_{\xi}(\Gamma)^0$ is isomorphic to $\mathcal{W}^{\otimes 3g-3}$ when $\Gamma$ does not have a univalent vertex (which is when $\partial \Sigma = \emptyset$) and to $\mathcal{W}^{\otimes 3g-2} \otimes \mathbb{C}[Z^{ \pm 1}]$ (where $Z$ is a formal independent variable) when $\Gamma$ has one univalent vertex. The result follows directly from \cite[Lemma 17,18]{BL07}. \end{proof} \section{Representation of the skein algebra} \label{sec:representations} In this section $\Sigma$ is still a surface with at most one boundary component with negative Euler characteristic. The goal of this section is to prove Theorem \ref{thm:lift_rep} and Corollary \ref{cor:unicity}. Let $p \ge 3$ an odd number, we warn the reader that from now on $A$ will not be a formal variable but a $2p$-th primitive root of unity. We recall the Bonahon-Wong theory, let $$\rho : S_A(\Sigma) \to \mathrm{End}(V)$$ be a finite dimensional irreducible representation. By Bonahon-Wong work, there exists $r : \pi_1(\Sigma) \to \mathrm{SL}_2(\mathbb{C})$ such that for any simple close curve $\gamma$ we have \begin{equation} \label{1} T_p(\rho(\gamma)) = -\mathrm{Tr}(r(\gamma))\mathrm{Id}_V \end{equation} Here $T_k$ is $k$-th Chebyshev polynomial of the first kind, the important thing to remember is that $$T_k(u+u^{-1}) = u^k + u^{-k} \quad \forall u\in \mathbb{C}-\{0 \}$$ Moreover $r$ is called the classical shadow of $\rho$. The proof of Theorem \ref{thm:lift_rep} requires several steps, it will starts at Subsection \ref{subs1} and ends at Subsection \ref{proof_lift_rep}. The goal is to define $\tilde{\rho}$ on the generators of $\mathcal{A}_A(\Gamma)^0$ (given in Lemma \ref{gen_t}), prove the relations satisfied by these generators are preserved by $\tilde{\rho}$, and show that $\tilde{\rho}$ agrees with $\rho$ on $\sigma_A(\Sigma_A(\Sigma))$. The proof of Corollary \ref{cor:unicity} is done in Subsection \ref{classical_shadow}. From now on, we fix a irreducible representation $\rho : S_A(\Sigma) \to \mathrm{End}(V)$ with classical shadow $r$ satisfying the hypothesis of Theorem \ref{thm:lift_rep}. \subsection{Action of the $Q$ operators} \label{subs1} For $\alpha \in \mathcal{P}$, let us chose $x_{\alpha} \neq 0$ such that $\mathrm{Tr}(r(\alpha)) = x_{\alpha}^{2p} + x_{\alpha}^{-2p}$. A known fact is that $(1)$ implies that $\rho(\alpha)$ is diagonalizable with eigenvalues $$-(x_{\alpha}^2 A^{2k+2} + x_{\alpha}^{-2} A^{-2k-2})$$ for $k = 0,\ldots,p-1$. We define for $k \in \mathbb{Z}$ $$V_{\alpha,k} = \mathrm{Ker}\Big(\rho(\alpha)+(x_{\alpha}^2 A^{2k+2} + x_{\alpha}^{-2} A^{-2k-2} ) \mathrm{Id}_V \Big)$$ We also define $\tilde{\rho}(Q_{\alpha}) \in \mathrm{GL}(V)$ by $$\tilde{\rho}(Q_{\alpha}) v = x_{\alpha} (-A)^k v \quad \quad \forall v \in V_{\alpha,k}$$ so that \begin{equation} \label{Q} \rho(\alpha) = -(A^2 \tilde{\rho}(Q_{\alpha})^2+ A^{-2} \tilde{\rho}(Q_{\alpha})^{-2}) \end{equation} As the matrices $\{\rho(\alpha) \, | \, \alpha \in \mathcal{P} \}$ pairwise commute, it is clear that $\{ \tilde{\rho}(Q_{\alpha}) \, | \, \alpha \in \mathcal{P} \}$ pairwise commute. Hence the set $\{ \tilde{\rho}(Q_{\alpha}) \, | \, \alpha \in \mathcal{P} \}$ defines a morphism $\tilde{\rho} : \mathbb{C}[Q_e^{\pm 1} \, | \, e \in \mathcal{E}(\Gamma)] \to \mathrm{End}(V)$ (here we use that $\mathcal{P}$ is canonically in bijection with $\mathcal{E}(\Gamma)$). The following lemma will help us extend $\tilde{\rho}$ further. Recall that for an invertible element $W$, $U(W)= W-W^{-1}$. \begin{lemma} For all $\alpha \in \mathcal{P}$, we have $U(A^k \tilde{\rho}(Q_{\alpha})^2) \in \mathrm{GL}(V)$ for any $k \in \mathbb{Z}$. \end{lemma} \begin{proof} Let $k \in \mathbb{Z}$ and $\alpha \in \mathcal{P}$, the eigenvalues of $U(A^k \tilde{\rho}(Q_{\alpha})^2)$ are $U(A^{k +2l} x_{\alpha}^2)$ for $l \in \mathbb{Z}$. Suppose that one of these is $0$ which is to say that $U(A^k \tilde{\rho}(Q_{\alpha})^2) \notin \mathrm{GL}(V)$. It would imply $A^{k +2l} x_{\alpha}^2=A^{-k -2l} x_{\alpha}^{-2}$ for some $l \in \mathbb{Z}$. Taking the $p$-th power of this equality gives $x_{\alpha}^{4p} =1$ which implies $r(\alpha) = x_{\alpha}^{2p}+x_{\alpha}^{-2p}= \pm 2$. This would contradict (\ref{eqG2}). \end{proof} From this lemma we see that $\tilde{\rho}$ is defined for elements in $\mathcal{A}_A(\Gamma)$ of the form $\dfrac{X}{Y}$ where $X,Y \in \mathbb{C}[Q_e^{\pm 1} \, | \, e \in \mathcal{E}(\Gamma)]$ and $Y$ is a finite product of elements in the set $\{U(A^k Q_{\gamma}) \, | \, \gamma \in \mathcal{P}, k \in \mathbb{Z} \}$. \begin{lemma} \label{invF} Let $e_1,e_2,e_3 \in E(\Gamma)$ meeting at vertex. For all $k \in \mathbb{Z}$ and $\epsilon_1,\epsilon_2,\epsilon_3 \in \{-1,1 \}$ we have $$\tilde{\rho}(U(A^k Q_{e_1}^{\epsilon_1}Q_{e_2}^{\epsilon_2} Q_{e_3}^{\epsilon_3})) \in \mathrm{GL}(V)$$ \end{lemma} \begin{proof} Let $\alpha_1,\alpha_2,\alpha_3 \in \mathcal{P}$ respectively dual to $e_1,e_2,e_3$. Suppose there exists $k \in \mathbb{Z}$ and $\epsilon_1,\epsilon_2,\epsilon_3 \in \{-1,1 \}$ such that $\tilde{\rho}(U(A^k Q_{e_1}^{\epsilon_1}Q_{e_2}^{\epsilon_2} Q_{e_3}^{\epsilon_3}))$ is not invertible. It would mean that for some $l \in \mathbb{Z}$ we have $U(\pm A^l x_{\alpha_1}^{\epsilon_1} x_{\alpha_2}^{\epsilon_2} x_{\alpha_3}^{\epsilon_3}) = 0$. This implies $A^l x_{\alpha_1}^{\epsilon_1} x_{\alpha_2}^{\epsilon_2} x_{\alpha_3}^{\epsilon_3}=A^{-l} x_{\alpha_1}^{-\epsilon_1} x_{\alpha_2}^{-\epsilon_2} x_{\alpha_3}^{-\epsilon_3}$, taking the $p$-th power this equality (and remembering that $A^p = A^{-p}$), one gets $$ x_{\alpha_1}^{p\epsilon_1} x_{\alpha_2}^{p\epsilon_2} x_{\alpha_3}^{p\epsilon_3}= x_{\alpha_1}^{-p\epsilon_1} x_{\alpha_2}^{-p\epsilon_2} x_{\alpha_3}^{-p \epsilon_3}$$ Let $\lambda_1 = x_{\alpha_1}^{p\epsilon_1}, \lambda_2 = x_{\alpha_2}^{p\epsilon_2}, \lambda_3 = x_{\alpha_3}^{p\epsilon_3}$ and remember that $\lambda_1 \lambda_2 \lambda_3 - \lambda_1^{-1} \lambda_2^{-1} \lambda_3^{-1} = 0$. Now notice that $$\prod_{\delta_2,\delta_3 \in \{-1,1\} } (\lambda_1 \lambda_2^{\delta_2} \lambda_3^{\delta_3}- \lambda_1^{-1} \lambda_2^{-\delta_2} \lambda_3^{-\delta_3}) = 2+\sum_{k=1}^3(\lambda_k^4+\lambda_k^{-4})- \prod_{k=1}^3 (\lambda_k^2+\lambda_k^{-2})$$ with the left hand side being zero by assumption and the right hand side being $$2+\sum_{k=1}^3 \mathrm{Tr}(r(\alpha_k^2))- \prod_{k=1}^3 \mathrm{Tr}(r(\alpha_k))$$ This would contradict (\ref{eqG1}). \end{proof} \subsection{Action of a one-cycle edge shift} \label{subs2} Recall that the set of curves $\{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ was defined in Figure \ref{fig_beta_gamma}, let $\gamma$ be one of these curves. Suppose that $\gamma$ is a one-cycle as in Figure \ref{fig_cycle} (a). In light of Equation (\ref{1_cycle_lift}), let us define \begin{align*} \tilde{\rho}({E_e}) & = - \tilde{\rho} \left[\Big(t_{e}(\gamma)+A^{-1}\gamma Q_e^{-2}\Big)A^{-1} U(A^2 Q_e^2)^{-1}\right] \\ \tilde{\rho}(E_e^{-1}) & =\quad \tilde{\rho} \left[\Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big)A^{-1} U(A^2 Q_e^2)^{-1}F^{-1} \right] \end{align*} where $F$ is defined in Equation (\ref{emb_1_cycle}). Notice that $\tilde{\rho}(F)$ is invertible by Lemma \ref{invF}, hence the second formula makes sense. \noindent \textbf{Convention :} In the coming proofs, we sometimes drop the symbol $\tilde{\rho}$ when the notations are too cluttered. \\ \begin{lemma} \label{1_cycle_rep} The following statements hold \begin{enumerate} \item[(a)] $\tilde{\rho}(Q_e) \tilde{\rho}(E_e) = -A \tilde{\rho}(E_e) \tilde{\rho}( Q_e)$ and $\tilde{\rho}(Q_e) \tilde{\rho}(E_e^{-1}) = -A ^{-1} \tilde{\rho}(E_e^{-1}) \tilde{\rho}( Q_e)$, \item[(b)] $\tilde{\rho}(E_e) \tilde{\rho}(E_e^{-1}) = \mathrm{Id}_V$, \item[(c)] $\rho(\gamma) = \tilde{\rho}(E_e)+\tilde{\rho}(E_e^{-1})\tilde{\rho}(F)$. \end{enumerate} \end{lemma} \begin{proof} Let us prove (a). Recall that $V_{e,k} = \mathrm{Ker}\Big(\rho(e)+(x_{e}^2 A^{2k+2} + x_{e}^{-2} A^{-2k-2}) \mathrm{Id}_V \Big)$ for $k \in \mathbb{Z}$. Moreover, it follow from $ e \gamma = A^{-2} \gamma e + A^{-1}(A^2-A^{-2}) t_{e}(\gamma)$ and $e t_{e}(\gamma) = A^2 t_{e}(\gamma) e - A(A^2-A^{-2}) \gamma$ that $$\rho(e) \tilde{\rho}(E_e) = \tilde{\rho}(E_e) \tilde{\rho}(-A^4 Q_e^2-A^{-4} Q_e^{-2})$$ Which implies that $\tilde{\rho}(E_e) V_{e,k} \subseteq V_{e,k+1}$ and in particular $\tilde{\rho}(Q_e) \tilde{\rho}(E_e) = -A \tilde{\rho}(E_e) \tilde{\rho}( Q_e)$. The second part of (a) can be done with exact same strategy. Let us prove (b). From (a), $U(A^2 Q_e^2)^{-1} \tilde{\rho}(E_e^{-1}) = \tilde{\rho}(E_e^{-1}) U(Q_e^2)$ so $$\tilde{\rho}(E_e)\tilde{\rho}(E_e^{-1}) = -\Big(t_{e}(\gamma)+A^{-1}\beta Q_e^{-2}\Big)\Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big) A^{-2} U(Q_e^2)^{-1} U(A^2 Q_e^2)^{-1}F^{-1}$$ Note that $-A^{2} U(Q_e^2) U(A^2 Q_e^2)F=-A^2 \Big(A^2 Q_e^4+A^{-2} Q_e^{-4} + f \Big)$. Thus it is enough to prove \begin{equation} \label{pic} \Big(t_{e}(\gamma)+A^{-1}\beta Q_e^{-2}\Big)\Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big)=-A^2 \Big(A^2 Q_e^4+A^{-2} Q_e^{-4} + f \Big) \end{equation} Still from (a) \begin{align*} & \Big(t_{e}(\gamma)+A^{-1}\gamma Q_e^{-2}\Big)\Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big) = A^3 t_{e}(\gamma) \gamma Q_e^2 + t_{e}(\gamma)^2+A^4 \gamma^2 + A \gamma t_{e}(\gamma) Q_e^{-2} \end{align*} Now we use $t_{e}(\gamma) \gamma = A^{-1} e + A t_{\gamma}^{-2}(e)$ to get \begin{align} & \Big(t_{e}(\gamma)+A^{-1}\gamma Q_e^{-2}\Big)\Big(A^3 \gamma Q_e^2+t_{e}(\gamma) \Big) = A^2(Q_e^2+Q_e^{-2})e + t_{e}(\gamma)^2+A^4 \gamma^2-A^2 t_{\gamma}^{-2}(e) e \notag \\ & = -A^2 \Big(A^2 Q_e^4+A^{-2} Q_e^{-4} + f \Big) \notag \end{align} The last equality is obtained using $t_{\gamma}^{-2}(e)e = A^2 \gamma^2 + f -A^2-A^{-2} + A^{-2} t_{e}(\gamma)^2$ and $e = -(A^2 Q_e^2+A^{-2} Q_{e}^{-2})$. The proof of (c) follows from direct computation. \end{proof} \subsection{Action of a two-cycle edge shift} \label{subs3} Let $\gamma \in \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ be a two-cycle as in Figure \ref{fig_cycle} (b). In light of Equations (\ref{2_cycle_lift1}), (\ref{2_cycle_lift2}), (\ref{2_cycle_lift3}) and (\ref{2_cycle_lift4}) let us define \begin{align*} &\tilde{\rho}(E_b E_c) = \tilde{\rho}\left[ \Big( \gamma A^{-2} Q_b^{-2} Q_c^{-2}+ t_b(\gamma) A^{-1} Q_c^{-2} + t_c(\gamma) A^{-1} Q_b^{-2} +t_b t_c(\gamma) \Big) D^{-1} \right]\\ &\tilde{\rho}(E_b E_c^{-1}) = \tilde{\rho}\left[ -\Big( \gamma A^{2} Q_b^{-2} Q_c^{2}+ t_b(\gamma) A^{3} Q_c^{2} + t_c(\gamma) A^{-1} Q_b^{-2} +t_b t_c(\gamma) \Big) D^{-1} F_{1,-1}^{-1}\right] \\ &\tilde{\rho}(E_b^{-1} E_c) = \tilde{\rho}\left[-\Big( \gamma A^{2} Q_b^{2} Q_c^{-2}+ t_b(\gamma) A^{-1} Q_c^{-2} + t_c(\gamma) A^{3} Q_b^{2} +t_b t_c(\gamma) \Big) D^{-1} F_{-1,1}^{-1} \right]\\ &\tilde{\rho}(E_b^{-1} E_c^{-1}) = \tilde{\rho}\left[ \Big( \gamma A^{6} Q_b^{2} Q_c^{2}+ t_b(\gamma) A^{3} Q_c^{2} + t_c(\gamma) A^{3} Q_b^{2} +t_b t_c(\gamma) \Big) D^{-1}F_{-1,-1}^{-1} \right] \end{align*} where $D = A^2 U(A^2 Q_c^2) U(A^2 Q_b^2)$ and where $F_{1,-1},F_{-1,1},F_{-1,-1}$ were defined in Equation (\ref{emb_2_cycle}). \begin{lemma} \label{2_cycle_rep} The following statements hold : \begin{enumerate} \item[(a)] $\tilde{\rho}(Q_b) \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) = (-A)^{\epsilon_1} \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2})\tilde{\rho}(Q_b)$ for all $\epsilon_1,\epsilon_2 \in \{-1,1\}$, \item[(b)] $\tilde{\rho}(Q_c) \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) = (-A)^{\epsilon_2} \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2})\tilde{\rho}(Q_c)$ for all $\epsilon_1,\epsilon_2 \in \{-1,1\}$, \item[(c)] $\tilde{\rho}(E_b E_c) \tilde{\rho}(E_b^{-1} E_c^{-1}) = \mathrm{Id}_V$ and $\tilde{\rho}(E_b E_c^{-1}) \tilde{\rho}(E_b^{-1} E_c) = \mathrm{Id}_V$, \item[(d)] $\tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) \tilde{\rho}(E_b^{\epsilon_3} E_c^{\epsilon_4}) = \tilde{\rho}(E_b^{\epsilon_3} E_c^{\epsilon_4}) \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2})$ for all $\epsilon_1,\epsilon_2,\epsilon_3, \epsilon_4 \in \{-1,1\}$, \item[(e)] $\rho(\gamma) = \tilde{\rho}(E_b E_c) + \tilde{\rho}(E_b E_c) \tilde{\rho}(F_{1,-1}) + \tilde{\rho}(E_b^{-1} E_c) \tilde{\rho}(F_{-1,1})+ \tilde{\rho}(E_b^{-1} E_c^{-1}) \tilde{\rho}(F_{-1,-1})$. \end{enumerate} \end{lemma} \begin{proof} For this proof, let us define for $\epsilon_1,\epsilon_2 \in \{-1,1\}$ $$X_{\epsilon_1,\epsilon_2} = \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) \tilde{\rho}(D F_{\epsilon_1,\epsilon_2})$$ where we set $F_{1,1} = 1$. The proof of (a) is very similar to the proof of Lemma \ref{1_cycle_rep} (a). This time, $$\begin{array}{ll} b \gamma &= A^{-2} \gamma b +A^{-1}(A^2-A^{-2}) t_{b}(\gamma) \\ b t_c(\gamma) &= A^{-2} t_c(\gamma) b +A^{-1}(A^2-A^{-2}) t_{b}(t_c(\gamma)) \\ b t_b(\gamma) &= A^{2} t_b(\gamma)b -A(A^2-A^{-2}) \gamma \\ b t_b t_c(\gamma) &= A^{2} t_b t_c(\gamma)b -A(A^2-A^{-2}) t_c(\gamma) \end{array}$$ implies that $\tilde{\rho}(b) \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) = \tilde{\rho}(E_b^{\epsilon_1} E_c^{\epsilon_2}) \tilde{\rho}(-A^{2+2\epsilon_1} Q_b^2-A^{2-2\epsilon_1} Q_b^{-2})$ for $\epsilon,\epsilon_2 = \pm 1$. The proof of (b) is exactly the same as (a). Let us prove (c). $$\tilde{\rho}(E_b E_c^{\epsilon}) \tilde{\rho}(E_b^{-1} E_c^{-\epsilon}) = X_{1,\epsilon} X_{-1,-\epsilon} (A^4 \hat{F}_{1,\epsilon} F_{-1,-\epsilon} \hat{D} D)^{-1}$$ with $$A^4 \hat{F}_{1,\epsilon} F_{-1,-\epsilon} \hat{D} D = A^4(A^{2\epsilon}Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} Q_b^{-2} Q_c^{-2\epsilon}+a)(A^{2\epsilon}Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} Q_b^{-2} Q_c^{-2\epsilon}+a')$$ Let us prove that $$X_{1,\epsilon} X_{-1,-\epsilon} = A^4 \hat{F}_{1,\epsilon} F_{-1,-\epsilon} \hat{D} D$$ We fix $\epsilon \in \{-1,1\}$. Let $x = A^{-1} \gamma Q_b^{-2}+t_b(\gamma)$ and $y = A^3 \gamma Q_b^2+t_b(\gamma)$, we have \begin{align*} & X_{1,\epsilon} = \epsilon(x A^{1-2\epsilon}Q_c^{-2\epsilon}+t_c(x)) \\ & X_{-1,-\epsilon} = \epsilon(yA^{1+2\epsilon}Q_c^{2\epsilon}+t_c(y)) \end{align*} $$X_{1,\epsilon} X_{-1,-\epsilon} = A^4 xy +t_c(xy)+A^2(A^{2\epsilon -1} t_c(x)yQ_c^{2\epsilon}+A^{-2\epsilon+1}xt_c(y)Q_c^{-2\epsilon})$$ Notice that the computations done in Lemma \ref{1_cycle_rep} can be repeated (more precisely Equation \ref{pic}) and give \begin{equation} \label{u1} xy = -A^2(A^2Q_b^4+A^{-2} Q_b^{-4}+\delta_b)\end{equation} \begin{equation} \label{u2} t_c(xy) = -A^2(A^2Q_b^4+A^{-2} Q_b^{-4}+t_c(\delta_b)) \end{equation} We compute $A^{2\epsilon -1} t_c(x)yQ_c^{2\epsilon}+A^{-2\epsilon+1}xt_c(y)Q_c^{-2\epsilon} = A^4 z+t_b(z)+A^2 z'$ where $z = A^{2 \epsilon-1}t_c(\gamma) \gamma Q_c^{2\epsilon}+A^{1-2\epsilon}\gamma t_c(\gamma) Q_c^{-2\epsilon}$ and $$z' = A^{2\epsilon} t_c t_b(\gamma) \gamma Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} \gamma t_c t_b(\gamma) Q_b^{-2} Q_c^{-2 \epsilon}+ t_b(\gamma)t_c(\gamma)\Big[A^{2\epsilon-2}Q_b^{-2}Q_c^{2\epsilon}+A^{-2\epsilon+2}Q_b^{2}Q_c^{-2\epsilon}\Big]$$ Hence \begin{equation} \label{u} X_{1,\epsilon} X_{-1,-\epsilon} = A^4xy+t_c(xy) + A^2 (A^4 z+t_b(z)+A^2 z') \end{equation} We compute using skein relations : \begin{equation} \label{u3} z = -A^2 \gamma^2- A^{-2} (t_c(\gamma))^2 -\delta_c +(A^2+A^{-2})+c(A^{2-2\epsilon} Q_c^2+A^{-2+2 \epsilon} Q_c^{-2}) \end{equation} \begin{equation} \label{u4} t_b(z) = -A^2 (t_b(\gamma))^2- A^{-2} (t_bt_c(\gamma))^2 -t_b(\delta_c) +(A^2+A^{-2})+c(A^{2-2\epsilon} Q_c^2+A^{-2+2 \epsilon} Q_c^{-2}) \end{equation} \begin{equation} \label{u5} z' = t_c(\gamma)t_b(\gamma) c b + (a+a')(A^{2\epsilon}Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} Q_b^{-2} Q_c^{-2\epsilon}) +cb (A^{2\epsilon-2}Q_b^2 Q_c^{2\epsilon}+A^{2-2\epsilon}Q_b^{-2} Q_c^{-2\epsilon}) \end{equation} The computation of $ t_c(\gamma) t_b(\gamma) cb$ gives \noindent $ A^4 \gamma^2+A^2(\delta_b+\delta_c)+(b^2+c^2-(A^2+A^{-2})^2+aa'+(t_b(\gamma))^2+(t_c(\gamma))^2)+A^{-2}(t_b(\delta_c)+t_c(\delta_b))+A^{-4}(t_bt_c(\gamma))^2$ Combining (\ref{u1}),(\ref{u2}),(\ref{u3}),(\ref{u4}),(\ref{u5}) in (\ref{u}) we get $$X_{1,\epsilon} X_{-1,-\epsilon} = A^4(A^{2\epsilon}Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} Q_b^{-2} Q_c^{-2\epsilon}+a)(A^{2\epsilon}Q_b^2 Q_c^{2\epsilon}+A^{-2\epsilon} Q_b^{-2} Q_c^{-2\epsilon}+a')$$ Let us prove (d). By (c) it is enough to prove that $$\tilde{\rho}(E_b E_c) \tilde{\rho}(E_b E_c^{-1}) = \tilde{\rho}(E_b E_c^{-1}) \tilde{\rho}(E_b E_c)$$ We have \begin{align*} \tilde{\rho}(E_b E_c) \tilde{\rho}(E_b E_c^{-1}) &= X_{1,1} X_{1,-1} \Big(A^4 U(A^2Q_b^2)U(A^2Q_c^2)U(A^4 Q_b^2) U(Q_c^2) F_{1,-1}\Big)^{-1} \\ \tilde{\rho}(E_b E_c^{-1}) \tilde{\rho}(E_b E_c) &= X_{1,-1} X_{1,1} \Big(A^4 U(A^2Q_b^2)U(A^2Q_c^2)U(A^4 Q_b^2) U(Q_c^2) F_{1,-1}\Big)^{-1} \end{align*} Thus it is enough to prove $X_{1,1}X_{1,-1} = X_{1,-1}X_{1,1}$. This reduces to \begin{align*} & A^4 x^2+t_c(x^2)+Axt_c(x)Q_c^{-2}+A^3t_c(x)xQ_c^{2} = A^4 x^2+t_c(x^2) +A^5xt_c(x)Q_c^{2}+A^{-1}t_c(x)xQ_c^{-2} \\ &\iff Axt_c(x)Q_c^{-2}+A^3t_c(x)xQ_c^{2} = A^5xt_c(x)Q_c^{2}+A^{-1}t_c(x)xQ_c^{-2} \\ & \iff Axt_c(x)(A^2 Q_c^2-A^{-2} Q_c^{-2}) = A^{-1} t_c(x)x(A^2 Q_c^2-A^{-2} Q_c^{-2}) \\ & \iff Axt_c(x) = A^{-1} t_c(x)x\end{align*} The last equivalence is obtained because $U(A^2 Q_c^2)$ is invertible. Let us expand $Axt_c(x) - A^{-1} t_c(x)x$ remembering that $Q_b x = A x Q_b$ and prove it is zero : \begin{align*} & Axt_c(x) - A^{-1} t_c(x)x = A^{-4}\Big[A\gamma t_c(\gamma)-A^{-1}t_c(\gamma) \gamma \Big]Q_b^{-4} + \\ & A^{-2}\Big[\gamma t_c(\gamma)-t_c(\gamma) \gamma +(A^2-A^{-2})t_b(\gamma)t_c(\gamma)\Big]Q_b^{-2} + t_b\Big(A \gamma t_c(\gamma)-A^{-1} t_c(\gamma) \gamma \Big) \end{align*} Expanding $\gamma t_c(\gamma)$ and $t_c(\gamma) \gamma$ using skein relations, this expression reduces to \begin{align*} & (A^2-A^{-2}) (A^{-4}cQ_b^{-4}+A^{-2}bc Q_b^{-2} +c) \\ & = (A^2-A^{-2})\Big[c(A^2 Q_b^2+A^{-2} Q_b^{-2})+bc \Big] Q_b^{-2} A^{-2} \\ & = (A^2-A^{-2})\Big[-cb+bc \Big] Q_b^{-2} A^{-2} \\ & = 0 \end{align*} \end{proof} \subsection{Action of the square of a separating edge shift} \label{subs4} Let $\gamma$ be a separating edge curve as shown in Figure \ref{fig_cycle} (c). Again inspired by Equations (\ref{sep_lift1}) and (\ref{sep_lift2}) let \begin{align*} \tilde{\rho}(E_c^2) & = -\tilde{\rho} \left[\Big(\gamma Q_c^{-2} + \tau - \dfrac{A^{-2} \delta_1 Q_c^{-2}-A^2 \delta_2}{U(A^4 Q_c^2)}\Big)A^{-2} U(A^2 Q_c^2)^{-1} G_2^{-1} \right] \\ \tilde{\rho}(E_c^{-2}) & = \tilde{\rho} \left[\Big(\gamma A^2 Q_c^2 + A^{-2} \tau + \dfrac{ \delta_1 Q_c^2-\delta_2}{U(Q_c^2)} \Big) U(A^2 Q_c^2)^{-1} G_{-2}^{-1} \right] \end{align*} \begin{lemma} \label{sep_rep}The following statements hold : \begin{enumerate} \item[(a)] $\tilde{\rho}(Q_c) \tilde{\rho}(E_c^2) = A^2 \tilde{\rho}(E_c^2) \tilde{\rho}(Q_c)$ and $\tilde{\rho}(Q_c) \tilde{\rho}(E_c^{-2}) = A^{-2} \tilde{\rho}(E_c^{-2}) \tilde{\rho}(Q_c)$, \item[(b)] $\tilde{\rho}(E_c^2) \tilde{\rho}(E_c^{-2})= \mathrm{Id}_V$. \item[(c)] $\rho(\gamma) = \tilde{\rho}(E_c^2) \tilde{\rho}(G_2)+ \tilde{\rho}(G_0) + \tilde{\rho}(E_c^{-2}) \tilde{\rho}(G_{-2})$. \end{enumerate} \end{lemma} \begin{proof} (a) Using skein relations we have \begin{align*} c \gamma & = A^{-4} \gamma c + A^{-2}(A^4-A^{-4}) \tau + A^{-2} (A^2-A^{-2}) (d_1 d_3 + d_2 d_4) \\ c \tau & = A^{4} \tau c - A^{2}(A^4-A^{-4}) c - A^{2} (A^2-A^{-2}) (d_1 d_2 + d_3 d_4) \end{align*} Then a computation implies $$c E_c^{\pm 2} = E_c^{\pm 2} (-A^{2 \pm 4} Q_c^2 - A^{-(2 \pm 4)} Q_c^{-2})$$ which implies the desired equalities. (b) Let $Y_2 = \tilde{\rho}(E_c^2) A^{2} U(A^2 Q_c^2)^{1} G_2^{1}$ and $Y_{-2} = \tilde{\rho}(E_c^{-2}) U(A^2 Q_c^2) G_{-2}$. Using (a), we have $\tilde{\rho}(E_c^2) \tilde{\rho}(E_c^{-2}) = Y_2 Y_{-2} \Big( A^2 U(A^{-2} Q_c^2) \hat{G_2} U(A^2 Q_c^2) G_{-2} \Big)^{-1} $ where $$\hat{G_2} = -U(A^{2} Q_{d_1} Q_{d_4} Q_{c}^{-1}) U(A^{2} Q_{d_2} Q_{d_3} Q_{c}^{-1})$$ Let us prove that $Y_2 Y_{-2} = A^2 U(A^{-2} Q_c^2) \hat{G_2} U(A^2 Q_c^2) G_{-2} $. A brute force computation gives \begin{align*} & A^2 U(A^{-2} Q_c^2) \hat{G_2} U(A^2 Q_c^2) G_{-2} \\ & = -A^2 \Big(-T^4+\delta_3 T^3 +(8-\Delta) T^2+(\delta_1 \delta_2-4 \delta_3) T + (4\Delta -16 - \delta_1^2 - \delta_2^2) \Big) U(Q_c^2)^{-2} \end{align*} where $\Delta = d_1^2+d_2^2+d_3^2+d_4^2+d_1d_2d_3d_4$ and $T = Q_c^2+Q_c^{-2}$. (Note that this egality is equivalent to an equality of two Laurent polynomials in $A$ and the variables $Q_e,$ hence can be checked using Sage for example). Therefore it is enough to prove that $$-Y_2 Y_ {-2} = A^2 \Big(-T^4+\delta_3 T^3 +(8-\Delta) T^2+(\delta_1 \delta_2-4 \delta_3) T + (4\Delta -16 - \delta_1^2 - \delta_2^2) \Big) U(Q_c^2)^{-2}$$ Let us prove this : \begin{align*} & -Y_2 Y_ {-2} = \left(\gamma Q_c^{-2} + \tau - \dfrac{A^{-2} \delta_1 Q_c^{-2}-A^2 \delta_2}{U(A^4 Q_c^2)}\right) \left(\gamma A^2 Q_c^2 + A^{-2} \tau + \dfrac{ \delta_1 Q_c^2-\delta_2}{U(Q_c^2)}\right) \\ & = A^6 \gamma^2 + A^2 \gamma \tau Q_c^{-2} +A^4 \gamma \delta_1 U(Q_c^2)^{-1} - A^4 \gamma \delta_2 Q_c^{-2} U(Q_c^2)^{-1} \\ & + A^2 \tau \gamma Q_c^2+A^{-2} \tau^2 + \tau \delta_1 Q_c^2 U(Q_c^2)^{-1}-\tau \delta_2 U(Q_c^2)^{-1}\\ & -A^4 \delta_1 \gamma U(Q_c^2)^{-1}-\delta_1 \tau Q_c^{-2} U(Q_c^2)^{-1}-A^2 \delta_1^2 U(Q_c^2)^{-2}+ A^2 \delta_1 \delta_1 Q_c^{-2} U(Q_c^2)^{-2} \\ & +A^4 \delta_2 \gamma Q_c^2+\delta_2 \tau U(Q_c^2)^{-1} + A^2 \delta_1 \delta_2 Q_c^2 U(Q_c^2)^{-2}- A^2 \delta_2^2 U(Q_c^2)^{-2}\\ & = A^4 \delta_2 \gamma + \tau \delta_1 + \big[A^2 \delta_1 \delta_2 (Q_c^2+Q_c^{-2})-A^2(\delta_1^2+\delta_2^2)\big]U(Q_c^2)^{-2} \\ & + A^6 \gamma^2+A^2(\gamma \tau Q_c^{-2}+\tau \gamma Q_c^2)+A^{-2} \tau^2 \end{align*} The term $\gamma \tau$ can reduced using skein relations to $A^2 c + \delta_3+A^{-2} \varphi$, where $\delta_3 = d_1 d_4+d_2 d_3$ and $\varphi$ is $$\includegraphics[scale = 0.3]{phi}$$ Hence $\gamma \tau Q_c^{-2}+\tau \gamma Q_c^2 =(A^{-2} Q_c^2+A^2 Q_c^{-2})c+ \delta_3(Q_c^2+Q_c^{-2})-\varphi c $. The expansion of $\varphi c$ gives $$\varphi c = \Delta -(A^2+A^{-2})^2+A^4 \gamma^2+A^2 \delta_2 \gamma+A^{-2} \delta_1 \tau+A^{-4} \tau^2$$ we recall that $\Delta = d_1^2+d_2^2+d_3^2+d_4^2+d_1d_2d_3d_4$. Now plugging this back to the expression of $-Y_2Y_{-2},$ we get after simplifications \begin{align*} & -Y_2 Y_ {-2} = \left(\gamma Q_c^{-2} + \tau - \dfrac{A^{-2} \delta_1 Q_c^{-2}-A^2 \delta_2}{U(A^4 Q_c^2)}\right) \left(\gamma A^2 Q_c^2 + A^{-2} \tau + \dfrac{ \delta_1 Q_c^2-\delta_2}{U(Q_c^2)}\right) \\ & = A^2 \Big( \delta_1 \delta_2 (Q_c^2+Q_c^{-2})U(Q_c^2)^{-2} - (\delta_1^2+\delta_2^2) U(Q_c^2)^{-2} + \delta_3 (Q_c^2+Q_c^{-2}) - \Delta - U(Q_c^2)^2\Big) \\ & = A^2 \Big( \delta_1 \delta_2 (Q_c^2+Q_c^{-2}) - (\delta_1^2+\delta_2^2) + \delta_3 (Q_c^2+Q_c^{-2})U(Q_c^2)^{2} - \Delta U(Q_c^2)^{2} - U(Q_c^2)^{4} \Big)U(Q_c^2)^{-2} \\ & = A^2 \Big(-T^4+\delta_3 T^3 +(8-\Delta) T^2+(\delta_1 \delta_2-4 \delta_3) T + (4\Delta -16 - \delta_1^2 - \delta_2^2) \Big) U(Q_c^2)^{-2} \end{align*} where we recall that $T = Q_c^2+Q_c^{-2}.$ The last equality is obtained from the identity $U(Q_c^2)^2 = T^2-4$. Point (c) is derived from a direct computation. \end{proof} \subsection{Commutation between the square of an edge and a one-cycle}\label{sec:com1cse} Consider the following portion of the graph $$\includegraphics[scale = 0.35]{sous-graphe4}$$ Recall that $\tilde{\rho}(E_c^2) = \tilde{\rho} \left[Y_2 A^{-2} U(A^2 Q_c^2)^{-1} G_2^{-1} \right]$ where $G_2 = -U(Q_{e}^2 Q_{c}^{-1}) U(Q_{d_2} Q_{d_3} Q_{c}^{-1})$ and where $$-Y_2 = \gamma Q_c^{-2} + \tau - \dfrac{A^{-2} \delta_1 Q_c^{-2}-A^2 \delta_2}{U(A^4 Q_c^2)}$$ with $\delta_1 = e d_3+e d_2 $, $\delta_2 = e d_2+e d_3 $ and $\tau$ being the following curve : $$\includegraphics[scale = 0.35]{tau-sous-graphe4}$$ Recall also that $\tilde{\rho}(E_e) = -\tilde{\rho} \left[\Big(t_{e}(\beta)+A^{-1}\beta Q_e^{-2}\Big)A^{-1} U(A^2 Q_e^2)^{-1} \right]$ \begin{lemma} \label{com1cse} $\tilde{\rho}(E_e) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_e)$. \end{lemma} \begin{proof} Let us first simplify the expression of $\tilde{\rho}(E_c^2)$. A computation shows that $$\tilde{\rho}(E_c^2) = - \left[\Big(\gamma-t_c(\gamma)+(\bar{\tau}-\tau) Q_c^{-2}\Big)A^{-2} U(A^4 Q_c^2)^{-1} U(A^2 Q_c^2)^{-1} G_2^{-1} \right]$$ where $\bar{\tau}=t_c^{-1}(\tau)$ is the following curve $$\includegraphics[scale = 0.35]{tau-bar-sous-graphe4}$$ Let us define $Y_2' = \gamma-t_c(\gamma)+(\bar{\tau}-\tau) Q_c^{-2}$, $\varphi = \gamma-t_c(\gamma)$ and $\psi = \bar{\tau}-\tau$. Using $A$-commutation we see that $\tilde{\rho}(E_e) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_e)$ is equivalent to \begin{equation} \label{eq11} X_1 Y_2'(A^2 Q_e^2 Q_c^{-1}-A^{-2} Q_e^{-2}Q_c) = Y_2' X_1 (Q_e^2 Q_c^{-1}-Q_e^{-2} Q_c) \end{equation} where $X_1=t_{e}(\beta)+A^{-1}\beta Q_e^{-2}$. For two elements $x,y$ we define $[x,y]_A = Axy-A^{-1}yx$. Proving Equality $(\ref{eq11})$ is equivalent to prove that $$\Big( A[X_1,Y_2']_A Q_e^2 +A^{-1} [Y_2',X_1]_AQ_e^{-2} Q_c^2 \Big) Q_c^{-1} = 0$$ Now let us expand the expression $\mathcal{E} = A[X_1,Y_2']_A Q_e^2 +A^{-1} [Y_2',X_1]_AQ_e^{-2} Q_c^2 $ using the fact that $X_1$ commutes with $Q_c$ and $Y_2'$ commutes with $Q_e$ : \begin{align*} & A[X_1,Y_2']_A Q_e^2 +A^{-1} [Y_2',X_1]_AQ_e^{-2} Q_c^2 \\ &= A\Big( [t_e(\beta),\varphi]_A+[t_e(\beta),\psi]_AQ_c^{-2}+A^{-1}[\beta,\varphi]_A Q_e^{-2} +A^{-1}[\beta,\psi]_A Q_c^{-2} Q_e^{-2} \Big) Q_e^2 \\ &+A^{-1}\Big([\varphi,t_e(\beta)]_A+A^{-1}[\varphi,\beta]_A Q_e^{-2}+[\psi,t_e(\beta)]_A Q_c^{-2} +A^{-1}[\psi,\beta]_A Q_c^{-2} Q_e^{-2} \Big)Q_e^{-2} Q_c^2 \\ &=A\Big( [t_e(\beta),\varphi]_A Q_e^2+[t_e(\beta),\psi]_AQ_c^{-2}Q_e^2+A^{-1}[\beta,\varphi]_A +A^{-1}[\beta,\psi]_A Q_c^{-2} \Big) \\ &+A^{-1}\Big([\varphi,t_e(\beta)]_A Q_e^{-2} Q_c^2+A^{-1}[\varphi,\beta]_A Q_e^{-4} Q_c^2+[\psi,t_e(\beta)]_A Q_e^{-2} +A^{-1}[\psi,\beta]_A Q_e^{-4} \Big) \\ \end{align*} Using that $Q_e^{-2} = -A^2 e -A^4 Q_e^2$, $Q_c^{-2} = -A^2 c -A^4 Q_c^2$ and $Q_e^{-4} = A^4 e^2+A^6 e Q_e^2-A^4$ we get $$\mathcal{E} = C_1 Q_c^2 Q_e^2+C_2 Q_e^2+C_3 Q_c^2+C_4$$ where \begin{align*} C_1 & = -A^5[t_e(\beta),\psi]_A-A^3[\varphi,t_e(\beta)]_A+A^4[\varphi,\beta]_Ae \\ C_2 & = A[t_e(\beta),\varphi]_A-A^3[t_e(\beta),\psi]_Ac-A^3[\psi,t_e(\beta)]_A+A^4[\psi,\beta]_Ae \\ C_3 & = -A^4[\beta,\psi]_A-A[\varphi,t_e(\beta)]_Ae+A^2[\varphi,\beta]_Ae^2-A^2[\varphi,\beta]_A \\ C_4 & = [\beta,\varphi]_A-A^2[\beta,\psi]_Ac-A[\psi,t_e(\beta)]_Ae+A^2[\psi,\beta]_Ae^2-A^2[\psi,\beta]_A \end{align*} The elements $C_1,C_2,C_3$ and $C_4$ are skein elements that can be computed using skein relations. After a straightforward computation we get $C_1=C_2=C_3=C_4=0$ which concludes that $\mathcal{E} = 0$. Some more details on those computations are given in the appendix. \end{proof} \subsection{Commutation between the square of an edge and a two-cycle}\label{sec:com2cse} Consider the following portion of the graph $$\includegraphics[scale = 0.35]{sous-graphe5}$$ Using the proof of Lemma \ref{com1cse} we have $$\tilde{\rho}(E_c^2) = - \tilde{\rho} \left[Y_2'A^{-2} U(A^4 Q_c^2)^{-1} U(A^2 Q_c^2)^{-1} G_2^{-1} \right]$$ with $Y_2' = \gamma-t_c(\gamma)+(\bar{\tau}-\tau) Q_c^{-2}$. Recall also that we set $\varphi = \gamma-t_c(\gamma)$ and $\psi = \bar{\tau}-\tau$. For the two-cycle $\beta$ we have \begin{align*} &\tilde{\rho}(E_{d_1} E_{d_4}) = \tilde{\rho}\left[ \Big( \beta A^{-2} Q_{d_1}^{-2} Q_{d_4}^{-2}+ t_{d_1}(\beta) A^{-1} Q_{d_4}^{-2} + t_{d_4}(\beta) A^{-1} Q_{d_1}^{-2} +t_{d_1} t_{d_4}(\beta) \Big) D^{-1} \right]\\ &\tilde{\rho}(E_{d_1} E_{d_4}^{-1}) \tilde{\rho}(F_{1,-1}) = \tilde{\rho}\left[ -\Big( \beta A^{2} Q_{d_1}^{-2} Q_{d_4}^{2}+ t_{d_1}(\beta) A^{3} Q_{d_4}^{2} + t_{d_4}(\beta) A^{-1} Q_{d_1}^{-2} +t_{d_1} t_{d_4}(\beta) \Big) D^{-1}\right] \end{align*} where $D = A^2 U(A^2 Q_{d_1}^2) U(A^2 Q_{d_4}^2)$ and $F_{1,-1} = -\dfrac{U(Q_{a'} Q_{d_4} Q_{d_1}^{-1}) U(Q_{c} Q_{d_4} Q_{d_1}^{-1})}{U(A^2 Q_{d_4}^2)U(Q_{d_4}^2)}$. \begin{lemma} \label{com2cse} The following statements hold : \begin{enumerate} \item[(a)] $\tilde{\rho}(E_{d_1} E_{d_4}) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_{d_1} E_{d_4})$, \item[(b)] $\tilde{\rho}(E_{d_1} E_{d_4}^{-1}) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_{d_1} E_{d_4}^{-1})$. \end{enumerate} \end{lemma} \begin{proof} To make the notation less cluttered, we write $Q_4$ for $Q_{d_4}$ and $Q_1$ for $Q_{d_1}$. Let us prove (a). First let us set $X = A^{-1} \beta Q_{1}^{-2}+t_{d_1}(\beta)$ so that $$\tilde{\rho}(E_{d_1} E_{d_4}) = \Big( A^{-1} X Q_{4}^{-2} + t_{d_4}(X) \Big) D^{-1} $$ Using known commutation relations we have that $\tilde{\rho}(E_{d_1} E_{d_4}) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_{d_1} E_{d_4})$ is equivalent to $$\mathcal{E} = A^{-1}\Big(A[X,Y_2']_AQ_1^{2}Q_4^2+A^{-1}[Y_2',X]Q_c^2\Big)Q_4^{-2} +t_{d_4}\Big(A[X,Y_2']_AQ_1^{2}Q_4^2+A^{-1}[Y_2',X]Q_c^2\Big)=0$$ If we set $\mathcal{U} = A[X,Y_2']_AQ_1^{2}Q_4^2+A^{-1}[Y_2',X]Q_c^2$, the expression of $\mathcal{E}$ is simply $A^{-1} \mathcal{U} Q_{4}^{-2} + t_{d_4}(\mathcal{U})$. Let us first compute $\mathcal{U}$ by expanding the expression and remembering that $Q_{1}^{-2} = -A^{4} Q_{1}^2-A^2 d_1$ and $Q_{c}^{-2} = -A^{4} Q_{c}^2-A^2 c$ : \begin{align*} & \mathcal{U} = A[X,Y_2']_AQ_1^{2}Q_4^2+A^{-1}[Y_2',X]Q_c^2 \\ & = -A^5 [t_{d_1}(\beta),\psi]_A Q_c^2 Q_1^2 Q_4^2 \\ & - \Big( A^3 [t_{d_1}(\beta),\psi]_A c +A[t_{d_1}(\beta),\varphi]_A \Big)Q_1^2 Q_4^2 -A^4[\beta,\psi]_A Q_c^2 Q_4^2 - A^2 [\varphi,\beta]_A Q_1^2 Q_c^2 \\ & +\Big( [\beta,\varphi]_A - A^2 [\beta,\psi]_A c\Big) Q_4^2 -A^2[\psi,\beta]_A Q_1^2 + \Big(A^{-1}[\varphi,t_{d_1}(\beta)]_A-[\varphi,\beta]_A d_1 \Big)Q_c^2 \\ & +\Big(A^{-1}[\psi,t_{d_1}(\beta)]_A-[\psi,\beta]_A d_1\Big) \end{align*} Using the same technique we get $$ A^{-1} \mathcal{U} Q_4^{-2} +t_{d_4}(\mathcal{U}) = \sum_{\epsilon_1,\epsilon_2,\epsilon_3 = 0,1} C_{\epsilon_1,\epsilon_2,\epsilon_3} Q_1^{2 \epsilon_1} Q_4^{ 2 \epsilon_2} Q_c^{2 \epsilon_3} $$ where \begin{align*} C_{1,1,1} &= -A^5 [t_{d_4}t_{d_1}(\beta),\psi]_A+A^5[\varphi,\beta]_A \\ C_{1,1,0} &= A^5 [\psi,\beta]_A-A^3[t_{d_4}t_{d_1}(\beta),\psi]_Ac+A[t_{d_4}t_{d_1}(\beta),\varphi]_A \\ C_{1,0,1} &= -A^2[\varphi,t_{d_4}(\beta)]_A+A^3[\varphi,\beta]_Ad_4-A^4 [t_{d_1}(\beta),\psi]_A \\ C_{0,1,1} &= -A^2 [\varphi,t_{d_1}(\beta)]_A+A^3[\varphi,\beta]_A d_1-A^4 [t_{d_4}(\beta),\psi]_A \\ C_{0,0,1} &= -A^3[\beta,\psi]_A-[\varphi,t_{d_1}(\beta)]_A d_4+A [\varphi,\beta]_A d_1 d_4+A^{-1}[\varphi,t_{d_4}t_{d_1}(\beta)]_A-[\varphi,t_{d_4}(\beta)]_A d_1 \\ C_{0,1,0} &= A^3[\psi,\beta]_A d_1+[t_{d_4}(\beta),\varphi]_A-A^2[t_{d_4}(\beta),\psi]_A c-A^2 [\psi,t_{d_1}(\beta)]_A \\ C_{1,0,0} &= -A^2[t_{d_1}(\beta),\psi]_A c+[t_{d_1}(\beta),\varphi]_A-A^2[\psi,t_{d_4}(\beta)]_A+A^3[\psi,\beta]_A d_4 \\ C_{0,0,0} &= -[\psi,t_{d_4}(\beta)]_A d_1+ A^{-1}[\psi,t_{d_4}t_{d_1}(\beta)]_A+A^{-1} [\beta,\varphi]_A \\ & -A [\beta,\psi]_Ac+A [\psi,\beta]_A d_1 d_4-[\psi,t_{d_1}(\beta)]_A d_4 \end{align*} Here again, these elements are in the skein algebra of the surface hence can be computed using skein relations. A long but straightforward computation shows that $C_{\epsilon_1,\epsilon_2,\epsilon_3} = 0$ for all $\epsilon_1,\epsilon_2,\epsilon_3 \in \{0,1\}$. We refer to the appendix for more details. Thus $\mathcal{E} = A^{-1} \mathcal{U} Q_4^{-2} +t_{d_4}(\mathcal{U}) = 0$. Let us prove (b). The proof goes as in (a) and we use the same notations. In this case $\tilde{\rho}(E_{d_1} E_{d_4}^{-1}) \tilde{\rho}(E_c^2) = \tilde{\rho}(E_c^2) \tilde{\rho}(E_{d_1} E_{d_4}^{-1})$ is equivalent to $$\mathcal{E} = A^{3}\Big(A[Y_2',X]_A Q_c^{2}Q_4^2+A^{-1}[X,Y_2']Q_1^2\Big)Q_4^{2} +t_{d_4}\Big(A[Y_2',X]_A Q_c^{2}Q_4^2+A^{-1}[X,Y_2']Q_1^2\Big)=0$$ Expanding this expression using $Q_{1}^{-2} = -A^{4} Q_{1}^2-A^2 d_1$, $Q_{c}^{-2} = -A^{4} Q_{c}^2-A^2 c$ and $Q_4^4 = -A^{-2} Q_4^2 d_4-A^{-4}$ we get : $$ \mathcal{E} = \sum_{\epsilon_1,\epsilon_2,\epsilon_3 = 0,1} D_{\epsilon_1,\epsilon_2,\epsilon_3} Q_1^{2 \epsilon_1} Q_4^{ 2 \epsilon_2} Q_c^{2 \epsilon_3} $$ where \begin{align*} D_{1,1,1} &= A^5 [\varphi,\beta]_A d_4-A^6[t_{d_1}(\beta),\psi]_A-A^4[\varphi,t_{d_4}(\beta)]_A \\ D_{1,1,0} &= A^5 [\psi,\beta]_A d_4 +A^2[t_{d_1}(\beta),\varphi]_A-A^4[t_{d_1}(\beta),\psi]_Ac-A^4[\psi,t_{d_4}(\beta)]_A \\ D_{1,0,1} &= A^3[\varphi,\beta]_A-A^3[t_{d_1}t_{d_4}(\beta),\psi]_A \\ D_{0,1,1} &= -A^2 [\varphi,t_{d_1}(\beta)]_A d_4+A^3[\varphi,\beta]_A d_1 d_4 -A^5 [\beta,\psi]_A +A[\varphi,t_{d_4}t_{d_1}(\beta)]_A -A^2[\varphi,t_{d_4}(\beta)]_A d_1 \\ D_{0,0,1} &= -[\varphi,t_{d_1}(\beta)]_A+A [\varphi,\beta]_A d_1-A^2 [t_{d_4}(\beta),\psi]_A \\ D_{0,1,0} &= -A^2[\psi,t_{d_1}(\beta)]_A d_4-A^3[\beta,\psi]_Ac+A[\beta,\varphi]_A +A^3 [\psi,\beta]_A d_1 d_4 \\ &+A[\psi,t_{d_1}t_{d_4}(\beta)]_A-A^2[\psi,t_{d_4}(\beta)]_A d_1 \\ D_{1,0,0} &= A^3[\psi,\beta]_A +A^{-1}[t_{d_1}t_{d_4}(\beta),\varphi]_A-A[t_{d_1}t_{d_4}(\beta),\psi]_A c \\ D_{0,0,0} &= A [\psi,\beta]_A d_1-[\psi,t_{d_1}(\beta)]_A-[t_{d_4}(\beta),\psi]_A c+ A^{-2}[t_{d_4}(\beta),\varphi]_A \end{align*} Notice that $D_{1,1,1}=A^2C_{1,0,1},$ $D_{1,1,0}=A^2C_{1,0,0},$ $D_{1,0,1}=A^{-2}C_{1,1,1},$ $D_{0,1,1}=A^2C_{0,0,1},$ $D_{0,0,1}=A^{-2}C_{0,1,1},$ $D_{0,1,0}=A^2C_{0,0,0},$ $D_{1,0,0}=A^{-2}C_{1,1,0},$ and $D_{0,0,0}=A^{-2}C_{0,1,0}.$ Hence these elements are again all vanishing. \end{proof} \subsection{Proof of Theorem \ref{thm:lift_rep}} \label{proof_lift_rep} Lemma \ref{gen_t} gives us a list of generators for $\mathcal{A}_A(\Gamma)^0$. Subsections \ref{subs1}, \ref{subs2}, \ref{subs3} and \ref{subs4}, define $\tilde{\rho}$ on these generators. Lemmas \ref{1_cycle_rep} (a) (b), \ref{2_cycle_rep} (a) (b) (c) (d), \ref{sep_rep} (a) (b), \ref{com1cse}, \ref{com2cse} insure that $\tilde{\rho}$ preserve the relations between the generators and therefore defines a representation $\tilde{\rho} : \mathcal{A}_A(\Gamma)^0 \to \mathrm{End}(V)$. Now Lemmas \ref{1_cycle_rep} (c), \ref{2_cycle_rep} (e), \ref{sep_rep} (c) and Equation \ref{Q} tell us that $\tilde{\rho} \circ \sigma_A$ coincide with $\rho$ on $\mathcal{P} \cup \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$. As $A$ is a $2p$-th primitive root of unity with $p \ge 3$, $\mathcal{P} \cup \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$ generate $S_A(\Sigma)$ by \cite[Thm 1.1]{San} and hence $\tilde{\rho} \circ \sigma_A=\rho$. \subsection{Classical shadow} \label{classical_shadow} We still work with an irreducible representation $\rho : S_A(\Sigma) \to \mathrm{End}(V)$ with classical shadow $r$ satisfying the hypothesis of Theorem \ref{thm:lift_rep}. Let $\tilde{\rho} : \mathcal{A}_A(\Gamma)^0 \to \mathrm{End}(V)$ be the lift of $\rho$ built in the previous subsections. For $\gamma$ a simple a closed curve on $\Sigma$, let $r_{\gamma} = - \mathrm{Tr}(r(\gamma))$. \begin{proposition} \label{cshadow} Let $\gamma \in \{\beta_1,\ldots,\beta_g,\gamma_1,\ldots,\gamma_{g-1}\}$. \begin{enumerate} \item[(a)] If $\gamma$ is a one-cycle as in Figure \ref{fig_cycle} (a), then $\tilde{\rho}(Q_e^{2p}) = x_{e}^{2p} \mathrm{Id}_V$ and $$\tilde{\rho}(E_e^p) = \dfrac{r_{\gamma} x_{e}^{-2p} + r_{t_{e}(\gamma)}}{x_{e}^{2p} - x_{e}^{-2p}} \mathrm{Id}_V$$ \item[(b)] If $\gamma$ is a two-cycle as in Figure \ref{fig_cycle} (b), then $\tilde{\rho}((Q_b Q_c^{ \pm 1})^p) = x_b^p x_{c}^{\pm p} \mathrm{Id}_V$, $$\tilde{\rho}((E_b E_c)^p) = \dfrac{r_{\gamma} x_b^{-2p} x_c^{-2p}- r_{t_b(\gamma)} x_c^{-2p}-r_{t_c(\gamma)} x_b^{-2p}+ r_{t_bt_c(\gamma)}}{(x_b^{2p}-x_b^{-2p})(x_c^{2p}-x_c^{-2p})} \mathrm{Id}_V$$ and $$\tilde{\rho}((E_b E_c^{-1})^p)= \dfrac{-r_{\gamma} x_b^{-2p} x_c^{2p}+ r_{t_b(\gamma)} x_c^{2p}+r_{t_c(\gamma)} x_b^{-2p}- r_{t_bt_c(\gamma)}}{(x_b^{2p}-x_b^{-2p})(x_c^{2p}-x_c^{-2p}) \omega} \mathrm{Id}_V$$ where $$\omega = -\prod_{k=0}^{p-1} \dfrac{U\big( (-A)^k x_{a'} x_c x_b^{-1} \big)U\big( (-A)^k x_{a} x_c x_b^{-1} \big)}{U\big( (-A)^k x_c^2 \big)^2}$$ \item[(c)] If $\gamma$ is a separating edge curve as in Figure \ref{fig_cycle} (c), $\tilde{\rho}(Q_c^p) = x_c^p \mathrm{Id}_V$ and $$\tilde{\rho}(E_c^{2p}) = \dfrac{r_{t_c^{-1}(\gamma)} x_c^{-2p} + r_{\gamma} r_c +r_{t_c(\gamma)} x_c^{2p}}{(x_c^{2p}-x^{-2p})^2 r_c \omega'} \mathrm{Id}_V$$ where $\omega' = \prod_{k=0}^{p-1} U\big((-A)^{k} x_{d_1} x_{d_4} x_{c}^{-1}\big) U\big((-A)^{k} x_{d_2} x_{d_3} x_{c}^{-1}\big)$. \end{enumerate} \end{proposition} \begin{proof} Before starting the proof, let us recall some important facts from Lemma \ref{1_cycle_rep}. Given $e$ an edge, we can decompose $V$ as the direct sum of the subspaces $V_{e,k} = \mathrm{Ker}\Big(\rho(e)+(x_{e}^2 A^{2k+2} + x_{e}^{-2} A^{-2k-2}) \mathrm{Id}_V \Big).$ Moreover, each $V_{e,k}$ is stable by all operators $\tilde{\rho}(Q_e)$ and $\tilde{\rho}(E_f), \tilde{\rho}(Q_f)$ with $f\neq e,$ and finally we have $\tilde{\rho}(E_e)(V_{e,k})\subset V_{e,k+1}.$ When computing $T_p(\gamma)$ for $\gamma$ a curve on $\Sigma$ and where $T_p$ is the $p$-th Chebychev polynomial, since we know that $T_p(\gamma)$ is a multiple of $id_V,$ it is sufficient to compute the "diagonal part" of $T_p(\gamma),$ i.e. the contribution that corresponds to maps $V_{e,k}\longrightarrow V_{e,k},$ since the non-diagonal parts will vanish. (a) $\tilde{\rho}(Q_e^{2p}) = x_{e}^{2p} \mathrm{Id}_V$ is immediate from the definition of $\tilde{\rho}(Q_e)$. Let us compute $\tilde{\rho}(E_e^{p})$, notice that taking the $p$-th Chebyshev in the equality $\rho(\gamma) = \tilde{\rho}(E_e) + \tilde{\rho}(E_e^{-1}) \tilde{\rho}(F)$ we have $$T_p(\rho(\gamma)) = \tilde{\rho}(E_e^p) + \tilde{\rho}((E_e^{-1}F)^p)$$ Similarly $\rho(t_e(\gamma)) = -A^3 \tilde{\rho}(E_e) \tilde{\rho}( Q_e^2) - A^{-1} \tilde{\rho}(E_e^{-1} F) \tilde{\rho}(Q_e^{-2}) $ gives $T_p(\rho(t_e(\gamma))) = -\tilde{\rho}(E_e^p) \tilde{\rho}( Q_e^{2p}) - \tilde{\rho}((E_e^{-1} F)^p) \tilde{\rho}(Q_e^{-2p})$. We thus have the following system $$\left\{ \begin{array}{llll} r_{\gamma} \mathrm{Id}_V & = \tilde{\rho}(E_e^p) + \tilde{\rho}((E_e^{-1}F)^p) \\ r_{t_e(\gamma)} \mathrm{Id}_V & = -\tilde{\rho}(E_e^p) x_e^{2p} - \tilde{\rho}((E_e^{-1} F)^p) x_e^{-2p} \end{array} \right. $$ The conclusion is obtained by solving this system. (b) $\tilde{\rho}(Q_b Q_c^{ \pm 1}) = x_b^p x_{c}^{ \pm p} \mathrm{Id}_V$ is immediate. For the other part, it is very similar to (a). This time we start from the system : $$\left\{ \begin{array}{llll} \sigma(\gamma) & = X_{1,1} + X_{1,-1} + X_{-1,1} + X_{-1,-1} \\ \sigma(t_b(\gamma)) & = -A^3 X_{1,1} Q_b^2 - A^3 X_{1,-1} Q_b^2 - A^{-1} X_{-1,1} Q_b^{-2} - A^{-1} X_{-1,-1} Q_b^{-2} \\ \sigma(t_c(\gamma)) & = -A^3 X_{1,1} Q_c^2 - A^{-1} X_{1,-1} Q_c^{-2} - A^{3} X_{-1,1} Q_c^{2} - A^{-1} X_{-1,-1} Q_c^{-2} \\ \sigma(t_bt_c(\gamma)) & = A^6 X_{1,1} Q_b^2 Q_c^2 + A^2 X_{1,-1} Q_b^2 Q_c^{-2} + A^2 X_{-1,1}Q_b^{-2} Q_c^2 + A^{-2} X_{-1,-1} Q_b^{-2} Q_c^{-2} \end{array} \right. $$ where $X_{\epsilon_1,\epsilon_2} = E_b^{\epsilon_1} E_c^{\epsilon_2} F_{\epsilon_1,\epsilon_2}$ with $F_{1,1} = 1$. Applying $\tilde{\rho}$ and taking the $p$-th Chebyshev polynomial for these four equalities, one gets : $$\left\{ \begin{array}{llll} r_{\gamma} & = X_{1,1}^p + X_{1,-1}^p + X_{-1,1}^p + X_{-1,-1}^p \\ r_{t_b(\gamma)} & = X_{1,1}^p x_b^{2p} + X_{1,-1}^p x_b^{2p} + X_{-1,1}^p x_b^{-2p} + X_{-1,-1}^p x_b^{-2p} \\ r_{t_c(\gamma)} & = X_{1,1}^p x_c^{2p} + X_{1,-1}^p x_c^{-2p} + X_{-1,1}^p x_c^{2p} + X_{-1,-1}^p x_c^{-2p} \\ r_{t_bt_c(\gamma)} & = X_{1,1}^p x_b^{2p} x_c^{2p} + X_{1,-1}^p x_b^{2p} x_c^{-2p} + X_{-1,1}^p x_b^{-2p} x_c^{2p} + X_{-1,-1}^p x_b^{-2p} x_c^{-2p} \end{array} \right. $$ In this system, $X_{\pm 1, \pm 1}$ has to be understood as $\tilde{\rho}(X_{\pm 1, \pm 1})$. As $X_{1,1}^p = \tilde{\rho}((E_b E_c)^p)$, the desired expression is immediate by solving the system. For $\tilde{\rho}((E_b E_c^{-1})^p)$, the resolution of the system gives $$X_{1,-1}^p = \tilde{\rho}((E_b E_c^{-1} F_{1,-1})^p) = \dfrac{-r_{\gamma} x_b^{-2p} x_c^{2p}+ r_{t_b(\gamma)} x_c^{2p}+r_{t_c(\gamma)} x_b^{-2p}- r_{t_bt_c(\gamma)}}{(x_b^{2p}-x_b^{-2p})(x_c^{2p}-x_c^{-2p})} \mathrm{Id}_V$$ Now from Lemma \ref{2_cycle_rep} (a),(b) and the fact that $\tilde{\rho}(Q_a)$, $\tilde{\rho}(Q_{a'})$ commute with $\tilde{\rho}(E_b E_c^{-1})$ we get $$\tilde{\rho}((E_b E_c^{-1} F_{1,-1})^p) = - \tilde{\rho}((E_b E_c^{-1})^p)\prod_{k=0}^{p-1} \dfrac{U(A^{-2k} Q_{a'} Q_c Q_b^{-1}) U(A^{-2k} Q_a Q_c Q_b^{-1})}{U(A^{2-2k} Q_c^2) U(A^{-2k} Q_c^2)}$$ Let $v$ an eigenvector commun to $Q_a,Q_{a'},Q_b,Q_c$, we see that $$\dfrac{U(A^{-2k} Q_{a'} Q_c Q_b^{-1}) U(A^{-2k} Q_a Q_c Q_b^{-1})}{U(A^{2-2k} Q_c^2) U(A^{-2k} Q_c^2)} v = \prod_{k=0}^{p-1} \dfrac{U\big( (-A)^k x_{a'} x_c x_b^{-1} \big)U\big( (-A)^k x_{a} x_c x_b^{-1} \big)}{U\big( (-A)^k x_c^2 \big)^2} v$$ Thus $\tilde{\rho}((E_b E_c^{-1} F_{1,-1})^p) = \tilde{\rho}((E_b E_c^{-1})^p) \omega$ and we can conclude. (c) The equality $\tilde{\rho}(Q_c^p) = x_c^p \mathrm{Id}_V$ is clear. Let us prove the other one. Applying the $p$-th Chebyshev polynomial to $\rho(\gamma)= \tilde{\rho}(E_c^2) \tilde{\rho}(G_2) + \tilde{\rho}(G_0) + \tilde{\rho}(E_c^{-2}) \tilde{\rho}(G_{-2})$ we get $$T_p(\rho(\gamma)) = \tilde{\rho}((E_c^2 G_2)^p)+ H + \tilde{\rho}((E_c^{-2} G_{-2})^p)$$ where $H$ is the degree zero term in $E_c$. We recall that $$\sigma(t_c(\gamma)) = E_c^{2} G_2 A^8 Q_c^4 + G_0+ E_c^{-2}G_{-2} Q_c^{-4}$$ We want to compute $T_p(\rho(t_c(\gamma)))$, to do that let us introduce an algebra automorphism $\tau_c$ on $\mathcal{A}_A(\Gamma)$ by the formulas $\tau_c(Q_f) = Q_f$ for all $f \in \mathcal{E}$, $\tau_c(E_f) = E_f$ for $f \neq c$ and $\tau_c(E_c) = (-A)^3 E_c Q_c^2$. This indeed defines an automorphism of $\mathcal{A}_A(\Gamma)$. Note that we have that $\tau_c(E_c^k) = (-A)^{(k+1)^2-1} E_c^k$ (for $k \in \mathbb{Z}$) and $\sigma(t_c(\gamma)) = \tau_c(\sigma(\gamma))$. We deduce that $$T_p(\rho(t_{c}(\gamma))) = \tilde{\rho}(\tau_c(\sigma(\gamma))) = \tilde{\rho}((E_c^{2}G_2 A^{8} Q_c^{4})^p) + H+ \tilde{\rho}((E_c^{-2} G_{-2} Q_c^{-4} )^p)$$ Similarly $$T_p(\rho(t_c^{-1}(\gamma))) = \tilde{\rho}(\tau_c^{-1}(\sigma(\gamma))) = \tilde{\rho}((E_c^{2}G_2 A^{-8} Q_c^{-4})^p) + H+ \tilde{\rho}((E_c^{-2} G_{-2} Q_c^{4})^p) $$ Now we have $$(E_c^{2}G_2 A^{\pm 8} Q_c^{\pm 4})^p = (E_c^2 G_2)^p x_c^{ \pm 4p} \quad \text{and} \quad (E_c^{-2} G_{-2} Q_c^{\pm 4})^p = (E_c^{-2} G_{-2} )^p x_c^{\pm 4p}$$ We deduce the following system $$\left\{ \begin{array}{llll} T_p(\rho(t_c^{-1}(\gamma))) & = \tilde{\rho}((E_c^{2}G_2)^p) x_c^{-4p} + H+ \tilde{\rho}((E_c^{-2} G_{-2})^p x_c^{4p}) \\ T_p(\rho(\gamma)) & = \tilde{\rho}((E_c^2 G_2)^p)+ H+ \tilde{\rho}((E_c^{-2} G_{-2})^p) \\ T_p(\rho(t_c(\gamma))) & = \tilde{\rho}((E_c^{2} G_2)^p) x_c^{4p} + H+ \tilde{\rho}((E_c^{-2}G_{-2})^p) x_c^{-4p} \end{array} \right. $$ solving this system gives $$\tilde{\rho}((E_c^2 G_2)^p) = \dfrac{T_p(t_c^{-1}(\gamma)) x_c^{-2p} - T_p(\gamma) (x_c^{2p}+x_c^{-2p})+T_p(t_c(\gamma)) x_c^{2p}}{(x_c^{2p}-x^{-2p})^2 (x_c^{2p}+x_c^{-2p})} \mathrm{Id}_V$$ On the other hand, $$\tilde{\rho}((E_c^2 G_2)^p) = -\tilde{\rho}(E_c^{2p}) \prod_{k=0}^{p-1} U((-A)^{k} x_{d_1} x_{d_4} x_{c}^{-1}) U((-A)^{k} x_{d_2} x_{d_3} x_{c}^{-1})$$ \end{proof} \begin{proof}[Proof of Corollary \ref{cor:unicity}] Let $\rho_1$ and $\rho_2$ be two irreducible representations of $S_A(\Sigma)$ with the same classical shadow $r$ satisfying the hypothesis of Theorem \ref{thm:lift_rep}. Let $\tilde{\rho}_1$ and $\tilde{\rho}_2$ the lifts of $\rho_1$ and $\rho_2$ to $\mathcal{A}_A(\Gamma)^0$ built from the previous subsections. We build the lifts $\tilde{\rho}_1$ and $\tilde{\rho}_2$ from the same quantities $\{x_{\alpha} \, , \, \alpha \in \mathcal{P} \}$. Proposition \ref{cshadow} shows that $\tilde{\rho}_1$ and $\tilde{\rho}_2$ have the same scalar values on the $p$-th powers of the non central generators given in Lemma \ref{gen_t}. Finally Proposition \ref{rep_Q_t} allows us to conclude. \end{proof}
\section{Introduction} The topic of photographing the interior and exterior of federal facilities is indeed a touchy one. The Department of Homeland Security in the United States has promulgated Operational Readiness Order HQ-ORO-002-2018 \cite{dhs:op:readiness}, which lays out detailed guidelines and restrictions regarding the photography and videotaping of the interior and exterior of federal buildings. 18 United States Code 795 \cite{18:uscode:75} makes it a crime to photograph military installations without permission. In addition, 18 United States Code 797 \cite{18:uscode:797} makes it a crime to disseminate photographs of military bases without explicit permission. It is evident then that the restriction of photography in sensitive areas is a national security concern. Detailed images of sensitive sites easily accessible in the public domain aid bad actors in planning and executing physical attacks on the sites; yet, the proliferation of cameras with advanced features in hard-to-detect form factors and superior energy efficiency makes it increasingly difficult to enforce the laws and guidelines concerning the photography of such locations. In analyzing the \textbf{Ex}changeable \textbf{i}mage \textbf{f}ile (Exif) format data of a large corpus of image data available for public consumption on the internet, it is self-evident how a large amount of photographic data relates to areas that one might expect to restrict photography. One can easily find several images of sensitive airside areas of airports, military bases, aircraft maintenance facilities, air traffic control facilities, nuclear installations, and power plants. Photography is prohibited in several places and situations mentioned above. Notification of the prohibition is given through explicit notices or even incorporated into local laws. Unfortunately, the enforcement of the rule is mainly dependent on physical observation and prevention of the activity or confiscation of equipment. The proliferation of cameras and recording devices in small-form factors have exacerbated the problem. The increase stems from the difficulty of observing the restricted activity and preventing it from happening physically. As a result, the free dissemination of images of restricted areas poses threats to national security. While existing solutions rely on post-processing to maintain the privacy of the photographed subjects, the main thrust of this work is to propose a geographical bounding boxes-based solution that prevents devices from capturing images when they are located within sensitive geographical areas. When implemented correctly and on a global scale, this solution will help fortify the physical security postures of sites of national security importance. Section 2 presents relevant research that has been published in the past. Section 3 introduces solutions that have been proposed in the past for the same or closely related problems. We also discuss in that section how our solution addresses the shortcomings of those solutions. Section 4 introduces our hypothesis with a few examples of use-cases our solution improves. Section 5 defines some of the terms and concepts used in our hypothesis. Section 6 describes the proposed evaluation that we will undertake and explains the various parameters used to evaluate our solution. Section 7 describes the multiple components of our solution and prototype in detail. Section 8 describes the implementation of our solution prototype in detail and describes the various workflows associated with numerous operations. Section 9 details our experience with evaluating the prototype thoroughly. Section 10 discusses the limitations and potential shortcomings of our proposed solution. Finally, section 11 concludes our work and offers a few extensions to work already been done. \section{Related Research} In their work on exploring privacy and security utilizing internet-connected cameras \cite{valente:junia:keerthi}, Valente et al. [2019] show how attackers can observe encrypted traffic to and from internet-connected cameras to observe the properties of what the camera is actually "seeing" at that time. They also discuss vulnerabilities in specific cameras (and other cameras utilizing the same software or hardware platforms) that attackers may use to invade privacy. This work underscores the premise that it is easy for sensitive photographs to fall into the wrong hands if they are in the public domain. In their work on exploring ways to protect privacy in video graphic data captured by self-driving car cameras \cite{xiong:cai:han:alrawais}, Xiong et al. [2021] propose methods to prevent the invasion of individuals' privacy. They suggest obfuscating the data in post-processing steps while retaining major, essential features. However, since the obfuscation happens during post-processing, there is still a risk of the actual, unprocessed photographic data being leaked. Furthermore, since the significant parts of the data are still retained, this method might not work well to protect the privacy of substantial installations of national security importance, such as military bases and nuclear power plants. In their work discussing various \textbf{I}nternet \textbf{P}rotocol (IP) cameras that store captured data in the cloud \cite{liranzo:hayajneh}, Liranzo, J et al. [2017] describe various vulnerabilities and possible attack vectors that threaten to invade users' privacy by illegally accessing the image and video data captured by these cameras. The authors also preview recommendations on securing the data by employing encryption both in-flight and at rest and generally regulating access to the stored data in the cloud. The risks called out by this work prove that it is not just enough to have a post-processing step to obfuscate sensitive data because the device may be compromised before the obfuscation is completed. In their paper describing a storage system for video data \cite{yu:chen:wu:cai:cui}, J. Yu et al. [2020] describe a low-cost distributed storage system architecture for video data to fend off geo-range attacks. In their work on discussing solutions to privacy concerns in wear-able cameras \cite{hassan:sazonov}, M. A. Hassan et al. [2020] discuss how privacy concerns may creep into the usage of egocentric wearable cameras. They propose using deep learning neural networks to apply image redaction by selective removal to address the privacy concerns of bystanders or other parties. This work also relies on post-processing to attain privacy objectives (high computational costs). The general risk with solutions that propose post-processing to make data unappealing is that the data that has already been collected could fall into the wrong hands before post-processing renders it useless. In their doctoral dissertation \cite{jiayu:phd:2019}, Shu J discusses privacy issues relating to using cameras in a social setting. They describe an architecture whereby users of photo and video cameras are informed of individuals' privacy preferences close to the devices; they also propose a method of visual gestures that allows individuals to make their privacy preferences explicitly known. The method proposed in this dissertation employs tags and visible gestures, but it could prove exhausting to individuals trying to protect their privacy. Furthermore, this method does not address how the confidentiality requirements of installations like military bases and nuclear power plants can be enforced. In their paper addressing privacy concerns in smart cities, \cite{peters:hanvey:veluru:mady:boubekeur:nuseibeh} F. Peters et al. [2018] propose setting up privacy zones in smart cities. The framework makes sure that individuals are aware of privacy factors before sharing their data in these privacy zones and recommends actions that individuals can take to safeguard their privacy. However, the drawback of this solution is that it does not prevent the deliberate exfiltration of sensitive photographic data for unauthorized use. In their paper on exploring solutions to data sharing and privacy \cite{koufogiannis:pappas}, F. Koufogiannis et al. [2016] hypothesize the usage of adding noise to data to preserve users' privacy when they share data. They hypothesize that adding less noise is feasible where there is a high physical concentration of users in a given geographical location and inversely in an area of lower concentration. This paper deals solely with the privacy concerns of sharing location data and does not deal with the risks of misusing sensitive photographs. \section{Other solutions proposed in the past} In this section, we discuss some solutions that have been attempted in the past. We also discuss some shortcomings of these proposals that do not fully address the privacy concerns we are researching. \subsection{Neural networks} Generative Adversarial Networks have been proposed to post-process video data and obfuscate non-essential features in the images to ensure that someone cannot infer the physical location of the self-driving car from the video graphics data. A similar approach has been suggested to remove bystander information potentially invading another person's privacy from egocentric wearable cameras. This solution involves post-processing photographic and video data to remove content following privacy restrictions. As shown in the previous section, the drawback of this approach is that the data is not safe in the interim between collection and completion and post-processing. If post-processing does not replace the original dataset, the risk of the original dataset falling into the wrong hands is perpetually existent. This process is also computationally costly and does not preclude capturing restricted photographs; it only serves to try and prevent the dissemination of these photographs. \subsection{Recommended best practices} \begin{itemize} \item Purchase photo and video equipment only from reputed vendors that have a strong track record of keeping users' privacy at the forefront. \item Users update the software/device firmware regularly and apply all available software security patches. \item Manufacturers to put safeguards against brute force attacks that attempt to guess passwords. \item Implement on-device cryptography to keep data safe. \item Use frameworks that use \textbf{G}lobal \textbf{P}ositioning \textbf{S}ystem (GPS) data to alert users to infer the users' location from shared data. \item Scrub location and other identifying data from Exif before disseminating photographic data. \end{itemize} These recommendations provide a potential path to preventing sensitive photographs and video captured by the devices from being unknowingly shared with other parties. Recommendations also spell out how the privacy of the users of these devices may be protected. However, recommendations are just advisory and do not serve to safeguard the confidentiality of the entities that are being photographed. \subsection{Visual cues} \begin{itemize} \item A beacon-based system alerts individuals close to the device that photo or video information is collected. \item Visual gestures or tags inform the user/device that there are privacy concerns and that the device should cease recording. \end{itemize} These devices are commonly found in places that display hazardous objects that should not be approached. Beacons that warn about prevailing photography restrictions in a given area are mainly advisory and do not have enforcement capabilities, unlike, for example, cell phone jammers. \subsection{Adding noise to shared data} Based on GPS data, determine whether an individual user is in a highly-populated area and add more noise to the shared data. This solution also deals with post-processing photo and video data after being collected. In addition to being computationally expensive, this solution relies on post-processing efficiency to ensure that private data is not leaked to unauthorized consumers. In our study of the literature, the solutions proposed so far fall into two main classifications: \begin{itemize} \item Solutions that are advisory; and \item Solutions that attempt to post-process the data to remove sensitive data. \end{itemize} Solutions that are advisory do not prevent the wilful collection and usage of sensitive photographs. In addition, solutions that propose post-processing techniques to obfuscate all or part of the data suffer from drawbacks in that devices could be compromised, and photographic data stolen before the post-processing step. To overcome the shortcomings identified in either class of solutions discussed above, we propose a solution that prevents photographs of sensitive sites from being captured in the first place. \section{Hypothesis} We propose a solution that prevents photographs of sensitive sites from being captured in the first place. The prevention renders moot the questions around safeguarding the data before post-processing has taken place and whether it may be possible to reconstruct the original data from the post-processed data using advanced techniques. The bedrock of our proposal is a global database of geographical locations. Geographical locations are bounding boxes, defined as an area bounded by two latitudes and two longitudes. The database is treated as an exclude list which means that any bounding box present in this database represents a geographic location in which photography and videotaping are restricted. We are proposing the setup of a database containing a list of geographic bounding boxes representing areas or properties owned by governments (airports, nuclear installations, military bases, power plants, etc.). Governments or other authorities that designate geographic sites as sensitive will create bounding boxes using geographical coordinates and persist them in the global database. We propose database schemas that persist the restricted bounding boxes into a central database and a lightweight database on the device itself that acts as a cache. We propose that the functionality to restrict or allow photography based on geographical location be built into the firmware of the camera and its control module. The device will need internet connectivity occasionally to initialize usage in each country or province that it is being used. The network connectivity gives the device a chance to download all restricted bounding boxes within that geographical region before being used for the first time. Devices will check in with the service at intervals based on changes in the GPS location of the device. We further propose that national governments mandate the use of this framework in camera devices that are sold or imported into their countries. As the adoption of this framework spreads, we believe that it will reduce the problem of unregulated photography to levels where physical observation and prohibition will become feasible again to stop recalcitrant individuals. \section{Definition of Terms} \subsection{Global Positioning System} The Global Positioning System (GPS) is a navigation system that uses satellites, receivers, and algorithms to determine an object's location, direction of travel, and velocity on earth or in the air. Three satellites help determine the position of an object by triangulation, i.e., by plotting the receiver's distance from each of the receivers. A fourth satellite is used to verify the information from the three satellites used in triangulation and to aid in deducing the latitude information of an object. \subsection{Bounding Boxes} A bounding box is a geographical area defined by two latitudes and two longitudes. The conventional format of a bounding box is \begin{equation} \begin{split} bounding\_box = [min(longitude_1, longitude_2),min(latitude_1, latitude_2),\\max(longitude_1, longitude_2),max(latitude_1, latitude_2)] \end{split} \end{equation} \subsection{Centroid of a Bounding Box} The centroid of a geographical bounding box is defined as the intersection point of the two diagonals. The coordinates of the centroid of the bounding box are calculated as \begin{equation} centroid = \dfrac{(longitude_1 + longitude_2)}{2} , \dfrac{(latitude_1 + latitude_2)}{2} \end{equation} \section{Proposed evaluation} Since we cannot modify the camera firmware on an iPhone, we plan to build a mobile camera application to demonstrate the feasibility of our idea. Our mobile application will be developed on the iOS platform and has basic capabilities such as capturing a photograph and saving it to device storage. In addition, the application has a small local database to hold a subset of locally restricted boundary boxes. The application fetches restricted bounding boxes in the country or province of usage. As we see in later sections, the storage costs of storing a single bounding box are low. Therefore it is feasible to keep bounding boxes for the entire country on the device at a given time. If the bounding box density in a particular country is prohibitively high, the framework can split the country into manageable regions in a way that is opaque to the device. However, when the device detects that it is currently located in a region for which it has not downloaded bounding boxes, it prevents the camera from functioning until internet connectivity has been restored and bounding boxes have been downloaded. In addition, the framework shall allow the pre-downloading of bounding boxes for regions in which travel is anticipated so that the device can work on arrival in those regions. The application has a module that records just one of the GPS locations of the device. When the application is active, it checks the GPS location of the device once every ten minutes. The application only stores the device's most recent location to preserve privacy. If the device has traveled more than a mile from its last recorded location, the module calls out to the service and fetches more restricted bounding boxes in the new vicinity of the device. Each device is to be configured with a "permissible distance" based on the optical capabilities of the camera lenses. If the device is within the permissible distance of a restricted bounding box, the camera application is not allowed to capture images. The concept of "permissible distance" prevents users from working around the restriction by situating the device outside the bounding box and using telephoto capabilities to photograph the area within a restricted bounding box. \section{Description of the prototype} We have built out all the modules of the solution. The solution has hardware and software components, and they are described in the subsections below. \subsection{Hardware platforms} \subsubsection{Database system}~\\ We installed a Postgres database on a Raspberry Pi 4. The Raspberry Pi computer has 8GB synchronous dynamic random access memory (SDRAM). We use a SQLite database to store the restricted bounding boxes locally on the device for the application cache. \subsubsection{The photography application}~\\ We have built a photography application whose only function is to capture pictures and save them to the photo Gallery. We tested the application on an iPhone 13 Pro. \subsection{Software Components} \subsubsection{iOS application to capture images}~\\ We developed an iOS application that utilizes the camera of the iPhone to take pictures and save them to the gallery. \subsubsection{Database schema to hold restricted bounding boxes}~\\ We created a database that contains the list of geographic bounding boxes representing areas where photography is restricted. \subsubsection{Application Programming Interface (API) framework to facilitate interaction with the database}~\\ We implemented a \textbf{Re}presentational \textbf{S}tate \textbf{T}ransfer (ReST) API service using Spring Boot. This API has the following capabilities: \begin{itemize} \item POST~\\ Used to add new bounding boxes to the database. \item GET~\\ Returns a list of bounding boxes within a defined radius surrounding the GPS location passed in as an argument to the API. \end{itemize} \section{Implementation of the Prototype} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/schema_of_bounding_box_table.png} \caption{Schema of bounding box table} \label{fig:bbox_tab_schema} \end{figure} \subsection{Database of restricted bounding boxes} The schema of the main table is shown in Fig. \ref{fig:bbox_tab_schema}. Each bounding box in the database table gets its unique identifier. The bounding box is defined by two sets of latitudes and longitudes per convention. For audit purposes, we record the handle of the user or entity that added the bounding box to the database and the reason behind adding the restriction. As the bounding box is being added, the processing engine also computes the centroid of the bounding box and persists it along with the data. A centroid to compute against makes the whole process more efficient when the bounding boxes are accessed later to check for proximity. \subsection{ReST API Framework} The ReST API framework was developed as a Spring Boot application in Java. The API has two endpoints, as enumerated below. \subsubsection{Add a new restricting bounding box} \begin{figure}[htb] \centering \includegraphics[scale=0.3]{figures/regist_bbox.png} \caption{Request to add a new bounding box} \label{fig:regist_bbox} \end{figure}~\\ The endpoint specification to add a new restricted bounding box is shown in Fig. \ref{fig:regist_bbox}. The endpoint above accepts a POST request to add a restricted bounding box into the database. A bounding box is defined by two points in two-dimensional space, the first representing the lower-left corner of the box and the other representing the upper-right corner of the box. The endpoint responds with a standard \textbf{H}yper\textbf{t}ext \textbf{T}ransfer \textbf{P}rotocol (HTTP) status code denoting the result of the operation. \subsubsection{Retrieve a list of bounding boxes in the vicinity of the device’s current location} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/get_endpoint.png} \caption{Request to fetch bounding boxes} \label{fig:api_fetch_bbox} \end{figure} ~\\Fig. \ref{fig:api_fetch_bbox} shows that the endpoint accepts a GET request that specifies the coordinates of the current location of the device as well as the desired radius of the vicinity in which to search for restricted bounding boxes. The endpoint responds with an array of bounding boxes that lie within the requested area of the device, along with the standard HTTP status codes denoting the result of the operation. \subsection{Processing Engine} The processing engine is the software component that translates the user input received via the API framework into actions on the database. When the device requests all existing bounding boxes that exist in the current vicinity of the device, the processing engine uses the Haversine formula to compute the great circle distance between the current location of the device \((latitude_1, longtitude_1\)) and the centroid of each bounding box in the database \((latitude_2, longitude_2\)). If the great circle distance so computed is within the radius specified by the device in the request, the bounding box is added to the list returned to the device to be added to its local cache. The haversine formula to compute the great circle distance between any two points on earth is given as \[ a = sin^2(\dfrac{\Delta \varphi}{2}) + cos(\varphi_1)\cdot cos(\varphi_2) \cdot sin^2(\dfrac{\Delta \lambda}{2})\] \[ c = 2 \cdot atan2(\sqrt{a}, \sqrt{(1-a}) \] \[ distance = (radius\ of\ the\ earth\ in\ metres)\cdot c\] \[where\ \varphi\ is\ the\ latitude\ and\ \lambda\ is\ the\ longitude.\] \subsection{Database of restricted bounding boxes on device memory} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/bbox_local_schema.png} \caption{Schema of bounding boxes table on device memory} \label{fig:bbox_schema_device} \end{figure} ~\\Fig. \ref{fig:bbox_schema_device} shows the schema of the bounding boxes table on device memory. \subsection{Workflows for common operations} \subsubsection{Add a new bounding box} ~\\Fig. \ref{fig:bbox_insert_wflow} shows the workflow when a new restricted bounding box is added to the database. A user with authority over a geographical area adds a restricted bounding box to the database via the API framework. Fig. \ref{fig:bbox_insert_wflow} shows how the processing engine processes a request to add a restrictive bounding box to the database. A group of nearby bounding boxes is retrieved from the database. Next, the engine runs a matching algorithm that checks whether the new bounding box overlaps any existing bounding boxes. If overlaps are detected, the engine adjusts them into discrete non-overlapping bounding boxes and persists them back into the database. \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/add_bbox_flow.jpg} \caption{New bounding box insertion workflow} \label{fig:bbox_insert_wflow} \end{figure} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/workflow_refresh_device.jpg} \caption{Bounding boxes refresh workflow} \label{fig:bbox_refresh_wflow} \end{figure} \subsubsection{Device refreshing its restricted bounding boxes cache}~\\ Fig. \ref{fig:bbox_refresh_wflow} shows the workflow when a device needs to restore its local store of limited bounding boxes. \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/camera_workflow.jpg} \caption{Image capture workflow} \label{fig:image_capt_wflow} \end{figure} As seen in Fig. \ref{fig:image_capt_wflow}, when the application starts up for the first time, it compares the current location of the device to the last recorded GPS location and informs the user that it needs to: \begin{enumerate} \item Record the GPS location of the device at ten-minute intervals when the application is active. Only the most recent GPS location is stored; GPS trails are not stored on the device to protect privacy. \item Connect to the internet to refresh the list of restricted bounding boxes in the national or provincial vicinity of the device. \end{enumerate} The device connects to the internet to download the list of restricted bounding boxes in the current vicinity of the device. As long as the camera application is active, it records the GPS location of the device and checks whether it has traveled more than a mile from its previously registered location. Suppose it has; the application calls the bounding box service to download the restricted bounding boxes within a 25-mile radius of the device's current location. Again, this continues for as long as the camera application on the device is active. The call to the service is an attempt to pick up any new bounding boxes added since the list was last updated. In addition, time triggers are built into the software. For example, if more than 24 hours have passed since the bounding box list was last updated, the device attempts to establish internet connection and refresh the inventory. At the 30-day mark, the camera on the device becomes inoperable until the refresh has been performed. \subsubsection{Device capturing an image}~\\ Fig. \ref{fig:image_capt_wflow} depicts the device's workflow when it needs to take a picture. When the application receives a request to take a picture (via voice commands or tactile input by the user), it performs the following checks as depicted in figure \ref{fig:bbox_refresh_wflow}: \begin{enumerate} \item Has the device refreshed its local bounding box cache within the last configured positional and temporal triggers? If not, refresh the local cache before displaying the controls to capture the image. \item Does the device's current location lie within a permissible distance of any of the restricted bounding boxes on the device's local cache? \end{enumerate} If the current location does lie inside one of the limited bounding boxes, the device presents an error message to the user, and the picture is not captured. If the current location does not lie inside one of the restricted bounding boxes, the action to capture an image and persist it in the image gallery is completed. \section{Evaluation of the prototype} \subsection{Functional evaluation} \subsubsection{Functional evaluation of the server-side components.} \begin{enumerate} \item Adding non-overlapping restricted bounding boxes.~\\ We used a free map application to draw bounding boxes and record the geographical coordinates. We then run two test cases to test the logic in the processing engine. \begin{enumerate} \item For the first test, we added two non-overlapping bounding boxes near each other. \item We added a third bounding box for the second test that intersected both existing bounding boxes. \end{enumerate} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/non_overlapping.png} \caption{Visual representation of the non-overlapping bounding boxes that were added} \label{fig:non_overl_bboxes} \end{figure} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/get_bboxes_in_vicinity.png} \caption{Fetch bounding boxes in the vicinity of the device} \label{fig:fetch_bboxes_vicinity} \end{figure} \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/overlapping.png} \caption{Visual representation of the encompassing bounding box when there are overlaps} \label{fig:encompass_bboxes} \end{figure} Fig. \ref{fig:non_overl_bboxes} shows the geographical bounding boxes as plotted on a map. When the application queried the database after these two bounding boxes had been added, it returned the two bounding boxes separately, as expected. Fig. \ref{fig:fetch_bboxes_vicinity} shows the API response when fetching bounding boxes in the vicinity of the device. \item Adding a bounding box that intersects existing restricted bounding boxes. Fig. \ref{fig:encompass_bboxes} shows the overlapping bounding boxes as plotted on a map. When the application queried the restricted bounding boxes after this, the processing engine worked correctly to return the correct all-encompassing bounding box. \end{enumerate} \subsubsection{Functional testing of the camera application.} \begin{enumerate} \item Testing the application on a fresh start.\\ We connected the Raspberry Pi hosting the database to a portable battery unit and linked the device and the Raspberry Pi on the local hotspot network over Wifi. We then traveled to the vicinity of a restricted bounding box with the device turned on. We intentionally left the application unstarted for this step. When launched, the refresh module contacted the API service running on the Raspberry Pi and fetched the bounding boxes in the current country of the device. When the device was outside any of the bounding boxes, the application allowed pictures to be captured. However, when the device had entered into a restricted bounding box, the application prevented the camera from capturing an image.\\ \item Testing the application while it was active and the device was traveling. \begin{figure}[htb] \centering \includegraphics[scale=0.2]{figures/get_bboxes_in_radius.png} \caption{Fetch bounding boxes in a particular radius of the device} \label{fig:fetch_bboxes_radius} \end{figure} Fig. \ref{fig:fetch_bboxes_radius} shows the workflow when the device fetches bounding boxes in a particular radius. The Raspberry Pi hosting the database and the API service was connected to a portable battery unit and linked with the device over the device's hotspot, over Wifi. We launched the application when the device was about 50 miles away from any recorded bounding boxes. The application downloaded all the bounding boxes for the country we were testing. We added a few new bounding boxes to the database and started traveling toward the registered bounding boxes. The application kept checking the device's location and attempted to refresh its cache of restricted bounding boxes. When the device came into the 25-mile radius surrounding the recorded bounding boxes, the newer bounding boxes were downloaded to the device cache. When the device was within a restricted bounding box, the camera was prevented from capturing an image. The camera could capture an image when the device was outside all the restricted bounding boxes. \end{enumerate} \subsection{Storage and performance characteristics of the solution} \subsubsection{Storage}~\\ Our test data consisted of 1 million restricted bounding boxes spread over a large area of a 50-mile radius. The data took up approximately 150 megabytes of data on the database. Initially, we configured the device to only request bounding boxes within a 25-mile radius and noted the memory consumption. When we set up the application to request all restricted bounding boxes in a 50-mile vicinity, the available device memory went down by 120 megabytes. \subsubsection{API performance when adding restricted bounding boxes} \begin{table} \caption{Latency to add a new bounding box with existing bounding boxes in the database} \label{tab:lat_new_bbox} \begin{tabular}{|p{4cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|} \hline \textbf{\begin{tabular}[c]{@{}l@{}}Num existing \\ bboxes(in 1000s)\end{tabular}} & \textbf{1} & \textbf{100} & \textbf{250} & \textbf{500} & \textbf{1,000} \\ \hline \textbf{\begin{tabular}[c]{@{}l@{}}Time to add\\ new bbox(in ms)\end{tabular}} & 12 & 64 & 139 & 442 & 1695 \\ \hline \end{tabular} \end{table}~\\ As shown in table \ref{tab:lat_new_bbox}, the performance of adding new bounding boxes to the database declined in direct proportion to the number of restricted bounding boxes already in the database. The relationship may be ascribed to the fact that the processing engine needs to check the potential overlap of the new bounding box against existing bounding boxes. \subsubsection{API performance when fetching restricted bounding boxes} \begin{table} \caption{Latency in fetching restricted bounding boxes in current vicinity} \label{tab:lat_fetch_bbox} \begin{tabular}{|p{4cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|} \hline \textbf{\begin{tabular}[c]{@{}l@{}}Num existing \\ bboxes(in 1000s)\end{tabular}} & \textbf{1} & \textbf{100} & \textbf{250} & \textbf{500} & \textbf{1,000} \\ \hline \textbf{\begin{tabular}[c]{@{}l@{}}Time to fetch bboxes\\ in vicinity(in ms)\end{tabular}} & 2 & 15 & 75 & 102 & 851 \\ \hline \end{tabular} \end{table}~\\ As shown in Table \ref{tab:lat_fetch_bbox}, the performance of fetching new bounding boxes based on distance from a particular geographical location is better than the performance of adding new bounding boxes. The improved performance stems from the processing engine's attempts to optimize performance by computing and recording the centroid of each bounding box in the record and quickly computing the distance between the current device location and the centroid of each bounding box.\\ \subsubsection{Performance of the application when it needs to check whether the device is currently within a bounding box} \begin{table} \caption{Application startup latency metrics} \label{tab:startup_lat} \begin{tabular}{|p{4cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|p{1.45cm}|} \hline \textbf{\begin{tabular}[c]{@{}l@{}}Num existing \\ bboxes(in 1000s)\end{tabular}} & \textbf{1} & \textbf{100} & \textbf{250} & \textbf{500} & \textbf{1,000} \\ \hline \textbf{\begin{tabular}[c]{@{}l@{}}Application startup\\ latency(in ms)\end{tabular}} & 2 & 50 & 276 & 702 & 2003 \\ \hline \end{tabular} \end{table}~\\ As shown in Table \ref{tab:startup_lat}, we see that the additional time taken by the application to check whether the device was currently within a restricted bounding box added modestly to the startup latency. However, in most cases, the additional latency is not prohibitive. We attempted to test the performance of the camera application in an area that had 1 million restricted bounding boxes within a 50-mile radius. The performance was tested by measuring the application startup latency. Before the application displays the controls to capture an image, it checks whether the current device location lies within any bounding boxes in its local cache. The performance is similar to the API version when it receives a request to fetch bounding boxes. \section{Limitations of our approach} In this section, we discuss the limitations of our approach. \begin{enumerate} \item Our approach largely depends on device manufacturers' voluntary protocol adoption. Therefore, device manufacturers may be unwilling to build devices that conform to these standards. So it may be possible to find devices that can capture photographs of restricted areas. \item This approach will only work with devices that have GPS capabilities and periodically active network connections. \item GPS data may be spotty or unavailable in areas with tree cover or tall buildings. These factors could "fool" the module to allow photography where it should have been restricted or vice-versa. \item A data network might be unavailable in the vicinity of the device. In cases where the restricted bounding boxes could not be refreshed, should the device be allowed to capture images or not? \item We have considered but not explored a solution to the problem where malicious software could spoof GPS locations and trick the camera application into believing that it is in someplace where it is not. \end{enumerate} \section{Conclusion and future work} In this paper, we have proposed an approach that promotes national security interests by setting up a global database of restricted bounding boxes representing geographical areas where photography is restricted. We have demonstrated the functional feasibility of the solution and discussed the performance implications of adhering to the new protocol. As photographic device technology evolves, governments and entities worldwide find it increasingly difficult to physically enforce the restriction on photographing sensitive sites. The technological improvements include: gaining compact form factors, becoming more unobtrusive, and achieving more energy efficiency and ubiquitousness. In addition, the physical security posture of sensitive installations of national security importance is improved by implementing a lightweight global standard that device manufacturers must follow. In extensions of this work, we will focus on the following areas: \begin{enumerate} \item Explore the use of databases geared towards storing geographical data. The specific database functionality will allow bounding boxes to be sorted and enable geographical computations like distance calculation to be more efficient. The improved performance, in turn, will make the process of adding new bounding boxes, fetching bounding boxes in the vicinity, and checking for location within bounding boxes all very efficient. We propose using the PostGIS extension to the Postgres database to support querying restricted bounding boxes for a specific city or region. For example, suppose the user knows that they are traveling to a particular geographic area. In that case, this feature will enable them to download restricted bounding boxes ahead of time, thereby preventing a lock-out of the photography application or costly downloads over the mobile internet. Geographic databases also allow us to create database indexes on columns containing geographical data. Using indexes will improve the efficiency of geo-SQL queries that run natively on the database. \item In today's mobile application, we perform a less-than-efficient process to check whether the device's current location falls within any restricted bounding boxes in the device cache. In future iterations of this work, we plan to use the SpatiaLite extension to \textbf{S}tructured \textbf{Q}uery \textbf{L}anguage (SQL) to allow geographic queries to be run natively in the database. We expect this modification to significantly improve the efficiency of the application, especially during the check to see if the device's current location falls within a restricted bounding box. \item We also plan to explore how the same approach may be extended to protect the privacy of individual properties and other geographical locations that could benefit from restricting photography. \end{enumerate}
\section{Introduction and related work} \label{sec:intro} Modern neural networks achieve great results on various predictive modelling tasks. In the fields like computer vision and natural language processing neural-network based approaches are ubiquitous. When the task at hand has high cost of wrong decisions one has to assess the reliability of the model's predictions. There exist different ways to proceed with this task for neural networks. The standard approach for uncertainty estimation is ensembling which proposes to train several neural networks from different starting parameter values. Next, one can compute uncertainty estimates based on the discrepancies between the predictions of ensemble members~\cite{heskes1997practical,deepens2016}. Ensembling usually gives high quality uncertainty estimates but for the price of large computational overhead both on training and inference stages. The different direction is to make weights of the network stochastic via Bayesian approach which results in the concept of Bayesian neural networks~\cite{jospin2020hands}. One can then quantify predictive uncertainty using the posterior distribution of the weights conditioned on the training dataset. Bayesian inference is intractable for practical neural networks and thus approximate methods like variational inference~\cite{graves2011practical,blundell2015weight,rezende2015variational} and stochastic gradient MCMC~\cite{chen2014sghmc} are in use. These methods have a higher computational cost compared to training regular neural networks which limits their practical applicability. The other popular alternative is dropout which adds stochasticity to a standard neural network via randomly setting some of the weights to zero. This technique leads to the regularization of training~\cite{srivastava2014dropout} and can provide uncertainty estimates if applied at prediction time~\cite{gal2016dropout,Tsymbalov2018,tsymbalov2020dropout,shelmanov-etal-2021-certain}. All the mentioned methods require either a modification of network architecture or training multiple models. As there are many existing pre-trained models for various tasks, it is beneficial to have a method that can be applied to a given neural network in order to obtain high-quality uncertainty estimates. In this work we will focus on the classical form of uncertainty estimates: prediction intervals~\cite{casella2002statistical}. We propose a general method to construct approximate prediction intervals for a trained neural network model in the non-linear regression problem. Our method is based on the classical ideas of linearization (or first-order Taylor expansion) and so-called \textit{delta method} (see e.g.~\cite{doob1935}). While the original method requires inverting the estimated parameter covariance matrix of the model, we propose an efficient computational scheme based on SVD and matrix sketching techniques. These techniques make the proposed \textit{Important Directions} method viable for modern deep neural networks. The rest of the work is organized as follows. Section~\ref{sec:algo} is devoted to the formal problem statement and introduces the proposed method. Section~\ref{sec:experiments} describes the implementation and experiments. After that Section~\ref{sec:discussion} points to possible extensions of the considered method and Section~\ref{sec:conclusions} concludes the work. \section{Approximate prediction intervals for neural networks} \label{sec:algo} \subsection{Prediction intervals for neural networks} We will be working in a general regression setting, where we are given a training dataset $\DS=\{\xv_i, y_i\}_{i=1}^{n}, \: \xv_i \in \mathbb{R}^m, \: y_i \in \mathbb{R}$. The task is to estimate the hypothesised relationship $y_i \approx f(\xv_i, \mathbf{w})$ by providing an estimate $\widehat{\mathbf{w}}$ of the parameter vector $\mathbf{w} \in \mathbb{R}^p$. To quantify the approximate nature of the statement, an unobserved noise random variable is introduced: \begin{EQA}[c] \label{eqn:nonlin_reg} y_i = f(\xv_i, \mathbf{w}) + \veps_i, \quad \veps_i \sim \mathcal{N}(0, \sigma^2), \quad i = 1, \dots, n. \end{EQA} % A level $(1 - \alpha)$ prediction interval for the function value $y_0 = f(\xv_0, \mathbf{w})$ is a random interval $\left[L_\alpha(\xv_0, \DS), U_\alpha(\xv_0, \DS)\right]$ with the following property: \begin{EQA}[c] \mathbb{P}\Bigl( y_0 \in \bigl[L_\alpha(\xv_0, \DS), U_\alpha(\xv_0, \DS)\bigr] \Bigr) \geq 1 - \alpha. \end{EQA} \noindent \textbf{Linear regression.} In the simplest case of a linear relationship $f$ there is a closed-form expression for the prediction interval. For ease of exposition need to slightly modify the training set here $\xv_i \in \mathbb{R}^{m+1}$ with a dummy first dimension equal to 1 and $\xm$ is a matrix with the vectors $\xv_i$ as rows. Using the fact that the noise is normally distributed, the following formula for interval endpoints can be derived~\cite{seber_lee2003linear}: \begin{EQA}[c] \widehat{y}_0 \: \pm \: t_{n-m-1}^{(\alpha/2)} \sighat \sqrt{1 + \xv_0^T \left( \xm^T \xm \right)^{-1} \xv_0}, \end{EQA} where $\sighat$ is an estimate of the noise standard deviation, $\widehat{y}_0$ is a linear regression prediction at point $\xv_0$ and $t_{n-m-1}^{(\alpha/2)}$ is a level $\alpha/2$ quantile of the Student's $t$-distribution with $n-m-1$ degrees of freedom. From the expression under the square root we see that even in this simple case the required computation scales quadratically with the size of the whole dataset and cubically with the feature dimension. Overall, computational complexity is $O(n^2m+m^3)$. \subsubsection{Nonlinear regression.} Now we move to the general setting of~\eqref{eqn:nonlin_reg} with $f$ being a neural network with parameters $\mathbf{w}$. In~\cite{Veaux1998PI} authors provide a method of constructing a prediction interval for a trained neural network based on delta-method. We briefly state main results here while the derivation and discussion can be found in the original paper. Let us assume that parameter estimates $\widehat{\wp}$ for the model are obtained by minimizing sum-of-squares loss with $L_2$ regularization with parameter $\lambda$ based on the training dataset $\DS=\{\xv_i, y_i\}_{i=1}^{n}$. We introduce some additional notations. Matrix $J$ consists of the gradients of the output of the neural network, computed at the final parameter estimates $\widehat{\wp}$: \begin{EQA}[c] J = \{J_{ij}\}_{i, j= 1}^{n, m}, \; \; J_{i,j} = \left.\frac{\partial f}{\partial w_j} \right\vert_{\xv=\xv_i, \mathbf{w}=\widehat{\wp}}, \end{EQA} and matrix $\CM$ is the approximate parameter covariance matrix: \begin{EQA}[c] \label{eq:1} \CM^{-1} = (J^T J + \lambda I)^{-1} (J^T J) (J^T J + \lambda I)^{-1}. \end{EQA} Let $\xv_0$ be a new unseen point where we aim to predict the response value $y_0$. Additionally, let $g_0 = \left.\frac{\partial f}{\partial w_j} \right\vert_{\xv=\xv_0, \mathbf{w}=\widehat{\wp}}$ be the gradient of the output of the neural network at the new point $\xv_0$. The approximate level $(1-\alpha)$ prediction interval at a new point $\xv_0$ is given by~\cite{Veaux1998PI}: \begin{EQA}[c] \widehat{y}_0 \pm t^{\alpha/2}_{n-p^*} \widehat{s} \sqrt{1 + g_0^T \CM^{-1} g_0}. \label{eq2} \end{EQA} % Here, $t^{\alpha/2}_{n-p^*}$ is the $\alpha/2$-level quantile of Student's \textit{t}-distribution with $n-p^*$ degrees of freedom. Quantity $p^*$ is the so-called \textit{effective number of parameters}. Authors of~\cite{Veaux1998PI} propose the following approximation for it: \begin{EQA}[c] p^* = \mathrm{Tr}(2 H - H^2) ~~ \text{with} ~~ H = J(J^T J + \lambda I)^{-1} J^T. \end{EQA} % The last component we have to cover is $\widehat{s}$, which is an estimate of the noise variance $\sigma$. This quantity can be found from the sum of squared residuals of the model on the training data: \begin{EQA}[c] \label{eqn:s_hat} \widehat{s}^2 = \frac{\sum_{i=1}^{n} (y_i - \widehat{y}_i)^2}{n - p^*} = \frac{\sum_{i=1}^{n} \bigl(y_i - f(\xv_i, \widehat{\wp})\bigr)^2}{n - p^*}. \end{EQA} From the applied point of view, we can divide this method into two parts: calculating $\CM$ and calculating $p^*$. Computational complexity of both parts is $O(n m^2 + m^3)$, not including the cost of computing gradients. Space complexity is at least $O(nm+m^2)$ since we need to store the full covariance matrix and the matrix of gradients. Unfortunately, for most modern deep neural networks this approach can not be applied as is. For example, in contemporary computer vision, a neural network can have tens of millions of parameters ($m$) and millions of examples in the training set ($n$). This will make the matrices involved in the formulas above prohibitively large to carry out computations. In this work we propose a set of approximation techniques to reduce the computational burden of the formulas above and obtain a practical algorithm to construct approximate prediction intervals for deep neural networks. \subsection{Simplification using SVD} If we assume that matrix $J$ admits the following singular value decomposition: \begin{EQA}[c] J = UDV^T, ~~ D = \mathrm{diag} (d_1, d_2, \dots, d_m), \label{eq_svd} \end{EQA} we can then simplify formula~\eqref{eq:1} using the fact that $U$ and $V$ are unitary matrices: \begin{EQA} && J^TJ = VDU^T UDV^T = VD^2V^T, \\ && (J^TJ + \lambda I)^{-1} = (VD^2V^T + \lambda I)^{-1} = (V(D^2 + \lambda I)V^T)^{-1} = V(D^2 + \lambda I)^{-1}V^T \end{EQA} and obtain \begin{EQA}[c] \CM^{-1} = V(D^2 + \lambda I)^{-1}V^T VD^2V^T V(D^2 + \lambda I)^{-1}V^T = VD^2(D^2 + \lambda I)^{-2}V^T. \end{EQA} % We can also observe that \begin{EQA} \label{eqn:d_sigma} D^2(D^2 + \lambda I)^{-2} & = & \mathrm{diag}\left( \left\{\frac{d_j^2}{(d_j^2 + \lambda)^2} \right\}_{j=1}^{m}\right). \end{EQA} % Using this form we can greatly simplify the computation of the formula~\eqref{eq:1} if the SVD decomposition is precomputed. \subsection{Proposed approximation} While obtaining the full decomposition~\eqref{eq_svd} may still be intractable, we can use a truncated rank-$k$ SVD. However, most existing implementations assume that the target matrix is stored and accessed in a sparse format. Since $J$ is a matrix of gradients of a neural network, it is dense, and, thus, we have a slightly different setup. First, the target matrix is accessible row-by-row, because modern automatic differentiation packages allow computation of the gradients of a function that outputs a single scalar. Second, we can only store a limited number of rows because of the large number of trainable parameters in the neural network. Based on these two requirements, we need an online algorithm that computes a low rank approximation of a matrix by reading through its rows one at a time. Low rank matrix approximation in the presence of constraints on access to the matrix elements is sometimes called matrix sketching. We refer to~\cite{Sarkar2020SpectralAF} and~\cite{Liberty2013SimpleAD} for further reading. In this work, we consider an online low rank matrix approximation algorithm Robust Frequent Directions (RFD)~\cite{robust_dirs}. RFD is a modification of Frequent Directions (FD) algorithm~\cite{freq_dirs,Liberty2013SimpleAD}. Given a matrix $A$, the algorithm approximates $A^TA$ by $B^TB + \lambda' I$, where matrix $B$ has only $k<<n$ rows. Reading matrix $A$ row-by-row, RFD updates the approximation $B$ and the regularization parameter $\lambda'$ simultaneously\footnote{When $A^TA + \lambda I$ is the target matrix the final approximation becomes $B^TB + (\lambda + \lambda') I$}. \begin{algorithm}[t] \label{alg:id_inner} \DontPrintSemicolon \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwFunction{SVD}{SVD} \caption{Update Approximation} \SetAlgoLined \Input{$B \in \mathbb{R}^{2k \times m}$ -- current approximation to the target matrix, $\lambda$ -- regularization parameter used for network training, $\lambda'$ -- current additional regularization parameter, $R$ -- next row of the target matrix } \Output{$B'$ -- updated low-rank approximation, $\lambda''$ -- updated additional regularization coefficient} $r \leftarrow \textrm{index of the first zero row of } B$ \; $B_r \leftarrow R$ \; \uIf{$r = 2k$}{ $U, D, V$ $\leftarrow$ \SVD{$B$} \; $S, \textrm{idx} \leftarrow$ top $k$ entries of $D$ based on $score(D, \lambda)$ together with indices\; $\delta \leftarrow \min S$ \; $B' \leftarrow 0^{2k \times m}$ \; $B'_{1:k} \leftarrow \sqrt{\max (S^2-\delta^2 I, 0)} V_{\textrm{idx}}^T$ \Comment{use singular vectors indexed with \textrm{idx} and scale corresponding singular values} $\lambda'' \leftarrow \lambda' + \delta^2 / 2$ \; } \uElse{ $B' \leftarrow B$ \; $\lambda'' \leftarrow \lambda'$ \; } \Return {$B', \; \lambda''$} \end{algorithm} \subsubsection{Parameter covariance.} We propose a new algorithm to approximate formula~\eqref{eq:1} using a modification of the RFD that we call Robust Important Directions, presented in Algorithm 1. The key element of the algorithm is the use of a scoring function to select a pivotal singular value (line 6) instead of just using the minimal one. This scoring function is chosen based on a higher-level problem at hand. In our case the end goal is estimating the parameter covariance matrix and~\eqref{eqn:d_sigma} can be directly used here: \begin{EQA}[c] \label{eqn:score_func} score(D, \lambda) = \left[\frac{d_j^2}{(d_j^2 + \lambda)^2}\right]_{j=1}^{m}. \end{EQA} % Since we want to preserve as much information about $\CM^{-1}$ as possible, this score function will help the algorithm retain the largest singular values. \begin{algorithm}[t] \label{alg:id_outer} \DontPrintSemicolon \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwFunction{UpdateApproximation}{UpdateApproximation} \caption{Robust Important Directions} \SetAlgoLined \Input{$k$ -- rank of the approximation, $A \in \mathbb{R}^{n \times m}$ -- target matrix, $\lambda$ -- regularization parameter} \Output{$B$ -- low-rank approximation of $A$, $\lambda_n$ -- corrected regularization coefficient} $B \leftarrow 0^{2k \times m}$ \; $\lambda_0 \leftarrow 0$ \; \ForEach {row $A_i \in A$}{ $B, \lambda_i \leftarrow$ \UpdateApproximation{$B, \lambda, \lambda_{i-1}, A_i$} \; } \Return {$B_{1:k}, \lambda_n$} \end{algorithm} After going through our training dataset one time we store the final SVD decomposition of the matrix $B$. This approximation of matrix $J$ is used later for computation of the intervals. Computational complexity of this procedure is the same as for Frequent Directions~\cite{freq_dirs}: $O(nmk)$, where $k$ is the rank of the approximation. We again ignore the cost of computing gradients since it is done only once and the resulting computational complexity will depend on the specific architecture. Space complexity is only $O(km)$ as we store $B \in \mathbb{R}^{2k, m}$. \subsubsection{Noise variance.} So far uncovered ingredient of the formula~\eqref{eq2} is the estimation of the noise variance $\widehat{s}^2$. Using our SVD decomposition of $J$ we can represent $H$ in the following form: \begin{EQA}[c] H = J(J^T J + \lambda I)^{-1} J = UDV^T V(D^2 + \lambda I)^{-1}V^T VDU^T = UD^2(D^2 + \lambda I)^{-1}U^T \end{EQA} and $D^2(D^2 + \lambda I)^{-1}$ can be computed by~\eqref{eqn:d_sigma}. To compute the unknown quantity $p^*$ we need to find the trace of the equation depending on $H$. Using the properties of SVD decomposition and trace we get: \begin{EQA}[c] p^* = \mathrm{Tr}(2 H - H^2) = 2\mathrm{Tr}(H) - \mathrm{Tr}(H^2) = \sum_{j=1}^m \frac{2d_j^2}{(d_j^2 + \lambda)} - \frac{d_j^4}{(d_j^2 + \lambda)^2}. \end{EQA} % Having obtained this simple expression, we can evaluate it using our truncated SVD approximation. \subsubsection{Algorithms.} We collect the steps described above in the following subprograms. Algorithm~\ref{alg:id_inner} computes an update to existing low rank approximation. It runs when a new row of the target matrix is available: if the buffer (matrix $B$) is full, we perform SVD and truncate our approximation. We use this later as a subroutine. Algorithm~\ref{alg:id_outer} is the procedure for computing low-rank approximation of a matrix for the case when a $score$ function is provided (implicitly used in Algorithm~\ref{alg:id_inner}). This algorithm can be used as a drop-in replacement for other low-rank approximation algorithms when more information about the problem is available. The end user will select the $score$ function based on the task at hand. Algorithm~\ref{alg:covar} summarizes all the steps that are required to compute prediction intervals of a trained neural network for the proposed \textit{Important Directions} approach. It precomputes a compact low rank approximation to the inverse covariance matrix of the network parameters and effective number of parameters. To construct the intervals for new data points the end user can employ equation~\eqref{eq2} together with these approximations. \begin{algorithm}[t] \label{alg:covar} \DontPrintSemicolon \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwFunction{UpdateApproximation}{UpdateApproximation} \SetKwFunction{SVD}{SVD} \SetAlgoLined \Input{$f(\xv, \widehat{\wp})$ - trained neural network, $\lambda$ - $L_2$-regularization parameter that was used to train the network, $\DS=\{\xv_i, y_i\}_{i=1,\dots,n}$ - training dataset, $k$ -- rank of the approximation} \Output{$D_{\Sigma^{-1}}, V$ - low-rank approximation to the parameter covariance matrix, $p^*$ - estimate of the effective number of parameters } $B \leftarrow 0^{2k \times m}$ \; $\lambda_0 \leftarrow 0$ \; \For{$(\xv_i, y_i)$ in $\DS$}{ $\mathbf{g}_i \leftarrow \nabla f_i = \left.\frac{\partial f}{\partial w} \right\vert_{x=x_i, w=\what}$ \; $B_i, \lambda_i \leftarrow$ \UpdateApproximation{$B, \lambda, \lambda_{i-1}, \mathbf{g}_i$} \; } $U, D, V \leftarrow$ \SVD{$B_n$} \; $D_{\Sigma^{-1}} \leftarrow (D^2 + \lambda_n)(D^2 + (\lambda_n + \lambda) I)^{-2}$ \; $D_H \leftarrow (D^2 + \lambda_n)(D^2 + (\lambda_n + \lambda) I)^{-1}$ \; $p^* \leftarrow \textrm{Tr}(2D_H - D_H^2)$ \; \Return {$D_{\Sigma^{-1}}, V, \; p^* $} \caption{Estimate the covariance matrix of the NN parameters and effective number of parameters} \end{algorithm} \subsection{Motivation behind the approximation} The proposed modification of the low-rank approximation procedure introduces the score function~\eqref{eqn:score_func} in order to capture the most important eigenvalues and eigenvectors of the parameter covariance matrix. We demonstrate the effectiveness of this heuristic on small-scale regression datasets from the UCI repository~\cite{UCI2019}. For a sufficiently small neural network it is feasible to apply formula~\eqref{eq2} directly. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{figures/specters-j-sigma} \caption{Approximation quality of Important Directions (rank $k=200$) for a $[50, 50]$ fully-connected network trained on the Wine Quality dataset. Dotted lines show the true specters of the matrices and solid lines show their respective approximations, shifted horizontally for visual clarity.} \label{fig:specters_wine} \end{figure} Figure~\ref{fig:specters_wine} shows comparison of the Important Directions approximation with exact computations: singular values of the Jacobian matrix $J$ and eigenvalues of the covariance $\Sigma^{-1}$ are plotted on the same axes. Using Robust Frequent Directions corresponds to selecting largest singular values of $J$, which will correspond to much smaller values for $\Sigma^{-1}$ (left-most part of the graph). At the same time, the largest eigenvalues of the covariance (shown in pink) will have more influence on the length of the resulting prediction intervals in~\eqref{eq2}. The presented graph shows that Important Directions approach achieves the goal of preserving the more informative part of the specter. \subsection{Hyperparameters} The proposed method essentially has a single hyperparameter: the rank of the approximation $k$. Our experiments have shown diminishing returns with its increase. One advantage of this hyperparameter is that it can be chosen without the use of a hold-out dataset: based on the relative magnitude of the recovered singular values of the Jacobian. If the smallest and largest singular values of the approximation differ by several orders, additional singular values and singular vectors will contribute very little to the final length of the interval. An example of a sharp decline like this can be seen in Figure~\ref{fig:specters_wine} around index $1000$. Since the size of the additional memory required for the approximation is a multiple of the total number of parameters of the neural network, it is reasonable to expect significant memory constraints playing a bigger role in the choice of this parameter. Thus we recommend to set it as high as your computational budget allows if you do not observe the behavior described in the previous paragraph. \section{Experiments} \label{sec:experiments} We evaluate our method against a number of existing approaches on publicly available regression datasets from UCI repository~\cite{UCI2019}. For comparison we have chosen methods designed specifically for neural networks and compared performance of the resulting prediction intervals. Every dataset was split 20 times into training and test sets and each method was independently applied on each split. Average performance metrics of these 20 runs are reported. \subsection{Methods} \textbf{ MC-dropout.} We have based our implementation on the reference implementation\footnote{\url{https://github.com/yaringal/DropoutUncertaintyExps}} of~\cite{gal2016dropout}. Dropout probability is tuned via grid search on a validation set (taken out of training set) and the then the final model is trained from scratch on the whole training set. Resulting prediction interval is obtained using 10~000 stochastic forward passes. \textbf{Deep Ensembles.} We train the neural network multiple times from different initializations. Probabilistic output is a Gaussian with mean and variance obtained by aggregating their predictions. \textbf{Important Directions.} For our method we set rank of the approximation to a fixed value of 500 for most datasets with some exceptions: 200 for ``Wine'' and 300 for ``Boston'' due to their small size and 1000 for ``Year''. Number of training epochs is tuned on a validation set similar and then the network is retrained from scratch (similar to Dropout). For all methods we have used the training of a neural network as a black-box building block. The same fully connected neural network with two hidden layers of size 50 was used. We used Adam optimizer~\cite{kingma2014adam} with the default learning rate of $0.001$. \textbf{Neural Network Prediction intervals}~\cite{Veaux1998PI}. We have implemented the base method using the fact that our neural networks and some datasets are rather small. All the data was stored in GPU memory to speed up gradient computation. Jacobian product matrix $J^TJ$ was also pre-computed on GPU which will be impossible for larger networks. \subsection{Metrics and results} While many existing papers on probabilistic regression use log-likelihood on the test set as the target metric, the quality of the resulting interval estimates is rarely explored~\cite{kompa2021empirical}. We argue that for a practitioner working on a regression problem a prediction interval with a specified level is much more useful than a simple ranking of the test sample by an uncertainty estimate. With this in mind we have chosen the following metrics to measure the quality of the obtained prediction intervals: \begin{itemize} \item Probability of coverage $p_{cov}$ -- proportion of the test examples for which estimated intervals cover the true response values. \item Pearson's correlation coefficient $r$ between width of the estimated interval and true absolute error. \item Width of the prediction interval in terms of the standard deviation of the true response values $w_{sd}$. Naturally one would prefer narrower intervals while still providing the coverage guaranties. \end{itemize} \subsubsection{Comparison with the exact method.} We have compared our method with the exact application of formula~\eqref{eq2}, setting the rank at 500 for all of the datasets using a powerful workstation. While the computation time was impractical even for these simple datasets, it will allow us to assess whether our approximation is adequate. Results are summarised in Table~\ref{tab:exact}. Column $\Delta t$ corresponds to wall clock time in seconds that it took to run the method (excluding training of the neural network, etc.). As we can see the results for Important Directions are comparable with the exact computation. Rank of the approximation of 500 was enough even for larger datasets where $p^*$ is underestimated. Our hypothesis is that the original formula often produces over-conservative intervals -- their coverage is often greater than the nominal $95\%$, so the lower $p^*$ actually improves the metrics. See also the relevant discussion in~\cite{Veaux1998PI}. In some cases running time of the exact method is slightly better. This might be due to different implementations of SVD on CPU and GPU: we could not fit $J$ and/or $\Sigma^{-1}$ in the GPU memory. \begin{table}[t] \centering \caption{Comparison of the low-rank approximation with the exact method}\label{tab:exact} \begin{tabular}{lcccccccc} \toprule Metric & \multicolumn{2}{c}{$p_{cov}$} & \multicolumn{2}{c}{$r$} & \multicolumn{2}{c}{$w_{sd}$} & \multicolumn{2}{c}{$\Delta t$} \\ Method & Exact & ID & Exact & ID & Exact & ID & Exact & ID \\ Dataset & & & & & & & & \\ \midrule Ailerons & 0.94 & 0.95 & 0.22 & 0.25 & 1.55 & 1.55 & 25 & 6 \\ Boston & 0.98 & 0.96 & 0.36 & 0.34 & 1.61 & 1.33 & 7 & 1 \\ CT & 0.96 & 0.96 & 0.36 & 0.33 & 0.38 & 0.37 & 2398 & 24 \\ Concrete & 0.96 & 0.96 & 0.21 & 0.21 & 1.41 & 1.37 & 5 & 1 \\ Energy & 0.96 & 0.96 & 0.42 & 0.42 & 1.75 & 1.75 & 6 & 1 \\ Protein & 0.95 & 0.95 & 0.10 & 0.10 & 2.95 & 2.95 & 17 & 19 \\ SGEMM & 0.96 & 0.96 & 0.41 & 0.41 & 0.69 & 0.69 & 71 & 99 \\ Superconduct & 0.94 & 0.94 & 0.10 & 0.12 & 1.50 & 1.52 & 76 & 9 \\ Wine & 0.98 & 0.95 & 0.18 & 0.14 & 3.85 & 3.08 & 6 & 1 \\ Yacht & 0.98 & 0.95 & 0.17 & 0.13 & 3.86 & 3.20 & 6 & 1 \\ Year & 0.94 & 0.93 & 0.22 & 0.22 & 3.10 & 3.07 & 5357 & 214 \\ \bottomrule \end{tabular} \end{table} \subsubsection{Comparison with other methods.} We have also preformed a comparison with other popular methods of uncertainty estimation for neural networks: MC-dropout and Deep Ensembles. Results of these experiments are presented in Table~\ref{tab:dropout}. For $p_{cov}$ the closest value to the nominal $95\%$ coverage is shown in bold. For $r$ the highest correlation coefficient is shown in bold. Overall it is a tie between ensembles and Important Directions: both methods are very close to the nominal coverage probability and provide intervals that correlate with the true error. Interesting observation is that methods are close in the three metrics at the same time, so ensemble does not for example provide universally tighter intervals. Our proposed explanation for the poor performance of the dropout is the following. Authors of~\cite{gal2016dropout} propose to tune both drop-out rate and $\tau$ parameter (related to noise precision) at the same time using grid search over predefined ranges. Even with standardizing the datasets it proves to be a challenging scenario given the observed coverage statistics. Given all the above we conclude that Important Directions method achieves results on par with more established but computationally heavy methods without the need to retrain the network and tune multiple hyper-parameters. \begin{table}[t] \centering \caption{Probability of coverage and other metrics for different methods.}\label{tab:dropout} \begin{tabular}{lccccccccc} \toprule Metric & \multicolumn{3}{c}{$p_{cov}$} & \multicolumn{3}{c}{$r$} & \multicolumn{3}{c}{$w_{sd}$} \\ Method & D-out & Ens. & ID & D-out & Ens. & ID & D-out & Ens. & ID \\ Dataset & & & & & & & & & \\ \midrule Ailerons & 0.965 & \textbf{0.948} & 0.945 & 0.008 & 0.158 & \textbf{0.245} & 1.960 & 1.573 & 1.550 \\ Boston & \textbf{0.947} & 0.957 & 0.962 & 0.032 & 0.261 & \textbf{0.344} & 1.519 & 1.388 & 1.330 \\ CT & 0.999 & 0.978 & \textbf{0.956} & 0.005 & \textbf{0.372} & 0.331 & 0.657 & 0.411 & 0.368 \\ Concrete & 0.908 & \textbf{0.950} & 0.960 & -0.062 & \textbf{0.211} & 0.206 & 1.029 & 1.265 & 1.372 \\ Energy & 0.963 & \textbf{0.952} & 0.959 & 0.022 & 0.419 & \textbf{0.421} & 1.862 & 1.715 & 1.748 \\ Protein & 0.870 & 0.953 & \textbf{0.952} & -0.086 & 0.072 & \textbf{0.097} & 1.960 & 2.965 & 2.949 \\ SGEMM & 0.990 & 0.967 & \textbf{0.963} & -0.069 & \textbf{0.503} & 0.411 & 0.392 & 0.709 & 0.693 \\ Sup.con. & 0.903 & \textbf{0.944} & 0.943 & -0.097 & \textbf{0.271} & 0.121 & 1.029 & 1.523 & 1.524 \\ Wine & 0.801 & \textbf{0.946} & \textbf{0.946} & 0.032 & 0.114 & \textbf{0.144} & 1.960 & 3.135 & 3.082 \\ Yacht & 0.802 & 0.946 & \textbf{0.952} & 0.041 & \textbf{0.139} & 0.133 & 1.960 & 3.135 & 3.202 \\ Year & 0.847 & \textbf{0.936} & 0.934 & 0.006 & 0.186 & \textbf{0.216} & 1.960 & 3.116 & 3.070 \\ \bottomrule \end{tabular} \end{table} \subsection{Implementation} We have implemented our method in Python 3 language. Neural network training and gradient computations were done in PyTorch~\cite{Paszke2019}. Subsequent matrix and vector calculations used NumPy library~\cite{harris2020array}. Full source code for the method and experiments is made publicly available \footnote{\url{https://github.com/stat-ml/id_prediction_intervals}}. \section{Discussion and future work} \label{sec:discussion} While we introduce Important Directions as method for regression tasks, it can also be applied in the classification setting. For a given class index the network's logits can be combined in a one-vs-rest fashion to produce a single logit value. For this we will need to run our method independently for each class (although some gradient computations could be reused). Other ways to extend our method to classification task is the topic for future research. The described increase in computational cost urges us to find other ways to improve performance. One way is to limit the number of the parameters of the neural network that are considered in the gradient computation and related matrix operations. We can restrict our focus only to top layers or any other subset. This is similar in spirit to performing Bayesian inference on the last layer only. A direction of possible future research is the choice of higher rank vs larger number of parameters. \section{Conclusions} \label{sec:conclusions} This work presents a new method to construct prediction intervals for a trained neural network based on matrix sketching. The method was developed for regression tasks but can also be applied in a classification setting targeting class logits. We demonstrate its advantages compared to other interval estimation methods for neural networks on a range of benchmark regression datasets. \noindent \textbf{Acknowledgements.} The research was supported by the Russian Science Foundation grant 20-71-10135. \bibliographystyle{splncs04}
\subsection{Nonlinear Models for Microgrid System Components with Node Voltage or Node Current Inputs} The DER connection circuit and the Vf-controller (given as an example) are shown in Fig.~\ref{fig_connection_diagram} and Fig.~\ref{fig_Vf_block_diagram}, respectively. Ten differential equations can then be developed, which are not given here due to the page limit. These equations form a control affine system, where the state vector is $\vect{x} = \big[x_1,\,x_2,\,x_3,\,x_4,\,x_5,\,x_6,\,V_C^D,\,V_C^Q,\,I_L^D,\,I_L^Q\big]^{\mathsf{T}}$, the input vector is the node current $\vect{u} = \big[I_N^D,\,I_N^Q\big]^{\mathsf{T}}$, and the output to the network is the node voltage that is equal to the state variables $\vect{y} = \big[V_C^D,\,V_C^Q\big]^{\mathsf{T}}$. \begin{comment} \begin{align} \dot{V}_C^D &= \omega\, V_C^Q + \frac{1}{C} (I_L^D - I_N^D) \\ \dot{V}_C^Q &= -\omega\, V_C^Q + \frac{1}{C} (I_L^Q - I_N^Q) \\ \dot{I}_L^D &= \omega\, I_L^Q + \frac{1}{L} (V_t^D - V_C^D - R I_L^D) \\ \dot{I}_L^Q &= -\omega\, I_L^Q + \frac{1}{L} (V_t^Q - V_C^Q - R I_L^D) \end{align} \end{comment} The input functions of the control affine system, $\vect{g}_1(\vect{x})$ and $\vect{g}_2(\vect{x})$, associated with each input are given by \begin{align} \vect{g}_1 &= \Big[\,0,\,0,\,0,\,0,\,-\cos{x_2},\,\sin{x_2},\,\frac{1}{C},\,0,\,-\frac{K_p^{Ireg}}{L},\,0\,\Big]^{\mathsf{T}}, \\ \vect{g}_2 &= \Big[\,0,\,0,\,0,\,0,\,-\sin{x_2},\,-\cos{x_2},\,0,\,\frac{1}{C},\,0,\,-\frac{K_p^{Ireg}}{L}\,\Big]^{\mathsf{T}}. \end{align} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/connection.pdf} \caption{The connection circuit of DER} \label{fig_connection_diagram} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/double_loop.pdf} \caption{Vf control} \label{fig_Vf_block_diagram} \end{figure} \begin{comment} equations starting from the PCC point can be written as a control affine system whose input is the node current injected into the transmission network. The following equations all have the same per-unit base and d-q reference frame as the transmission network. \begin{align} \dot{x}_1 &= -V_C^d \sin{x_2} + V_C^q \cos{x_2} \label{E:Vf 1}\\ \dot{x}_2 &= K_p^{PLL} (-V_C^d \sin{x_2} + V_C^q \cos{x_2}) + K_i^{PLL} x_1 \\ \dot{x}_3 &= V^* - \sqrt{(V_C^d)^2 + (V_C^q)^2} \\ \dot{x}_4 &= -K_p^{PLL} (-V_C^d \sin{x_2} + V_C^q \cos{x_2}) - K_i^{PLL} x_1 \\ \dot{x}_5 &= K_p^{Vreg} (V^* - \sqrt{(V_C^d)^2 + (V_C^q)^2}) \notag \\ & \;\, + K_i^{Vreg} x_3 - (I_N^d \cos{x_2} + I_N^q \sin{x_2}) \\ \dot{x}_6 &= K_p^{Vreg} \big[-K_p^{PLL} (-V_C^d \sin{x_2} + V_C^q \cos{x_2}) \notag \\ & \;\, - K_i^{PLL}x_1\big] + K_i^{Vreg} x_4 - (-I_N^d \sin{x_2} + I_N^q \cos{x_2}) \\ \end{align} \begin{align} \dot{V}_C^d &= \omega\, V_C^q + \frac{1}{C} (I_L^d - I_N^d) \\ \dot{V}_C^q &= -\omega\, V_C^q + \frac{1}{C} (I_L^q - I_N^q) \\ \dot{I}_L^d &= \omega\, I_L^q + \frac{1}{L} (V_t^d - V_C^d) \\ \dot{I}_L^q &= -\omega\, I_L^d + \frac{1}{L} (V_t^q - V_C^q), \end{align} \end{comment} \begin{comment} \begin{align} V_t^d &= K_p^{Ireg} K_p^{Vreg} \Big[\Big(V^* - \sqrt{(V_C^d)^2 + (V_C^q)^2}\Big)\cos{x_2} \notag \\ & \;\, + \big( K_p^{PLL} (-V_C^d \sin{x_2} + V_C^q \cos{x_2}) + K_i^{PLL} x_1 \big) \sin{x_2} \Big] \notag \\ & \;\, + K_p^{Ireg} K_i^{Vreg} (x_3 \cos{x_2} - x_4 \sin{x_2}) \notag \\ & \;\, + K_i^{Ireg}(x_5 \cos{x_2} - x_6 \sin{x_2}) \notag \\ & \;\, - K_p^{Ireg} I_N^d \\ V_t^q &= K_p^{Ireg} K_p^{Vreg} \Big[\Big(V^* - \sqrt{(V_C^d)^2 + (V_C^q)^2}\Big)\sin{x_2} \notag \\ & \;\, - \big( K_p^{PLL} (-V_C^d \sin{x_2} + V_C^q \cos{x_2}) - K_i^{PLL} x_1 \big) \cos{x_2} \Big] \notag \\ & \;\, + K_p^{Ireg} K_i^{Vreg} (x_3 \sin{x_2} - x_4 \cos{x_2}) \notag \\ & \;\, + K_i^{Ireg}(x_5 \sin{x_2} - x_6 \cos{x_2}) \notag \\ & \;\, - K_p^{Ireg} I_N^q \label{E:Vf 12} \end{align} \end{comment} \begin{comment} \subsubsection{PQ Controlled Inverter Model} The PQ controlled inverter equations starting from the PCC point can be similarly written as follows, except for PQ controlled inverters the node voltage instead of the node current is taken as the input. \begin{align} \dot{x}_1 &= -V_N^d \sin{x_2} + V_N^q \cos{x_2} \label{E:PQ 1}\\ \dot{x}_2 &= K_p^{PLL} (-V_N^d \sin{x_2} + V_N^q \cos{x_2}) + K_i^{PLL} x_1 \\ \dot{x}_3 &= P^* - V_N^d I_N^d - V_N^q I_N^q \\ \dot{x}_4 &= -Q^* - V_N^d I_N^q + V_N^q I_N^d \\ \dot{x}_5 &= K_p^{PQreg} (P^* - V_N^d I_N^d - V_N^q I_N^q) \notag \\ & \;\, + K_i^{PQreg} x_3 - (I_N^d \cos{x_2} + I_N^q \sin{x_2}) \\ \dot{x}_6 &= K_p^{PQreg} (-Q^* - V_N^d I_N^q + V_N^q I_N^d) \notag \\ & \;\, + K_i^{PQreg} x_4 - (-I_N^d \sin{x_2} + I_N^q \cos{x_2}) \\ \dot{I}_L^d &= \omega\, I_L^q + \frac{1}{L} (V_t^d - V_N^d) \\ \dot{I}_L^q &= -\omega\, I_L^d + \frac{1}{L} (V_t^q - V_N^q) \\ \dot{I}_N^d &= \omega\, I_L^q + \frac{1}{L} (V_t^d - V_N^d) + \omega\,C\big[-\omega\,V_N^d + \frac{1}{C}(I_L^q - I_N^q)\big] \\ \dot{I}_N^q &= -\omega\, I_L^d + \frac{1}{L} (V_t^q - V_N^q) - \omega\,C\big[\,\omega\,V_N^q + \frac{1}{C}(I_L^d - I_N^d)\big] \end{align} where $V_t^d$ and $V_t^q$ are the voltage at the inverter terminal, which are given as the following \begin{align} V_t^d &= K_p^{Ireg} K_p^{PQreg} \big[(P^* - V_N^d I_N^d - V_N^q I_N^q)\cos{x_2} \notag \\ & \;\, - (-Q^* - V_N^d I_N^q + V_N^q I_N^d) \sin{x_2} \big] \notag \\ & \;\, + K_p^{Ireg} K_i^{PQreg} (x_3 \cos{x_2} - x_4 \sin{x_2}) \notag \\ & \;\, + K_i^{Ireg}(x_5 \cos{x_2} - x_6 \sin{x_2}) \notag \\ & \;\, - K_p^{Ireg} I_N^d \\ V_t^q &= K_p^{Ireg} K_p^{PQreg} \big[(P^* - V_N^d I_N^d - V_N^q I_N^q)\sin{x_2} \notag \\ & \;\, + (-Q^* - V_N^d I_N^q + V_N^q I_N^d) \cos{x_2} \big] \notag \\ & \;\, + K_p^{Ireg} K_i^{PQreg} (x_3 \sin{x_2} - x_4 \cos{x_2}) \notag \\ & \;\, + K_i^{Ireg}(x_5 \sin{x_2} - x_6 \cos{x_2}) \notag \\ & \;\, - K_p^{Ireg} I_N^q \label{E:PQ 12} \end{align} The PQ controlled inverter equations (\ref{E:PQ 1}) to (\ref{E:PQ 12}) is thus control affine with the state vector $\vect{x} = \big[x_1,\,x_2,\,x_3,\,x_4,\,x_5,\,x_6,\,I_L^d,\,I_L^q,\,I_N^d,\,I_N^q\big]^{\mathsf{T}}$ and the input vector $\vect{u} = \big[V_N^d,\,V_N^q\big]^{\mathsf{T}}$. The output to the transmission network is the node current $\vect{y} = \big[I_N^d,\,I_N^q\big]^{\mathsf{T}}$, which are state variables. The input functions $\vect{g}_1(\vect{x})$ and $\vect{g}_2(\vect{x})$ associated with each of the two input variables are given by \begin{align} &\vect{g}_1 = \Big[-\sin{x_2},\,-K_p^{PLL}\sin{x_2},\,-I_N^d,\,-I_N^q,\, \notag \\ & \qquad -K_p^{PQreg}I_N^d,\,-K_p^{PQreg} I_N^q,\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\cos{x_2} + I_N^q\sin{x_2}) - \frac{1}{L},\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\sin{x_2} - I_N^q\cos{x_2}),\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\cos{x_2} + I_N^q\sin{x_2}) - \frac{1}{L} - \omega^2 C,\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\sin{x_2} - I_N^q\cos{x_2})\, \Big]^{\mathsf{T}} \\ &\vect{g}_2 = \Big[\,\cos{x_2},\,K_p^{PLL}\cos{x_2},\,-I_N^q,\,I_N^d,\, \notag \\ & \qquad -K_p^{PQreg}I_N^q,\,K_p^{PQreg} I_N^d,\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^q\cos{x_2} - I_N^d\sin{x_2}),\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^q\sin{x_2} + I_N^d\cos{x_2}) - \frac{1}{L},\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\cos{x_2} + I_N^q\sin{x_2}),\, \notag \\ & \qquad \frac{K_p^{Ireg}K_p^{PQreg}}{L}(-I_N^d\sin{x_2} - I_N^q\cos{x_2}) - \frac{1}{L} - \omega^2 C\, \Big]^{\mathsf{T}} \end{align} \end{comment} \begin{comment} \subsubsection{Constant Power Load Model} The constant power load equations with input node voltage and output node current is given by the following algebraic equations. \begin{equation} \begin{bmatrix}[1.5] I_N^d \\ I_N^q \end{bmatrix} = \frac{1}{(V_N^d)^2 + (V_N^q)^2} \begin{bmatrix}[1.5] V_N^d &-V_N^q \\ V_N^q &V_N^d \end{bmatrix} \begin{bmatrix} P\\ Q \end{bmatrix}, \end{equation} where $P$ and $Q$ are the active and reactive power which are negative for positive loads. \end{comment} \begin{comment} \subsection{Proof of the evolution of time-varying observable} Assume $\varphi(\vect{x})$ is an observable function of the system (\ref{E:control_affine_system}) with the flow map $\vect{\Phi}_{\vect{u}}(t,\vect{x}_0) \in \mathbb{X}$ for any initial condition $\vect{x}_0 \in \mathbb{X}$, and $\psi(t,\vect{x})$ is the associated time-varying observable. \begin{align} &\quad\;\left[\frac{\partial \psi(t,\vect{x})}{\partial t}\right]_{\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)} \\ &= \frac{\partial}{\partial t} \varphi(\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)) \\ &= \left[\frac{\partial}{\partial t}\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)\right]\cdot \left[\nabla_{\vect{x}}\varphi(\vect{x})\right]_{\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)} \\ &= \Bigg[\Bigg(\vect{f}(\vect{x}) + \sum_{i=1}^m u_i \vect{g}_i(\vect{x})\Bigg)\cdot \nabla_{\vect{x}}\varphi(\vect{x})\Bigg]_{\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)} \\ &= \Bigg[\vect{f}(\vect{x})\cdot\nabla_{\vect{x}}\varphi(\vect{x}) + \sum_{i=1}^m u_i \vect{g}_i(\vect{x})\cdot\nabla_{\vect{x}}\varphi(\vect{x})\Bigg]_{\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)} \\ &= \Bigg[\vect{f}(\vect{x})\cdot\nabla_{\vect{x}}\psi(t,\vect{x}) + \sum_{i=1}^m u_i \vect{g}_i(\vect{x})\cdot\nabla_{\vect{x}}\psi(t,\vect{x})\Bigg]_{\vect{\Phi}_{\vect{u}}(t,\vect{x}_0)} \end{align} This is true for any $\vect{\Phi}_{\vect{u}}(t,\vect{x}_0) \in \mathbb{X}$. Thus we get, \begin{equation} \frac{\partial \psi(t,\vect{x})}{\partial t} = L_{\vect{f}}\psi(t,\vect{x}) + \sum_{i=1}^m u_i L_{\vect{g}_i} \psi(t,\vect{x})\qquad \blacksquare. \end{equation} \end{comment} \section{Conclusions} The paper contributes a scalable data-driven method, M-KBF, to efficiently model and predict the transient dynamics of nonlinear microgrids under disturbances. The data-driven modules for subsystems are developed through EDMD with eigenvalue-based order truncation and then integrated into a combined model for microgrid systems. Test results have demonstrated the effectiveness of M-KBF in providing fast and precise transient predictions. For future work, M-KBF will be further developed to handle data with noise, to identify the system by using output-only measurements like bus voltage and current, and to perform predictive control based on the predictions obtained from M-KBF. \section{Data-Driven Identification of KBF} The data-driven identification of the KBF equivalent model (\ref{E:KBF}) of DER subsystems is carried out through a least-squares formulation using a predetermined set of observable functions. The eigenfunction embeddings and the KBF system are identified simultaneously from the state and input measurements of the DER subsystems. The general rule of selecting a dictionary of observable functions is that these functions should span a rich subspace so that a certain set of eigenfunctions can be approximated by their projections onto this subspace. There are several choices of observable functions~\cite{bruce2019koopman}, including monomials, radial basis functions, Hermite polynomials, and Chebyshev polynomials. And in this work we choose monomial functions as the observable dictionary. In this paper, we use EDMD with additional bilinear inputs to identify the KBF model (\ref{E:KBF}). As will be shown in the subsection A, the KBF model identified in this way inherently satisfies the bilinearizability condition in Theorem~\ref{Thm_finite_bilinearizable}. \subsection{Approximated Eigenfunctions} \begin{comment} The eigendecomposition of $\est{\matr{A}}_d$ provides the Koopman eigenvalues and eigenfunctions of $L_{\vect{f}}$. Assume that $\est{\matr{A}}_d$ is diagonalizable, let the eigendecomposition of $\est{\matr{A}}_d$ be given as \begin{equation} \est{\matr{A}}_d = (\matr{W}^*)^{-1} \matr{D} \matr{W^*} \end{equation} with $\matr{W}$ being the left eigenvector matrix. Then the Koopman eigenfunctions can be approximated by $\vect{\Phi}(\vect{x}) = \matr{W^*}\vect{\Psi}(\vect{x})$. \end{comment} Given the conditions in Theorem~\ref{Thm_finite_bilinearizable}, the original system (\ref{E:control_affine_system}) can be identified by the surrogate KBF model (\ref{E:KBF}) in the coordinates of a finite set of eigenfunctions of $L_{\vect{f}}$. One option to approximate such eigenfunctions of $L_{\vect{f}}$ is by applying EDMD on the sampled trajectories of the system with zero inputs. Since the inputs to DER subsystems include node current or voltage that cannot be held constant during system transients, it is not feasible to independently identify the eigenfunctions using EDMD. Instead, the invariant eigenfunction embeddings and the bilinear system can be identified together using a predetermined dictionary of observable functions. The requirement on the observable functions is that their span approximates an invariant eigenspace of $L_{\vect{f}}$ w.r.t (\ref{E:evolution_PDE}) that is defined in Theorem~\ref{Thm_finite_bilinearizable}. Then given the KBF system (\ref{E:KBF}) and the observable functions $T(\vect{x})$, for each left eigenvector $\vect{w}_i$ and eigenvalue $\lambda_i$ of $\matr{A}$, $\hat{\phi}(\vect{x}) = \vect{w}_i^* T(\vect{x})$ is proved to be an eigenfunction of $L_{\vect{f}}$ with eigenvalue $\lambda_i$~\cite{proctor2016dynamic}. Assume that all eigenvalues of $\matr{A}$ are distinct. Denote the left eigenvector matrix $\matr{W}$ and eigenvalue matrix $\matr{D}$ of $\matr{A}$ such that $\matr{W}^* \matr{A} = \matr{D}\matr{W}^*$. Then the approximated eigenfunction embeddings $\tilde{\vect{z}} = \matr{W}^* \vect{z} = \matr{W}^*T(\vect{x})$ is a linear transformation of the predetermined observable function embeddings, which gives us the following KBF system with the eigenfunction embedded state, \begin{equation}\label{E:KBF_eigenfunction_coordinates} \dot{\tilde{\vect{z}}} = \matr{D} \tilde{\vect{z}} + \sum_{i=1}^m u_i \tilde{\matr{B}}_i \tilde{\vect{z}},\quad \tilde{\vect{z}}(0) = \matr{W}^*T(\vect{x}_0), \end{equation} where $\tilde{\matr{B}}_i = \matr{W}^* \matr{B}_i (\matr{W}^*)^{-1}$. \subsection{Discretization of KBF for Identification} \begin{comment} Since the measurement data and DMD are both in discrete time, the KBF system (\ref{E:KBF}) is assumed to be discretized in the following way \begin{equation}\label{E:discretized_KBF} \begin{split} \vect{z}[k+1] = \matr{A}_d \vect{z}[k] + \sum_{i=1}^{m_1} u_i[k+1] \matr{B}_{i,d}\vect{z}[k] + \\ \sum_{i=m_1+1}^{m} u_i[k+1] \matr{B}_{i,d}\vect{z}[k+1] \end{split} \end{equation} \hl{we need to explain the above equation carefully. Why do we split $m_1$ from m? } where the first $m_1$ input variables are multiplied with the current state vector and the other $m - m_1$ input variables are multiplied with the next-step state vector. Note that (\ref{E:discretized_KBF}) is an assumption on the training data by which we can apply DMD to get an approximate KBF system. Whether each input is multiplied with current-step or next-step state vector depends on the form of the original system (part of DAE) and the numerical method used for simulation. Once a transformed KBF system is obtained, the solution of the transformed system is not restricted by the discretization assumption (\ref{E:discretized_KBF}). Without loss of generality, in the following we assume that the inputs are all multiplied with the next-step state vector. \end{comment} Since the measurement data are sampled data, the continuous-time KBF system (\ref{E:KBF}) needs to be discretized to provide the discrete-time template for identification. Again, we assume that the span of the observable functions $T(\vect{x})$ is a subspace of invariant eigenspace of $L_{\vect{f}}$. \begin{comment} Suppose the sampling period is $\Delta t$, the KBF system is a linear time-varying system with the solution (\ref{E:LTV_solution}) for $\Delta t \geq 0$. \begin{equation}\label{E:LTV_solution} \vect{z}(t+\Delta t) = \exp\Bigg[\int_t^{t + \Delta t} \Bigg(\matr{A} + \sum_{i=1}^m u_i(s)\matr{B}_i\Bigg) ds \Bigg]\vect{z}(t) \end{equation} \end{comment} Assume the sampling period is $\Delta t$ and that the inputs $u_i(t)$ are constant within each time step (zero-order hold). The KBF system is linear time-invariant with the solution (\ref{E:LTI_solution}). \begin{equation}\label{E:LTI_solution} \vect{z}(t+\Delta t) = \exp\Bigg[\Bigg(\matr{A} + \sum_{i=1}^m u_i(t+\Delta t)\matr{B}_i\Bigg) \Delta t \Bigg]\vect{z}(t) \end{equation} \begin{comment} \begin{remark} Notice that from the transformed system (\ref{E:KBF_eigenfunction_coordinates}), $\matr{A}$ commutes with every $\matr{B}_i$ if $\matr{A}$ has full rank. Then the time-varying matrix $(\matr{A} + \sum_{i=1}^m u_i(t) \matr{B}_i)$ at any time instances $t$ and $\tau$ commute and hence the state transition matrix in (\ref{E:LTV_solution}) is a matrix exponential. \end{remark} \end{comment} \begin{comment} \begin{remark} The bilinearizability condition can actually be relaxed to only requiring the span of the observable functions to be an invariant subspace for both $L_{\vect{f}}$ and $L_{\vect{g}_i}$'s. In this case, the solution (\ref{E:LTV_solution}) do not apply in general. \end{remark} \end{comment} Then, by expanding (\ref{E:LTI_solution}) into Taylor series and taking the first order approximation on $\Delta t$, we can get the discretized KBF model in explicit (\ref{E:discrete_explicit}) and implicit (\ref{E:discrete_implicit}) forms: \begin{subequations}\label{E:discrete} \begin{align} \vect{z}_{k+1} &= \matr{A}^d\, \vect{z}_k + \sum_{i=1}^m u_{i,k+1} \matr{B}_i^d\, \vect{z}_k + \mathcal{O}(\Delta t^2), \label{E:discrete_explicit} \\ \vect{z}_{k+1} &= \matr{A}^d\, \vect{z}_k + \sum_{i=1}^m u_{i,k+1} \matr{B}_i^d\, \vect{z}_{k+1} + \mathcal{O}(\Delta t^2), \label{E:discrete_implicit} \end{align} \end{subequations} where $\matr{A}^d = \exp(\matr{A} \Delta t),\, \matr{B}_i^d = \matr{B}_i \Delta t$. \subsection{Least-Squares Formulation Suppose that a suitable dictionary of observable functions $T(\vect{x}) \in \mathbb{R}^q$ is selected, we can identify the discretized KBF models (\ref{E:discrete}) using least-squares formulation similar to EDMD~\cite{proctor2016dynamic}, which gives us the approximated eigenfunction coordinates and the KBF (\ref{E:KBF}). In the following, we assume that the explicit model (\ref{E:discrete_explicit}) is used, while the implicit model (\ref{E:discrete_implicit}) can be obtained in a similar way. Assume that the measurement data is collected from a single sampled trajectory which includes many transient responses of the DER under investigation. Denote the state and input vector data as $\vect{x}_k,\, \vect{u}_k$ for $k = 1,\, \ldots\,,\, N$. We will organize the measurement data into the following matrices: \begin{subequations} \begin{align} \matr{X}_1 &= \Big[T(\vect{x}_1),\, T(\vect{x}_2),\, \ldots \,,\, T(\vect{x}_{N-1})\Big], \\ \matr{X}_2 &= \Big[T(\vect{x}_2),\, T(\vect{x}_3),\, \ldots \,,\, T(\vect{x}_{N})\Big], \\ \matr{\Gamma}_i &= \Big[u_{i,2} T(\vect{x}_1),\, u_{i,3} T(\vect{x}_2),\, \ldots\,,\, u_{i,N} T(\vect{x}_{N-1})\Big]. \end{align} \end{subequations} Then, a least-squares problem based on the discrete-time model (\ref{E:discrete_explicit}) can be formulated in (\ref{E:ls_KBF}). \begin{subequations}\label{E:ls_KBF} \begin{align} &\;\min_{\matr{G}} \left\|\matr{X}_2 - \matr{G}\matr{\Omega} \right\|_F^2,\,\text{where} \label{E:ls_cost} \\ \matr{G} &= \Big[\matr{A}^d,\, \matr{B}_1^d,\, \ldots\,,\, \matr{B}_m^d\Big], \label{E:def_G}\\ \matr{\Omega} &= \Big[\matr{X}_1^{\mathsf{T}},\, \matr{\Gamma}_1^{\mathsf{T}},\, \ldots\,,\, \matr{\Gamma}_m^{\mathsf{T}}\Big]^{\mathsf{T}}. \end{align} \end{subequations} The solution to (\ref{E:ls_KBF}) is given by $\est{\matr{G}} = \matr{X}_2 \matr{\Omega}^{+}$. The pseudoinverse $\vect{\Omega}^{+}$ can be calculated from the singular value decomposition (SVD) of $\matr{\Omega} = \matr{U}\matr{\Sigma}\matr{V}^*$, where $\matr{\Sigma}$ is a diagonal matrix whose diagonal elements are the nonzero singular values in descending order, and $\matr{U}$ and $\matr{V}$ contain the corresponding left and right singular vectors. The pseudoinverse is \begin{equation}\label{E:singular_truncation} \matr{\Omega}^+ = \matr{V} \matr{\Sigma}^{-1} \matr{U}^*. \end{equation} \subsection{Singular Value Truncation} Since the assumed discretization of KBF is only first-order accurate w.r.t. the time step $\Delta t$ and the selected observable functions are usually not guaranteed to represent the eigenspace, using the exact pseudoinverse in the solution of (\ref{E:ls_KBF}) does not necessarily lead to optimal predictive accuracy. Therefore the solution of (\ref{E:ls_KBF}) is modified through the technique of singular value truncation. Assume that the number of singular values of $\matr{\Omega}$ is reduced to $r \leq q$. We get the truncated singular value matrix $\tilde{\matr{\Sigma}}\in \mathbb{R}^{r{\times} r}$ and singular vector matrices $\tilde{\matr{U}} \in \mathbb{R}^{mq{\times}r},\,\tilde{\matr{V}} \in \mathbb{R}^{N{\times}r}$. The regularized solution with singular value truncation is, \begin{equation} \est{\matr{G}} = \matr{X}_2 \tilde{\matr{\Omega}}^+ = \matr{X}_2 \tilde{\matr{V}} \tilde{\matr{\Sigma}}^{-1} \tilde{\matr{U}}^*. \end{equation} From the composition of the parameter matrix $\matr{G}$, the singular vector matrix $\tilde{\matr{U}} = \big[\tilde{\matr{U}}_0^{\mathsf{T}},\,\tilde{\matr{U}}_1^{\mathsf{T}},\,\ldots\,,\,\tilde{\matr{U}}_m^{\mathsf{T}}\big]^{\mathsf{T}}$ is split such that $\tilde{\matr{U}}_i \in \mathbb{R}^{q{\times}r}$ to get the discretized KBF system matrices, \begin{equation}\label{E:unreduced_KBF} \est{\matr{A}}^d = \matr{X}_2 \tilde{\matr{V}} \tilde{\matr{\Sigma}}^{-1} \tilde{\matr{U}}_0^*,\quad \est{\matr{B}}_i^d = \matr{X}_2 \tilde{\matr{V}} \tilde{\matr{\Sigma}}^{-1} \tilde{\matr{U}}_i^*. \end{equation} Assume that $\matr{P} = \matr{X}_2 \tilde{\matr{V}}$ has full column rank $r$, so that the data matrices are linearly consistent, i.e., $\mathrm{Ker}(\matr{X}_2) \subseteq \mathrm{Ker}(\tilde{\matr{\Omega}})$~\cite{tu2014}, then we can reduce the dimension of the identified discrete KBF model by taking the state transform $\bar{\vect{z}} = \matr{P}^+ \vect{z}$, which gives us the reduced KBF model, \begin{subequations}\label{E:reduced_KBF} \begin{align} \bar{\vect{z}}_{k+1} &= \bar{\matr{A}}^d \bar{\vect{z}}_k + \sum_{i=1}^m u_{i,k+1} \bar{\matr{B}}_i^d \bar{\vect{z}}_k,\,\text{where}\\ \bar{\matr{A}}^d &= \tilde{\matr{\Sigma}}^{-1} \tilde{\matr{U}}_0^*\matr{X}_2 \tilde{\matr{V}},\\ \bar{\matr{B}}_i^d &= \tilde{\matr{\Sigma}}^{-1} \tilde{\matr{U}}_i^*\matr{X}_2 \tilde{\matr{V}}. \end{align} \end{subequations} It can be checked that the reduced system (\ref{E:reduced_KBF}) preserves the dynamics of the unreduced system (\ref{E:unreduced_KBF}) by observing that $\bar{\matr{A}}^d$ and $\est{\matr{A}}^d$ share the same nonzero eigenvalues (see~\cite{butler2015facts}) and the same is true between $\bar{\matr{B}}_i^d$ and $\est{\matr{B}}_i^d$. In summary, the benefits for using singular value truncation include the following. (i) Reduce KBF model order in (\ref{E:reduced_KBF}); (ii) Form linear consistency between $\matr{X}_2$ and $\tilde{\matr{\Omega}}$ where the reduced $\tilde{\matr{\Omega}}$ is almost the same as $\matr{\Omega}$; and (iii) SVD truncation in effect adds $l_2$ regularization to the elements of $\matr{G}$~\cite{lawson1995solving}, which in discrete-time makes the solution more stable. \subsection{Original State Reconstruction} Since the monomial functions used as observable functions $T(\vect{x})$ contains the original state variables $\vect{x}$, the original state can be reconstructed linearly by extracting out their entries using a constant matrix $\matr{C}^{\vect{x}}$ as in $\vect{x} = \matr{C}^{\vect{x}} \vect{z}$. For the reduced model (\ref{E:reduced_KBF}) with the reduced observable function embedding, the hypothetical linear reconstruction takes the form $\vect{x}_{recon} = \matr{C}^{\vect{x}}\matr{P}\tilde{\vect{z}} = \matr{C}^{\vect{x}}\matr{P}\matr{P}^+\vect{z}$. However, the loss of information due to the dimension reduction of $\tilde{\vect{z}}$ may prevent the complete linear reconstruction of the original states. The information loss turns out to be the case for the Vf model in our example but not for the PQ model, and therefore the system (\ref{E:unreduced_KBF}) is used for the Vf model in order to preserve linear reconstruction. \begin{comment} Suppose that $r$ singular values of $\matr{\Omega}$ are retained, the regularized solution is given by \begin{equation}\label{E:regularized_ls_solution} \est{\matr{G}} = \matr{\Psi}_{\matr{Y}} \matr{V}_r \matr{\Sigma}_r^{-1} \matr{U}_r^*. \end{equation} If we assume that $\matr{\Psi}_{\matr{Y}}$ is full rank, then $\est{\matr{G}}$ has rank $r$. From the definition of $\matr{G}$ in (\ref{E:def_G_Omega}), the approximate KBF system matrices with observable functions embeddings $\vect{\Psi}(\vect{x})$ can be recovered to get the system \begin{equation}\label{E:observable_sys} \vect{z}[k+1] = \est{\matr{A}}_d \vect{z}[k] + \sum_{i=1}^m u_i[k+1]\,\est{\matr{B}}_{i,d} \vect{z}[k+1]. \end{equation} However, the system (\ref{E:observable_sys}) is not necessarily capable of being transformed to have the basis of eigenfunctions. If $\mathrm{rank}(\est{\matr{A}}_d) = r$ so that there are $r$ eigenfunctions associated with nonzero eigenvalues, then $\mathrm{range}(\est{\matr{B}}_{i,d}) \subseteq \mathrm{range}(\matr{W}_r)$ where $\matr{W}_r \in \mathbb{C}^{N \times r}$ is the truncated left eigenvector matrix associated with nonzero eigenvalues with the truncated eigenvalue matrix $\matr{D}_r$. This is equivalent to the bilinearizability condition of Theorem 2 in the vector space of the observable functions. Then with the approximated eigenfunctions embedding $\vect{w} = \matr{W}_r^*\vect{z}$, the $r$ dimensional KBF system is written as \begin{equation}\label{E:approx_KBF} \vect{w}[k+1] = \matr{D}_r \vect{w}[k] + \sum_{i=1}^m u_i[k+1]\, \matr{B}_{i,r} \vect{w}[k+1], \end{equation} with the input mapping given by \begin{equation}\label{E:approx_input_mapping} \matr{B}_{i,r} = \matr{W}_r^* \est{\matr{B}}_i (\matr{W}_r^*)^+,\,i = 1,\ldots,m. \end{equation} Finally, the state vector in (\ref{E:approx_KBF}) is transformed using Koopman Canonical Transform (KCT) defined in~\cite{surana2016koopman} so that $\matr{D}_r$ becomes block diagonal and the embedding functions are real valued. \end{comment} \section{Introduction} \PARstart{D}{istributed} Energy Resources (DERs), such as photovoltaic (PV) and wind power, is seen as a great opportunity to achieve the target of modernizing the power systems. Microgrids have been developed to integrate those DERs. Considering most DERs are integrated into microgrids through power-electronic interfaces, the system’s inertia is significantly reduced. Consequently, microgrids are sensitive to disturbances like PV fluctuations and load disturbances; and thus, it is of primary importance to investigate the transient dynamics of microgrids subjected to disturbances. Efforts on the modeling and control of transient dynamics since the 1980s mainly focused on the mathematical model-based simulation and analysis~\cite{sobbouhi2021transient}. Despite that several control approaches have been developed for stabilizing the system during transients, it is still elusive that \emph{how to analyze and predict the system's transient dynamics when an accurate system model is unavailable.} The rapidly developing machine learning and artificial intelligence technologies~\cite{li2021determination, adibi2019reinforcement, madani2021data} provide a potent means to resolve this challenge from the data-driven perspective. Recognizing the fact that microgrid is a quintessentially nonlinear dynamical system, there are several existing data-driven approaches to identify the transient dynamics model of a nonlinear system through its operating data. They can fall into three major categories: (1) linear models as local linearization of a globally nonlinear system, (2) nonlinear models to directly capture the global nonlinearity, and (3) linear models in the embedded space to reproduce the global nonlinearity. First, the local linear models are the most commonly used system identification method and develop a high-order linear system with input and output to approximate the system dynamics near an equilibrium point. From the perspective of linear system identification~\cite{a299a76f179d4ebba7c9872e1aced639}, existing methods include Prony analysis~\cite{119247, 5275444} and state space methods, e.g., Minimal Realization algorithm~\cite{260898}, Eigenvalue Realization Algorithm (ERA)~\cite{780912}, Matrix Pencil method~\cite{6024892}, Hankel Total Least Squares (HTLS)~\cite{4410548}, subspace identification~\cite{9609618}, Dynamic Mode Decomposition (DMD)~\cite{6982236}, etc. Beyond the linear system perspective, there are nonparametric spectrum estimation such as Welch periodgram~\cite{stoica2005spectral} and parametric methods, including Yule-Walker~\cite{anderson2005bootstrap}, Frequency Domain Decomposition~\cite{liu2008oscillation}, etc. These aforementioned approaches generate accurate model for linear systems given sufficient system responses and are straightforward to perform with guaranteed convergence. However, the linear system methods do not have the extrapolation ability due to their nature of local linearization; and thus, it is not suitable to directly apply them to identify microgrid systems that are typically nonlinear for the entire operating envelope. Second, several data-driven methods have also been developed to identify a nonlinear system to capture the transient dynamics globally over the entire state space. Representative methods include Taylor series~\cite{8598677}, Volterra series~\cite{1546078}, Sparse Identification (SINDy)~\cite{brunton2016discovering}, etc. These methods can theoretically identify an accurate model if the correct nonlinear terms are used. However, their implementation usually result in a non-convex optimization formulation and need a large computational effort; and the identified models are limited by the high algorithmic complexity in the prediction stage, which poses a challenge for control applications. Third, to reconcile the dilemma between local linearization and global nonlinearity, the global linearization method, represented by the Koopman operator theory, has been seen as a promising paradigm for the data-driven modeling and control of nonlinear systems~\cite{mezic2005spectral,mezic2004comparison,mezic2021koopman,BEVANDA2021197,budivsic2020koopman} and has been widely used in the domain of power systems~\cite{susuki2011nonlinear,korda2018power,sharma2021data}. The Koopman theory states that a nonlinear dynamical system can be represented using an infinite-dimensional linear operator, that is characterized by an infinite set of eigenvalues and eigenfunctions, or eigenpairs, on the so-called embedded space. Using a converged, truncated set of eigenpairs, the nonlinear dynamics can be represented by a finite-dimensional linear system on a Koopman invariant embedded subspace with the eigenfunctions as new coordinates. Compared to the traditional nonlinear system identification models, the Koopman-based model evolves linearly in the embedded space, leading to a simplified representation of the original nonlinear system that is amenable for efficient control applications. In the Koopman theoretic framework, the data-driven modeling centers on the identification of a set of eigenpairs that is sufficiently comprehensive to represent the nonlinear dynamics linearly in the embedded subspace and reconstruct it in the original state space. The eigenfunctions are usually constructed as functionals of the observable functions of the state variables in the nonlinear dynamics. The existing methods for identifying Koopman eigenfunctions can generally be divided into two types. The first type is the Extended Dynamic Mode Decomposition (EDMD) and its variants, where a predetermined set of observable functions is given~\cite{williams2015data}. The observable functions lift the original state in the training data into an embedded space, on which a linear system identification method such as DMD can be applied to identify a linear model as well as a Koopman invariant subspace spanned by the correspondingly approximated Koopman eigenfunctions. The set of observable functions are required to approximate a Koopman invariant subspace as much as possible; otherwise, the identified model may be no better than a local linear model. Moreover, the EDMD-type methods are usually limited by the curse of dimensionality, as the number of observable functions may grow exponentially with the number of states, which makes this type of method infeasible to directly use for identifying high-dimensional nonlinear dynamical systems like power systems and microgrids. The second type of Koopman methods directly solves for Koopman eigenfunction basis to build the linear system~\cite{folkestad2020extended,korda2020optimal}. This type of methods exploit the connection of the Koopman operators to state-space geometry either within a basin of attraction or off-attractor. And hence, they are limited in the case where the state-space geometry is altered by inputs. To predict transient dynamics in the Koopman framework, inputs that represent the disturbances and cause the transient response need to be included in the linear evolution of eigenfunctions. Previously, the nonlinear system's inputs were added to the Koopman model linearly, which resulted in a linear system with inputs~\cite{korda2018power}. However, this assumption applied to the function space is not consistent with how the inputs influence the dynamics of the original nonlinear system in the state space, which significantly limits the applicable range of Koopman model. Recently, Koopman model called Koopman Bilinear Form (KBF) in the context of control-affine systems were proposed in~\cite{goswami2021bilinearization,peitz2020data}, where the bilinear input has a precise connection to the original state-space input. In this paper, a Modularized Koopman Bilinear Form (M-KBF) is developed as a scalable data-driven modeling approach for efficiently predicting the transient dynamics of microgrids integrated with power-electronics-interfaced DERs. The data-driven modeling of a whole microgrid system is divided into the separate identification of backbone subsystem and DERs dynamics. KBF is used to develop a precise data-driven model for each DER, since the typical power-electronics-interfaced DERs have been determined to be control-affine to the input disturbance from the current or voltage at the DER integration point. The identified KBF modules for DERs are then integrated into the backbone subsystem to assemble the entire data-driven model for the whole microgrid. The novelties of the presented work are summarized below. \begin{enumerate} \item M-KBF unlocks the potential of KBF for high-dimensional nonlinear systems by overcoming the curse of dimensionality. It develops the data-driven model of high-dimensional systems by first breaking it into several manageable subsystems that each is modeled by a KBF model and then connecting the subsystems via the accurately modeled inputs. \item M-KBF offers modularity in both data-driven modeling and prediction. It does not need to send high volume data to a central computational resource; and thus, issues caused by data acquisition like data privacy and poisoning can be alleviated or fully avoided. Meanwhile, local distributed computational resources can be exploited for identifying large-scale dynamical systems. \item The modularity design enables M-KBF with the plug-and-play versatility. The KBF models for subsystems can be built from a relatively small amount of training data of only the subsystem under consideration. Moreover, the identified KBF models for subsystems like DERs can be repeatedly used for other systems, which is advantageous over previous data-driven methods in the Koopman framework that focus on modeling the whole system. \item M-KBF ensures accurate predictions because each identified KBF models are independent to the initial choice of the global DQ reference frame, which is found to be important for nonlinear system identification. It is realized by introducing random DQ frames to the measurement data set. This property signifies a major difference to the linear data-driven models. \end{enumerate} Besides, considering the fact that the voltage and current usually respond to input change with no time delay, a modification to the explicit solution procedure for the connected data-driven model is also presented to reduce its intrinsic time delay effect on prediction. The prediction obtained from M-KBF can potentially be applied to provide guidance for system control, such as performing model predictive control, which is the authors' next work. The reminder of the paper is organized as follows. Section II establishes the modularized Koopman bilinear form. Section III introduces the determination of eigenfunctions through the EDMD method with order truncation. Section IV presents the prediction of transient dynamics based on M-KBF. In Section V, tests on a microgrid system verify the effectiveness and efficiency of the presented method in modeling and predicting transients. Conclusions are drawn in Section VI. \section{Prediction of the Whole Dynamical System} Based on the data-driven modules for the network, the individual models of grid-forming DERs, grid-following DERs, and power loads can be connected to form a data-driven model for the whole microgrid system, for the prediction of its transients. The prediction loop that connects each subsystems is provided in Algorithm~\ref{alg_prediction}, where the Vf and PQ controls are used for grid-forming and grid-following DER controls, respectively, and constant power loads are used as an example. Nonetheless, it can be easily modified to ZIP loads or include more comprehensive load dynamics. Note that in order to identify an accurate KBF from data, we find that it is important to use the explicit form (\ref{E:discrete_explicit}) for the PQ controlled DER subsystem and implicit form (\ref{E:discrete_implicit}) for the Vf controlled DER subsystem. The main difference between these two DERs lies in that the Vf control has node voltage as an output while the PQ control has node voltage as an input. In particular, the dynamics of both types of DERs depend on their PLL state to establish the controller reference frame, which always depends on the node voltage in the same time step. Since the node voltage is an internal state in the Vf model that needs to be solved for, it follows that an implicit form need to be used. For the PQ model, the explicit form is due to the more reactive nature of the grid-following control where the node voltage is a direct input to the model. To simplify notation, we partition all the nodes in the system into Vf node $\mathcal{P}_1$, PQ nodes with no local load $\mathcal{P}_{2a}$, PQ nodes with local load $\mathcal{P}_{2b}$, and load-only nodes $\mathcal{P}_{2c}$, after Kron reduction. Assume that the following information is given for prediction: the initial state of the Vf inverter subsystem $\vect{x}^p_0,\, p \in \mathcal{P}_1$, initial states of the PQ inverter subsystems $\vect{x}^p_0, p \in \mathcal{P}_{2a} \cup \mathcal{P}_{2b}$, the initial mixed node current and voltage vector $\vect{u}_0$ (input to the map given by the hybrid matrix $\vect{y} = \matr{H}\vect{u}$ as in (\ref{Eq_Hmatrix})), power loads $S_k$, and PQ inverter references $R_k$ for $k = 1,\, \ldots\,,\,PredLength$. The function \texttt{shiftPhase} transforms the input and output variables of each DER model between the global and local reference frames. This point is further explained in Section V-D. \begin{algorithm} \caption{M-KBF Enabled Prediction Algorithm \label{alg_prediction} \SetKwInOut{KwIn}{Input} \SetKwInOut{KwOut}{Output} \SetKwFunction{shiftPhase}{shiftPhase} \SetKwFunction{VfModel}{VfModel} \SetKwFunction{PQModel}{PQModel} \newcommand\mycommfont[1]{\small\ttfamily\textcolor{blue}{#1}} \SetCommentSty{mycommfont} \KwIn{KBF models $\pi_1$ (implicit) for Vf inverter and $\pi_2$ (explicit) for PQ inverter, and hybrid network parameter matrix $\matr{H}$ for the grid} \KwOut{Node voltage and current in $\vect{y}_k$ and $\vect{u}_k$} $\vect{x}^p_0 = \shiftPhase(\vect{x}^p_0,-x_{2,0}^p)$\; $\vect{z}^p_0 = \matr{P}_{\pi_1}^+ T_{\pi_1}(\vect{x}^p_0),\, p \in \mathcal{P}_1$\; $\vect{z}^p_0 = \matr{P}_{\pi_2}^+ T_{\pi_2}(\vect{x}^p_0),\, p \in \mathcal{P}_{2a} \cup \mathcal{P}_{2b}$\; \For{$k \leftarrow 0$ \KwTo $PredLength$}{ $\vect{y}_k = \matr{H}\,\vect{u}_k$\; $\vect{u}_{k+1} = \vect{u}_{k}$\; \For(\tcp*[h]{Load change}){$p \in \mathcal{P}_{2b} \cup \mathcal{P}_{2c}$}{ $\vect{u}^p_{k+1} \mathrel{+}= \overline{(S^p_{k+1}-S^p_k)/\vect{y}^p_k}$\; } $\vect{y}_{k+1} = \matr{H}\,\vect{u}_{k+1}$\; \For(\tcp*[h]{Redo load current}){$p \in \mathcal{P}_{2b} \cup \mathcal{P}_{2c}$}{ $\vect{u}^p_{k+1} = \overline{S^p_{k+1}/\vect{y}^p_{k+1}}$\; } \For(\tcp*[h]{PQ inverter}){$p \in \mathcal{P}_{2a} \cup \mathcal{P}_{2b}$}{ $\tilde{\vect{y}}^p_{k+1} = \shiftPhase(\vect{y}^p_{k+1},-x_{2,0}^p)$\; $\vect{z}^p_{k+1} = \PQModel(\vect{z}^p_k,\tilde{\vect{y}}^p_{k+1},R^p_{k+1})$\; $\vect{x}^p_{k+1} = \matr{C}^{\vect{x}}_{\pi_1} \matr{P}_{\pi_1} \vect{z}^p_{k+1}$\; \eIf{$p \in \mathcal{P}_{2b}$}{ $\vect{u}^p_{k+1} \mathrel{+}= \shiftPhase(\matr{C} \vect{x}^p_{k+1},x_{2,0}^p)$\; }{ $\vect{u}^p_{k+1} = \shiftPhase(\matr{C} \vect{x}^p_{k+1},x_{2,0}^p)$\; } } $\vect{y}_{k+1} = \matr{H}\,\vect{u}_{k+1}$\; \For(\tcp*[h]{Vf inverter}){$p \in \mathcal{P}_1$}{ $\tilde{\vect{y}}^p_{k+1} = \shiftPhase(\vect{y}^p_{k+1},-x_{2,0}^p)$\; $\vect{z}^p_{k+1} = \VfModel(\vect{z}^p_k,\tilde{\vect{y}}^p_{k+1})$\; $\vect{x}^p_{k+1} = \matr{C}^{\vect{x}}_{\pi_2} \matr{P}_{\pi_2} \vect{z}^p_{k+1}$\; $\vect{u}^p_{k+1} = \shiftPhase(\matr{C}\vect{x}^p_{k+1},x_{2,0}^p)$\; } } \end{algorithm} \section{Numerical Examples} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{Figures/microgrid.pdf} \caption{A typical microgrid test system} \label{microgrid_testsystem} \end{figure} A typical microgrid system shown in Fig.~\ref{microgrid_testsystem} is used to test and verify the effectiveness of the M-KBF method for modeling and predicting the nonlinear transient dynamics of the microgrid. The test system includes 35 buses, one Vf-controlled DER, ten PQ-controlled DERs, and eight constant power loads. For the details of the system, the reader is referred to~\cite{li2021cyber}. For one thing, synthetic data is prepared by modeling the test system via a set of Differential Algebraic Equations (DAEs) and simulating it through the Numerical Differenciation Formula (NDF) method with a fixed step size of $10^{-3}$ second. For another, simulations of the test system's transient responses to disturbances are performed to provide training data for M-KBF to identify the data-driven model and then predict the system's transient dynamics. Each transient response is induced by an approximated step change in constant power loads and/or power references of PQ-controlled DERs. In practice, the training data set is obtained from the measurement of the controller and the RLC filter through the advanced metering infrastructure. Note that in the test system, the dynamical model for all PQ-controlled DERs are identical, only with different power outputs. It is designed to demonstrate that the identified KBF model can be repeatedly used to efficiently identify the whole system, so as to show that the modularity of M-KBF leads to its plug-and-play versatility. The M-KBF results are analyzed from the following four aspects. \begin{comment} \begin{figure} \centering \begin{subfigure}[b]{0.237\textwidth} \includegraphics[width=\textwidth]{Figures/Vf_eigenvalue_2nd.pdf} \caption{Order truncation for Vf model with $2^{\text{nd}}$ order monomials} \label{fig_Vf_eigenvalue_2nd} \end{subfigure} \hfill \begin{subfigure}[b]{0.236\textwidth} \includegraphics[width=\textwidth]{Vf_eigenvalue_3rd.pdf} \caption{Order truncation for Vf model with $3^{rd}$ order monomials} \label{fig_Vf_eigenvalue_3rd} \end{subfigure} \begin{subfigure}[b]{0.237\textwidth} \includegraphics[width=\textwidth]{PQ_eigenvalue_2nd.pdf} \caption{Order truncation for PQ model with $2^{nd}$ order monomials} \label{fig_PQ_eigenvalue_2nd} \end{subfigure} \hfill \begin{subfigure}[b]{0.232\textwidth} \includegraphics[width=\textwidth]{PQ_eigenvalue_3rd.pdf} \caption{Order truncation for PQ model with $3^{rd}$ order monomials} \label{fig_PQ_eigenvalue_3rd} \end{subfigure} \caption{Caption} \label{fig:eigenvalue} \end{figure} \end{comment} \subsection{Data-Driven Modeling for Individual DER via KBF} The synthetic training data for the Vf-controlled DER are the transient responses of the DER under random changes of power loads and other DERs' outputs, where the changes in this paper is designed up to $\pm80\%$ of their nominal values. The training data for the PQ-controlled DERs are the synthetic combined transient responses of the DERs 13, 16, 18, and 20, under random changes of their power outputs that are up to $\pm20\%$ of their nominal values. While both the $2^{\text{nd}}$-order and $3^{\text{rd}}$-order monomials can accurately predict the DER's transient responses up to $\pm80\%$ changes of power loads (or DER outputs), Fig.~\ref{fig:monomial_order_Vf} and Fig.~\ref{fig:monomial_order_PQ} show the individual model predictions in response to up to $\pm100\%$ input changes. \begin{figure} [!t] \centering \includegraphics[width=0.5\textwidth]{Figures/vf-single.pdf} \caption{Prediction of Vf-controlled DER under disturbances in the $100\%$ range} \label{fig:monomial_order_Vf} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.5\textwidth]{Figures/pq-single.pdf} \caption{Prediction of PQ-controlled DER on node 31 under disturbances in the $100\%$ range} \label{fig:monomial_order_PQ} \end{figure} From the predictions, we can see that observables play an essential role in identifying the data-driven model and predicting transient dynamics, in particular when the system is under large disturbances. Detailed comparisons are: \begin{itemize} \item The prediction through the KBF model obtained by the $3^{\text{rd}}$-order monomials remains accurate when the system is under $\pm100\%$ changes (note the training data is up to $\pm80\%$ changes), for both Vf- and PQ-controlled DERs. \item The prediction based on the $2^{\text{nd}}$-order monomials experiences equilibrium point drifts for Vf-controlled DER model, which causes the deviation from the true data. \item The $1^{\text{st}}$-order KBF provides false prediction for the Vf-controlled DER as shown in Fig.~\ref{fig:monomial_order_Vf}; and the prediction trajectory quickly diverges for the PQ-controlled DERs, which is too large to show in Fig.~\ref{fig:monomial_order_PQ}. \end{itemize} \begin{comment} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{Figures/monomial_order_Vf.pdf} \caption{Prediction of Vf controlled DER under disturbances in the $100\%$ range} \label{fig:monomial_order_Vf} \end{figure} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{Figures/monomial_order_PQ.pdf} \caption{Prediction of PQ controlled DER on node 31 under disturbances in the $100\%$ range} \label{fig:monomial_order_PQ} \end{figure} \end{comment} \begin{comment} \begin{figure} \centering \begin{subfigure}[b]{0.5\textwidth} \includegraphics[width=\textwidth]{Figures/Vf_eigenvalue_unreduced.pdf} \caption{Identified Koopman eigenvalues without SVD truncation (Blue shows the SVD truncation order)} \hspace{0.1in} \label{fig:Vf_eigenvalue_unreduced} \end{subfigure} \begin{subfigure}[b]{0.5\textwidth} \includegraphics[width=\textwidth]{Figures/Vf_eigenvalue_reduced.pdf} \caption{Identified Koopman eigenvalues with SVD truncation (Blue shows the SVD truncation order)} \label{fig:Vf_eigenvalue_reduced} \end{subfigure} \caption{The effect of SVD truncation} \label{fig:Vf_eigenvalue} \end{figure} \end{comment} \subsection{SVD Order Truncation and Eigenfunctions} \begin{comment} Fig.~\ref{fig:eigenvalue} show the distribution of the real parts of the Koopman eigenvalues for Vf and PQ subsystems respectively when no SVD truncation is applied to the data matrix $\matr{\Omega}$. Fig. \ref{fig:Vf_eigenvalue}a shows the case when second order monomials are used as the observable dictionary and Fig. \ref{fig:Vf_eigenvalue}b shows when third order monomials are used as dictionary. In all cases, we find that there is a range of singular value truncation orders for which the resulting KBF system is stable, which are indicated by the dashed lines. Moreover, the best choice of SVD reduction order is at the bottom of the second step of eigenvalues calculated without SVD reduction, which are clearly seen in Fig. \ref{fig:Vf_eigenvalue}a and \ref{fig:PQ}b. For the Vf model, the SVD truncation order is $56$ for second order monomials and $155$ for third order monomials. For the PQ model, the SVD truncation order is $70$. \end{comment} In order to obtain an appropriate KBF model for prediction and overcome the discretization error when arriving at the template model (\ref{E:discrete}), it is necessary to apply singular value truncation to the data matrix. Here we show that an optimal truncation order can be inferred by the eigenavlue distribution. Fig.~\ref{fig:Vf_eigenvalue_unreduced} shows the distribution of the approximated Koopman eigenvalues on the Vf model with monomial observables of up to $3^{\text{rd}}$ order before and after the optimal truncation order of $155$ is applied. We can see that: \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/eigenvalues.pdf} \caption{Identified Koopman eigenvalues before (a) and after (b) SVD truncation (Blue shows the SVD truncation order)} \hspace{0.1in} \label{fig:Vf_eigenvalue_unreduced} \end{figure} \begin{itemize} \item Before the SVD order truncation is applied to the KBF model solution, there exists an eigenvalue pattern repetition of the first $155$ eigenvalues, as illustrated by the black dashed lines in Fig.~\ref{fig:Vf_eigenvalue_unreduced}~(a). This is due to the fact that the sum of two Koopman eigenvalues is another Koopman eigenvalue with the associated eigenfunction being the product of the two existing eigenfunctions, as given in (\ref{E:eigenvalue_group}). As a consequence, the repeated eigenvalues to the left correspond to higher-order eigenfunctions that are less likely to be approximated accurately by the monomials of lower orders, which may result in an unstable KBF model for prediction. \item After the SVD truncation is applied, the identified Koopman eigenvalues contain no repetitive pattern and the associated eigenfunctions can be well approximated by the selected low-order monomials so that the resulting KBF model is not only stable but can accurately represent the dynamics of the DER subsystem, as has been demonstrated in Fig.~\ref{fig:monomial_order_Vf} and Fig.~\ref{fig:monomial_order_PQ}. \end{itemize} We have tested Vf- and PQ-controlled DER models with both the $2^{\text{nd}}$-order and $3^{\text{rd}}$-order monomials and find that in each setup there is a narrow range of SVD truncation order that results in the KBF model having the lowest prediction error. The optimal truncation order is inferred by the distribution of the identified Koopman eigenvalues obtained without truncation as in Fig.~\ref{fig:Vf_eigenvalue_unreduced}~(a) by retaining only the number of eigenvalues with no repetitive pattern. The coefficient matrices of the identified eigenfunction embeddings with the optimal SVD truncation orders for the Vf and PQ models are shown in Fig.~\ref{fig:Vf_eigenfunction} and Fig.~\ref{fig:PQ_eigenfunction}, where the complex coefficients are projected onto the real domain by Koopman canonical transform~\cite{surana2016koopman}. The vertical axes in both figures correspond to the eigenfunctions in the descending order of the real parts of their eigenvalues. The yellow rectangle in each figure shows that these eigenfunctions have large coefficients corresponding to the voltage and current variables in the DER subsystem, which agrees with the fact that these variables have fast dynamics in the solution of the DAEs. \begin{comment} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{Figures/Vf_eigenfunction.pdf} \caption{Eigenfunction coefficients for Vf model} \label{fig:Vf_eigenfunction} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.48\textwidth]{Figures/PQ_eigenfunction.pdf} \caption{Eigenfunction coefficients for PQ model} \label{fig:PQ_eigenfunction} \end{figure} \end{comment} \begin{comment} \begin{figure} \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width=\textwidth]{Figures/fig_whole_system_voltage.pdf} \caption{Whole system node voltage prediction with $100\%$ load and reference changes using $3^{rd}$ order Vf and PQ models} \label{fig_whole_system_voltage} \vspace{0.1in} \end{subfigure} \begin{subfigure}[b]{0.236\textwidth} \includegraphics[width=\textwidth]{Figures/fig_whole_system_b.pdf} \caption{Voltage amplitude zoom in} \label{fig_Vf_eigenvalue_3rd} \end{subfigure} \begin{subfigure}[b]{0.237\textwidth} \includegraphics[width=\textwidth]{Figures/fig_whole_system_c.pdf} \caption{Voltage angle zoom in} \label{fig_PQ_eigenvalue_2nd} \end{subfigure} \caption{Caption} \label{fig:my_label} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.46\textwidth]{Figures/prediction_pq.pdf} \caption{PQ 50\% connected} \label{fig:connected_PQ} \end{figure} \end{comment} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/vf-single-monomials.pdf} \caption{Eigenfunction coefficients for Vf model} \label{fig:Vf_eigenfunction} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/pq-single-monomials.pdf} \caption{Eigenfunction coefficients for PQ model} \label{fig:PQ_eigenfunction} \end{figure} \subsection{Prediction based on M-KBF and Error Analysis} Based on Algorithm~\ref{alg_prediction}, we can integrate the identified KBF modules to perform the entire system's transient prediction. Fig.~\ref{fig:whole_sys_voltage} and Fig.~\ref{fig:whole_sys_current} show the voltage and current predictions of the connected M-KBF model under $\pm100\%$ range disturbances. From the predictions, we can see that: \begin{itemize} \item The Vf model trained on $\pm80\%$ range data is capable of predicting $\pm100\%$ range disturbances in the network. The PQ model trained on $\pm20\%$ range data from DERs 13, 16, 18, and 20, is capable of predicting every PQ-controlled DER in $\pm100\%$ range disturbance situations, as shown in Fig.~\ref{fig:whole_sys_voltage} and Fig.~\ref{fig:whole_sys_current}. \item The predictions demonstrate the M-KBF's plug-and-play function, since the identified KBF model for PQ-controlled DERs is repeatedly used in the system. \item The prediction error for each DER model is smaller in the connected system than that in the individual test because each DER model's input in the connected system is a dynamic feedback from the rest of the system. \end{itemize} The average prediction error of the M-KBF system with $2^{\text{nd}}$-order and $3^{\text{rd}}$-order monomials when the sytem is under different ranges of disturbances are provided in Fig.~\ref{fig:error_bar}. Overall, it shows the error increases as the disturbance increases. When the Vf model adopts the $3^{\text{rd}}$-order implicit prediction, we have the smallest errors compared to the $2^{\text{nd}}$-order implicit and $3^{\text{rd}}$-order explicit predictions. However, it needs a high computational effort, as summarized in Table~\ref{Table_error}, which is tested on a 2.9GHz PC. Note that Table~\ref{Table_error} also shows that M-KBF enables faster than real-time predictions, which provides space for performing predictive control to the dynamical system. \begin{table}[h!] \caption{Average computational time for $20s$ prediction of the whole system with different Vf models}\label{Table_error} \centering \scriptsize \begin{tabular}{c c c c} \toprule[1.5pt] $2^{\text{nd}}$-order(explicit) & $2^{\text{nd}}$-order(implicit) & $3^{\text{rd}}$-order(explicit)& $3^{\text{rd}}$-order(implicit) \\ \hline $5.0064$s & $6.2007$s & $7.6465$s & $20.6726$s \\ \bottomrule[1.5pt] \end{tabular} \end{table} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/voltage_pred.pdf} \caption{Voltage predictions for the whole system with $\pm100\%$ range disturbances} \label{fig:whole_sys_voltage} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/current_pred.pdf} \caption{Current predictions for the whole system with $\pm100\%$ range disturbances} \label{fig:whole_sys_current} \end{figure} \begin{comment} \begin{table}[h!] \caption{Accumulated bus voltage error in 0.5 seconds} \label{table_errors} \centering \scriptsize \begin{tabular}{c c c c} \toprule[1.5pt] Bus & 50\% changes & 80\% changes & 100\% changes \\ \hline $1$ & $0.0176$ & $0.0422$ & $0.0836$ \\ $4$ & $0.0217$ & $0.0516$ & $0.0993$ \\ $13$ & $0.0178$ & $0.0422$ & $0.0831$ \\ $14$ & $0.0258$ & $0.0617$ & $0.1280$ \\ $16$ & $0.0270$ & $0.0653$ & $0.1379$ \\ $17$ & $0.0217$ & $0.0516$ & $0.0993$ \\ $18$ & $0.0216$ & $0.0516$ & $0.0983$ \\ $20$ & $0.0217$ & $0.0516$ & $0.0977$ \\ $23$ & $0.0326$ & $0.0719$ & $0.1397$ \\ $25$ & $0.0387$ & $0.0825$ & $0.1627$ \\ $27$ & $0.0306$ & $0.0703$ & $0.1359$ \\ $28$ & $0.0313$ & $0.0730$ & $0.1389$ \\ $29$ & $0.0315$ & $0.0745$ & $0.1401$ \\ $31$ & $0.0527$ & $0.1121$ & $0.2232$ \\ $33$ & $0.0423$ & $0.0860$ & $0.1856$ \\ $34$ & $0.0469$ & $0.0918$ & $0.2059$ \\ $35$ & $0.0480$ & $0.0936$ & $0.2109$ \\ \bottomrule[1.5pt] \end{tabular} \end{table} \end{comment} \begin{comment} \begin{figure} \centering \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width=\textwidth]{Figures/whole_sys_voltage_abs.pdf} \caption{Voltage amplitude predictions for the whole system} \hspace{0.1in} \label{fig:whole_sys_voltage_abs} \end{subfigure} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width=\textwidth]{Figures/whole_sys_voltage_ang.pdf} \caption{Voltage angle predictions for the whole system} \label{fig:whole_sys_voltage_ang} \end{subfigure} \caption{Voltage predictions for the whole system with $100\%$ range disturbances} \label{fig:whole_sys_voltage} \end{figure} \begin{figure} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width=\textwidth]{Figures/whole_sys_current_abs.pdf} \caption{Current amplitude predictions for the whole system} \hspace{0.1in} \label{fig:whole_sys_current_abs} \end{subfigure} \begin{subfigure}[b]{0.48\textwidth} \includegraphics[width=\textwidth]{Figures/whole_sys_current_ang.pdf} \caption{Current angle predictions for the whole system} \label{fig:whole_sys_current_ang} \end{subfigure} \caption{Current predictions for the whole system with $100\%$ range disturbances} \label{fig:whole_sys_current} \end{figure} \end{comment} \begin{comment} \begin{figure} \centering \includegraphics[width=0.48\textwidth]{Figures/error_nodes.pdf} \caption{The maximum node voltage prediction errors with $3^{\text{rd}}$ order models for both Vf and PQ} \label{fig:error_nodes} \end{figure} \end{comment} \subsection{Independence of KBF to the Global Reference Frame} The global DQ reference frame rotating at the nominal frequency allows one to represent the instantenous voltages and currents as phasor quantities. However, the initial phase of the rotating DQ frame is not unique, so that if all phasors in the initial condition rotate by a same angle corresponding to a shift in the DQ reference frame, then the system dynamics would be the same in the new reference frame. This property is seen as the zero eigenvalue in the linearized system but it is a global nonlinear property, which cannot be recreated by a linear system model. However, the nonlinear KBF model may still be dependent on a specific DQ reference frame if only one frame is present in the training data. To illustrate this issue, Fig.~\ref{fig:reference_shift} shows the prediction of the Vf KBF model when the reference frame for the initial condition and the inputs are shifted by only $0.001$ radian. We can see that the predicted trajectory deviates from the initial equilibrium point and runs parallel to the simulated trajectory. To address this issue, the training data is preprocessed as follows. For the Vf model, we first shift the transient responses' reference frame to zero and then randomly add an angle within $\pm 0.01$ radian. For the PQ model, the reference frames are only shifted to have zero initial PLL phase angle because the four PQ DERs are already in different reference frames. Therefore, the nonlinearity related to the changes between the internal PLL reference frame and the global one is represented in the KBF model in a limited range of PLL phases. The prediction remains accurate when the PLL phase is within a $\pm 0.04$ radian inverval for the Vf model, and $\pm 0.05$ radian interval for the PQ model. These limits could be removed by selecting proper observable functions that are invariant to different reference frames, which is the authors' future work. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/error_bar.pdf} \caption{Average node voltage prediction errors} \label{fig:error_bar} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{Figures/PLL_angle.pdf} \caption{Counter example of dependence to DQ reference frame} \label{fig:reference_shift} \end{figure} \section{Modularized Koopman Bilinear Form} \begin{comment} Introduce your theoretical contributions. You might want to introduce your contributions by using subsections. Or if you have different categories of theoretical contributions, you might need two sections to introduce your novelty. \Yan{Xinyuan: when you learn Koopman operator, please summarize the following things. \begin{itemize} \item Essential idea of Koopman \item The relation between Koopman and DMD \item How does Koopman convert a low-dimension nonlinear system to a high-dimension linear system? \item How to select observable functions? \end{itemize}} \end{comment} The essential idea of M-KBF is to decouple a large system into several smaller subsystems, identify the data-driven model for each subsystem separately through KBF, and then integrate them into the network model with inputs and outputs of bus voltages or currents. Considering the transient dynamics of microgrids is dominated by the nonlinear dynamics of DERs while the grid can be modeled as a set of linear constraints between node currents and voltages, the data-driven modeling of the whole system can be separated into identifying the grid's algebraic constraint and the dynamics of DER subsystems. The main advantages of the presented M-KBF are that the modeling and prediction architecture is scalable and the identified model is linear or control-affine in the lifted space so linear system identification methods can be leveraged ~\cite{sharma2021data}. \subsection{Identification of Hybrid Network Parameter Matrix} Taking into account the different functions of grid-forming and grid-following DERs in the microgrid system~\cite{kettner2021harmonic}, the network that connects DERs and power loads can be represented by a hybrid network parameter matrix~\cite{kettner2017properties}, as given in (\ref{Eq_Hmatrix}), which gives the constraint between node currents and voltages. \begin{equation} \label{Eq_Hmatrix} \begin{bmatrix} \matr{I}_{\mathcal{P}_1} \\ \matr{V}_{\mathcal{P}_2} \end{bmatrix} = \matr{H} \begin{bmatrix} \matr{V}_{\mathcal{P}_1} \\ \matr{I}_{\mathcal{P}_2} \end{bmatrix}, \end{equation} where the partition $\mathcal{P}_1$ is the set of nodes connecting to the grid-forming DERs, and the partition $\mathcal{P}_2$ is the set of nodes connecting to the grid-following DERs and/or power loads. Let $\mathcal{N}$ be the set of microgrid nodes, then $\mathcal{P}_1 \cup \mathcal{P}_2 \subseteq \mathcal{N}$. The goal is to find a hybrid network parameter matrix $\matr{H}$ that satisfies (\ref{Eq_Hmatrix}). Specifically, the grid-forming DER inverters take node current as input and node voltage as output in (\ref{Eq_Hmatrix}), while the grid-following inverters take node voltage as input and node current as output. The power loads have the same input and output definitions as grid-following DERs. Therefore, the network has complementary input and output ports at the DER inverter nodes, leading to the hybrid network parameter matrix $\matr{H}$. The hybrid network parameter matrix can be obtained by using two methods, namely by obtaining the matrix analytically from the admittance matrix if it is known, or by solving a least-squares problem based on the measurement of node voltages and currents. Note that both methods need to meet the condition given in Remark \ref{condition} to guarantee that $\matr{H}$ exists. To derive $\matr{H}$ from the admittance matrix, there are two steps~\cite{kettner2017properties}, including the elimination of nodes with zero current injections from generations or loads (e.g., Kron reduction~\cite{dorfler2012kron}) and the switching of a set of node currents and voltages (for partition $\mathcal{P}_2$). To solve for the hybrid network parameter matrix from measurements of node voltages and currents, it is typical to formulate (\ref{Eq_Hmatrix}) into a least-squares problem, which is well posed given the existence of $\matr{H}$ (Remark \ref{condition}). \begin{remark}[Sufficient condition for the existence of $\matr{H}$] \label{condition} In a connected network, assume all the branches are not electromagnetically coupled and have nonzero admittance. If all lines are passive, i.e., having strictly positive real part in line admittance, then the hybrid network parameter exists~\cite{kettner2017properties}. The existence follows from the ability to transform the admittance matrix through the two steps described above. If, in particular, no shunt elements (shunt capacitors or constant impedance loads) are included in the network, then the hybrid matrix always exists for a connected network. \begin{comment} In a connected network, define the nodes to be eliminated or the nodes that are to see switches in variables a subset of nodes $\mathcal{P} \subset \mathcal{N}$. The hybrid network parameter matrix exists when meeting at least one of the following two conditions. \begin{itemize} \item If there are shunt capacitance in the network, the hybrid matrix will exist when each of the mutually disconnected groups that belong to the partition $\mathcal{P}$ is connected to at least one node outside the partition by a \hl{dissipative line}. \item If no shunt capacitance is included in the network model, the hybrid matrix exists. \end{itemize} \end{comment} \end{remark} \subsection{Bilinear Koopman Surrogate Model for DERs Koopman Bilinear Form is a global bilinearization of control-affine nonlinear systems in an operator theoretic view. Each grid-forming controlled DER with node current inputs or the grid-following DER with node voltage inputs can be expressed in the following form of control-affine system, with Vf controlled DER provided as an example in the Appendix. \begin{subequations}\label{E:control_affine_system} \begin{align} \dot{\vect{x}} &= \vect{f}(\vect{x}) + \sum_{i=1}^m \vect{g}_i(\vect{x}) u_i, \\ \vect{y} &= \matr{C}\vect{x}, \label{E:output} \end{align} \end{subequations} where $\vect{x} \in \mathbb{X} \subseteq \mathbb{R}^n$ is the state vector for one DER, $\vect{u} = [u_1 \ldots u_m]^{\mathsf{T}} \in \mathbb{R}^m$ is the input vector, $\vect{y} \in \mathbb{R}^2$ is the output vector, $\matr{C} \in \mathbb{R}^{2{\times}n}$ is the output matrix, $\vect{f}: \mathbb{X} \to \mathbb{X}$ and $\vect{g}_i: \mathbb{X} \to \mathbb{X}$ are the flow and control vector fields for the two typical inverter controls. The KBF for identifying DER dynamics are then introduced from the following three aspects. \subsubsection{Observable Function} An observable function $\varphi: \mathbb{X} \to \mathbb{C}$ is a complex-valued function of the state vector $\vect{x}$. Let $\mathcal{F}$ be the space of all possible observable functions so that $\varphi \in \mathcal{F}$. Let $\mathbf{\Phi}_{\vect{u}}(t,\vect{x}_0)$ be the flow map of the system (\ref{E:control_affine_system}) at time $t > 0$ starting from an initial condition $\vect{x}_0$ with input $\mathbf{u}$. The time-varying observable $\psi(t,\vect{x}) \triangleq \left.\varphi(\vect{x})\right|_{\vect{x} = \mathbf{\Phi}_{\vect{u}}(t,\vect{x}_0)}$ of the system (\ref{E:control_affine_system}) is the solution of the following partial differential equation, which lays the foundation for bilinearization. \begin{equation}\label{E:evolution_PDE} \begin{split} \frac{\partial \psi}{\partial t} &= L_{\vect{f}}\psi + \sum_{i=1}^{m} u_i L_{\vect{g}_i} \psi, \\ \psi(0,\vect{x}) &= \varphi(\vect{x}), \end{split} \end{equation} where $L_{\vect{f}} \triangleq \vect{f} \cdot \nabla$, $L_{\vect{g}_i} \triangleq \vect{g}_i \cdot \nabla,\,i = 1,\ldots,m$ are the Lie derivatives~\cite{7384725} with respect to the drift and control vector fields $\vect{f}(\vect{x})$ and $\vect{g}_i(\vect{x})$, which are linear operators on $\mathcal{C}^1(\mathbb{X})$. \subsubsection{Koopman Operator} The Koopman operator is defined for the system (\ref{E:control_affine_system}) with zero inputs, \begin{equation}\label{E:autonomous_system} \dot{\vect{x}} = \vect{f}(\vect{x}) \end{equation} Assume ${\mathbf{\Phi}}(t,\vect{x}_0)$ is the flow map of (\ref{E:autonomous_system}) for the time $t > 0$, the continuous time Koopman operator is defined as $\mathcal{K}^t: \mathcal{F} \to \mathcal{F}$ such that, \begin{equation}\label{E:Koopman_operator} (\mathcal{K}^t\varphi)(\cdot) = \varphi \circ \mathbf{\Phi}(t,\cdot), \end{equation} where $\circ$ represents function composition. Based on (\ref{E:Koopman_operator}), we can see the Koopman operator is linear, namely, \begin{equation}\label{E:linearity} \begin{aligned} \mathcal{K}^t (\alpha_1 \varphi_1 + \alpha_2 \varphi_2) &= \alpha_1\varphi_1 \circ \mathbf{\Phi}(t,\cdot) + \alpha_2 \varphi_2 \circ \mathbf{\Phi}(t,\cdot)\\ &=\alpha_1\mathcal{K}^t \varphi_1 + \alpha_2 \mathcal{K}^t \varphi_2. \end{aligned} \end{equation} Therefore, the Koopman operator can be characterized by its eigenvalues and eigenfunctions, \begin{equation}\label{E:eigen_linear} \mathcal{K}^t \phi = e^{t\lambda} \phi, \end{equation} where $\lambda \in \mathbb{C}$ is the Koopman eigenvalue and $\phi \in \mathcal{F}$ is the corresponding eigenfunction. Through the definition of Lie derivatives, the infinitesimal generator of the Koopman operator is equal to the Lie derivative of the drift vector field, i.e., $L_{\vect{f}} = \lim_{t \to 0} \frac{\mathcal{K}^t - I}{t}$, where $I$ is the identity operator, so $L_{\vect{f}}$ is also referred to as the Koopman generator. The eigenvalue and eigenfunction relation in (\ref{E:eigen_linear}) can also be expressed in terms of the Lie derivative, \begin{equation}\label{E:eigenfunction} L_{\vect{f}} \phi = \lambda \phi. \end{equation} From (\ref{E:eigenfunction}) and the definition of $L_{\vect{f}}$, for any two eigenpairs $(\lambda_1,\phi_1)$ and $(\lambda_2,\phi_2)$, we have \begin{equation}\label{E:eigenvalue_group} L_{\vect{f}}(\phi_1 \cdot \phi_2) = (\lambda_1 + \lambda_2) (\phi_1 \cdot \phi_2). \end{equation} Thus, there exist infinitely many eigenfuncions and eigenvalues for the Koopman operator. \begin{comment} The Koopman eigenvalues and eigenfunctions are defined by the relation \begin{equation}\label{E:def_eigenfunction} L_{\vect{f}} \phi = \lambda \phi, \end{equation} where $\lambda \in \mathbb{C}$ and $\phi \in \mathcal{F}$ are the corresponding eigenvalue and eigenfunction. \end{comment} \subsubsection{Bilinearzation} The goal of bilinearzation of (\ref{E:control_affine_system}) is to choose a set of observable functions, \begin{equation} T(\vect{x}) = [\varphi_1(\vect{x}),\varphi_2(\vect{x}),\, \ldots,\, \varphi_N(\vect{x})]^{\mathsf{T}}, \end{equation} such that their evolution over time is that of a bilinear system (\ref{E:KBF}), which mirrors (\ref{E:evolution_PDE}) with the observable function basis $T(\vect{x})$. \begin{equation}\label{E:KBF} \dot{\vect{z}} = \matr{A}\vect{z} + \sum_{i=1}^m u_i \matr{B}_i \vect{z},\quad \vect{z}(0) = T(\vect{x}_0), \end{equation} where $\matr{A}$ and $\matr{B}_i$ will be determined in Section III. The condition for bilinearizability into (\ref{E:KBF}) with the state embeddings $T(\vect{x})$ being the eigenfunctions of $L_{\vect{f}}$ is provided in Theorem 1 from~\cite{goswami2021bilinearization}. And furthermore, bilinearizability condition with finite eigenfunction embeddings~\cite{goswami2021bilinearization} is presented in the following Theorem for completeness. \begin{comment} \begin{theorem}[Theorem 1 in \cite{goswami2021bilinearization}] \label{Thm_bilinearizable} The control affine system (\ref{E:control_affine_system}) is bilinearizable in a countable basis (possibly infinite) if the eigenspace of $L_{\vect{f}}$, $\{\phi_j:j = 1,2,\ldots\}$, is an invariant subspace of $L_{\vect{g}_i}$ for any $i = 1,\ldots,m$. \end{theorem} The bilinearizability condition in Theorem~\ref{Thm_bilinearizable} means that $L_{\vect{g}_i} \phi_j \in span(\phi_1,\phi_2,\ldots)$ for all $i$ and all $j$. \end{comment} \begin{theorem} \label{Thm_finite_bilinearizable} If a set of Koopman eigenfunctions $\{\phi_1,\phi_2,\ldots,\phi_n\},\, n \in \mathbb{N}$ of the unactuated system forms an invariant subspace of $L_{\vect{g}_i},\, i = 1,\ldots,m$, then the system (\ref{E:control_affine_system}) is bilinearizable with an $n$ dimensional state space. \end{theorem} Given that the condition of Theorem~\ref{Thm_finite_bilinearizable} is satisfied, the control-affine DER subsystem (\ref{E:control_affine_system}) is bilinearizable with a finite number of eigenfunction embeddings. Next, we will obtain a finite-dimensional bilinear model (\ref{E:KBF}) by modifying the Extended Dynamic Mode Decomposition (EDMD) algorithm to include blinear inputs.
\section*{Theoretical model} In this work, we use an extended Gross-Pitaevskii theory for direct comparison to our experimental results. We employ both the standard three-dimensional form of the extended Gross-Pitaevskii equation (eGPE) and derive a discrete effective one-dimensional eGPE. Starting with the three-dimensional case, our system can be described by the 3D eGPE of the form \cite{Wachtler2016qfi,Bisset2016gsp,FerrierBarbut2016ooq,Chomaz2016qfd} \begin{align} i \hbar \diffp{}{t} \Psi(\vec{x}, t) = \Big{[} &- \displaystyle\frac{\hbar^2}{2 m} \nabla^2 + V_\mathrm{harm}(\vec{x}) \nonumber\\ &+ V_\mathrm{latt}(z) - F_\text{ext} z + g |\Psi(\vec{x}, t)|^2 \nonumber\\ &+ \int \text{d}^3\vec{x}' \, U_\text{dd}(\vec{x} - \vec{x}')|\Psi(\vec{x}', t)|^2\nonumber\\ &+ \gamma_\text{QF} |\Psi(\vec{x}, t)|^{3} \Big{]} \Psi(\vec{x}, t)\,, \label{eqn:eGPE} \end{align} where the wavefunction $\Psi$ is normalized to the total atom number $N=\int {\rm d}^3\vec{x}\,|\Psi|^2$. The atoms are confined in a harmonicpotential $V_\text{harm} = \sum_{\xi = x,y,z} \frac{1}{2} m \omega_\xi^2 \xi^2$ with single particle mass $m$ and trap frequencies $\omega_\xi$, together with the lattice potential $V_\text{latt} = s E_\text{rec} \sin^2{(k z)}$ where $s$ is the tunable lattice depth in multiples of the recoil energy $E_\text{rec}$ and $k=2\pi/\lambda$ is the lattice spacing in reciprocal space. The mean-field interaction contributions are $g = 4 \pi \hbar^2 a_\text{s}/m$ for the contact interaction, governed by the s-wave scattering length $a_\text{s}$, and the long-ranged anisotropic dipolar interaction potential $U_\text{dd}(\vec{x}) = 3\hbar^2a_\text{dd}/m\left(1-3\cos^2\theta\right)/|\vec{x}|^3$, where $a_\text{dd} = \mu_0\mu_m^2m/12\pi\hbar^2$ with magnetic moment $\mu_m$ and $\theta$ is the angle between the polarization axis ($y$-axis) and the vector between neighboring atoms. We also include beyond-mean-field effects through the quantum fluctuations term $\gamma_\text{QF} = \frac{32}{3} g \sqrt{\frac{a^3_\mathrm{s}}{\pi}} \left( 1 + \frac{3}{2}\varepsilon^2_\mathrm{dd} \right)$ \cite{Lima2011qfi}, which depends on the relative strength between the dipolar and short-ranged interactions $\varepsilon_\text{dd} = a_\text{dd}/a_\text{s}$. Finally, $F_\text{ext} = g_\text{grav} m$ denotes the external force exerted on the system by gravity. In this work, we employ the imaginary time-evolution technique on Eq.\,\eqref{eqn:eGPE} in order to find stationary solutions for the wavefunction in the lattice, without gravity. For various atom numbers and scattering lengths, we use a numerical grid of lengths $(L_x,\,L_y,\,L_z) = (6,\,33.3,\,6)\,\mu$m, with corresponding grid points $128\times256\times128$. The dipolar term is efficiently calculated in momentum space, and we use a cylindrical cut-off in order to negate the effects of aliasing from the Fourier transforms \cite{Lu2010sdo}. To derive the effective one-dimensional model, we follow Ref.\,\cite{Blakie2020vtf} by assuming a wavefunction decomposition \begin{align} {\Psi(\vec{x}, t) = \Phi(x,y,l,\eta)\psi(z,t)\equiv\frac{1}{\sqrt{\pi} l} e^{- (\eta x^2 + y^2/\eta)/2 l^2} \psi(z, t)}\,, \label{eqn:variational} \end{align} with variational parameters $l$ and $\eta$ representing the width of the radial wavefunction and the anisotropy of the state, respectively. Integrating out the transverse directions $(x,y)$ in Eq.\,\eqref{eqn:eGPE} upon substitution of the ansatz above gives the continuous quasi-one-dimensional eGPE, which when combined with a variational minimization of the energy functional to find $(l,\eta)$ gives close agreement to the full 3D eGPE \cite{Blakie2020vtf}. We further decompose the longitudinal wave function $\psi(z, t)$ into a sum of Wannier functions $w(z)$ of the lowest energy band over all lattice sites \begin{align} \psi(z, t) = \sqrt{N} \sum_j c_j(t)\,w(z - z_j)\,, \label{eqn:wann} \end{align} for complex amplitudes $c_j$, and positions of lattice minima $z_j = (\lambda/2)j$. For deep enough lattices, the Wannier functions are well approximated by Gaussians of the form $w(z) = \left(\pi l_\text{latt}^2\right)^{-1/4}e^{-z^2/2 l_\mathrm{latt}^2}$, with $l_\mathrm{latt} = (k \sqrt[4]{s})^{-1}$. After multiplying on the left by $c_j^*$ and integrating over $z$, we obtain a set of discrete effective one-dimensional eGPEs \begin{widetext} \begin{equation} \label{eq:Discrete_model} i \hbar \diffp{c_j}{t} = - J(c_{j+1} + c_{j-1}) + \left(-F_\mathrm{ext}z_j + V_\text{harm}(z) + g^\text{1D}N|c_j|^2 + N\sum_{k} U_{|j-k|}^\mathrm{dd}|c_k|^2 + \gamma^\mathrm{1D}_\mathrm{QF}N^{3/2} \gamma_\mathrm{QF} |c_j|^{3} \right) c_j \,, \end{equation} \end{widetext} with the reduced effective one-dimensional parameters $\gamma^\mathrm{1D}_\mathrm{QF} = 2^{3/2} / (5 \pi^{3/2} l^2 l_\mathrm{latt})^{3/2} \gamma_\mathrm{QF}$ and $g^\text{1D} = g / ((2 \pi)^{3/2} l^2 l_\mathrm{latt})$. Here, $J$ denotes the tunneling rate between two neighboring lattice sites. The dipolar interaction coefficients between lattice sites $j$ and $k$ depend both on the separation $|j-k|$, and non-trivially on the size $l$ and anisotropy $\eta$ of the transverse cloud. For the variational minimization, we generate an interpolating function for a sensible range of $(l,\eta)$ and separations up to $|j-k|=6$ via \begin{align} U_{|j-k|}^\mathrm{dd}(l,\eta) = \int \text{d}^3\vec{x}&\Big\{ |\Psi_0(\vec{x}-z_{|j-k|}\hat{e}_z,l,\eta)|^2 \nonumber \\ &\int\text{d}^3\vec{x}'\, U_\text{dd}(\vec{x} - \vec{x}')|\Psi_0(\vec{x}',l,\eta)|^2\Big\}\,, \end{align} where $\Psi_0(\vec{x}',l,\eta) = \Phi(x,y,l,\eta)w(z)$ [see Eqs.\,\eqref{eqn:variational} and \eqref{eqn:wann}]. This allows us to simply look up the values of $U_{|j-k|}^\mathrm{dd}$ without having to recalculate for every time step during the energy minimization. We note that the energy contribution rapidly declines for separations larger than 2 sites, and find that 6 is more than sufficient to quantitatively describe the physics. To find the stationary state solution of Eq.\,\eqref{eq:Discrete_model} (without gravity) we employ an imaginary time-evolution in combination with an optimization scheme, aiming to find the state which minimizes the total energy functional \begin{equation} \label{eq:Total_energy_functional} \mathcal{E}[\textbf{c}; l, \eta] = \mathcal{E}_\perp [l, \eta] + \mathcal{E}_\parallel [\textbf{c}; l, \eta] \ , \end{equation} where $\textbf{c}=(c_1,c_2,\dots,c_n)$ for $n$ total lattice sites. Here, $\mathcal{E}_\perp [l, \eta]$ gives the energy contribution from the transverse variational wave function, which reads \begin{equation} \mathcal{E}_\perp [l, \eta] = \frac{\hbar^2}{2 m l^2} \left(\eta + \frac{1}{\eta}\right) + \frac{m l^2}{4} \left( \frac{\omega^2_x}{\eta} + \eta \omega^2_y \right) \ . \end{equation} The latter term of Eq.\,\eqref{eq:Total_energy_functional} gives the discrete energy functional for the amplitudes $c_j$, which includes the tunneling and all interaction terms \begin{align} \mathcal{E}_\parallel [\textbf{c}; l, \eta] = & - \sum_j J (c_{j+1} + c_{j-1}) c_j \nonumber \\ & + \frac{1}{2} N g^\text{1D} \sum_j |c_j|^4 + \frac{1}{2}N \sum_{j,k} U^\text{dd}_{|j-k|} |c_k|^2 |c_j|^2 \nonumber \\ & + \frac{2}{5} N^{3/2} \gamma^\text{1D}_\mathrm{QF} \sum_j |c_j|^5\,. \label{eq:Axial_energy_functional} \end{align} Starting from an initial distribution of the amplitudes $c_j$ we first determine the variational parameters $(l,\,\eta)$, which is done via an optimization scheme minimizing Eq.\,\eqref{eq:Axial_energy_functional}. Subsequently, we evolve the amplitudes in imaginary time using Eq.\,\eqref{eq:Discrete_model} and repeat this process until we find the minimum of the total energy function Eq.\,\eqref{eq:Total_energy_functional}. In Fig.\,\ref{figS1} we assess the different interaction energy contributions to Eq.\,\eqref{eq:Total_energy_functional} for a range of scattering lengths. For $\ensuremath{a_{\rm s}}>a_{\rm dd}$ the total interaction energy is positive, and it corresponds to a dilute BEC. Following $\ensuremath{a_{\rm s}}$ to smaller values all interaction contributions are almost constant, until at around $\ensuremath{a_{\rm s}}=\SI{60}{\bohr}$ there is a phase transition from the BEC to droplet state, as identified in Fig.\,4 of the main text. This sharp gradient ceases at around $\ensuremath{a_{\rm s}}=\SI{55}{\bohr}$, where the atoms are localized to a single lattice plane. Note that although the DDI offsite energy is typically only 10\% of the onsite counterpart, it constitutes a significant contribution to the total interaction energy in the system, shifting the BEC to droplet crossover and localization transitions by a few \SI{}{\bohr}. Once we have the ground state of the system, we employ the discrete effective one-dimensional eGPE in real-time to simulate the Bloch oscillations in the presence of gravity. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{img/suppmat_energy_fig1.pdf} \caption{\label{figS1}\textbf{Interaction energy contributions.} Scattering length dependency of the individual interaction contributions of the ground state solutions from the 1D model, calculated for $N=10^4$ atoms.} \end{figure} \section*{2D to 3D crossover} The dimensionality of the system is known to highly influence the size and even the sign of the beyond-mean-field contribution, in both Bose-Bose \cite{Petrov2016uld,ilg2018dimensional,Lavoine2021bmf} and dipolar \cite{Edler2017qfi,boudjemaa2019two,zin2021quantum} gases. Here, we assess the validity of employing the full 3D LHY correction to our system. Following Ref.\,\cite{zin2021quantum}, we define the dimensionless parameter $\xi = g n /\epsilon_0$--dependent on the contact interactions $g$, peak 3D density $n$, and the confinement energy scale $\epsilon_0 = \hbar^2\pi^2/2mz_\text{ho}^2$--that indicates which dimensionality regime our system is in. If $\xi\gtrsim1$ we are safe to use the 3D LHY term, whereas if $\xi\ll1$ the 2D solution deviates from the 3D one. Deep in the localized droplet regime, where the peak density is on the order of $10^{22}\SI{}{\per\cubic\meter}$, we find $\xi\approx2$, and the 3D LHY as used throughout this work is valid. Even at large scattering lengths, where the peak density is closer to $5\times10^{20}\SI{}{\per\cubic\meter}$, we find $\xi\approx0.5$, which introduces an error of less than 5\% between the 2D and 3D LHY terms \cite{zin2021quantum}. In this limit, the 2D LHY term may be more appropriate, however in the dilute BEC phase the impact of the LHY is minimal. \section*{Analytic model of dephasing} Starting from the discrete 1D eGPE we decompose the coefficients $c_j$ into amplitude and phase as $c_j = |c_j|\exp(-i\phi_j)$, and then integrate Eq.\,\eqref{eq:Discrete_model} in time to give \begin{align} \phi_j(t) &= \Bigg(- F_\mathrm{ext} z_j +g^\text{1D}N|c_j|^2 + N\sum_{k} U_{|j-k|}^\mathrm{dd}|c_k|^2 \nonumber\\ &\qquad\qquad\qquad\qquad+ \gamma^\mathrm{1D}_\mathrm{QF}N^{3/2} \gamma_\mathrm{QF} |c_j|^{3} \Bigg) \frac{t}{\hbar} \nonumber\\ &\equiv \left(- F_\mathrm{ext} z_j + \mu_j\right)\frac{t}{\hbar}\,, \end{align} with onsite chemical potentials $\mu_j$, and where we have also assumed that $F_\mathrm{ext}d\gg J$ such that the amplitudes $|c_j|$ are frozen. Following Ref.\,\cite{Witthaut2005boo}, we write the Fourier transform of the quasi-1D wavefunction as \begin{align} \psi(k,t) = w(k)\sum_j |c_j|\exp[-i(kz_j + \phi_j(t))] = w(k) \tilde{C}(k,t) \,, \end{align} where $w(k)$ is the momentum space Wannier function, and phases $\phi_j$ are given above. If all interactions are set to zero this function is initially a delta function situated at $k=0$ and moves in $k$-space as $\tilde{k} = k-F_\text{ext}t/\hbar$. Interactions broaden $\tilde{C}(k,t)$, leading to a dephasing of coefficients $c_j$. Fig.\,\ref{fig:deph_thry}(a) depicts $|\tilde{C}(k,t)|^2$ as a function of $k$ at different times $t$, normalized to $|\tilde{C}(0,0)|^2$. \begin{figure} \centering \includegraphics[width=\columnwidth]{img/suppmat_dephTheory_fig2.pdf} \caption{\textbf{Analytic dephasing rate. (a)}\,Evolution of the function $\tilde{C}$, with $\tilde{k}$ normalized to the Brillouin zone in the moving frame, and $\ensuremath{a_{\rm s}} = 60.5\,a_0$. Here, the solution of Eq.\,\eqref{eqn:t_d} is $t_{\rm d} = 0.59$s. \textbf{(b)}\,Time evolution of the central point of $\tilde{C}$, showing when $|\tilde{C}|^2$ crosses $\alpha=0.5$. The function $\tilde{C}$ is scaled to the value at $\tilde{C}(0,0)$. \textbf{(c)}\,Analytic dephasing rate ($\gamma = 1/t_{\rm d}$) obtained for the 3 lattice site approximation Eq.\,\eqref{eqn:t_d} and the 5 lattice site approximation Eq.\,\eqref{eqn:t_d5}, compared to the numerically obtained value from a real-time simulation of the discrete model, Eq.\,\eqref{eq:Discrete_model}.} \label{fig:deph_thry} \end{figure} We extract an analytic approximation to the dephasing time by considering the temporal behaviour of the point $|\tilde{C}(0,t)|^2$, i.e.\,at $\tilde{k}=0$. During dephasing this point rapidly decreases through interference between neighboring sites. This quantity is plotted in Fig.\,\ref{fig:deph_thry}(b) for a few example scattering lengths. It reaches the threshold $\alpha / \tilde{C}(0,0)= 0.5$ at the dephasing time $t = t_{\rm d}$, where many $k$-modes are now highly occupied. This time can be found through the smallest positive solution of \begin{align} \alpha = \left|\left(\sum_j|c_j|\cos\left(\frac{\mu_jt_{\rm d}}{\hbar}\right)\right)^2 +\left(\sum_j|c_j|\sin\left(\frac{\mu_jt_{\rm d}}{\hbar}\right)\right)^2\right|\,. \label{eqn:alph} \end{align} Exact solutions to $|\tilde{C}(0,t_{\rm d})|^2=\alpha$ can be only found in limiting cases. For the three lattice site case, with $j=-1,0,1$ and noting the symmetry of $|c_j| = |c_{-j}|$ we obtain \begin{align} t_{\rm d} = \left|\arccos\left(\frac{4|c_0c_1|}{\alpha + |c_0|^2-2}\right)\frac{\hbar}{(\mu_1-\mu_0)}\right|\,, \label{eqn:t_d} \end{align} This relation is expected to give an accurate prediction of the dephasing time for all states where only 3 lattice sites are dominant. From this equation, one can see how the dephasing time tends to infinity in the limit of equally distributed chemical potentials, as observed in Fig.\,2 of the main text. We can extend this to 5 sites, but it is not as trivial. One needs to numerically solve the transcendental equation \begin{align} \alpha = &\Big|2 - |c_0|^2 + 4|c_0c_1|\cos\left(\frac{(\mu_0-\mu_1)t_{\rm d}}{\hbar}\right) \nonumber\\ &+ 4|c_0c_2|\cos\left(\frac{(\mu_0-\mu_2)t_{\rm d}}{\hbar}\right) \nonumber\\ &+ 8|c_1c_2|\cos\left(\frac{(\mu_1-\mu_2)t_{\rm d}}{\hbar}\right)\Big|\,, \label{eqn:t_d5} \end{align} for the smallest non-zero root $t_{\rm d}$. We compare the results from Eqs.\,\eqref{eqn:t_d} and \eqref{eqn:t_d5} to the numerically obtained dephasing rate, $\gamma=1/t_{\rm d}$, in Fig.\,\ref{fig:deph_thry}(c), as presented in Fig.\,2 of the main text, and find excellent agreement. \section*{Experimental protocol} We prepare a $\ensuremath{^{166}}{\rm Er} $ spin-polarized BEC similar to Ref.\,\cite{Chomaz2016qfd}. The magnetic field during the evaporation is along the z-axis with absolute value $\mathbf{|B|}=B_z= \SI{1.9}{\gauss}$ ($\ensuremath{a_{\rm s}}=\SI{80(1)}{\bohr})$, see Fig.\,\ref{Fig1}(a). The B-to-as conversion has been precisely mapped out in previous experiments \cite{Chomaz2016qfd,patscheider2021accurate}. Before loading the lattice, we rotate the magnetic field direction along the y-axis in \SI{50}{ms} and change its absolute value to set the scattering length. At this step, we typically achieve $5 \times 10^4$ atoms with more than 60 \% condensed fraction in a cigar shape dipole trap with trapping frequencies $\omega_{x,y,z} = 2 \pi \,(240(3),30(3),217(1))$\,\SI{}{\hertz}. For our experiments, the atoms are then loaded in a 1D lattice by a \SI{20}{\milli\second} exponential ramp of the lattice depth. This is the experimental protocol used in Fig\,\ref{Fig1}, \ref{Fig2}, and \ref{Fig3}(a). To study the reversibility of the interaction-induced transition to a single lattice site (\ref{Fig3}(b)), i.e. the evolution of the contrast due to a change of the scattering length, we employ a different protocol from the one above. In fact, in our experiment, the magnetic field along the y-direction can be changed on a timescale of $\simeq \SI{20}{\milli\second}$, which is slower compared to the z-direction ($\simeq \SI{1}{\milli\second}$). For this dataset, we prepare the BEC with $\mathbf{B}=(0,0.25,1)\,\SI{}{\gauss}$ and then we load the lattice as described above. We then linearly ramp the field in \SI{20}{\milli\second} to $\mathbf{B}=(0,0.25,0)\,\SI{}{\gauss}$ and record the time evolution. In Fig. \ref{Fig3}(b), we study the contrast evolution after the ramp. For the black dataset, the magnetic field is quenched back to the initial value after \SI{10}{\milli\second}. For Fig\,\ref{Fig4}, we extract the atom number condensed in the lattice by releasing the cloud from the combined ODT-lattice trap and by performing an absorption imaging after \SI{30}{\milli\second} of TOF. We integrate the density along the lattice axis and use a double Gaussian fit on the integrated density profile. We repeat the sequence 4-8 times for every scattering length. At low scattering lengths, we find a decreased number of condensed atoms, see Fig.\ref{Fig4}. We attribute this to an increase of three-body loss in the vicinity of a Feshbach resonance \cite{Chomaz2016qfd} and the increased density of the groundstate. \section*{Analysis of momentum distribution during Bloch Oscillation } \begin{figure}[t] \includegraphics[width=\columnwidth]{img/suppmat_meank_fig3.pdf} \caption{\label{figS1meank}\textbf{Evolution of the \ensuremath{\langle\left| q_z \right|\rangle}\,. } In the figure \ensuremath{\langle\left| q_z \right|\rangle}\, as a function of time for \ensuremath{a_{\rm s}}=\SI{58.8}{\bohr}. The points with red edges are the one selected for the fit. The red line corresponds to the fit result $A(t-\tau)+0.5$} \end{figure} When the Bloch oscillation dephases, the width of the momentum distribution increases with time \cite{Morsch2001boa}. To evaluate the dephasing rate we analyze the 1D momentum distribution along z, $n(q_z)$, as a function of the holding time. Because of our limited vertical optical access, the 1D lattice is not perfectly aligned with the z (gravity) direction. We measure a tilt of \SI{9(1)}{\degree}. Such a tilt effectively weakens the radial trapping strength, limiting our observation time to \SI{12}{\milli\second}, which anyhow allows us to observe up to 25 BO period. From $n(q_z)$, we can extract the maximum position ($q_z^{\text{max}}$) and the quantity \ensuremath{\langle\left| q_z \right|\rangle}\,, given by \[\ensuremath{\langle\left| q_z \right|\rangle}\, = \sum_{q_z} n(q_z)\left| q_z -q_z^{\text{max}}\right|.\] This quantity is proportional to the width of the distribution. In Fig.\,\ref{figS1meank}, we report \ensuremath{\langle\left| q_z \right|\rangle}\, for \ensuremath{a_{\rm s}} = 65.7(1.0)\,\SI{}{\bohr}. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{img/Suppmat_chisquared_fig4.pdf} \caption{\label{figS2} \textbf{Uncertainties $\chi^2$ analysis}. \textbf{(a)}\,$\chi^2$ as a function of A and $\tau$. The black dash lines correspond to the value $\chi_{min}^2+1$. Below, \textbf{(b)}\,probability distribution of $\tau$, given by numerical integration of $\int_A dA e^{-\chi^2(A,\tau)/2}$ and normalization to 1. \ensuremath{a_{\rm s}}=\SI{58.8}{\bohr}. The dashed line indicates the fit result and the shaded area the 68\% confidence interval.} \end{figure} To quantify the dephasing rate $\gamma$, we apply a linear fit to \ensuremath{\langle\left| q_z \right|\rangle}\,. For the fit, we select only the points at the center of the Brillouin zone, up to the time when \ensuremath{\langle\left| q_z \right|\rangle}\, is reaching the fully dephased configuration, $0.5 \hbar k$. Indeed, when the cloud is at the edge of the Brillouin zone, \ensuremath{\langle\left| q_z \right|\rangle}\, is artificially increased and it does not represent the dephasing, as shown in Fig.\,\ref{figS1meank}. We define the dephasing rate $\gamma$ as the inverse of the time $\tau$ that the fitted function needs to reach the value $0.5\, \hbar k$. Thus, using the fit parametrization $A(t-\tau)+0.5$, where $A$ and $\tau$ are the fitting variables and $t$ is the time, we can directly extract $\tau$ and its inverse $\gamma$. To determine the uncertainties with our non-linear parametrization, we analyze the $\chi^2(A,\tau)$. We estimate the uncertainties on our data points by assuming equal statistical fluctuations around our fitting model and using the expected value $\left< \chi^2 \right>$= $N_{\text{data}}-2$. Figure\,\ref{figS2} shows a clear asymmetric shape for $\chi^2$, indicating asymmetric uncertainties on our fit parameters. As we are only interested in the uncertainties on $\tau$, we consider $P_{\chi^2}(\tau)=\frac{1}{N}\int_A dA e^{-\chi^2(A,\tau)/2}$, with $N$ a normalization constant. $P_{\chi^2}(\tau)$ corresponds to the probability distribution of $\tau$ for our fitting model. Finally, from $P_{\chi^2}(\tau)$, we define the 68\% confident interval of our dephasing rate $\gamma$ shown in Fig.\,\ref{figS2}. In order to compare our experimental data with the theoretical predictions, we repeat the same analysis with the data from the 1D discrete model. Since in the experiment the condensed atom number changes with the scattering length, see Fig.\,\ref{Fig4}, the atom number considered in the theoretical simulations varies accordingly. In Fig.\,\ref{Fig2}, we account for the experimental fluctuations by taking an interval of $\pm20\%$ of the BEC atoms number. For each scattering length, we determine the extreme values of $\gamma$ in the $\pm20\%$ range, which we use to create the shaded area. \section*{Contrast of the interference pattern} The density modulation that usually characterizes a BEC loaded into a 1D lattice can be experimentally extracted from the matter-wave interferometry after a TOF expansion \cite{Greiner2002qpt}. To study the transition to one single occupied lattice site, we record the density distribution as a function of \ensuremath{a_{\rm s}}. In more details, for each picture we perform a Fourier transform (FT) of the integrated momentum distribution, $n(q_z)$. In the contact dominated regime, the lattice induces two sidepeaks at $\pm q_z^*$ in $n(q_z)$. Consequently, in the FT analysis the peaks are at $z^{*} \simeq \lambda_{\text{lattice}}$. The visibility of the interference pattern is then estimated as $n_{\text{FT}}(|z^*|)/n_{\text{FT}}(0)$. \end{document}
\section{Introduction} \label{sec:intro} \begin{abstract} Garside et al.~\cite{Garside:2021} use event history methods to analyze topological data. We provide additional background on persistent homology to contrast the hazard estimators used by Garside et al.\ with traditional approaches in topological data analysis. In particular, the former is a local method, which has advantages and disadvantages, while homology is a global. We also provide more background on persistence landscapes and show how a more complete use of this statistic improves its performance. \end{abstract} \section{Critical points and persistent homology} \label{sec:ph} Consider a function $f: \mathbb{R}^d \to \mathbb{R}$. For simplicity, let us restrict to the case $d=2$. We are interested in the topology or `shape' of the \emph{lower excursion sets} or \emph{sublevel sets} $\{x \in \mathbb{R}^2 \ | \ f(x) \leq a \}$ for $a \in \mathbb{R}$. Consider, for example, the negative of a kernel density estimator. In particular, we compute the \emph{homology} of these sublevel sets with binary coefficients. The result is two vector spaces $H_0$ and $H_1$, called homology in {degree} $0$ and homology in degree $1$, respectively. The dimension of these vector spaces equals the \emph{Betti numbers}, $\beta_0$ and $\beta_1$. These topological invariants enumerate the number of connected components and the number of `holes', respectively, of the sublevel sets. In computational settings, one works with a discretization of the domain $\mathbb{R}^2$ given by either triangles or rectangles together with function values on the vertices, edges, and faces. Often the function values are only given on the vertices, which are arranged in a rectangular grid and the values on the edges and faces are set equal to the maximum of the values on their boundary vertices. If we increase the value of the level $a$ then the homology of the sublevel sets changes at the critical values of the function $f$. At the value of local minima, $\beta_0$ increases by one. At value of local maxima, $\beta_1$ decreases by one. At the value of saddle points, either $\beta_0$ decreases by one or $\beta_1$ increases by one. The local minima, saddle points, and local maxima are said to be \emph{critical points} of \emph{index} $0$, $1$, and $2$, respectively. For $a \leq b$ the sublevel set given by $a$ is contained in the sublevel set given by $b$. This inclusion of subspaces of $\mathbb{R}^2$ induces a linear map between the corresponding homology vector spaces. The collection of vector spaces and linear maps (for all $a \leq b$) is called a \emph{persistence module}. \emph{Persistent homology} provides a complete description of the persistence module by determining a canonical pairing between critical values. This pairing pairs the critical value for which a homological feature appears, called \emph{birth} with the critical value at which that homological feature disappears, called \emph{death}. In particular, we have pairs in degree $0$ for which a connected component is born at a local minimum and is merged with another component at a saddle point and we have pairs in degree $1$ for which a hole is born at a saddle point and which dies at a local maximum. The only remaining critical points are the global minimum and the global maximum. These are either paired (extended persistence) or omitted (reduced homology). This pairing of critical values by persistent homology is visualized by either a collection of intervals, called a \emph{barcode}, or by plotting the paired critical values as points in the plane, called a \emph{persistence diagram}. \section{Local versus global} \label{sec:local-global} The critical values are locally determined. In the smooth, nondegenerate case, the critical points are the points at which the gradient vanishes, and their index is given by the number of negative values of the Hessian. In the discrete case, assuming vertices have distinct values, critical points and their index are determined by comparing neighboring values. In contrast, one cannot determine whether or not a saddle point increases $\beta_1$ or decreases $\beta_0$ using local information. In particular, one cannot obtain persistent homology from knowledge of the critical values and their indices. In the other direction, given persistent homology one may obtain the critical values and their indices. That is, persistent homology is a strictly more informative statistic than critical values and their indices. However, critical values and their indices may be quickly computed, while computing persistent homology is comparatively slow. Therefore, a statistician should choose between the less expensive local statistic -- critical values and their indices -- or the more expensive global statistic -- persistent homology. The appropriate choice depends on the application. For situations in which there is no global structure of interest, a local statistic may be a good choice, while situations in which global `shape' is important call for a global statistic. For an example of the former, consider a stationary isotropic random field. For an example of the latter, consider the reconstruction of neuronal networks in medical images~\cite{Hu:2021}. The Nelson-Aalen estimator in the manuscript under discussion is a local topological statistic. \section{Persistence landscapes and their use} \label{sec:pl} Persistence landscapes may be used to provide a vector encoding of persistent homology. Persistence landscapes are a sequence $(\lambda_k)_{k \geq 1}$ of functions $\lambda_k:\mathbb{R} \to \mathbb{R}$ or, equivalently, a single function $\lambda: \mathbb{N} \times \mathbb{R} \to R$, where $\lambda(k,t) = \lambda_k(t)$. It is a consequence of their definition that for $k \leq \ell$ and for all $t$, $\lambda_k(t) \geq \lambda_{\ell}(t) \geq 0$ and given a finite amount of data there is a maximum $M$ such that $\lambda_M(t) > 0$ for some $t$. See Figure~\ref{fig:1} for the average persistence landscapes for the Gaussian random fields considered by Garside et al.~\cite{Garside:2021} The difference between the two most similar cases is given in Figure~\ref{fig:2}. To obtain a high-dimensional vector representation of persistent homology, we discretize the persistence landscape. In particular, choose values $t_0 < t_1 < \cdots < t_N$ and a choose a maximum \emph{depth} $K$. Let $\lambda^{(0)}$ and $\lambda^{(1)}$ denote the persistence landscapes for homology in degree $0$ and $1$, respectively. Define $\Lambda \in \mathbb{R}^{2(N+1)K}$ by \begin{equation} \label{eq:1} \Lambda = (\lambda^{(0)}_1(t_0),\ldots,\lambda^{(0)}_1(t_N),\lambda^{(0)}_2(t_0),\ldots,\lambda^{(0)}_K(t_N),\lambda^{(1)}_1(t_0),\ldots,\lambda^{(1)}_K(t_N)). \end{equation} When using persistence landscapes for statistical analysis, the main computational cost is the cost of computing persistent homology. Restricting to a vector $(\lambda^{(0)}_k(t_0),\ldots,\lambda^{(0)}_k(t_0))$ for some fixed $k$ as is done by Garside et al.~\cite{Garside:2021} loses information and does not provide a significant overall savings in computational cost. Repeating the computations in Garside et al.\ using the vector in \eqref{eq:1}, we have the following updates to their Table 2 in our Table~\ref{tab:1}. With this update, the Nelson-Aalen estimator and persistence landscape provide comparable excellent results for M1 v M2 and M2 v M3. The results for the persistence landscape for M1 v M3 are improved but still not as good as those of the Nelson-Aalen estimator. It would be good to understand reason for this difference. We remark that when using the R package \verb+e1071+ with persistence landscapes, one should use the parameters \verb+scale=FALSE+ and \verb+kernel="linear"+ to use the inner product appropriate for $L^2(\mathbb{N} \times \mathbb{R})$. Also, since \verb+e1071+ uses sparse matrices internally and persistence landscapes are sparse it is recommended to use a sparse matrix encoding of the persistence landscape. \begin{figure} \centering \includegraphics[width=0.3\linewidth]{apl0_m1.eps} \quad \includegraphics[width=0.3\linewidth]{apl1_m1.eps}\\ \includegraphics[width=0.3\linewidth]{apl0_m2.eps} \quad \includegraphics[width=0.3\linewidth]{apl1_m2.eps}\\ \includegraphics[width=0.3\linewidth]{apl0_m3.eps} \quad \includegraphics[width=0.3\linewidth]{apl1_m3.eps} \caption{The average persistence landscape in degree $0$ using reduced homology (left) and degree $1$ (right) of 1000 samples of M1 (top row), M2 (middle row), and M3 (bottom row). The $x$ axis gives the function values and the $y$ axis gives the persistence of the homological features of given multiplicity at those values.} \label{fig:1} \end{figure} \begin{figure} \centering \includegraphics[width=0.3\linewidth]{diffapl0_m1m3.eps} \quad \includegraphics[width=0.3\linewidth]{diffapl1_m1m3.eps} \quad \caption{The difference in average persistence landscapes in degree $0$ (left) and degree $1$ (right) between M1 and M3.} \label{fig:2} \end{figure} \begin{table} \centering \begin{tabular}{ccccccc} Mat\'ern & \multicolumn{2}{c}{M1 v M2} & \multicolumn{2}{c}{M1 v M3} & \multicolumn{2}{c}{M2 v M3} \\ $(\eta,\nu)$ & Acc. & Cal. & Acc. & Cal. & Acc. & Cal.\\ (5,1) & 100.0 & 97.4 & 93.4 & 88.1 & 100.0 & 97.2\\ (10,1) & 100.0 & 96.3 & 83.1 & 73.3 & 98.8 & 94.9\\ (5,2) & 100.0 & 97.4 & 87.9 & 80.9 & 100.0 & 97.1 \end{tabular} \caption{Classification of random fields using persistence landscapes. Accuracy (Acc.) measures the proportion of random fields that were correctly allocated and calibration (Cal.) gives the mean estimate class probabilities for the correct values.} \label{tab:1} \end{table} \bibliographystyle{plain}
\section{Contextuality witness of rank-one projectors}\label{app:lemma} \begin{lemma} For any $\{(G',\Vec{w'}),\{\Pi_i\}_{i=1}^{n'},\rho\}$ satisfying \eqref{wc}, where the rank of $\Pi_i$ is $r_i$ $\geqslant 1$, there is $\{(G,\Vec{w}),\{|\psi_{i,k}\rangle\!\langle \psi_{i,k}|\},\rho\}$ satisfying \eqref{wc} such that \begin{equation} \label{splitPi} \sum_{k=1}^{r_i} |\psi_{i,k}\rangle\!\langle \psi_{i,k}| = \Pi_i, \end{equation} where $i = 1, \ldots, n'$ and, for each $i$, $k = 1, \ldots,$ $r_i$, and $(G',\Vec{w'})$ is a vertex-weighted subgraph of $(G,\Vec{w})$. \end{lemma} \begin{proof} If the rank of projector $\Pi_i$ is $r_i (\geqslant 1)$, then we split the vertex $i$ into $r_i$ vertices, say $(i,k)$, where $k = 1, \ldots, r_i$. The edges and weights of the new graph $G$ are defined as follows: \begin{eqnarray} & \forall k, k', i, \quad (i,k) \sim (i, k') \ , \text{ and } \nonumber \\ & \forall i, j, k, k', \quad (i,k) \sim (j,k'), \ \ \text{\it iff} \ \ i \sim j \ , \nonumber \\ & \forall i,k, \quad w_{(i,k)} = w'_i. \label{exclusiveR} \end{eqnarray} The above relations in Eq.~(\ref{exclusiveR}) imply $\alpha(G,\Vec{w}) = \alpha(G',\Vec{w'}) $. Now, if we split each projectors according to \eqref{splitPi}, then the set of rank-one projectors $ \{|\psi_{i,k}\rangle\!\langle \psi_{i,k}|\}$ has $G$ as graph of orthogonality, and furthermore, \begin{equation} \sum_{i=1}^n \sum_{k=1}^{r_i} w_{(i,k)}\ \text{tr} (\rho |\psi_{i,k}\rangle\!\langle \psi_{i,k}|) = \sum_{i=1}^n w'_i\ \text{tr}(\rho \Pi_i), \end{equation} which is greater than $ \alpha(G,w)$ by definition. \end{proof} \section{Communication complexity advantage based on quantum contextuality}\label{app:thms} \begin{lemma} The maximum value of $S$ given by Eq.~\eqref{fom} when the system communicated between Alice and Bob is a classical system of dimension $d$ is given by \begin{equation} S_c = \underset{\{p_e(m|x)\}}{\text{max}} \left[1 - \sum_{y,m} \min \left\{ \sum_{x|f(x,y)=0} t(x,y) p_e(m|x), \sum_{x|f(x,y)=1} t(x,y) p_e(m|x) \right\} \right], \label{reducedfom} \end{equation} where $m= 1,\dots,d$, and, $\forall x,m, \ p_e(m|x) \in \{0,1\}$, $\sum_m p_e(m|x) = 1$. \end{lemma} \begin{proof} Alice and Bob share prior classical random variables $\lambda$ with arbitrary distribution $p(\lambda)$. Alice's strategy is to encode the information of input $x$ into classical message $m$. A general description of such strategy is given by a set of probabilities $\{p_e(m|x,\lambda)\}$, where $p_e(m|x,\lambda)$ is the probability of sending the message $m$ depending on input choice $x$ and random variable $\lambda$. Here $m \in \{1,\dots,d\}$, since the dimension of the communicated system is at most $d$. Bob's decoding strategy is generally represented by the set of probability distribution $\{p_d(z|y, m,\lambda)\}$, where $p_d(z|y,m,\lambda)$ is the probability of output $z$ given his input $y$, received message $m$, and the shared random variable $\lambda$. Therefore, the general expression of the probability of getting outcome $z$ upon receiving inputs $x,y$ in classical communication is given by \begin{equation} p(z|x,y) = \sum_m \sum_\lambda p(\lambda) p_e(m|x,\lambda) p_d(z|y,m,\lambda) . \end{equation} By dividing all inputs $x$ into two subgroups according to the value of $f(x,y)$ given every $y$ and substituting each term using the above in the figure of merit, we find that \begin{align} \label{calints} S_c & = \max_{\substack{ \{p_e(m|x,\lambda)\}\\ \{p_d(z|y,m,\lambda)\}\\ \{p(\lambda)\}} } \sum_y \bigg( \sum_{x|f(x,y)=0} t(x,y) p(0|x,y) + \sum_{x|f(x,y)=1} t(x,y) p(1|x,y) \bigg) \nonumber \\ & = \max_{\substack{ \{p_e(m|x,\lambda)\} \\ \{p_d(z|y,m,\lambda)\}\\ \{p(\lambda)\}} } \sum_\lambda p(\lambda) \left[ \sum_{y,m} \left\{ \left(\sum_{x|f(x,y)=0} t(x,y) p_e(m|x,\lambda)\right) p_d(0|y,m,\lambda) + \left(\sum_{ x|f(x,y)=1} t(x,y) p_e(m|x,\lambda)\right) p_d(1|y,m,\lambda) \right\} \right]. \end{align} Let us see the term within the curly bracket $\{ \ldots \}$. Since $p_d(0|y,m,\lambda) + p_d(1|y,m,\lambda) =1$ the best decoding probability $p_d(z|y,m,\lambda)$ is fixed such that the above expression is \begin{equation} S_c = \max_{\substack{ \{p_e(m|x,\lambda)\} \\ \{p(\lambda)\}} } \sum_\lambda p(\lambda) \left[ \sum_{y,m} \max \left\{ \sum_{x|f(x,y)=0} t(x,y) p_e(m|x,\lambda) , \sum_{ x|f(x,y)=1} t(x,y) p_e(m|x,\lambda) \right\} \right] . \end{equation} Given any encoding probability $\{p_e(m|x,\lambda)\}$, the above expression within the square bracket $[ \ldots ]$ is a convex function of $\lambda$, and thus, without loss of generality, we can take $p(\lambda)=1$ for which that expression is maximum or, equivalently, we can omit the dependence of $\lambda$. This implies \begin{equation}\label{Sc} S_c = \underset{\{p_e(m|x)\}}{\text{max}} \sum_{y, m} \max \left\{ \sum_{x|f(x,y)=0} t(x,y) p_e(m|x) , \sum_{ x|f(x,y)=1} t(x,y) p_e(m|x) \right\} . \end{equation} Further, using the identity, $\max\{a,b\} = a + b - \min \{a,b\}$ for any nonnegative number $a,b$, Eq. (\ref{Sc}) further reduces to \begin{equation} S_c = \underset{\{p_e(m|x)\}}{\text{max}} \left[\sum_{y, m,x} t(x,y) p_e(m|x) - \sum_{y,m} \min \left\{ \sum_{x|f(x,y)=0} t(x,y) p_e(m|x) , \sum_{ x|f(x,y)=1} t(x,y) p_e(m|x) \right\} \right] . \end{equation} Using $\sum_{m} p_e(m|x) = 1, \forall x$, and $\sum_{x,y} t(x,y) =1$ in the above equation, we get \eqref{reducedfom}. Finally, note that it is sufficient to consider the extremal values of $p_e(m|x)$ since the expression is convex. \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:Sc}] Using Eq.~(\ref{reducedfom}) for $S$ given by Eq.~\eqref{fomk}, we can express the optimal classical value as follows: \begin{eqnarray} S_c & = & \frac{1}{N} \underset{\{p_e(m|x)\}}{\text{max}} \Bigg[N - \sum_{y=1}^n \sum_{m=1}^d \text{min} \left\{p(m|x=y) + w_y p(m|x=0), \sum_{x \in N_y} p(m|x) \right\} \nonumber \\ && \qquad \qquad\qquad - \sum_{y=n+1}^{n+k} \sum_{m=1}^d \text{min} \left\{ p(m|x=y), \sum_{x\in N_y} p(m|x) \right\} \Bigg] , \label{Sc1} \end{eqnarray} wherein the encoding strategy $\{p_e(m|x)\}$ is deterministic, that is, for each input $x$, Alice sends a classical level $m$ out of $d$ distinct levels. This is equivalent to assigning one of $d$ colours to each input $x$. Since $d \leqslant \chi(G)$, in general, $d$ colours are not sufficient to colour all the vertices of the extended $\widetilde{G}$ properly. Say $\delta$ is the minimum number of `improperly colored' vertices when $d$ colours are used to colour all the vertices of the extended exclusivity graph. An vertex is `improperly colored' if it has at least one neighbour that shares the same color. We would like to find the optimal encoding strategy $\{p_e(m|x)\}$ that maximizes $S_c$ in \eqref{Sc1}. Say, the optimal encoding is such that, there are $\delta - q$ improperly colored vertices, that is, out of all the vertices, $n+k-\delta-q$ vertices are properly coloured, where $q \in \{0, \ldots, n+k-\delta\}$ is an integer. Let us denote the level/color by $m_x$ that is assigned to input $x=0,1,\dots,n+k$. There are three possibilities for each input $y$: \begin{enumerate} \item \textit{y is not properly coloured.} In this case there exists at least one $x \in N_y$ such that $p(m_y|x) = 1$. Thus, \begin{equation} \sum_{m} \text{min} \left\{p(m|x=y) + w_y p(m|x=0), \sum_{x \in N_y} p(m|x) \right\} \geqslant 1. \end{equation} \item \textit{y is properly coloured and $y \in \{1, \ldots, n\}$.} In this scenario, either $p(m_0|x=y)=0$, or, $p(m_0|x=y) =1$. For the former case, since every $y$ belongs to at least one $d$-clique there exists one $y \in N_x$, for which $p(m_0|x) =1$. Therefore, \begin{equation} \text{min} \left\{p(m_0|x=y) + w_y p(m_0|x=0), \sum_{y\in N_x} p(m_0|x) \right\} \geqslant \min \{w_y,1\} = w_y . \end{equation} While for the later case, \begin{equation} \text{min} \left\{p(m_0|x=y) + w_y p(m_0|x=0), \sum_{y\in N_x} p(m_0|x) \right\} = 0. \end{equation} \item \textit{y is properly coloured and $y \in \{n+1, \ldots, n+k\}$.} In this case, \begin{equation} \sum_m \text{min} \left\{p(m|x=y) , \sum_{y\in N_x} p(m|x) \right\} = 0. \end{equation} \end{enumerate} As the encoding strategy properly colours $n+k-\delta-q$ vertices, the above analysis implies \begin{equation} \sum_y \sum_{m} \text{min} \left\{p(m|x=y) +w_y\ p(m|x=0), \sum_{x \in N_y} p(m|x) \right\} \geqslant \delta + q + \sum\limits_{y|p(m_0|x=y) = 0} w_y. \end{equation} Using this in Eq. (\ref{Sc1}), we obtain \begin{equation} S_c \leqslant \underset{p_e(m|x)}{\text{max}} \frac{1}{N} \left[1-\delta -q-\sum_{y|p(m_0|y) = 0} w_y \right]. \end{equation} Replacing $1$ by $n+k+\sum_{x=1}^{n+k}|N_x| + \sum_y w_y$ from \eqref{eqN} in the above equation, we obtain \begin{eqnarray} S_c &\leqslant & \underset{p_e(m|x)}{\text{max}}\frac{1}{N} \left[n+k+\sum_{x=1}^{n+k} |N_x| -\delta - q + \sum_{y} w_y - \sum_{x|p(m_0|x=y)=0} w_y \right] \nonumber \\ & = & \underset{p_e(m|x)}{\text{max}}\frac{1}{N} \left[n+k+\sum_{x=1}^{n+k} |N_x| - \delta - q + \sum_{x|p(m_0|y)=1} w_y \right]. \end{eqnarray} If $q=0$, then \begin{equation} \sum_{x|p(m_0|y)=1} w_y \leqslant \alpha. \end{equation} On the other hand, if $q > 0$, then \begin{equation} \sum_{x|p(m_0|y)=1} w_y \leqslant \alpha + \sum_y w_y - q, \end{equation} where the sum over $y$ on right-hand-side is taken for $q$ number of different indices. It follows from \eqref{cy} that the above is bounded by $\alpha + q \cdot (\max_y w_y) - q \leqslant \alpha .$ Therefore, the best strategy is choosing $q=0$, which implies \eqref{fomclassical}. \end{proof} \begin{proof}[Proof of Theorem \ref{thm:ccw}] Eq. \eqref{2terms} implies \begin{equation} \label{myrx} \forall y, M_{0|y}^{\rho_{x=y}} = \mathbbm{1}, \ M_{1|y}^{\rho_x} = \mathbbm{1}, \text{ for } x\in N_y, \end{equation} where $M_{z|y}^{\rho_x} $ denotes the reduced from of $M_{z|y}$ in the support of $\rho_x$. Note that $M_{0|x}^{\rho_{x}}$ are projectors and we must have \begin{equation} \label{rxrx'0} \forall x\sim x', \ (M_{0|x}^{\rho_{x}}) \ (M_{0|x'}^{\rho_{x'}}) = \mathbbm{O} , \text{ and } \rho_x \rho_{x'} = \mathbbm{O} . \end{equation} Since $d=d_{\min}$, the size of the maximum clique in the extended graph $\widetilde{G}$ is $d_{\min}$. Say, $\{1,\dots,d_{\min}\}$ is a maximum clique. The conditions \eqref{rxrx'0} for any pair of $x,x' \in \{1,\dots,d_{\min}\}$ and $\rho_x \in \mathbbm{C}^{d_{\min}}$ hold true \textit{if and only if} $\rho_x$ are rank-one projectors and satisfy orthogonality relations according to $\widetilde{G}$. Moreover, it follows from \eqref{myrx} that \begin{equation} M_{0|1}^{\rho_{1}} + \sum_{x=2}^{d} M_{1|1}^{\rho_{x}} \geqslant \mathbbm{1}_{d\times d} . \end{equation} However, the normalization condition $M_{0|1}+M_{1|1}=\mathbbm{1}_{d\times d}$ holds \textit{if and only if} $M^{\rho_x}_{0|x}=\rho_x$ for all $x=1,\dots,d$. Due to the fact that every input belongs to at least one maximum clique, the analysis holds true for all $x$. \end{proof} \begin{proof}[Proof of Theorem \ref{thm:cc}] $\overline{S}$ given by Eq.~\eqref{simS} is $1$ if \begin{equation} \label{sbar1} p(0|x,y=x) = p(1|x,y\in N_x) = 1 , \end{equation} which implies Eq2.~\eqref{myrx}-\eqref{rxrx'0}. Consequently, $\{M_{0|x}^{\rho_{x}}\}$ satisfies the orthogonality relations as per the exclusivity graph $G$. Moreover, the new set of measurements defined by $M_{0|x} = M_{0|x}^{\rho_x}$ also achieves $\overline{S}=1$ for the same Alice's encoding strategy $\{\rho_x\}$. Therefore, for any quantum strategy that yields $\overline{S}=1$, there exists a set of projectors that realizes $G$. In the reverse direction, for any set of projectors $\{\Pi_i\}$ realizing $G$, the strategy in which $M_{0|y}=\Pi_y, \rho_x = \Pi_x/\text{rank}(\Pi_x)$ achieves $\overline{S}=1$. So, there is a one-to-one correspondence between quantum strategy achieving perfect figure of merit and set of projectors satisfying the orthogonality relations according to $G$. Thus, $Q(G)$ is the minimum dimension $d$ such that a set of projectors $\{\Pi_i\}$ acting on $\mathbbm{C}^d$ exists, and moreover, $Q(G)\leqslant d_{\min}$. \\ In classical communication, it follows from \eqref{fom1} that \begin{equation} \overline{S}_c = \frac{1}{N} \underset{\{p_e(m|x)\}}{\text{max}} \left[N - \sum_{y=1}^n \sum_{m=1}^d \text{min} \left\{p(m|x=y), \sum_{x \in N_y} p(m|x) \right\} \right] , \label{sSc1} \end{equation} which is 1 if and only if \begin{equation} \forall x,y, \ \text{min} \left\{p(m|x=y), \sum_{x \in N_y} p(m|x) \right\} = 0 . \end{equation} Since, without loss of generality, we can take $p_e(m|x)$ to be deterministic, the above implies if $p_e(m|x)=1$ for some $x$ then $\forall x'\in N_x, p_e(m|x')=0$. Therefore, the set of $\{m\}$ can be used to color the graph, and similarly, any set of colors used to color the graph can also be used as $\{m\}$ to achieve $\overline{S}=1$. Thus, $C(G)$ is the minimum of number colors required to color the vertices of $G$. \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:qm/cm}] To prove $Q(G^m) \leqslant (d_{\min})^m$, it suffices to show that there exists a set of projectors realizing $G^m$ in $d^m$ dimensional Hilbert space. Consider the realization where the vertex $(i_1,\dots,i_m)$ (where each $i_k\in\{1,\dots,n\}$) of $G^m$ is represented by the projector $\Pi_{i_1}\otimes \Pi_{i_2} \otimes \dots \otimes \Pi_{i_m}$. Clearly, if $i_k \sim j_{k}$ for any $k$, then the respective two projectors are orthogonal as $\Pi_{i_k}$ and $\Pi_{j_{k}}$ are orthogonal. \\ For the classical communication complexity, we make use of Theorem 2.3 of \cite{Feige1997} that states the following relation: \begin{equation} \chi(G\times H) \geqslant \frac{\chi(G)\cdot \chi(H)}{\ln{n}} \end{equation} when both graphs $G$ and $H$ have same number of vertices $n$. Taking $H$ to be $G$, we have $\chi(G^2)\leqslant \chi(G)^2/\ln{n}$. Again, we taking product of two $G^2$ of the same number of vertices $n^2$, we have $\chi(G^4)\leqslant \chi(G)^4/\ln{n^2}$, and similarly, we can obtain \begin{equation} \chi(G^m) \geqslant \frac{2\cdot \chi(G)^m}{m\ln{n}} \end{equation} for any $m=2^q, q \in \mathbbm{N}$. Finally, using the facts that $C(G^m)= \chi(G^m), Q(G^m) \leqslant (d_{\min})^m$ and the above relation, we arrive at \eqref{qm/cm}. On the other hand, for any graph $G$, we have $\chi(G) \geqslant \chi_f(G)$. In addition, $\chi_f(G^m) = (\chi_f(G))^m$ according to Lemma 2.8 in Ref.~\cite{feige1995randomized}. Therefore, Eq.~\eqref{qm/cm2} holds true. \end{proof} \section{}\label{app:qkd} \subsection{Communication complexity advantage based on extended 5-cycle graph} Consider the first figure of the 5-cycle graph in Table~\ref{table}. There are total five events and three extensions. So, $n = 5$ and $k = 3$. We take weighs $w_i = 1 \ \forall i\in \{1,\ldots,5\}$. The classical bound for this contextuality witness $\alpha(G, \Vec{w}) = 2$ whereas quantum bound $\beta(G, \Vec{w}) = \sqrt{5}$. Alice chooses an input $x$ from the set $[x] = \{0,1,\ldots,8\}$. Bob chooses an input $y$ from $[y] = \{1,2,\ldots,8\}$. The task is to maximize the figure of merit (\ref{fomk}). For this, let us first determine $N$ using Eq.~(\ref{eqN}). That is, \begin{align} N &= 5 + 3 + |N_1|+|N_2|+|N_3|+|N_4|+|N_5|+|N_6|+|N_7|+|N_8|+\sum_{i=1}^5 w_i \nonumber \\ &= 5+3+3+3+3+3+4+2+2+2+5 \nonumber \\ &= 35 . \end{align} Using this and $\sum_{x=1}^8 |N_x| = 22$ in Eq.(\ref{fomclassical}), we get the maximum value of the figure of merit with classical settings as $S_c = 0.914$. On the other hand, the maximum figure of merit with quantum settings using Eq.~(\ref{fomq}) is $S_{\beta} = 0.921$. This shows a quantum advantage. Similarly, we have shown the quantum advantage in our communication task for other contextuality witnesses in the third column of the Table~\ref{table}. \begin{comment} \subsection{Quantum key distribution based on extended 5-cycle graph} Here, we present the semi-device independent QKD based on the quantum advantage in the communication complexity task shown above. Alice and Bob will be generating keys when (i) $y = x$ or $y \in N_x$ and (ii) $x = 0$ and $y \in n$. They will not be generating keys for other possible random selections. Consider once again the first figure of the 5-cycle graph in Table~\eqref{table}. In this case, Alice can randomly choose her input $x$ from the set of nine elements ($x \in \{0, 1, \ldots, 8\}$). Bob can randomly choose his input $y$ from the set of eight elements ($y \in \{1, 2, \ldots, 8\}$). The success probability of generating keys ($P_s$) is given as follows: \begin{align} P_s &= p(x=1, y=\{1,2,5,8\})+p(x=2, y=\{1,2,3,6\})+P(x=3, y=\{2,3,4,6\}) \nonumber \\ &+P(x=4, y=\{3,4,5,7\}) +P(x=5, y=\{1,4,5,7,8\})+=P(x=6, y=\{2,3,6\}) \nonumber \\ &+P(x=7, y=\{4,5,7\})+P(x=8, y=\{1,5,8\})+P(x=0, y=\{1,2,3,4,5\}) \nonumber \\ &= \frac{1}{9}\cdot\frac{4}{8} + \frac{1}{9}\cdot\frac{4}{8} +\frac{1}{9}\cdot\frac{4}{8} +\frac{1}{9}\cdot\frac{4}{8} +\frac{1}{9}\cdot\frac{5}{8} +\frac{1}{9}\cdot\frac{3}{8} +\frac{1}{9}\cdot\frac{3}{8} +\frac{1}{9}\cdot\frac{3}{8} +\frac{1}{9}\cdot\frac{5}{8} \nonumber \\ &= \frac{35}{72} = 0.486 \end{align} Where, $p(x=1, y=\{1,2,5,8\})$ represents the probability of Alice's input to be 1 and Bob's input to be $1, 2, 5$ or $8$. In the key string, the probability of the bit to be $0$ is \begin{align} P_0 &=\frac{1}{35} \Bigg[ p(z=0|x=1,y=\{1,2,5,8\})+p(z=0|x=2,y=\{1,2,3,6\})+p(z=0|x=3,y=\{2,3,4,6\}) \nonumber \\ &+p(z=0|x=4,y=\{3,4,5,7\})+p(z=0|x=5,y=\{1,4,5,7,8\}) +p(z=0|x=6,y=\{2,3,6\}) \nonumber \\ &+p(z=0|x=7,y=\{4,5,7\})+p(z=0|x=8,y=\{1,5,8\})+p(z=0|x=0,y=\{1,2,3,4,5\})\Bigg] \nonumber \\ &= \frac{1}{35} \Bigg[1 + 1+ 1+1+1+1+1+1 +\frac{5}{\sqrt{5}}\Bigg] = \frac{8+\sqrt{5}}{35} \nonumber \\ &= 0.292. \end{align} Here, $p(z=0|x=1,y=\{1,2,5,8\})$ is the probability of getting $z=0$ conditioned that $x=1$ and $y=\{1,2,5,8\}$. Note that $z=0$ when $x=y=1$. For other values of Bob's input $y$ ($y=2,5$ or $8$), $z=1$, provided $x=1$. Next, $p(z=0|x=0,y=\{1,2,3,4,5\})$ is the probability of getting $z = 0$ conditioned that $x=0$ and $y=\{1,2,3,4,5\}$. Note that when $x=y$ and $x \neq 0$ then bit in key string is certainly zero but for $x=0$, bit in the key string at Bob side is zero with probability is $1/\sqrt{5}$ in the case of 5-cycle graph. However, Alice puts bit in the key string as zero whenever $x=0$ occurs. This mismatch between Alice and Bob's key bit corresponding to $x=0$ can be corrected during the post-processing stage and does not contribute to the key rate. Next, we calculate the probability of the bit to be $1$ in the key string as \begin{align} P_1 &=\frac{1}{35} \Bigg[p(z=1|x=1,y=\{1,2,5,8\})+p(z=1|x=2,y=\{1,2,3,6\})+p(z=1|x=3,y=\{2,3,4,6\})\nonumber \\ &+p(z=1|x=4,y=\{3,4,5,7\}) +p(z=1|x=5,y=\{1,4,5,7,8\}) +p(z=1|x=6,y=\{2,3,6\}) \nonumber \\ &+p(z=1|x=7,y=\{4,5,7\})+p(z=1|x=8,y=\{1,5,8\})\Bigg] \nonumber \\ &=\frac{1}{35}\Bigg[3 + 3 +3 +3 +4 +2 +2 +2\Bigg] = \frac{22}{35} \nonumber \\ &= 0.628. \end{align} Here, $p(z=1|x=1,y=\{1,2,5,8\})$ is the probability of getting $z=1$ conditioned that $x=1$ and $y = \{1,2,5,8\}$. Note that $z=1$ when $y \in N_x$ ($y=2,5$ or $8$ provided $x=1$). The final keys should be uniform with respect to the bit $0$ and $1$. Hence, the final key rate is $P_s \cdot E = 0.451$, where $E$ is the Shannon information of the raw key string. \end{comment} \subsection{Communication complexity advantages and key rates of the respective QKD protocol based on a few well-known quantum contextuality witnesses} In order to calculate the average key rate per transmission, we compute the Shannon information of the transmitted string which is given as $E = -P_0 \log_2 (P_0) -P_1 \log_2 (P_1)$, where $P_0(P_1)$ is the probability of bit 0(1) in the key. Let $P_s$ be the success probability of generating the key, then the average key generation per transmission or the key rate is $P_s \cdot E$. The key rates for some contextuality witnesses are given in Table~\ref{table}. However, this key rate may not be secure. The secure key rate ($\bf{r}$) is calculated using Eq. (\ref{mono_relation}). For this, we estimation the mutual information between Alice and Bob/Eve as follows \cite{Marcin2011}: \begin{equation} I(A:X)= \sum_{j=0}^1 1 - h(S_{X_j}), \quad \text{where $X$ is $B$ or $E$.} \end{equation} Here, $S_{B_j}(S_{E_j})$ is the figure of merit of guessing $f(x,y) \in \{0,1\}$ for Bob (Eve), $h(S_{X_j})$ is the Shannon binary entropy. We have taken $S_{B_j} = S_{\beta}$ and $S_{E_j} = S_c \forall \{0,1\}$. The secure key rates for some contextuality witnesses are also provided in Table~\ref{table}. Note that Alice and Bob can apply the privacy amplification using Toeplitz matrix based hash function on raw keys to make it secure. \begin{table}[h!] \centering \begin{tabular}{|c|c|c|c| \hline NC & Graph & Communication complexity advantage & Quantum key distribution \\ \hline \hline 5-cycle & \cell{\includegraphics[scale=0.3]{C8.pdf}} & \cell{ \small{$d=3,\ \chi(G)=3,\ \delta=0$} \\ \small{$n=5, \ k=3 $} \\ \small{$w_i=1, \ \forall i = 1,\dots,5$} \\ \small{$\alpha(G,\Vec{w})=2, \quad \beta(G,\Vec{w}) = \sqrt{5}$} \\ $N = 8 + ( 4 + 4\cdot 3 + 3\cdot 2 ) + 5 = 35$ \\ \small{$S_c= \frac{1}{35}(8+22+2) = 0.914$ } \\ \small{$S_{\beta}= \frac{1}{35}(8+22+\sqrt{5}) = 0.921$}} & \cell{\small{$P_ = \frac{35}{72} = 0.486$} \\ \small{$P_0=\frac{(8+\sqrt{5})}{35} = 0.292$} \\ \small{$P_1=\frac{22}{35} = 0.628 $}\\ \small{\textbf{Key rate = 0.457}} \\ \small{\textbf{r = 0.049}}} \\\hline 5-cycle* & \cell{\includegraphics[scale=0.3]{C9.pdf}} & \cell{ \small{$d=3,\ \chi(G)=3,\ \delta=0$} \\ \small{$n=5, \ k=4$} \\ \small{$w_i=1, \ \forall i = 1,\dots,5$} \\ $\alpha(G,\Vec{w})=2, \quad \beta(G,\Vec{w}) = \sqrt{5}$ \\ $N = 9 + ( 4 + 4\cdot 3 + 4\cdot 2 ) + 5 = 38$ \\ $S_c= \frac{1}{38}(9+24+2) = 0.921$ \\ $S_{\beta}= \frac{1}{38}(9+24+\sqrt{5}) = 0.927$} & \cell{\small{$P_s = \frac{38}{90} = 0.422$} \\ \small{$P_0=\frac{(9+\sqrt{5})}{38} = 0.296$} \\ \small{$P_1=\frac{24}{38} = 0.632$}\\ \small{\textbf{Key rate = 0.396}} \\ \small{\textbf{r = 0.043}}} \\\hline 7-cycle & \cell{\includegraphics[scale=0.4]{C11.pdf}} & \cell{ \small{$d=3,\ \chi(G)=3,\ \delta=0$} \\ \small{$n=7, \ k=4$ }\\ \small{$w_i=1, \ \forall i = 1,\dots,7$} \\ $\alpha(G,\Vec{w}) = 3, \quad \beta(G,\Vec{w}) = \frac{7 \cos{\pi/7}}{1+\cos{\pi/7}}$ \\ $N = 11 + ( 4 + 6\cdot 3 + 4\cdot 2 ) + 7 = 48$ \\ $S_c= \frac{1}{48}(11+30+3) = 0.917$ \\ $S_{\beta}= \frac{1}{48}(11+30+\frac{7 \cos \pi/7}{1+\cos \pi/7}) = 0.923$} & \cell{\small{$P_ = \frac{48}{132} = 0.364$} \\ $P_0=\frac{\Big(11+\frac{7 \cos{\pi/7}}{1+\cos{\pi/7}}\Big)}{48} = 0.298$ \\ \small{$P_1=\frac{30}{48} = 0.625$}\\ \small{\textbf{Key rate = 0.343}} \\ \small{\textbf{r = 0.042}}} \\\hline CEG-18 & \cell{\includegraphics[scale=0.3]{C18.pdf}} & \cell{ \small{$d=4,\ \chi(G)=5,\ \delta=3$} \\ \small{$n=18, \ k=0$} \\ \small{$w_i=1, \ \forall i = 1,\dots,18$} \\ $\alpha(G,\Vec{w}) = 4, \quad \beta(G,\Vec{w}) = 9/2$ \\ $N = 18 + ( 18\cdot 6 ) + 18 = 144$ \\ \small{$S_c= \frac{1}{144}(18+108+4-3) = 0.882$} \\ $S_{\beta}= \frac{1}{144}(18+108+\frac{9}{2}) = 0.906$} & \cell{\small{$P_ =\frac{144}{342} = 0.421$} \\ \small{$P_0=\frac{(18+9/2)}{144} = 0.156$} \\ \small{$P_1=\frac{108}{144} = 0.75$}\\ \small{\textbf{Key rate = 0.307}}} \\ \hline YO-13 & \cell{\includegraphics[scale=0.35]{C13.pdf}} & \cell{ \small{$d=3,\ \chi(G)=4,\ \delta=2$} \\ \small{$n=13, \ k=12$} \\ \small{$w_i=1, \ \forall i = 1,\dots,9$} \\ \small{$w_i=1/2, \ \forall i = 10,11,12,13$} \\ $\alpha(G,\Vec{w}) = 7/2, \quad \beta(G,\Vec{w}) = 11/3 $ \\ $N = 25 + ( 24 + 60 + 12 ) + 13 = 134$ \\ \small{$S_c= \frac{1}{134}(25+96+\frac{7}{2}-2) = 0.914$} \\ \small{$S_{\beta}= \frac{1}{134}(25+96+\frac{11}{3}) = 0.930$} } & \cell{\small{$P_ = \frac{134}{650} = 0.206$} \\ \small{$P_0=\frac{(25+11/3)}{134} = 0.214$} \\ \small{$P_1=\frac{108}{134} = 0.806$}\\ \small{\textbf{Key rate = 0.15}}} \\\hline \end{tabular} \caption{Quantum advantage in the one-way communication and quantum key distribution tasks described in the main text based on some quantum contextuality witnesses. The extended graphs are given in the second column, in which the additional edges are drawn by dashed lines. We have considered two different extensions of the 5-cycle graph in the first two rows. In the CEG-18 graph \cite{Cabello1996}, there are nine 4-cliques that are represented by the nine closed lines. In this case, no extension is needed. The details of the communication complexity task are given in the third column. The last column contains values of key rates and secure key rates ({\bf r}) in the presence of Eve for the corresponding semi-device independent QKD protocol. Note that we have not provided the values of {\bf r} for the CEG-18 and YO-13 \cite{Yu2012} graphs, since these contextuality witnesses are not known to satisfy monogamy relation.} \label{table} \end{table} \newpage \mbox{} \newpage \subsection{Randomness certification based on extended 5-cycle graph} \begin{figure}[h!] \includegraphics[width=0.55\textwidth, height=70mm]{randomSDC.pdf} \caption Vertical axis represents the randomness quantified by $\mathbf{H}_{\infty}$ and horizontal axis denotes the obtained figure of merit ($S_o \in (S_c, S_{\beta}]$). The contextual scenario under consideration is represented by the 5-cycle graph. The amount of randomness $H_{\infty}$ is found to be nonzero whenever the figure of merit is greater than the classical upper bound $S_c$. The maximum randomness ($H_{\infty} = 0.77$) corresponds to the optimal figure of merit in the quantum case $(S_{\beta})$. } \label{randomfig} \end{figure} \end{document}
\section{Introduction} There is increasing popularity of mediation analysis in medical research, especially mediation with time-to-event outcomes \citep{Lapointe2018}. In our motivating example, we focus on cardiovascular disease, including coronary heart disease (CHD), from the Framingham Heart Study (FHS). It is widely accepted that evaluating well-established lifestyle risk factors on CHD events plays an important role in controlling and preventing CHD occurrence. Such risk factors typically include lipid profile (i.e., total cholesterol (TC), low density lipoprotein cholesterol (LDL-C), high density lipoprotein cholesterol (HDL-C), and triglycerides (TG)), blood pressure (BP), obesity, diabetes, and cigarette smoking \citep{Wilson1998}. There is growing evidence showing that these risk factors lie in the causal pathway between environmental exposure and downstream CHD events or mortality outcomes \citep{Buttar2005, Sharif2019}. Thus, it is of great interest to understand and estimate the additional proportion of variation in disease outcomes explained by environmental risk factors through these putative mediating pathways. Mediation analysis is able to meet such needs by helping researchers to explain why or how environmental exposures affects disease outcomes \citep{MacKinnon2008,Sampson2018}. Despite increasing research trends in the area of mediation analysis, most studies focus on a single mediator, linear regression, or causal interpretation in simple mediation structures due to the lack of preferred, flexible effect-size measures \citep{Vandenberghe2018}. Here, we would like to extend mediation analysis from linear outcomes to survival outcomes using an $R^2$ measurement, instead of the commonly used product-based mediation effect size measures \citep{VanderWeele2011,Huang2017}. When considering other existing effect size measures, we prefer the use of $R^2$ for survival outcomes for the following reasons: 1) easier to extend to high-dimensional space \citep{Fairchild2009, Yang2019}; 2) high computing efficiency and accuracy when p is larger than 2, of high dimensions, or the mediators are in highly correlated structures \citep{Yang2019}; 3) the component-wise mediation effect-size measures may be positive or negative, leadings to cancellation in the estimation of the total mediation effect via the marginal mediation effect measures, such as the sum of the product measures. The $R^2$ measurement avoids such issues \citep{Fairchild2009, Yang2019}. The chosen $R^2$ measure for survival outcomes also poses another layer of challenges to mediation analyses. There are multiple proposals for $R^2$ measures in survival models \citep{HonerkampSmith2016, ChoodariOskooei2012a, ChoodariOskooei2012b}, and all of the proposed $R^2$ measures can be classified into three groups: explained variation, explained randomness, and predictive accuracy. However, it is not clear which $R^2$ measure will serve best as a tool for mediation analysis for Cox regression models. According to the properties of a good measure of $R^2$ suggested by \cite{Royston2006}, we chose five different $R^2$ measures to evaluate mediation effect performance through simulation studies and real data settings. We recommend two of the five that are better effect size measures for multiple-mediator models under the Cox proportional hazards (PH) framework from simulation studies. In the FHS data analysis, we found that six lifestyle risk factors as mediators altogether can explain more than 80\% of the exposure variables-associated CHD risk. Under the same setting, however, they can only explain 5\% - 14\% of all-cause mortality risk associated with the same set of exposure variables. The rest of the paper is organized as follows. Section 2 presents details of the statistical models that we addressed, specifically the mediation analysis under the Cox PH regression models. Section 3 presents simulation studies. Section 4 provides the results of the real data analysis. Section 5 concludes with a discussion. \noindent \section{Methods} \subsection{Extension of Mediation Analysis for Continuous Outcomes to Survival Outcomes} A large body of literature describe mediation analyses under the linear regression setting for continuous outcomes. In this research, we focus on the common setting with survival outcomes in clinical practice: Cox PH regression models. \subsubsection{Single-Mediator Analysis} A single-mediator model is the simplest case of mediation analysis, where the association between an independent variable $X$ with a dependent variable, time-to-event $T$, is accounted ``partially" or ``entirely" through the third variable, a mediator $M$ (Figure~\ref{f1}). The single-mediator model under a Cox regression setting can be described using the following equations: \begin{figure}[h!] \begin{center} \includegraphics[width=10cm,height=6cm]{single.jpg} \end{center} \caption{Single-Mediator Models} \label{f1} \end{figure} \vspace{-0.5cm} \begin{align} & \lambda(t|X) = \lambda_0^{(X)}(t) \exp{(cX)} \label{eq: X_single},\\ & \lambda(t|X,M) = \lambda_0^{(XM)}(t) \exp{(rX + bM)} \label{eq: XM_single},\\ & \lambda(t|M) = \lambda_0^{(M)}(t) \exp(dM) \label{eq: M_single},\\ & M = e + aX + \epsilon \label{eq: med_single}, \end{align} \noindent where $e$ is an intercept, and $a,b,c,d$ and $r$ are regression coefficients. Note that $\lambda_0^{(X)}(t)$, $\lambda_0^{(XM)}(t)$ and $\lambda_0^{(M)}(t)$ are baseline hazard functions for the three Cox PH models, respectively. $\exp{(r)}$ is the direct effect, $\exp{(a*b)}$ is the indirect effect, and $\exp{(c)}$ is the total effect. There are two equivalent ways to compute the mediation (indirect) effect: product and difference measures \citep{VanderWeele2011}. The product measure is to obtain the product of the coefficients $a$ and $b$, and the difference measure is to subtract the effect $r$ from total effect $c$, where $c = ab + r$, originally proposed in linear regression models by \cite{Baron1986}. Both measures are unstandardized effect size measurements of mediation. Normalized by the total effect, the proportion of the indirect effect (proportion mediated) can be calculated by the following equations: \begin{align*} & \text{Product-based proportion mediated} = \frac{\exp(a*b)}{\exp(c)}, \\ & \text{Difference-based proportion mediated} = \frac{\exp{(c - r)}}{\exp{(c)}} = \exp{(- r)}. \end{align*} In addition to reporting the proportion mediated effect sizes, there have been many other mediation effect size measures proposed in the literature. Partially standardized indirect effect and fully standardized indirect effect have been evaluated for both single-mediator models and two-mediator models, which both have satisfactory relative bias levels and high efficiency \citep{Miocevic2017}. The proportion mediated and ratio mediated effect sizes are most commonly seen in the literature; however, both of them require large sample sizes to obtain stable estimates \citep{MacKinnon2008}. All of these measures face problems in inconsistent mediation models and multiple-mediator models where $a*b$ and $c$ have opposite signs, which is known as suppression via effect-size cancellation by the different signs of coefficients $a$ and $b$. One option to deal with the different signs of $a, b$ and $c$ is to take the absolute value of each before computing the proportion mediated \citep{Alwin1975}. However, this is hard to interpret. $R^2$ measures, the explained portion of variance in an outcome variable by the indirect effect, were originally proposed from commonality analysis by \cite{Fairchild2009}, and they have been developed only for continuous outcomes \citep{Yang2019}. Under Cox regression models, we propose to compute the $R^2$ mediation effect along the same line as in linear regression: \begin{equation} R^2_{med} = R^2_{T,M} + R^2_{T,X} - R^2_{T,MX}, \end{equation} \noindent where $R^2_{T,M}$ is the proportion of variance in $T$ that is explained by $M$, $R^2_{T,X}$ is the proportion of variance in $T$ that is explained by $X$, and $R^2_{T,MX}$ is the proportion of variance in $T$ that is explained by $M$ and $X$. $R^2_{med}$ can be interpreted as the amount of variance in $T$ that is explained by $M$, specific to the mediated effect if no other unmeasured confounders exist. The counterpart of standardized $R^2$ measures is called the shared over simple effect (SOS) \citep{Lindenberger1998}, and calculated via the formula: $SOS = R^2_{med}/R^2_{T,X}$. \subsubsection{Multiple-Mediator Analysis} Figure~\ref{f02} illustrates a model for multiple-mediator analysis, which can be written as follows, \begin{figure}[h!] \begin{center} \includegraphics[width=10cm,height=8cm]{multiple.jpg} \end{center} \vspace{-0.5cm} \caption{Multiple-Mediator Models} \label{f02} \end{figure} \begin{align & \lambda(t|X) = \lambda_0^{(X)}(t) \exp{(cX)} \label{eq: X_multiple},\\ & \lambda(t|X,M) = \lambda_0^{(XM)}(t) \exp{(rX + \sum b_j M_j)} \label{eq: XM_multiple},\\ & \lambda(t|M) = \lambda_0^{(M)}(t) \exp{(\sum d_j M_j)} \label{eq: M_multiple},\\ & M_j = e_j + a_jX + \epsilon_j \label{eq: med_multiple}, \end{align} where $a_j$, $b_j$, $r$, $d_j$, and $c$ are regression coefficients, $e_j$ is an intercept for $j = 1, 2, \cdots, p$, and $p$ is the number of mediators. Note that $M_j$ is regressed on $X$ for each mediator. $\lambda_0^{(X)}(t)$, $\lambda_0^{(XM)}(t)$ and $\lambda_0^{(M)}(t)$ are baseline hazard functions for the three Cox PH models, respectively. Similarly to the single-mediator models, the mediation indirect effect can be calculated through the exponential summation of the products: $\exp(\sum (a_jb_j))$ or exponential difference: $\exp(c - r)$. However, they become more complicated by the addition of multiple mediators, because the directions of $a_{j}*b_{j}$ and $r$ can be very likely different. Standardized proportion mediated measures have been defined in multiple-mediator models as follows: \begin{align*} & \text{Product-based proportion mediated} = \frac{\exp(\sum a_j b_j)}{\exp(c)}, \\ & \text{Difference-based proportion mediated} = \frac{\exp{(c - r)}}{\exp{(c)}} = \exp{(- r)}. \end{align*} Evaluation of the explained variance $R^2$ measure under multiple-mediator models is similar to that used in single-mediator models, and it is straightforward to extend $R^2$ to multiple-mediator models as follows: \begin{align} & R^2_{med} = R^2_{T,M} + R^2_{T,X} - R^2_{T,MX} \label{eq: R2medPH}, \\ & SOS = R^2_{med}/R^2_{T,X} \label{eq: SOSPH}, \end{align} \noindent where $R^2_{T,X}$, $R^2_{T,MX}$ and $R^2_{T,M}$ are based on models (\ref{eq: X_multiple}), (\ref{eq: XM_multiple}), and (\ref{eq: M_multiple}), respectively. $R^2_{med}$ is interpreted as the difference of the variance of the dependent variable $T$ that is explained by the exposure $X$ ($R^2_{T,X}$: total effect), and the variance that can be explained by the exposure after removing the mediator mediated effect ($R^2_{T,MX}-R^2_{T,M}$: the so-called direct effect). The $R^2_{med}$ measure has many characteristics of a good measure of effect size. It is appealing to measure the total mediation effect of multiple-/high-dimensional mediators \citep{Yang2019}. It has been shown to have stable performance for sample sizes $> 100$ \citep{Fairchild2009}. Its scale is appropriate for most of the given questions of interest, and it increases as the mediation effect approaches the total effect. A major concern is that it can be negative, hindering its interpretation, for which we will give more detailed discussion in the Results and Discussion sections. Here we would like to evaluate performance of the $R^2_{med}$ measure under a multiple-mediator Cox regression setting ($n >> p$ and $p \le 10$). \subsection{Comparison of Different $R^2$ Measures for Multiple-mediator Mediation Analysis under the Cox PH Models} \label{R2prop} Motivated by the definition of $R^2_{med}$ in the linear regression framework, we calculate mediated effects by $R^2_{med}$ measures for Cox PH models as defined in formula (\ref{eq: R2medPH}). In general, $R^2$ measures in survival models are calculated by the formula: $ R^2 = 1-\frac{Var(g(T)|Z)}{Var(g(T))}$, where $g$ is a link function. \cite{Royston2006} suggested that a good measure of $R^2$ should have the following five properties: (a) closely related to explained variation, which is ``equivalent" to linear regression analysis; (b) approximate independence of the amount of censoring; (c) $R^2$ increasing with the strength of association; (d) nesting property: for two models, $M_1$ nested in $M_2$ should have $R^2 (M_1) < R^2 (M_2)$; (e) availability of confidence intervals. Based on the above properties, we chose five different $R^2$ measures to assess the performance of the corresponding $R^2_{med}$ mediation effect measure under the Cox PH modeling framework in simulation studies and real data analysis. Two of the five different $R^2$ measures are defined as follows \citep{Royston2006}: \begin{align} & R_n^2 = 1-\exp{\{- \frac{2}{n}(l_{\hat{\beta}} - l_0)\}} = 1- \exp{(-\frac{\chi^2}{n})} \label{R2n},\\ & R_k^2 = 1-\exp{\{- \frac{2}{e}(l_{\hat{\beta}}} - l_0)\} = 1- \exp{(-\frac{\chi^2}{e})} \label{R2k}, \end{align} where $n$ is the sample size, and $e$ is the number of events. $l_{\hat{\beta}}$ denotes the maximized log likelihood under the working model with $\beta$, and $l_0$ is the maximized log likelihood of the null model. $ \chi^2 = 2(l_{\hat{\beta}} - l_0)$ is the likelihood ratio statistic for comparing between the model with $\beta$ and the null model without $\beta$. Equation (\ref{R2n}) is a classic measure of the proportion of explained variance of outcome dependent on the predictors in a general regression model. It was originally developed by \cite{Nagelkerke1991}, and we call it $R_n^2$ . Equation (\ref{R2k}) generalizes the $R_n^2$ measure for application to the Cox PH regression models, as done by O'Quigley et.al (2005). This measure was considered for computing explained variance in the context of censored survival data, instead of only considering sample size \citep{O'Quigley2005}. We call the measure $R_k^2$. The other three $R^2$ measures are defined as follows \citep{Royston2006, Heller2012}: \begin{align} & R_r^2 = \frac{A}{\frac{\pi^2}{6} + A} = \frac{R_k^2}{R_k^2 + \frac{\pi^2}{6}(1 - R_k^2) } \label{R2r},\\ & R_b^2 = \frac{B}{0.5772 + B} \label{R2b},\\ & R_w^2 = \frac{var(\textbf{Z}\boldsymbol{\beta})}{1 + var(\textbf{Z}\boldsymbol{\beta})} \label{R2w}, \end{align} where $A = R_k^2/(1 - R_k^2)$, $\textbf{Z} = (X, \textbf{M})$ \citep{Royston2006}, $B = log(\frac{\sum_{i=1}^{n} exp(\boldsymbol{\beta}^T \textbf{z}_i)}{n})$, $\textbf{z}_i$ is an element of $\textbf{Z}$, $ i = 1, \cdots, n$, and $ \frac{\pi^2}{6} -1 = 0.5772$ \citep{Heller2012}. Equation (\ref{R2r}) is a function of the $R_k^2$ measure, which was developed by Royston (2006) to achieve better performance in Cox PH regression models. Equation (\ref{R2b}) is a measure of explained risk in the Cox PH models developed based on entropy loss functions by Heller (2012). Here we call this measure $R_b^2$. The major advantage of the $R_b^2$ measure is that it is compatible to the $R^2$ measure in linear regression models \citep{Heller2012}. The $R^2$ measure in equation (\ref{R2w}) is a simple one to approximate the measure of explained ``randomness" in the Weibull model \citep{Kent1998}, and we call it $R_w^2$. \section{Simulation Study} \subsection{Single-Mediator Models} \subsubsection{Simulation Setting} Single-mediator models can be described using equations (\ref{eq: X_single}) to (\ref{eq: med_single}) in the Methods section. We assumed the two following true models to generate the data, for subject $i=1,\ldots,n$: \begin{align*} & M_i = e + aX_i + \epsilon_i, \\ & \lambda(t|X_i, M_i) = \lambda_0^{(XM)}(t) \exp(rX_i + bM_i). \end{align*} \noindent At the same time, we used the following models together to estimate parameters and compute effect size measures based on the simulated data: \begin{align*} & \lambda(t|X_i) = \lambda_0^{(X)}(t) \exp(cX_i), \\ & \lambda(t|M_i) = \lambda_0^{(M)}(t) \exp(dM_i), \end{align*} where $X_i$ was an exposure variable, $M_i$ was a mediator, and we assumed that $M_i$ was continuous and linearly regressed on $X_i$. $e$ was an intercept. $c$ was the total effect for the exposure variable, and $\epsilon_i$ was an error term, independent of $X_i$. We simulated $X_i$ from a standard normal distribution and generated a single mediator $M_i$ from equation (\ref{eq: med_single}). We assumed a common baseline hazard functional form: $\lambda_0(t) = \lambda t^{\lambda - 1} \exp(\eta)$, with $ \lambda = 2$ and $\eta = -5$. The error term $\epsilon_i \overset{i.i.d.}{\sim} N(0,1) $. We generated the survival time $T$ by using equation (\ref{eq: XM_single}). We further let $ a = 0.5$, $b = -1.5$, $r = 2$, sample size $n=2000$, and replication times $Q=1000$. The indirect mediation effects based on the product and difference measures and $R^2_{med}$ were all calculated by the corresponding functions under the following two settings, based on Cox PH models: \noindent {Setting (S1)}: We fixed the sample size $n= 2000$ and let the censor rates vary from 5\% to 95\%, including 5\%, 15\%, 20\%, 25\%, 35\%, 65\%, 85\%, 90\%, and 95\%; \noindent {Setting (S2)}: We fixed the censor rate at 25\% and let the sample size very from 200 to 5000, including 200, 500, 1000, 2000, and 5000. \subsubsection{Simulation Results of Single-Mediator Models} \begin{figure}[h!] \begin{center} \includegraphics[width=12cm,height=18cm]{singleMed.pdf} \end{center} \caption{Plots of indirect mediation effects by the product (Prod) and difference (Diff) measures under the single-mediator setting. (A) varying the censor rates; (B) Varying the sample sizes.} \label{f1-1} \end{figure} \cite{Tein2003} reported, without considering censoring and ties, that the product and difference effect size measures of single-mediator analysis were comparable by simulations in log survival time models and log hazard time models, but not in Cox PH models. \cite{VanderWeele2011} provided an analytical approach to prove the equivalence of the two measures for single-mediator analysis in both PH models and accelerated failure time models only when the outcome is rare. To confirm the above statements, our simulation results showed that the two measures were quite close if the censor rate was above $90\%$; if the censor rate was $95\% $, their values were almost identical, such that they converged as shown in Figure \ref{f1-1}A under the Cox PH modeling framework. If we fixed the censor rate at $85\%$, the two indirect effect measures did converge for varied sample sizes from 50 to 5000, as shown in Figure \ref{f1-1}B. Except for performing mediation analysis under linear regression or non-linear regression (such as Cox PH models) with a rare event, we would get quite different results from these two measures. Therefore, development of more generalized effect size measures are necessary for Cox regression models, and we suggest use of $R^2$ measures. \begin{figure}[h!] \begin{center} \includegraphics[width=15cm,height=14cm]{censor-single.pdf} \end{center} \caption{Plots of $R^2_{med}$ effect sizes of five different $R^2$ measures by varying censor rates under the single-mediator setting.} \label{f1-2} \end{figure} Under simulation setting (S1), we fixed the sample size and varied censor rates to compare the performance of the five different $R^2$ measures of mediation effect size. As shown in Figure \ref{f1-2}, we found, except for the $R_n^2$ measure, that the rest of the four measures increased slowly with increasing censor rates, going up more dramatically when censor rates reached higher levels (e.g., greater than 90\%). $R_k^2$, $R_b^2$, and $R_w^2$ had relatively closer profiles. $R_k^2$ kept values at a bit of a higher level, and $R_r^2$ kept values lower than $R_b^2$ and $R_w^2$. Therefore, these two measures, $R_b^2$ and $R_w^2$, were relatively independent of censor rate changes. Comparing $R_b^2$ and $R_w^2$ with the product or difference effect size measures under the same simulation setting, these two $R^2$ measures were relatively stable and independent of censoring. \subsection{Multiple-Mediator Simulations} \subsubsection{Simulation Setting} \noindent Multiple-mediator models under the Cox PH setting follow equations (\ref{eq: X_multiple}) to (\ref{eq: med_multiple}) in the Methods section. As in single-mediator models, we assumed the following two true models to generate the data, for subject $i=1,\ldots,n$ and mediator $j=1,\ldots,p$: \begin{align*} & M_{ij} = e_j + a_jX_i + \epsilon_{ij}\\ & \lambda(t|X_i,\boldsymbol{M_{i}}) = \lambda_0^{(XM)}(t) \exp(rX_i + \sum b_j M_{ij}). \end{align*} \noindent We also used the following models together to estimate parameters and compute effect size measures based on the simulated data: \begin{align*} & \lambda(t|X_i) = \lambda_0^{(X)}(t) \exp(cX_i), \\ & \lambda(t|\boldsymbol{M_{i}}) = \lambda_0^{(M)}(t) \exp(\sum d_j M_{ij}), \end{align*} where $X_i$ was an exposure variable, $M_j$ was a continuous mediator, $e_j$ was an intercept, and $\epsilon_{ij}$ was an error term. $a_j$, $b_j$, $r$, $d_j$, and $c$ were regression coefficients, among which $c$ was the total effect. $\exp{(r)}$ was the direct effect and $\exp{(a^Tb)}$ was the product indirect effect; these are usually estimated by the partial likelihood approach. We further let $ a = [a_1, a_2,\cdots,a_p]^T, b = [b_1, b_2,\cdots,b_p]^T $, the sample size $n=2000$, and replication times $Q=1000$, where $p=5$. We assumed a common form of baseline hazard function: $\lambda_0(t) = \lambda t^{\lambda - 1} \exp(\eta)$, a Weibull distribution with $ \lambda = 2$ and $\eta = -5$. We generated the survival time $T$ by using equation (\ref{eq: XM_multiple}). The product and difference measures, along with the five $R^2_{med}$ effect size measures defined in formula (\ref{R2n} - \ref{R2w}), were all computed via the functions under the following five settings based on Cox PH models. Setting (M1): We assumed five true mediators existed. The independent variable $X$ followed standard normal distribution $N(0,1)$. The regression coefficients were set as follows: $r=2.5, b_j = 0.5, a_j = 1$, for $j = 1, 2, \cdots, 5$. Therefore, after considering their correlation introduced by the mediated relations among $X$ and all mediators, $(X_i, M_{i1},\ldots, M_{i5})^{T}$ were generated altogether by a multivariate normal distribution with a mean vector of $0$ and a variance-covariance matrix with a compound symmetry structure: its diagonal was a vector $(1, 1.25, 1.25, 1.25, 1.25, 1.25)^{T}$, and all off-diagonal values were 0.25. We varied the censor rates at 5\%, 25\%, 65\%, 85\%, and 95\%.\\ \noindent Setting (M2): We assumed five true mediators existed. The independent variable $X$ and all mediators followed a multivariate normal distribution as in setting (M1), but its variance-covariance matrix changed with varying values of $a$. We varied $a$ by letting $a_j = 0.05,0.25,0.5,1,3$, or $5$, and the rest of the regression coefficients were set as follows: $r=2.5$ and $b_j = 0.5$, for $j=1,\ldots,5$. The censor rate was set at 85\%.\\ \noindent Setting (M3): The independent variable $X$ and all mediators followed multivariate normal distribution as in setting (M1). We varied $b$ by letting $b_j = 0.01,0.25,0.5,1,2$ ,or $3$, and the rest of the regression coefficients were set as follows: $r=2.5$ and $a_j = 1$, for $j=1,\ldots,5$. The censor rate was set at 85\%.\\ \noindent Setting (M4): The independent variable $X$ and all mediators followed multivariate normal distribution as in setting (M1). We varied the direct effect $r$ by letting $r= 0.05,0.5,1,2,5$, or $10$, and the rest of the regression coefficients were set as follows: $ b_j = 0.5; a_j = 1$ for $j=1,\ldots,5$. The censor rate was set at 85\%.\\ \noindent Setting (M5): The independent variable $X$ and all mediators followed multivariate normal distribution as the setting (M1), and the censor rate was set at 85\%. We varied the number of mediators from 1 to 5 to assess the mediation effects for nested models. \subsubsection{Simulation Results of Multiple-Mediator Models} \begin{figure}[h!] \begin{center} \includegraphics[width=14cm,height=18cm]{r2SOS.pdf} \end{center} \caption{Plots of SOS mediation effects for five different $R^2$ measures by varying strength of association and censor rates. (A) Varying $a$ values; (B) Varying $b$ values;(C) Varying $r$ values; (D) Varying censor rates.} \label{f2} \end{figure} \noindent We first studied the properties of $R^2$ measures. Under the above five simulation settings of multiple-mediator models, we compared the performance of the five different $R^2$ measures of mediation effect size, and investigated whether any of them could follow the desirable characteristics of good $R^2$ measures listed in Section \ref{R2prop}. From simulation results shown in Figure \ref{f2}D, we found the $R_n^2$ measure decreased with increasing censor rates, and the other four measures were relatively independent of censor rates (property(b)). By varying $a$ and $b$, shown in Figure \ref{f2}A and B, we could see the mediation effects were increasing with the growth of coefficient $a$ and $b$ values. By varying $r$, shown in Figure \ref{f2}C, we could see the opposite trend: the mediation effects were decreasing with an increase in coefficient $r$ values. In all these settings, the $R_n^2$ measure changed more dramatically relative to the other $R^2$ measures, and its values were much lower than the other four. The $R_k^2$ measure was always relatively higher than the other three, i.e., $R_r^2$, $R_b^2$, and $R_w^2$, which almost overlapped with each other. Therefore, we can interpret that these three measures of mediation effects were increasing with an increase in the effect size of $a$ or $b$, except at the highest level (e.g., such as $a$ or $b$ values reaching from 2 to 3, which were too high and unrealistic values). Similarly, when we varied $r$ from 0.05 to 10, within the reasonable range from 0.05 to 6, all three $R^2$ SOS measures were decreasing more reasonably than the other two measures. So all of these results may reflect that the three measures $R_r^2$, $R_b^2$ and $R_w^2$ satisfied property (c). \begin{figure}[h!] \begin{center} \includegraphics[width=12cm,height=14cm]{nestedr2.pdf} \end{center} \caption{Plots of five different $R^2$ SOS measures by varying the number of mediators from 1 to 5.} \label{f3} \end{figure} We also investigated the nested property by varying the number of mediators. As shown in Figure \ref{f3}, all five $R^2$ SOS measures increased with the increasing number of mediators from 1 to 5. The only difference was that $R_n^2$ increased a bit faster, and at the same time, its values were much lower than the other four measures. $R_n^2$ kept relatively higher values, and $R_r^2$ kept relatively lower ones compared with $R_b^2$ and $R_w^2$. So these results may reflect that all $R^2$ SOS measures satisfied property (d). Both $R_b^2$ and $R_w^2$ were closely related to explained variation, which is ``equivalent" to linear regression analysis (property(a)). Their formula also suggested some flexibility to change with model structure alterations, such as adding covariates or considering interaction terms \citep{Royston2006, Heller2012}. Their confidence interval can be approximately calculated using the delta method or bootstrap approach (property(e)). Therefore, in conclusion, we recommend that the $R^{2}_{med}$ and $SOS$ based on $R_b^2$ and $R_w^2$ are better effect size measures for multiple-mediator models under the Cox PH framework. \noindent \begin{figure}[h!] \begin{center} \includegraphics[width=14cm,height=18cm]{abr2f4.pdf} \end{center} \caption{Plots of mediation effects comparing two $R^2$-based SOS measures with the product (Prod) and difference (Diff) indirect effect measures. (A) Varying $a$ values; (B) Varying $b$ values;(C) Varying $r$ values; (D) Varying censor rates. Note: $R^2_b$ and $R^2_w$ curves almost overlap in plots from (A) to (D).} \label{f4} \end{figure} We compared the $R^2$ SOS measures, $R_b^2$ and $R_w^2$, with the product and difference indirect effect measures, which are commonly used under the single-mediator setting. We calculated the proportion mediated indirect effects for these two measures under varying censor rates and strength of association in our multiple-mediator models. From the simulation results shown in Figure \ref{f4}, we can see that for all the settings, the difference measure was hardly sensitive to varying values of $a$ and $b$ compared with the $R^2$ measures. On the other hand, the product measure under varying strengths of association could change dramatically and be totally off. With varying censor rates, the patterns were similar for all four measures. Therefore, the difference measure compared with the product measure was more similar to $R^2$ measures except in a much smaller value range. Thus, such comparisons support our suggestion to use the $R^2$ measures for mediation effect. \noindent \section{Real Data Example: Application to the Framingham Heart Study} \subsection{Dataset Description} The Framingham Heart Study, which began in 1948, is a family-based, ongoing longitudinal prospective cohort study \citep{Splansky2007}. It primarily investigates cardiovascular diseases among the residents of the town of Framingham, Massachusetts. This study has included participants from three generations: the original cohort (first generation), the offspring cohort (second generation), and the third generation cohort. The offspring cohort is the largest one. For our present study, we used the offspring cohort dataset, and it included both longitudinal phenotype measurements and time to disease events for 1523 unrelated participants. We downloaded the data from the US National Center for Biotechnology Information dbGaP \citep{Cao2016}. We were interested in two survival outcomes in the FHS data: CHD occurrence and all-cause mortality. It has been reported that the following major risk factors affect CHD events: lipid abnormalities, cigarette smoking, drinking, blood pressure, older age, and obesity (body mass index (BMI) 30 or higher) \citep{Wilson1998}. Such risk factors are also associated with general or coronary cause-specific mortality \citep{ Sharif2019,Keeley2010}. In general, cholesterol is a fat-like substance in the blood, which is necessary for building-up of arteries walls. However, high blood cholesterol is a major risk factors for heart disease: the higher the blood LDL-C level, the greater the risk for developing heart disease or having a heart attack. On the other hand, a higher HDL-C level can help to clear an overabundance of cholesterol in the blood, benefiting health. These risk factors are in generally highly correlated. Previous research suggest that increased smoking or smoking paired with drinking and other factors may be responsible for increases in TC, LDL-C, and TG, as well as decreases in HDL-C \citep{Gossett2009, Mukamal2006, Vodnala2012}. Therefore, several or all risk factors may work together to confer the risk of heart diseases \citep{Buttar2005, Jousilahti1996}. To this end, we would like to untangle this research ``puzzle" in order to understand why and how these factors work together to contribute to the occurrence of clinical outcomes by mediation analysis. Specifically, we used three variables together as exposures, including current smoking, current drinking, and gender. We used the baseline age as a left truncation variable. The mediators were HDL-C, LDL-C, TC, TG, glucose, and BMI. We evaluated their mediation effects via SOS of $R^2$ measures in the single and multiple-mediator models with CHD risk and the risk of all-cause mortality. Among the 1523 subjects, there were 209 incident CHD events and 206 all-cause deaths with a censoring rate of 86.3\% and 86.4\%, respectively. The follow-up duration ranged from 8 years to 44 years with a median of 41 years. The results are summarized in Tables \ref{T1} and \ref{T2}. \subsection{Single-Mediator Analysis of the FHS Data} In order to show the conformity of results from our mediation analyses using single-mediator and multiple-mediator models, we first evaluated all six mediators one-by-one in single-mediator models for both CHD risk and all-cause mortality risk. From Table \ref{T1}, we found that HDL-C could explain the highest variation of both CHD risk and all-cause mortality risk in all five $R^2$ measures. However, the $R^2_{med}$ measure might be negative in single-mediator models, which could be explained for two reasons. First, the mediation effect size was really small, or close to zero. For instance, we simulated an unrelated variable (called ``Random"), and its $R^2$ values were small around 0, which sometimes lead to $R^2_{med}$ negativity. Second, if the directions of the indirect and direct effects were different (for example, TC in CHD risk or LDL-C in all-cause mortality), this might result in $R^2_{med}$ negativity, consistent with other reports \citep{Yang2019}. We will expand this in the Discussion section. \begin{table} \caption{\label{T1} SOS evaluation of $R^2_{med}$ measures in single-mediator models} \centering \begin{threeparttable} \begin{tabular}{p{2cm} p{2cm} p{2cm} p{2cm} p{2cm} p{2cm}} \hline \multicolumn{6}{l}{Time to CHD} \\ \hline Mediators & SOS-$R^2_n$ & SOS-$R^2_k$ & SOS-$R^2_r$ & SOS-$R^2_b$ & SOS-$R^2_w$\\ \hline BMI & 0.14 & 0.16 & 0.14 & 0.16 & 0.14\\ Fgluc & 0.27 & 0.35 & 0.29 & 0.32 & 0.23\\ HDL-C & 0.68 & 0.73 & 0.69 & 0.85 & 0.83\\ LDL-C & 0.070 & 0.12 & 0.079 & 0.088 & 0.078\\ TC & -0.13 & -0.10 & -0.13 & -0.16 & -0.12\\ TG & 0.35 & 0.50 & 0.39 & 0.70 & 0.32\\ Random & -0.0057 & 0.0017 & -0.0046 & 0.0053 & 0.0067\\ \hline \multicolumn{6}{l}{Time to all-cause mortality} \\ \hline BMI & 0.011 & 0.019 & 0.012 & 0.010 & 0.0073\\ Fgluc & 0.025 & 0.072 & 0.045 & 0.026 & 0.047\\ HDL-C & 0.14 & 0.16 & 0.15 & 0.14 & 0.18\\ LDL-C & -0.0056 & -0.012 & -0.049 & -0.046 & -0.039\\ TC & 0.048 & 0.053 & 0.048 & 0.056 & 0.067\\ TG & 0.048 & 0.055 & 0.048 & 0.039 & 0.039\\ Random & 0.011 & 0.021 & 0.012 & 0.023 & 0.029\\ \hline \end{tabular} \begin{tablenotes} \item BMI: body mass index; Fgluc: fasting glucose; HDL-C: high density lipoprotein cholesterol; LDL-C: low density lipoprotein cholesterol; TC: total cholesterol; TG: triglycerides; Random: a simulated random variable. SOS: the shared over simple effect. \end{tablenotes} \end{threeparttable} \end{table} \subsection{Multiple-Mediator Analysis of the FHS Data} \begin{table} \caption{\label{T2} SOS evaluation of $R^2_{med}$ measures in multiple-mediator models} \centering \begin{threeparttable} \begin{tabular}{p{2cm} p{2cm} p{2cm} p{2cm} p{2cm} p{2cm}} \hline \multicolumn{6}{l}{T = Time to CHD } \\ \hline $R^2$ Type & $R^2(T,X)$ & $R^2(T,M)$ & $R^2(T,XM)$ & $R^2_{med}$ & SOS\\ \hline $R_n^2$ & 0.024 & 0.080 & 0.085 & 0.019 & 0.81\\ $R_k^2$ & 0.16 & 0.45 & 0.47 & 0.14 & 0.88\\ $R_r^2$ & 0.10 & 0.34 & 0.35 & 0.088 & 0.84\\ $R_b^2$ & 0.12 & 0.50 & 0.49 & 0.13 & 1.055\\ $R_w^2$ & 0.15 & 0.33 & 0.35 & 0.13 & 0.87\\ \hline \multicolumn{6}{l}{T= Time to all-cause mortality } \\ \hline $R_n^2$ & 0.031 & 0.013 & 0.042 & 0.0014 & 0.047\\ $R_k^2$ & 0.21 & 0.091 & 0.27 & 0.027 & 0.13\\ $R_r^2$ & 0.14 & 0.057 & 0.18 & 0.0098 & 0.072\\ $R_b^2$ & 0.21 & 0.061 & 0.25 & 0.018 & 0.086\\ $R_w^2$ & 0.20 & 0.080 & 0.25 & 0.027 & 0.13\\ \hline \end{tabular} \begin{tablenotes} \item X(exposures): gender, smoking, and drinking status; M (mediators): body mass index, fast glucose, high density lipoprotein cholesterol, low density lipoprotein cholesterol, total cholesterol, and triglycerides; SOS: the shared over simple effect. \end{tablenotes} \end{threeparttable} \end{table} \noindent From the results of multiple-mediator models in Table \ref{T2}, we found that, except for $R^2_{n}$, the exposure variables X that included gender, smoking, and drinking status could explain 10-16\% of the variation in CHD risk and 14-21\% of the variation in all-cause mortality risk. All six mediators together explain 33-50\% of the variation in CHD risk and 5.7-9.1\% of the variation in all-cause mortality risk. All six mediators plus exposures could explain 35-49\% of the variation in CHD risk and 18-27\% of the variation in all-cause mortality risk. After calculation of the mediation effect at the SOS scale for all five $R^2$ measures, six mediators altogether could explain more than 80\% of the variation in CHD risk from exposure variables. $R_b^2$ provided the highest value (1.05), which makes sense for two reasons. First, here we used almost all known CHD risk factors as our mediators to explain CHD risk variation in our exposure variables, including gender, drinking, and smoking. Second, $R^2_{med}$ is not bounded in the interval (0, 1), thus SOS may be larger than 1 if correlation among mediators or exposure variables is high. On the other hand, the six mediators were able to explain about 5\% - 14\% of the all-cause mortality risk from the exposure variables in all five $R^2$ measures under the same settings. This suggests that these six well-established lifestyle risk factors for cardiovascular diseases mediated much less on the exposure-all-cause-mortality association than the exposure-CHD association. \section{Discussion and Conclusion} There are multiple challenges when estimating mediation effects. For example, we have to choose the right effect-size measure, especially under a Cox regression setting. Multiple or high-dimensional mediators are often encountered in practice. Thus, our goal in this article was to study the statistical characteristics and evaluate the performance of $R^2_{med}$ effect size measures for multiple-mediator models under the Cox PH regression framework. We would like to give a reasonable solution to the posed challenges except implying causal inference. Since causal mediation models require very strong assumptions, which may be often violated and difficult to verify in real data applications. Therefore, we do not pursue cause-and-effect interpretation in this article. We extended mediation analysis from single-mediator and linear regression based models to multiple-mediators and Cox PH regression models. At the same time, we chose the $R^2$ measure instead of the commonly used product measure of indirect mediation effect. The chosen $R^2$ measure also posed another layer of challenges to mediation analyses under Cox regression frameworks due to the multiple definitions of $R^2$ for survival outcomes \citep{HonerkampSmith2016, ChoodariOskooei2012a, ChoodariOskooei2012b}. According to the five properties of a good $R^2$ measure by Royston's suggestion under Cox regression models, we chose five $R^2$ measures: $R^2_n, R^2_k, R^2_r, R^2_b$, and $R^2_w$ to evaluate their performance in our simulation studies and real data analyses. $R^2$ measures, in general, are stable and easier to extend to multidimensional or even higher-dimensional models compared to commonly used mediation effect measures \citep{Yang2019}. By simulation studies, the $R^2_{med}$ mediation effect measures based on $R_b^2$ and $R_w^2$ are suggested as better for multiple-mediator analysis of Cox PH models due to their satisfying all five properties of \cite{Royston2006}. By using the recommended measures in the FHS data, we found that all six major mediators together including the four lipids, BMI, and glucose, were able to explain 80\% - 90\% of the variation in CHD risk from the exposure variables, and explain the 4\% - 14\% of the variation in all-cause mortality risk from the same set of exposure variables. Due to lack of multiple-mediator models under similar settings, it is hard to compare our results with others. However, these results were consistent with those of our single-mediator models. Although we obtained favorable results in the $R^2_{med}$ measures, the present study has three possible limitations. First, we assumed that the mediation models were correctly specified; the performance of the $R^2_{med}$ measure in missepecified models warrants future investigation. Second, more complicated model structures, such as interactions among exposure variables and mediator variables were not included in our studies. So the $R^2_{med}$ measure was not intended to extend for such complicated models. Third, from the results of single-mediator models in real data analyses, as well as its definition (formula (\ref{eq: R2medPH})), we could see that $R^2_{med}$ was not bounded. It can be negative or above 1. Such a result could limit its interpretation. The major reasons of negativity are as follows: if the indirect mediation effect of a mediator is very small (close to zero), a $R^2_{med}$ measure is negative due to randomness in data. Another reason is the ``masking" effect among exposure variables and mediators with respect to their outcomes \citep{deHeus2012, Yang2019}. It is very likely that mediators or exposures have different directions of indirect or direct effects resulting in the negativity of $R^2_{med}$. However, as the number of mediators increases, the number of possible combinations of the directions of the mediation effects increase \citep{MacKinnon2008, Yang2019}. In fact, \cite{Yang2019} showed that, under the high-dimensional mediator setting, the negativity of $R^2_{med}$ is unlikely to occur, which is consistent with the results of our simulation study and real data analysis (Table \ref{T2}). In summary, our models extend from the linear, single-mediator analysis for the following three aspects: 1) from univariate to multiple mediators ($P \le 10$); 2) our model formulation and estimation apply under the Cox PH regression framework; 3) we suggested using the two generalized $R^2$ measures: $R^2_b$ and $R^2_w$ in Cox regression-based mediation analysis. \section*{Acknowledgments} This research was supported by the National Institutes of Health (NIH) grant R01HL1167202; P.W. was partially supported by NIH grants R01CA16912 and P50CA21767; X.H. was partially supported by the National Science Foundation through grant DMS 1612965, U54CA096300, U01CA152958 and 5P50CA100632, and the Dr. Mien-Chie Hung and Mrs. Kinglan Hung Endowed Professorship. The Framingham Heart Study is conducted and supported by the National Heart, Lung, and Blood Institute (NHLBI) in collaboration with Boston University (Contract No. N01-HC-25195). This manuscript was not prepared in collaboration with investigators of the Framingham Heart Study and does not necessarily reflect the opinions or views of the Framingham Heart Study, Boston University, or NHLBI. The authors acknowledge the Texas Advanced Computing Center at The University of Texas at Austin for providing HPC resources and thank Ms. Jessica Swann for editorial assistance. The authors declare no conflict of interest. \bibliographystyle{rss}
\section{Introduction} \label{sec:Intro} Theoretical work following the discovery of the Higgs boson~\cite{Aad:2012tfa,Chatrchyan:2012xdj} is essential to identify signals of new physics detectable in the next generation of experimental searches. Much interest has focused on composite Higgs models (CHMs)~\cite{Kaplan:1983fs,Georgi:1984af,Dugan:1984hq} (see also Refs.~\cite{Panico:2015jxa,Panico:2015jxa,Witzel:2019jbe,Cacciapaglia:2020kgq,Ferretti:2016upr,Cacciapaglia:2019bqz} and references therein). Here the Higgs fields appear within the low energy EFT description of pseudo-Nambu-Goldstone bosons (PNGBs), themselves originating from a new, strongly coupled field theory. Lattice studies have begun to provide non-perturbative information about the dynamics of such strongly coupled systems, and their spectroscopy~\cite{Hietanen:2014xca,Detmold:2014kba,Arthur:2016dir,Arthur:2016ozw,Pica:2016zst,Lee:2017uvl,Drach:2017btk,Ayyar:2017qdf,Ayyar:2018zuk,Ayyar:2018ppa,Ayyar:2018glg,Cossu:2019hse,Bennett:2017kga,Bennett:2019jzz,Bennett:2019cxd,Drach:2020wux,Drach:2021uhl,DelDebbio:2021xlv,Bennett:2022yfa}. A surprising feature emerged in the lattice studies of an $SU(3)$ gauge theory with $N_f = 8$ fundamental Dirac fermions~\cite{Aoki:2014oha,Appelquist:2016viq,Aoki:2016wnc,Gasbarro:2017fmi,Appelquist:2018yqe}, or $N_f = 2$ Dirac fermions in the symmetric representation~\cite{Fodor:2012ty,Fodor:2015vwa,Fodor:2016pls,Fodor:2017nlp,Fodor:2019vmw,Fodor:2020niv}: an anomalously light composite state with vacuum quantum numbers. This particle can be interpreted as a dilaton (the PNGB associated with scale invariance), and it can be included in the low-energy EFT. The resulting dilaton EFT has a long history, dating back at least to early studies of dynamical symmetry breaking~\cite{Leung:1985sn,Bardeen:1985sm,Yamawaki:1985zg} (see also Refs.~\cite{Migdal:1982jp,Goldberger:2007zk,Coleman:1985rnk}), but the recent lattice measurements have led to a resurgence of interest~\cite{Matsuzaki:2013eva,Golterman:2016lsd,Kasai:2016ifi,Hansen:2016fri,Golterman:2016cdd,Appelquist:2017wcg,Appelquist:2017vyy,Golterman:2018mfm,Cata:2019edh,Appelquist:2019lgk,Golterman:2020tdq,Golterman:2020utm,LatticeStrongDynamicsLSD:2021gmp,Hasenfratz:2022qan}. The application of the dilaton EFT to lattice data yields a parameter measurement~\cite{Appelquist:2017wcg,Appelquist:2017vyy} consistent with a large anomalous dimension for the bilinear fermion condensate~\cite{Cohen:1988sq,Ryttov:2010iz,Ryttov:2016asb,Leung:1989hw}. In a recent paper~\cite{Appelquist:2020bqj}, a viable CHM was built on the basis of the dilaton-EFT description of the $N_f = 8$ gauge theory. This CHM shares important features with earlier proposals~\cite{BuarqueFranzosi:2018eaj,Vecchi:2015fma,Ma:2015gra}, yet it exploits in a distinctive way the role of the dilaton field and existing lattice results. At the price of moderate fine tuning, only one Higgs boson, $h^0$, is accessible to the LHC. All additional composite states are heavy enough to evade even conservative bounds from direct~\cite{Sirunyan:2019vgj} and indirect~\cite{Aad:2019mbh} searches\footnote{We adopt $M_{\pi}=4$ TeV as an indicative reference mass scale for the PNGBs. This scale could be lowered, and the fine tuning further softened, as some experimental bounds from direct searches involve suppressed model-dependent couplings that enter certain production rates. See for instance Refs.~\cite{Belyaev:2016ftv,Cacciapaglia:2020vyf} for useful dedicated phenomenological studies.}. Two-Higgs-doublet models predict the existence of two additional neutral scalar particles ($H^0$ and $A^0$) and two charged ones ($H^\pm$), each of which could be light enough to be within reach of future LHC direct searches. The treatment of generic 2HDMs with EFT principles leads to a rich phenomenology, but also to the daunting task of constraining many independent couplings (see, e.g., Refs.~\cite{Georgi:1978xz,Low:2020iua} and references therein). Bounds derived from perturbative unitarity and vacuum stability have been used for this purpose, but an organisational principle is naturally provided in the case of 2HDMs which are CHMs~\cite{Mrazek:2011iu,DeCurtis:2021uqx}. Recently, an improved measurement of the mass of the W boson by the CDF II collaboration has been published~\cite{CDF:2022hxs}, leading to some tension with precision measurements within the standard model. If confirmed, this measurement would suggest the existence of sources of custodial symmetry breaking in new physics. In particular, it suggests that the precision electroweak parameter $T$~\cite{Peskin:1990zt,Peskin:1991sw} lies in the range $0.1 - 0.3$, the precise value depending on the treatment of other experimental input and on the assumptions made about the combination with other precision parameters~\cite{Strumia:2022qkt,deBlas:2022hdk,Fan:2022yly,Lu:2022bgw,Paul:2022dds,DiLuzio:2022xns,Bagnaschi:2022whn,Asadi:2022xiy,Balkin:2022glu,Biekotter:2022abc,Almeida:2022lcs}. Several studies suggest that 2HDMs can accommodate these values~\cite{Babu:2022pdn,Bahl:2022xzi,Song:2022xts,Heo:2022dey,Ahn:2022xeq,Ghorbani:2022vtv,Lee:2022gyf,Abouabid:2022lpg,Fan:2022dck}. In this paper, we reconsider the dilaton EFT we used to describe the $N_f = 8$ lattice data~\cite{Appelquist:2017wcg,Appelquist:2017vyy,Appelquist:2019lgk}, and that we deployed to build a minimal CHM~\cite{Appelquist:2020bqj}. We modify it in a simple way, by adding potential terms such that a composite 2HDM emerges at low energies, separated from the rest of the spectrum by a mass gap. We describe this construction in some detail, use lattice measurements to constrain the model, discuss fine-tuning, and compute the spectrum of additional light scalars. We then match the resulting low energy theory to a conventional description of a generic 2HDM. We use the latter to estimate the 1-loop contribution to precision electroweak parameters. This demonstrates how the dilaton--EFT treatment of near-conformal theories provides a flexible model-building instrument with broad applicability. In this framework it is possible to explain the anomaly in the measurement of the W mass~\cite{CDF:2022hxs}. \section{The Model} \label{sec:Model} \begin{table}[t] \vspace{10pt} \centering \renewcommand\arraystretch{1.2} \begin{tabular}{| c | c c c | c |} \hline\hline Fermion & $SU(2)_L$ & $U(1)_Y$ & $SU(3)_c$& $SU(3)$\\ \hline $L_\alpha$ & 2 & 0 & 1 & 3\\ $R_{1,2}$ & 1 & $\begin{pmatrix} 1/2\\ -1/2 \end{pmatrix}$ & 1 & 3 \\ $\cal T$ & 1 & 2/3 & 3 & 3 \\ $\cal S$ & 1 & 0 & 1 & 3 \\ \hline\hline \end{tabular} \caption{Quantum number assignments of the Dirac fermions. $SU(2)_L \times U(1)_Y \times SU(3)_c$ is the SM gauge group, while $SU(3)$ is the strongly coupled gauge symmetry. The $SU(2)_L$ index is $\alpha=1,\,2$. The fermions $R_{1,2}$ form a fundamental representation of the global $SU(2)_R$. See also Ref.~\cite{Vecchi:2015fma}.}\label{Fig:fields} \end{table} We summarise in Table~\ref{Fig:fields} the standard--model (SM) quantum numbers of the fermions of the $N_f=8$, $SU(3)$ gauge theory, with the same assignments as in Ref.~\cite{Appelquist:2020bqj}. The theory confines, and its approximate, global $SU(8)_1\times SU(8)_2$ symmetry is broken by the condensate to the diagonal $SU(8)_V$ subgroup. Long distance physics is captured by an EFT containing only the fields associated with the dilaton and the $63$ PNGBs. The Lagrangian density is the following: \begin{eqnarray} {\cal L} &=& \frac{1}{2}\partial_{\mu}\chi\partial^{\mu}\chi -V_{\Delta} + {\cal L}_{\pi}+{\cal L}_M + {\cal L}_Y - V_{f}\,. \label{Eq:L} \end{eqnarray} The first four terms of Eq.~(\ref{Eq:L}) provide the dilaton--EFT description of the strong dynamics, considered in isolation. The other terms describe additional interactions arising from underlying couplings of the fermions to the SM fields and to each other. The field $\chi$ describes the dilaton. The (dilatation-symmetry-breaking) interactions are encoded in the potential $V_{\Delta}$, which depends only on $\chi$. This potential originates from the intrinsic breaking of scale invariance arising from the strong dynamics of the gauge theory. We use the form for the potential discussed in Ref.~\cite{Appelquist:2019lgk}, which assumes that the breaking of dilatation symmetry is due to the coupling of an operator of dimension $\Delta$, without further committing to a choice of $\Delta$. The field $\chi$ appears also in all other terms of the Lagrangian density, reflecting its role as a conformal compensator~\cite{Coleman:1985rnk}. The $SU(8)_1\times SU(8)_2/SU(8)_V$ coset is described in the EFT by the matrix-valued field $\Sigma$, subject to the non-linear constraint $\Sigma^{\dagger}\Sigma=\mathbb{1}_8$. The kinetic terms for the $63$ PNGBs derive from \begin{eqnarray} {\cal L}_{\pi}&=& \frac{F_{\pi}^2}{4}\left(\frac{\chi}{F_d}\right)^2 {\rm Tr} \left[\frac{}{}D_{\mu}\Sigma (D^{\mu}\Sigma)^{\dagger}\right]\,, \end{eqnarray} where $F_{\pi}$ and $F_{d}$ are parameters that control the scale of spontaneous breaking of global and dilatation symmetry, respectively. The nonlinear constraint leads to $\Sigma=\exp\left[\frac{2i}{F_{\pi}}\sum_A\pi^At^A\right]$, where $\pi^A$ are the $63$ real PNGBs, and $t^A$ the $SU(8)_V$ generators, normalised with ${\rm Tr} t^At^B=\frac{1}{2}\delta^{AB}$. The presence of covariant derivatives reflects the (weak) gauging of the $SU(2)_L\times U(1)_Y\times SU(3)_c$ subgroup of the unbroken $SU(8)_V$ global symmetry. The corresponding gauge fields have a standard Lagrangian density, which we leave implicit. Explicit breaking of the global symmetry is also due to a universal mass term for the fundamental fermions. Its effects are captured in the EFT by \begin{eqnarray} {\cal L}_M&=& \frac{M_{\pi}^2F_{\pi}^2}{4}\left(\frac{\chi}{F_d}\right)^y {\rm Tr}\left[\Sigma + \Sigma^{\dagger}\right]\,, \label{eq:lm} \end{eqnarray} where $M_{\pi}^2$ is the mass of the PNGBs, while $y$ is the parameter mentioned in the introduction, related to the scaling dimension of the chiral condensate. Fits to the lattice data indicate a value close to $y\simeq2$~\cite{Appelquist:2017wcg,Appelquist:2017vyy,Appelquist:2019lgk}. This term also contributes to the dilaton potential, modifying both its vacuum expectation value (VEV) and mass. To describe the presence of two Higgs doublets within the PNGB multiplet, in the basis defined by the field content in Table~\ref{Fig:fields}, we introduce the following matrices: \begin{align} P_\alpha=\begin{pmatrix} \tilde{P}_\alpha & \mathbb{0}_{4}\\ \mathbb{0}_{4} & \mathbb{0}_{4} \end{pmatrix}, \label{eq:P} \end{align} with \begin{align} \tilde{P}_1=\frac{1}{2}\begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ \end{pmatrix},\quad \tilde{P}_2=\frac{1}{2}\begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ \end{pmatrix}.\label{eq:Pmatrix} \end{align} and \begin{align} R_\alpha=\begin{pmatrix} \tilde{R}_\alpha & \mathbb{0}_{4}\\ \mathbb{0}_{4} & \mathbb{0}_{4} \end{pmatrix}, \label{eq:R} \end{align} with \begin{align} \tilde{R}_1=\frac{1}{2}\begin{pmatrix} 0 & 0 & i & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & i & 0 & 0 \\ \end{pmatrix},\quad \tilde{R}_2=\frac{1}{2}\begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & 0 & 0 & 0 \\ -i & 0 & 0 & 0 \\ \end{pmatrix}.\label{eq:Rmatrix} \end{align} The combinations ${\rm Tr}\left[P_{\alpha}\Sigma\right]$ and ${\rm Tr}\left[R_{\alpha}\Sigma\right]$ transform as two Higgs doublets $H^1_{\alpha}$ and $H^2_{\alpha}$, respectively, with identical quantum numbers $(2,-1/2,1)$, under the SM group $SU(2)_L\times U(1)_Y\times SU(3)_c$. The conjugate Higgs doublets are obtained with the second Pauli matrix $\tau^2$, as $\tilde{H}_{\alpha}^1 \sim -i(\tau^2)_{\alpha}^{\,\,\,\,\beta}{\rm Tr}\left[P_{\beta}^\dagger\Sigma\right]$ and $\tilde{H}_{\alpha}^2 \sim -i(\tau^2)_{\alpha}^{\,\,\,\,\beta}{\rm Tr}\left[R_{\beta}^\dagger\Sigma\right]$. New underlying interactions, extending the $SU(3)$ gauge theory, are assumed to generate Yukawa-like couplings to the SM fermions, breaking the $SU(8)_1 \times SU(8)_2$ symmetry. We write the resulting couplings to the third-family quarks in the simple form: \begin{multline} {\cal L}_Y=y_t F_{\pi} \left(\frac{\chi}{F_d}\right)^{z} \bar{Q}_L^{\alpha}\left({\rm Tr}\left[P_{\alpha} \Sigma\right]\right) t_R\\ +y_b F_{\pi} \left(\frac{\chi}{F_d}\right)^{z}\bar{Q}_L^{\alpha}\left(-i(\tau^2)_{\alpha}^{\,\,\,\,\beta} {\rm Tr}\left[P_{\beta}^\dagger \Sigma\right]\right) b_R+\text{h.c}\, ,\label{eq:ly} \end{multline} where $z$ is a scaling dimension and $y_t$ and $y_b$ are the top and bottom Yukawa couplings. Replacing them by complex $3 \times 3$ matrices would allow for a straightforward extension to three SM families. We introduce a $Z_2$ symmetry, under which only $H^2_\alpha\sim{\rm Tr}\left[R_\alpha\Sigma\right]$ is odd. As a result, we couple to the fermions only one of the doublets, corresponding to $H^1_{\alpha}$. Fermion mass hierarchies and mixing are entirely attributed to the hierarchies in the $y_i$ couplings. This choice implements a GIM mechanism that protects the model from excessive flavor-changing neutral current processes. It is natural to expect that the underlying interactions responsible for generating ${\cal L}_Y$ lead also to new contributions to the potential of the Higgs doublets. To accommodate the two doublets, we allow for terms involving both $P_{\alpha}$ and $R_{\alpha}$. We assume the dominant terms to be quadratic in these structures and write this new potential in the form \begin{widetext} \begin{align} V_f = -\frac{C}{4}\left(\frac{\chi}{F_d}\right)^w\sum_{\alpha}&\left\{ (1+\kappa)\left[(1+\lambda)\left|{\rm Tr}\left[P_{\alpha}\Sigma\right]\right|^2+(1-\lambda)\left|{\rm Tr}\left[P_{\alpha}^\dagger\Sigma\right]\right|^2\right]\right.\nonumber\\ &\left.+(1-\kappa)\left[(1+\lambda)\left|{\rm Tr}\left[R_{\alpha}\Sigma\right]\right|^2+(1-\lambda)\left|{\rm Tr}\left[R_{\alpha}^\dagger\Sigma\right]\right|^2\right]\right\}\,, \label{Eq:Vf} \end{align} \end{widetext} where the parameter $w$ is a scaling dimension. We have omitted terms that mix operators built with $P_\alpha$ and $R_{\alpha}$. This is motivated by invoking the $Z_2$ symmetry acting on $H^2_{\alpha}\sim{\rm Tr}[R_{\alpha}\Sigma]$. Because such mixing terms are absent, only $H^1_{\alpha}$ develops a non-vanishing VEV as long as $\kappa > 0$, making $H^2_{\alpha}$ an ``inert'' doublet. The limits $\kappa\rightarrow 0$ and $\lambda\rightarrow 0$ are symmetry enhancement points: the former related to a $U(1)_X$ symmetry making the two Higgs doublets degenerate in mass, the latter to custodial $SU(2)_L\times SU(2)_R$ symmetry. We assume that $C \geq 0$, hence triggering electroweak symmetry breaking (EWSB), and will discuss its magnitude in the next section. The potential $V_t$ of Ref.~\cite{Appelquist:2020bqj} is recovered by setting $C = C_t$, $\lambda = 1$, and $\kappa = 1$. For completeness, we show explicitly how the aforementioned $U(1)_X$ symmetry acts on the PNGB fields: \begin{equation} \Sigma\rightarrow X \Sigma X^\dagger, \label{eq:X1} \end{equation} where $X X^\dagger=\mathbb{1}$ and \begin{equation} {X} = \text{diag}\left(e^{i\frac{\phi}{2}},\,e^{i\frac{\phi}{2}},\, e^{-i\frac{\phi}{2}},\, e^{-i\frac{\phi}{2}},1,1,1,1\right)\, . \label{eq:X2} \end{equation} Under the action of this symmetry, the two Higgs doublets are rotated into each other in the following way: \begin{align*} {\rm Tr}\left[P_\alpha\Sigma\right] & \rightarrow \cos\phi \;{\rm Tr}\left[P_\alpha\Sigma\right] - \sin\phi \;{\rm Tr}\left[R_\alpha\Sigma\right]\, ,\\ {\rm Tr}\left[R_\alpha\Sigma\right] & \rightarrow \cos\phi \;{\rm Tr}\left[R_\alpha\Sigma\right] + \sin\phi \;{\rm Tr}\left[P_\alpha\Sigma\right]\, . \end{align*} \section{The vacuum} \label{sec:Vacuum} The vacuum structure is determined by minimising the potential derived form Eq.~(\ref{Eq:L}). When $\kappa>0$, only the doublet $H^1_{\alpha}$ acquires a nonzero value vacuum expectation value. We parametrise the EWSB vacuum value of the $\Sigma$ field as \begin{eqnarray} \langle \Sigma \rangle&\equiv &\exp\left[i\theta \left( \begin{array}{ccc} \mathbb{0}_{2\times 2} & -i \mathbb{1}_{2} & \mathbb{0}_{2\times 4}\cr i \mathbb{1}_{2} &\mathbb{0}_{2\times 2} & \mathbb{0}_{2\times 4}\cr \mathbb{0}_{4 \times 2} &\mathbb{0}_{2\times 2}& \mathbb{0}_{4} \end{array}\right)\right], \end{eqnarray} with $0\leq \theta \leq \pi$. The potential to be minimised to determine $\theta$ and $\chi$ is the following: \begin{eqnarray} W&\equiv V_{\Delta}(\chi)&-{\cal L}_{M}(\chi,\theta)+V_f(\chi,\theta)\nonumber\\ &=V_{\Delta}(\chi)&-2M_{\pi}^2F_{\pi}^2 \left(\frac{\chi}{F_d}\right)^y(1+\cos\theta)\\ & & -\frac{C}{2}\left(\frac{\chi}{F_d}\right)^w\left(1+\kappa\right)\sin^2\theta\nonumber\,. \end{eqnarray} This potential does not depend on the parameter $\lambda$ that breaks custodial symmetry, but the spectrum does, as we shall see explicitly. As in Ref.~\cite{Appelquist:2020bqj}, we define $\langle \chi \rangle \equiv F_d$. This potential is minimised when $\theta$ takes the value \begin{eqnarray} \cos\theta &=&\frac{2 M_{\pi}^2F_{\pi}^2}{C\left(1+\kappa \right)}\,. \label{Eq:tuning} \end{eqnarray} The EWSB vacuum is then given by \begin{eqnarray} v&\equiv&\sqrt{2} F_{\pi} \sin \theta\,\simeq\,246 \, {\rm GeV}\,, \label{eq:vew} \end{eqnarray} providing only that $2M_{\pi}^2F_{\pi}^2< C(1+\kappa)$. The masses of the SM gauge bosons are approximated by \begin{eqnarray} M_W^2&=&\frac{1}{2}g^2 F_{\pi}^2 \sin^2\theta\,,\\ M_Z^2&=&\frac{1}{2}(g^2+g^{\prime\,2}) F_{\pi}^2 \sin^2\theta\,, \end{eqnarray} for the $W$ and $Z$ bosons, respectively. For the SM fermions, the masses of the top and bottom quarks are \begin{eqnarray} m_{t,b}&=&\,y_{t,b}\frac{v}{\sqrt{2}}\,. \end{eqnarray} To ensure a hierarchy between the electroweak scale $v$ and the confinement scale of the gauge theory, $\theta\ll1$ is necessary. This is achieved by a single tuning, of the parameter combination $C(1 + \kappa)$ against the combination $M_{\pi}^{2} F_{\pi}^{2}$. The factor $M_{\pi}^{2}$ is governed by the assigned mass of the fermions in the gauge theory. The tuning here, at roughly the $2\%$ level, is the same as we implemented in Ref.~\cite{Appelquist:2020bqj}, and we refer the reader to that paper for additional comments. We note also that it is natural to take $\kappa<1$, which brings down the mass of the second Higgs doublet relative to those of the many other PNGBs in the dilaton EFT. The size of $\kappa$ is affected by symmetry--breaking effects coming from ${\cal L}_Y$. The first term in $V_f$, for example, receives contributions from a loop of top quarks, controlled by $y_t$ and regulated by the confinement scale of the $SU(3)$ gauge theory. This contribution is not larger than the required size of $C(1+\kappa)$, and supplements those of other, underlying interactions, which determine all the terms in $V_f$. Only taking $\kappa$ to extremely small values would introduce additional fine tuning. \section{The spectrum} \label{sec:Spectrum} We study the mass spectrum of perturbations near the EWSB minimum of the potential. We treat as free parameters the quantities $\{M^2_\pi,\,M^2_d,\,F^2_\pi,\,F^2_d,\,y,\,v,\,m^2_h,\,\lambda,\,\kappa\}$. Following Ref.~\cite{Appelquist:2020bqj}, we set $v$ and $m^2_h$ to their experimentally measured values and fix $M_\pi=4$ TeV as a benchmark value. Lattice calculations in the $N_f=8$ gauge theory provide values of $M^2_\pi/F^2_\pi$ and $M^2_d/F^2_\pi$; we take the measurements with fermion mass $am=0.005$, mid--range in Tables III and IV of Ref.~\cite{Appelquist:2018yqe}. We fix $y=2.06\pm0.05$ and $F^2_\pi/F^2_d=0.086\pm0.015$, taken from an earlier dilaton--EFT study~\cite{Appelquist:2019lgk}. We identify a region of parameter space in which the particles associated with the 2HDM are parametrically lighter than the other spin-0 states. To this end, we allow the two new free parameters $\kappa$ and $\lambda$ to differ from the choices $\kappa=1=\lambda$ implicitly adopted in Ref.~\cite{Appelquist:2020bqj}. We take $\lambda$, which controls custodial symmetry breaking, to be $O(1)$, and positive since the spectrum depends on only $\lambda^2$. The aforementioned requirements demand $\theta\simeq 0.17$, which is obtained by tuning $C$ in Eq.~(\ref{Eq:tuning}). Because $\theta$ is small, simple approximate expressions describe the masses of the Higgs states. It was observed in Ref.~\cite{Appelquist:2020bqj} that mixing between one PNGB and the dilaton state leads to a simple expression for $m_h^{2}/v^2$: \begin{equation} \frac{m^2_h}{v^2}\simeq\frac{M^2_\pi}{2F^2_\pi}\left(1-\frac{2F^2_\pi M^2_\pi(y-w)^2}{F^2_d M^2_d}\right)\,, \label{Eq:mhiggs} \end{equation} and this relation holds also for the present model. The dilaton plays a key role in making this ratio realistically small. The combination of parameters in the parentheses in Eq.~(\ref{Eq:mhiggs}) provides the necessary cancellation, lowering the Higgs-mass-to-VEV ratio. \begin{center} \begin{figure}[t] \includegraphics[width=0.95\columnwidth]{FIGS/fig1.pdf} \caption{Masses for the composite states included in the EFT as a function of $\kappa$, taking $\lambda=0.5$ ($\lambda=0.85$) for the left (right) panel. Choices for the other model parameters are explained in the text. The blue lines refers to the state corresponding to the SM Higgs. The black solid lines refers to the $A^0$, the reds to the $H^\pm$ and the black dashed lines to the $H^0$ mass. The pale gray lines at the top of the spectrum indicate the masses of the remaining composite spinless states.} \label{fig:spectrum} \end{figure} \end{center} For illustration purposes, we take $\lambda=0.5$ and 0.85, compute the masses of the dilaton and PNGB states, and show the results in Fig.~\ref{fig:spectrum}, varying the EFT parameter $\kappa>0$. As $\kappa$ is reduced, the masses of the four states which make up the second Higgs doublet split apart from the rest of the spectrum, represented by the pale gray lines sitting around $4$ TeV. For small $\kappa$, the low energy spectrum becomes that of a 2HDM, as desired. For instance, when $\kappa=0.1$ and $\lambda=0.85$, the masses of the four scalars associated with $H^2_\alpha$ lie around 1.6 TeV. Similar results apply for other generic values of $\lambda$. The $U(1)_X$ symmetry shown in Eqs.~(\ref{eq:X1}) and (\ref{eq:X2}) interchanges the two Higgs doublets. Since $\kappa$ breaks this symmetry, when $\kappa$ is small the second Higgs doublet and SM Higgs states come closer together. Taking $\kappa$ to zero would restore $U(1)_X$ in the potential $V_f$ of Eq.~(\ref{Eq:Vf}) To provide simple analytic expressions for the second Higgs doublet masses, we take $\kappa\sim\theta^2\ll1$, a magnitude consistent with the phenomenological discussion to come. For the charged states $H^{\pm}$, we find \begin{equation} M^2_{H^\pm}= 2M^2_\pi\kappa+M^2_\pi\theta^2(1-2\lambda^2), \label{eq:hp} \end{equation} plus terms higher order in $\kappa$ and $\theta^2$. We see also that for $|\lambda|>1/\sqrt{2}$, $M^2_{H^\pm}$ becomes negative for extreme values of $\kappa$. We avoid this region of parameter space in the following. The masses of the neutral CP-even Higgs state, $H^0$, and the CP-odd state, $A^0$, are given by \begin{equation} M^2_{H^0} = 2M^2_\pi \kappa, \label{eq:mh0} \end{equation} and \begin{equation} M^2_{A^0}= 2M^2_\pi\kappa+M^2_\pi\theta^2. \label{eq:a0} \end{equation} plus terms higher order in $\kappa$ and $\theta^2$. In the small $\lambda$ limit, where custodial symmetry is restored, $H^{\pm}$ and $A^0$ become degenerate. For $\lambda\simeq 1/\sqrt{2}$ one finds approximate degeneracy of the $H^0$ and $H^{\pm}$ states, up to subleading corrections in the small parameters $\kappa$ and $\theta$. By choosing a small value of $\kappa$, the four additional particles of the second Higgs doublet can be light enough that they separate from the rest of the EFT spectrum. Because $\kappa$ is a parameter that breaks the approximate $U(1)_X$ global symmetry (broken only by ${\cal L}_Y$), only a moderate amount of additional tuning, beyond that of Ref.~\cite{Appelquist:2020bqj}, is needed in this process. Also, since these results do not depend sensitively on the value of $\lambda$, the construction we have outlined may lead to spectra exhibiting custodial symmetry, or violating it, affecting the electroweak precision parameter $T$. \section{Two--Higgs Doublet EFT} \label{sec:eft} With $\kappa$ small, the eight states comprising the two Higgs doublets are much lighter than the remaining states. An EFT for the two light doublets includes a potential with operators of dimension $d\leq4$. The most general form of the potential, in the conventions of Ref.~\cite{Low:2020iua}, is \begin{align} V&= m_{11}^2H^\dagger_1H_1+m_{22}^2H^\dagger_2H_2-\left(m_{12}^2H^\dagger_1H_2+\text{h.c.}\right)\nonumber\\ &+\frac{\beta_1}{2}\left(H_1^\dagger H_1\right)^2+\frac{\beta_2}{2}\left(H_2^\dagger H_2\right)^2+\beta_3\left(H_1^\dagger H_1\right)\left(H_2^\dagger H_2\right)\nonumber\\ &+\beta_4\left(H_1^\dagger H_2\right)\left(H_2^\dagger H_1\right)+\left\{\frac{\beta_5}{2}\left(H_1^\dagger H_2\right)^2+\text{h.c.}\right\}\nonumber\\ &+\left\{\left[\beta_6\left(H^\dagger_1 H_1\right)+\beta_7\left(H^\dagger_2 H_2\right)\right]\left(H^\dagger_1H_2\right)+\text{h.c.}\right\}\, . \label{eq:Veft} \end{align} Imposing a $Z_2$ symmetry with respect to the second Higgs doublet sets $m^2_{12}=\beta_6=\beta_7=0$. The relation of the other parameters in Eq.~(\ref{eq:Veft}) to the free parameters in our theory is shown in Table~\ref{tab:eftparams}, where we have kept only leading terms in the limit $\kappa\sim\theta^2\ll1$. The expressions for $m^2_{11}$ and $\beta_1$ lead directly to Eq.~(\ref{Eq:mhiggs}). Similarly, the expressions for $m^2_{22}$, $\beta_2$, $\beta_3$, $\beta_4$, and $\beta_5$ lead to the mass formulae Eqs.~(\ref{eq:hp})--(\ref{eq:a0}). We notice that couplings $\beta_1$ and $\beta_2$ are $O(m^2_h/v^2)\sim1/4$, typical of the electroweak theory whereas $\beta_3,\,\beta_4,\,\beta_5$ are larger. They are of order $O(M^2_\pi/F^2_\pi)\sim 16$, using lattice data~\cite{Appelquist:2018yqe}. The second Higgs doublet $H_2$ does not acquire a VEV or couple to the SM fermions. The model therefore reduces at low energies to an inert two–Higgs doublet model. \begin{table} \centering \renewcommand\arraystretch{2.0} \addtolength{\tabcolsep}{1.5 pt} \begin{tabular}{|c|c|} \toprule \multirow{2}{2cm}{\centering 2HDM EFT Parameter} & \multirow{2}{2cm}{\centering Dilaton EFT Expression} \\ & \\ \hline $m^2_{11}$ & $-m^2_h/2$ \\ $m^2_{22}$ & $2M^2_\pi\kappa-m^2_h/2$ \\ $\beta_1$ & $\frac{m^2_h}{v^2}$ \\ $\beta_2$ & $\frac{m^2_h}{v^2}$ \\ $\beta_3$ & $\frac{M^2_\pi}{F^2_\pi}\left(1-2\lambda^2\right)+\frac{m^2_h}{v^2}$ \\ $\beta_4$ & $-\frac{M^2_\pi}{2F^2_\pi}\left(1-4\lambda^2\right)$\\ $\beta_5$ & $-\frac{M^2_\pi}{2F^2_\pi}$\\ \hline\hline \end{tabular} \caption{The parameters in the potential of the two-Higgs doublet model EFT as shown in Eq.~(\ref{eq:Veft}), expressed in terms of quantities in the dilaton EFT. We have expanded these relations in powers of the small quantities $\kappa,\,\theta^2$ and kept only the lowest--order nonvanishing terms, for simplicity. The expressions for $m^2_{11}$ and $m^2_{22}$ are truncated to include only terms linear in $\kappa$ and $\theta^2$. The expressions for couplings $\beta_i$ include only the zeroth order terms in $\kappa$ and $\theta^2$. We have simplified the expressions using Eqs.~(\ref{eq:vew}) and (\ref{Eq:mhiggs}).} \label{tab:eftparams} \end{table} \subsection{Electroweak Precision Observables} We now turn our attention to the contribution of the new composite sector to the $S$ and $T$ electroweak precision parameters \cite{Peskin:1990zt,Peskin:1991sw}. The contribution from one--loop diagrams calculated using the $d\le 4$ potential shown in Eq.~(\ref{eq:Veft}) dominates over tree level contributions from higher dimension operators. The $T$ parameter is given by~\cite{Haber:1993wf,Haber:1999zh}\footnote{To apply the general formula for $T$ provided in appendix A of Ref.~\cite{Haber:1999zh} to our inert two--Higgs doublet model, we set $\sin(\beta-\alpha)=1$, using the notation of the reference.}: \begin{multline} T=\frac{1}{16\pi s^2_W m^2_W}\left({\cal F}(M_{H^\pm},M_{A^0})+{\cal F}(M_{H^\pm},M_{H^0})\right.\\ \left.-{\cal F}(M_{A^0},M_{H^0})\right), \label{eq:tpar} \end{multline} where $m_W$ is the mass of the W boson and $s^2_W=\sin^2\theta_W$. We use the values $m_W=80.4$ GeV and $s^2_W=0.23$. The function ${\cal F}$ is defined as \begin{equation} {\cal F}(m_1,m_2) \equiv \frac{1}{2}\left(m^2_1+m^2_2\right) - \frac{m^2_1m^2_2}{m^2_1-m^2_2}\log\left(\frac{m^2_1}{m^2_2}\right). \label{eq:fdef} \end{equation} In Fig.~\ref{fig:tpar}, we use Eqs.~(\ref{eq:tpar}) and (\ref{eq:fdef}) to evaluate $T$ for a range of values of the parameters $\lambda$ and $\kappa$. The remaining model parameters are fixed using the experimental values for $m^2_h$ and $v$, and using lattice data as explained earlier. The masses of the second Higgs doublet states are required inputs for the calculation and we determine them using the potential of the full dilaton EFT at the classical level. The model allows $T$ to take both positive and negative values, and in general the magnitude of $T$ increases as $\kappa$ is reduced and the states of the second Higgs doublet become light. When $\lambda=0$, the scalar sector contains no sources of custodial symmetry violation and therefore $T$ vanishes. \begin{center} \begin{figure}[h] \includegraphics[width=0.9\columnwidth]{FIGS/figprod3.pdf} \caption{Contours of the electroweak $T$ parameter in the $\lambda$, $\kappa$ plane. The $T$ parameter is an even function of $\lambda$, so we show only the $\lambda>0$ region. In the areas shaded gray, $|T|>0.5$ making this parameter space disfavored by experiment.} \label{fig:tpar} \end{figure} \end{center} Fig.~\ref{fig:tpar} shows that $T$ changes sign near the threshold $\lambda\simeq1/\sqrt{2}$. This feature may be explained by considering the intermediate regime where $m^2_h\ll M^2_{H^0,\,A^0,\,H^\pm}\ll M^2_\pi$. In this case, the two--Higgs doublet EFT may still be used but Eq.~(\ref{eq:tpar}) can be simplified to yield \cite{Haber:2010bw} \begin{equation} T\simeq \frac{\left(M^2_{H^\pm}-M^2_{A^0}\right)\left(M^2_{H^\pm}-M^2_{H^0}\right)}{48\pi m^2_W s^2_W M^2_{A^0}}\,. \end{equation} In this approximate formula, the sign of $T$ changes when the mass hierarchy within the second Higgs doublet changes. By comparing Eq.~(\ref{eq:hp}) with (\ref{eq:mh0}), we see that the mass difference $M^2_{H^\pm}-M^2_{H^0}$ changes sign around $\lambda\simeq1/\sqrt{2}$. The electroweak parameter $S$, when the two--Higgs doublet model is inert, is given by \cite{Haber:1993wf,Kanemura:2011sj} \begin{equation} S = \frac{1}{4\pi}\left({\cal F}^\prime(M_{A^0},M_{H^0})-{\cal F}^\prime(M_{H^\pm},M_{H^\pm})\right)\, , \end{equation} where \begin{eqnarray} {\cal F}^\prime(m_{1},m_{2})\equiv-\frac{1}{3}&\left[\frac{4}{3}- \frac{m^2_1\log m^2_1-m^2_2\log m^2_2}{m^2_1-m^2_2}\right.\nonumber\\ &\left.-\frac{m^2_1+m^2_2}{(m_1^2-m^2_2)^2}{\cal F}(m_1,m_2)\right]\,. \end{eqnarray} We find that $|S|<0.02$ for all values of $\lambda$ explored in Fig.~\ref{fig:tpar} with $\kappa>0.01$. In this case, the contribution of our model to the $S$ parameter is negligible, unlike the contribution to $T$. If the new, larger measurement for $m_W$ from the CDF collaboration \cite{CDF:2022hxs} is incorporated into a global electroweak precision fit, it favors positive values for $T$. Taking $S$ and the other electroweak precision parameters to be negligible, as is the case in our model, updated fits~\cite{Strumia:2022qkt,deBlas:2022hdk,Fan:2022yly,Paul:2022dds,DiLuzio:2022xns,Bagnaschi:2022whn,Asadi:2022xiy,Balkin:2022glu,Biekotter:2022abc,Almeida:2022lcs} suggest $T$ lying in the range $[0.1,\,0.3]$. In Fig.~\ref{fig:tpar}, we see that there is a portion of the $\{\kappa,\,\lambda\}$ parameter space for which these values of $T$ can be accommodated. \section{Discussion} \label{sec:Discussion} We embedded into the dilaton-EFT framework a two-Higgs-doublet model (2HDM). As in Ref.~\cite{Appelquist:2020bqj}, we employed moderate fine tuning to yield a composite Higgs model, now with {\it two} Higgs doublets separated by a mass hierarchy from the other, heavier states in the dilaton EFT. The latter are heavy enough to escape both direct and indirect searches. The full dilaton EFT is partially UV completed by a near conformal gauge theory studied extensively on the lattice. We drew directly on these calculations. We built an effective description of the resulting 2HDM, uncovering some features that are distinctive with respect to generic 2HDMs. For example, the quartic couplings $\beta_1$ and $\beta_2$ in Eq.~(\ref{eq:Veft}) are relatively small, of order unity, while the other scalar couplings are larger, of order $M_{\pi}^2/F_{\pi}^2$, as determined by the strong interactions of the near conformal gauge theory. Importantly, over significant portions of parameter space, the four additional scalars relative to the standard model form an inert doublet with near degenerate physical masses. We explored the implications of these features for electroweak precision measurements, in particular with reference to custodial symmetry breaking. It will be interesting to understand whether other distinctive signatures emerge. Most notably, depending on parameter choices, the particles of the inert doublet could be light enough to appear in direct searches at future colliders. We leave these considerations for future dedicated studies. \vspace{0.5cm} \begin{acknowledgments} The work of MP has been supported in part by the STFC Consolidated Grants ST/P00055X/1 and ST/T000813/1. MP has also received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme under grant agreement No 813942. \vspace{12pt} {\bf Open Access Statement - } For the purpose of open access, the authors have applied a Creative Commons Attribution (CC BY) licence to any Author Accepted Manuscript version arising. \end{acknowledgments}
\section{Introduction} As various audio recognition (AR) systems such as Automatic Speech Recognition (ASR), acoustic event detection (AED) are being deployed onto our phones; into cars; indoor \& outdoor; \emph{noise robustness} is becoming ever more crucial to any type of AR system~\cite{li2019adversarial}. Traditional AR pipeline relies on preprocessing/enhancement step to filter out the noise that exists in the input. However, enhancement by no means guarantees noise free~\cite{michelsanti2021overview, wang2018supervised}, noise still cascades to downstream pipelines. Therefore, it is also important to understand the robustness of models. \begin{figure}[t] \hskip-0.8cm\centering \includegraphics[width=1.1\linewidth]{Images/architecture_all-crop1.png} \caption{(A): CNN+Transformer, (B): CRNN (C): ViT. PE: positional encoding; $N_t=2$, $N_c=10$, $N_p=5$, f-stride$=$t-stride$=8$ } \label{fig:architecture} \end{figure} In this work, we focus on \emph{model robustness} without adopting any preprocessing step, and we focus on the Acoustic Event Detection (AED) task in the scope of this paper: Given an audio stream, we need to predict the most proper semantic label for the acoustic event. General environmental sounds, compared to their well-studied human speech subset, do not usually contain strong contextual dependencies or senses, but span a wide range of frequencies and are naturally noisy. From a pure machine learning modeling perspective, we believe the AED task is a better angle for us to gain deeper understanding of specific neural architectures without worrying much about language models. Meanwhile, our findings about different neural models on the AED task could inform modeling choices for all other audio-related tasks such as ASR, speaker identification, and etc. In AED task, CNN variants~\cite{kong2019panns} had many proven successes until being challenged by ViT~\cite{gong2021ast} architecture in 2021. A recent comparison~\cite{li2022ATbaseline} showed CNNs are more efficient and easier to train compared to ViT, whereas ViT can beat pure CNNs in performance (mean Average Precision -- mAP) by a small margin on the AED task. Despite the neck-to-neck performance, fundamentally, these 2 types of neural models are largely different in inductive biases due to their disparate learning mechanisms: convolutional neural networks are efficient since they effectively downsample the input with a sliding kernel (learned), discretizing the mathematical convolution into polynomial multiplication; whereas ViT networks model the global correlation among patches through the self-attention mechanism, which is inherently quadratic. Given such distinctions, we suspect the 2 types of networks would have very different properties (e.g. robustness) when performing audio classification. Some recent work in the vision domain advocated for ViT's robustness~\cite{paul2021vision}, while its robustness on audio recognition (AR) remain unexplored. \begin{figure}[!ht] \includegraphics[width=1.0\linewidth]{Images/occlusion_all.png} \caption{Different masking of the 10s Audio. The sample sound here is a ``hammer" class. Youtube id: --BfvyPmVMo. The 4 verticle lines are the actual hammering sound. } \label{fig:occlusion} \end{figure} \todo{F: I think we could rename "mask 4s" to "every 2s", and change the ordering of the presentation in the figure and the table? Maybe we could also have a condition where we cut one third from the middle (everything else, except "every 2s" cuts half), but the results are probably predictable.} In this work, we seek to thoroughly understand the difference of noise robustness between the CNN variants and ViT models on the AED task. We pick competitive single-checkpoint models from the recent study~\cite{li2022ATbaseline}, and select 4 variants of CNN and transformer networks for comparison. Our comparison includes CNN+Transformer, Vision Transformer (ViT), ResNet and CRNN on the task of Audio Event Detection (AED) using the largest dataset available: AudioSet~\cite{gemmeke2017audio}. In our study, we start with the model's ``clean'' performance on the AudioSet test set without any input perturbation, and report performance changes when the model is under the influence of various type of noises. We first mask out a portion of the audio to test the change of the performance of different models. Then, we model intermittent noise through \emph{occlusion}, and we model continuous noise using \emph{Gaussian} noise. In addition, we probe the model by computing \emph{adversarial examples} to understand the ``worst" case scenarios. Our contributions: \begin{enumerate} \item We systematically compared the performances of different transformer variants between several CNN variants under the influence of different input noises on the large-scale dataset Audioset. Our observations suggest that attention models bear very different \emph{model-based inductive bias} than pure convolution counterparts. \item We measure robustness of these different neural architectures, and we conclude that, trained on the same datasets doing the same task, self-attention architectures are more robust to noise noise perturbations than convolutional models in all regards. \end{enumerate} \section{Acoustic Event Detection Baselines} \noindent \textbf{AudioSet~\cite{gemmeke2017audio}} contains 2,042,985 10-second YouTube video clips, summing up to 5,800 hours annotated with 527 types of sound events (weak label\footnote{does not specify which second specific event happens}). The same group~\cite{hershey2021benefit} released a set of \emph{temporally-strong} labels (103,464 train, 16,996 eval). The \emph{full} trainset has 2 subsets: class-wise \emph{balanced} set (22,176 samples) and \emph{unbalanced} (2,042,985 samples) set, and \emph{eval} set with 20,383 samples~\cite{vggish}. \\ \noindent \textbf{Benchmark on the AED task:} Table~\ref{tab:model-perform} lists state-of-the-art \emph{single models} and for the AED task trained on the \emph{full} AudioSet and test on the \emph{eval} set.\footnote{The waveform is downsampled to 16 kHz; frames of 1,024 samples (64 ms) are taken with a hop of 400 samples (25 ms); each frame is Hanning windowed and padded to 4,096 samples before taking the Fourier transform; the filterbank of 64 triangle filters spans a frequency range from 0 Hz to 8 kHz.} To limit variability, we do not include (implicit \& explicit) ensembled models, multi-modal models. In~\cite{li2022ATbaseline}, they trained 6 model types, we select 4 models with competitive performance, so that comparison could be carried out fairly. The training procedure details and parameters are identical to what is described in~\cite{li2022ATbaseline}. The architecture of each model are shown in Figure~\ref{fig:architecture}, ResNet50's architecture is omitted due to its prevalence.\todo{F: is this a good reason? I would add it, if we can. I understand the Figure may need to become bigger, but it is confusing later on, e.g. in Table 2, when we have A B C but nothing for ResNet...} We use the 64x400 feature input models in the experiments of this work for better efficiency. (Shown in bold in Table~\ref{tab:model-perform}) \todo{F: So, in the table, we list two different sizes, but in this paper we only use one? Why not remove 128x1024 entirely then?} \begin{table}[ht] \setlength\tabcolsep{3.2pt} \begin{center} \caption{The best mAP of various models in comparison, w/. or w/o ImageNet pretraining, and using 64$\times$400 logMel spectrogram features.}. \begin{tabular}{c c| c c c c } \toprule \multirow{2}{*}{\textbf Model} & \multirow{2}{*}{\textbf \#param} & \multicolumn{2}{c}{64$\times$400}\\ && {w/ pretrain} & {w/o pretrain} \\ \midrule AST/ViT &87.9M &\textbf{0.410} & 0.264 \\ CNN+Trans & 12.1M & - & \textbf{0.411}\\ ResNet50 &25.6M & \textbf{0.382} & 0.370\\ CRNN &10.5M & - & \textbf{0.406}\\ \bottomrule \end{tabular} \label{tab:model-perform} \end{center} \end{table} \todo{F: can we clarify if these numbers are the ones from the papers (which ones? let's add the references here), or are they the ones from your re-implementation? This needs to be very clear. How much effort would it be to run the ResNet-50 experiments with 128x1024 resolution? If we did, the baseline performance for ResNet would be the exact same as for the other architectures. It may be good to briefly describe the training of the various models here. Which one uses augmentation, dropout, other techniques etc that may interfere with the robustness?} \section{Experiments \& Results} \todo{F: We could briefly explain why we pick these four cases - or have we done it before, and I missed it?} \subsection{Natural Occlusions} To verify our hypothesis that attention models and convolution models are fundamentally different, we leverage time-domain occlusion as probing tool for analysis. We apply blank (silent) temporal masks to cover different parts of the 10s audio, and apply it to all the samples in the \emph{eval set} of AudioSet, as shown in Figure~\ref{fig:occlusion}(a-g). Then, we measure the performance change on the \emph{eval set} of our trained model. Note that in Figure~\ref{fig:occlusion}(o,p), if we were to mask WAV file with silences and then extract logMel feature from the masked WAV file, we would end up with \href{https://en.wikipedia.org/wiki/Gibbs_phenomenon}{Gibbs phenomenon} due to performing FFT over the step function, namely the occlusion. In this paper, since our focus is to study the neural models' response over occlusion, the overshooting thorn-shaped artifacts (Figure~\ref{fig:occlusion}(q)) and the narrower occlusion on spectrogram (caused by FFT window leaking information into silence) are not desire. Therefore, we occlude logMel features directly without worrying about such behaviors.\todo{F: Can we not just eliminate this discussion about masking raw audio files? We mask logMel spectrograms, for all models. End of discussion. Saves space. Billy: I will move it to appendix, for anyone who might be interested, since it is an interesting phenomenon} As we can see in Table~\ref{tab:audioOcclusion}, intuitively, the less information the model sees, the lower performance it would lead to. This can be observed at Figure~\ref{fig:occlusion}(a-c), Table~\ref{tab:audioOcclusion} first 5 rows show that occluding consecutive blocks of sound by 40\% (i.e. mask 4s out of 10s) and 50\% would degrade the performance of all the 4 models by 6\% and 8\% mAP respectively. \todo{F: I think we can simplify the table here, and only report the numbers for "Mid 5s" occlusion, and say that we verified, and the result for first and last occlusion are very similar - should save some space} \todo{F: I think 'consecutive' and 'intermittent' masking are really the same thing, except that for 'slow' change intervals, there can be 'rounding errors' and we retain less than half of the info. But we should simplify the presentation, and I am also not sure if we need to formally define the making function?} On top of consecutive masking, we experimented with intermittent masking, which can be denoted as: \newcommand*{\begin{cases} 1 & \text{if} \quad t \in [(n-1)d, nd], n\in\{2,4,6,...\frac{T}{d}\} \\ 0 & \text{if} \quad \text{else}{\begin{cases} 1 & \text{if} \quad t \in [(n-1)d, nd], n\in\{2,4,6,...\frac{T}{d}\} \\ 0 & \text{if} \quad \text{else} \end{cases} }% \newcommand*{\VPhantom}{\vphantom{\begin{cases} 1 & \text{if} \quad t \in [(n-1)d, nd], n\in\{2,4,6,...\frac{T}{d}\} \\ 0 & \text{if} \quad \text{else}}% \newcommand*{\VPhantomHack}{\vphantom{\begin{cases} 1 & \text{if} \quad t \in [(n-1)d, nd], n\in\{2,4,6,...\frac{T}{d}\} \\ 0 & \text{if} \quad \text{else^{2}}}% \newcommand*{\BoldLeftBrace}{\pmb{\left\{\VPhantomHack\right.}}% \newcommand*{\RightBrace}{\left.\VPhantom\right\}}% \begin{equation} \mathbbm{1}_{t}(X_t) = \begin{cases} 1 & \text{if} \quad t \in [(n-1)d, nd], n\in\{2,4,6,...\frac{T}{d}\} \\ 0 & \text{if} \quad \text{else \end{equation} where $d$ is the masking interval, and $T$ being the total length of audio, $T=10s$ for AudioSet samples. As Table~\ref{tab:audioOcclusion} row 6-9 show, the shorter the mask intervals, the lower the performance would be, despite the fact that the equivalent information is the same between masking every 0.125s and masking every 1s. Surprising, we could observe the existence of a threshold masking interval which significantly decreases the model performance. For instance, masking $d=0.25s$ for AST/ViT and CRNN almost nullified the models capability to recognize. As George Miller's experiment~\cite{cowan2015george}, neural networks resemble human memory in some ways, showing there's a ``magic number" period of information machine perception could remember. Taking a closer look into the class-wise performance, under $0.125s-0.25s$ masking, there are only a handful of classes that the models could still predict with above 0.3 mAP: Speech, Music, and Whistling, and whispering, smoke detector and fire alarm. Even the classes previously found~\cite{li2019adversarial} to be robust to high-frequency adversarial noise, e.g. Police car, emergency vehicle, and siren classes are beyond recognizing for our model. Counter-intuitively, if we assemble the $d=0.125s$ fragments which were not masked to form a new 5s audio, the performance would recover dramatically, despite that we can clearly see the cutoff effect from the spectrograms. (see Figure~\ref{fig:occlusion}(h,i), Table~\ref{tab:audioOcclusion} row 10-13) Interestingly, the performance of reassembled spectrogram would ``recover" to the equivalent value as if the mask was a consecutive 5s mask on the spectrogram, comparable to Table~\ref{tab:audioOcclusion} row 2-5. Several observations: \begin{enumerate} \item ViT/AST architectures are comparatively more robust architecture under occlusion, with its performance comparatively outperforms all other models under different type of occlusions. CRNN's robustness is also very competitive. \item If noise spans longer than the convolution receptive field, it causes huge performance drop, this specific behavior could be leveraged to infer neural architecture under a blackbox setting. \item This is a very effective and novel and super potent threat model for adversarial attack in audio domain. The above finds are supposed to work mainly on 2D FFT features. \end{enumerate} \todo{F: It is indeed weird that the model performance does recover so much for the "concat" case, but there is really no difference in the performance of the different methods, right? They all recover and behave quite the same. How big is the convolution receptive field for ResNet and CRNN? For the second observation, it would be important to show that it is comparable to where the dropoff occurs. How is all of this a super potent threat model?} \begin{table*}[ht] \setlength\tabcolsep{3.2pt} \begin{center} \begin{tabular}{c| c c c | c c c | c c c | c c c } \toprule \multirow{2}{*}{\textbf Model} & \multicolumn{3}{c|}{\textbf AST/ViT} & \multicolumn{3}{c|}{\textbf CNN+Trans}& \multicolumn{3}{c|}{\textbf ResNet} & \multicolumn{3}{c}{\textbf CRNN}\\ & { mAP} & {AUC} & {d-prime} & {mAP} & {AUC} & {d-prime} & {mAP} & {AUC} & {d-prime} & {mAP} & {AUC} & {d-prime}\\ \midrule No Occlusion & 0.411 & 0.837 & 1.387&0.411 & 0.971 & 2.672 & 0.382 & 0.966 & 2.574 & 0.406 & 0.972 & 2.694\\ \hline 4s Occlusion & 0.360 & 0.798 & 1.178&0.349 & 0.956 & 2.417 &0.313 & 0.951 & 2.347 & 0.357 & 0.962 & 2.513 \\ First 5s Occlusion & 0.321 & 0.748 & 0.946 &0.315 & 0.939 & 2.187 & 0.296 & 0.940 & 2.201 &0.326 & 0.947 & 2.286 \\ Mid 5s Occlusion & 0.337 & 0.772 & 1.056&0.331 & 0.949 & 2.313 & 0.299 & 0.947 & 2.284 & 0.339 & 0.955 & 2.404 \\ Last 5s Occlusion & 0.331 & 0.756 & 0.981&0.323 & 0.940 & 2.196 & 0.301 & 0.940 & 2.195 &0.329 & 0.945 & 2.266 \\\hdashline Every 1s Occlusion & 0.321 & 0.767 & 1.033 &0.292 & 0.941 & 2.214&0.237 & 0.929 & 2.079 &0.308 & 0.950 & 2.331 \\ Every 0.5s Occlusion & 0.236 & 0.686& 0.686&\textbf{0.140} & 0.881 & 1.667 & \textbf{0.130} & 0.885 & 1.696 &0.213 & 0.925 & 2.037 \\ Every 0.25s Occlusion & \textbf{0.052} & 0.279 &-0.829&0.033 & 0.729 & 0.861 &0.020 & 0.637 & 0.494 & \textbf{0.067} & 0.821 & 1.299\\ Every 0.125s Occlusion&0.032 & 0.187 &-1.258&0.015 & 0.634 & 0.486 & 0.014 & 0.609 & 0.391 & 0.018 & 0.666 & 0.608 \\\hdashline 0.125s Concat & 0.293 & 0.747& 0.939&0.281 & 0.941 & 2.209 & 0.266 & 0.940 & 2.199 &0.296 & 0.949 & 2.315 \\ 0.25s Concat & 0.313 & 0.766& 1.024&0.305 & 0.947 & 2.292 & 0.277 & 0.943 & 2.236 &0.314 & 0.954 & 2.385 \\ 0.5s Concat &0.333 & 0.781& 1.095 &0.326 & 0.951 & 2.338&0.294 & 0.947 & 2.284 & 0.334 & 0.957 & 2.422 \\ 1s Concat &0.340 & 0.784 & 1.109 &0.333 & 0.951 & 2.344&0.302 & 0.948 & 2.300 & 0.339 & 0.957 & 2.423 \\\hline White Noise 2D& 0.248 & 0.694 & 0.718 &0.056 & 0.727 & 0.854 & 0.165 & 0.881 & 1.672 & 0.049 & 0.738 & 0.903 \\ While Noise 1D& 0.191 & 0.572 &0.258 & 0.155 & 0.827 & 1.335&0.147 & 0.815 & 1.265 &0.158&0.817&1.277\\\hline Masking Strong & 0.203 & 0.495 &-0.019 & 0.194 & 0.792 & 1.149 & 0.183 & 0.826 & 1.328 & 0.193 & 0.830 & 1.347\\\hline $l_{\infty}$ attack &0.260 & 0.700 &0.742 &0.164 & 0.891& 1.739& 0.011 & 0.542 & 0.148 & 0.082 & 0.845 & 1.434 \\ $l_{2}$ attack & 0.263 & 0.706 & 0.768 & 0.117 & 0.856 & 1.502 & 0.025 & 0.608 & 0.386 & 0.144 & 0.897 & 1.786 \\ \bottomrule \end{tabular} \end{center} \caption{Different architectures(Audio Only) under different temporal occlusions} \label{tab:audioOcclusion} \end{table*} \todo{F: why are some numbers bold? we do not need to repeat that this is audio-only here, right? would it not make sense to reverse the order of the "concat" lines, to be in sync with the "occlusion" ones? It would also be interesting to report the "50\% duration", the length of occlusion that halves the model's performance. For ResNet, this may be about 0.75s, for CRNN and AST/ViT this may be 0.375s. What does this tell us about the robustness of the various models? Somehow it says that AST/ ViT does not need more temporal context, but less, right?} \subsection{Strong label masking} With the release of new strong labels from AudioSet\cite{hershey2021benefit}, we have knowledge of when does specific event happen exactly for 16,996 samples among the entire 20,123 \emph{eval set}. We mask out the specific strongly labeled portion of each audio sample for the entire eval set of AudioSet, and compare different model's test performance on the audio without the labeled events. In essence, we are either occluding the most relevant part as shown in Figure~\ref{fig:occlusion}(j). The results are shown in table~\ref{tab:audioOcclusion} on the line ``Masking Strong". As we can see, it is surprising that the models are still preserving average 0.19 mAP, indicating the neural models are leveraging a tremendous portion of context around the labeled event in the audio, to predict the actual audio event in this case. ViT/AST models comparatively ``remember" the most information. \todo{F: I think the most interesting observation is that all the models preserve about the same amount of information. What results do you get when you test only on the strong labeled test data? We have established that concatenating "cut" segments does little damage, so do all the models recover entirely on the "strong" labels?} \subsection{Gaussian Noise Masking} It is a common practice to add Gaussian noise to speech to model continuous noise. We test 2 types of Gaussian noises in this work: 1) We add Gaussian noise $\sim \mathcal{N}(0,0.1)$ to the .wav file and let the noise cascade into the logMel filters through the FFT step and the Mel Filters. 2) We directly add Gaussian noise $\sim \mathcal{N}(0,0.1)$ onto the logMel spectrogram feature. Both Guassian noises are added to all the samples in the eval set of AudioSet, on which we report performances of different models in comparison. Figure\ref{fig:occlusion}(k,l) illustrate the resulting logMel spectrograms of these 2 types of Gaussian noises. As we can see, the resulting spectrogram of 1D Gaussian noise is visibly lower magnitude than the 2D Gaussian noise.\todo{F: Presumably, 1D noise is the one directly applied to the audio?} Table~\ref{tab:audioOcclusion} showcase the resulting differences. There are some surprising observation here, ViTs are more susceptible to 1D Gaussian noise whereas CRNN and CNN+Transformers are more susceptible to 2D Gaussian. This is potentially due to the attention mechanism of ViT are heavily leveraging temporal relations which would get more influence from the 1D Guassian noise. \todo{F: AST still does better in 1D noise than any other method, but it is striking that CNN+Trans and CRNN completely break down for 2D noise. Why is that? ResNet also is a convolutional architecture, but it seems to be considerably more robust. Also, the results of the occlusion study do not indicate that AST/ ViT heavily leverages temporal relations, because the model is more robust under frequent occlusions, or are you thinking at a entirely different time scale (samples)?} \subsection{Adversarial Masking} Finally, we want to study the ``worst case" scenarios by computing adversarial perturbations against the models. \subsubsection{Adversarial Perturbations background} The problem of computing universal adversarial perturbation to attack a classification model $f$ by maximizing the following~\cite{madry2017towards}: \begin{equation} \begin{aligned} & \mathbf{E}_{(x,y)\sim \mathcal{D}} \underset{x' \in C(x)}{\max }[L(f(x'),y)]\\ & \text{subject to } C(x)=\{ a\in \mathbb{R} :||a-x||_p \leq \epsilon \}. \\ \end{aligned} \end{equation} \noindent where $L$ is the loss function, $x$ is input and $y$ is label, $\mathcal{D}$ is the dataset, and $x' = x + \delta$ is our perturbed input. We want to find some perturbation $x'$ that looks ``indistinguishable'' from $x$, yet is classified incorrectly by $f$ even when $x$ is classified correctly. To solve such a constrained optimization problem, one of the most common methods utilized to circumvent the non-exact-solution issue is the Projected Gradient Descent (PGD) method~\cite{madry2017towards}: \begin{equation} \delta := \mathcal{P}_{\epsilon} \left(\delta - \alpha \frac{\nabla_{\delta}L(f( x +\delta),y)}{\Vert \nabla_{\delta}L(f( x +\delta),y)\Vert_p}\right) \end{equation} where $\mathcal{P}_{\epsilon}$ is the projection onto the $\ell_p$ ball of radius $\epsilon$, and $\alpha$ is the gradient step size. To practically implement gradient descent methods, we use very small step size and iterate it by $\epsilon / \alpha$ steps. Recently, the research community has examine the robustness of the ViTs. \cite{paul2021vision, shao2021adversarial,bhojanapalli2021understanding} have concurrently studied and claimed that ViT are more robust learning compared to their CNN counterparts. \cite{shao2021adversarial} advocates adversarial robustness is correlated to transformer blocks. Meanwhile, ViT are shown to be more vulnerable against patch attacks~\cite{gu2021vision}. However, existing works mostly examine such robustness on vision tasks, not much work has been done to understand ViT's behaviors on audio dataset. Given the unique characteristics or audio, we do not expect the robustness ViT showed on vision tasks could be copied to audio tasks. \todo{F: This would best go into the introduction or related work?} \subsubsection{Adversarial Perturbation on LogMel Spectrogram} In this work, we compute white-box adversarial perturbations against the 4 models and add them on the input feature (logMel spectrogram) level.\todo{F: Remind me: this is a white-box (or whateverit is called) attack, in which we have access to the model, and compute the gradients through it, correct?} Specifically, we compute perturbation in both $\ell_{\infty}$ and $\ell_2$ norm, with the $\ell_{\infty}$ attack being a single step FGSM. Here, for every model that is under attack, we compute perturbation by PGD and use 20 step, step size 0.01, and $\epsilon = 0.1$. Figure.~\ref{fig:occlusion}(m) shows the effect of an $\ell_2$ norm perturbation. We can see the effect resembles Guassian noise but more potent. Figure.~\ref{fig:occlusion}(n)(needs to zoom in to see clearly) illustrates the FGSM attack in $\ell_{\infty}$ norm, the perturbation is effectively creating sparse zero-valued pixels in the logMel spectrogram. All of our experiment results are shown in Table~\ref{tab:audioOcclusion} last 2 rows. Here, we can see that ViT/AST models are once again more robust than other models. Interestingly, its performance under $\ell_{\infty}$ or $\ell_2$ norm attack with the same attack budget do not seem to differ much. ResNet's performance cratered under the influence of adversarial perturbation, indicating that without modules specifically modeling temporal dependencies, it is difficult to defend adversarial perturbations. Also note here CRNNs are comparatively less robust against adversarial perturbation, despite being very robust against occlusions. It is intriguing that different neural architectures would respond to attacks under $\ell_{\infty}$ or $\ell_2$ norms very differently. \todo{F: This is very interesting indeed. Would it make sense to re-run these eperiments with multiple values of $\epsilon$? It should then be possible to produce a graph similar to the one that I produced for different values of occlusion and it would show where the dropoff occurs, and one could express the robustness of the model in terms of the $\epsilon$ value that reduces its performance to 50\%?} \section{Conclusion and On-going work} ViT/AST architecture are comparatively more robust compared to all the other 3 types of neural architectures against various types of noises, although the mechanism is currently still unknown and being actively investigated. All neural networks learn/memorize vast amount of contextual data to perform predictions, the specific labeled events only accounts for 50\% of the mAP\todo{F: mAP} in AudioSet's case. We still do not have a clear way to explain the reason behind the drastically different behaviors of different neural architectures against adversarial perturbations. This is currently under investigation. In the mean time, we observe AUC, d-prime of ViT models are drastically different than all other 3 models in comparison, which could throw doubt on its robustness, such variations are currently being studied. \todo{F: Would it make sense to repeat the attacks also against the strongest Transformer model (trained with all tricks, e.g. dropout, mixup, augmentation and whatever else is there), to see if they make the AST model even more robust than it is already?} \bibliographystyle{IEEEtran}
\section{Introduction} With the development of digital technologies, digital processing has been the core point of the next generation of tinnitus therapy~\cite{searchfield2021state}. State-of-the-art digital processing relies on the improvement of artificial intelligence to physiological sensors, which enables the personalization of the patient-centered therapies~\cite{hunn2016market,crum2019hearazbles}. The most representative and commonly used artificial technology applied to improve tinnitus therapies is machine learning~\cite{koprinkova2015artificial}. For example, machine learning has been widely applied in the analysis of electroencephalogram (EEG)~\cite{allgaier2021deep}, auditory brainstem response (ABR)~\cite{liu2021generalizable}, and functional magnetic resonance imaging (fMRI)~\cite{shahsavarani2020comparing}. In particular, EEG can be an effective and inexpensive data source to analyze the neural feedback of tinnitus patients~\cite{sun2019multi}. Extensive EEG-based machine learning research~\cite{sun2019multi,liu2021generalizable,li2016svm,saeidi2021neural,emami2017eeg} has shown that machine learning is able to discover differences in signals between tinnitus patients and healthy people by learning patterns from given (i.e., training) datasets. Therefore, EEG dataset can be a reliable data source that enables machine learning models to assist in diagnosing tinnitus. While some research~\cite{quiet-svm-tinnitus,basic-tinnitus-subject-dependent,zscoretinnitus} focuses on learning the pattern difference of the existing tinnitus and control subjects, there exist significant variance between subjects~\cite{liu2021generalizable}. When between-subject variance is high, these models may only work when the testing signals are sampled from known subjects or if their distributions closely mirror those seen within the training dataset. To enhance the model robustness, especially with regards to handling new subjects, some other research~\cite{liu2021generalizable,power_value} enables the model to be aware of the subject variance. By understanding the subject variance in signals, models can mitigate the corresponding negative influences in the prediction. However, in real-world scenarios, many EEG datasets~\cite{liu2021generalizable,sun2019multi,allgaier2021deep} may collect data using different experimental environments and thus build data with diverse formats. The different data formats may cause an extremely significant domain shift. Therefore the majority of models are still limited to a single dataset and may not be able to be generalized across distinct datasets. \begin{figure} \centering \begin{subfigure}{0.24\textwidth} \includegraphics[width=\textwidth]{image/left_target_min_maxed.pdf} \centering \caption{Left side.} \end{subfigure}\hfil \begin{subfigure}{0.24\textwidth} \includegraphics[width=\textwidth]{image/right_target_min_maxed.pdf} \centering \caption{Right side.} \end{subfigure}\hfil \caption{Illustration of signal difference on (a) the left and (b) the right sides of the same subject.}\label{left_right_dif} \end{figure} In the other related fields, it has been shown that the cross-dataset domain shift will heavily impair model performance in classifying EEG signals~\cite{cimtay2020investigating,xu2020cross,lan2018domain,lin2019constructing,rayatdoost2018cross}. For example, unsupervised domain adaptation~\cite{lan2018domain} and transfer learning~\cite{lin2019constructing} show good performance on cross-dataset EEG-based emotion classification. However, these methods rely on large-scale datasets like common deep learning methods. Meanwhile, some advanced technologies in machine learning can be applied to help tackle the cross-dataset domain shift in EEG. One such technique, model-agnostic meta-learning has been widely applied in computer vision~\cite{finn2017model}, natural language processing~\cite{obamuyide2019model}, and recommender systems~\cite{bharadhwaj2019meta}. The model-agnostic meta-learning is compatible with any traditional machine learning method and does not rely on large-scale datasets. It can learn a set of generalized basic model parameters based on existing datasets and then be quickly adapted to new datasets by fitting a few samples~\cite{hospedalesmeta}, which effectively prevents domain shift among different datasets. However, directly using these methods may not fully capture the characteristic information of tinnitus signals. As shown in Figs.~\ref{left_right_dif} (a-b), there exists a difference between the EEG signals corresponding to sounds presented to the left and right ears. Traditional methods may confuse this side difference with the difference in subject variance. This may lead models to learn false information that these signals are from two different subjects, which will impair model performance and cause inaccurate conclusions in the further analysis of the learned representation. In this paper, we propose a domain-specific meta-learning, named Side-aware Meta-learning (SMeta), for tinnitus diagnosis. SMeta utilizes the subject difference of left/right ears and takes the difference as an auxiliary indicator to assist meta-learning. To conduct subject-specific meta-learning, we also propose subject-independent task training for SMeta, which allows episode-wise subject-specific training. We further implement SMeta based on autoencoder and design two model variants, i.e., Side-aware Meta-AutoEncoder (SMeta-AE) and Side-aware Meta-Siamese-AutoEncoder (SMeta-SAE). Both variants outperform state-of-the-art methods. Our major contributions in this paper can be summarized as follows: \begin{itemize} \item We propose a novel Side-aware Meta-learning for the domain-specific tinnitus diagnosis. In the cross-dataset tinnitus classification, our model outperforms state-of-the-art methods by 2.8\%, 3.5\%, and 5.0\% on Negative-F1 score, Positive-F1 score, and accuracy, respectively. \item We propose a subject-specific task sampling and an auxiliary side predictor to conduct side-aware meta-learning. We also design a sliding window and down-sampling policy to align the cross-dataset signals. We implement both SMeta and conventional meta-learning on autoencoders. SMeta achieves an increase up to 1.4\%, 6.7\%, and 3.8\% on Negative-F1 score, Positive-F1 score, and accuracy respectively, demonstrating the superiority of SMeta. \item Our method yields a 2.5\%/5.0\% improvement in left/right ear prediction accuracy. We conduct extensive experiments and ablation studies to show the robustness against the selection of hyper-parameters and good explainability. \end{itemize} \section{Related Work} \subsection{EEG-based Tinnitus Diagnosis} About 10\%-15\% of humans suffer from tinnitus, making tinnitus a common disorder~\cite{langguth2013tinnitus}. However, due to many possible causes, such as head injury, stress, etc., as well as different symptoms, such as hearing loss, noise trauma, etc., there is currently no universally effective clinical method for subjective tinnitus diagnosis and treatment~\cite{hall2016systematic}. Because tinnitus is often associated with changes in the brain, many researchers have proposed that the assessment of abnormal neural activity as assessed by EEG signals may aid in the diagnosis of tinnitus. In the early stages, evaluation of EEG signals and further diagnosis were usually done by clinical specialists~\cite{7yearsfeedbackbutwork,focusonsinglebetaband}. Gosepath et al.~\cite{7yearsfeedbackbutwork} first attempted to use neurofeedback to assist tinnitus therapy. With the decreased activity of EEG observed, all patients claimed tinnitus relief. The researchers then further used statistical tools to quantitatively analyze EEG data and help appraise patients' recovery condition~\cite{zscoretinnitus,scpprotocal}. For example, Weiler et al. \cite{zscoretinnitus} proved the correlation between tinnitus and alpha, delta, and theta bands, by comparing their z-scores with control subjects. Milner et al. \cite{scpprotocal} analyzed EEG signals quantitatively by sequentially performing high- and low-pass filtering, independent component analysis (ICA), fast Fourier transform, and mean absolute amplitudes calculation of different frequency bands. Although they have made significant progress in diagnosing tinnitus using EEG signals, their approach suffers from inconsistent results that may lead to different diagnoses or conclusions. The reason is that their research relies heavily on the judgment of human experts, the analysis is case-specific, and there is no uniform standard. Recent research uses machine learning and deep learning to reduce reliance on experts and mitigate the influence of personal factors in the diagnosis process~\cite{basic-tinnitus-subject-dependent,quiet-svm-tinnitus}. Sun et al.~\cite{basic-tinnitus-subject-dependent} segmented EEG data to enrich training sets and use Support Vector Machine (SVM) for tinnitus classification. Li et al. \cite{quiet-svm-tinnitus} also used SVM as the classifier. They pre-processed EEG signals by first transforming the signals into the frequency domain and then performing nonlinear cosine mapping. The machine-learning-based methods can achieve better or comparable performance than traditional diagnoses accomplished by experts, demonstrating the effectiveness of introducing machine learning into EEG analysis. However, the testing samples of this methods~\cite{quiet-svm-tinnitus,basic-tinnitus-subject-dependent} may belong to the same subjects as training samples. The subject-dependent sampling strategy can result in similar training and testing samples and thus lead to inflated performance. To address the problem, some efforts are made to conduct subject-independent experiments, which aims to distinguish tinnitus patients from control subjects. For example, Wang et al. \cite{power_value} adopted Fast Fourier Transform (FFT) to obtain multiple views of features from EEG signals, utilized Multi-view Intact Space Learning (MISL) to obtain latent representations, and classified samples with the Least Squares Support Vector Machine (LS-SVM). \subsection{Cross-dataset EEG Research In Related Fields } In addition to its application in tinnitus, EEG has also attracted much attention in other fields, where advanced deep learning methods are used~\cite{supratak2017deepsleepnet, AEXGB, liu2021task, hartmann2018eeg}. For example, DeepSleepNet~\cite{supratak2017deepsleepnet} used convolutional neural networks (CNN) and bidirectional-long short-term-memory (LSTM) to automatically score sleep stage based on EEG signals. Zhang et al.~\cite{AEXGB} and Hartmann et al.~\cite{hartmann2018eeg} both employed generative models, i.e., Auto-encoder and Generative adversarial networks (GANs), respectively, to synthesize EEG samples for downstream tasks, such as brain activity recognition, EEG super-sampling, or data recovery. However, their models are optimized on large-scale datasets, limiting their deployment in more practical scenarios. To address this issue, some cross-dataset EEG studies are proposed ~\cite{cimtay2020investigating,xu2020cross,rayatdoost2018cross}. They use the knowledge learned in other datasets to assist learning in the target dataset, naturally solving the problem of insufficient data. However, due to the non-stationary nature of EEG data and varying distributions across subjects and datasets, the performance of directly applying deep learning models to cross-dataset problems may decrease significantly. Cimtay et al.~\cite{cimtay2020investigating} adopted CNN to avoid manual feature extraction and find latent features, yielding impressive cross-subject and cross-dataset accuracy. Xu et al.~\cite{xu2020cross} proposed online pre-alignment to eliminate cross-dataset variability. Some studies~\cite{lan2018domain,lin2019constructing} further adopted the domain adaptation or transfer learning to better reuse learned knowledge in new datasets. For example, Lan et al.~\cite{lan2018domain} employed domain adaptation to reduce the inter-subject as well as inter-datasets variance and train and test the classifier on different datasets. In contrast, Lin et al.~\cite{ lin2019constructing} integrated transfer learning and principal component analysis (PCA) to reduce the variance. \subsection{Meta-learning Work} In recent years, deep learning has achieved great success in various scenarios, e.g., computer vision~\cite{liu2021task,li2021attribute}, natural languages processing~\cite{gu2021domain,maulud2021state}, applications in health domains~\cite{li2020non,liu2021generalizable}. However, the advances in deep learning are based on large-scale datasets(e.g., ImageNet~\cite{deng2009imagenet}), which is not available in many scenarios of medical applications. Meta-learning~\cite{naik1992meta}, simulating humans learning how to learn, is proposed to address the problem. It aims to learn novel concepts quickly through accumulated knowledge learned from other tasks. A typical solution of meta-learning, called \textit{metric-based} methods, is to learn a metric or distance function to measure the similarity between new inputs and prior samples~\cite{koch2015siamese,snell2017prototypical,sung2018learning,vinyals2016matching,satorras2018few}. For example, Koch et al.~\cite{koch2015siamese} proposed to use Siamese Neural Networks to generate pairwise similarity between inputs and thus transfer prediction ability to data from unknown distributions. While Snell et al.~\cite{snell2017prototypical} learned a new metric space and calculated the similarity between inputs and learned prototypes of classes in the space. Despite the advances achieved, the metric-based meta-learning fails to utilize knowledge from new tasks to update the meta-model. Recently, some studies focus on \textit{model-based} meta-learning to learn task representations to alter internal state of models~\cite{santoro2016meta,munkhdalai2017meta,mishra2017simple,duan2016rl,wang2016learning}. The dynamic state can reflect task-specific knowledge and can thus be used to predict new inputs. For example, MANN~\cite{santoro2016meta} was a neural network with augmented external memory to encode and retrieve information of new data sequentially for prediction. Mishra~\cite{mishra2017simple} et al. integrated temporal convolutions and soft attention to accumulate information and pinpoint memories, respectively. A drawback of model-based meta-learning is that it requires extra memory to remember information from previous inputs. More related to our models are \textit{optimization-based} meta-learning~\cite{andrychowicz2016learning,ravi2016optimization,finn2017model,grant2018recasting,finn2019online}, pioneered by Andrychowicz et al. ~\cite{andrychowicz2016learning}. These models adjust the optimization process to fulfill fast gradient propagation with few training samples. Andrychowicz et al. first proposed considering the optimization procedure as a learning problem and utilizing LSTMs to replace hand-designed optimizers. Subsequently, Finn~\cite{finn2017model} et al. proposed MAML, which attracts much attention as it is simple and effective. MAML samples multiple tasks and then adopts a meta-training, meta-testing, and fine-tuning procedure to learn initial parameters. These parameters can then be fine-tuned quickly to fit new tasks. In this paper, we adapt MAML to train our model. The reasons are three-fold: 1) MAML can learn generalizable knowledge for better cross-dataset transfer; 2) the fine-tuning process in MAML can make full use of the side information; 3) the tinnitus datasets are tiny, MAML can enrich the datasets by constructing diverse tasks. \begin{figure*}[h] \centering \includegraphics[width=0.88\textwidth]{image/model_overview.pdf} \caption{Model overview. The upper part shows the training stage of SMeta, and the lower part draws the data flow of the inference stage. In our experiments, signals from the target dataset have fewer time points than those from source datasets. Therefore, the training stage first uses a sliding window and down-sampling to align the data format of the source dataset to the target dataset. Then, the down-sampled source dataset will be split into two sub-sets for meta-training and meta-testing, respectively. Both meta-training and meta-testing not only learn to reconstruct raw signals and classify signals but also learn tinnitus-specific information, i.e., the side information of left/right ears. The inference stage uses the trained encoder from the training stage and further fine-tunes the encoder based on side predictor fitting left/right ears. Then, we take the fine-tuned features for the final prediction.} \label{Overview} \end{figure*} \section{Methodology} \subsection{Problem Definition} Given a source dataset $S$ and a target dataset $T$ with different data formats, $x_{i}\in S\cup T$ denotes an EEG signal. Specifically, $x^{s}_{i}$ and $x^{g}_{i}$ are signals sampled from the source and the target dataset, respectively. Each signal consists of $n$ time points $x_{i}=\{o_{j}:j\in[1,n]\}$, has a corresponding label $y^{t}_{i}$ for tinnitus diagnosis, and has a side label $y^{d}_{i}$ to record the left/right ear where the signal is collected. $y^{t}_{i}=1$ denotes positive subject (i.e., tinnitus patient) and $y^{t}_{i}=0$ denotes negative subject (i.e., control subject). $y^{d}_{i}=1$ denotes right ear and $y^{d}_{i}=0$ denotes left ear. Our goal is to learn a unified encoder $f_{en}(x_{i})\rightarrow e_{i}$ and a unified classifier $f_{c}(e_{i})\rightarrow y^{t}_{i}$ that are effective for both source and target datasets, where $e_{i}$ denotes the extracted feature of $x_{i}$. To learn tinnitus-specific information of left/right ear, we design a side predictor $f_{p}(e_{i})\rightarrow y^{d}_{i}$ to predict the side information. To regularize the learned feature, we use a decoder $f_{de}(e_{i})\rightarrow x_{i}$ to restrain $e_{i}$ from over-fitting classification information. The model overview is shown in Fig.~\ref{Overview}. \subsection{Dataset Pre-processing} Different data formats may cause the problems that signals from source dataset $S$ and target dataset $T$ sample different numbers of sampled time points (i.e., sampling frequency), use different filter policies in the same time duration or have divergent strength range due to the different experimental equipment. Suppose that the signals that have the same time duration in source and target datasets are with $n_{s}$ and $n_{g}$ time points ($n_{s}\geq n_{g}$), respectively. We can use sliding window to cut source signals $x^{s}_{i}$ into slices $\{x^{o}_{1},x^{o}_{2},...\}$ that have the same time duration as $x^{g}_{i}$. Then, we can use down-sampling to align the length of time points in the source dataset to those in the target dataset as follows: \begin{gather}\label{slide_down_sample} \bar{o}^{s}_{j}=\left\{\begin{matrix} \frac{1}{l}\sum_{k\in [jl-l+1,jl]}o^{s}_{k} & j\in[1,m]\\ \frac{1}{l+1}\sum_{k\in [jl+j-m-l,jl+j-m+1]}o^{s}_{k} & j\in[m+1,n_{g}] \end{matrix}\right.\\ s.t. \quad l = \left \lfloor n_{s}/n_{g} \right \rfloor \quad m = n_{s}-l*n_{g} \end{gather} where $o^{s}_{k}$ denotes $k^{th}$ original time point in the sliced source signal $x^{o}_{i}$; $\bar{o}^{s}_{j}$ denotes the new averaged time point for the sliced source signal; the window size is $n_{s}$; $\left \lfloor n_{s}/n_{g} \right \rfloor$ denotes the floor of $n_{s}/n_{g}$. After sliding and down-sampling, $\bar{o}^{s}_{j}$ will be the new time points in source signals, where the front $m$ values in new signals of the source dataset will be the mean values of $l$ time points; the last $(n_{g}-m)$ values will be the mean values of ($l+1$) time points. Then, we use min-max normalization to separately limit the signal strengths to the same value range as follows: \begin{gather}\label{min_max_norm} \hat{o}^{s}_{j}=\frac{\bar{o}^{s}_{j}-\min \bar{o}^{s}_{j}}{\max \bar{o}^{s}_{j} - \min \bar{o}^{s}_{j}}\\ \hat{o}^{g}_{j}=\frac{o^{g}_{j}-\min o^{g}_{j}}{\max o^{g}_{j} - \min o^{g}_{j}} \end{gather} where $o^{g}_{j}$ denotes the time points of the signal from the target dataset (i.e., $x^{g}_{i}\in T$; $\hat{o}^{s}_{j}$ and $\hat{o}^{g}_{j}$ represent the normalized time points in the source signal and the target signal, respectively. We let $\hat{x}^{s}_{i}$ and $\hat{x}^{g}_{i}$ be the new source and target signals constituted by $\bar{o}^{s}_{j}$ and $o^{g}_{j}$, respectively. $\hat{x}^{s}_{i}$ will have the same length (i.e., $n_{g}$) as the signal $\hat{x}^{g}_{i}$ for the target dataset. Note that when $n_{s}<n_{g}$, we can use the same operations to align the target dataset to the source dataset by sliding window and down-sampling. \begin{figure}[h] \centering \includegraphics[width=0.48\textwidth]{image/slided.pdf} \caption{Illustration of the same signal trend in (left) the raw signal and (right) the aligned signal, i.e., the normalized and down-sampled sliding window. x-axis denotes the time points and y-axis denotes the signal strength.}\label{raw_and_slided} \end{figure} As shown in Figs.~\ref{raw_and_slided}, we take the 1) raw signal and 2) the normalized down-sampled signal as an example. From the parallel dashes, we can observe that the down-sampling and min-max normalization will squeeze the signal strength to a unified value range $(0,1)$ but not change the original signal trend or pattern. \subsection{Side-aware Meta-autoencoder} We let $\hat{S}=\{\hat{x}^{s}_{1},\hat{x}^{s}_{2},...\}$ be the normalized and down-sampled source dataset. Following the meta-learning setting~\cite{finn2017model} and the subject-independent setting~\cite{liu2021generalizable}, we propose a subject-specific task sampling strategy for tinnitus analysis. Regarding the significant subject variance, we view each subject as a task and denote a subject $k$ in the source dataset by $\tau_{k} \in \hat{S}$. Then, we conduct episode-wise meta-learning. In each episode, we sample $b$ tasks (i.e., independent subjects) from $\hat{S}$, where $b$ denotes batch size. For each subject $\tau_{k}$, we randomly split the signals into two disjoint sets: support set $\tau^{spt}_{k}$ and query set $\tau^{qry}_{k}$ for meta-training and meta-learning, respectively. Note that $\tau^{spt}_{k}\cap \tau^{qry}_{k}=\emptyset$. In the meta-learning phase, we design three loss functions to learn different aspects of signal information: classification loss $L_{cls}$, reconstruction loss $L_{rec}$, and ear side prediction loss $L_{ear}$. Classification loss $L_{cls}$ aims to supervise the learned features to carry the information to accurately classify tinnitus patients and control subjects: \begin{equation}\label{cls_loss} L_{cls}=CrossEntropy(f_{c}(f_{en}(\hat{x}^{s}_{i})),y^{s}_{i}) \end{equation} where $CrossEntropy$ denotes cross entropy loss; $y^{s}_{i}$ is the corresponding ground-truth label of $\hat{x}^{s}_{i}$. We design reconstruction loss $L_{rec}$ to enable the learned features to carry the waveform information to reconstruct the original signals, which can prevent the encoder from over-fitting class information: \begin{equation}\label{rec_loss} L_{rec}=MSE(f_{de}(f_{en}(\hat{x}^{s}_{i})),\hat{x}^{s}_{i}) \end{equation} where $MSE$ represents mean square error. Ear side prediction loss $L_{ear}$ tends to optimize the learned features to be aware of the ear side information among signals, which may assist in classifying subjects: \begin{equation}\label{sde_loss} L_{ear}=CrossEntropy(f_{p}(f_{en}(\hat{x}^{s}_{i})),y^{d}_{i}) \end{equation} where $y^{d}_{i}$ is the corresponding ground-truth ear side of $\hat{x}^{s}_{i}$. Then, we can summarize the loss function for optimizing our Side-aware Meta-AutoEncoder (SMeta-AE) as follows: \begin{equation}\label{smeta_ae_loss} L_{SMeta\hbox{-}AE}=L_{cls}+L_{rec}+L_{ear} \end{equation} Based on the SMeta-AE loss, we first meta-train the model based on the support set, which virtually optimizes the model to learn a basic model. Then, we meta-test the model based on the query set, which summarizes the overall gradients of tasks to truly optimize the model and thus obtains generalized model parameters. The meta-learning can be summarized as follows: \begin{equation}\label{smeta-ae-meta-train} \theta_{AE}^{'}(\tau^{spt}) \leftarrow \theta_{AE}-\alpha\sum_{k}\bigtriangledown_{\theta_{AE}}\mathcal{L}^{\tau^{spt}_{k}}_{SMeta\hbox{-}AE}(\theta_{AE}) \end{equation} \begin{equation}\label{smeta-ae-meta-test} \theta_{AE}^{*}\leftarrow\theta_{AE}-\beta\sum_{k}\bigtriangledown_{\theta_{AE}}\mathcal{L}^{\tau^{qry}_{k}}_{SMeta\hbox{-}AE}(\theta_{AE}^{'}(\tau^{spt})) \end{equation} where $\theta_{AE}$ are model parameters of SMeta-AE; $\theta_{AE}^{'}(\tau^{spt})$ represents the virtual parameters using support sets to meta-train the model; $\theta_{AE}^{*}$ are the updated parameters based on the query sets; $\bigtriangledown_{\theta_{AE}}\mathcal{L}^{\tau^{spt}_{k}}_{SMeta\hbox{-}AE}(\theta_{AE})$ represents the gradient calculation of SMeta-AE for loss $L_{SMeta\hbox{-}AE}$ using $\theta_{AE}$ as original model parameters and $\tau^{spt}_{k}$ as the training samples; $\alpha$ is the meta-learning rate for meta-training; $\beta$ is the learning rates for meta-testing, respectively. \subsection{Siamese Autoencoder Extension} In this section, we introduce a Siamese autoencoder extension, named Side-aware Meta-Siamese-AutoEncoder (SMeta-SAE), to our basic version of autoencoder following the work of Liu et al.~\cite{liu2021generalizable}. Additionally, we design a subject predictor $f_{sub}(e_{i},e_{j})\rightarrow (0,1)$ to predict which subject the signals belong to. Note that we simplify the contrastive learning about subject prediction to two subjects, which is sufficient for meta-learning. To conduct pairwise training for episode-wise meta-learning, we sample two subjects each time, and fuse their support and query sets in a half-to-half way: keeping half of the sets without fusion as samples that belong to the same subjects and fusing the last half of the sets of two subjects as samples that belong to the different subjects. Then, we design the loss function for SMeta-SAE based on an adversarial training loss as follows: \begin{equation} \begin{gathered} L_{SMeta\hbox{-}SAE}=L_{SMeta\hbox{-}AE}+L_{adv}+L_{sub}\\ =L_{cls}+L_{rec}+L_{ear}+\gamma_{i,j}*MSE(e_{i},e_{j})\\ +CrossEntropy(f_{sub}(e_{i},e_{j}),u_{i,j}) \end{gathered} \end{equation} where $L_{SMeta\hbox{-}AE}$ denotes the sum of the common loss functions $L_{cls}$, $L_{rec}$, and $L_{ear}$; $\gamma_{i,j}$ is a sign function that equals 1 when $i=j$ otherwise -1; $u_{i,j}$ is the contrastive label which equals 1 when $i=j$ otherwise 0. $L_{adv}$ is an adversarial loss. It aligns the learned features when they are form the same subject; otherwise it optimizes the learned features to be divergent. $L_{sub}$ is a contrastive label that enhances the model learning abilities by comparing signals from different subjects. Then, we can easily infer the meta-learning loss for SMeta-SAE as follows: \begin{equation}\label{smeta-sae-meta-train} \theta_{SAE}^{'}(\tau^{spt}) \leftarrow \theta_{SAE}-\alpha\sum_{k}\bigtriangledown_{\theta_{SAE}}\mathcal{L}^{(\tau^{spt}_{k,1},\tau^{spt}_{k,2})}_{SMeta\hbox{-}SAE}(\theta_{SAE}) \end{equation} \begin{equation}\label{smeta-sae-meta-test} \theta_{SAE}^{*}\leftarrow\theta_{SAE}-\beta\sum_{k}\bigtriangledown_{\theta_{SAE}}\mathcal{L}^{(\tau^{qry}_{k,1},\tau^{qry}_{k,2})}_{SMeta\hbox{-}SAE}(\theta_{SAE}^{'}(\tau^{spt})) \end{equation} where $\theta_{SAE}$ are model parameters of SMeta-SAE. \subsection{Training and Inference Strategy for Meta-learning} In the training stage, we first train the AE and SAE to get a basic model. Then, we take the trained model as initial parameters to conduct conventional meta-learning and side-aware meta-learning. We do not use random parameters as an initial model for meta-learning because meta-learning will weaken the fitting ability of models. The random initialization may cause the model under-fitting. In the inference stage, we lack observed samples for the conventional meta-learning, so we directly use the trained model to conduct inference. For side-aware meta-learning, as shown in the lower part of Fig.~\ref{Overview}, we use side information from the target dataset to fine-tune the model parameters for each subject as follows: \begin{equation} \theta_{k} \xleftarrow{fine-tune} \theta-\beta\bigtriangledown_{\theta}\mathcal{L}_{ear}^{\tau^{test}_{k}\in \hat{T}} \end{equation} where $\theta_{k}$ denotes the fine-tuned model parameters of AE or SAE for subject $k$; $\beta$ is the learning rate; $\hat{T}=\{\hat{x}^{g}_{1},\hat{x}^{g}_{2},...\}$. \section{Experiment} \begin{table*} \centering \caption{Best performance of cross-dataset tinnitus diagnosis on both ears (standard deviation).} \label{Main_exp_both} \small \begin{tabular}{c|ccccccc} \toprule \multirow{2}{*}{Model} & \multicolumn{7}{c}{Both Sides} \\ \cmidrule{2-8} & NPV & TNR & N-F1 & PPV & TPR & P-F1 & Acc \\ \midrule XGBoost & 0.467(0.000) & 0.525(0.000) & 0.494(0.000) & 0.457(0.000) & 0.400(0.000) & 0.427(0.000) & 0.463(0.000) \\ Nu-SVC & 0.467(0.000) & 0.350(0.000) & 0.400(0.000) & 0.480(0.000) & 0.600(0.000) & 0.533(0.000) & 0.475(0.000) \\ nCSP & 0.568(0.055) & 0.625(0.078) & 0.595(0.058) & 0.583(0.054) & 0.525(0.085) & 0.553(0.063) & 0.575(0.053) \\ DeepNet & 0.714(0.243) & 0.125(0.042) & 0.213(0.070) & 0.521(0.010) & 0.950(0.019) & 0.673(0.009) & 0.538(0.018) \\ ShalowNet & 0.581(0.044) & 0.625(0.147) & 0.602(0.112) & 0.595(0.033) & 0.550(0.110) & 0.571(0.040) & 0.588(0.035) \\ AE-XGB & 0.696(0.071) & 0.400(0.170) & 0.508(0.158) & 0.579(0.033) & 0.825(0.126) & 0.680(0.041) & 0.613(0.041) \\ EEGNET & 0.605(0.081) & 0.650(0.230) & 0.627(0.181) & 0.622(0.048) & 0.575(0.159) & 0.597(0.055) & 0.613(0.049) \\ AE & 0.660(0.047) & 0.775(0.077) & 0.713(0.032) & 0.727(0.104) & 0.600(0.154) & 0.658(0.143) & 0.688(0.056) \\ SAE & 0.703(0.029) & 0.650(0.063) & 0.675(0.018) & 0.674(0.027) & 0.725(0.076) & 0.699(0.034) & 0.688(0.013) \\ \midrule Meta-AE & 0.667(0.013) & 0.800(0.036) & 0.727(0.012) & 0.750(0.020) & 0.600(0.036) & 0.667(0.014) & 0.700(0.007) \\ Meta-SAE & 0.681(0.018) & 0.800(0.045) & 0.736(0.014) & 0.758(0.023) & 0.625(0.048) & 0.685(0.020) & 0.713(0.010) \\ SMeta-AE & 0.714(0.020) & 0.750(0.025) & 0.732(0.010) & 0.737(0.012) & 0.700(0.040) & 0.718(0.022) & 0.725(0.013) \\ SMeta-SAE & 0.732(0.019) & 0.750(0.061) & 0.741(0.022) & 0.744(0.040) & 0.725(0.053) & 0.734(0.020) & 0.738(0.013) \\ \bottomrule \end{tabular} \end{table*} \subsection{Experiment Setting}\label{exp_set} In the experiments, we examine the efficacy of our method using two tinnitus dataset~\cite{schaette2011tinnitus,guest2017tinnitus} through Auditory brainstem responses (ABRs) through EEG. ABRs are evoked potentials recorded with EEG sensors, which originate from the early stages of the auditory pathway. The source dataset was collected by Schaette and McAlpine~\cite{schaette2011tinnitus}, which used presentation levels of 90 and 100 dB peSPL with an 11 click/s rate. The target dataset was collected by Guest et al.~\cite{guest2017tinnitus} in response to 102 dB peSPL clicks presented with a rate of 7 clicks/s. The source dataset was approved by the University College London (UCL) ethics committee with ethics ID number 2039/002. The declaration is the Helsinki declaration. The target dataset was approved by the National Research Ethics Service Greater Manchester West Ethics Committee with REC reference 15/NW/0133 and IRAS project ID 168221. The source dataset~\cite{schaette2011tinnitus} contains 408 signals of a duration of 10 ms from 38 subjects, where each subject only has data of one side (left or right ear). The target dataset~\cite{guest2017tinnitus} has 80 signals of a duration of 8 ms from 40 subjects, where each subject in the target dataset has records for both left and right ears, respectively. In other words, we use 408 signals of the source dataset as the training data, and 80 signals of the target dataset as the testing data. Since we use different datasets for training and testing, K-fold cross-validation is not applicable for our experiments. The source dataset only consists of the female subjects and the target dataset contains both male and female subjects. The averaged time point numbers are 500 and 131 for the source and target datasets, respectively. The mean ages of patients/subjects are 36.3/33.2 years and 25.7/25.5 years in the source dataset and target dataset, respectively. Both datasets are measured by a Medelec Synergy T-EP system (Oxford Instruments Medical) by placing Disposable electrodes (Nicolet Biomedical) on the high forehead and the ipsilateral and contralateral mastoids, where the electrode impedances are two k$\Omega$. Therefore, $n_{s}$=400 and $n_{g}$=131 to make slices of signals in the same time duration, i.e., 8 ms. For both SMeta-AE and SMeta-SAE, we use a 1-way 2-shot learning scheme for meta-learning following the work of Finn et al.~\cite{finn2017model}. We use this setting because we want to have a subject-specific fine-tuned model for each subject to ease the negative influence of subject variance on classification, and the target dataset only has two samples for each subject, i.e., 2 samples to fit in the inference stage. The window interval is 20 when sampling signals in the source dataset. We set $\alpha$=1e-3, $\beta$=1e-3, query size as 8, and batch size $b$=16 for SMeta-AE and $b$=5 for SMeta-SAE. The epoch maximum is 200 for SMeta-AE during training. To allow more training times for the Siamese autoencoder which is more complex than a conventional autoencoder, we set the epoch maximum as 1000 for SMeta-SAE. We compare our method with 9 competitive machine learning models: (\textbf{a}) XGBoost~\cite{chen2016xgboost}, (\textbf{b}) nu-SVC~\cite{v-svm}, (\textbf{c}) nCSP~\cite{ncsp}, (\textbf{d}) DeepNet \cite{DeepConvNet}, (\textbf{e}) ShallowNet \cite{DeepConvNet} (\textbf{f}) AEXGB \cite{AEXGB}, (\textbf{g}) EEGNet \cite{eegnet}, (\textbf{h}) AE~\cite{sunilkumar2021bio}, and (\textbf{i}) SAE~\cite{liu2021generalizable}. We view tinnitus patients as positive samples and control subjects as negative samples. We use criteria, Negative Predictive Value (NPV), True Negative Rate (TNR), Positive Predictive Value (PPV), True Positive Rate (TPR), F1-score for negative samples (N-F1), and F1-score for positive samples (P-F1), to measure the model performance among positive and negative samples. The calculation is as follows: \begin{gather} NPV = TN / (FN + TN)\\ TNR = TN / (FP + TN)\\ PPV = TP / (TP + FP)\\ TPR = TP / (TP + FN)\\ N\hbox{-}F1: 2*NPV*TNR/(NPV+TNR)\\ P\hbox{-}F1: 2*PPV*TPR/(PPV+TPR) \end{gather} where TP, TN, FP, FN represent the numbers of true positive, true negative, false positive, and false negative prediction, respectively. \begin{figure*}[h] \centering \begin{subfigure}{0.32\textwidth} \includegraphics[width=\textwidth]{image/both_side_auc.pdf} \centering \caption{ROC curve of both sides.} \end{subfigure}\hfil \begin{subfigure}{0.32\textwidth} \includegraphics[width=\textwidth]{image/left_side_auc.pdf} \centering \caption{ROC curve of left side.} \end{subfigure}\hfil \begin{subfigure}{0.32\textwidth} \includegraphics[width=\textwidth]{image/right_side_auc.pdf} \centering \caption{ROC curve of right side.} \end{subfigure}\hfil \caption{ROC curves of SMeta-SAE. Class 0 and class 1 denote control subject and tinnitus patient, respectively.}\label{ROC_curve} \end{figure*} \subsection{Cross-dataset Tinnitus Diagnosis} We run each model 50 times and use the best performance as the final result. The best performance and standard deviation are shown in Table~\ref{Main_exp_both}. In the compared methods, AE and SAE achieve the highest accuracy. Meanwhile, AE obtains the highest scores in TNR, N-F1, and PPV, which means that AE has a better ability in classifying negative samples than SAE. SAE has the best scores in TPR and P-F1, which shows that SAE is effective in classifying positive samples. DeepNet gets the highest score in NPV. Overall, deep-learning-based methods have the best performance in machine learning methods. We show both conventional meta-learning and side-aware meta-learning on AE and SAE. Compared to these methods, we can observe that both meta-learning and side-aware meta-learning can effectively improve the model performance. Specifically, SMeta-based method can improve up to 1.8\%, 2.8\%, 1.7\%, 3.5\%, 5.0\% in NPV, N-F1, PPV, P-F1, and ACC, respectively. The meta-based method can improve up to 2.5\%, 2.3\%, 3.1\%, 2.5\%, in TNR, N-F1, PPV, and Acc, respectively. Meta-learning mainly improves the ability to classify negative samples, while SMeta can improve the ability to classify both positive and negative samples. However, SMeta methods tend to be less stable than Meta methods, which may be caused by the over-fitting towards side information in the inference stage. \begin{table*} \centering \caption{Best performance of cross-dataset tinnitus diagnosis on the left ear (standard deviation).} \label{Main_exp_left} \small \begin{tabular}{c|ccccccc} \toprule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\\Model\end{tabular}} & \multicolumn{7}{c}{Left Side} \\ \cmidrule{2-8} & NPV & TNR & N-F1 & PPV & TPR & P-F1 & Acc \\ \midrule XGBoost & 0.455(0.000) & 0.500(0.000) & 0.476(0.000) & 0.444(0.000) & 0.400(0.000) & 0.421(0.000) & 0.450(0.000) \\ Nu-SVC & 0.467(0.000) & 0.350(0.000) & 0.400(0.000) & 0.480(0.000) & 0.600(0.000) & 0.533(0.000) & 0.475(0.000) \\ nCSP & 0.591(0.088) & 0.650(0.109) & 0.619(0.090) & 0.611(0.078) & 0.550(0.114) & 0.579(0.091) & 0.600(0.081) \\ DeepNet & 0.500(0.245) & 0.100(0.053) & 0.167(0.085) & 0.500(0.016) & 0.900(0.026) & 0.643(0.017) & 0.575(0.029) \\ ShalowNet & 0.524(0.063) & 0.550(0.136) & 0.537(0.110) & 0.526(0.036) & 0.500(0.122) & 0.513(0.055) & 0.525(0.044) \\ AE-XGB & 0.615(0.143) & 0.400(0.179) & 0.485(0.169) & 0.556(0.049) & 0.750(0.146) & 0.638(0.065) & 0.575(0.060) \\ EEGNET & 0.600(0.115) & 0.600(0.240) & 0.600(0.196) & 0.600(0.054) & 0.600(0.169) & 0.600(0.068) & 0.600(0.062) \\ AE & 0.652(0.053) & 0.750(0.078) & 0.698(0.043) & 0.706(0.157) & 0.600(0.159) & 0.649(0.161) & 0.675(0.069) \\ SAE & 0.750(0.038) & 0.600(0.077) & 0.667(0.035) & 0.667(0.036) & 0.800(0.073) & 0.727(0.030) & 0.700(0.023) \\ \midrule Meta-AE & 0.682(0.018) & 0.750(0.034) & 0.714(0.016) & 0.722(0.019) & 0.650(0.037) & 0.684(0.020) & 0.700(0.015) \\ Meta-SAE & 0.682(0.021) & 0.750(0.038) & 0.714(0.018) & 0.722(0.022) & 0.650(0.044) & 0.684(0.024) & 0.700(0.017) \\ SMeta-AE & 0.714(0.030) & 0.750(0.029) & 0.732(0.023) & 0.737(0.023) & 0.700(0.047) & 0.718(0.032) & 0.725(0.026) \\ SMeta-SAE & 0.714(0.024) & 0.750(0.056) & 0.732(0.024) & 0.737(0.036) & 0.700(0.051) & 0.718(0.023) & 0.725(0.019) \\ \bottomrule \end{tabular} \end{table*} \begin{table*} \centering \caption{Best performance of cross-dataset tinnitus diagnosis on the right ear (standard deviation).} \label{Main_exp_right} \small \begin{tabular}{c|ccccccc} \toprule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\\Model\end{tabular}} & \multicolumn{7}{c}{Right Side} \\ \cmidrule{2-8} & NPV & TNR & N-F1 & PPV & TPR & P-F1 & Acc \\ \midrule XGBoost & 0.478(0.000) & 0.550(0.000) & 0.512(0.000) & 0.471(0.000) & 0.400(0.000) & 0.432(0.000) & 0.475(0.000) \\ Nu-SVC & 0.467(0.000) & 0.350(0.000) & 0.400(0.000) & 0.480(0.000) & 0.600(0.000) & 0.533(0.000) & 0.475(0.000) \\ nCSP & 0.545(0.068) & 0.600(0.099) & 0.571(0.077) & 0.556(0.062) & 0.500(0.109) & 0.526(0.078) & 0.550(0.063) \\ DeepNet & 1.000(0.416) & 0.150(0.047) & 0.261(0.082) & 0.541(0.011) & 1.000(0.028) & 0.702(0.012) & 0.500(0.021) \\ ShalowNet & 0.636(0.049) & 0.700(0.166) & 0.667(0.125) & 0.667(0.045) & 0.600(0.104) & 0.632(0.033) & 0.650(0.043) \\ AE-XGB & 0.800(0.115) & 0.400(0.174) & 0.533(0.164) & 0.600(0.039) & 0.900(0.127) & 0.720(0.044) & 0.650(0.051) \\ EEGNET & 0.609(0.060) & 0.700(0.226) & 0.651(0.170) & 0.647(0.054) & 0.550(0.155) & 0.595(0.050) & 0.625(0.046) \\ AE & 0.667(0.049) & 0.800(0.098) & 0.727(0.037) & 0.750(0.110) & 0.600(0.160) & 0.667(0.140) & 0.700(0.055) \\ SAE & 0.667(0.038) & 0.700(0.063) & 0.683(0.027) & 0.684(0.037) & 0.650(0.090) & 0.667(0.054) & 0.675(0.031) \\ \midrule Meta-AE & 0.654(0.019) & 0.850(0.048) & 0.739(0.019) & 0.786(0.034) & 0.550(0.046) & 0.647(0.022) & 0.700(0.016) \\ Meta-SAE & 0.680(0.021) & 0.850(0.060) & 0.756(0.020) & 0.800(0.037) & 0.600(0.060) & 0.686(0.024) & 0.725(0.012) \\ SMeta-AE & 0.714(0.025) & 0.750(0.037) & 0.732(0.017) & 0.737(0.026) & 0.700(0.050) & 0.718(0.028) & 0.725(0.019) \\ SMeta-SAE & 0.750(0.030) & 0.750(0.073) & 0.750(0.030) & 0.750(0.053) & 0.750(0.070) & 0.750(0.035) & 0.750(0.025) \\ \bottomrule \end{tabular} \end{table*} We further show the detailed prediction of left and right ear in Table~\ref{Main_exp_left} and Table~\ref{Main_exp_right}, respectively. We can find that SMeta-based methods still achieve the best performance on both left and right ears in Acc. SMeta-SAE improves the accuracy up to 2.5\% and 5.0\% compared to the best comparison in left and right ear, respectively. In the aspect of balanced classification ability, SMeta-based methods are suitable for the negative subject in both left and right ears. It can also well handle tinnitus patients in the right ear. While meta-learning may impair the model performance of TPR in the left ear, both Meta- and SMeta-methods can make the model classify tinnitus patients with higher precision, i.e., PPV. In conclusion, side-aware meta-learning can effectively improve the ability of the model to classify tinnitus patients and control subjects of different gender and ages. The side information of ears can boost the model training and fitting process to further enhance the meta-learning. It is feasible to use side-aware meta-learning to develop a reliable classification tool for ubiquitous patients with diverse physical conditions, e.g., age and gender, based on limited datasets. \subsection{Ablation Study} \subsubsection{ROC curves} As shown in Figs.~\ref{ROC_curve} (a-c), we show the Receiver Operating Characteristic (ROC) curves of SMeta-SAE, which can achieve a high Area Under Curve (AUC) score for ROC in three conditions. When classifying both left and right sides at the same time, the areas are similar. SMeta-SAE obtains the highest AUC score in precisely classifying the right ear of tinnitus patients. Overall, SMeta-SAE shows a better AUC in the right ear than the left ear. \begin{table*}[h] \centering \caption{Parameter study of SMeta-AE on batch size $b$.} \label{Ablation_batch_size} \resizebox{\textwidth}{!}{% \begin{tabular}{c|ccccc|ccccc|ccccc} \toprule \multirow{2}{*}{Batch Size} & \multicolumn{5}{c|}{Both Sides} & \multicolumn{5}{c|}{Left Side} & \multicolumn{5}{c}{Right Side} \\\cmidrule{2-16} & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc \\ \midrule 1 & 0.718 & 0.700 & 0.707 & 0.725 & 0.713 & 0.737 & 0.700 & 0.714 & 0.750 & 0.725 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 \\ 2 & 0.690 & 0.725 & 0.711 & 0.675 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 4 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 8 & 0.660 & 0.775 & 0.727 & 0.600 & 0.688 & 0.652 & 0.750 & 0.706 & 0.600 & 0.675 & 0.667 & 0.800 & 0.750 & 0.600 & 0.700 \\ 16 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 32 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 64 & 0.705 & 0.775 & 0.750 & 0.675 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.696 & 0.800 & 0.765 & 0.650 & 0.725 \\ 128 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.652 & 0.750 & 0.706 & 0.600 & 0.675 \\ \bottomrule \end{tabular} } \end{table*} \begin{table*}[h] \centering \caption{Parameter study of SMeta-AE on different learning steps.} \label{Ablation_learning_step} \resizebox{\textwidth}{!}{% \begin{tabular}{c|ccccc|ccccc|ccccc} \toprule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\\Learning Step\end{tabular}} & \multicolumn{5}{c|}{Both Sides} & \multicolumn{5}{c|}{Left Side} & \multicolumn{5}{c}{Right Side} \\ \cmidrule{2-16} & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc \\ \midrule 1 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.750 & 0.750 & 0.750 & 0.750 & 0.750 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 2 & 0.711 & 0.675 & 0.690 & 0.725 & 0.700 & 0.722 & 0.650 & 0.682 & 0.750 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 \\ 3 & 0.725 & 0.725 & 0.725 & 0.725 & 0.725 & 0.750 & 0.750 & 0.750 & 0.750 & 0.750 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 \\ 4 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 5 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 6 & 0.667 & 0.800 & 0.750 & 0.600 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.654 & 0.850 & 0.786 & 0.550 & 0.700 \\ 7 & 0.674 & 0.775 & 0.735 & 0.625 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.667 & 0.800 & 0.750 & 0.600 & 0.700 \\ 8 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.652 & 0.750 & 0.706 & 0.600 & 0.675 \\ 9 & 0.690 & 0.725 & 0.711 & 0.675 & 0.700 & 0.667 & 0.700 & 0.684 & 0.650 & 0.675 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 10 & 0.653 & 0.800 & 0.742 & 0.575 & 0.688 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.630 & 0.850 & 0.769 & 0.500 & 0.675 \\ \bottomrule \end{tabular} } \end{table*} \begin{table*}[h] \centering \caption{Parameter study of SMeta-AE on different meta-learning rate ($\alpha$).} \label{Ablation_meta_lr} \resizebox{\textwidth}{!}{% \begin{tabular}{c|ccccc|ccccc|ccccc} \toprule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\\$\alpha$\end{tabular}} & \multicolumn{5}{c|}{Both Sides} & \multicolumn{5}{c|}{Left Side} & \multicolumn{5}{c}{Right Side} \\ \cmidrule{2-16} & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc \\ \midrule 6.0E-04 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 7.0E-04 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 8.0E-04 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 9.0E-04 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.652 & 0.750 & 0.706 & 0.600 & 0.675 \\ 1.0E-03 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 1.1E-03 & 0.674 & 0.775 & 0.735 & 0.625 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.667 & 0.800 & 0.750 & 0.600 & 0.700 \\ 1.2E-03 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 1.3E-03 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.4E-03 & 0.707 & 0.725 & 0.718 & 0.700 & 0.713 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 1.5E-03 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ \bottomrule \end{tabular} } \end{table*} \begin{table*}[h] \centering \caption{Parameter study of SMeta-AE on different learning rate ($\beta$).} \label{Ablation_lr} \resizebox{\textwidth}{!}{% \begin{tabular}{c|ccccc|ccccc|ccccc} \toprule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\\$\beta$\end{tabular}} & \multicolumn{5}{c|}{Both Sides} & \multicolumn{5}{c|}{Left Side} & \multicolumn{5}{c}{Right Side} \\ \cmidrule{2-16} & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc & NPV & TNR & PPV & TPR & Acc \\ \midrule 6.0E-04 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 7.0E-04 & 0.689 & 0.775 & 0.743 & 0.650 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.667 & 0.800 & 0.750 & 0.600 & 0.700 \\ 8.0E-04 & 0.690 & 0.725 & 0.711 & 0.675 & 0.700 & 0.737 & 0.700 & 0.714 & 0.750 & 0.725 & 0.652 & 0.750 & 0.706 & 0.600 & 0.675 \\ 9.0E-04 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.0E-03 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 \\ 1.1E-03 & 0.690 & 0.725 & 0.711 & 0.675 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.2E-03 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.3E-03 & 0.690 & 0.725 & 0.711 & 0.675 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.700 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.4E-03 & 0.698 & 0.750 & 0.730 & 0.675 & 0.713 & 0.714 & 0.750 & 0.737 & 0.700 & 0.725 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 \\ 1.5E-03 & 0.682 & 0.750 & 0.722 & 0.650 & 0.700 & 0.667 & 0.700 & 0.684 & 0.650 & 0.675 & 0.696 & 0.800 & 0.765 & 0.650 & 0.725 \\ \bottomrule \end{tabular} } \end{table*} \subsubsection{Hyper-parameter study} We use the parameters in Section \ref{exp_set} as the default setting and fix the random seed as 200 to test the influence of different hyper-parameters on SMeta-AE. We show the ablation study of batch size $b$, learning steps for meta-training, meta-learning rate $\alpha$, learning rate $\beta$ in Table~\ref{Ablation_batch_size}, Table~\ref{Ablation_learning_step}, Table~\ref{Ablation_meta_lr}, and Table~\ref{Ablation_lr}, respectively. We can observe that our model is stable over most parameters. Only a few parameters (e.g., $b$=128 and $\alpha$=9e-4) will slightly impair the model performance, which may be caused by the bad initialization of the random seed, but the model performance is still competitive. \begin{figure}[h] \centering \begin{subfigure}{0.24\textwidth} \includegraphics[width=\textwidth]{image/raw_fig_both_side_10_subject.pdf} \centering \caption{Raw signals.} \end{subfigure}\hfil \begin{subfigure}{0.24\textwidth} \includegraphics[width=\textwidth]{image/embed_fig_both_side_10_subject.pdf} \centering \caption{Learned features.} \end{subfigure}\hfil \caption{Visualization of (a) raw signals and (b) the learned features of SMeta-SAE, respectively. We take 10 subjects from the target dataset for exhibition. Each subject (distinguished by different colors) has two signals (represented as spots).}\label{embedding} \end{figure} \subsubsection{Visualization of Learned Features} We take 10 subjects from the target dataset and visualize the learned features of SMeta-SAE based on t-SNE~\cite{van2008visualizing} in Figs.~\ref{embedding} (b). The samples of the same subject are plotted with the same color. Compared to the raw signals in Figs.~\ref{embedding} (a), the learned features can effectively decrease the distance between samples of the same subject, which shows the effectiveness of SMeta-learning in improving the feature qualities. The models can effectively cluster new signals if they belong to the same subjects without any prior collected data from these subjects. \subsection{Conclusion} We propose a novel side-aware meta-autoencoder to conduct tinnitus diagnosis across datasets for different ages and genders. We design a sliding window with down-sampling to align data, a subject-specific task sampling way for our side-aware meta-learning, and an inference stage to fit side information. We conduct extensive experiments to analyze the model performance on both ears and single ears, which is superior to conventional meta-learning. The experimental results indicate that the side information of the tested ear is beneficial for model training. Moreover, we visualize the embedding space to show the effectiveness of our method in improving the quality of the learned features. These results indicate that it is feasible to transfer model classification ability across datasets with different data collection processes. In the future, we plan to validate our method on more challenging datasets that collect data from more divergent experimental environments. \bibliographystyle{IEEEtran}
\section{Convex duality for the IH1 configuration}\label{ss:duality-ih1} The equivalence between \eqref{e:primal-form-ih1} and \eqref{e:dual-form-ih1} follow from a relatively standard convex duality argument. It will be enough to show that \begin{equation}\label{e:ih1-duality-inf-sup} \sup_{T \in \mathcal{H}_+} -\Phi\{T\} = \inf_{ \substack{\lm \in L^2(0,1) \\ \lm \text{ \rm nondecreasing} \\ \langle \lm \rangle = -1}} \tfrac{1}{4\bp} \volav{ \abs{ \bfield' - \lm - \bp \left(z - \tfrac{1}{2}\right) }^2}, \end{equation} where \begin{equation* \Phi\{T\} := \volav{ \bp \abs{\nabla T}^2 - R \bfield' (\Delta^{-2}\Delta_h T) T - (\bfield' - \bp z) \partial_z T }. \end{equation*} To establish this identity, we start by rewriting the maximization on the left-hand side as a minimization problem for the Legendre transform of $\Phi$. Recall that the Legendre transform of a functional $\Lambda:\mathcal{H} \to \mathbb{R}$ is the functional \begin{equation* \Lambda^*\{\mu\} := \sup_{T \in \mathcal{H}} \left( \mu\{T\} - \Lambda\{T\}\right), \end{equation*} which acts on the dual space $\mathcal{H}^*$ of bounded linear functionals $T \mapsto \mu\{T\}$ on $\mathcal{H}$. We shall write $\mathcal{H}^*_+ \subset \mathcal{H}^*$ for the subset of nonnegative bounded linear functionals on $\mathcal{H}$, meaning that $\mu \in \mathcal{H}^*_+$ if and only if $\mu \in \mathcal{H}^*$ and $\mu\{T\} \geq 0$ for all $T \in \mathcal{H}_+$. \begin{lemma}\label{th:ih1-duality} If the pair $(\bp,\bfield)$ satisfies the spectral constraint, $\sup_{T \in \mathcal{H}_+} -\Phi\{T\} = \inf_{\mu \in \mathcal{H}^*_+} \Phi^*\{\mu \}.$ \end{lemma} \begin{proof} Define a functional $\Psi$ from $\mathcal{H}$ into $\mathbb{R} \cup \{+\infty\}$ via \begin{equation* \Psi\{T\} := \begin{cases} 0 & T \in \mathcal{H}_+,\\ +\infty & \text{otherwise}. \end{cases} \end{equation*} % Its Legendre transform is % \begin{equation* \Psi^*\{\mu\} = \begin{cases} 0 &\text{if } -\mu \in \mathcal{H}^*_+,\\ +\infty &\text{otherwise}. \end{cases} \end{equation*} % We claim that % \begin{align*} \sup_{T \in \mathcal{H}_+} -\Phi\{T\} &= -\inf_{T \in \mathcal{H}_+} \Phi\{T\} \\ &= -\inf_{T \in \mathcal{H}} \left(\Phi\{T\} + \Psi\{T\} \right) \\ &= \inf_{\mu \in \mathcal{H}^*} \left( \Phi^*\{-\mu \} + \Psi^*\{\mu\} \right)\\ &= \inf_{\mu \in \mathcal{H}^*_+} \Phi^*\{\mu \}. \end{align*} The first, second and fourth equalities are immediate consequences of the definitions of $\inf$, $\sup$, $\Psi$, and $\Psi^*$. The third one, instead, follows from the Fenchel--Rockafellar minmax theorem when $\mathcal{H}$ is viewed as a Hilbert space with the inner product $\volav{\nabla T_1 \cdot \nabla T_2}$ and norm $\langle \abs{\nabla T}^2 \rangle$. To apply this theorem as stated in~\cite[Theorem~1.12]{Brezis2010}, we need to verify that the functionals $\Phi$ and $\Psi$ are convex, and that $\Phi$ is continuous (with respect to the norm on $\mathcal{H}$) at some $T_0 \in {\rm dom}(\Phi) \cap {\rm dom}(\Psi) = \mathcal{H}_+$. The convexity of $\Psi$ is obvious, while that of $\Phi$ follows from the assumption that the pair $(\bp,\bfield)$ satisfies the spectral constraint (cf. \cref{def:sc}). To see this, write $\Phi\{T\} = \mathcal{Q}\{T,T\} - (\bfield' - \bp z) \partial_z T$ where $\mathcal{Q}$ is the bilinear form % \begin{equation*} \mathcal{Q}\{T_1,T_2\} := \volav{\beta \nabla T_1 \cdot \nabla T_2 - R \bfield' (\Delta^{-2}\Delta_h T_1) T_2 }, \end{equation*} and observe that the spectral constraint ensures $\mathcal{Q}\{T,T\} \geq 0$ for all $T$ in the linear space $\mathcal{H}$. Thus, for any $\lambda \in [0,1]$ we can set $\bar{\lambda} = 1-\lambda$ and estimate \begin{align*} \Phi\{\lambda T_1 + \bar{\lambda} T_2\} &= \mathcal{Q}\{\lambda T_1 + \bar{\lambda} T_2, \lambda T_1 + \bar{\lambda} T_2\} - (\bfield' - \bp z) \partial_z [\lambda T_1 + \bar{\lambda} T_2]\\ &= \lambda\Phi\{T_1, T_1\}+\bar{\lambda}\Phi\{T_2,T_2\}- \lambda \bar{\lambda} \mathcal{Q}\{T_1-T_2, T_1-T_2\}\\ &\leq \lambda \Phi\{T_1, T_1\}+\bar{\lambda} \Phi\{T_2,T_2\}, \end{align*} proving that $\Phi$ is convex. The continuity of $\Phi$ at any $T_0 \in \mathcal{H}_+$ follows because $\Phi$ is continuous on the whole space $\mathcal{H}$. Indeed, the terms $\smallvolav{\abs{\nabla T}^2}$ and $\smallvolav{(\bfield'-\bp z)\partial_z T}$ in the expression for $\Phi\{T\}$ are clearly continuous on $\mathcal{H}$. To see that the remaining term is also continuous, it is enough to establish that $T_k \to T$ in $\mathcal{H}$ implies $\varphi_k := \smash{\Delta^{-2}\Delta_h T_k} \to \smash{\Delta^{-2}\Delta_h T} =: \varphi$ in $\mathcal{H}$. This can be shown by combining the Poincar\'e inequalities $\smallvolav{\varphi^2} \lesssim \smallvolav{\abs{\Delta \varphi}^2}$ and $\smallvolav{T^2} \lesssim \smallvolav{\abs{\nabla T}^2}$ with the estimate \begin{equation*} \smallvolav{ \abs{\Delta \varphi}^2 } = \abs{\smallvolav{ \varphi \Delta^2 \varphi }} = \abs{\smallvolav{ \varphi \Delta_h T }} = \abs{\smallvolav{ \Delta_h \varphi T } } \leq \smallvolav{ \abs{\Delta \varphi}^2 }^\frac12 \smallvolav{ \abs{T}^2 }^\frac12, \end{equation*} which implies $\smallvolav{\abs{\Delta \varphi}^2} \leq \smallvolav{T^2}$. This concludes the proof of \cref{th:ih1-duality}. \end{proof} Next, we prove that since $\Phi\{T\}$ is invariant under horizontal translations of the temperature field $T$, the minimization of its Legendre transform $\Phi^*$ can be restricted to functionals $\mu \in \mathcal{H}^*_+$ that are translation invariant. Specifically, for any real numbers $r,s$ define the translation map $\translation{r,s}:\mathcal{H} \to \mathcal{H}$ and its adjoint $\translation{r,s}^*:\mathcal{H}^* \to \mathcal{H}^*$ via \begin{align*} \translation{r,s} T &:= T(x+r, y+s, z) \\ \translation{r,s}^* \mu &:= \mu \circ \translation{r,s}. \end{align*} The functional $\mu \in \mathcal{H}^*$ is translation invariant if $\translation{r,s}^* \mu= \mu$ for all $r$ and $s$. \begin{lemma}\label{th:ih1-invariance} Suppose $\Phi:\mathcal{H} \to \mathbb{R}$ satisfies $\Phi\{\translation{r,s}T\} = \Phi\{T\}$ for all $r,s \in \mathbb{R}$. Then, \begin{equation*} \inf_{\mu \in \mathcal{H}^*} \Phi^*\{\mu \} = \inf_{\substack{\mu \in \mathcal{H}^* \\ \mu \text{ \rm transl. inv.}}} \Phi^*\{\mu \}. \end{equation*} \end{lemma} \begin{proof} It suffices to show that for every $\nu \in \mathcal{H}^*$ there exists a translation-invariant $\mu \in \mathcal{H}^*$ such that $\Phi^*\{\mu\} = \Phi^*\{\nu\}$. Since every temperature field $T \in \mathcal{H}$ is horizontally periodic, such a $\mu$ can be constructed simply by averaging the functionals $\translation{r,s}^*\nu$ over horizontal translations $r$ and $s$, i.e., by letting % \begin{equation*} \mu(T) := \fint_{r,s} \translation{r,s}^*\nu\{T\} = \fint_{r,s} \nu\{\translation{r,s} T\} \qquad \forall T \in\mathcal{H}. \end{equation*} % To show that $\Phi^*\{\mu\} = \Phi^*\{\nu\}$, we establish the complementary inequalities $\Phi^*\{\mu\} \leq \Phi^*\{\nu\}$ and $\Phi^*\{\mu\} \geq \Phi^*\{\nu\}$. For the first one, use the translation invariance of $\Phi$ and the definition of the Legendre transform to estimate % \begin{equation*} \nu\{\translation{r,s}T\} - \Phi\{T\} = \nu\{\translation{r,s}T\} - \Phi\{\translation{r,s} T\} \leq \Phi^*\{\nu\} \end{equation*} for all $T \in \mathcal{H}$ and all horizontal shifts $r,s \in \mathbb{R}$. Averaging over horizontal shifts shows that $\mu\{T\} - \Phi\{T\} \leq \Phi^*\{\nu\}$ for all $T \in \mathcal{H}$, which implies $\Phi^*\{\mu\} \leq \Phi^*\{\nu\}$. To obtain the reverse inequality observe that, by definition of $\Phi^*$, for any $\varepsilon>0$ there exists $T_\varepsilon \in \mathcal{H}$ such that $\nu\{T_\varepsilon\} - \Phi\{T_\varepsilon\} \geq \Phi^*\{\nu\} - \varepsilon$. Then, since $\Phi$ is translation invariant, % \begin{align*} \Phi^*\{\nu\} - \varepsilon &\leq \nu\{T_\varepsilon\} - \Phi\{T_\varepsilon\} \\ &= (\translation{r,s}^*\nu)\{\translation{-r,-s} T_\varepsilon\} - \Phi\{\translation{-r,-s} T_\varepsilon\}\\ &\leq \Phi^*\{\translation{r,s}^*\nu\}. \end{align*} % Upon averaging this inequality over all horizontal shifts $r,s \in \mathbb{R}$ and applying Jensen's inequality to $\Phi^*$, which is concave because it is the supremum of linear functions, we find % \begin{equation*} \Phi^*(\nu) - \varepsilon \leq \fint_{r,s} \Phi^*\left(\translation{r,s}^*\nu \right) \leq \Phi^*\!\left(\fint_{r,s} \translation{r,s}^*\nu \right) = \Phi^*(\mu). \end{equation*} Letting $\varepsilon \to 0$ yields $\Phi^*\{\mu\} \geq \Phi^*\{\nu\}$, as desired. \Cref{th:ih1-invariance} is therefore proved. \end{proof} To establish identity~\eqref{e:ih1-duality-inf-sup} we now need to show that its right-hand side coincides with the infimum of $\Phi^*$ over translation-invariant functionals $\mu \in \mathcal{H}^*_+$. For this, we use a characterization of such $\mu$ established in~\cite[Appendix C]{arslan2021IH1}. \begin{lemma}\label{th:ih1-representation} Let $\mathcal{H}^*_+$ be the set of positive linear functionals on the temperature space $\mathcal{H}$ defined in~\eqref{e:T-space-ih1}. If $\mu \in \mathcal{H}^*_+$ is translation invariant, there exists a nondecreasing function $\lm \in L^2(0,1)$ with $\volav{\lm}=-1$ such that $\mu\{T\} = \volav{-{\lm}(z)\, \partial_z T}$. \end{lemma} Thanks to this representation, all that remains to do is to calculate \begin{equation}\label{e:Psi-transform-initial} \Phi^*\{\mu\} = \sup_{T \in \mathcal{H}} \volav{ (\bfield' - \lm + \bp z) \partial_z T - \bp \abs{\nabla T}^2 + R \bfield' (\Delta^{-2}\Delta_h T) T }. \end{equation} To solve this maximization problem, let $\eta(z) = \smallvolav{T}_h(z)$ be the horizontal mean of $T$ and set $\xi = T - \eta$. Since $\Delta_h \eta =0$ and $\smallvolav{\xi}_h(z) = 0$ by construction, we can therefore substitute $T=\eta+\xi$ in~\cref{e:Psi-transform-initial} and solve the equivalent problem \begin{multline}\label{e:Psi-transform-expanded} \Phi^*\{\mu\} = \sup_{\substack{\eta=0 \text{ if }z \in\{0,1\} \\ \xi = 0 \text{ if }z \in\{0,1\} \\ \smallvolav{\xi}_h=0}} \Big\{ \volav{ (\bfield' - \lm + \bp z) \eta' - \bp \abs{\eta'}^2 - \bp \abs{\nabla \xi}^2 + R \bfield' (\Delta^{-2}\Delta_h \xi) \xi } \\[-5ex] \volav{ (\bfield' - \lm + \bp z) \partial_z \xi - 2\bp\, \eta'\, \partial_z \xi + R \bfield' \eta \,(\Delta^{-2}\Delta_h \xi) } \Big\}. \end{multline} The boundary conditions on $\eta$ and $\xi$ follow from those on $T$. The three terms on the second line vanish identically because $\smallvolav{\xi}_h(z) = 0$ at all $z\in[0,1]$. To verify this claim, observe that \begin{equation*} \volav{f(z) \partial_z \xi} = \int_0^1 f(z) \volav{\xi}_h'(z) {\rm d}z = 0 \end{equation*} for any function $f(z)$ that depends only on the vertical direction. Similarly, one can show that \begin{equation*} \volav{R \bfield' \eta\, (\Delta^{-2}\Delta_h \xi)} = 0 \end{equation*} because the function $w = -R\smash{\Delta^{-2}\Delta_h T} = -R\smash{\Delta^{-2}\Delta_h \xi}$ also has zero horizontal mean. Indeed, taking the horizontal average of~\eqref{e:w_and_T_eq} yields the ODE $\smallvolav{w}_h''(z)=0$, whose only solution satisfying the boundary conditions in~\eqref{e:w-bcs} is $\smallvolav{w}_h(z)=0$. The minimization in~\eqref{e:Psi-transform-expanded} therefore simplifies into \begin{align}\label{e:Psi-transform-middle} \Phi^*\{\mu\} = \sup_{\substack{\eta=0 \text{ if }z \in\{0,1\} \\ \xi = 0 \text{ if }z \in\{0,1\} \\ \smallvolav{\xi}_h=0}} \volav{ (\bfield' - \lm - \bp z) \eta' - \bp \abs{\eta'}^2 - \bp \abs{\nabla \xi}^2 - R \bfield' w \xi }. \end{align} Since the pair $(\bp,\bfield)$ was assumed to satisfy the spectral constraint (cf. \cref{def:sc}), the choice $\xi=0$ is optimal. The optimal $\eta$, instead, satisfies the Euler--Lagrange equation $2\bp \eta'' = (\bfield' - \lm - \bp z)'$. Solving this equation using the boundary conditions, the constraints $\bfield(0)=1$ and $\bfield(1)=0$, and the normalization $\smallvolav{\lm} = -1$ gives $\eta' = \frac{1}{2b}[\bfield' - \lm - b(z-\frac12)]$, which can be substituted back into~\eqref{e:Psi-transform-middle} to give \begin{equation} \Phi^*\{\mu\} = \tfrac{1}{4\bp} \langle \abs{ \bfield' - \lm' - \bp \left( z-\tfrac12 \right) }^2 \rangle. \end{equation} Minimizing the left-hand side over translation invariant $\mu$ in $\mathcal{H}^*_+$ is the same as minimizing the right-hand side over $\lm$ satisfying the conditions in \cref{th:ih1-representation}, which is exactly the problem on the right-hand side of~\eqref{e:ih1-duality-inf-sup}. \section{Convex duality for the IH3 configuration}\label{ss:duality-ih3} The equivalence between the upper bounds~\cref{e:primal-form-ih3} and~\cref{e:dual-form-ih3} for the IH3 configuration follows from the identity \begin{equation}\label{e:ih3-duality-inf-sup} \sup_{T \in \mathcal{H}_+} -\Phi\{T\} = \inf_{ \substack{\lm \in L^2(0,1) \\ \lm \text{ \rm nondecreasing} \\ \lm \geq -1}} \volav{ \tfrac{1}{4\bp} \abs{ \bfield' - \lm - \bp z }^2 }, \end{equation} where \begin{equation} \Phi\{T\} := \volav{ \bp \abs{\nabla T}^2 -R \bfield' (\Delta^{-2}\Delta_h T) T - \left( \bfield' - \bp z + 1 \right)\partial_z T }. \end{equation} This identity can be proven using a convex duality argument analogous to that in \cref{ss:duality-ih1}. Indeed, \cref{th:ih1-duality,th:ih1-invariance} apply to the functional $\Phi$ considered in this section with no changes to their proofs. Consequently, \begin{equation} \sup_{T \in \mathcal{H}_+} \label{e:ih3-duality-initial} -\Phi\{T\} = \inf_{\substack{\mu \in \mathcal{H}^* \\ \mu \text{ \rm transl. inv.}}} \Phi^*\{\mu \}. \end{equation} To calculate the Legendre transform $\Phi^*$, however, we must replace \cref{th:ih1-representation} with a different characterization of translation-invariant linear functionals $\mu \in \mathcal{H}^*_+$. This is due to the different boundary conditions imposed on the temperature space $\mathcal{H}$. \begin{lemma}\label{th:ih3-representation} Let $\mathcal{H}^*_+$ be the set of positive linear functionals on the temperature space $\mathcal{H}$ defined in~\eqref{e:T-space-ih1}. If $\mu \in \mathcal{H}^*_+$ is translation invariant, there exists a nondecreasing function $\lm \in L^2(0,1)$ nonnegative almost everywhere and such that $\mu\{T\} = \volav{-{\lm}(z)\, \partial_z T}$. \end{lemma} \begin{proof} Straightforward modifications to the proof of~\cite[Lemma~3]{arslan2021IH1} reveal that any translation-invariant $\mu \in \mathcal{H}^*$ admits the representation $\mu\{T\} = \volav{-{\lm}(z)\, \partial_z T}$ for some function $\lm \in L^2(0,1)$. If $\mu$ is also positive, then the argument in the proof of~\cite[Lemma~2]{arslan2021IH1} shows that $\lm$ must be nondecreasing. To see that we must have $\lm(z_0) \geq 0$ at almost every $z_0 \in (0,1)$, fix $\varepsilon>0$ sufficiently small and consider the temperature field $T_\varepsilon \in \mathcal{H}_+$ given by % \begin{equation*} T_\varepsilon(\boldsymbol{x}) := \begin{cases} 2 & z\in (0, z_0-\varepsilon),\\ 2-\varepsilon^{-1}(z-z_0+\varepsilon) & z \in (z_0-\varepsilon, z_0+\varepsilon),\\ 0 & z \in (z_0+\varepsilon, 1). \end{cases} \end{equation*} % Then, since $\mu$ is a positive functional by assumption, % \begin{equation*} 0 \leq \mu(T_\varepsilon) = \frac1\varepsilon \int_{z_0-\varepsilon}^{z_0+\varepsilon} \lm(z) {\rm d}z. \end{equation*} By Lebesgue's differentiation theorem, the right-hand side tends to $2\lm(z_0)$ for almost all $z_0 \in (0,1)$ as $\varepsilon \to 0$. Thus, we must have $\lm \geq 0$ almost everywhere on $(0,1)$. \end{proof} To conclude the argument, we need to calculate $ \Phi^*\{\mu \}$ for translation-invariant $\mu \in \mathcal{H}^*_+$, which by \cref{th:ih3-representation} is given by \begin{equation*} \Phi^*\{\mu\} = \sup_{T \in \mathcal{H}} \volav{ \left( \bfield' - \lm - \bp z + 1 \right)\partial_z T -\bp \abs{\nabla T}^2 +R \bfield' (\Delta^{-2}\Delta_h T) T }. \end{equation*} Since the pair $(\bp,\bfield)$ was assumed to satisfy the spectral constraint, this maximization problem can be restricted to temperature fields that depend only on the vertical coordinate $z$ (this can be proven by splitting $T$ into its horizontal mean $\eta$ and a perturbation $\xi$ with zero horizontal mean, as outlined at the end of \cref{ss:duality-ih1}). The optimal value can then be shown to be \begin{equation*} \Phi^*\{\mu\} = \tfrac{1}{4\bp} \volav{ \abs{ \bfield' - \lm - \bp z + 1 }^2 } \end{equation*} and can be substituted into~\eqref{e:ih3-duality-initial} to arrive at \begin{equation*} \sup_{T \in \mathcal{H}_+} -\Phi\{T\} = \inf_{\substack{\lm \in L^2(0,1) \\ \lm \text{ \rm nondecreasing}\\\lm\geq 0}} \tfrac{1}{4\bp} \volav{ \abs{ \bfield' - \lm - \bp z + 1 }^2 }. \end{equation*} Changing the optimization variable on the right-hand side to $\tilde{\lm} = \lm - 1$ yields~\eqref{e:ih3-duality-inf-sup}. \section{Introduction}\label{sec:intro} Convective flows driven by internal sources of heat have attracted renewed interest in recent years~\cite{arslan2021ih2, arslan2021IH1, Wang2020, creyssels_2021, kumar2021ihc, Tobasco2022}. Such flows are commonly encountered in geophysics, where atmospheric convection~\cite{emanuel1994atmospheric} and mantle convection~\cite{schubert2001mantle, MantleConvectioninTerrestrialPlanets} are typical examples. They also exhibit unique features not seen in boundary-driven Rayleigh--B\'enard convection: for instance, it has recently been observed experimentally that internally heated (IH) convection can transport heat more efficiently than Rayleigh-B\'enard convection~\cite{miquel2019convection,bouillaut2019transition}. Nevertheless, the former remains much less studied. In particular, it remains a largely open challenge to rigorously predict how key statistical properties such as the mean vertical heat flux depend on the heating strength and on the fluid's Prandtl number $\Pr$, defined as the ratio between the fluid's kinematic viscosity $\nu$ and its thermal diffusivity $\kappa$. One source of difficulty for mathematical studies of IH convection is that the mean thermal dissipation, the mean viscous dissipation, and the mean vertical convective heat flux cannot all be related to each other via \textit{a priori} relationships. This is in contrast with Rayleigh-B\'enard convection, where such relationships enable one to rigorously bound the convective heat transfer through variational analysis of the mean thermal dissipation~\cite{doering1996variational}. Applying the same strategy to IH flows yields bounds on the mean temperature of the fluid~\cite{lu2004bounds,whitehead2011internal,goluskin2016internally,whitehead2012slippery} but not the convective heat flux. Recently, this variational strategy was extended by taking into account a minimum principle for the temperature, leading to bounds on the mean convective heat flux that approach a constant exponentially fast as the heating strength is increased~\cite{arslan2021IH1,kumar2021ihc}. Here, we demonstrate that these bounds can be improved to algebraic powers when the Prandtl number is taken to be infinite. Using standard non-dimensional variables~\cite{goluskin2016internally}, we consider a fluid in a horizontally periodic domain $\Omega = \mathbbm{T}_{[0,L_x]} \times \mathbbm{T}_{[0,L_y]} \times [0,1]$, the motion of which is governed by the infinite Prandtl number Boussinessq equations \begin{subequations}\label{e:governing-equations} \begin{align} \nabla \cdot \boldsymbol{u} &= 0\, , \label{continuit} \\ \nabla p &= \Delta\boldsymbol{u} + \Ra\, T \uvec{z}\, , \label{nondim_momentum} \\ \partial_t T + \boldsymbol{u}\cdot \nabla T &= \Delta T + 1. \label{nondim_energy} \end{align} \end{subequations} Here, $\boldsymbol{u}=(u,v,w)$ is the fluid velocity in cartesian components, $p$ is the pressure, $T$ is the temperature, and the unit forcing in~\eqref{nondim_energy} represents the non-dimensional internal heating rate. The flow is controlled by a `flux' Rayleigh number that measures the destabilising effect of the heating compared to the stabilising effects of diffusion, \begin{equation} \Ra := \frac{g \alpha Q d^{5}}{\rho c_p \nu \kappa^{2}}. \end{equation} Here $g$ is the acceleration of gravity, $\rho$ is the density, $c_p$ is the specific heat capacity, $\alpha$ is the thermal expansion coefficient and $Q$ is the heating rate per unit volume. We consider two separate configurations that differ in the choice of boundary conditions at the top ($z=1$) and bottom ($z=0$) of the domain. In the first configuration, referred to as IH1 and sketched in \cref{fig:config}\textit{(a)}, the velocity satisfies no-slip conditions and the temperature of both vertical boundaries is held at a constant value, which can be taken as zero without loss of generality. Hence, we enforce \begin{subequations} \begin{equation} \text{IH1:} \qquad \boldsymbol{u}\vert_{z\in\{0,1\}}=\boldsymbol{0}, \qquad T\vert_{z=0} = 0, \qquad T\vert_{z=1} = 0. \label{bc_T_IH1} \end{equation} In the second configuration, illustrated by \cref{fig:config}\textit{(b)}, the bottom plate is replaced by a perfect thermal insulator, giving \begin{equation} \text{IH3:} \qquad \boldsymbol{u}\vert_{z\in\{0,1\}}=\boldsymbol{0}, \qquad \partial_z T\vert_{z=0} =0, \qquad T\vert_{z=1} = 0. \label{bc_T_IH3} \end{equation} \end{subequations} We seek bounds on the mean vertical convective heat transport, \mbox{$\smash{\mean{wT}}$}, a quantity that is directly proportional to the viscous dissipation for both the IH1 and IH3 configurations. Throughout this paper overbars denote infinite time averages, while angled brackets denote volume averages: \begin{subequations} \begin{align} \volav{f} &= \frac{1}{L_x L_y} \int^{L_x}_0 \int^{L_y}_0 \int^{1}_{0} f(x,y,z,t) \textrm{d}z\, \textrm{d}y\, \textrm{d}x,\\ \mean{f} &= \limsup_{\tau\rightarrow \infty} \frac{1}{\tau} \int^{\tau}_{0} \volav{f} \textrm{d}t. \end{align} \end{subequations} For either set of boundary conditions considered in this paper, it is known that $0 \leq \mbox{$\smash{\mean{wT}}$} \leq \frac12$ uniformly in \Ra\ and \Pr~\cite{goluskin2012convection}. The zero lower bound is saturated by the (possibly unstable) state in which the flow does not move and heat is transported vertically by conduction alone. The upper bound of $\frac12$, instead, takes on a different meaning depending on the thermal boundary conditions. As will become apparent from \eqref{e:fluxes_ih1} below, for the IH1 configuration a flow with $\mbox{$\smash{\mean{wT}}$}=\frac12$ would see all heat escape the domain through the upper boundary. \begin{figure \centering \begin{tikzpicture}[every node/.style={scale=0.95}] \draw[black,thick] (-6,0) -- (-2,0) node [anchor=west] {$z=0$}; \draw[black,thick] (-6,1.8) -- (-2,1.8) node [anchor = west] {$z=1$}; \draw [dashed,colorbar10] plot [smooth, tension = 1] coordinates {(2.5,1.8) (3.4,1.25) (3.7,0)}; \draw [colorbar10] plot [smooth, tension =1] coordinates {(2.5,1.8) (2.9,1.7) (3.1,1.6)}; \draw [colorbar10] (3.1,1.6) -- (3.1,0); \node at (1.25,-0.25) {$ \partial_z T = 0 $}; \node at (1.25,2.025) {$ T = 0 $}; \node at (-4.75,0.9) { IH }; \draw[->,colorbar10] (-3.5,0) -- (-3.5,0.45) node [anchor = east]{$z$}; \draw [dotted,colorbar10] (2.5,0) -- (2.5,1.8); \draw[->,colorbar10] (-3.5,0) -- (-3,0) node [anchor=north]{$T$}; \draw[->] (-6.8,0) -- (-6.8,0.36) node [anchor=east]{$z$}; \draw[->] (-6.8,0) -- (-6.4,0) node [anchor=north]{$x$}; \draw[->] (-6.8,0) -- (-6.5,0.18) node [anchor=west]{$y$}; \draw[black,thick] (0,0) -- (4,0) node [anchor=west] {$z=0$}; \draw[black,thick] (0,1.8) -- (4,1.8) node [anchor = west] {$z=1$}; \node at (-4.75,-0.25) {$ T = 0 $}; \node at (-4.75,2.025) {$ T = 0 $}; \draw [dashed,colorbar10] plot [smooth, tension = 1] coordinates { (-3.5,1.8) (-2.5,0.9) (-3.5,0) }; \draw [colorbar10] plot [smooth,tension=1] coordinates {(-3.5,1.8) (-3.05,1.6) (-2.9,1.5)}; \draw [colorbar10] (-2.9,1.5) -- (-2.9,0.5); \draw [colorbar10] plot [smooth, tension =1] coordinates {(-2.9,0.5) (-3.05,0.35) (-3.5,0)}; \draw [dotted,colorbar10] (-3.5,0) -- (-3.5,1.8) ; \draw[->,colorbar10] (2.5,0) -- (2.5,0.45) node [anchor = east]{$z$}; \draw[->,colorbar10] (2.5,0) -- (3,0) node [anchor=north]{$T$}; \node at (1.25,0.9) {\textrm{IH}}; \node at (-6.4,1.8) {\textit{(a)}}; \node at (-0.4,1.8) {\textit{(b)}}; \end{tikzpicture} \caption{IH convection with \textit{(a)} isothermal boundaries \eqref{bc_T_IH1}, and \textit{(b)} insulating lower boundary \eqref{bc_T_IH3}. In both panels, IH represents the uniform unit internal heat generation. Red lines denote the conductive temperature profiles ({\color{colorbar10}\dashedrule}) and indicative mean temperature profiles in the turbulent regime ({\color{colorbar10}\solidrule}).} \label{fig:config} \end{figure} This, however, cannot be achieved at any finite value of \Ra. Precisely, our first main results reveal that the mean vertical heat flux \mbox{$\smash{\mean{wT}}$}\ is strictly smaller than $\frac12$ by an amount that cannot decrease faster than quadratically as \Ra\ is raised. \begin{theorem}[Isothermal boundaries, $\Pr=\infty$]\label{thm:ih1-main-result} Suppose that $\boldsymbol{u}=(u,v,w)$ and $T$ solve \eqref{e:governing-equations} subject to the no-slip isothermal boundary conditions \eqref{bc_T_IH1}. There exists a constant $c>0$ such that, for all sufficiently large $R>0$, \begin{equation}\label{e:thm1_b} \mean{wT} \leq\frac12 - c\,R^{-2}. \end{equation} \end{theorem}% \begin{remark}\label{rem:prefactors-ih1} It is shown in \cref{ss:proof-IH1} that \eqref{e:thm1_b} holds with $c = 216$ for any $R > 1892$. \end{remark} The bound on \mbox{$\smash{\mean{wT}}$}\ can be given a clear physical interpretation as a measure of the asymmetry of the heat transport due to heating. Indeed, upon computing $\mean{z\cdot \eqref{nondim_energy} }$ one can show that the average nondimensional heat fluxes through the top and bottom boundaries, denoted by $\mathcal{F}_T$ and $\mathcal{F}_B$ respectively, can be expressed as \begin{subequations}\label{e:fluxes_ih1} \begin{align} \label{e:top_flux_ih1} \mathcal{F}_T &:= -\partial_z\mean{T}_h\vert_{z=1} = \frac12 + \mean{wT} , \\ \label{e:bottom_flux_ih1} \mathcal{F}_B &:= \phantom{-}\partial_z\mean{T}_h\vert_{z=0} = \frac12 - \mean{wT} , \end{align} \end{subequations} where $\volav{\cdot}_h$ denotes a spatial average over the horizontal directions alone. Thus, our upper bound on \mbox{$\smash{\mean{wT}}$}\ immediately implies bounds on $\mathcal{F}_T$ and $\mathcal{F}_B$. \begin{corollary} For all sufficiently large $R$, \begin{equation}\label{e:main-result-ih1} \mathcal{F}_T \leq 1 - c\, R^{-2} \qquad \textrm{and} \qquad \mathcal{F}_B \geq c\, R^{-2} . \end{equation} \end{corollary} The results discussed so far apply to the IH1 configuration, where the two horizontal domain boundaries are isothermal. Similar results hold also for the IH3 case, where the bottom boundary is perfectly insulating. In this case, however, the deviation of \mbox{$\smash{\mean{wT}}$}\ from $\frac12$ may decay as fast as $\Ra^{-4}$ \begin{theorem}[Insulating bottom \& isothermal top, $\Pr=\infty$] Suppose that $\boldsymbol{u}=(u,v,w)$ and $T$ solve \eqref{e:governing-equations} subject to the boundary conditions \eqref{bc_T_IH3}. There exists a constant $c>0$ such that, for all sufficiently large $\Ra>0$, \begin{equation}\label{e:thm2_b} \mean{wT} \leq \frac12 - c \, \Ra^{-4}. \end{equation} \label{thm:ih3} \end{theorem}% \begin{remark}\label{rem:prefactors-ih3} It is shown in \cref{ss:bm-IH3} that \eqref{e:thm2_b} holds with $c \approx 0.0107$ for all $R > 2961$. \end{remark} Since the IH3 boundary conditions imply that the conductive heat flux is positive, the effects of convection on the enhancement of heat transport in the system can be described using a Nusselt number, $\Nu$. This is defined as the ratio of the mean total heat flux to the mean conductive heat flux, and can be expressed in terms of \mbox{$\smash{\mean{wT}}$}\ as \begin{equation} \Nu = \left( 1-2\mean{wT} \right)^{-1}. \label{e:Nu_ih3} \end{equation} Thus, our upper bound on \mbox{$\smash{\mean{wT}}$}\ can be transformed into an upper bound on \Nu. \begin{corollary} For all sufficiently large \Ra, $\Nu \leq c R^4$. \end{corollary} The proofs of \cref{thm:ih1-main-result,thm:ih3} rely on two key ingredients. The first is a variational problem giving an upper bound on \mbox{$\smash{\mean{wT}}$}. This variational problem is derived by enforcing a minimum principle for the fluid's temperature within the classical ``background method''~\cite{doering1996variational,doering1994variational,constantin1995variational}, which for simplicity we formulate using the language of a more general framework for bounding infinite-time averages~\cite{chernyshenko2014polynomial,Chernyshenko2022,tobasco2018optimal,rosa2020optimal} (see~\cite{Chernyshenko2022,Fantuzzi2022} for further discussion of the link between the two approaches). Using this minimum principle is essential to obtain bounds on \mbox{$\smash{\mean{wT}}$}\ that asymptote to $\frac12$ from below. This has already been shown for the IH1 configuration at finite \Pr: for this case, without the miniumum principle one obtains only $\mbox{$\smash{\mean{wT}}$} \lesssim R^{1/5}$~\cite{arslan2021IH1}, while with it one can prove that $\mbox{$\smash{\mean{wT}}$} \leq \frac12 - O(R^{1/5} \exp{(- R^{3/5})})$ uniformly in \Pr~\cite{kumar2021ihc}. A similar (but not identical) exponentially-varying bound of $\mbox{$\smash{\mean{wT}}$} \leq \frac12 - O(R^{-1/5} \exp{(- R^{3/5}))}$ uniformly in \Pr\ was also obtained for the IH3 configuration~\cite{kumar2021ihc}. The second key ingredient in our proofs are estimates of Hardy--Rellich type, obtained by observing that the reduced momentum equation \eqref{nondim_momentum} determines the vertical velocity field as a function of the temperature field. Specifically, taking the vertical component of the double curl of~\eqref{nondim_momentum} gives \begin{equation} \label{e:w_and_T_eq} \Delta^2 w = -R \, \Delta_h T, \end{equation} where $\Delta_h := \partial^2_x + \partial^2_y $, is the horizontal Laplacian. Using the no-slip boundary conditions with the incompressibility condition ~\eqref{continuit}, the vertical velocity $w$ satisfies \begin{equation}\label{e:w-bcs} w\vert_{z=0} = \partial_z w\vert_{z=0} = w\vert_{z=1} = \partial_z w\vert_{z=1} = 0. \end{equation} Equation \eqref{e:w_and_T_eq} was exploited in Rayleigh-B\'enard convection to improve the scaling of upper bounds on \Nu~\cite{doering2006bounds}. This was achieved by using \eqref{e:w_and_T_eq} to derive inequalities of the Hardy--Rellich type (see \cref{lemma:doering_estimate} below) that help the construction of a background field with a logarithmically-varying stable stratification in the bulk~\cite{doering2006bounds,Whitehead2014mixed}. Here, we use the same inequalities to construct (different) background fields suited to IH convection, which will enable us to bound \mbox{$\smash{\mean{wT}}$}\ in the infinite \Pr\ limit. \section{Bounds for the IH1 configuration}\label{sec:IH1} We first consider the IH1 configuration, where the top and bottom plate are held at zero temperature. In \cref{ss:bm-IH1}, we show that $\smash{\mean{wT}}$ can be bounded from above by constructing suitably constrained functions of the vertical coordinate $z$. \Cref{ss:ansatz-IH1} describes parametric ans\"atze for such functions, while \cref{ss:lemmas-IH1} establishes auxiliary results that simplify the verification of the constraints and the evaluation of the bound. We then prove~\cref{thm:ih1-main-result} in \cref{ss:proof-IH1} by prescribing \Ra-dependent values of the free parameters in our ans\"atze. To simplify the notation, we introduce two sets of temperature fields that encode the thermal boundary conditions and the pointwise nonnegativity constraint implied by the minimum principle: \begin{subequations} \begin{gather} \label{e:T-space-ih1} \mathcal{H}_{n} := \{T \in H^1(\Omega):\; T \text{ is horizontally periodic \& \eqref{bc_T_IH1}} \veebar \eqref{bc_T_IH3} \},\\ \mathcal{H}_+ := \{ T \in \mathcal{H}_n: T(\boldsymbol{x}) \geq 0 \text{ a.e. } \boldsymbol{x} \in \Omega \}, \label{e:T-positive-cone-ih1} \end{gather} \end{subequations} where $n =$ 1 or 3, depending on the boundary conditions of IH1 and IH3 respectively. In \cref{sec:IH1}, $T$ belongs to $\mathcal{H}_{1}$. \subsection{Bounding framework}\label{ss:bm-IH1} To bound $\smash{\mean{wT}}$ we employ the auxiliary function method~\cite{chernyshenko2014polynomial,Fantuzzi2022}. The method relies on the observation that the time derivative of any bounded functional $\mathcal{V}\{T(t)\}$ along solutions of the Boussinesq equations~\eqref{e:governing-equations} averages to zero over infinite time, so \begin{equation}\label{e:af-method} \mean{wT} = \timeav{\volav{wT} + \tfrac{\rm d}{ {\rm d} t}\mathcal{V}\{T(t)\} }. \end{equation} If $\mathcal{V}$ is chosen such that the quantity being averaged on the right-hand side is bounded above pointwise in time, then this pointwise bound is also an upper bound on $\smash{\mean{wT}}$. Following analysis at finite Prandtl number~\cite{arslan2021IH1}, we restrict our attention to quadratic functionals taking the form \begin{equation}\label{e:V-IH1} \mathcal{V}\{T\} = \volav{ \tfrac{\bp}{2} \abs{T}^2 - [\bfield(z)+z-1] T }, \end{equation} which are parametrized by a positive constant $\bp \in \mathbb{R}_+$ and a piecewise-differentiable function $\bfield:[0,1] \to \mathbb{R}$ with square-integrable derivative. We require $\bfield$ to satisfy \begin{equation}\label{e:psi-bc-ih1} \bfield(0)=1, \qquad \bfield(1)=0, \end{equation} so the coefficient multiplying $T$ in~\eqref{e:V-IH1} vanishes at $z=0$ and $z=1$. This choice enables us to integrate by parts without picking up boundary terms when calculating $\tfrac{\rm d}{ {\rm d} t}\mathcal{V}\{T(t)\}$. To ensure that the resulting expression $\volav{wT} + \tfrac{\rm d}{ {\rm d} t}\mathcal{V}\{T\}$ can be bounded from above poinwise in time, we also require that the pair $(\bp,\bfield)$ satisfies a condition called the \emph{spectral constraint}. \begin{definition}[Spectral constraint]\label{def:sc} The pair $(\bp,\bfield)$ is said to satisfy the \emph{spectral constraint} if \begin{equation}\label{e:sc} \volav{\bp \abs{\nabla T}^2 + \bfield' wT } \geq 0 \qquad T \in \mathcal{H}_n, \end{equation} where $w = -R \Delta^{-2} \Delta_h T$ solves~\eqref{e:w_and_T_eq} with the boundary conditions~\cref{e:w-bcs}. \end{definition} If the spectral constraint is satisfied, then it is possible to bound $\smash{\mean{wT}}$ from above in terms of $\bfield$, $\bp$, and another suitably constrained function $\lm:[0,1]\to \mathbb{R}$. \begin{proposition}[Bounding framework, IH1]\label{th:ih1-bounding-problem} Suppose that the pair $(\bp,\bfield)$ satisfies the spectral constraint and the boundary conditions in~\eqref{e:psi-bc-ih1}. Further, let $\lm \in L^2(0,1)$ be a nondecreasing function such that $\volav{\lm} = -1$. Then, \begin{equation*} \mean{wT} \leq \tfrac12 + \volav{ \tfrac{1}{4\bp} \abs{ \bfield' - \lm - \bp \left(z - \tfrac{1}{2}\right) }^2 - \bfield } =: U(\bfield,\lm,\bp) \end{equation*} \end{proposition} \begin{proof} A standard calculation using integration by parts, the incompressibility condition~\eqref{continuit}, and the boundary conditions on $\boldsymbol{u}$ and $T$ yields % \begin{align} \mean{wT} &= \timeav{ \volav{wT} + \tfrac{\rm d}{ {\rm d} t}\mathcal{V}\{T(t)\} } \nonumber\\[0.5ex] &= \tfrac12 +\mean{ -\bp \abs{\nabla T}^2 - \bfield' wT + (\bfield' - \bp z) \partial_z T - \bfield }. \end{align} % The infinite-time average on the right-hand side is bounded above by the largest value of the argument over the global attractor of the infinite-Prandtl-number Boussinesq equations~\eqref{e:governing-equations}. The minimum principle for the temperature field implies that the global attractor is contained in the set $\mathcal{H}_+$ defined in~\eqref{e:T-positive-cone-ih1}. Consequently, we can estimate % \begin{equation}\label{e:primal-form-ih1} \mean{wT} \leq \tfrac12 + \sup_{\substack{T \in \mathcal{H}_+ \\ w = -R\Delta^{-2}\Delta_h T}} \volav{ -\bp \abs{\nabla T}^2 - \bfield' wT + (\bfield' - \bp z) \partial_z T - \bfield }. \end{equation} % This upper bound is finite if and only if unless the pair $(\bp,\bfield)$ satisfies the spectral constraint (cf. \cref{def:sc}), in which case the supremum over $T$ can be evaluated using a technical convex duality argument detailed in \cref{ss:duality-ih1}. The result of the argument is that the bound in~\cref{e:primal-form-ih1} is equivalent to \begin{equation}\label{e:dual-form-ih1} \mean{wT} \leq \tfrac12 + \inf_{ \substack{\lm \in L^2(0,1) \\ \lm \text{ \rm nondecreasing} \\ \langle \lm \rangle = -1}} \volav{ \tfrac{1}{4\bp} \abs{ \bfield' - \lm - \bp \left(z - \tfrac{1}{2}\right) }^2 - \bfield }. \end{equation} % This inequality clearly implies the upper bound on $\smash{\mean{wT}}$ stated in the proposition, which is therefore proven. \end{proof} \begin{remark} The function $\lm$ that arises when deriving~\cref{e:dual-form-ih1} from~\cref{e:primal-form-ih1} can be viewed as a Lagrange multiplier enforcing the pointwise nonnegativity of temperature fields in the set $\mathcal{H}_+$. Further details regarding this interpretation (with slightly different notation) are given in~\cite[\S4.4]{arslan2021IH1}. \end{remark} \begin{remark} The best upper bound on $\smash{\mean{wT}}$ provable with our approach is found upon minimizing the expression $U(\bfield,\lm,\bp)$ over all choices of $\bfield$, $\lm$ and $\bp$ that satisfy the conditions of \cref{th:ih1-bounding-problem}. This is hard to do analytically, but can be done computationally using a variety of numerical schemes (see~\cite{Fantuzzi2022} and references therein). We leave such computations to future work and focus on proving \cref{thm:ih1-main-result} by constructing suboptimal $\bfield$, $\lm$ and $\bp$ analytically. \end{remark} \subsection{Ans\"atze}\label{ss:ansatz-IH1} To prove the upper bound on \mbox{$\smash{\mean{wT}}$}, we seek $\bp>0$, $\bfield(z)$, and $\lm(z)$ that satisfy the conditions of \cref{th:ih1-bounding-problem} and make the quantity $U(\bp,\bfield,\lm)$ as small as possible. To simplify this task, we restrict $\bfield$ to take the form \begin{equation} \label{e:psi} \bfield(z):= \begin{dcases} 1-\frac{z}{\delta} ,& 0\leq z \leq \delta\\ A\, \ln\!{\left(\frac{z (1-\delta)}{\delta (1-z)} \right)}, & \delta \leq z \leq 1-\varepsilon \\ A\, \ln\!\left(\frac{(1-\varepsilon)(1-\delta)}{\varepsilon\delta}\right) \, \left(\frac{1-z}{\varepsilon}\right), & 1-\varepsilon \leq z \leq 1 \end{dcases} \end{equation} and $\lm$ to be given by \begin{equation} \label{e:q_profile} \lm(z):= \begin{dcases} -\frac{1}{\delta} ,& 0\leq z \leq \delta,\\ 0, & \delta \leq z \leq 1. \end{dcases} \end{equation} These piecewise-defined functions, sketched in \cref{fig:psi_log_inf_pr}, are fully specified by the bottom boundary layer width $\delta \in (0,\frac12)$, the top boundary layer width $\varepsilon \in (0,\frac12)$, and the parameter $A > 0$ that determines the amplitude of $\bfield$ in the bulk of the layer. \begin{figure \centering \input{./figs/tex/ih1-profiles-v2} \caption{Sketches of the functions $\bfield(z)$ in~\eqref{e:psi} and $\lm(z)$ in~\eqref{e:q_profile} used to prove \cref{thm:ih1-main-result}.} \label{fig:psi_log_inf_pr} \end{figure} We also fix \begin{equation}\label{e:b-choice-ih1} \bp := {\volav{|\bfield'- \lm|^2}^{\frac12}}{\volav{|z - \tfrac12|^2}^{-\frac12}} = 2\sqrt{3} \volav{|\bfield'- \lm|^2}^{\frac12}. \end{equation} This choice is motivated by the desire to minimize the right-hand side of the inequality \begin{equation} \frac{1}{4\bp} \volav{ | \bfield' - \lm - \bp \left(z - \tfrac{1}{2}\right) |^2 } \leq \frac{\bp}{2} \volav{|z - \tfrac{1}{2}|^2 } + \frac{1}{2\bp} \volav{ |\bfield'- \lm|^2 }, \label{e:inequality_2norm_ih1} \end{equation} which is used later in \cref{th:ih1-U-bounds} by estimating from above the value of the bound $U(\bp,\bfield,\lm)$ for our choices of $\bfield$ and $\lm$. For any choice of the parameters $\delta$, $\varepsilon$, and $A$, the function $\bfield$ satisfies the boundary conditions in~\eqref{e:psi-bc-ih1}, while $\lm$ is nondecreasing and satisfies the normalization condition $\volav{\lm} = -1$. To establish~\cref{thm:ih1-main-result} using \cref{th:ih1-bounding-problem}, we only need to specify parameter values such that $U(\bp,\bfield,\lm) \leq \frac12 - O(\Ra^{-2})$ while ensuring that the pair $(\bp,\bfield)$ satisfies the spectral constraint. For the purposes of simplifying the algebra in what follows, we shall fix \begin{equation}\label{e:A-choice} A(\delta) = \frac{3\sqrt{15}}{20} \delta^{\frac32} \end{equation} from the outset. As explained in \cref{remark:ih1-A-value} below, this choice arises when insisting that the upper estimate on $U(\bp,\bfield,\lm)$ derived in \cref{th:ih1-U-bounds} be strictly less than $\frac12$ for some values of $\delta$ and $\varepsilon$, at least when all other constraints on these parameters are ignored. \subsection{Preliminary estimates}\label{ss:lemmas-IH1} We now derive a series of auxiliary results that make it simpler to specify the boundary layer widths $\delta$ and $\varepsilon$. The first result gives estimates on the value of $\bp$ in~\eqref{e:b-choice-ih1}. \begin{lemma}[Estimates on $\bp$]\label{th:ih1-b-bounds} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be given by~\eqref{e:psi}, \eqref{e:q_profile}, and~\eqref{e:b-choice-ih1} with $A$ specified by~\eqref{e:A-choice}. Suppose that the boundary layer widths $\delta$ and $\varepsilon$ satisfy \begin{subequations} \begin{equation} \delta \leq \frac16, \qquad \varepsilon \leq \frac13, \qquad \delta \ln^{2}{\left(\frac{1}{\delta^2}\right)} \leq \varepsilon. \tag{\theequation a,b,c} \end{equation} \label{e:eps_constraint_lemma} \end{subequations} % Then, \begin{equation} \frac{9}{2\sqrt{5}} \delta \leq \bp \leq \frac{9}{2} \delta. \label{e:b_upper_lower} \end{equation} \end{lemma} \begin{remark} Condition~\subeqref{e:eps_constraint_lemma}{c} is key to prove the auxiliary results of this section. The other two restrictions, instead, are introduced to more easily keep track of constants in our estimates, which is necessary to obtain an explicit prefactor for the $O(\Ra^{-2})$ term. We have not attempted to optimize this prefactor. \end{remark} \begin{remark}\label{r:delta_less_eps} Condition~\subeqref{e:eps_constraint_lemma}{c} implies that $\delta \leq \varepsilon$. We will use this fact often in the proofs of this section. \end{remark} \begin{proof}[Proof of \cref{th:ih1-b-bounds}] It suffices to estimate $\volav{ |\bfield' - \lm|^2 }^{\frac12}$ from above and below. For a lower bound, substitute our choices for $\bfield$ and $\lm$ to estimate % \begin{equation*} \volav{ |\bfield' - \lm|^2} = \int^{1}_{\delta}|\bfield'(z)|^2 \,{\rm d}z \geq \int^{1-\varepsilon}_{\delta} |\bfield'(z)|^2 \,{\rm d}z = A^2 \int^{1-\varepsilon}_{\delta} \left|\frac{1}{z} + \frac{1}{1-z}\right|^2 \,{\rm d}z. \end{equation*} Expanding the square, dropping the nonnegative term $\smash{\frac{2}{z(1-z)}}$, and recalling that $\varepsilon\leq \frac13$ and $\delta\leq \frac16 < \frac13$ by assumption, we can further estimate \begin{eqnarray} \volav{ |\bfield' - \lm|^2} \geq A^2\left( \int^{2/3}_{\delta} \frac{1}{z^2} \,{\rm d}z + \int^{2/3}_{1/3} \frac{1}{(1-z)^2} \,{\rm d}z \right) = \frac{A^2}{\delta}. \label{e:lower_bound_L2_ih1} \end{eqnarray} Taking the square root of both sides and substituting for the value of $A$ from \eqref{e:A-choice} gives $\smash{\volav{|\bfield' - \lm|^2}^{1/2}} \geq (3\sqrt{15}/20)\,\delta$, which combined with \eqref{e:b-choice-ih1} proves the lower bound on $\bp$ stated in~\eqref{e:b_upper_lower}. For the upper bound on $\bp$, recall that condition~\subeqref{e:eps_constraint_lemma}{c} implies $\delta \leq \varepsilon$, so $1-\varepsilon\leq 1-\delta\leq1$. Then, \begin{eqnarray*} \frac{\volav{ |\bfield'- \lm|^2 }}{A^2} &=& \int^{1-\varepsilon}_{\delta} \left| \frac{1}{z} + \frac{1}{1-z} \right|^2 \textrm{d}z + \frac{1}{\varepsilon} \ln^{2}{\left(\frac{(1-\varepsilon)(1-\delta)}{\varepsilon\delta} \right)} \nonumber \\ &\leq& \int^{1-\delta}_{\delta} \left| \frac{1}{z} + \frac{1}{1-z} \right|^2 \textrm{d}z + \frac{1}{\varepsilon} \ln^{2}\left(\frac{1}{\delta^2} \right). \end{eqnarray*} % Using the inequality $(a+b)^2 \leq 2a^2 + 2b^2$ we can further estimate \begin{eqnarray*} \frac{\volav{ |\bfield'- \lm|^2 } }{A^2} &\leq& 2 \left(\int^{1-\delta}_{\delta} \frac{1}{z^2} \, {\rm d}z + \int^{1-\delta}_{\delta} \frac{1}{(1-z)^2} \,{\rm d}z \right) + \frac{1}{\varepsilon} \ln^{2}\left(\frac{1}{\delta^2} \right) \nonumber \\ &=& \frac{4}{\delta}\left(\frac{1-2\delta}{1-\delta} \right) + \frac{1}{\varepsilon} \ln^{2}\left(\frac{1}{\delta^2} \right). \end{eqnarray*} Finally, we observe that $\frac{1-2\delta}{1-\delta} \leq 1$ for all $\delta\geq0$ and apply \subeqref{e:eps_constraint_lemma}{c} to arrive at \begin{equation}\label{e:bf-lm-upper-bound} \volav{ |\bfield'- \lm|^2 } \leq \frac{5A^2}{\delta}. \end{equation} Substituting our choice of $A$ from~\eqref{e:A-choice} and taking a square root gives $\smash{\smallvolav{|\bfield' - \lm|^2}^{1/2}} \leq (3\sqrt{3}/4) \delta$, which combined with \eqref{e:b-choice-ih1} yields the upper bound on $\bp$ in~\eqref{e:b_upper_lower}. \end{proof} Our second auxiliary result estimates the upper bound $U(\bp,\bfield,\lm)$ on \mbox{$\smash{\mean{wT}}$}\ from \cref{th:ih1-bounding-problem} in terms of the bottom boundary layer width $\delta$ alone. \begin{lemma}[Estimates on $U(\bp,\bfield,\lm)$]\label{th:ih1-U-bounds} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be given by~\eqref{e:psi}, \eqref{e:q_profile}, and~\eqref{e:b-choice-ih1} with $A$ specified by~\eqref{e:A-choice}. Suppose the boundary layer widths $\delta$ and $\varepsilon$ satisfy the conditions of \cref{th:ih1-b-bounds}. Then, \begin{equation} U(\bp,\bfield,\lm) \leq \frac12 - \frac{\delta}{8}. \label{e:bound_eq} \end{equation} \end{lemma} \begin{proof} Using inequality \eqref{e:inequality_2norm_ih1}, our choice of $\bp$ from \eqref{e:b-choice-ih1}, and the upper bound on $\smallvolav{ |\bfield' - \lm|^2}$ from~\eqref{e:bf-lm-upper-bound} yields % \begin{align*} U(\bp,\bfield,\lm) \leq \frac12 + \frac{\sqrt{3}}{6} \, \volav{ |\bfield' - \lm|^2}^{\frac12} - \volav{\tau} \leq \frac12 + \frac{\sqrt{15}A}{6} \,\delta^{-\frac12} - \volav{\tau}. \end{align*} Moreover, since we have chosen $\bfield$ to be a non-negative function we can estimate $\volav{\tau} = \int_0^1 \tau(z) \,{\rm d}z \geq \int_0^\delta \tau(z) \,{\rm d}z = \frac{1}{2} \delta$ % to obtain \begin{equation}\label{e:ih1-U-estimate-with-A} U(\bp,\bfield,\lm) \leq \frac12 + \frac{\sqrt{15}A}{6}\,\delta^{-\frac12} - \frac{1}{2} \delta. \end{equation} Substituting our choice of $A$ from~\eqref{e:A-choice} into this inequality gives~\eqref{e:bound_eq}. \end{proof} \begin{remark}\label{remark:ih1-A-value} The right-hand side of~\eqref{e:ih1-U-estimate-with-A} can be strictly smaller than $\frac12$ only if $A \lesssim \delta^{3/2}$. It is this observation that dictates the choice of $A$ in~\eqref{e:A-choice}. For any fixed value of $R$, one should choose $A \sim \delta^{3/2}$ with a (possibly $R$-dependent) prefactor that optimises the balance between the positive and negative terms, subject to constraints on $A$, $\delta$ and all other parameters that ensure the spectral constraint. To simplify our proof, however, we choose to fix this prefactor \textit{a priori} irrespective of $R$. \end{remark} Our final auxiliary result gives sufficient conditions on $\delta$ and $\varepsilon$ that ensure the spectral constraint (cf. \cref{def:sc}) is satisfied. \begin{lemma}[Sufficient conditions for the spectral constraint]\label{th:ih1-sc} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be given by~\eqref{e:psi}, \eqref{e:q_profile}, and~\eqref{e:b-choice-ih1} with $A$ specified by~\eqref{e:A-choice}. Suppose the boundary layer widths $\delta$ and $\varepsilon$ satisfy the conditions of \cref{th:ih1-b-bounds}. Suppose further that % \begin{subequations} \begin{equation} \delta \leq (24\sqrt{3})^2\, R^{-2} \qquad\text{and}\qquad \varepsilon^3 \delta^\frac12 \, \ln^2\!\left(\frac{1}{\delta^{2}}\right) \leq 8\sqrt{3} R^{-1}. \tag{\theequation a,b} \end{equation} \label{e:delta_eps_cons} \end{subequations} % Then, the pair $(\bp,\bfield)$ satisfies the spectral constraint. \end{lemma} The proof of this result relies on Hardy--Rellich inequalities established in Ref.~\cite{whitehead2011internal}, which extract a positive term from the \textit{a priori} indefinite term $\smallvolav{\bfield' w T}$. \begin{lemma}[Hardy--Rellich inequalities~\cite{whitehead2011internal}]\label{lemma:doering_estimate} Let $T,w:\Omega \to \mathbb{R}$ be horizontally periodic functions such that $\Delta^2 w = -R \Delta_h T$ subject to velocity boundary conditions~\eqref{e:w-bcs}. Then, \begin{subequations}\label{doering_estimate} \begin{align} \volav{\frac{w T}{z}} &\geq \frac{4}{R} \volav{\frac{w^2}{z^3}} &\text{and}&& \volav{\frac{w T}{1-z}} &\geq \frac{4}{R} \volav{\frac{w^2}{(1-z)^3}}. \tag{\theequation a,b} \end{align} \end{subequations} \end{lemma} \begin{proof}[Proof of \cref{th:ih1-sc}] Let $\mathbbm{1}_{(a,b)}$ denote the indicator function of the interval $(a,b)$. Define the functions \begin{subequations} \begin{gather} \label{e:ih1-f} f(z):= \left[ \frac{1}{\delta}+\frac{A}{z(1-z)} \right] \mathbbm{1}_{(0,\delta)}(z),\\ g(z):= \left[ \frac{1}{\varepsilon} \ln\!{\left(\frac{(1-\varepsilon)(1-\delta)}{\varepsilon\delta} \right)} +\frac{1}{z(1-z)} \right]\mathbbm{1}_{(1-\varepsilon,1)}(z). \end{gather} \end{subequations} Given our choice of $\bfield$ from~\eqref{e:psi}, we can rewrite the spectral constraint as % \begin{equation*} 0 \leq\volav{ \bp|\nabla T|^2 + \bfield' w T } = \mathcal{F}\{T\} + \mathcal{G}\{T\}, \end{equation*} where \begin{subequations} \begin{gather} \mathcal{F}\{T\} := \frac{\bp}{2} \volav{ |\nabla T|^2 } + A \volav{ \frac{wT}{z} } - \volav{ f(z) wT }, \\ \mathcal{G}\{T\} := \frac{\bp}{2} \volav{ |\nabla T|^2 } + A \volav{ \frac{wT}{1-z} } - A \volav{g(z) wT }. \end{gather} \end{subequations} % Here, $w$ is determined as a function of $T$ by solving~\eqref{e:w_and_T_eq} subject to the boundary conditions in~\eqref{e:w-bcs}. We shall prove that $\mathcal{F}$ and $\mathcal{G}$ are individually non-negative. First, let us consider $\mathcal{F}$. The Hardy--Rellich inequality~\subeqref{doering_estimate}{a} gives \begin{equation}\label{e:ih1-B-estimate} \mathcal{F}\{T\} \geq \frac{\bp}{2} \volav{ |\nabla T|^2} + \frac{4 A}{R} \volav{\frac{w^2}{z^3}} - \volav{ f(z) wT } . \end{equation} % Next, we estimate $\smallvolav{ f(z) wT }$. Since $T$ vanishes at $z=0$ by virtue of the thermal boundary conditions in~\eqref{bc_T_IH1}, we can use the fundamental theorem of calculus and the Cauchy-Schwarz inequality to estimate $|T(\cdot,z)|\leq\smash{\sqrt{z}(\int^{1}_{0}|\nabla T|^2 \textrm{d}z )^{1/2}}$. Squaring both sides and taking the horizontal average of which gives $\volav{T^2}_h \leq z \volav{|\nabla T|^2}$. Then, use of the Cauchy--Schwarz inequality, substitution for $\volav{T^2}_h$ and Youngs inequality gives \begin{align*} \volav{ f(z) wT } \leq \int^{1}_{0} |f(z)| \volav{|wT|}_h \textrm{d}z &\leq \int^{1}_0 |f(z)| \volav{w^2}^{1/2}_h \volav{T^2}^{1/2}_h \textrm{d}z \nonumber \\ &\leq \volav{|\nabla T|^2}^{\frac12}\int^{1}_{0} f(z) z^2 \volav{\frac{w^2}{z^{3}}}^{\frac12}_h \textrm{d}z \nonumber \\ &\leq \volav{|\nabla T|^2}^{\frac12} \volav{ f(z)^2 z^{4} }^{\frac12} \volav{\frac{w^2}{z^3} }^{\frac12}\nonumber\\ &\leq \frac{\bp}{2} \volav{|\nabla T|^2 } + \frac{1}{2\bp} \volav{ f(z)^2 z^{4}} \volav{\frac{w^2}{z^3} } . \end{align*} % Upon using the lower bound on $\bp$ from \eqref{e:b_upper_lower} to estimate the last term from above we obtain % \begin{equation} \volav{ f(z) wT } \leq \frac{\bp}{2} \volav{|\nabla T|^2 } + \frac{\sqrt{5}}{9\delta} \volav{ f(z)^2 z^{4}} \volav{\frac{w^2}{z^3} } . \end{equation} This can be substituted into~\eqref{e:ih1-B-estimate} along with our choice of $A$ from~\eqref{e:A-choice} to find % \begin{equation} \mathcal{F}\{T\} \geq \frac{\sqrt{5}}{9}\delta^{\frac32}\left( \frac{27\sqrt{3}}{5 R} \, - \frac{\volav{ f(z)^2 z^{4}}}{\delta^{\frac52}}\right) \volav{ \frac{w^2}{z^3} }. \end{equation} % To conclude, we show that the term in parentheses is nonnegative when $\delta$ satisfies $\delta \leq \frac16$ and~\subeqref{e:delta_eps_cons}{a}. To do this, we observe that the function $f(z)$ in~\eqref{e:ih1-f} is nonnegative function and that it is nonzero only if $z \leq \delta$. We can therefore bound it from above on the interval $(0,\delta)$ using the estimates $\frac{1}{1-z} \leq \frac{1}{1-\delta} \leq \frac65$ and, consequently, obtain \begin{equation*} \frac{\volav{ f(z)^2 z^{4}}}{\delta^{\frac52}} \leq \frac{1}{\delta^{\frac52}}\int^{\delta}_{0} \left(\frac{1}{\delta} + \frac{6A}{5z} \right)^2 z^4 \, {\rm d}z = \bigg(\frac15 + \frac{9\sqrt{15}}{100} \delta^{\frac32} + \frac{81}{500} \delta^3\bigg) \delta^\frac12. \end{equation*} Using the assumption that $\delta \leq \frac16$ to estimate the expression in parentheses by its value at $\delta=\frac16$, followed by an application of assumption~\subeqref{e:delta_eps_cons}{a} to estimate the remaining $\delta^{1/2}$ term in terms of $\Ra$ we arrive at the desired inequality % \begin{equation*} \frac{\volav{ f(z)^2 z^{4}}}{\delta^{\frac52}} \leq \frac{9\delta^\frac12}{40} \leq \frac{27\sqrt{3}}{5 \Ra}. \end{equation*} % Analogous arguments show that $\mathcal{G}\{T\}$ is nonnegative. Using the Hardy--Rellich inequality~\subeqref{doering_estimate}{b} we have \begin{equation}\label{e:ih1-T-estimate} \mathcal{G}\{T\} \geq \frac{\bp}{2} \volav{ |\nabla T|^2 } + \frac{4 A}{R} \volav{ \frac{|w|^2}{(1-z)^3} } - A \volav{ g(z) wT } . \end{equation} To estimate the last term, we use (in order) the inequality $\volav{T^2}_h\leq \smash{(1-z)\volav{ |\nabla T|^2} }$, the Cauchy--Schwarz inequality, and Young's inequality: \begin{align*} \volav{g(z) w T} \leq \int^{1}_{0} |g(z)| \volav{|wT|}_h \textrm{d}z &\leq \int^{1}_{0} |g(z)| \volav{w^2}^{1/2}_h \volav{T^2}^{1/2}_h \textrm{d}z \nonumber \\ &\leq \volav{|\nabla T |^2}^{\frac12} \int^{1}_{0} g(z)(1-z)^2 \volav{\frac{w^2}{(1-z)^{3}} }_{h}^{\frac12} \textrm{d}z \nonumber \\ &\leq \volav{|\nabla T|^2}^{\frac12} \volav{ g(z)^2(1-z)^4 }^{\frac12} \volav{ \frac{w^2}{(1-z)^3}}^{\frac12} \nonumber \\ &\leq \frac{\bp}{2A} \volav{ |\nabla T|^2} + \frac{A}{2\bp} \volav{ g(z)^2 (1-z)^4 } \volav{ \frac{w^2}{(1-z)^3} } . \end{align*} Using the lower bound on $\bp$ from \eqref{e:b_upper_lower} gives \begin{equation} \volav{g(z) w T} \leq \frac{\bp}{2A} \volav{ |\nabla T|^2} + \frac{\sqrt{5}A}{9 \delta} \volav{ g(z)^2 (1-z)^4 } \volav{ \frac{w^2}{(1-z)^3} }, \end{equation} which can be substituted into \eqref{e:ih1-T-estimate} along with the value of $A$ from~\eqref{e:A-choice} to obtain \begin{equation} \mathcal{G}\{T\} \geq \frac{3 \delta^\frac32}{16 \sqrt{5}} \left( \frac{16\sqrt{3}}{\Ra} - \delta^{\frac12} \volav{ g(z)^2 (1-z)^4 } \right)\volav{ \frac{w^2}{(1-z)^3} }. \label{e:T_1} \end{equation} % To conclude the argument we show that the term in parentheses is non-negative. To demonstrate this, we first estimate $g(z)$ on the interval $(1-\varepsilon,1)$ from above using the assumption that $\varepsilon\leq \frac13$, so $\frac23\leq z \leq1$ and $\frac{1}{z(1-z)} \leq \frac{3}{2(1-z)}$. Thus, % \begin{equation*} g(z) \leq \frac{1}{\varepsilon} \ln{\left(\frac{1}{\delta^{2}}\right)} + \frac{3}{2(1-z)} \qquad \forall z \in (1-\varepsilon,1). \end{equation*} Then, we use the assumptions $\delta\leq\frac16$ and $\delta\leq \varepsilon$ (cf. \cref{r:delta_less_eps}) to observe that $\ln{(\frac{1}{\varepsilon\delta})} \leq \ln{(\frac{1}{\delta^2})}\leq \ln^{2}{(\frac{1}{\delta^2})} $ and $\frac34 \leq \frac34 \ln^{2}{(\frac{1}{\delta^2})}$. Combining these estimates with the upper bound on $g$ derived above gives \begin{align*} \delta^{\frac12} \volav{ g(z)^2 (1-z)^4 } &\leq \delta^{\frac12}\int^{1}_{1-\varepsilon} \left( \frac{1}{\varepsilon} \ln{\left(\frac{1}{\delta^{2}}\right)} + \frac{3}{2(1-z)} \right)^2 (1-z)^4 \, \textrm{d}z \nonumber \\ & = \delta^{\frac12}\varepsilon^3 \left( \frac15 \ln^{2}{\left(\frac{1}{\delta^2}\right) } + \frac34\ln{\left(\frac{1}{\delta^{2}}\right)} + \frac34 \right) \nonumber\\ & \leq 2\delta^{\frac12} \varepsilon^3 \ln^{2}{\left( \frac{1}{\delta^{2}} \right)} \nonumber \\ (\text{\textrm{by} \subeqref{e:delta_eps_cons}{b}}) \qquad & \leq \frac{16\sqrt{3}}{R}, \end{align*} as desired. This concludes the proof of \cref{th:ih1-sc}. \end{proof} \subsection{Proof of \texorpdfstring{ \cref{thm:ih1-main-result}}{Theorem 1} } \label{ss:proof-IH1} It is now straightforward to prove the upper bound on \mbox{$\smash{\mean{wT}}$}\ by specifying boundary layer widths $\delta$ and $\varepsilon$ that satisfy the conditions of \cref{th:ih1-b-bounds,,th:ih1-U-bounds,,th:ih1-sc}. \begin{figure} \centering \includegraphics[scale=1]{figs/ih1_valid_ranges.eps} \caption{Variation with \Ra\ of the allowed values for the bottom boundary layer width $\varepsilon$ (shaded region), determined by condition~\subeqref{e:eps_constraint_lemma}{c} in \cref{th:ih1-b-bounds} and condition~\subeqref{e:delta_eps_cons}{b} in~\cref{th:ih1-sc} when the bottom boundary layer width $\delta$ ({\color{matlabblue}\solidrule}) is chosen as in~\eqref{e:choice_vars_final}. Also shown are the uniform upper bounds $\delta\leq \frac16$ ({\color{matlabblue}\dottedrule}) and $\varepsilon\leq\frac13$ ({\color{matlabred}\dottedrule}) imposed on these variables. A black vertical line marks the Rayleigh number $\Ra_0 \simeq 1891.35$ above which all constraints on $\delta$ and $\varepsilon$ are satisfied. } \label{fig:ih1_conditions} \end{figure} Since the estimate for the resulting upper bound obtained in \cref{th:ih1-U-bounds} is minimized when $\delta$ is as large as possible, we choose the largest value consistent with \subeqref{e:delta_eps_cons}{a}, \begin{equation} \label{e:choice_vars_final} \delta = (24\sqrt{3})^2\, R^{-2}. \end{equation} With this choice of $\delta$, conditions~\subeqref{e:eps_constraint_lemma}{c} and~\subeqref{e:delta_eps_cons}{b} require $\varepsilon$ to satisfy % \begin{equation} \frac{27\,648}{R^{2}}\,\ln^2{\left(\frac{R}{24\sqrt{3}} \right)} \leq \varepsilon \leq \left(\frac{1}{48}\right)^{\frac13} \ln^{-\frac23}{\left(\frac{R}{24\sqrt{3}} \right)}, \label{e:eps_range} \end{equation} which is possible for $\Ra>\Ra_0 \simeq 1891.35$ (cf. \cref{fig:ih1_conditions}). For $\Ra > \Ra_0$, any choice of $\varepsilon$ in this range is feasible. The optimal value could be determined at the expense of more complicated algebra either by optimizing the full bound $U(\bp,\bfield,\lm)$, or by deriving better $\varepsilon$-dependent estimates for it. However, we expect that any $\varepsilon$-dependent terms will contribute only higher-order corrections to our bound on $\mean{wT}$. To conclude the proof of \cref{thm:ih1-main-result}, there remains to verify that our choice of $\delta$ is no larger than $\frac16$ and that any $\varepsilon$ satisfying~\eqref{e:eps_range} is no larger than $\frac13$. It is easily checked that both conditions hold when $\Ra \geq \Ra_0$ (see \cref{fig:ih1_conditions} for an illustration). For all such values of $R$, therefore, \cref{th:ih1-U-bounds} and our choice of $\delta$ yield the upper bound $\mean{wT} \leq U(\bp,\bfield,\lm) \leq \frac12 - cR^{-2}$ with $c = 216$. \section{Bounds for the IH3 configuration}\label{sec:IH3} We now move on to studying IH convection in the IH3 configuration, where the top boundary is maintained at constant (zero) temperature and the bottom boundary is insulating. First, in \cref{ss:bm-IH3}, we derive a bounding framework for $\smash{\mean{wT}}$ following steps similar to those used for the IH1 case (cf. \cref{ss:bm-IH1}). In \cref{ss:ansatze-IH3} we present ans\"atze for $\bfield$ and $\lm$, with which we obtain crucial estimates in \cref{ss:lemmas_ih3} , which give the bound in \cref{ss:analtic_bound_ih3}. Throughout this section, $T$ belongs to $\mathcal{H}_3$. Observe that this changes the set of temperature fields over which the spectral constraint in \cref{def:sc} is imposed. The notation $\mathcal{H}_+$ still denotes the subset of temperature fields in $\mathcal{H}_3$ that are nonnegative pointwise almost everywhere. \subsection{Bounding framework}\label{ss:bm-IH3} Upper bounds on $\smash{\mean{wT}}$ for the IH3 configuration can be derived using a quadratic auxiliary function $\mathcal{V}\{T\}$ similar to that used for the IH1 case. Precisely, we still take $\mathcal{V}$ to be defined as in~\eqref{e:V-IH1}, where the positive constant $\bp$ and the piecewise-differentiable square-integrable function $\bfield(z)$ are tunable parameters. However, this time we impose only the boundary condition \begin{equation}\label{e:psi-bc-ih3} \bfield(1)=0. \end{equation} These changes result in the following family of parametrized upper bounds on $\mean{wT}$. \begin{proposition}[Bounding framework, IH3]\label{th:ih3-bounding-problem} Suppose that the pair $(\bp,\bfield)$ satisfies the spectral constraint (cf. \cref{def:sc}) and the boundary condition in~\eqref{e:psi-bc-ih3}. Further, let $\lm \in L^2(0,1)$ be a nondecreasing function such that $\lm(0) = -1$. Then, \begin{equation*} \mean{wT} \leq \tfrac12 + \volav{ \tfrac{1}{4\bp} \abs{ \bfield' - \lm - \bp z }^2 - \bfield } =: U(\bfield,\lm,\bp) \end{equation*} \end{proposition} \begin{proof} Proceeding as in the proof of \cref{th:ih1-bounding-problem} shows that % \begin{equation}\label{e:primal-form-ih3} \mean{wT} \leq \tfrac12 + \sup_{\substack{T \in \mathcal{H}_+ \\ w = -R\Delta^{-2}\Delta_h T}}\volav{ - b \abs{\nabla T}^2 - \bfield' w T + \left(\bfield - \bp z + 1 \right)\partial_z T - \bfield }. \end{equation} The supremum on the right-hand side can be evaluated using the convex duality argument summarized in \cref{ss:duality-ih3}, leading to the equivalent inequality % \begin{equation}\label{e:dual-form-ih3} \mean{wT} \leq \tfrac12 + \inf_{ \substack{\lm \in L^2(0,1) \\ \lm \text{ \rm nondecreasing} \\ \lm \geq -1}} \volav{ \tfrac{1}{4\bp} \abs{ \bfield' - \lm - \bp z }^2 - \bfield }. \end{equation} % This clearly implies the upper bound stated in the proposition. \end{proof} \subsection{Ans\"atze}\label{ss:ansatze-IH3} The procedure for the proof of an upper bound on $\mean{wT}$ is the same as that employed for isothermal boundaries. We construct $\bp >0$, $\bfield(z)$ and $\lm(z)$ that satisfy the conditions of \cref{th:ih3-bounding-problem}, while trying to minimize the corresponding bound $U(\bp,\bfield,\lm)$. Due to the Neumann boundary condition on $T$ at $z=0$, we can no longer employ the Poincar\'e estimates used in \cref{ss:lemmas-IH1} to control the sign-indefinite term in the spectral constraint at the bottom boundary. Instead we modify $\bfield(z)$ in $(\delta,\frac12)$ to increase slower than logarithmically in $z$ and use results established in~\cite{Whitehead2014mixed}. The function $\bfield(z)$ is hence chosen to have the form \begin{equation} \label{e:psi_3} \bfield(z):= \begin{dcases} \delta -z ,& 0\leq z \leq \delta,\\ \frac{A}{1-\alpha}\left(z^{1-\alpha} - \delta^{1-\alpha} \right) - A \ln{\left(\frac{1-z}{1-\delta}\right)}, & \delta \leq z \leq 1-\varepsilon, \\ \frac{A\,B}{\varepsilon} \left(1-z\right), & 1-\varepsilon \leq z \leq 1, \end{dcases} \end{equation} where \begin{align} B=B(\epsilon,\delta,\alpha) := \frac{(1-\varepsilon)^{1-\alpha}-\delta^{1-\alpha}}{1-\alpha} + \ln{\left(\frac{1-\delta}{\varepsilon} \right)}. \label{e:B_form} \end{align} On the other hand, the Lagrange multiplier $\lm(z)$ is still chosen to be \begin{equation} \label{e:q_3} \lm(z):= \begin{dcases} -1, & 0\leq z \leq \delta,\\ 0 , & \delta \leq z \leq 1 . \end{dcases} \end{equation} These piecewise functions, sketched in \cref{fig:psi_log_inf_pr_ih3}, are fully specified by the bottom and top boundary layer widths $\delta, \varepsilon \in (0,\frac12)$, the constant $A>0$, and the exponent $\alpha \in (0,1)$ driving the behaviour of $\bfield(z)$ in the bulk. For $\bp$ we take \begin{equation} \bp := \volav{ |\bfield' - \lm|^2}^{\frac12} \volav{z^2}^{-\frac12} = \sqrt{3} \volav{ |\bfield' - \lm|^2 }^{\frac12}. \label{e:b_choice_ih3} \end{equation} This choice is motivated by minimizing the right hand side of the estimate \begin{equation} \frac{1}{4\bp} \volav{ | \bfield' - \lm - \bp z|^2} \leq \frac{\bp}{2} \volav{ z^2} + \frac{1}{2\bp} \volav{ |\bfield'- \lm |^2 } = \frac{1}{\sqrt{3}} \volav{ |\bfield'- \lm |^2 }^{\frac12} = \frac{\beta}{3}, \label{e:est_2norm_starting_point} \end{equation} which is used in \cref{lemma:U_ih3} below to estimate the value of the bound $U(\bp,\bfield,\lm)$ from above when $\bfield$ and $\lm$ are define by \eqref{e:psi_3} and \eqref{e:q_3} respectively. For any choice of the parameters $\delta$, $\varepsilon$, $A$, and $\alpha$, the function $\bfield$ satisfies the boundary conditions in \eqref{e:psi-bc-ih3}, while $\lm$ is nondecreasing and satisfies the condition $\lm(0)=-1$. Thus, to establish \cref{thm:ih3} using \cref{th:ih3-bounding-problem} we need only specify parameter values such that $U(\bp,\bfield,\lm) \leq \frac12 - O(R^{-4})$ while ensuring that $(\bp,\bfield)$ satisfy the spectral constraint. For the purposes of simplifying the algebra in what follows, we shall fix \begin{equation} A(\delta,\alpha) = \frac{2\sqrt{3}}{9} \sqrt{2\alpha-1}\, \delta^{\alpha+\frac32} \label{e:A_choice_ih3} \end{equation} from the outset. This choice arises when insisting that the upper estimate on $U(\bp,\bfield,\lm)$ derived in \cref{lemma:U_ih3} below should be strictly less than $\frac12$ for suitable choices of $\delta$ and $\varepsilon$, at least when all other constraints on these parameters are ignored. \begin{figure \centering \input{figs/tex/ih3-profiles-v2} \caption{Sketch of the functions $\bfield(z)$ \eqref{e:psi_3} and $\lm(z)$ in \eqref{e:q_3} used to prove \cref{thm:ih3}. } \label{fig:psi_log_inf_pr_ih3} \end{figure} \subsection{Preliminary Estimates}\label{ss:lemmas_ih3} We now derive auxiliary results that simplify the choice of the exponent $\alpha$ and of the boundary widths $\delta$ and $\varepsilon$. The first gives estimates on the value of $\bp$ in~\eqref{e:b_choice_ih3}. \begin{lemma}[Estimates on $\bp$]\label{lemma:b_ih3} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be given by \eqref{e:psi_3}, \eqref{e:q_3} and \eqref{e:b_choice_ih3} with $A$ specified in \eqref{e:A_choice_ih3}. Suppose that $\alpha \in (\frac12,1)$ and the boundary layer widths $\delta$ and $\varepsilon$ satisfy \begin{subequations} \begin{equation} \delta \leq \frac13 \left(\frac12\right)^{\frac{1}{2\alpha -1}}, \qquad \varepsilon \leq \frac13, \qquad (2\alpha-1)\,\delta^{2\alpha-1}B(\epsilon,\delta,\alpha)^2 \leq \varepsilon. \tag{\theequation a,b,c} \end{equation} \label{e:eps_bound_conditions} \end{subequations} Then \begin{equation} \frac{\sqrt{2}}{3}\, \delta^2 \leq \bp \leq \frac43\, \delta^2. \label{e:b_lower_upper_ih3} \end{equation} \end{lemma} \begin{remark} Condition \subeqref{e:eps_bound_conditions}{a} and the bounds on $\alpha$ imposed in the Lemma imply that $0 \leq \delta \leq \frac16$. These uniform bounds will be used repeatedly in the following proofs. \end{remark} \begin{proof}[Proof of \cref{lemma:b_ih3}] It suffices to estimate $\volav{|\bfield'-\lm|^2}^{\frac12}$ from above and below. For a lower bound, we can substitute our choices of $\bfield$ and $\lm$ and then estimate \begin{eqnarray} \volav{ |\bfield' - \lm |^2} = \int^{1}_{\delta} |\bfield'(z)|^2\textrm{d}z \geq \int^{1-\varepsilon}_{\delta} |\bfield'(z)|^2\textrm{d}z = A^2 \int^{1-\varepsilon}_{\delta} \left|\frac{1}{z^{\alpha}} + \frac{1}{1-z} \right|^2 \textrm{d}z . \nonumber \end{eqnarray} Dropping the positive term $1/(1-z)$ from the integrand and integrating the rest gives \begin{equation*} \volav{ |\bfield' - \lm |^2} \geq A^2 \left(\frac{\delta^{1-2\alpha}-(1-\varepsilon)^{1-2\alpha}}{2\alpha-1} \right). \end{equation*} For every $\alpha \in (\frac12,1)$, the second term inside the parentheses can be estimated upon observing that constraints \subeqref{e:eps_bound_conditions}{a-b} imply \begin{equation} \label{e:est_1_eps} (1-\varepsilon)^{1-2\alpha}\leq \left(\frac23 \right)^{1-2\alpha } \leq \frac{1}{2^{2\alpha}} \delta^{1-2\alpha} \leq \frac12 \delta^{1-2\alpha} . \end{equation} Thus, we obtain \begin{equation} \label{e:lower_bound_L2_ih3} \volav{|\bfield' - \lm|^2} \geq A^2 \frac{\frac12 \delta^{1-2\alpha}}{2\alpha - 1} . \end{equation} Taking the square root of \eqref{e:lower_bound_L2_ih3} and using \eqref{e:A_choice_ih3} gives $\volav{| \bfield' - \lm|^2}^{\frac12} \geq \frac{\sqrt{6}}{9}\, \delta^2$, which combined with \eqref{e:b_choice_ih3} proves the lower bound on $\bp$ stated in \eqref{e:b_lower_upper_ih3}. To prove the upper bound on $\bp$, we start by using the inequality $(a+b)^2 \leq 2a^2 + 2b^2$, evaluating exactly the integral of $\bfield'-\lm$, and dropping the negative terms to get \begin{align} \frac{\volav{ |\bfield' - \lm|^2}}{A^2} &= \int^{1-\varepsilon}_{\delta} \left|\frac{1}{z^{\alpha}} + \frac{1}{1-z} \right|^2 \textrm{d}z + \frac{ B^2}{\varepsilon} \nonumber \\ &\leq \int^{1-\varepsilon}_{\delta} \frac{2}{z^{2\alpha}} + \frac{2}{(1-z)^2} \textrm{d}z + \frac{ B^2}{\varepsilon} \nonumber \\ \text{(since $\alpha > \frac12$)} \quad &\leq \frac{2\delta^{1-2\alpha}}{2\alpha-1} + \frac{2}{\varepsilon} + \frac{B^2}{\varepsilon}. \label{e:upper_1_est_ih3} \end{align} Using assumption \subeqref{e:eps_bound_conditions}{c}, the second and final term in \eqref{e:upper_1_est_ih3} can be estimated from above to arrive at \begin{equation} \frac{\volav{|\bfield' - \lm|^2}}{A^2} \leq \frac{\delta^{1-2\alpha}}{2\alpha -1}\left(2+ \frac{2}{B^2}+1 \right). \label{e:2_norm_est_ih3} \end{equation} Next, we observe that for all $\varepsilon \in (0,\frac13)$, $\delta \in (0,\frac16)$, and $\alpha \in (\frac12,1)$ we can estimate \begin{equation*} B(\varepsilon,\delta,\alpha) \geq B\left( \frac13, \frac16, \frac12 \right) = \frac{\sqrt{6}}{3} + \ln{\left(\frac52\right)} > \sqrt{2}, \end{equation*} so $B^{-2} \leq 1/2$. Using this estimate in \eqref{e:2_norm_est_ih3}, taking a square root, and substituting in the value of $A$ given in \eqref{e:A_choice_ih3} leads to the inequality $\volav{ |\bfield'- \lm|^2}^{1/2} \leq (4\sqrt{3}/9)\, \delta^2$. Combining this with \eqref{e:b_choice_ih3} yields the upper bound on $\bp$ stated in \eqref{e:b_lower_upper_ih3} and concludes the proof of \cref{lemma:b_ih3}. \end{proof} The second auxiliary result of this section estimates the upper bound $U(\bp,\bfield,\lm)$ on $\mean{wT}$ given by \cref{th:ih3-bounding-problem} using only the bottom boundary layer width $\delta$. \begin{lemma}[Estimates on $U(\bp,\bfield,\lm)$]\label{lemma:U_ih3} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be specified by \eqref{e:psi_3}, \eqref{e:q_3} and \eqref{e:b_choice_ih3} with $A$ given by \eqref{e:A_choice_ih3}. Suppose $\alpha$ and the boundary layer widths $\delta$, $\varepsilon$ satisfy the conditions of \cref{lemma:b_ih3}. Then, \begin{equation} U(\bp,\bfield,\lm) \leq \frac12 - \frac{\delta^2}{18}. \label{e:U_final_ih3} \end{equation} \end{lemma} \begin{proof Inequality \eqref{e:est_2norm_starting_point} and the upper bound on $\beta$ from \eqref{e:b_lower_upper_ih3} give \begin{equation}\label{e:U_lemma_v3} U(\bp,\bfield,\lm) \leq \frac12 + \frac{\beta}{3} - \volav{\bfield} \leq \frac12 + \frac{4}{9}\delta^2 - \volav{\bfield}. \end{equation} The result follows upon observing that $\bfield$ is non-negative, so $\volav{\bfield} = \int^{1}_0 \bfield(z) \textrm{d}z \geq \int^{\delta}_0 \bfield(z) \textrm{d}z = \frac12 \delta^2$. \end{proof} \begin{remark} The right hand side of \eqref{e:U_lemma_v3} can be strictly smaller than $\frac12$ when $\delta^2$ is small only if $A \lesssim \delta^{\alpha + 3/2}$. This observation dictates the choice of $A$ in \eqref{e:A_choice_ih3}. For any fixed value of $R$, one should choose $A \sim \delta^{\alpha + 3/2}$ with a (possibly $R$-dependent) prefactor that optimises the balance between the positive and negative terms, subject to constraints on $A$, $\delta$ and all other parameters that ensure the spectral constraint. To simplify our proof, however, we choose to fix this prefactor \textit{a priori} irrespective of $R$. \end{remark} Our final auxiliary result gives the sufficient conditions on $\delta$ and $\varepsilon$ that ensure the spectral constraint (cf. \cref{def:sc}) is satisfied. \begin{lemma}[Sufficient conditions for spectral constraint] \label{lemma:spectral_ih3} Let $\bfield(z)$, $\lm(z)$ and $\bp$ be specified by \eqref{e:psi_3}, \eqref{e:q_3} and \eqref{e:b_choice_ih3} with $A$ given by \eqref{e:A_choice_ih3}. Suppose that $\alpha$ and the boundary layer widths satisfy the conditions of \cref{lemma:b_ih3}. Further, let \begin{equation} h(\alpha) =2(2\alpha -1 )(1-\alpha^2). \label{e:h_a_lem} \end{equation} and suppose that \begin{subequations} \begin{gather} \delta \leq \varepsilon,\\ \delta \leq h(\alpha) \, R^{-2},\\ \frac{\sqrt{2\alpha - 1}}{(1-\alpha)^2}\,\delta^{\alpha-\frac12}\varepsilon^3\ln^2{(\delta^{-1})} \leq \frac43 \sqrt{6} R^{-1}. \end{gather} \label{e:delta_eps_lemma} \end{subequations} Then, the pair $(\bp,\bfield)$ satisfies the spectral constraint. \end{lemma} Unlike the analogous result obtained in \cref{ss:lemmas-IH1}, \cref{lemma:spectral_ih3} cannot be proven using only the Hardy--Rellich inequalities stated in \cref{lemma:doering_estimate}. The lack of a fixed boundary temperature at $z=0$, makes it impossible to gain sufficient control on the contribution of the bottom boundary layer to the quadratic form in~\cref{e:sc}. This difficulty can be overcome using the following result, obtained as a particular case of a more general analysis by Whitehead and Wittenberg~\citep[][Eqs. (59) \& (77)]{Whitehead2014mixed}, which upon setting (in their notation) $\nu_1 = \frac{\alpha}{2} - \nu_2$ and $\nu_2 = \frac12\left(-1+\sqrt{2(1-\alpha^2)}\right)$. \begin{lemma}[Adapted from~\cite{Whitehead2014mixed}]\label{lemma_3_main} Fix $\alpha \in (\frac12,1)$ and $\mu,R>0$. Suppose $\varphi(z): [0,1] \rightarrow \mathbb{R}$, be a non-negative function, satisfying \begin{equation}\label{e:lemma_cons_WW} \volav{ \varphi(z) z^{1+\alpha/2}}^2 \leq \frac{\mu}{R} \frac{\sqrt{2}(3-\alpha)(2+\alpha) \sqrt{1-\alpha^2}}{3+\alpha}. \end{equation} Then, for every $w$ and $T$ solving~\eqref{e:w_and_T_eq} subject to the boundary conditions \eqref{e:w-bcs}, \begin{equation} \volav{\frac12 |\nabla T|^2 + \mu\frac{wT }{z^{\alpha}} - \varphi(z) wT }\geq 0. \end{equation} \end{lemma} We are now ready to prove \cref{lemma:spectral_ih3}. \begin{proof}[Proof of \cref{lemma:spectral_ih3}] Let $\mathbbm{1}_{(a,b)}$ denote the indicator function of the interval $(a,b)$ and define the functions \begin{subequations} \begin{gather} f(z) := \left[1 + \frac{A(\delta,\alpha)}{z^{\alpha}} + \frac{A(\delta,\alpha)}{1-z} \right] \mathbbm{1}_{(0,\delta)}(z) ,\label{e:j}\\ g(z) := \left[\frac{B(\varepsilon,\delta,\alpha)}{\varepsilon}+ \frac{1}{z^\alpha} + \frac{1}{1-z} \right] \mathbbm{1}_{(1-\varepsilon,1)}(z) . \label{e:k} \end{gather} \end{subequations} Given our choice of $\bfield$, we can rewrite the spectral constraint as \begin{equation*} 0 \leq \volav{\bp |\nabla T|^2 + \bfield' w T } = \mathcal{F}\{T\} + \mathcal{G}\{T\}, \end{equation*} where \begin{subequations} \begin{gather} \mathcal{F}\{T\} := \frac{\bp}{2} \volav{|\nabla T|^2} + A \volav{\frac{w T }{z^{\alpha}}}\, - \volav{f(z)\, w T }, \\ \mathcal{G}\{T\} := \frac{\bp}{2} \volav{|\nabla T|^2} + A \volav{ \frac{w T }{1-z}} - \, A\volav{ g(z)\, w T}. \end{gather} \end{subequations} Observe that $\mathcal{F}\{T\}$ and $\mathcal{G}\{T\}$ are functionals of the temperature field only because $w$ is determined as a function of $T$ by solving~\eqref{e:w_and_T_eq} subject to the boundary conditions in~\eqref{e:w-bcs}. We shall prove that $\mathcal{F}\{T\}$ and $\mathcal{G}\{T\}$ are individually non-negative for all temperatures $T$ from the space $\mathcal{H}_3$, which is sufficient for the spectral constraint to hold. To prove that $\mathcal{F}\{T\} \geq 0$, we apply \cref{lemma_3_main} with $\varphi(z) = f(z)/\bp $ and $\mu = A / \bp$, where $f$ is given by \eqref{e:j} and $A$ given by \eqref{e:A_choice_ih3}. We therefore need to check tha % \begin{equation} \label{eq:f_ww_cond} \volav{f(z)z^{1+\frac{\alpha}{2}}}^2 \leq \frac{\beta A}{R} \frac{\sqrt{2}(3-\alpha)(2+\alpha)\sqrt{1-\alpha^2}}{3+\alpha}. \end{equation} % To verify this inequality, we first bound from above the weighted integral on the left-hand side. By assumption we have $0\leq z \leq \delta \leq \frac{1}{6}$ and $\alpha \in (\frac12, 1)$, from which we obtain $\frac{1}{1-z} \leq \frac{1}{z^{\alpha}}$. Using this estimate and the definition of $A$ from \eqref{e:A_choice_ih3} we can therefore estimate \[ \volav{f(z)z^{1+\frac{\alpha}{2}}} \leq \int^{\delta}_0 z^{1+\frac{\alpha}{2}} + 2A z^{1-\frac{\alpha}{2}}\textrm{d}z = \left[\frac{2}{4+\alpha} + \frac{8\sqrt{3}}{9} \frac{ \sqrt{2\alpha-1}}{(4-\alpha)}\delta^{\frac32 }\right] \delta^{2+\frac{\alpha}{2}} . \] Using again that $0 \leq \delta \leq \frac16$ and $\alpha \in (\frac12,1)$, the bracketed expression can be bounded from above to obtain \begin{equation} \label{e:est_integral_f} \volav{f(z)z^{1+\frac{\alpha}{2}}} \leq \left[ \frac{4}{9} + \frac{8 \sqrt{3}}{9} \cdot \frac{1}{3} \cdot \left(\frac16\right)^\frac32 \right] \delta^{2+\frac{\alpha}{2}} < \frac12 \delta^{2 + \frac{\alpha}{2}}. \end{equation} Next, we bound from below the right-hand-side of \eqref{eq:f_ww_cond}. Using the lower bound on $\bp$ from \cref{lemma:b_ih3}, the definition \eqref{e:A_choice_ih3} of $A$, and the fact that $\alpha \in (\frac12,1)$, we have \begin{align} \frac{\beta A \sqrt{2} (3-\alpha)(2+\alpha)}{(3+\alpha)} &\geq \frac{4 \sqrt{3}}{27} \delta^{\alpha + \frac{7}{2}} \sqrt{2\alpha-1} \cdot \frac{(3-\alpha)(2+\alpha)}{(3+\alpha)} \nonumber \\ & \geq \frac{5}{9\sqrt{3}} \delta^{\alpha + \frac72} \sqrt{2\alpha-1}. \label{eq:spec_lb} \end{align} Combining \eqref{e:est_integral_f} and \eqref{eq:spec_lb}, we conclude that \eqref{eq:f_ww_cond} holds if \[ \delta^{\frac12} \leq \frac{20}{9 \sqrt{3}} \frac{\sqrt{(2\alpha-1)(1-\alpha^2)}}{R} \leq \sqrt{2} \frac{\sqrt{(2\alpha-1)(1-\alpha^2)}}{R} , \] which is true because $\delta$ satisfies \subeqref{e:delta_eps_lemma}{a} by assumption. This proves that $\mathcal{F}\{T\} \geq 0$, as desired. We now prove that $\mathcal{G}\{T\}$ is also nonnegative. This can be done following the same steps used in \cref{ss:lemmas-IH1}. The Hardy--Rellich inequality \subeqref{doering_estimate}{b} gives \begin{equation} \mathcal{G}\{T\} \geq \frac{\bp}{2} \volav{|\nabla T|^2} + \frac{4A}{R} \volav{ \frac{w^2}{(1-z)^3}} - A \volav{g(z) wT}. \label{e:T_upper_ih3} \end{equation} To estimate the last term, as before we use the inequality $\volav{T^2}_h\leq \smash{(1-z)\volav{ |\nabla T|^2} }$, the Cauchy--Schwarz inequality, and Young's inequality: \begin{align*} \volav{g(z) w T} \leq \frac{\bp}{2A} \volav{ |\nabla T|^2} + \frac{A}{2\bp} \volav{ g(z)^2 (1-z)^4 } \volav{ \frac{w^2}{(1-z)^3} } . \end{align*} Using the lower bound on $\bp$ from \eqref{e:b_lower_upper_ih3} gives \begin{equation*} \volav{g(z) w T} \leq \frac{\bp}{2A} \volav{ |\nabla T|^2} + \frac{3\sqrt{2}\, A}{4 \delta^2}\volav{ g(z)^2 (1-z)^4 } \volav{ \frac{w^2}{(1-z)^3} } , \end{equation*} which can be substituted into \eqref{e:T_upper_ih3} along with the value of $A$ from \eqref{e:A_choice_ih3} to obtain \begin{equation} \label{e:T_exp_ih3} \mathcal{G}\{T\} \geq \frac{\sqrt{6(2\alpha - 1)}\, A}{6} \left( \frac{4\sqrt{6}}{\sqrt{2\alpha-1}\, R} -\delta^{\alpha - \frac12} \volav{ g(z)^2 (1-z)^4 }\right)\volav{ \frac{|w|^2}{(1-z)^3}} . \end{equation} To conclude the argument we need to show that term in the parentheses is non-negative. To demonstrate this, we first estimate from above the function $g(z)$ given in \eqref{e:k} on the interval $(1-\varepsilon,1)$. Our assumption that $\delta\leq \varepsilon$ implies that $1-\varepsilon\leq 1-\delta \leq1$ and $\ln(\frac{1}{\varepsilon})\leq \ln(\frac{1}{\delta})$. Thus, for all $\delta\leq\frac16$ and $\alpha \in (\frac12,1)$ the first term in $g(z)$ can be bounded as \begin{align}\label{e:esti_g_int} \frac{B}{\varepsilon} \leq \frac{1}{\varepsilon}\left(\frac{1}{1-\alpha} + \ln{\left(\frac{1}{\delta} \right)}\right) &\leq \frac{2\ln{\left(\frac{1}{\delta}\right)}}{\varepsilon(1-\alpha)} . \end{align} To estimate the other terms in $g(z)$, we observe that the assumptions $\varepsilon\leq \frac13$ and $\alpha\in(\frac12,1)$ imply that $\frac{1}{z^{\alpha}} \leq \frac{1}{2(1-\alpha)(1-z)}$ and $\frac{1}{1-z} \leq \frac{1}{2(1-\alpha)(1-z)}$. Consequently, we arrive at \begin{equation}\label{e:g_1st_est} g(z) \leq \frac{2\ln{(\frac{1}{\delta})}}{\varepsilon(1-\alpha)} + \frac{1}{(1-\alpha)(1-z)}. \end{equation} Finally, using \eqref{e:g_1st_est} and evaluating the integral in the parentheses of \eqref{e:T_exp_ih3} with the fact that $\ln(\frac{1}{\delta}) \leq \ln^{2}{(\frac{1}{\delta})}$ and $\frac13 \leq \frac13 \ln{(\frac{1}{\delta})}$ gives \begin{eqnarray} \delta^{\alpha - \frac12} \volav{g(z)^2(1-z)^4} &\leq& \delta^{\alpha - \frac12} \int^{1}_{1-\varepsilon} \left(\frac{2 \ln{\left(\frac{1}{\delta}\right)}}{\varepsilon(1-\alpha)} + \frac{1}{(1-\alpha)(1-z)} \right)^2(1-z)^4\,\textrm{d}z \nonumber\\ &=& \frac{\delta^{\alpha - \frac12} \varepsilon^{3}}{(1-\alpha)^2} \left[\frac45 \ln^{2}{\left(\frac{1}{\delta}\right)} + \ln{\left(\frac{1}{\delta}\right)} + \frac13 \right] \nonumber\\ &\leq& \frac{3\,\delta^{\alpha - \frac12}\varepsilon^{3} \ln^{2}{\left(\frac{1}{\delta}\right)}}{(1-\alpha)^2} \nonumber \\ {(\text{by \subeqref{e:delta_eps_lemma}{b}})} \qquad &\leq& \frac{4\sqrt{6}}{\sqrt{2\alpha - 1}\, R} . \label{e:Phi_integral_est} \end{eqnarray} This concludes the proof of \cref{lemma:spectral_ih3}. \end{proof} \subsection{Proof of \texorpdfstring{\cref{thm:ih3}}{Theorem 2} } \label{ss:analtic_bound_ih3} To prove \cref{thm:ih3}, we only need to specify $R$-dependent values for $\alpha$ and for the boundary layer widths $\delta$ and $\varepsilon$ that satisfy the conditions of \cref{lemma:b_ih3,,lemma:U_ih3,,lemma:spectral_ih3}. \begin{figure} \centering \includegraphics[scale=1]{figs/ih3_valid_ranges.eps} \begin{tikzpicture}[overlay] \node at (-12.5,5.4) {\textit{(a)}}; \node at (-6,5.4) {\textit{(b)}}; \end{tikzpicture} \caption{\textit{(a)} Variation with \Ra\ of the allowed values for the bottom boundary layer width $\delta$ \eqref{e:boundary_layers_ih3} ({\color{matlabblue}\solidrule}) and the feasible region of $\varepsilon$ \eqref{e:eps_range_alpha} (shaded region). Also shown are uniform upper bounds of $\delta\leq \frac{1}{6}$ ({\color{matlabblue}\dottedrule}), and $\varepsilon\leq\frac13$ ({\color{matlabred}\dottedrule}) imposed on the variables. A black vertical line marks the Rayleigh number, $\Ra_0\approx 2960.89 $ above which all constraints on are satisfied. \textit{(b)} Plot of the function $h(\alpha)$ \eqref{e:h_a_lem} ({\color{matlabblue}\solidrule}). Shown also is the optimal $\alpha^* = (1+\sqrt{13})/6$ ({\color{matlabblue}\dottedrule}). } \label{fig:ih3_conditions} \end{figure} Motivated by the desire to minimize the upper bound on $U(\bp,\bfield,\lm)$ stated in \cref{lemma:U_ih3}, we choose \begin{equation} \delta = h(\alpha^*) R^{-2} \label{e:boundary_layers_ih3} \end{equation} where $\alpha^* = (1+\sqrt{13})/6$ is the unique maximizer of $h(\alpha)$ on the interval $(\frac12,1)$ (see \cref{fig:ih3_conditions}(b)). With these choices, conditions \subeqref{e:eps_bound_conditions}{c} and \subeqref{e:delta_eps_lemma}{b} require $\varepsilon$ to satisfy \begin{eqnarray} c_0 R^{-4\alpha^* +2} B(\delta,\varepsilon,\alpha^*)^2 \leq \varepsilon \leq c_2 R^{-\frac{2-2\alpha^*}{3}} \ln^{-\frac23}{(\delta^{-1})}, \end{eqnarray} where $c_0$, $c_1$ and $c_2$ are non-negative constants independent of \Ra. Using the upper bound on $B$ from~\eqref{e:esti_g_int}, it suffices to find $\varepsilon$ such that \begin{eqnarray} \frac{4c_0}{(1-\alpha^*)^2} R^{-4\alpha^* +2} \ln^2{\left(\frac{R^2}{h(\alpha^*)}\right)} \leq \varepsilon \leq c_2 R^{-\frac{2-2\alpha^*}{3}} \ln^{-\frac23}\left( \frac{R^2}{h(\alpha^*)} \right). \label{e:eps_range_alpha} \end{eqnarray} \Cref{fig:ih3_conditions} shows that suitable values of $\varepsilon$ exist when $\Ra \geq \Ra_0 \approx 2960.89$. One can also check that for all such values of \Ra\ and any $\varepsilon$ in the range given by \cref{e:eps_range_alpha} one has $\delta \leq \frac16$, $\varepsilon \leq \frac13$, and $\delta \leq \varepsilon$. We have therefore verified all conditions of \cref{lemma:b_ih3,,lemma:U_ih3,,lemma:spectral_ih3}. To conclude the proof of \cref{thm:ih3}, we simply substitute our choice of $\delta$ from \eqref{e:boundary_layers_ih3} into \cref{lemma:U_ih3} to find the upper bound $\mean{wT} \leq U(\bp,\bfield,\lm) \leq \frac12 - c R^{-4}$, where $c = \frac{h^2(\alpha^*)}{18} \simeq 0.0107$. \begin{remark} The top boundary layer width $\varepsilon$ is not uniquely determined in our construction. Its optimal value could be obtained by considering more refined estimates on $U(\bp,\bfield,\lm)$ than \cref{lemma:U_ih3}, but we expect such estimates to provide only higher-order corrections to the eventual bound on \mbox{$\smash{\mean{wT}}$}. \end{remark} \section{Conclusions}\label{sec:conclusion} We have proven upper bounds on the mean vertical convective heat transport \mbox{$\smash{\mean{wT}}$}\ for two configurations of infinite-Prandtl-number convection driven by uniform internal heating between no-slip boundaries. In the first case, where both boundaries are held at a constant temperature, we find $\mbox{$\smash{\mean{wT}}$} \leq \frac12 - O(\Ra^{-2})$ for all sufficiently large \Ra\ (cf. \cref{thm:ih1-main-result}). This result implies that the outward heat fluxes through the top and bottom are bounded by $\mathcal{F}_T \leq 1 - O(\Ra^{-2})$ and $\mathcal{F}_B \geq O(\Ra^{-2})$, respectively. In the second configuration, where the top boundary remains isothermal but the bottom one is insulating (no-flux condition), we find $\mbox{$\smash{\mean{wT}}$} \leq \frac12 - O(\Ra^{-4})$ (cf. \cref{thm:ih3}). In this case, we conclude from \eqref{e:Nu_ih3} that the Nusselt number is bounded above by $\Nu \leq O(\Ra^4)$. Explicit suboptimal values for the prefactors in the Rayleigh-dependent terms were also obtained (cf. \cref{rem:prefactors-ih1,rem:prefactors-ih3}) All of these results were derived using the background method, which we formulated as a search over quadratic auxiliary functionals of the form \eqref{e:V-IH1} and augmented using a minimum principle for the fluid's temperature. Similar to previous works on infinite-Prandtl-number Rayleigh--B\'enard convection, the background temperature fields used vary linearly in thin boundary layers, and increase either logarithmically (IH1 configuration) or as a power law (IH3 configuration) in the bulk of the fluid layer. This bulk behaviour enables us to use Hardy--Rellich inequalities from~\cite{whitehead2011internal} (\cref{lemma:doering_estimate}) and an integral estimate from~\cite{Whitehead2014mixed} (\cref{lemma_3_main}) that were originally developed in the context of Rayleigh--B\'enard convection. In contrast to the latter, however, our background fields lack symmetry in the vertical direction, which reflects the lack of vertical symmetry of IH convection problems. In our choice of background fields, allowing the bottom boundary layer width $\delta$ to be smaller than the top boundary layer width $\varepsilon$ is essential to prove \cref{thm:ih1-main-result,thm:ih3}. For the IH1 configuration, forcing $\delta = \varepsilon$ worsens the \Ra-dependent correction to $\frac12$ in \cref{thm:ih1-main-result} to $O(\Ra^{-2}\ln^{-2}{(\Ra)})$. For the IH3 configuration, instead, no upper bound on \mbox{$\smash{\mean{wT}}$}\ that asymptotes to $\frac12$ from below as \Ra\ increases can be obtained with our method of proof if $\delta=\varepsilon$. This boundary layer asymmetry contrasts the construction of background fields for IH convection at finite \Pr~\cite{kumar2021ihc}, where taking $\delta \neq \varepsilon$ appears to bring no qualitative improvement to the exponentially-varying upper bounds on \mbox{$\smash{\mean{wT}}$}\ . We also stress that the \textit{a priori} uniform limits on the allowed values of $\delta$ and $\varepsilon$ imposed throughout \cref{sec:IH1,sec:IH3} have been chosen with the only goal of simplifying the algebra in our proofs. Varying these limits affects the prefactors of the \Ra-dependent terms in \cref{thm:ih1-main-result,thm:ih3}, as well as the range of \Ra\ values for which they hold. Both could be optimized further if desired. One crucial difference between our constructions for the IH1 and IH3 configurations is the leading-order behaviour of the background temperature fields---or, more precisely, of the function $\bfield(z)$---as the bottom boundary layer edge is approached from the bulk region. For the IH1 configuration, it suffices for $\bfield$ to have the same logarithmic behaviour as the background temperature fields used to study Rayleigh--B\'enard convection~\cite{doering2006bounds}. For the IH3 configuration, however, this choice does not work due to the loss of control on the temperature of the bottom boundary, and we are instead forced to take $\bfield(z) \sim z^{1-\alpha}$ with $\alpha \in (0,1)$. This modification was already used in the context of Rayleigh--B\'enard convection between imperfectly conducting boundaries~\cite{Whitehead2014mixed}, where the optimal exponent $\alpha$ depended logarithmically on the Rayleigh number. Within our proof, instead, the optimal $\alpha$ is a constant. Whether this difference is due to our choice of estimates or the inherent differences between Rayleigh-B\'enard and IH convection remains an open question. More generally, we do not know whether the upper bounds on \mbox{$\smash{\mean{wT}}$}\ stated in \cref{thm:ih1-main-result,thm:ih3} are qualitatively sharp. To check if the $O(\Ra^{-2})$ and $O(\Ra^{-4})$ corrections to the asymptotic value of $\frac12$ are optimal within our bounding framework, one could employ a variation of the computational approach taken in~\cite{arslan2021IH1} and optimize the tunable parameters $\bfield$, $\bp$, and $\lm$ in full (see also~\cite{Fantuzzi2022} and references therein for more details on the numerical optimization of bounds). A more interesting but also more challenging problem is to identify which convective flows maximize \mbox{$\smash{\mean{wT}}$}\, and the corresponding optimal scaling of this quantity with \Ra. Considerable insight in this direction can be gained through (i) direct numerical simulations, which to the best of our knowledge are currently lacking; (ii) the calculation of steady but unstable solution of the Boussinesq equations~\eqref{e:governing-equations} that, as recently observed in the context of Rayleigh--B\'enard convection~\cite{Wen2020,wen_goluskin_doering_2022}, may transport heat more efficiently than turbulence; and (iii) the explicit design of optimally-cooling flows~\cite{Tobasco2017,doering2019optimal,Tobasco2022}. Finally, it would be interesting to investigate if more sophisticated PDE analysis techniques used for Rayleigh--B\'enard convection~\cite{choffrut2016upper} can be extended to IH convection to interpolate between the algebraic bounds on \mbox{$\smash{\mean{wT}}$}\ proved in this paper for infinite-\Pr\ fluids with the finite-\Pr\ exponential bounds obtained in~\cite{kumar2021ihc}. \vspace{2ex}\noindent \textbf{Acknowledgements} A.A. acknowledges funding by the EPSRC Centre for Doctoral Training in Fluid Dynamics across Scales (award number EP/L016230/1). G.F. was supported by an Imperial College Research Fellowship and would like to thank the Isaac Newton Institute for Mathematical Sciences, Cambridge, for support and hospitality during the programme ``Mathematical aspects of turbulence: where do we stand?'' (EPSRC grant number EP/R014604/1) where work on this paper was undertaken.
\section{Background} \label{sec:background} We provide an overview of website fingerprinting, traffic splitting as a website fingerprinting defense, as well as \emph{connection migration} and \emph{IP roaming}. \subsection{Website fingerprinting} Website fingerprinting is a network traffic analysis attack aimed at determining which website a client is visiting from a stream of encrypted packets~\cite{df, knnwfp}. The attacker has the capability to eavesdrop packets sent on the network. When a client encrypts and proxies their web traffic through VPN or Tor, the network adversary can only observe the resulting encrypted traffic to the tunneling service. Since they cannot decrypt the traffic nor observe the destination IP, the goal of the network adversary is to determine which website the client is visiting based solely on network metadata such as packet sizes and timing. Many website fingerprinting attacks utilize features hand-crafted from packet size and timing data~\cite{og_fingerprinting_paper, wfp2011pachenko, cai2012_wfp, knnwfp, panchenko2016website,tiktok}. Random forest classifiers trained on these hand-crafted features can achieve a high accuracy on many website fingerprinting problems~\cite{kfp}. However, in recent years, the field has moved towards more powerful classifiers that can automate feature engineering using neural network architectures~\cite{df,varcnn, pfp,triplet}. \subsection{Traffic splitting as a website fingerprinting defense} Many website fingerprinting defenses other than traffic splitting involve the obfuscation of feature-rich metadata in encrypted web traces~\cite{wtfpad,csbuflo,walkietalkie,frontglue,tamaraw}. For instance, Tor cells are padded to a fixed size for this purpose~\cite{tor_04}. Despite the data overhead, this removes packet size information that a website fingerprinting adversary could otherwise use. Many other defenses also involve obfuscating packet timing, either by injecting ``dummy” packets or intentionally delaying packet delivery~\cite{wtfpad,frontglue}. The focus of this paper is on traffic splitting, which is an alternative or additional measure to obfuscation, and is built upon recent works that aim to reduce information that an attacker with a limited network perspective can learn~\cite{trafficsliver, hywf, mimiq}. We examine recent website fingerprinting defenses built on traffic splitting and emphasize their limitations in comparison to {CoMPS}\xspace. We summarize these differences in Table~\ref{tab:comparison-traffic-splitting}. \begin{table*}[t] \centering \begin{tabular}{l|l|l|l} & Multiple paths & Requires client ISP support & Protocol deployment \\ \hline TrafficSliver-Net & Yes & No & None (Modified Tor) \\ \hline HyWF & Yes & No & Low (Multipath TCP) \\ \hline MIMIQ & No & Yes & High (QUIC) \\ \hline {CoMPS}\xspace & Yes & No & High (Connection migration support) \\ \end{tabular} \caption{Comparison of different traffic splitting systems for website fingerprinting resilience. MIMIQ's splitting occurs over a singular network path, meaning an adversary can see all client traffic, even if each subtrace is associated with a different IP address. MIMIQ also requires client ISP support. For other prior work, the protocol that performs the traffic merging is either custom (as in TrafficSliver) or not widely supported (as in Multipath TCP).} \label{tab:comparison-traffic-splitting} \end{table*} \bheading{TrafficSliver.} Previous work has explored splitting traffic across Tor circuits for improving Tor network performance~\cite{alsabah2013splitting,mtor,sangeetha_novel_2015}. Since then, others have proposed splitting traffic across Tor circuits for privacy, to defend against website fingerprinting by guard node operators~\cite{trafficsliver,yang_enhancing_2015,pennekamp_multipathing_2019}. In this model, the adversary either observes a single network path or operates a single guard node. We spotlight De la Cadena et al.'s proposed system, TrafficSliver, due to its extensive website fingerprinting evaluation. TrafficSliver, like other Tor circuit splitting proposals, relies on a change to the Tor protocol that allows the middle Tor node to merge traffic~\cite{trafficsliver,pennekamp_multipathing_2019}. Recent work has since built on these proposals, including creation of prototypes and further evaluation of their efficacy as website fingerprinting defenses~\cite{netsys-trafficsliver-demo, magnusson_evaluation_2021}. De la Cadena et al. also proposed splitting at the application layer, sending different HTTP requests down different Tor circuits, thus obviating the need to alter the Tor protocol to merge traffic at the middle node. However, the authors concluded that this latter method is not as resilient against website fingerprinting attacks~\cite{trafficsliver}. Leveraging protocols with native support for connection migration, {CoMPS}\xspace could perform this splitting without the need to alter Tor to merge traffic at the middle node. However, the connection migration protocols we examine rely on UDP, while the Tor protocol is tightly coupled with TCP connection state~\cite{tor_tcp_only}. If Tor builds out support for tunneling UDP, {CoMPS}\xspace could split across Tor circuits as well. \bheading{HyWF.} Henri et al. propose a traffic fingerprinting defense that sends packets down different networks via Multipath TCP~\cite{hywf}. In this model, each adversary can only observe a single network path. Henri et al. also find that given the relatively low overhead of this method, it can be easily combined with other website fingerprinting defenses such as WTF-PAD and Walkie Talkie to further decrease website fingerprinting accuracy~\cite{wtfpad,walkietalkie}. \edits{We describe how CoMPS can easily replicate HyWF defenses without multipath TCP services in Section \ref{sec:comps-other}. This is especially useful as some popular middleboxes interfere with multipath TCP usage in practice~\cite{mptcp-wild}.} \bheading{MIMIQ.} Govil et al. propose MIMIQ, where a router or ISP performs a form of traffic splitting on behalf of clients~\cite{mimiq}. The network device rebinds different IP addresses to a client throughout its connection. Unlike the previously discussed systems, MIMIQ traffic occurs over the same network path. Though MIMIQ investigates the capability of QUIC connection migration for privacy, its deployability is limited as the network device next to the client must cooperate. Since MIMIQ does not leverage multiple paths, it is also more vulnerable to flow correlation. Lastly, MIMIQ encodes a client identifier (although it can be somewhat obfuscated) in the IP address. The attacker could discern the mapping scheme used by MIMIQ to assign clients to IP addresses. By contrast, {CoMPS}\xspace utilizes other standard ways clients change or hide their IP address, such as using VPN or other anonymizing pathways, without needing to rely on a trusted network or closely deployed on-path ISP. In addition, {CoMPS}\xspace supports splitting across different network paths, while all MIMIQ traffic traverses the same path. {CoMPS}\xspace also supports other protocols that support \emph{IP roaming} such as WireGuard or Mosh. \subsection{Connection migration and IP roaming} For better mobility support, modern encrypted communication protocols may utilize a connection identifier that is distinct from IP addresses to identify the corresponding party. Examples include QUIC, WireGuard, and Mosh~\cite{quicietf, WireGuard_17, mosh}. In this section, we discuss mobility-related features in these three protocols, namely \emph{connection migration} in QUIC, and \emph{IP roaming} in WireGuard and Mosh. \bheading{Connection migration in QUIC.} QUIC is a UDP-based secure transport protocol that allows for multiplexing of application layer data streams. It was primarily designed to significantly improve HTTP performance in modern traffic patterns~\cite{quic}. The next-generation web protocol HTTP/3 will only support QUIC as a network-layer transport and not TCP~\cite{http3}. The QUIC transport also mandates encryption~\cite{quicietf}. Many large services and CDN providers like Google, Facebook, Akamai, and Cloudflare support QUIC. The browsers Edge, Chrome, and Firefox all support upgrading connections to QUIC. In 2018, QUIC accounted for up to 9\% of Internet traffic, though this figure varied by vantage point~\cite{quic-wild}. In 2021, Cloudflare reported 13\% of the traffic it observes occurs over HTTP/3 (and thus, QUIC)~\cite{cloudflare_quic_v1}. We expect this number to continue increasing, especially once HTTP/3 becomes an RFC and as QUIC and HTTP/3 libraries stabilize~\cite{http3}. QUIC uses a set of connection identifiers to uniquely identify an active connection across network changes. The foremost goal of this design choice is to provide smooth and fast migration when a device moves between different networks (such as from cellular to WiFi). Each QUIC connection usually has multiple valid connection IDs, which are communicated to the other endpoint through the encrypted tunnel once the connection is established. To reduce correlation between different traffic flows, QUIC necessitates the use of different connection IDs per each new network path~\cite{quicietf}. When a QUIC client detects a network change, it first performs a round-trip \emph{path validation} to ensure the server is still reachable from the client. Neither party can exchange data packets until path validation has completed. After 2-way reachability has been established via path validation, servers may allow clients to freely migrate between paths that have been recently validated. Each time the connection is migrated onto the new network, congestion control parameters are reset. QUIC clients can also initiate connection migrations for other reasons, including network performance (if they sense degradation on one particular network path). \bheading{IP roaming in WireGuard and Mosh.} Other UDP-based encrypted protocols like WireGuard and Mosh support \emph{IP roaming}, which has similar properties to connection migration~\cite{WireGuard_17, mosh}. WireGuard is a popular and flexible VPN protocol that has been incorporated into the Linux 5.6 kernel and backported into most major Linux distributions~\cite{salter_WireGuard_2020}. WireGuard is also the underlying protocol driving many commercial VPNs, including Mozilla VPN as well as Cloudflare's Warp VPN~\cite{mozilla_vpn, cloudflare_warp}. WireGuard performs some amount of congestion control per network path~\cite{WireGuard_17}. Mosh is a remote terminal application similar to SSH that is intended for use by mobile clients~\cite{mosh}. Mosh is more resilient to network congestion, network drops, and network changes than SSH~\cite{mosh}. Mosh is not built for high-volume transport, and generally adapts its frame-rate (and thus the amount of information it transmits) to network conditions~\cite{mosh}. Unlike QUIC's \emph{connection migration}, endpoints that support \emph{IP roaming} are not expected to keep state about whether particular network paths have previously established 2-way reachability (via path validation) and do not explicitly reset congestion control parameters each time a packet is received on a new path. In \emph{IP roaming}, as long as an endpoint of the connection receives a valid, decryptable packet with a valid sequence number, that endpoint will accept the packet. WireGuard endpoints are manually configured with their peers' public keys, and in the case of Mosh, this key is established at the beginning of the session, bootstrapped over SSH. \section{{CoMPS}\xspace: System design and implementation} \label{sec:design} With any service that supports IP roaming or connection migration, as long as each packet sent by the same client is received by the intended host, the packet can be delivered by any means, including different network paths on multihomed devices, encrypted VPNs, or other proxies. With this primitive, we can construct a framework to arbitrarily split ongoing sessions to any endpoint~(e.g., QUIC, Mosh, or WireGuard servers) that supports connection migration or IP roaming. Currently, many network-control devices rely heavily on the source and destination IP address and port to identify TCP sessions. In general, {CoMPS}\xspace enables users to split a continuous session across different IP addresses and ports, thus breaking this assumption. In the website fingerprinting context, we instantiate {CoMPS}\xspace to foil network adversaries attempting to fingerprint traffic by limiting the amount of information they observe about a single session. This works against even powerful and adaptive adversaries. In this section, we discuss the overall system design for {CoMPS}\xspace and its core components that allow it to flexibly instantiate various types of network defenses. We detail how {CoMPS}\xspace can be used to construct systems that can support a broad range of use cases against different adversaries. \begin{figure}[t] \centering \includegraphics[width=0.95\columnwidth]{images/embed/comps_overview.pdf} \caption{A path scheduler on the client sends packets down different CoMPS paths, which can encapsulate regular network paths as well as tunneling protocols or other forms of packet delivery.} \label{fig:design} \end{figure} \subsection{Design goals and adversary model} The primary design goal for a {CoMPS}\xspace deployment is to perform traffic splitting of a communication session. {CoMPS}\xspace aims to achieve this functionality via client-side software: (1) without requiring any modification to servers, (2) without requiring any support from the client ISP, and (3) performing traffic splitting using widely-deployed protocols. Furthermore, {CoMPS}\xspace is designed to enable traffic splitting across multiple network paths and tunneling protocols, which can support a range of use cases including website fingerprinting resilience and censorship circumvention. Although precise attacker capabilities may vary depending on the use case, the {CoMPS}\xspace framework generally focuses on a passive network-level adversary that performs traffic analysis of network traffic. \edits{Furthermore, the adversary is assumed to be limited in their perspective and can only observe traffic on one network path. A global adversary who sees all (or most) network paths is not considered. We also make no privacy claims in scenarios where an adversary observes multiple network paths and correlates traffic to the same client. {CoMPS}\xspace focuses on the context of an honest client, and attacks that compromise client-side software are also out of scope. Finally, we assume that network traces are entirely encrypted (including DNS and SNI), consistent with prior work~\cite{wfquic}}. \begin{figure*}[t] \centering \includegraphics[width=0.95\textwidth]{images/embed/CoMPS-paths.pdf} \caption{Demonstration of {CoMPS}\xspace path components. In our threat model, we assume each adversary is limited to a single network position. We distinguish splitting between different network paths for multihomed devices as well as enabling splitting via different network protocols, via heterogeneous VPN or other encrypted tunnel protocols.} \label{fig:CoMPS-paths} \end{figure*} \subsection{Components of {CoMPS}\xspace} In any {CoMPS}\xspace system, the client and server communicate over a protocol that supports connection migration or IP roaming. From there, the primary parameters that we can elect for our system are (1) the end server protocol, (2) different paths and protocols through which to deliver packets, and (3) the path scheduling algorithm that performs mid-session splitting and elects which path to send each packet across. \bheading{(1) Connection migration-supporting server protocol.} {CoMPS}\xspace is deployable to any server supporting connection migration. In this paper, we examine QUIC, WireGuard, and Mosh. To differentiate between the three protocols, we refer to systems that connect to each as {CoMPS}\xspace-over-QUIC, {CoMPS}\xspace-over-WireGuard, and {CoMPS}\xspace-over-Mosh, respectively. \bheading{(2) Heterogeneous paths and tunneling protocols.} As demonstrated in Figure \ref{fig:design}, a \emph{{CoMPS}\xspace path} can be a regular network path, or a tunneled or proxying network protocol, like any VPN protocol, encrypted proxy, or SSH. The only requirement is that the packets from the client arrive at the same server through this path. The clients can choose, according to their own capability and limitations, how many and what type of {CoMPS}\xspace paths to select. For instance, a multihomed client can choose to send traffic over diverse network routing paths. A non-multihomed client can elect to use different VPN protocols or encrypted tunneling protocols, so long as the packet arrives at the intended host.~\footnote{A protocol choice can include different instances of existing protocols with different configuration options that affect the traffic shape, e.g., WireGuard connections with varying maximum transmission unit (MTU) sizes.} Choice of network paths can be limited by the device network (if the device is not multihomed), but choosing network tunnels is only limited by the preliminary effort to set up and maintain proxy or VPN servers. \begin{figure}[t] \centering \includegraphics[width=0.95\columnwidth]{images/embed/CoMPS-path-scheduling.pdf} \caption{Demonstrating the difference between consistent and context-dependent splitting. In context-dependent splitting, the path switch may happen a constant number of times. In consistent splitting, the number of path changes is a function of the session length. In this example, we demonstrate round-robin switching, a straightforward consistent splitting strategy.} \label{fig:localized-consistent} \end{figure} \bheading{(3) Path scheduler.} The path scheduler runs on the client device and provides a virtual network interface to the client program. The scheduler then routes packets down different network paths according to a predetermined path scheduling protocol. We consider two categories of path scheduling techniques: \textbf{consistent splitting} and \textbf{context-dependent splitting}. Consistent splitting is a regular and ongoing path-switching schedule; for instance, continuously switching paths after a set number of packets or milliseconds. Context-dependent splitting is more reactive, and is an occasional path-switch triggered by a particular network event. The three types of \emph{consistent} splitting we highlight in this paper are \emph{round robin}, \emph{uniform random}, and \emph{weighted random}. Round robin deterministically alternates sending series of packets down each path. The \emph{uniform random} scheduler chooses each path uniformly at random, over which to send each series of packets. The \emph{weighted random} scheduler chooses a random weighted probability distribution for every connection. During traffic splitting, the scheduler samples each path from this probability distribution. A \emph{context-dependent} splitting technique we examine is a path scheduler that prefers to send handshake packets to a proxy over an encrypted connection, and other packets over a regular connection. This example involves only one path switch, and the splitting is dependent on a particular context in the connection. \subsection{Concrete use cases and traffic-splitting strategies} In this paper, we primarily implement and evaluate {CoMPS}\xspace instantiations and path-scheduling techniques for the concrete use case of defending against website fingerprinting. We also propose a {CoMPS}\xspace technique to perform low-latency censorship circumvention. \bheading{{CoMPS}\xspace as a fingerprinting defense.} Recall that we describe website fingerprinting in Section \ref{sec:background}. For this use case, our threat model consists of an adaptive adversary who can observe encrypted traffic on ONE of the paths between the client and tunneling service, or between the client and server. From this perspective, they attempt to determine what websites the client is visiting. They know which strategy the client is employing, and train their models with traffic that is defended using the same~strategy. {CoMPS}\xspace can replicate network topologies present in previous work on traffic splitting for website fingerprinting that utilize consistent path scheduling (constant and ongoing path switching), in addition to supporting a broader range of protocols. In this work, we will also implement instantiations using QUIC, WireGuard, and Mosh clients utilizing a consistent path-switching strategy, and evaluate their resilience against fingerprinting attacks and performance overhead. \begin{figure}[t] \centering \includegraphics[width=0.4\textwidth]{images/embed/CoMPS-censorship-circ.pdf} \caption{Using {CoMPS}\xspace-over-QUIC to circumvent naive handshake-based censorship of TLS (with QUIC as the transport layer) connections with negligible overhead.} \label{fig:circumvent-design} \end{figure} \bheading{Circumventing handshake censorship.} As encryption for both web and DNS connections has is slowly becoming the norm, ISPs increasingly use the unencrypted Server Name Indication (SNI) in the TLS handshake to identify connections to throttle or block~\cite{esni}. However, many reliable censorship circumvention transports (e.g., VPN, Tor, and Tor pluggable transports) are relatively high-latency, when compared to a native network connection. Since TLS is integrated into QUIC, QUIC connections will also be susceptible to SNI-based censorship~\cite{quicietf}. We design a simple {CoMPS}\xspace topology to mitigate SNI-based connection identification with minimal overhead. We instantiate {CoMPS}\xspace with two paths: a regular, non-VPN network path, and separate encrypted, VPN path (for instance, a WireGuard VPN). We employ the following context-dependent path scheduling strategy: the path scheduler sends any handshake packets over the VPN path. Once the handshake is complete, the session is migrated to the non-VPN path. The overhead of this technique is a single connection migration. We illustrate this use case in Figure~\ref{fig:circumvent-design}. The design is similar to the concurrently developed BlindTLS, which uses TLS session resumption to switch network paths~\cite{blindtls}. Unlike BlindTLS, which focuses on TLS 1.2, our approach is independent of TLS protocol and works with TLS 1.3~\cite{blindtls}. \subsection{Various {CoMPS}\xspace topologies for website fingerprinting defense} In this section, we describe the specific {CoMPS}\xspace instantiations we evaluate in the paper: traffic splitting to any WireGuard VPN in Section~\ref{sec:comps-wg}, and traffic splitting to a QUIC server via WireGuard VPNs in Section~\ref{sec:comps-quic}. In Section~\ref{sec:comps-other}, we also show that the {CoMPS}\xspace framework subsumes existing traffic splitting designs, as well as provides for new types of traffic splitting systems with differing security properties. \subsubsection{Multihoming to a WireGuard server} \label{sec:comps-wg} {CoMPS}\xspace can enable arbitrary traffic splitting across network paths to any unaltered WireGuard VPN server. This enables the client to perform splitting with arbitrary network TCP and UDP network traffic that is tunneled through WireGuard. Here, we instantiate {CoMPS}\xspace via the topology illustrated in Figure \ref{fig:CoMPS-paths}(a) to connect to a regular WireGuard VPN. In this scenario, our client is multihomed, and there is a passive adversary present on one of the upstream ISPs. We evaluate the resilience of split WireGuard traffic on website fingerprinting attacks with both simulated and real data, as well as the overhead of performing splitting against a WireGuard server. The same approach can also be applied to Mosh. \subsubsection{Traffic splitting to a QUIC server via VPNs} \label{sec:comps-quic} {CoMPS}\xspace enables arbitrary traffic splitting across network paths to unaltered QUIC servers. However, to hide the handshake data (which, at the moment, reveals the destination server name), it is necessary to send this traffic through an encrypted tunnel. In this case, we instantiate {CoMPS}\xspace with the topology in Figure \ref{fig:CoMPS-paths}(b) to connect to any QUIC server. In this scenario, the client does not need to be multihomed, in which case we consider an adversary that can only observe encrypted traffic on one of the paths between the client and VPN proxy. \edits{This defends against fingerprinting by ISPs further upstream from the user.} We examine the effect of splitting QUIC-over-WireGuard traffic on website fingerprinting attacks. We also evaluate the overhead of splitting against a QUIC server that supports connection migration. \subsubsection{Other {CoMPS}\xspace topologies} \label{sec:comps-other} While we discuss the following extensions here for completeness, their evaluation is not our primary focus. Prior work has demonstrated the viability of these concepts~\cite{hywf, trafficsliver, mimiq} and the {CoMPS}\xspace framework is able to realize their benefits in practice. \bheading{Multihoming to a Tor bridge.} If a device is multihomed, {CoMPS}\xspace can also replicate the splitting techniques and defense topology presented in HyWF~\cite{hywf}. To achieve this, we instantiate CoMPS via the topology illustrated in Figure~\ref{fig:CoMPS-paths}(a) to connect to any Tor bridge that supports connection migration. Unlike HyWF, different {CoMPS}\xspace instantiations can work without multipath TCP services, and also support heterogeneous protocols in addition to multiple network paths. \bheading{Rotating source ports to foil naive network-control devices.} MIMIQ proposes a system where an on-path network switch re-addresses traffic from a large pre-allocated pool of IP addresses available to the switch. This prevents a network adversary from naively correlating traffic across different IP addresses to the same connection~\cite{mimiq}. Since {CoMPS}\xspace does not presuppose the existence of a friendly network switch that has access to a pool of IP addresses for address-masking, it cannot construct paths from new IP addresses. We propose MIMIQ-lite, a {CoMPS}\xspace instantiation where the client continually rotates its (IP, port) tuple by binding to new local source ports over which to send data. Although the split traffic may be correlatable via the IP address, in practice, network-control devices are heavily reliant on the (IP, port) tuple for connection identification. This would introduce some difficulty for existing (non-adaptive) adversaries/tools to correlate traffic occurring over constantly changing ports, even if the traffic does not utilize different IP addresses. \bheading{Traffic splitting leveraging heterogeneous protocols.} Unlike previous work in this area, {CoMPS}\xspace also supports a potential strategy and topology where the client can switch between differing tunneling protocols (like WireGuard or OpenVPN) within a single session. This technique can also be combined with the techniques above --- that is, switching between source ports or network paths, to construct an even more resilient defense against network adversaries. Here, we can instantiate {CoMPS}\xspace with the topology in Figure~\ref{fig:CoMPS-paths}(b) or \ref{fig:CoMPS-paths}(c), depending on whether the client is multihomed, to connect to any connection migration-supporting server. The use of heterogeneous protocols can make it more challenging for the attacker to correlate flows from the same connection. Even an attacker who can monitor all the paths (which is not the primary attack model considered in this work) may not know for sure if they are produced by CoMPS's splitting or just two concurrent connections. If the adversary samples incorrect flows or omits relevant flows, this may cause additional false positives or false negatives. This technique is likely resilient against a naive (non-adaptive) attacker (i.e. one using a classifier, which is not trained on data split over heterogeneous protocols). Prior work on transfer learning between classifiers trained on different encrypted protocols has found that they generally perform quite poorly when applied to previously unseen encrypted protocols, even if the same data is being tunneled~\cite{wfquic}. While these last few {CoMPS}\xspace instantiations can raise the bar against non-adaptive adversaries, our primary evaluation focuses on splitting to WireGuard and QUIC servers, as described in Sections~\ref{sec:comps-wg} and \ref{sec:comps-quic}, which we show are resilient against website fingerprinting by an adaptive adversary. \subsection{Implementation and deployment} \label{sec:implementation} We now describe the {CoMPS}\xspace deployment we use for performance experiments as well as data collection for subsequent evaluation as a website fingerprinting defense. We implement traffic splitting to a WireGuard server, as described in Section~\ref{sec:comps-wg} and demonstrated in Figure~\ref{fig:comps-setup}(a). We also implement splitting traffic to a QUIC server, as described in Section~\ref{sec:comps-quic} and demonstrated in Figure~\ref{fig:comps-setup}(b). Finally, we implement splitting to a Mosh server to show that {CoMPS}\xspace can also work with other protocols that support connection migration. \edits{Our client machine is located in New Jersey, although we run the real-world data collection from a virtual private server in Digital Ocean's NYC region.} Depending on which instantiation of {CoMPS}\xspace a client deploys, they may need to first pre-allocate a number of encrypted tunnels, as in Figure~\ref{fig:CoMPS-paths}(b) or Figure~\ref{fig:CoMPS-paths}(c). \edits{In our experiment, we utilize WireGuard as our encrypted tunnel, deploying 2--3 VPN proxies for each network in addition to the server we are splitting traffic to. Our approach is compatible with any encrypted proxy, but we use WireGuard in our experiments. Depending on the experiment, these WireGuard proxies can either be local to the container, orchestrated via Docker Compose, or remote hosts, orchestrated via Ansible~\cite{docker, ansible}. } \begin{figure}[t] \centering \includegraphics[width=0.43\textwidth]{images/embed/CoMPS-WireGuard.pdf}\\ (a) CoMPS-over-WireGuard\\ \includegraphics[width=0.43\textwidth]{images/embed/CoMPS-QUIC.pdf}\\ (b) CoMPS-over-QUIC\\ \includegraphics[width=0.38\textwidth]{images/embed/CoMPS-Mosh.pdf} \\ (c) CoMPS-over-Mosh \caption{Experimental setups for CoMPS with WireGuard, QUIC, and Mosh. Each path is abstracted to the client as a virtual network interface, to mimic how a client might intentionally swap between physical interfaces. } \label{fig:comps-setup} \end{figure} \bheading{Emulating a Multihomed Setup.} We emulated multihoming for client devices in our experiments by providing each device a number of virtual network interfaces. In practice, a user with a multihomed device would not need to do this. \edits{We use Ansible and Docker Compose to orchestrate and manage multiple Docker containers on virtual private servers hosted on Digital Ocean~\cite{ansible, docker}. We use WireGuard to provide virtual network interfaces between containers on separate hosts. The arrows to the WireGuard VPN in Figure~\ref{fig:comps-setup}(a), and the arrows to the Mosh server in Figure~\ref{fig:comps-setup}(c) roughly correspond to WireGuard proxies in our test setup. The code is hosted at https://github.com/inspire-group/comps. } \bheading{Implementing the path scheduler on the client.} Since each path is abstracted to the client as a virtual network interface, we run a process on the client side that continually changes the default network interface via \texttt{ip route}, based on a pre-determined path selection strategy. The path scheduler is thus not on-path for the packets, though it can passively observe them via packet capture. We focus here on consistent-splitting strategies for our website fingerprinting defense evaluation. \bheading{{CoMPS}\xspace-over-WireGuard.} We instantiate {CoMPS}\xspace with $n=3$ network paths in New York City, connecting to a WireGuard server in San Francisco. The WireGuard client can communicate with the WireGuard server over any of these paths. By attaching a container to the same network namespace as the WireGuard client, any and all traffic from that container is routed through this {CoMPS}\xspace instantiation. The traffic is encrypted to the WireGuard server (travelling via one of the $n$ paths), and then forwarded to the intended destination. We use Selenium to orchestrate a Chrome browser to fetch various web sites over this network. \bheading{{CoMPS}\xspace-over-QUIC.} For this experiment, we instantiate {CoMPS}\xspace with several VPN proxies in New York City. This approach is compatible with any VPN protocol, but we use WireGuard VPNs here. In this case, we do not need a multihomed client. Since WireGuard VPN provides a virtual interface, it works well with the path scheduler. The QUIC client shares a network namespace with the WireGuard client which is able to send traffic through any of its peers. The QUIC client is then able to split traffic between remote WireGuard instances. It can also successfully fetch any remote QUIC resource so long as the underlying QUIC server implementation supports connection migration. \edits{For our client, we used a forked version of Chromium’s simple QUIC client to perform connection migration~\cite{mimiq}, since their test client did not support connection migration.} At this time, Chromium's QUIC libraries do support connection migration, although whether it is used actively by the browser varies depending on client support~\cite{chromium_src, mozilla_neqo}. Generally, servers that utilize Google's QUIC libraries also support connection migration. Although connection migration is specified in the RFC, many other implementations of QUIC do not yet support it at this time. Large companies like Cloudflare and Facebook have already announced their intention to implement server-side connection migration~\cite{cloudflare_http3, facebook_quic}. \bheading{{CoMPS}\xspace-over-Mosh.} For Mosh, we implemented a simple test deployment. We instantiated {CoMPS}\xspace with 3 network paths, emulating a multihomed client. We ran an unaltered Mosh remote server located in New York City against which to test our setup, and on the client device, we installed and ran an unaltered Mosh client. \section{Evaluation methodology} \label{sec:evaluation} We evaluate how the {CoMPS}\xspace deployments detailed in Section~\ref{sec:design} perform under the conditions of an adaptive adversary performing website fingerprinting. In addition, we evaluate the relative overhead introduced by both QUIC connection migration and Mosh/WireGuard IP roaming. \subsection{Threat model and defense evaluation} We measure {CoMPS}\xspace against a fully adaptive adversary (i.e. trained on data that is split using the same algorithm) using a neural network-based classifier in the \emph{open-world} setting, as described below. \bheading{The open-world setting.} The study of website fingerprinting attacks (i.e. classifiers) and website fingerprinting defenses are designed to perform under either the \textit{open-world} model or the \textit{closed-world} model. In the closed-world model, the classification task is a multi-label classification problem where the classifier is trained on a set of \textit{n} web pages, and must label any future trace seen as one of these \textit{n} web pages. In the open-world model, the classifier is trained on a set of \textit{n} monitored web pages, as well as some large number of unlabelled unmonitored web pages. The classifier must first determine whether a trace belongs to the monitored set, and then label it. \edits{In this work, we use a train/test split of 9:1.} We prefer evaluations under the open-world model as it describes an adversary who may encounter traffic belonging to new, unknown, or uninteresting web pages, which more realistically emulates the real-world traffic classification task. \bheading{Metrics.} In the open-world model, the attacker must perform two classification tasks: first, a binary classification task to determine whether the trace belongs to a page in the monitored set, and if it is, they must perform an additional multi-class classification task to determine which of the monitored websites the trace belongs to. Metrics for evaluations in the open-world model tend to differ from the closed-world model (a standard multi-class classification task) due to this added complexity. For instance, an accuracy metric that only describes the ratio of correctly labelled traces to incorrectly labelled traces, even if weighted per-class, is not as useful since it does not distinguish between the different types of mistakes that such a classifier can make. We use the open-world evaluation metrics provided by Wang et al.~\cite{wang2018optimizing}, which are more representative of classifier performance. A \emph{true positive} is when the classifier correctly labels a monitored trace. A \emph{wrong positive} is when the classifier labels a monitored trace as a different monitored trace. A \emph{false positive} is when the classifier labels a unmonitored trace as an monitored one. Recall is the rate of labelling a monitored trace as the correct monitored web page, and is equivalent to the true positive rate. Instead of regular precision, we utilize \emph{r-precision}, presented by Wang et. al to more accurately capture the ratio of true positives to total positives~\cite{wang2018optimizing}. \emph{r-precision} scales the false positive rate by the natural base rate of unmonitored to monitored traces in the real world. It is defined as $$\pi_r = \frac{\textrm{TPR}}{\textrm{TPR}+\textrm{WPR} + r \cdot \textrm{FPR}}$$ where $r$ is the expected base rate of unmonitored to monitored web page visits in the real world. As in Wang et. al's work~\cite{wang2018optimizing}, we use $r = 20$ in our evaluation. We also utilize the $F_1$ score, a more balanced depiction of classifier accuracy in the open-world setting. $F_1$ is the harmonic mean of the \emph{r-precision} and recall scores, calculated as $$ F_1 = 2 \cdot \frac{\pi_r \cdot recall}{\pi_r + recall} $$ \bheading{Classifiers using neural networks.} We evaluate {CoMPS}\xspace against state-of-the-art classifiers built on neural network architectures: Deep Fingerprinting, p-FP, and VarCNN~\cite{df, pfp, varcnn}. Rather than using manually-extracted features, these classifiers borrow techniques from deep learning in computer vision by using convolutional neural networks to learn features from the raw packet traces. We elect to use these classifiers to evaluate our splitting defense due to their high classification precision and recall (even against several state-of-the-art defenses)~\cite{df, pfp, varcnn}. \bheading{Limitations of the open-world model.} As explored in prior work, there are some practical limitations to the standard academic study of website fingerprinting~\cite{juarez_critical_2014}. For instance, website fingerprinting experiments generally assign labels to individual traces of automated browsers visiting the homepages of static websites. This hardly maps onto real client web-browsing behavior, where individuals load dynamic streams of content, many pages at a time, and will visit pages other than the homepages of websites. We inherit these practical limitations in our evaluation. However, due to the expanding capabilities of commodity enterprise middleboxes and the growing willingness of state-backed network adversaries to perform more expensive forms of blocking, modelling powerful adversaries helps test the theoretical bounds of our defenses, so users can escape the proverbial ``cat-and-mouse'' game of network privacy and surveillance. \subsection{Evaluation of simulated traffic splitting} Collecting a real-world dataset of traffic splitting for each possible design and parameter choice in our splitting strategy is an expansive task. We thus first sought to determine the effect of path-switching strategy parameters on our classifier performance via simulated traffic splitting experiments. Using an existing dataset of QUIC-over-WireGuard traffic traces for open-world evaluation~\cite{wfquic}, we simulate a variety of splitting strategies across various parameter changes (number of paths, frequency of path switching, and path-switching strategy) while fixing the other parameters. This simulates the type of traffic an adversary might see in both the QUIC experimental setup (which splits QUIC traffic over different WireGuard proxies) as well as the WireGuard experimental setup (which splits any WireGuard traffic over different network paths). By simulating the splitting, evaluating each set of parameters, and determining the ideal parameter choices for {CoMPS}\xspace, we can then perform real-world traffic splitting and data collection in Section~\ref{sec:real-world-eval}. \subsubsection{Path-switching parameters} \bheading{Number of paths.} This is the number of \emph{CoMPS paths} available to the client. Intuitively, splitting traffic across more paths means each potential adversary receives less information about the full network trace. However, realistically a user may not have many paths available to them, although this may change in the future. In our experiment, we vary the number of paths from 2 to 5. \bheading{Frequency of path-switching.} This variable represents how often the scheduler must pick a new path. A higher switching frequency implies there are more variations to how a particular trace may be sliced. The most important tradeoff is that the performance may heavily degrade at high frequencies of path switching by confusing the protocol's congestion control algorithms. We evaluate performance at similar path-switching frequencies that are evaluated for resilience here. \edits{For the simulated data experiments, we primarily use packet-based evaluation (i.e. switching on the order of packets). } \bheading{Path selection strategy.} At each path-switching junction, the scheduler must decide which path to send the next batch of packets. A simple strategy would be to deterministically \textit{round-robin} between each path. We also evaluate a \textit{uniform random} path selection strategy, where the path scheduler selects one of the paths uniformly at random. Lastly, we evaluate a \textit{weighted random} path selection strategy, where the probability distribution between paths is (1) non-uniform, and (2) newly chosen for each connection. For each connection, we sample the path probabilities from a Dirichlet distribution, a splitting technique previously proposed for splitting Tor traffic by De la Cadena et al.~\cite{trafficsliver} \subsubsection{Simulating traffic splitting on a dataset} We use the WireGuard dataset collated by Smith et al.~\cite{wfquic}, which contains both TCP and QUIC traces. \edits{Results on this dataset extend to both {CoMPS}\xspace-over-WireGuard and {CoMPS}\xspace-over-QUIC, as it provides traces of QUIC website traffic collected through WireGuard VPNs.} In total, there are 48,546 QUIC traces. The monitored set contains 100 domains, and the unmonitored set contains 16,182 traces. Monitored domains were sampled 100 times, and unmonitored domains were sampled 3 times \cite{wfquic}. When we simulate splitting for each trace, we break it into subtraces according to the number of \emph{{CoMPS}\xspace paths}. Each subtrace is then considered as a separate trace in the training and test data. \subsubsection{Combining {CoMPS}\xspace with other website fingerprinting defenses} \edits{{CoMPS}\xspace, like other traffic-splitting techniques, can (and should) be combined with any website fingerprinting defense that utilizes obfuscation as its primary tactic.} We test combining {CoMPS}\xspace with WTF-PAD, another low-latency website fingerprinting defense~\cite{wtfpad}. WTF-PAD is a natural fit since its primary mode of operation is to fill in packet timing gaps, caused by {CoMPS}\xspace-like traffic splitting techniques. \subsection{Evaluation and data collection of traffic splitting in the real world} \label{sec:real-world-eval} \edits{We evaluate {CoMPS}\xspace on real-world data by collecting traces of network traffic split using our experimental setup described in Section~\ref{sec:design}.} We perform a website fingerprinting attack evaluation to show that {CoMPS}\xspace provides effective resilience in real-world settings. Similar to the simulated experiments, our real-world data collection is evaluated under the open-world model with a fully adaptive adversary. Using our WireGuard experimental setup depicted in Figure~\ref{fig:comps-setup}(b), we collect a dataset of website traces as a passive network adversary with a limited vantage point might observe them over this {CoMPS}\xspace instantiation. The data collection setup uses 3 different network paths. The path scheduler performs the \emph{weighted random} strategy and switches every 100\,ms across 3 paths, which fits our desired performance constraints. We discuss the results from these initial experiments in Sections~\ref{sec:results-privacy} and \ref{sec:results-perf}. \edits{The dataset can be downloaded from https://github.com/m0namon/comps.} We collect the traces of the top 10,000 websites according to Tranco, Majestic, and Alexa datasets. We combine and de-duplicate these domains, and select the domains that provide QUIC support. This process yielded 4,928 domains that could successfully load over HTTP/3. We select 100 at random to be our monitored dataset, and use the remaining 4,828 websites as unmonitored traces. We fetch each monitored website 50 times, and each unmonitored website once. Since each fetch is split across 3 paths, each fetch produces three separate traces. This dataset is summarized in Table~\ref{tab:dataset}. \begin{table}[t] \centering \begin{tabular}{l|l|l} & Monitored & Unmonitored \\ \hline URLs & 100 & 4,828 \\ \hline Fetches per URL & 50 & 1 \\ \hline \# Paths & 3 & 2-3 \\ \hline Total traces & 15,000 & 14,484 \\ \end{tabular} \begin{tabular}{l|l|l} & Monitored & Unmonitored \\ \hline URLs & 100 & 16,182 \\ \hline Fetches per URL & 100 & 3 \\ \hline Total traces & 10,000 & 48,546 \\ \end{tabular} \caption{Trace distribution for (\textbf{Upper}) our real-world dataset collected using {CoMPS}\xspace~(split across 3 network paths), and (\textbf{Lower}) the QUIC-specific dataset from Smith et al.~\cite{wfquic}.} \label{tab:dataset} \end{table} To collect a website trace, we use Selenium to instrument a Chrome browser to fetch the home page. In the meantime, several \texttt{tcpdump} processes capture the packets sent over each individual network interface. Each of these traces (over different network or WireGuard interfaces) are labelled as separate traces of that particular website. These traces are then converted into a vector of packet timing and sizes, which can then be consumed by website fingerprinting classifiers. \edits{As our threat model includes an adversary who observes one network path between the client and server, network traces from each link are treated as separate traces in the training stage. Recall that since {CoMPS}\xspace does not employ Tor, packet sizes are also visible to adversaries.} \subsection{Performance and overhead evaluation} We describe our methods for evaluating the performance overhead for {CoMPS}\xspace over QUIC, WireGuard, and Mosh. We expect QUIC to incur higher overheads than WireGuard and Mosh due to its use of path validation and the resetting of congestion control parameters when switching to new paths~\cite{quicietf}. The use of single-path congestion control algorithms for multi-path network traffic may also affect all three deployments to varying degrees. We use the experimental setup described in Section~\ref{sec:design} to evaluate the practical overhead of all three protocols. In all setups, we use 2 paths and the weighted random path scheduler. For QUIC and WireGuard \edits{we repeatedly fetch a remote resource until 1 GB of data is transferred. For Mosh, we repeatedly \texttt{cat} a 10\,MB file on a remote server. While each operation is running, the path scheduler is alternating the network path at a variable rate. Each experiment is repeated 10 times.} \section{Conclusion and future work} \label{sec:future} \bheading{{CoMPS}\xspace is practical and effective to deploy as a website fingerprinting defense.} {CoMPS}\xspace exploits various protocols' native capabilities for IP roaming and connection migration for network privacy. We successfully implement {CoMPS}\xspace networks using QUIC, WireGuard, and Mosh; three protocols that support connection migration-like capabilities. We show that it is practical to constantly perform traffic splitting, and it introduces relatively low overhead. With a WireGuard-based {CoMPS}\xspace defense, we can split any network traffic to the WireGuard VPN. In addition, QUIC~(and its connection migration capability) is continually gaining adoption. As Internet protocols develop to adapt to clients with dynamic IP addresses, {CoMPS}\xspace-like splitting to servers will become even more feasible. In addition to its practicality, we also demonstrate that {CoMPS}\xspace enhances resilience against fingerprinting attacks, even against powerful adaptive adversaries. \subsection{Future work} Due to the flexibility of {CoMPS}\xspace, there is much room for further research in evaluating different ways to leverage connection migration for privacy. \bheading{Testing {CoMPS}\xspace for censorship circumvention.} We implement a simple prototype of our censorship circumvention use case (Section~\ref{sec:design}) using a QUIC-based CoMPS defense, which efficiently elides naive handshake censorship by sending handshake packets through an encrypted tunnel outside the censor's jurisdiction before migrating onto the regular network path. However, we did not thoroughly investigate the effectiveness of this technique in this work. \bheading{Evaluating the tradeoff between traffic privacy and traffic visibility.} By splitting traffic across different network paths, {CoMPS}\xspace (and other traffic-splitting systems) potentially expose portions of traffic to more network adversaries. Although each individual adversary may be able to learn less information about client traffic, the traffic is more likely to encounter more adversaries if it is split on multiple paths. This is in some ways similar to the trade-off that Tor users make when selecting the number of guard relays. This tradeoff has been examined in the Tor context~\cite{Dingledine14onefast,alsabah2013splitting}. \bheading{Evaluating splitting across heterogeneous protocols.} We did not fully explore the potential use of splitting a single traffic stream across heterogeneous protocols as a traffic analysis defense, which has never been explored in literature before, but is a possibility with {CoMPS}\xspace. Prior work has found that website fingerprinting models trained on TCP-over-WireGuard traffic do not transfer well to QUIC-over-WireGuard traffic, and vice versa~\cite{wfquic}. When splitting traffic across different encrypted tunneling protocols, we can raise the bar for adversaries by forcing them to account for multiple protocols in their models since fingerprinting models do not transfer well across protocols. \bheading{Using Tor circuits as {CoMPS}\xspace paths.} One avenue for future work is to examine the possibility of using Tor circuits as \emph{{CoMPS}\xspace paths}. Unfortunately, Tor cannot tunnel UDP traffic natively as Tor's session model is currently tightly coupled with TCP~\cite{tor_tcp_only}. Thus, Tor cannot provide support for protocols like QUIC without an additional proxy, or a large engineering effort on the part of the Tor Project. Many Tor developers and researchers have investigated adopting a UDP-based transport such as QUIC as a session-layer for Tor~\cite{datagramtor, udptor, turbotunnel, tor_quic_support_masters, quicTor}. Mathewson and Perry have also examined how switching to a UDP-based transport might affect their current security model~\cite{towards_analysis_udp_tor}. If Tor adopts a more flexible session layer, tunneling UDP packets could be possible. In the future, we would like to explore the implications of UDP-based (QUIC, for instance) traffic splitting over Tor for both censorship circumvention and resistance against traffic fingerprinting by a guard node. Given similar prior work examining traffic splitting over Tor for privacy, it is likely that {CoMPS}\xspace would perform well~\cite{trafficsliver, yang_enhancing_2015,pennekamp_multipathing_2019}. In summary, as surveillance of users' network communications continues to become more prevalent and sophisticated, CoMPS offers a powerful new framework for resisting traffic analysis. \section{Introduction} \label{sec:intro} An individual's privacy today is closely tied to their network traffic. Malicious actors may devote vast resources to install network-control devices, either for commercial gain or to exert other forms of control. The use of encrypted VPNs and Tor \cite{WireGuard_17, tor_04} for both privacy and censorship circumvention has skyrocketed in recent years as individuals counteract these trends. However, extensive research into traffic analysis techniques show that \emph{website fingerprinting} is feasible. Researchers have shown that encrypted Tor or VPN traffic can be fingerprinted, as each website exhibits unique packet-size and timing patterns that can be learned~\cite{frontglue, kfp, knnwfp, df}. Many recent state-of-the-art defenses against website fingerprinting have shifted from obfuscating traffic to limiting the amount of information that the adversary can use to label a particular flow. Works like TrafficSliver \cite{trafficsliver}, which performs Tor-specific network-level splitting, and HyWF \cite{hywf}, which leverages multipath TCP, have demonstrated that splitting traffic across different network paths to limit the amount of information available to any network adversary is successful at thwarting many state-of-the-art website fingerprinting attacks. However, both these techniques face deployment challenges as they are specific to a particular proxy implementation or multipath TCP. In this paper, we exploit the observation that in order to improve performance on mobile clients, a growing number of encrypted protocols are no longer dependent on IP addresses and ports as identifiers, as in TCP. This feature is present in QUIC, WireGuard, and Mosh~\cite{quicietf, WireGuard_17, mosh}. This capability to switch network addresses is referred to as \emph{connection migration} in QUIC, and \emph{IP roaming} in WireGuard and Mosh. We present a general framework that is deployable with any service supporting connection migration to foil powerful adversaries performing traffic analysis, surveillance, and selective censorship. Our system exploits connection migration features to support mid-session traffic splitting across heterogeneous paths and protocols. Our Connection Migration Powered Splitting~({CoMPS}\xspace) framework is extremely flexible, as it enables clients to send packets over any network path or protocol available to the client \footnote{https://github.com/inspire-group/comps}. For instance, a multihomed device can utilize any of the network paths available to it. If the device has VPNs or proxies configured, the client can utilize those as separate \emph{{CoMPS}\xspace paths} as well, so long as the original packet is delivered to the intended destination server and port. Previous traffic-splitting work has been limited to a particular protocol (such as Tor or multipath TCP), or limited to one network path with a co-operating router deployed~\cite{trafficsliver, mimiq, hywf}. We demonstrate the resilience of website fingerprinting defenses constructed with {CoMPS}\xspace. We evaluate {CoMPS}\xspace as a website fingerprinting defense using both simulations over a dataset of QUIC website traces tunneled through WireGuard and a real-world dataset of around 30,000 QUIC website traces tunneled through WireGuard, split across {CoMPS}\xspace. In our real-world splitting experiment, our results show that {CoMPS}\xspace is highly effective in providing resilience against state-of-the-art website fingerprinting attacks. We show that {CoMPS}\xspace is also practical to deploy because of its low performance and implementation overhead. We successfully deploy {CoMPS}\xspace for unaltered QUIC, WireGuard, and Mosh servers, and demonstrate that the throughput impact for an effective splitting schedule is only around 5-6\% for WireGuard servers, around 10-20\% for QUIC servers, and around 4-5\% for Mosh servers. Beyond website fingerprinting --- our primary focus in this work --- we also discuss how {CoMPS}\xspace can enable a novel keyword-censorship circumvention method: the user can identify sensitive traffic (for instance, DNS requests, or a handshake containing the TLS SNI) to send over a high-latency path offered by a censorship circumvention mechanism, and migrate to the regular network path for the remainder of the session. We encourage the community to explore other privacy use cases of {CoMPS}\xspace, and we will open source our framework to facilitate this. \section*{Acknowledgement} We are grateful to Jonathan Mayer for insights that helped us refine this work. We are also grateful to anonymous reviewers and numerous HoTPETs 2021 attendees for their invaluable feedback. \edits{This work was supported by the National Science Foundation under grants CNS-1553437 and CNS-1704105, by DARPA under grant FA8750-19-C-0079, and in part, by the Ripple University Blockchain Research Initiative.} \bibliographystyle{IEEEtranS} \subsection{Performance} \begin{figure} \centering \includegraphics[height=0.25\textwidth]{images/pr-packet.png} \includegraphics[height=0.25\textwidth]{images/pr-time.png} \caption{$r$-Precision v/s Recall curves from the simulated splitting experiments. On the left, we use packet-based splitting at a frequency of 50 packets. On the right, we use time-based splitting at a frequency of 100ms. We evaluate simulated {CoMPS}\xspace against Deep Fingerprinting, VarCNN, and p-FP. For both experiments, we use the \emph{weighted random} strategy across 3 paths.} \label{fig:simulated-defense} \end{figure} \begin{figure*} \centering \begin{tabular}{cccc} \includegraphics[height=0.23\textwidth]{images/compare-dfnet-strategy.png} & \includegraphics[height=0.23\textwidth]{images/compare-dfnet-batch-size.png} & \includegraphics[height=0.23\textwidth]{images/paths-wr.png} & \includegraphics[height=0.23\textwidth]{images/compare-dfnet-comparing-combined.png} \\ (a) Varying strategy & (b) Varying switching frequency& (c) Varying number of paths & (d) Combining defenses\\[6pt] \end{tabular} \caption{$r$-Precision v/s Recall curves for the parameter experiments performed on simulated dataset. Our default setup used the \emph{weighted random} strategy, a path switching frequency of 50 packets, and three paths. (a) varies the switching strategy, (b) varies the switching frequency, and (c) varies the number of paths. (d) combines {CoMPS}\xspace best performing strategy with WTF-PAD. {CoMPS}\xspace is evaluated against the Deep Fingerprinting classifier \cite{df}. } \label{fig:pr-curve} \end{figure*} \section{Resilience against website fingerprinting attacks} \label{sec:results-privacy} In this section, we discuss our evaluations of {CoMPS}\xspace as a website fingerprinting defense, using simulated splitting as well as real-world splitting. \begin{table}[t] \centering \begin{tabular}{ll|r|r|r} \cline{3-5} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{$r$-Precision} & \multicolumn{1}{c|}{Recall} & \multicolumn{1}{c}{$F_1$} \\ \hline \multicolumn{1}{l|}{\multirow{2}{*}{DF}} & no defense & 0.708 & 0.993 & 0.827 \\ \cline{2-5} \multicolumn{1}{l|}{} & defended & 0.416 & 0.329 & 0.367 \\ \hline \hline \multicolumn{1}{l|}{\multirow{2}{*}{p-FP(C)}} & no defense & 0.827 & 0.801 & 0.814 \\ \cline{2-5} \multicolumn{1}{l|}{} & defended & 0.415 & 0.007 & 0.014 \\ \hline \hline \multicolumn{1}{l|}{\multirow{2}{*}{VarCNN}} & no defense & 0.939 & 0.953 & 0.946 \\ \cline{2-5} \multicolumn{1}{l|}{} & defended & 0.462 & 0.061 & 0.107 \\ \hline \end{tabular} \caption{Comparison of $r$-precision, recall, and $F_1$ on simulated splitting data across different classifiers. In this experiment, we use the \emph{weighted random} strategy across 3 paths and a switching frequency of 50 packets.} \label{tab:diff-classifiers} \end{table} \subsection{Evaluation of WireGuard traffic splitting via simulated dataset} \label{sec:results-simulated} In the experiments discussed here, we used a path scheduler using the \emph{weighted random} strategy, switching every 50 packets, across 3 paths. In Section~\ref{sec:comps-param-results}, we vary each of these parameters individually. \bheading{{CoMPS}\xspace is effective against Deep Fingerprinting, p-FP, and VarCNN.} As shown in Figure~\ref{fig:simulated-defense} and Table~\ref{tab:diff-classifiers}, {CoMPS}\xspace performs well against multiple state-of-the-art website fingerprinting classifiers, significantly reducing both precision and recall compared to the baseline scenario. It performed especially well against the p-FP model, taking $r$-precision and recall down to 41.5\% and 0.7\% in the simulated splitting experiment from Table~\ref{tab:diff-classifiers}. The VarCNN classifier also achieved low recall, with precision and recall of 46.2\% and 6.1\%, and Deep Fingerprinting performed the best, at 41.6\% and 32.9\% precision and recall. \bheading{Combining {CoMPS}\xspace with WTF-PAD lowers website fingerprinting attack performance significantly.} In Figure~\ref{fig:pr-curve}(d), we demonstrate the effects of combining our best performing strategy with WTF-PAD. As also shown in Table~\ref{tab:combo_defense}, combining WTF-PAD with {CoMPS}\xspace decreases classifier $r$-precision to 13.5\% and recall to 30.8\% on a simulated dataset. We thus show that not only is traffic splitting via {CoMPS}\xspace an effective defense against a powerful and adaptive website fingerprinting adversary for WireGuard traffic, it can also be combined with other zero-latency website fingerprinting defenses to provide even stronger resilience. \begin{table}[t] \centering \begin{tabular}{l|r|r|r} \hline & \multicolumn{1}{c|}{\textbf{$r$-Precision}} & \multicolumn{1}{c|}{\textbf{Recall}} & \multicolumn{1}{c}{\textbf{$F_1$}} \\ \hline No Defense & 0.708 & 0.993 & 0.827 \\ \hline WTF-PAD & 0.348 & 0.957 & 0.510 \\ \hline {CoMPS}\xspace & 0.416 & 0.329 & 0.367 \\ \hline WTF-PAD $+$ {CoMPS}\xspace & 0.135 & 0.308 & 0.187 \\ \hline \end{tabular} \caption{Comparison of $r$-precision, recall, and $F_1$ across different defenses. The path scheduler used the \emph{weighted random} strategy across 3 paths with a switching frequency of 50 packets. These were evaluated with the Deep Fingerprinting classifier \cite{df}.} \label{tab:combo_defense} \end{table} \begin{table}[t] \centering \begin{tabular}{c|c|c|r|r|r} \hline \textbf{Strategy} & \textbf{Batch Size} & \textbf{Paths} & \multicolumn{1}{c|}{\textbf{$r$-Precision}} & \multicolumn{1}{c|}{\textbf{Recall}} & \multicolumn{1}{c}{\textbf{$F_1$}} \\ \hline \multicolumn{3}{c|}{\textbf{No Defense}} & 0.708 & 0.993 & 0.827 \\ \hline RR & 50 & 3 & 0.743 & 0.774 & 0.758 \\ \hline UR & 50 & 3 & 0.492 & 0.447 & 0.468 \\ \hline WR & 50 & 3 & 0.416 & 0.329 & 0.367 \\ \hline \hline WR & 50 & 2 & 0.582 & 0.511 & 0.544 \\ \hline WR & 50 & 5 & 0.523 & 0.246 & 0.334 \\ \hline \hline WR & 200 & 3 & 0.681 & 0.477 & 0.561 \\ \hline WR & 100 & 3 & 0.509 & 0.412 & 0.455 \\ \hline \end{tabular} \caption{Comparison of $r$-precision, recall, and $F_1$ across varying of path-switching strategies, path-switching frequencies, and path numbers. The Round Robin~(\textbf{RR}) strategy round-robins between the paths in a consistent order. The Uniform Random~(\textbf{UR}) strategy chooses a path uniformly at random. The Weighted Random~(\textbf{WR}) strategy samples the paths from a new non-uniform probability distribution for every connection. These were evaluated with the Deep Fingerprinting classifier \cite{df}.} \label{fig:eval:merged} \end{table} \subsubsection{Evaluating {CoMPS}\xspace parameters} \label{sec:comps-param-results} This section refers to results in Figure~\ref{fig:pr-curve} and Table~\ref{fig:eval:merged}, where we examine the impact of different parameters on {CoMPS}\xspace's resilience against website fingerprinting. Our default setup used the (1) \emph{weighted random} strategy, (2) a path switching frequency of 50 packets, and (3) three paths. For each experiment, we varied one of these parameters. Since Deep Fingerprinting performed the best in our experiment in Figure~\ref{fig:simulated-defense}, we use that classifier for our evaluations here. \bheading{The weighted random strategy performs the best compared to the other path-scheduling strategies, as shown in Figure~\ref{fig:pr-curve}(a).} The deterministic round-robin strategy provides weaker resilience in comparison. Randomly choosing paths (as in the \emph{uniform random} strategy) improves the resilience, as the sampling pattern is no longer deterministic and thus more difficult for the attacker to learn. Finally, we find that the \emph{weighted random} strategy of choosing a new random distribution per-trace outperforms choosing paths uniformly at random. \bheading{Higher path-switching frequencies improve resilience against website fingerprinting attacks, as shown in Figure~\ref{fig:pr-curve}(b).} A higher path-switching frequency increases the number of possible ways {CoMPS}\xspace can split and sample the traffic, as there are more decision junctures throughout the packet trace. Many website traces are shorter than 1,000 packets; so a 200-packet switching frequency may only imply a few path switches during the connection. \bheading{Increasing number of paths improves resilience against website fingerprinting attacks.} Increasing the number of paths reduces the success of website fingerprinting classifiers, producing significant privacy gains even with just 2-3 paths. The experiment shown in Figure~\ref{fig:pr-curve}(c) was performed using the \emph{weighted random} strategy. While increasing the number of paths to 5 provides further gains in privacy, this design choice may not be practical for regular users, who are unlikely to have access to 5 separate network paths, even in the future. Since we want our system to be deployable, we primarily performed evaluations with 3 paths rather than 5. \edits{ \bheading{Splitting on time-based boundaries achieves similar results to packet-based boundaries.} To address the discrepancy between the time-based and packet-based boundaries used for the real-world and simulated experiments, respectively, we demonstrate that simulated splitting at an equivalent packet frequency (100\,ms and 50 packets) with the same weighted random strategy yields similar results, with the full PR curve illustrated in Figure~\ref{fig:simulated-defense}. With the DF classifier, splitting at 100\,ms with weighted random yields 28.1\% r-precision 25.1\% recall, respectively. This is very close to the performance of the classifier when trained on data that is split via the 50-packet boundary, which achieved 41.6\% r-precision and 32.9\% recall, respectively. } \subsection{Evaluation of WireGuard traffic splitting in the real world} \bheading{Our real world experiment confirms {CoMPS}\xspace’ ability to mitigate website fingerprinting.} We evaluate Deep Fingerprinting (DF), p-FP, and VarCNN on the real-world dataset split over {CoMPS}\xspace using the \emph{weighted random} strategy, split across 3 paths, and a path-switching frequency of 100\,ms. This experiment was performed by switching at millisecond boundaries rather than a fixed number of packets due to the simplicity of the former implementation. Surprisingly, VarCNN performed better on the real-world dataset than on our dataset from simulated splitting, and Deep Fingerprinting performed worse on the real dataset. \edits{This might be partly due to VarCNN's design focus for low-data scenarios, as our real-world dataset is smaller than the simulated one.} The differences show the importance of experimenting with multiple classifiers, and the collection of real-world data. Deep Fingerprinting achieved $r$-precision and recall of 12.4\% and 34.9\%, the p-FP model achieved $r$-precision and recall of 12.6\% and 12.1\%, and the VarCNN model performed the best, with an $r$-precision and recall of 29.9\% and 36.7\% respectively. \begin{table}[t] \centering \begin{tabular}{l|r|r|r} & \textbf{$r$-Precision} & \textbf{Recall} & \textbf{$F_1$} \\ \hline \textbf{DF} & 0.124 & 0.349 & 0.183 \\ \hline \textbf{p-FP(C)} & 0.126 & 0.121 & 0.123 \\ \hline \textbf{VarCNN} & 0.299 & 0.367 & 0.329 \\ \hline \end{tabular} \caption{Comparison of $r$-precision, recall, and $F_1$ across real-world splitting data across different classifiers. Dataset collection is described in Section~\ref{sec:real-world-eval}.} \label{tab:real-world} \end{table} \section{Overhead of traffic splitting} \label{sec:results-perf} We now summarize our results from performance experiments with {CoMPS}\xspace. Recall that the performance experiments were performed by time-based boundaries rather than packet-based boundaries due to the simplicity of the implementation. In our real-world data, the average throughput is approximately 500 packets/second. The 50 packet switching frequency from our simulated analysis in Section~\ref{sec:results-simulated} is thus approximately equivalent to 100\,ms path switching frequency for the real-world experiments. Our simulated results in Figure~\ref{fig:simulated-defense} generally show that time-based splitting at a frequency of 100\,ms achieves similar resilience against state-of-the-art neural networks to the equivalent packet-based splitting (every 50 packets). \begin{figure*}[t] \centering \begin{tabular}{cccc} \includegraphics[width=0.25\textwidth]{images/thruput-wg.png}& \includegraphics[width=0.25\textwidth]{images/thruput-quic-2.png} & \includegraphics[width=0.25\textwidth]{images/thruput-mosh.png} \\ (a) {CoMPS}\xspace-over-WireGuard & (b) {CoMPS}\xspace-over-QUIC & (d) {CoMPS}\xspace-over-Mosh \\ \end{tabular} \caption{Comparison of impact on throughput vs path-switching frequency for {CoMPS}\xspace-over-WireGuard, {CoMPS}\xspace-over-QUIC, and {CoMPS}\xspace-over-Mosh (left-to-right). The red line is the average baseline throughput without path switching. The path scheduler randomly selects one of three paths at the specified frequency.} \label{fig:thruput} \end{figure*} \textbf{{CoMPS}\xspace-over-WireGuard has low throughput overhead, with as little as 5–10\% overhead at reasonable switching frequencies, as shown in figure~\ref{fig:thruput}(a).} {CoMPS}\xspace-over-WireGuard, the system we use to perform our real-world website fingerprinting evaluation, has quite low overhead at the 100\,ms switching frequency. We show that similar switching frequencies also provide reasonable resilience in our privacy evaluation in Section~\ref{sec:results-privacy}. Using faster switching frequencies (less than 40\,ms) leads to a reduction in throughput, and only offers marginal gains in our privacy evaluation. \textbf{{CoMPS}\xspace-over-QUIC has a 10–25\% throughput overhead at switching frequencies that provide resilience against website fingerprinting, as shown in Figure~\ref{fig:thruput}(b) and (c).} \edits{The larger amount of overhead from QUIC path migration is primarily due to path validations.} If path validations are cached, the performance impact would decrease for reasonable switching frequencies. At frequencies faster than switching every 30\,ms, the repeated need for path validation caused too many retransmission timeouts. To mitigate these performance effects, we encourage QUIC services to cache path validations. \textbf{{CoMPS}\xspace-over-Mosh has very little deterioration in performance overhead relative to switching frequency, as shown in Figure~\ref{fig:thruput}(d)}. Even at the unreasonably fast 10\,ms switching period, the average throughput overhead is less than 5\%. The low performance impact relative to QUIC or WireGuard is because Mosh generally does not transmit high-volume traffic, even if the remote terminal is updating quickly. Mosh adapts the frame rate of screen updates according to the expected connection RTT~\cite{mosh}. \textbf{Mosh and WireGuard performance are less affected by traffic splitting than QUIC.} Across Figure~\ref{fig:thruput}, we can compare how QUIC performance degrades more dramatically at higher frequencies, while WireGuard and Mosh performance is less impacted. We hypothesize that this is due to the congestion control window being reset on every path switch for QUIC. The connection fails to exit the slow-start phase of the connection, leading to a drop-off in performance when the switching occurs too often. Nevertheless, at reasonable switching frequencies, the overhead is as little as 4-6\% for both WireGuard and Mosh and 10-20\% for QUIC. \edits{For comparison, experiments on TrafficSliver estimate a 20\% throughput overhead and WTF-PAD incurs a 60\% bandwidth overhead~\cite{trafficsliver, wtfpad}.}
\section{Introduction} The Standard Model (SM) effective field theory, commonly known as SMEFT~\cite{Brivio:2017vri}, is currently one of the most popular descriptions of the elementary particles and their interactions; mostly because it can correctly account for experimental observations not well explained within the SM alone without conflicting with the null results for resonant searches encountered at different experiments and in particular at the LHC. The appeal of the SMEFT also relies on the very mild assumptions on which it is built, namely the validity of the SM gauge symmetry $SU(3)_c\times SU(2)_L\times U(1)_Y$ and the presence of a mass gap between the electroweak (EW) scale and the new physics threshold. In the absence of lepton-number violation (LNV), the dimension-six terms of the SMEFT naively provide the dominant corrections to SM predictions in low-energy observables. In recent years though, the next tower of operators, namely those of dimension eight, are being more and more scrutinised both from the theory and experimental points of view~\cite{Alioli:2022fng}. One important reason for this is that, in a number of observables, the leading dimension-six contributions vanish~\cite{Azatov:2016sqh}. A more striking motivation is that dimension-eight operators are the first ones subject to the so-called positivity constraints, which are theoretical bounds on the signs of certain (combinations of) Wilson coefficients implied solely by the principles of unitarity and analyticity of the $S$-matrix~\cite{Adams:2006sv}. Thus, any experimental evidence of a violation of these constraints would indicate the invalidity of the EFT approach (for example, due to the existence of new light degrees of freedom) or even the breakdown of some of the fundamental principles of modern physics. In a previous work~\cite{Chala:2021pll}, we started efforts to renormalise the SMEFT to order $v^4/\Lambda^4$ (with $v\sim 246$ GeV being the Higgs vacuum expectation value), thus including dimension-eight interactions. In that paper, the renormalisation group evolution of the bosonic sector of the SMEFT driven by pairs of dimension-six interactions at one-loop was computed. In this article, we focus on the renormalisation of the same set of operators but as triggered by dimension-eight terms. It is worth mentioning that, during the course of the work presented in this paper, a number of results related to the renormalisation of the dimension-eight SMEFT were presented in Ref.~\cite{AccettulliHuber:2021uoa}. These include the renormalisation group evolution (RGE) of both bosonic and fermionic operators, but restricted to linear order in the Higgs quartic parameter and to quadratic order in the gauge couplings. We do compute the higher-power corrections, which in particular induce (otherwise absent) mixing between several operators. Corrections to lower-dimensional operators, proportional to the Higgs squared mass, that we also include here, were disregarded in Ref.~\cite{AccettulliHuber:2021uoa} too. This article is structured as follows. In section~\ref{sec:theory} we introduce our notation and provide details on the calculation procedure. In section~\ref{sec:rges} we discuss the structure of the anomalous dimension matrix, drawing special attention to (i) elements that depart significantly from their naive power counting estimate; and (ii) interactions that, despite arising only at loop-level in renormalisable models of new physics, are renormalised by operators that can be generated at tree level. (We do not provide explicit expressions of all the RGEs in the text; they can be instead found in an auxiliary file on \htmladdnormallink{github.com/SMEFT-Dimension8-RGEs}{https://github.com/SMEFT-Dimension8-RGEs}.) In section~\ref{sec:positivity}, we discuss the behaviour of some positivity bounds under the quantum corrections derived in this paper. We conclude in section~\ref{sec:conclusions}. We dedicate Appendix~\ref{app:comparison} to comparing our results with those obtained in Ref.~\cite{AccettulliHuber:2021uoa}. \section{Theory and conventions} \label{sec:theory} The SMEFT Lagrangian is an expansion in inverse powers of the cutoff $\Lambda\gg v$. Assuming lepton-number conservation, it reads: \begin{align} % \mathcal{L}_\text{SMEFT} = \mathcal{L}_\text{SM} + \frac{1}{\Lambda^2}\sum_i c_i^{(6)} \mathcal{O}_i^{(6)} + \frac{1}{\Lambda^4}\sum_j c_j^{(8)}\mathcal{O}_j^{(8)} + \cdots % \end{align} where $\mathcal{L}_\text{SM}$ represents the SM dimension-four Lagrangian and, in our convention, $i$ and $j$ run over the operators in the bases of dimension-six and dimension-eight interactions given in Refs.~\cite{Grzadkowski:2010es} (the ``Warsaw'' basis) and \cite{Murphy:2020rsh}, respectively. \mc{We borrow the notation for the Wilson coefficients from this reference.} The ellipses encode operators of dimension ten and higher. We write the renormalisable SM Lagrangian as follows: \begin{align}\nonumber \mathcal{L}_\text{SM} = & -\frac{1}{4}G_{\mu\nu}^{A}G^{A\,\mu\nu} -\frac{1}{4}W_{\mu\nu}^{a}W^{a\,\mu\nu} -\frac{1}{4}B_{\mu\nu}B^{\mu\nu}\\\nonumber % & +\overline{q_{L}^{\alpha}}\ensuremath{\mathrm{i}}\slashed{D}q_{L}^{\alpha} +\overline{l_{L}^{\alpha}}\ensuremath{\mathrm{i}}\slashed{D}l_{L}^{\alpha} +\overline{u_{R}^{\alpha}}\ensuremath{\mathrm{i}}\slashed{D}u_{R}^{\alpha} +\overline{d_{R}^{\alpha}}\ensuremath{\mathrm{i}}\slashed{D}d_{R}^{\alpha} +\overline{e_{R}^{\alpha}}\ensuremath{\mathrm{i}}\slashed{D}e_{R}^{\alpha} \\ % & +\left(D_{\mu}\phi\right)^{\dagger}\left(D^{\mu}\phi\right) +\mu^{2}|\phi|^{2}-\lambda|\phi|^{4} -\left( y_{\alpha\beta}^{u}\overline{q_{L}^{\alpha}}\widetilde{\phi}u_{R}^{\beta} +y_{\alpha\beta}^{d}\overline{q_{L}^{\alpha}}\phi d_{R}^{\beta} +y_{\alpha\beta}^{e}\overline{l_{L}^{\alpha}}\phi e_{R}^{\beta} +\text{h.c.}\right)~. % \end{align} We denote by $e$, $u$ and $d$ the right-handed leptons and quarks; while $l$ and $q$ stand for the left-handed counterparts. The letters $W, B$ and $G$ refer to the EW gauge bosons and the gluon, respectively. We represent the Higgs doublet by $\phi = (\phi^+, \phi^0)^T$, and $\tilde{\phi} = \ensuremath{\mathrm{i}}\sigma_2\phi^*$ with $\sigma_I$ ($I=1,2,3$) being the Pauli matrices. Our expression for the covariant derivative is: \begin{equation} % D_\mu = \partial_\mu - \ensuremath{\mathrm{i}} g_1 Y B_\mu -ig_2\frac{\sigma^I}{2} W_\mu^I -\ensuremath{\mathrm{i}} g_3\frac{\lambda^A}{2} G_\mu^A\,, % \end{equation} where $g_1, g_2$ and $g_3$ represent, respectively, the $U(1)_Y$, $SU(2)_L$ and $SU(3)_c$ gauge couplings, $Y$ stands for the hypercharge and $\lambda^A$ are the Gell-Mann matrices. To order $v^4/\Lambda^4$ and assuming lepton-number conservation, the dimension-eight Wilson coefficients are only renormalised by dimension-eight couplings themselves, proportional to renormalisable terms, as well as by pairs of dimension-six interactions. Schematically: \begin{equation}\label{eq:gprime} \dot{c}_i^{(8)} \equiv 16\pi^2\tilde{\mu} \frac{d c_{i}^{(8)}}{d\tilde{\mu}} = \gamma_{ij} c_j^{(8)} + \gamma_{ijk}' c_j^{(6)}c_k^{(6)}\,. \end{equation} The anomalous dimensions $\gamma_{ijk}'$ in the bosonic sector were computed in Ref.~\cite{Chala:2021pll}. In this work, we focus on the $\gamma_{ij}$ counterpart. The dimension-eight terms renormalise lower-dimensional interactions too, proportional to $\mu^2$. We also calculate these corrections in this work. We carry renormalisation by computing the divergences of the operators in the basis of independent Green's functions of Ref.~\cite{Chala:2021cgt}, which extends the basis of independent physical operators of Ref.~\cite{Murphy:2020rsh}. The former operators can be projected onto the latter using the relations derived through the equations of motion in Ref.~\cite{Chala:2021cgt}. This procedure ensures that only off-shell 1-particle irreducible Feynman diagrams have to be considered \mc{in the calculation.} For the computations of the diagrams, we use \texttt{FeynArts}~\cite{Hahn:2000kx} and \texttt{FormCalc}~\cite{Hahn:1998yk} using the \texttt{Feynrules}~\cite{Alloul:2013bka} model provided in Ref.~\cite{Chala:2021cgt}, too. We work in dimensional regularisation with space-time dimension $\text{d}=4+2\epsilon$, using the background field method and the Feynman gauge. We have cross checked most of our results (with perfect agreement in all cases) with the help of \texttt{matchmakereft}~\cite{Carmona:2021xtq}. In fact, for the calculation of eight-Higgs processes we have relied entirely on this latter tool. We neglect loops with insertions of operators that can arise only at loop-level in weakly-coupled UV completions of the SMEFT~\cite{Craig:2019wmo}, as these effects are formally two-loop corrections. \section{Structure of the anomalous dimension matrix} \label{sec:rges} \begin{table}[t] % \begin{center} \resizebox{0.9\textwidth}{!}{\begin{tabular}{c|ccccccccc} % \toprule % & $\phi^4 D^4$ & $B\phi^4 D^2$ & $W\phi^4 D^2$ & $B^2\phi^4$ & $W^2\phi^4$ & $WB\phi^4$ & $G^2\phi^4$ & $\phi^6 D^2$ & $\phi^8$\\\midrule % \textcolor{gray}{$B^2 \phi^2 D^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_1^2$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$W^2 \phi^2 D^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_2^2$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$WB \phi^2 D^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_1 g_2$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$G^2 \phi^2 D^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$W^3 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$W^2 B \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % \textcolor{gray}{$G^3 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % $\phi^4 D^4$ & $\mrr{g_2^2}$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % $B\phi^4 D^2$ & $g_1g_2^2$ & $\mrr{\lambda}$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % $W\phi^4 D^2$ & $g_2^3$ & 0 & $g_2^2$ & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % $B^2\phi^4$ & $g_1^2 g_2^2$ & $g_1 \lambda$ & $g_1^2 g_2$ & $\mrr{\lambda}$ & 0 & $g_1 g_2$ & 0 & 0 & 0 \\[0.1cm] % $W^2\phi^4$ & $g_2^4$ & $g_1 g_2^2$ & $g_2^3$ & 0 & $\mrr{\lambda}$ & $g_1 g_2$ & 0 & 0 & 0 \\[0.1cm] % $WB\phi^4$ & $g_1 g_2^3$ & $g_2 \lambda$ & $g_1 \lambda$ & $g_1 g_2$ & $g_1 g_2$ & $\mrr{\lambda}$ & 0 & 0 & 0 \\[0.1cm] % $G^2\phi^4$ & 0 & 0 & 0 & 0 & 0 & 0 & $\mrr{g_3^2}$ & 0 & 0 \\[0.1cm] % $\phi^6 D^2$ & $\mrr{g_2^4}$ & $ \mrr{g_1 \lambda}$ & $\mrr{g_2 \lambda}$ & 0 & 0 & 0 & 0 & $\mrr{\lambda}$ & 0 \\[0.1cm] % $\phi^8$ & $\mrr{\lambda^3}$ & $\mrr{g_1\lambda^2}$ & $\mrr{g_2\lambda^2}$ & $\mrr{g_1^2 \lambda}$ & $\mrr{g_2^2 \lambda}$ & $\mrr{g_1 g_2\lambda}$ & 0 & $\mrr{\lambda^2}$ & $\mrr{\lambda}$\\[0.1cm] % \bottomrule % \end{tabular} % } \end{center} % \caption{\it Structure of the bosonic-bosonic dimension-eight anomalous dimension matrix. The entries indicate the order in SM couplings of the leading contribution. Those in blue represent terms that deviate significantly from naive dimensional analysis. The operators in gray can only arise at loop-level in weakly-coupled UV completions of the SMEFT. The shaded cells indicate those of the latter operators that are renormalised by interactions that can be generated at tree level.}\label{tab:dim8adm} % \end{table} \begin{table}[t] % \begin{center} \resizebox{\textwidth}{!}{\begin{tabular}{c|cccccccccc} % \toprule % & $\psi^2 B \phi^3$ & $\psi^2 W \phi^3$ & $\psi^2 G \phi^3$ & $\psi^2 \phi^2 D^3$ & $\psi^2\phi^5$ & $\psi^2\phi^4 D$ & $\psi^2 B\phi^2 D$ & $\psi^2 W\phi^2 D$ & $\psi^2 G\phi^2 D$ & $\psi^2 \phi^3 D^2$\\\midrule % \textcolor{gray}{$B^2 \phi^2 D^2$} & 0 & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8} $ g_1^2 $ & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$W^2 \phi^2 D^2$} & 0 & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8} $ g_2^2 $ & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$WB \phi^2 D^2$} & 0 & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8} $ g_1 g_2 $ & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$G^2 \phi^2 D^2$} & 0 & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8} $ g_3^2 $ & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$W^3 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$W^2 B \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$G^3 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % $\phi^4 D^4$ & 0 & 0 & 0 & \mrr{$ |y^t|^2 $} & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % $B\phi^4 D^2$ & 0 & 0 & 0 & \mrr{$g_1 |y^t|^2 $} & 0 & 0 & \mrr{$ |y^t|^2 $} & 0 & 0 & $ g_1 y^t $\\[0.1cm] % $W\phi^4 D^2$ & 0 & 0 & 0 & \mrr{$g_2 |y^t|^2 $} & 0 & 0 & 0 & \mrr{$ |y^t|^2 $} & 0 & $ g_2 y^t $\\[0.1cm] % $B^2\phi^4$ & $ g_1 y^t $ & 0 & 0 & $g_1^2 |y^t|^2 $ & 0 & 0 & $ g_1 |y^t|^2 $ & 0 & 0 & $ g_1^2 y^t $\\[0.1cm] % $W^2\phi^4$ & 0 & $ g_2 y^t $ & 0 & $g_2^2 |y^t|^2 $ & 0 & $ g_2^2 $ & 0 & $ g_2 |y^t|^2 $ & 0 & $ g_2^2 y^t $\\[0.1cm] % $WB\phi^4$ & $ g_2 y^t $& $ g_1 y^t $ & 0 & $g_1 g_2 |y^t|^2 $& 0 & $ g_1 g_2 $ & $ g_2 |y^t|^2 $ & $ g_1 |y^t|^2 $ & 0 & $ g_1 g_2 y^t $\\[0.1cm] % $G^2\phi^4$ & 0 & 0 & $ g_3 y^t $ & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % $\phi^6 D^2$ & 0 & 0 & 0 & \mrr{$g_2^2 |y^t|^2 $} & 0 & \mrr{$ |y^t|^2 $} & $ g_1 |y^t|^2 $ & \mrr{$ g_2 |y^t|^2 $} & 0 & \mrr{$y^t |y^t|^2$ } \\[0.1cm] % $\phi^8$ & 0 & 0 & 0 & \mrr{$ \lambda |y^t|^4 $} & \mrr{$ y^t |y^t|^2 $} & \mrr{$ \lambda |y^t|^2 $} & $ g_1 \lambda |y^t|^2 $ & \mrr{$g_2 \lambda |y^t|^2 $} & 0 & \mrr{$\lambda y^t |y^t|^2$}\\[0.1cm] % \bottomrule % \end{tabular} % } \end{center} % \caption{\it \mc{Same as Tab.~\ref{tab:dim8adm} but for the bosonic-fermionic anomalous dimension matrix.}}\label{tab:dim8adm2} % \end{table} \begin{table}[t] % \begin{center} \resizebox{0.9\textwidth}{!}{\begin{tabular}{c|cccccccccccc} % \toprule % & $\phi^4 D^4$ & $B\phi^4 D^2$ & $W\phi^4 D^2$ & $B^2\phi^4$ & $W^2\phi^4$ & $WB\phi^4$ & $G^2\phi^4$ & $\phi^6 D^2$ & $\phi^8$\\\midrule % $\phi^2$ & $ \mu^6 $ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\[0.1cm] % % $\phi^4$ & $ \mrr{\lambda \mu^4} $ & $ g_1 \mu^4 $ & $ \mrr{g_2 \mu^4} $ & 0 & 0 & 0 & 0 & $ \mu^4 $ & 0 \\\midrule % % % % % \textcolor{gray}{$B^2 \phi^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_1^2 \mu^2$ & \cellcolor[rgb]{0.8,0.8,0.8}$g_1 \mu^2$ & 0 & \cellcolor[rgb]{0.8,0.8,0.8}$\mrr{\mu^2}$ & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$W^2 \phi^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_2^2\mu^2$ & 0 & \cellcolor[rgb]{0.8,0.8,0.8}$g_2\mu^2$ & 0 & \cellcolor[rgb]{0.8,0.8,0.8}$\mrr{\mu^2}$ & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$WB \phi^2$} & \cellcolor[rgb]{0.8,0.8,0.8}$g_1g_2\mu^2$ & \cellcolor[rgb]{0.8,0.8,0.8}$g_2\mu^2$ & \cellcolor[rgb]{0.8,0.8,0.8}$g_1\mu^2$ & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8} $\mu^2$ & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$G^2 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & \cellcolor[rgb]{0.8,0.8,0.8}$\mrr{\mu^2}$ & 0 & 0\\[0.1cm] % $\phi^4 D^2$ & $\mrr{\lambda\mu^2}$ & $g_1 \mu^2$ & $ \mrr{g_2 \mu^2} $ & 0 & 0 & 0 & 0 & $\mrr{\mu^2}$ & 0\\[0.1cm] % $\phi^6$ & $\mrr{\lambda^2\mu^2}$ & $\mrr{\lambda g_1\mu^2}$ & $\mrr{\lambda g_2\mu^2}$ & $g_1^2\mu^2$ & $\mrr{g_2^2\mu^2}$ & $g_1 g_2\mu^2$ & 0 & $\mrr{\lambda\mu^2}$ & $\mrr{\mu^2}$\\[0.1cm] % \bottomrule % \end{tabular} % } \end{center} % \caption{\it Same as Tab.~\ref{tab:dim8adm} but for the renormalisation of the bosonic interactions of dimensions two, four and six.}\label{tab:dim6adm} % \end{table} \begin{table}[t] % \begin{center} \resizebox{\textwidth}{!}{\begin{tabular}{c|ccccccccccccc} % \toprule % & $\psi^2 B \phi^3$ & $\psi^2 W \phi^3$ & $\psi^2 G \phi^3$ & $\psi^2 \phi^2 D^3$ & $\psi^2\phi^5$ & $\psi^2\phi^4 D$ & $\psi^2 B\phi^2 D$ & $\psi^2 W\phi^2 D$ & $\psi^2 G\phi^2 D$ & $\psi^2 \phi^3 D^2$\\\midrule % $\phi^2$ & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % % $\phi^4$ & 0 & 0 & 0 & \mrr{$ \mu^4 |y^t|^2 $} & 0 & 0 & 0 & 0 & 0 & $ \mu^4 y^t $\\\midrule % % \textcolor{gray}{$B^2 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$W^2 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$WB \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % \textcolor{gray}{$G^2 \phi^2$} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\[0.1cm] % $\phi^4 D^2$ & 0 & 0 & 0 & \mrr{$ \mu^2 |y^t|^2 $} & 0 & 0 & 0 & 0 & 0 & $ \mu^2 y^t $\\[0.1cm] % $\phi^6$ & 0 & 0 & 0 & \mrr{$ \lambda \mu^2 |y^t|^2 $} & $ \mu^2 y^t $ & \mrr{$\mu^2 |y^t|^2$} & $\mu^2 |y^t|^2$ & $\mu^2 |y^t|^2$ & 0 & $ \mu^2 y^t |y^t|^2 $\\[0.1cm] % \bottomrule % \end{tabular} % } \end{center} % \caption{\it Same as Tab.~\ref{tab:dim8adm2} but for the renormalisation of the bosonic interactions of dimensions two, four and six.}\label{tab:dim6adm2} % \end{table} The \mc{$\mathcal{O}(v^4/\Lambda^4)$ piece of the} RGEs of both relevant and marginal bosonic interactions of the SMEFT, driven by operators that can arise at tree level upon matching, are provided in an auxiliary \mc{file on \htmladdnormallink{github.com/SMEFT-Dimension8-RGEs}{https://github.com/SMEFT-Dimension8-RGEs}}. Here we limit ourselves to discussing some generic aspects of this result. The structure of the anomalous dimension matrix $\gamma$ of dimension-eight bosonic operators is shown in Tabs.~\ref{tab:dim8adm} and ~\ref{tab:dim8adm2}. Operators involving only gauge bosons are not shown, as none of them is renormalised. (The reason is that all tree-level generated bosonic interactions involve at least four Higgses, \mc{while} % at most two of them can be taken as internal particles at one loop; \mc{tree-level fermionic interactions contain at least two Higgses as well as two fermions that must close the loop.}) There are mixing terms of a size that deviate significantly from the naive dimensional analysis estimate, \mc{$\gamma_{ij}/g\sim 1$; with $g$ representing (products of) SM couplings}. In particular, we highlight in blue those that fulfil $\gamma_{ij}/g\gtrsim 10$. The corresponding RGEs read: \begin{align} % \dot{c}_{\phi^4}^{(3)} &= -g_2^2(12 c_{\phi^4}^{(1)} + \frac{29}{3}c_{\phi^4}^{(2)} + 14 c_{\phi^4}^{(3)}) - 56 (c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{\alpha_2,\alpha_3} (y^u)^*_{\alpha_3,\alpha_1} + \cdots\\[0.1cm] % \dot{c}_{B\phi^4D^2}^{(1)} &= 12 \lambda c_{B\phi^4D^2}^{(1)} + 60 g_1 (c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}}\nonumber\\ & -36 (c^{(1)}_{q^2 B \phi^2 D})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}} + \cdots\\[0.1cm] % \dot{c}_{W\phi^4D^2}^{(1)} &= 44 g_2 (c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}} + 48 (c^{(11)}_{q^2 W H^2 D})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}} + \cdots\\[0.1cm] % \dot{c}_{B^2\phi^4}^{(i)} &= 48 \lambda c_{B^2\phi^4}^{(i)} + \cdots\\[0.1cm] % \dot{c}_{W^2\phi^4}^{(i)} &= 48 \lambda c_{W^2\phi^4}^{(i)}+\cdots\\[0.1cm] % \dot{c}_{W^2\phi^4}^{(j)} &= 24 \lambda c_{W^2\phi^4}^{(j)}+\cdots\\[0.1cm] % \dot{c}_{WB\phi^4}^{(i)} &= 40 \lambda c_{WB\phi^4}^{(i)}+\cdots\\[0.1cm] % \dot{c}_{G^2\phi^4}^{(i)} &= -14 g_3^2 c_{G^2\phi^4}^{(i)}+\cdots\\[0.1cm] % \dot{c}_{\phi^6}^{(1)} &= -\frac{157}{16}g_2^4 c_{\phi^4 D^4}^{(3)} + 20 g_1 \lambda c_{B\phi^4D^2}^{(1)} + 40 g_2 \lambda c_{W\phi^4D^2}^{(1)} + 68\lambda c_{\phi^6}^{(1)} \nonumber \\[0.1cm] % &- 34 g_2^2 (c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}} - 48 (c^{(2)}_{q^2 \phi^4 D})_{_{\alpha_2,\alpha_1}} \, y^u_{_{\alpha_1,\alpha_3}} (y^u)^*_{_{\alpha_2,\alpha_3}} \nonumber \\[0.1cm] % &-30 g_2 (c^{(11)}_{q^2 W \phi^2 D})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}} -12 (c^{(1)}_{qu \phi^3 D^2})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_4,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}} (y^u)^*_{_{\alpha_4,\alpha_2}} +\cdots \\[0.1cm] % \dot{c}_{\phi^8} &= \frac{184}{3}\lambda^3 c_{\phi^4}^{(2)} -12 g_1\lambda^2 c_{B\phi^4 D^2}^{(1)}-16g_2\lambda^2 c_{W\phi^4 D^2}^{(1)}+12 g_1^2\lambda c_{B^2\phi^4}^{(1)} \nonumber \\ &+ 36 g_2^2 \lambda c_{W^2\phi^4}^{(1)} + 12 g_1 g_2\lambda c_{WB\phi^4}^{(1)}+48 \lambda^2 c_{\phi^6 D^2}^{(2)}+192\lambda c_{\phi^8} \nonumber \\ & +24\lambda (c^{(1)}_{u^2 \phi^2 D^3} +c^{(2)}_{u^2 \phi^2 D^3} )_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_3,\alpha_4}} y^u_{_{\alpha_5,\alpha_1}} (y^u)^*_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_4,\alpha_5}} \nonumber \\ & +24\lambda (c^{(1)}_{q^2 \phi^2 D^3} +c^{(2)}_{q^2 \phi^2 D^3} -c^{(3)}_{q^2 \phi^2 D^3} -c^{(4)}_{q^2 \phi^2 D^3} )_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} y^u_{_{\alpha_4,\alpha_5}} (y^u)^*_{_{\alpha_3,\alpha_4}} (y^u)^*_{_{\alpha_5,\alpha_1}}\nonumber \\ % & -12 (c_{qu \phi^5})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_3,\alpha_4}} (y^u)^*_{_{\alpha_1,\alpha_4}} (y^u)^*_{_{\alpha_3,\alpha_2}} -12 (c_{qu \phi^5})^{*}_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_1,\alpha_3}} (y^u)_{_{\alpha_4,\alpha_2}} (y^u)^*_{_{\alpha_4,\alpha_3}}\nonumber\\ % & +24\lambda (c^{(2)}_{q^2 \phi^4 D})_{_{\alpha_2,\alpha_1}} \, y^u_{_{\alpha_1,\alpha_3}} (y^u)^*_{_{\alpha_2,\alpha_3}} +12 g_2 \lambda (c^{(11)}_{q^2 W \phi^2 D})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}}\nonumber\\ % & -12 \lambda (c^{(5)}_{qu \phi^3 D^2})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_4,\alpha_3}} (y^u)^*_{_{\alpha_1,\alpha_3}} (y^u)^*_{_{\alpha_4,\alpha_2}} + \cdots % \end{align} with $i=1,2$ and $j=3,4$; $\alpha_i$'s are the flavor indices. The shaded cells represent operators (those of the form $X^2\phi^2 D^2$) that, despite arising only at the loop-level in weakly-coupled UV completions of the SMEFT, are renormalised by interactions that can be generated at tree level (those of the form $\phi^4 D^4$ \mc{and $\psi^2 \phi^2 D^3$}). (This is in contrast with what occurs within the dimension-six bosonic sector of the SMEFT~\cite{Cheung:2015aba}.) The RGEs of these operators read: \begin{align}\label{eq:treeloppmixing} % \dot{c}_{B^2\phi^2 D^2}^{(1)} &= \frac{1}{6} g_1^2 (2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)}) -\frac{8}{9}g_1^2 \left[ 2 c^{(1)}_{d^2 \phi^2 D^3} + 2 c^{(2)}_{d^2 \phi^2 D^3} + 8( c^{(1)}_{u^2 \phi^2 D^3} + c^{(2)}_{u^2 \phi^2 D^3}) \right. \,\nonumber\\ & \left. +6 c^{(1)}_{e^2 \phi^2 D^3} + 3 c^{(1)}_{l^2 \phi^2 D^3} + 3 c^{(2)}_{l^2 \phi^2 D^3} + c^{(1)}_{q^2 \phi^2 D^3} + c^{(2)}_{q^2 \phi^2 D^3} \right]_{\alpha_1,\alpha_1}\,,\\ % \dot{c}_{B^2\phi^2 D^2}^{(2)} &= -\frac{1}{24} g_1^2 (2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)})\,+\frac{2}{9}g_1^2 \left[ 2 c^{(1)}_{d^2 \phi^2 D^3} + 2 c^{(2)}_{d^2 \phi^2 D^3} + 8( c^{(1)}_{u^2 \phi^2 D^3} + c^{(2)}_{u^2 \phi^2 D^3}) \right. \,\nonumber\\ & \left. +6 c^{(1)}_{e^2 \phi^2 D^3} + 3 c^{(1)}_{l^2 \phi^2 D^3} + 3 c^{(2)}_{l^2 \phi^2 D^3} + c^{(1)}_{q^2 \phi^2 D^3} + c^{(2)}_{q^2 \phi^2 D^3} \right]_{\alpha_1,\alpha_1} \,,\\[0.3cm] % \dot{c}_{W^2\phi^2 D^2}^{(1)} &= \frac{1}{6} g_2^2 (2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)})\,-\frac{8}{3}g_2^2 \left[ c^{(1)}_{l^2 \phi^2 D^3} + c^{(2)}_{l^2 \phi^2 D^3} + 3( c^{(1)}_{q^2 \phi^2 D^3} + c^{(2)}_{q^2 \phi^2 D^3}) \right]_{\alpha_1,\alpha_1}\,,\\ % \dot{c}_{W^2\phi^2 D^2}^{(2)} &= -\frac{1}{24}g_2^2 (2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)})\,+\frac{2}{3}g_2^2 \left[c^{(1)}_{l^2 \phi^2 D^3} + c^{(2)}_{l^2 \phi^2 D^3} + 3( c^{(1)}_{q^2 \phi^2 D^3} + c^{(2)}_{q^2 \phi^2 D^3}) \right]_{\alpha_1,\alpha_1}\,,\\ % \dot{c}_{W^2\phi^2 D^2}^{(5)}&= \frac{2}{3}g_2^2 \left[c^{(3)}_{l^2 \phi^2 D^3} + c^{(4)}_{l^2 \phi^2 D^3} + 3( c^{(3)}_{q^2 \phi^2 D^3} + c^{(4)}_{q^2 \phi^2 D^3}) \right]_{\alpha_1,\alpha_1}\,,\\[0.3cm] % \dot{c}_{WB\phi^2 D^2}^{(1)} &= -\frac{1}{12} g_1 g_2( c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)}) -\frac{4}{3} g_1 g_2 \left[c^{(3)}_{l^2 \phi^2 D^3} + c^{(4)}_{l^2 \phi^2 D^3} - c^{(3)}_{q^2 \phi^2 D^3} - c^{(4)}_{q^2 \phi^2 D^3} \right]_{\alpha_1,\alpha_1}\,,\\ % \dot{c}_{WB\phi^2 D^2}^{(4)} & = \frac{1}{6} g_1 g_2( c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)}) +\frac{8}{3} g_1 g_2 \left(c^{(3)}_{l^2 \phi^2 D^3} + c^{(4)}_{l^2 \phi^2 D^3} - c^{(3)}_{q^2 \phi^2 D^3} - c^{(4)}_{q^2 \phi^2 D^3} \right)_{\alpha_1,\alpha_1}\,,\\[0.3cm] % \dot{c}_{G^2 \phi^2 D^2}^{(1)} & = -\frac{8}{3} g_3^2 \left(c^{(1)}_{u^2 \phi^2 D^3} + c^{(2)}_{u^2 \phi^2 D^3}+c^{(1)}_{d^2 \phi^2 D^3} + c^{(2)}_{d^2 \phi^2 D^3} + 2 c^{(1)}_{q^2 \phi^2 D^3} + 2 c^{(2)}_{q^2 \phi^2 D^3} \right)_{\alpha_1,\alpha_1} \,,\\ % \dot{c}_{G^2 \phi^2 D^2}^{(2)} & = \frac{2}{3} g_3^2 \left(c^{(1)}_{u^2 \phi^2 D^3} + c^{(2)}_{u^2 \phi^2 D^3}+c^{(1)}_{d^2 \phi^2 D^3} + c^{(2)}_{d^2 \phi^2 D^3} + 2 c^{(1)}_{q^2 \phi^2 D^3} + 2 c^{(2)}_{q^2 \phi^2 D^3} \right)_{\alpha_1,\alpha_1} \,. % \end{align} Essentially, all zeros in Tabs.~\ref{tab:dim8adm} and ~\ref{tab:dim8adm2} can be understood on the basis of the results in Ref.~\cite{Craig:2019wmo}. Within our field approach to renormalisation relying on the Green's basis of Ref.~\cite{Chala:2021cgt}, the only zero that is not manifest off-shell is the divergence of $\mathcal{O}_{W^2B\phi^2}^{(1)}$. Indeed, off-shell we have: \begin{align} % c_{W^2B\phi^2}^{(1)} &= \frac{g_2^2}{192\pi^2 \epsilon} c_{B\phi^4D^2}^{(1)} +\frac{g_2^2}{24 \pi^2 \epsilon} \left(c^{(1)}_{l^2 B \phi^2 D} + 3 c^{(1)}_{q^2 B \phi^2 D} \right)_{\alpha_1,\alpha_1}\nonumber\\ & -\frac{g_1 g_2^2}{48 \pi^2 \epsilon} \left(c^{(3)}_{l^2 \phi^2 D^3} + 3 c^{(4)}_{l^2 \phi^2 D^3} - 5 c^{(3)}_{q^2 \phi^2 D^3} + c^{(4)}_{q^2 \phi^2 D^3} \right)_{\alpha_1,\alpha_1} \,, \\ c_{WB\phi^2D^2}^{(11)} &= 0 \,,\\ c_{WB\phi^2D^2}^{(13)} &= -\frac{g_2}{192\pi^2 \epsilon} c_{B\phi^4D^2}^{(1)}-\frac{g_2}{24 \pi^2 \epsilon} \left(c^{(1)}_{l^2 B \phi^2 D} + 3 c^{(1)}_{q^2 B \phi^2 D} \right)_{\alpha_1,\alpha_1}\nonumber\\ & +\frac{g_1 g_2}{48 \pi^2 \epsilon} \left(c^{(3)}_{l^2 \phi^2 D^3} + 3 c^{(4)}_{l^2 \phi^2 D^3} - 5 c^{(3)}_{q^2 \phi^2 D^3} + c^{(4)}_{q^2 \phi^2 D^3} \right)_{\alpha_1,\alpha_1}\,. % \end{align} However, the Wilson coefficient $c_{W^2B\phi^2}^{(1)}$ is shifted on-shell to \begin{align} c_{W^2B\phi^2}^{(1)} \rightarrow c_{W^2B\phi^2}^{(1)} + \frac{g_2}{2}c_{WB\phi^2D^2}^{(11)} + g_2 c_{WB\phi^2D^2}^{(13)} \,, % \end{align} thus making $c_{W^2B\phi^2}^{(1)}$ vanish on-shell. It should be also emphasised that some anomalous dimensions arise only from redundant operators. For example, the physical interactions $\phi^4 D^4$ do not renormalise directly \mc{the operator $\mathcal{O}_{\phi^8}$}, because divergences of the latter are momentumless, whereas loops of the former involve always external momenta. In \mc{Tabs.~\ref{tab:dim6adm} and ~\ref{tab:dim6adm2}} we depict the same information as in \mc{Tabs.~\ref{tab:dim8adm} and ~\ref{tab:dim8adm2}} but for the renormalisation of the bosonic SM Lagrangian terms and dimension-six interactions. In this case, the anomalous dimensions that differ substantially from naive power counting read: \begin{align} % \dot{c}_{\phi \square} &= 24 \lambda \mu^2 c_{\phi^4}^{(3)}+\frac{21}{2} g_2 \mu^2c_{W\phi^4D^2}^{(1)}+16\mu^2 c_{\phi^6}^{(2)} -16\mu^2 \left[ (c^{(1)}_{u^2 \phi^2 D^3}+c^{(2)}_{u^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_3,\alpha_1}} (y^u)^*_{_{\alpha_2,\alpha_3}}\right.\nonumber\\ & \left.+(c^{(1)}_{q^2 \phi^2 D^3}+c^{(2)}_{q^2 \phi^2 D^3}-c^{(3)}_{q^2 \phi^2 D^3}-c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}}\right]+ \cdots\,,\\[0.3cm]\nonumber % \dot{c}_{\phi} &= 144 \lambda^2 \mu^2 c_{\phi^4}^{(3)}+14 g_1 \lambda \mu^2c_{B\phi^4D^2}^{(1)}+40 g_2 \lambda \mu^2 c_{W\phi^4D^2}^{(1)}\,-18 g_2^2 \mu^2 c_{W^2\phi^4}^{(1)}+52\lambda\mu^2 c_{\phi^6}^{(1)}+40\mu^2c^{8}_{\phi}\nonumber\\ & -72 \lambda \mu^2 \left[ (c^{(3)}_{q^2 \phi^2 D^3}+c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}} \right]- 12 \mu^2 (c^{(2)}_{q^2 \phi^4 D})_{_{\alpha_2,\alpha_1}} \, y^u_{_{\alpha_1,\alpha_3}} (y^u)^*_{_{\alpha_2,\alpha_3}} + \cdots \,,\\[0.cm] % \dot{\lambda} &= -\mc{94} \lambda \mu^4 c_{\phi^4}^{(3)}\mc{-}16 g_2 \mu^4c_{W\phi^4D^2}^{(1)} \mc{-} 28 \mu^4 \left[ (c^{(3)}_{q^2 \phi^2 D^3}+c^{(4)}_{q^2 \phi^2 D^3})_{_{\alpha_1,\alpha_2}} \, y^u_{_{\alpha_2,\alpha_3}} (y^u)^*_{_{\alpha_3,\alpha_1}} \right]+ \cdots\,. % \end{align} Likewise, the loop operators that are renormalised by (dimension-eight) tree level terms have the following RGEs: \begin{align} % \dot{c}_{\phi B} &= \mu^2\left[\frac{1}{4} g_1^2 \left(2 c_{\phi ^4}^{(1)}-3 c_{\phi ^4}^{(2)}+c_{\phi ^4}^{(3)}\right)-2g_1 c_{B\phi^4D^2}^{(1)}+12c_{B^2\phi^4}^{(1)}\right]\,,\\ % \dot{c}_{\phi \widetilde{B}} &= -2 \mu^2 \left(g_1 c_{B\phi^4D^2}^{(1)}-6c_{B^2\phi^4}^{(1)}\right)\,,\\ % \dot{c}_{\phi W} &= \mu^2\left[-\frac{g_2^2}{4} \left(c_{\phi ^4}^{(2)}-c_{\phi ^4}^{(3)} \right)-2g_2 c_{W\phi^4D^2}^{(1)}+12c_{W^2\phi^4}^{(1)}+4c_{W^2\phi^4}^{(3)}\right]\,,\\ % \dot{c}_{\phi \widetilde{W}} &= \mu^2\left[-2g_2 c_{W\phi^4D^2}^{(2)}+12c_{W^2\phi^4}^{(2)}+4c_{W^2\phi^4}^{(4)}\right]\,,\\ % \dot{c}_{\phi WB} &= \mu^2\left[\frac{g_1 g_2}{2} \left(c_{\phi ^4}^{(1)}-2c_{\phi ^4}^{(2)}+c_{\phi ^4}^{(3)}\right)-g_2 c_{B\phi^4D^2}^{(1)}-g_1 c_{W\phi^4D^2}^{(1)}+8c_{WB\phi^4}^{(1)}\right]\,,\\ % \dot{c}_{\phi \widetilde{W}B} &= -\mu^2\left[g_2 c_{B\phi^4D^2}^{(2)}+g_1 c_{W\phi^4D^2}^{(2)}-8c_{WB\phi^4}^{(2)}\right]\,,\\ % \dot{c}_{\phi G} &= 12\mu^2c_{G^2\phi^4}^{(1)}\,,\\ % \dot{c}_{\phi \widetilde{G}} &= 12\mu^2c_{G^2\phi^4}^{(2)}\,. % \end{align} Notice that none of the dimension-eight fermionic interactions considered here renormalise lower-dimensional bosonic terms. \section{Positivity bounds} \label{sec:positivity} Positivity bounds are restrictions on the form of the S-matrix derived from unitarity, analyticity and crossing. The best known example is the positivity of the forward scattering amplitude $\mathcal{A}(s,t=0)$ in $2\to 2$ processes, given by: \begin{equation}\label{eq:positivity} % \frac{d^2}{ds^2}\mathcal{A}(s,t=0)\bigg|_{s=0} \geq 0\,. % \end{equation} If $\mathcal{A}(s,t=0)$ is analytical in $s=0$, then it admits an expansion in a neighbourhood of the origin reading $\mathcal{A}(s,t=0) = a_0+a_1s+a_2 s^2+...$. Hence, the equation above implies $a_2\geq0$. The Wilson coefficients that enter in $a_2$ are those of dimension-eight (or pairs of dimension-six ones, etc.), from where it follows that certain combinations of dimension-eight terms are forced to be \mc{non-negative}. For example, by analysing the process $\phi\phi\to\phi\phi$, Ref.~\cite{Remmen:2019cyz} finds that: \begin{align}~\label{eq:posh4} % c_{\phi^4 }^{(2)}\geq0\,,\\ c_{\phi^4 }^{(1)}+c_{\phi^4 }^{(2)}\geq0\,,\\ c_{\phi^4}^{(1)}+c_{\phi^4}^{(2)}+c_{\phi^4 }^{(3)}\geq0. \end{align} The problem arises when the amplitude is not regular around $s=0$. This occurs, for example, when the leading contribution is due to loops involving massless particles, in which case there are branch cuts that extend all the way to the origin. In principle, the reasoning leading to Eq.~\eqref{eq:positivity} can be replicated upon giving a small mass $m$ to the massless states (hence regularising the singularity in the origin), which can be later taken to zero~\cite{Adams:2006sv}. However, this solution does not always imply that the conclusions derived in the absence of light loops remain valid in their presence. In particular, for $\phi^4 D^4$ operators, it was shown recently in Ref.~\cite{Chala:2021wpj} that the corresponding amplitude in the limit $m\to 0$ is actually dominated by the running of lower-dimensional operators ($\phi^4$ and $\phi^4 D^2$). It was explicitly shown that, in general, even if the $\phi^4 D^4$ operators fulfil the inequalities in Eqs.~\eqref{eq:posh4} at some heavy scale $\Lambda$ at which they are generated at tree-level, the positivity bounds are violated at scales $\tilde{\mu}<\Lambda$ upon evolving with the RGEs triggered by $\lambda$, $g_1$ and $g_2$. (Not so by gravity~\cite{Baratella:2021guc}.) Positivity bounds exist also for the operators $X^2\phi^2 D^2$. They were obtained in Ref.~\cite{Bi:2019phv} upon inspection of the amplitude $V_1V_2\to V_1V_2$, with $V_i=W^\pm, Z, \gamma$, in the EW broken phase. \textit{A priori}, one could also think of deriving these constraints from the amplitude $\phi V\to\phi V$ in the unbroken phase. In such case, and contrary to the $\phi^4 D^4$ instance, there is no lower-dimensional operator that can dominate the amplitude in the deep infrared (in particular dimension-six $\phi^2 X^2$ operators are not renormalised by tree-level interactions), which would imply that the positivity bounds on the $c_{X^2\phi^2 D^2}$ Wilson coefficients are valid at all scales. Let us ascertain this hypothesis by explicit calculation. The relevant operators in Ref.~\cite{Bi:2019phv} are dubbed $\mathcal{O}_{M,i}$, for $i=1,...,5,7$. The explicit form of those interactions (first derived in Ref.~\cite{Eboli:2006wa}) can be found also in that paper; here we simply specify how the corresponding Wilson coefficients (which are there called $f_{M,i}$) are related to the Wilson coefficients of the operators in our basis: \begin{align}\nonumber % f_{M,0} &= -\frac{2}{g_2^2} c_{W^2\phi^2 D^2}^{(2)}\,, % f_{M,1} = \frac{2}{g_2^2} (c_{W^2\phi^2 D^2}^{(1)}+c_{W^2\phi^2 D^2}^{(4)})\,, % f_{M,2} = -\frac{4}{g_1^2} c_{B^2\phi^2 D^2}^{(2)}\,,\\ % f_{M,3} = \frac{4}{g_1^2} &c_{B^2\phi^2 D^2}^{(1)}\,, % f_{M,4} = -\frac{4}{g_1 g_2} c_{WB\phi^2 D^2}^{(1)}\,, % f_{M,5} = -\frac{8}{g_1g_2} c_{WB\phi^2 D^2}^{(4)}\,, % f_{M,7} = \frac{4}{g_2^2} c_{W^2\phi^2 D^2}^{(4)}\,. % \end{align} The equations (3.93) and (3.99) in Ref.~\cite{Bi:2019phv} constrain certain combinations of $f_{M,i}$. Translated to our basis, these relations read: \begin{align} % \mc{g_1^2}c_{B^2\phi^2 D^2}^{(1)} + \mc{g_2^2}c_{W^2\phi^2 D^2}^{(1)} + 2\mc{g_1 g_2} c_{WB\phi^2 D^2}^{(4)} \leq 0\,,\label{eq:posI}\\ % \mc{g_1^2}c_{B^2\phi^2 D^2}^{(1)} + \mc{g_2^2}c_{W^2\phi^2 D^2}^{(1)} - 2 \mc{g_1g_2}c_{WB\phi^2 D^2}^{(4)} \leq 0\,,\\ % c_{W^2 \phi^2 D^2}^{(1)} \leq 0\,,\label{eq:bound4}\\ % g_1^2 c_{W^2 \phi^2 D^2}^{(1)} + 2 g_1 g_2 c_{WB \phi^2 D^2}^{(4)} + g_2^2 c_{B^2 \phi^2 D^2}^{(1)} \leq 0\,,\\ % g_1^2 c_{W^2 \phi^2 D^2}^{(1)} - 2 g_1 g_2 c_{WB \phi^2 D^2}^{(4)} + g_2^2 c_{B^2 \phi^2 D^2}^{(1)} \leq 0\label{eq:posF}\,. % \end{align} The operators $X^2\phi^2 D^2$ can not arise at tree-level in weakly-coupled UV completions of the SMEFT. So, their values at energies $\tilde{\mu}\ll\Lambda$ will be dominated by their running induced by tree-level operators, namely by $\phi^4 D^4$ \mc{and $\psi^2\phi^2 D^3$}. Using the RGEs in Eqs.~\eqref{eq:treeloppmixing} to leading-logarithm (note that the running of the SM gauge couplings can be ignored precisely because the $X^2 \phi^2 D^2$ operators vanish at tree-level at $\tilde{\mu}=\Lambda$), \mc{a sufficient condition for all inequalities above to hold is}: \begin{align}\label{eq:posbound1} % 2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)}&\geq 0\,,\\ c_{\phi^4}^{(1)} + 2 c_{\phi^4}^{(2)} + c_{\phi^4}^{(3)} &\geq 0\,,\\ % c_{\phi^4}^{(1)} + c_{\phi^4}^{(2)} &\geq 0\,,\label{eq:posbound3}\\ % \mc{c_{\psi_R^2\phi^2 D^3}^{(1)} + c_{\psi_R^2\phi^2 D^3}^{(2)}} &\mc{\leq 0\,,}\label{eq:newposI}\\ % \mc{c_{\psi_L^2\phi^2 D^3}^{(1)} + c_{\psi_L^2\phi^2 D^3}^{(2)} + c_{\psi_L^2\phi^2 D^3}^{(3)} + c_{\psi_L^2\phi^2 D^3}^{(4)}} &\mc{\leq 0\,,}\\ % \mc{c_{\psi_L^2\phi^2 D^3}^{(1)} + c_{\psi_L^2\phi^2 D^3}^{(2)} - c_{\psi_L^2\phi^2 D^3}^{(3)} - c_{\psi_L^2\phi^2 D^3}^{(4)}} &\mc{\leq 0\,;}\label{eq:newposF} \end{align} \mc{for $\psi_L=l,q$ and $\psi_R=e,u,d$. The Wilson coefficients above must be thought as evaluated in $\Lambda$.} For example, Eq.~\eqref{eq:bound4} reads simply: \begin{align} % c_{W^2\phi^2D^2}^{(1)}(\tilde{\mu}) &= c_{W^2\phi^2D^2}^{(1)}(\Lambda)-\frac{1}{16\pi^2}\dot{c}_{W^2\phi^2 D^2}^{(1)}(\Lambda)\log{\frac{\Lambda}{\tilde{\mu}}}<0\\ % &\Rightarrow \frac{1}{6} g_2^2 \bigg[2 c_{\phi^4}^{(1)} + 3 c_{\phi^4}^{(2)} + c_{\phi^4 D^4}^{(3)}\nonumber\\ % &\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,-\frac{16}{3}\left(c_{l^2\phi^2D^3}^{(1)}+c_{l^2\phi^2D^3}^{(2)}+3c_{q^2\phi^2D^3}^{(1)}+3c_{q^2\phi^2D^3}^{(2)}\right)\bigg]\log{\frac{\Lambda}{\tilde{\mu}}} > 0\,, % \end{align} and it is clear that the $g_2^2$ and the logarithm are positive. The relations in Eqs.~\eqref{eq:posbound1}--\eqref{eq:posbound3} are always fulfilled because, at tree-level, the four-Higgs operators satisfy the conditions in Eqs.~\eqref{eq:posh4}. The remaining inequalities, Eqs.~\eqref{eq:newposI}--\eqref{eq:newposF} are essentially equivalent to those quoted in Eq. (12) of Ref.~\cite{Li:2022tcz}. We have nevertheless checked their validity explicitly by studying the forward scattering amplitude for $\phi\psi\to\phi\psi$; see Ref.~\cite{Bellazzini:2016xrt} for the positivity of amplitudes involving particles with spin. Thus, we have proven that the positivity constraints on the operators $X^2\phi^2 D^2$, unlike those for $\phi^4 D^4$~\cite{Chala:2021wpj}, remain valid at all scales within one-loop accuracy. \section{Conclusions} \label{sec:conclusions} We have \mc{completed} the one-loop renormalisation of bosonic operators in the (lepton-number conserving) SMEFT to order $v^4/\Lambda^4$. This includes the running of operators triggered by pairs of dimension-six interactions, first computed in Ref.~\cite{Chala:2021pll}, as well as the renormalisation due to dimension-eight terms, which has been our focus for calculation within this work. We have relied heavily on the basis of Green's functions and the reduction of redundant operators onto physical ones derived in Ref.~\cite{Chala:2021cgt}. The current picture of one-loop renormalisation within the SMEFT is summarised in Tab.~\ref{tab:summary}. Without entering into phenomenological considerations, there are several important consequences that can be derived from our results. To start with, we have found a number of anomalous dimensions that divert significantly from naive power counting. For example, $\dot{c}_{\phi^6}^{(1)} = -\frac{157}{16}g_2^4 c_{\phi^4 D^4}^{(3)} + 68\lambda c_{\phi^6}^{(1)}+\cdots$; the factors of $157/16$ and $68$ compensate partially the loop suppression. On a different note, there are tree-level dimension-eight interactions that mix into loop-level dimension-eight operators (this was first noticed in Ref.~\cite{Craig:2019wmo}) as well as into loop-level dimension-six terms \mc{(that we have unraveled here for the first time)}; an example of the latter is the renormalisation (proportional to $\mu^2$) of $X^2\phi^2$ interactions by $\phi^4 D^4$ operators. Finally, we have found the remarkable result that, unlike for $\phi^4 D^4$~\cite{Chala:2021wpj}, positivity bounds on $X^2\phi^2 D^2$ operators, first derived in Ref.~\cite{Bi:2019phv}, hold at all scales at one-loop accuracy. This strengthens the idea that the restrictions in Eqs.~\eqref{eq:posI}--\eqref{eq:posF} should be used as Bayesian priors in experimental fits aiming at measuring the values of the Wilson coefficients of quartic-gauge coupling operators, in line with Ref.~\cite{Zhang:2018shp}. Several future directions remain to be explored. First, one could compute the running driven by LNV and baryon-number violating (BNV) interactions. Although this effect is most probably negligible, due to the in principle huge scale of LNV and BNV, the possibility that these symmetries are broken at the TeV scale is not yet discarded; in which case the neutrino masses and the absence of proton decay would reflect strong GIM-like cancellations between different LNV and BNV operators~\cite{Dong:2011rh}. One more step further requires renormalising the fermionic operators of the SMEFT. Our current work paves the way to this endeavour, since, in the field-theory approach to running, the divergences of fermionic interactions receive contributions from redundant bosonic operators, all of which we have computed here. As a third possible avenue, one could consider quantifying the impact of dimension-eight interactions, with and without quantum corrections, for constraining concrete models of new physics. \begin{table}[t] % \begin{center} \resizebox{1.\textwidth}{!}{\begin{tabular}{l|ccccccccccc} % & $d_5$ & $d_5^2$ & $d_6$ & $d_5^3$ & $d_5\times d_6$ & $d_7$ & $d_5^4$ & $d_5^2\times d_6$ & $d_6^2$ & $d_5\times d_7$ & $d_8$\\ % \toprule % $d_{\leq 4}$ (bosonic) & & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Jenkins:2013zja} & & & & & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Chala:2021pll} & & \colorbox{gray}{\textcolor{white}{This\, work}} \\ % $d_{\leq 4}$ (fermionic) & & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Jenkins:2013zja} & & & & & & $\textcolor{red}{\text{\sffamily X}}$ & & $\textcolor{red}{\text{\sffamily X}}$ \\ % $d_5$ & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Chankowski:1993tx,Babu:1993qv,Antusch:2001ck} & & & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Chala:2021juk} & $\textcolor{orange}{\mathbf{\checkmark}}$~\cite{Chala:2021juk} & & & & & \\ % $d_6$ (bosonic) & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Davidson:2018zuo} & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Jenkins:2013zja,Jenkins:2013wua,Alonso:2013hga} & & & & & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Chala:2021pll} & $\textcolor{red}{\text{\sffamily X}}$ & \colorbox{gray}{\textcolor{white}{This\, work}} \\ % $d_6$ (fermionic) & & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Davidson:2018zuo} & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Jenkins:2013zja,Jenkins:2013wua,Alonso:2013hga,Alonso:2014zka} & & & & & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$\\ % $d_7$ & & & & $\textcolor{orange}{\mathbf{\checkmark}}$~\cite{Chala:2021juk} & $\textcolor{orange}{\mathbf{\checkmark}}$~\cite{Chala:2021juk} & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Liao:2016hru,Liao:2019tep}\\ % $d_8$ (bosonic) & & & & & & & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{green}{\mathbf{\checkmark}}$~\cite{Chala:2021pll} & $\textcolor{red}{\text{\sffamily X}}$ & \colorbox{gray}{\textcolor{white}{This\, work}}\\ % $d_8$ (fermionic) & & & & & & & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{red}{\text{\sffamily X}}$ & $\textcolor{orange}{\mathbf{\checkmark}}$~\cite{AccettulliHuber:2021uoa} % \\\bottomrule % \end{tabular}} % \caption{\it State of the art of the SMEFT renormalisation. The rows represent the operators (characterised by their dimension $d$) being renormalised, while the columns indicate the operators entering the loops. Blank entries vanish; a tick $\textcolor{green}{\mathbf{\checkmark}}$ represents that the complete contribution is known; the $\textcolor{orange}{\mathbf{\checkmark}}$ implies that only (but substantial) partial results have been already obtained; the $\textcolor{red}{\text{\sffamily X}}$ indicates that nothing, or very little, is known. The contribution made in this paper is marked by $\colorbox{gray}{\,\,\,}$.}\label{tab:summary} % \end{center} % \end{table} \section*{Acknowledgments} We would like to thank José Santiago and Maria Ramos for useful discussions. This work has been partially funded by SRA under the grants PID2019-106087GB-C21/C22 (10.13039/501100011033), Junta de Andaluc\'ia under grants FQM 101, A-FQM-211-UGR18, P18-FR-4314 (FEDER) and A-FQM-467-UGR18 (FEDER) as well as by LIP (FCT, COMPETE2020-Portugal2020, FEDER, POCI-01-0145-FEDER-007334) and by FCT under the project CERN/FIS-PAR/0032/2021 and under the grant SFRH/BD/144244/2019. ADC is also supported by the Spanish MINECO under the FPI programme. MC is also supported by the Spanish MINECO under the Ram\'on y Cajal programme.
\section{Introduction} The stellar performance of Transformers \cite{attention-is-all-you-need} has garnered a lot of attention to analyzing the reasons behind their effectiveness. The self-attention mechanism has been one of the main areas of focus \cite{clark-etal-2019-bert-look, kovaleva-etal-2019-revealing, reif2019visualizing, bert-track-syntactic-dep}. However, there have been debates on whether raw attention weights are reliable anchors for explaining model's behavior or not \cite{wiegreffe-pinter-2019-attention, serrano-smith-2019-attention, jain-wallace-2019-attention}. Recently, it was shown that incorporating vector norms should be an indispensable part of any attention-based analysis\footnote{We also have shown the unreliability of weights due to norm disparities in probing studies \cite{fayyaz-etal-2021-models}.} \cite{kobayashi-etal-2020-attention-norm, kobayashi-etal-2021-incorporating-residual}. However, these norm-based studies incorporate only the attention block into their analysis, whereas Transformer encoder layer is composed of more components. \input{plots/sst2_qualitative} Another limitation of the existing analysis techniques is that they are usually constrained to the analysis of single layer attributions. In order to expand the analysis to multi-layered encoder-based models in their entirety, an aggregation technique has to be employed. \citet{abnar-zuidema-2020-quantifying} proposed two aggregation methods, \emph{rollout} and \emph{max-flow}, which combine raw attention weights across layers. Despite showing the outcome of their method to be faithful to a model's inner workings in specific cases, the final results are still unsatisfactory on a wide range of fine-tuned models. Additionally, gradient-based alternatives \cite{Simonyan2014DeepIC, kindermans2016investigating, li-etal-2016-visualizing} have been argued to provide a more robust basis for token attribution analysis \cite{atanasova-etal-2020-diagnostic, Brunner2020On, pascual-etal-2021-telling-full-story}. Nonetheless, the gradient-based alternatives have not been able to fully replace attention-based counterparts, mainly due to their high computational intensity. In this paper, we propose a new global token attribution analysis method (\methodName) which is based on the encoder layer's output. In \methodName, the second layer normalization is also included in the norm-based analysis of each encoder layer. To aggregate attributions over all layers, we applied a modified attention rollout technique, returning global scores. Through extensive experiments and comparing the global attribution with the input token attributions obtained by gradient-based saliency scores, we show that our method produces faithful and meaningful results (Figure~\ref{fig:sst2_qualitative}). Our evaluations on models with distinct pre-training objectives and sizes \cite{devlin-etal-2019-bert, clark2020electra} show high correlations with gradient-based methods in global settings. Furthermore, with comparative studies on each aspect of \methodName~, we find that: (i) norm-based methods achieve higher correlations than weight-based methods; (ii) incorporating residual connections plays an essential role in token attribution; (iii) considering the two layer normalizations improve our analysis only if coupled together; and (iv) aggregation across layers is crucial for an accurate whole-model attribution analysis. In summary, our main contributions are: \begin{itemize} \itemsep0em \item We expand the scope of analysis from attention block in Transformers to the whole encoder. \item Our method significantly improves over existing techniques for quantifying global token attributions. \item We qualitatively demonstrate that the attributions obtained by our method are plausibly interpretable. \end{itemize} \section{Background} \label{sec:background} In encoder-based language models (such as BERT), a Transformer encoder layer is composed of several components (Figure \ref{fig:encoder_diagram}). The core component of the encoder is the self-attention mechanism \cite{attention-is-all-you-need}, which is responsible for the information mixture of a sequence of token representations ($\bm{x}_1, ..., \bm{x}_n$). Each self-attention head computes a set of attention weights $\bm A^h=\{\alpha_{i,j}^h | 1 \leq i, j \leq n \}$, where $\alpha_{i,j}^h$ is the raw attention weight from the $i^\text{th}$ token to the $j^\text{th}$ token in head $h \in \{1,...,H\}$. Therefore, the output representation ($\bm{z}_i \in \mathbb{R}^d$) for the $i^\text{th}$ token of a multi-head (with $H$ heads) self-attention module is computed by concatenating the heads' outputs followed by a head-mixing $\bm{W_O}$ projection: \begin{equation} \label{eq:self_attention_vaswani} \bm{z}_i = \textsc{Concat}(\bm{z}_i^1, ..., \bm{z}_i^H)\bm{W_O} \end{equation} where each head's output vector is generated by performing a weighted sum over the transformed value vectors $\bm{v}(\bm{x}_j) \in \mathbb{R}^{d_v}$: \begin{equation} \label{eq:self_attention_vaswani_head} \bm{z}_i^h = \sum_{j=1}^{n}\alpha_{i,j}^h\bm{v}^h(\bm{x}_j) \vspace{-3.0ex} \end{equation} \input{plots/encoder_diagram} \paragraph{Norm-based attention.} While one may interpret the attention mechanism using the attention weights $\bm A$, \citet{kobayashi-etal-2020-attention-norm} argued that doing so would ignore the norm of the transformed vectors multiplied by the weights, elucidating that the weights are insufficient for interpretation. Their solution enhanced the interpretability of attention weights by incorporating the value vectors $\bm{v}(\bm{x}_j)$ and the following projection $\bm W_O$. By reformulating Equation \ref{eq:self_attention_vaswani}, we can consider $\bm{z}_i$ as a summation over the attentions heads: \begin{equation} \label{eq:self_attention_reformulated} \bm{z}_i = \sum_{h=1}^{H}\sum_{j=1}^{n}\alpha^h_{i,j}\underbrace{\bm{v}^h(\bm{x}_j)\bm W^h_O}_{f^h(\bm{x}_j)} \end{equation} Using this reformulation\footnote{ $\bm W^h_O$ is a head-specific slice of the original $\bm W_O$ projection. For more information about the reformulation process, see Appendix C in \citet{kobayashi-etal-2021-incorporating-residual}}, \citeauthor{kobayashi-etal-2020-attention-norm} proposed a \emph{norm-based} token attribution analysis method, \bgfg{ $\mathcal{N}:=(||\bm{z}_{i\leftarrow j}||) \in \mathbb{R}^{n\times n}$ } , to measure each token's contribution in a self-attention module: \begin{equation} \label{eq:z_j_to_i} \bm{z}_{i\leftarrow j} = \sum_{h=1}^{H}\alpha^h_{i,j}f^h(\bm{x}_j) \end{equation} They showed that incorporating the magnitude of the transformation function ($f^h(\bm{x})$) is crucial in assessing the input tokens' contribution to the self-attention output. \paragraph{Residual connections \& Layer Normalizations.} \citet{kobayashi-etal-2021-incorporating-residual} added the attention block's Layer Normalization (\textbf{LN}\#1) and Residual connection (\textbf{RES}\#1) to its prior norm-based analysis to assess the impact of residual connections and layer normalization inside an attention block. \bgfg{ $\mathcal{N}_\textsc{Res}:=(||\bm{z}^\texttt{+}_{i\leftarrow j}||) \in \mathbb{R}^{n\times n}$ } is the analysis method which incorporates the attention block's residual connection. The input vector $\bm x$ is added to the attribution of each token to itself to incorporate the influence of RES\#1: \begin{equation} \label{eq:kobayashi_res} \bm{z}^\texttt{+}_{i\leftarrow j} = \sum_{h=1}^{H}\alpha^h_{i,j}f^h(\bm{x}_i) + \mathbf{1}[i=j]\bm{x}_i \end{equation} They proposed a method for decomposing LN\footnote{$\bm{\gamma} \in \mathbb{R}^d$ and $\bm{\beta} \in \mathbb{R}^d$ are the trainable weights of LN. Similar to \citet{kobayashi-etal-2021-incorporating-residual} we ignore $\bm{\beta}$.} into a summation of normalizations: \begin{equation} \label{eq:kobayashi_LN_decomp} \begin{aligned} \text{LN}(\bm{z}_i^\texttt{+}) &= \sum_{j=1}^{n}g_{\bm{z}^\texttt{+}_i}(\bm{z}_{i\leftarrow j}^\texttt{+}) + \bm \beta\\ g_{\bm{z}_i^\texttt{+}}(\bm{z}^\texttt{+}_{i\leftarrow j}) &:= \frac{\bm{z}^\texttt{+}_{i\leftarrow j} - m(\bm{z}^\texttt{+}_{i\leftarrow j})}{s(\bm{z}^\texttt{+}_i)} \odot \bm\gamma \end{aligned} \end{equation} where $m(.)$ and $s(.)$ are the element-wise mean and standard deviation of the input vector (cf. \S\ref{sec:formulation}). The decomposition can be applied to the contribution vectors: \begin{equation} \label{eq:kobayashi_res_LN} \bm{\tilde{z}}_{i\leftarrow j} = g_{\bm{z}^\texttt{+}_i}(\sum_{h=1}^{H}\alpha^h_{i,j}f^h(\bm{x}_i) + \mathbf{1}[i=j]\bm{x}_i) \end{equation} Accordingly, we can compute the magnitude \bgfg{ $\mathcal{N}_\textsc{ResLN}:=(||\bm{\tilde{z}}_{i\leftarrow j}||) \in \mathbb{R}^{n\times n}$ }, which represents the amount of influence of an encoder layer's input token $j$ on its output token $i$. Based on this formulation, a context-mixing ratio could be defined as: \begin{equation} \label{eq:mixing_ratio} r_i = \frac{||\sum_{j=1,j\neq i}^{n}\bm{\tilde{z}}_{i\leftarrow j}||}{||\sum_{j=1,j\neq i}^{n}\bm{\tilde{z}}_{i\leftarrow j}|| + ||\bm{\tilde{z}}_{i\leftarrow i}||} \end{equation} Experiments by \citet{kobayashi-etal-2021-incorporating-residual} revealed considerably low $r$ values which indicate the huge impact of the residual connections. In other words, the model tends to preserve token representations more than mixing them with each other. \section{Methodology} \label{sec:methodology} Our method for input token attribution analysis has a holistic view and takes into account almost every component within the encoder layer. To this end, we first extend the norm-based analysis of \citet{kobayashi-etal-2021-incorporating-residual} by incorporating the encoder's output LN\#2. We then apply an aggregation technique to combine the information flow throughout all layers. \paragraph{Encoder layer output $\neq$ Attention block output.} While the RES\#1 and the LN\#1 from the attention block are included in the analysis of \citet{kobayashi-etal-2021-incorporating-residual}, the subsequent FFN, RES\#2, and output LN\#2 are ignored (see Fig.~\ref{fig:encoder_diagram}). Hence, $\mathcal{N_\textsc{ResLN}}$ might not be indicative of the entire encoder layer's function. To address this issue, we additionally include the encoder layer components from the attention block outputs ($\tilde{z}_{i}$) to the output representations ($\tilde{x}_{i}$). The output of each encoder ($\tilde{x}_{i}$) is computed as follows: \begin{equation} \label{eq:output_eq} \begin{aligned} \bm{\tilde{z}}_{i}^\texttt{+} &= \text{FFN}(\bm{\tilde{z}}_{i}) + \bm{\tilde{z}}_{i} \\ \bm{\tilde{x}}_{i} &= \text{LN}(\bm{\tilde{z}}_{i}^\texttt{+}) \end{aligned} \end{equation} We apply the LN decomposition rule in Eq. \ref{eq:kobayashi_res_LN} to separate the impacts of residual and FFN output: \begin{equation} \label{eq:output_eq_LNdecomp} \bm{\tilde{x}}_{i} = \sum_{j=1}^{n} \Big( g_{\bm{\tilde{z}}_{i}^{\texttt{+}}}(\text{FFN}(\bm{\tilde{z}}_{i\leftarrow j})) + g_{\bm{\tilde{z}}_{i}^{\texttt{+}}}(\bm{\tilde{z}}_{i\leftarrow j})\Big) + \bm \beta \end{equation} Given that the activation function between the two fully connected layers in the FFN component is non-linear \citep{attention-is-all-you-need}, a linear decomposition similar to Eq. \ref{eq:kobayashi_res_LN} cannot be derived. As a result, we omit FFN's influence on the contribution of each token and instead consider RES\#2, approximating $\bm{\tilde{x}}_{i\leftarrow j}$ as $g_{\bm{\tilde{z}}_{i}^{\texttt{+}}}(\bm{\tilde{z}}_{i\leftarrow j})$. Nevertheless, it should be noted that the FFN \emph{still preserves some influence on this new setting due to the presence of $s(\bm{\tilde{z}}_{i}^{\texttt{+}})$ in $g_{\bm{\tilde{z}}_{i}^{\texttt{+}}}(\bm{\tilde{z}}_{i\leftarrow j})$.} Similarly to Eq.~\ref{eq:kobayashi_res_LN}, we can introduce a more inclusive layerwise analysis method \bgfg{ $\mathcal{N}_\textsc{Enc}:=(||\bm{\tilde{x}}_{i\leftarrow j}||) \in \mathbb{R}^{n\times n}$ } from input token $j$ to output token $i$ using: \begin{equation} \label{eq:encoder_attr} \bm{\tilde{x}}_{i\leftarrow j} \approx g_{\bm{\tilde{z}}_{i}^{\texttt{+}}}(\bm{\tilde{z}}_{i\leftarrow j}) = \frac{\bm{\tilde{z}}_{i\leftarrow j} - m(\bm{\tilde{z}}_{i\leftarrow j})}{s(\bm{\tilde{z}}_{i}^{\texttt{+}})} \odot \bm\gamma \end{equation} \paragraph{Aggregating multi-layer attention.} \label{sec:rollout} To create an aggregated attribution score, \citet{abnar-zuidema-2020-quantifying} proposed describing the model's attentions via modelling the information flow with a directed graph. They introduced \emph{attention rollout} method, which linearly combines raw attention weights along all available paths in the pairwise attention graph. The attention rollout of layer $\ell$ w.r.t. the inputs is computed recursively as follows: \begin{equation} \label{eq:attention_rollout_main} \begin{aligned} \tilde{\bm{A}}_{\ell} &= \begin{dcases} \Hat{\bm{A}}_{\ell}\tilde{\bm{A}}_{\ell-1} & \ell > 1\\ \Hat{\bm{A}}_{\ell} & \ell = 1 \end{dcases} \\ \end{aligned} \end{equation} \begin{equation} \label{eq:attention_rollout_residual} \begin{aligned} \Hat{\bm{A}}_{\ell} &= 0.5\Bar{\bm{A}}_{\ell}+0.5\bm{I} \end{aligned} \end{equation} $\Bar{\bm{A}}_{\ell}$ is the raw attention map averaged across all heads in layer $\ell$. This method assumes equal contribution from the residual connection and multi-head attention (See Fig.~\ref{fig:encoder_diagram}). Hence, an identity matrix is summed and renormalized, giving $\Hat{\bm{A}}_{\ell}$. For aggregating the layerwise analysis methods, we use the rollout technique with minor modifications. As many of the methods already include residual connections, we only use Eq. \ref{eq:attention_rollout_main} (replacing $\Hat{\bm{A}}_{\ell}$ with the desired method's attribution matrix in layer $\ell$) to calculate the rollout of a given method. However, for methods that do not assume the residual connection, we define a corresponding ``Fixed'' variation using Eq. \ref{eq:attention_rollout_residual} that incorporates a fixed residual effect ($r_i \approx 0.5$). \textbf{We refer to our proposed global method\textemdash aggregating the $\mathcal{N_\textsc{Enc}}$ across all layers by the rollout method\textemdash as \emph{\methodName}.} In what follows we report our experiments, comparing \methodName~ with several other settings. \section{Experiments} In this section, we introduce the datasets and the token attribution analysis methods used in our evaluations, followed by the experimental setup and results. \subsection{Datasets} All analysis methods are evaluated on three different classification tasks. To cover sentiment detection tasks we use SST2 \cite{socher-etal-2013-recursive}, MNLI \cite{williams-etal-2018-broad} for Natural Language Inference and Hatexplain \cite{Mathew_Saha_Yimam_Biemann_Goyal_Mukherjee_2021} in hate speech detection. \subsection{Analysis Methods} \label{sec:analysis_methods} We use two categories of explainability approaches in our work: \textbf{\emph{Weight-based}} and \textbf{\emph{Norm-based}}.\footnote{Note that in most of our experiments, we use all these methods within the rollout aggregation technique.} The \emph{Weight-based} approaches employed in our experiments are as follows: \begin{itemize} \itemsep0em \item $\mathcal{W}$\,: The raw attention maps averaged across all heads (See $\overline{\boldsymbol{A}}_{\ell}$ in \S\ref{sec:background}). \item $\mathcal{W_\textsc{FixedRes}}$\,: \citeauthor{abnar-zuidema-2020-quantifying}'s assumption; add an identity matrix as a fixed residual to $\overline{\boldsymbol{A}}_{\ell}$ (see $\hat{\boldsymbol{A}}_{\ell}$ in Eq. \ref{eq:attention_rollout_residual}). \item $\mathcal{W_\textsc{Res}}$\,: The corrected version of $\mathcal{W}$ in which accurate residuals are added based on the context-mixing ratios of $\mathcal{N_\textsc{Enc}}$: \begin{equation} \label{eq:r_nenc} \begin{aligned} \hat{r}_{i}=&\frac{\left\|\sum_{j=1, j \neq i}^{n} \tilde{\boldsymbol{x}}_{i \leftarrow j}\right\|}{\left\|\sum_{j=1, j \neq i}^{n} \tilde{\boldsymbol{x}}_{i \leftarrow j}\right\|+\left\|\tilde{\boldsymbol{x}}_{i \leftarrow i}\right\|} \\ \end{aligned} \end{equation} In order to enforce $\mathcal{W_\textsc{Res}}$ to have a context-mixing ratio equal to $\hat{r}_{i}$, it is essential to \mbox{zero-out} the diagonal elements (the tokens' attentions to themselves) of $\bar{\bm{A}}_{\ell}$ and renormalize it: \begin{equation} \label{eq:w_res} \begin{gathered} \bm{A}_{\ell}^{\prime}= (\bm{I} - \operatorname{\textbf{diag}}\left(\bar{\bm{A}}_{\ell}\right))^{-1}(\bar{\bm{A}}_{\ell} - \operatorname{\textbf{diag}}\left(\bar{\bm{A}}_{\ell}\right)) \\ \begin{aligned} \mathcal{W_\textsc{Res}}:=& \operatorname{\textbf{diag}}\left(\hat{r}_{1},\cdots,\hat{r}_{n}\right)\bm{A}_{\ell}^{\prime} \\ +&\operatorname{\textbf{diag}}\left(1-\hat{r}_1, \ldots, 1-\hat{r}_{n}\right)\bm{I} \end{aligned} \end{gathered} \end{equation} \end{itemize} The \emph{Norm-based} analysis methods, namely $\mathcal{N}$, $\mathcal{N_\textsc{Res}}$ and $\mathcal{N_\textsc{ResLN}}$ were discussed in detail in \S\ref{sec:background}. Our proposed norm-based method $\mathcal{N_\textsc{Enc}}$ was explained in \S\ref{sec:methodology}. For an ablation study, we introduce $\mathcal{N_\textsc{FixedRes}}$ which is $\mathcal{N}$, corrected with a fixed residual similar to $\mathcal{W_\textsc{FixedRes}}$\footnote{The only difference is that we need to normalize $\mathcal{N}$ before adding an identity matrix.}. \begin{equation} \begin{gathered} \hat{\mathcal{N}} = \left (\frac{||\bm{z}_{i\leftarrow j}||}{\sum_j||\bm{z}_{i\leftarrow j}||}\right) \in \mathbb{R}^{n\times n}\\ \mathcal{N_\textsc{FixedRes}} := 0.5\,\hat{\mathcal{N}}+0.5\,\bm{I} \end{gathered} \end{equation} In \S\ref{sec:results}, we will demonstrate our comparative studies between the aforementioned methods and \methodName. \subsection{Gradient-based Methods for Faithfulness Analysis} Gradient-based methods are widely used as alternatives for attention-based counterparts for quantifying the importance of a specific input feature in making the right prediction \cite{li-etal-2016-visualizing, atanasova-etal-2020-diagnostic}. In this section we discuss the specific gradient-based methods we use, namely saliency, HTA, and our adjusted HTA. \subsubsection{Saliency} Gradient-based saliency is based on the gradient of the output ($y_{c}$) w.r.t. the input embeddings ($\boldsymbol{e}_{i}^{0}$). One of the most accurate variations of the saliency family is the \emph{gradient$\times$input} method \citep{kindermans2016investigating} where the input embeddings is multiplied by the gradients. Thus, the contribution score of input token $i$ is determined by first computing the element-wise product of the input embeddings ($\boldsymbol{e}_{i}^{0}$) and the gradients of the true class output score ($y_{c}$) w.r.t. the input embeddings. Then, the L2 norm of the scaled gradients is computed to derive the final score: \begin{equation} Saliency_{i}=\left\|\frac{\partial y_{c}}{\partial \boldsymbol{e}_{i}^{0}} \odot \boldsymbol{e}_{i}^{0}\right\|_{2} \end{equation} \subsubsection{HTA x Inputs} \label{sec:HTA_x_inputs} To determine an upper bound on the information mixing within each layer, we use a modified version of \emph{Hidden Token Attribution} \citep[HTA]{Brunner2020On}. In the original version, HTA is the sensitivity between any two vectors in the model's computational graph. However, inspired by the \emph{gradient$\times$input} method \citep{kindermans2016investigating}, which has shown more faithful results \citep{atanasova-etal-2020-diagnostic, on_explaining_your_explanationsBERT}, we multiply the input vectors by the gradients and then apply a Frobenius norm. We compute the attribution from hidden embedding $j$ ($\bm e^{\ell-1}_j$) to hidden embedding $i$ ($\bm e^{\ell}_i$) in layer $\ell$ as: \begin{equation} \label{eq:HTA_x_Input} \bm{c}_{i\leftarrow j}^\ell = \left\|\frac{\partial \bm e^{\ell}_i}{\partial \bm e^{\ell-1}_j} \odot \bm e^{\ell-1}_j\right\|_F \end{equation} Computing HTA-based attribution matrices is an extremely computation-intensive task (especially for long texts) due to the high dimensionality of hidden embeddings. Hence, we only use this method for 256 examples from the SST-2 task's validation set. It is worth noting that extracting the HTA-based contribution maps for the aforementioned data took approximately 2 hours, whereas computing the maps for the entire analysis methods stated in \S\ref{sec:analysis_methods} took only 5 seconds.\footnote{Conducted on a 3070 GPU machine.} \subsection{Setup} We employ HuggingFace's Transformers library\footnote{\href{https://github.com/huggingface/transformers}{https://github.com/huggingface/transformers}} \cite{wolf-etal-2020-transformers} and the BERT-base-uncased model. For fine-tuning BERT, epochs vary from 3 to 5, and the batch size and learning rate are 32 and 3e-5, respectively.\footnote{Recommended by \citet{devlin-etal-2019-bert}.} We also carried out the main experiment on BERT-large and ELECTRA \cite{devlin-etal-2019-bert, clark2020electra} where the results are reported at \S\ref{more_models}. After rollout aggregation of each analysis method, we obtain an accumulated attribution matrix for every layer ($\ell$) of BERT. These matrices indicate the overall contribution of each input token to all token representations in layer $\ell$. Since the classifier in a fine-tuned model is attached to the final layer representation of the \textsc{[CLS]} token, we consider the first row (corresponding to \textsc{[CLS]} attributions) of the last layer attribution matrix. This vector represents the contribution of each input token to the model's final decision. As a measure of faithfulness of the resulting vector with the saliency scores, we report the \emph{Spearman’s rank correlation} between the two vectors. \subsection{Results} \input{tables/spearman} \label{sec:results} Table~\ref{tab:spearman} shows the Spearman correlation of saliency scores with the aggregated attribution scores from \textsc{[CLS]} to input tokens at the final layer. In order to determine the contribution of each component of encoder layer to the overall performance, we report the results for attribution analysis methods discussed in \S\ref{sec:analysis_methods}. Our results demonstrate that incorporating the vector norms, residual connection, and both layer normalizations yields the highest correlation ($\mathcal{N_\textsc{Enc}}$). In what follows, we discuss the impact of incorporating various parts in the analysis. \input{plots/sst2_spearman} \subsubsection{On the role of vector norms} As also suggested by \citet{kobayashi-etal-2020-attention-norm}, vector norms play an important role in determining attention outputs. This is highlighted by the significant gap between weight-based and norm-based settings across all datasets in Table~\ref{tab:spearman}. We also show the correlation of the aggregated attention for all layers in Figure~\ref{fig:sst2_spearman}. The norm-based settings ($\mathcal{N}$ and $\mathcal{N_\textsc{Res}}$) attain higher correlation than the weight-based counterparts ($\mathcal{W}$ and $\mathcal{W_\textsc{Res}}$) almost in all layers, confirming the importance of incorporating vector norms. \footnotetext{ As mentioned in \S4.2, this analysis method is based on the original experiment by \citet{abnar-zuidema-2020-quantifying}. Our experiments on SST2 differ from theirs in two aspects: (i) we opted for \emph{gradient$\times$input} saliencies, while they used the sum of gradients (sensitivity) (ii) instead of BERT, they used a DistillBERT fine-tuned model \citep{sanh2019distilbert}. However, their reported results in their sepcific setup (Spearman Corr. = 0.14) still yields significantly lower results than \methodName. } \subsubsection{On the role of residual connections} \citet{kobayashi-etal-2021-incorporating-residual} showed that in the encoder layer, the output representations of each token is mainly determined by its own representation, and the contextualization from other tokens' plays a marginal role. This is in contrary to the simplifying assumption made by \citet{abnar-zuidema-2020-quantifying} who used a fixed context-mixing ratio of $0.5$ (assuming that BERT equally preserves and mixes the representations). This setting is shown as weight-based with fixed residual ($\mathcal{W_\textsc{FixedRes}}$) in Table~\ref{tab:spearman}. We compare this setting against $\mathcal{W_\textsc{Res}}$ (see \S\ref{sec:analysis_methods}). $\mathcal{W_\textsc{Res}}$ is similar to $\mathcal{W_\textsc{FixedRes}}$ (in that it does not take into account vector norms) but differs in that it considers a dynamic mixing ratio (the one from $\mathcal{N_\textsc{Enc}}$). The huge performance gap between the two settings in Table~\ref{tab:spearman} clearly highlights the importance of considering accurate context-mixing ratios. Therefore, it is crucial to consider the residual connection in the attention block for input token attribution analysis. To further demonstrate the role of residual connections, we utilize the introduced method in \S\ref{sec:analysis_methods}, where we modified the norm-based attentions with fixed residual ($r\approx0.5$). The comparison of norm-based without any residual ($\mathcal{N}$) and with a fixed residual ($\mathcal{N_\textsc{FixedRes}}$) shows a consistent improvement for the latter across all the datasets. This provides evidence on that having a fixed uniform context-mixing ratio is better than neglecting the residual connection altogether. Finally, when we aggregate the norm-based analysis with an accurate dynamic context-mixing ratio ($\mathcal{N_\textsc{Res}}$), we observe the highest correlation up to this point, without layer normalization. \subsubsection{On the role of layer normalization} \input{plots/sst2_hta_corr} In Table~\ref{tab:spearman} we see a sudden drop in correlations for $\mathcal{N_\textsc{ResLN}}$. Although this method considers vector norms and residuals, incorporating LN\#1 in the encoder seems to have deteriorated the accuracy for token attribution analysis. To determine whether this deterioration of correlation in aggregated attributions is also present in individual single layers, we compare the HTA maps as a baseline with the attribution matrices extracted from different analysis methods. Figure~\ref{fig:sst2_hta_corr} shows the correlation of HTA attribution maps with the maps obtained by $\mathcal{N_\textsc{Res}}$, $\mathcal{N_\textsc{ResLN}}$, and $\mathcal{N_\textsc{Enc}}$ methods. The results indicate that $\mathcal{N_\textsc{ResLN}}$ exhibits a significantly lower association. The question that arises here is that how incorporating an additional component of the encoder (LN\#1) in $\mathcal{N_\textsc{ResLN}}$ degrades the results (compared to $\mathcal{N_\textsc{Res}}$). \input{plots/ln_weights} To answer this question, we investigated the learned weights of LN\#1 and LN\#2. The outlier weights\footnote{We identify the dimensions where the weights are at least $3\sigma$ from the mean as outliers \cite{kovaleva-etal-2021-bert}.} in specific dimensions of LNs are shown to be significantly influential on the model's performance \cite{kovaleva-etal-2021-bert, luo-etal-2021-positional}. It is interesting to note that based on our observations, the outlier weights of the two layer norms seem to be the opposite of each other. Figure~\ref{fig:ln_weights} demonstrates the weight values in layer 11 and also the correlation of the outlier weights across layers. The large negative correlations confirm that the outlier weights work contrary to each other. We speculate that the effect of outliers in the two layer norms is partly cancelled out when both are considered. As shown in Figure~\ref{fig:encoder_diagram}, the FFN and the second layer normalization are on top of the attention block. However, $\mathcal{N_\textsc{ResLN}}$ does not incorporate the components outside of the attention block. As described in \S\ref{sec:methodology}, in our local analysis method $\mathcal{N_\textsc{Enc}}$ we incorporate the second layer normalization in the transformer's encoder (Figure~\ref{fig:encoder_diagram}), thus considering the whole encoder block (except FFN). Overall, our global method, \methodName, yields the best results among all the methods evaluated in our experiments. In general, Table~\ref{tab:spearman} suggests that incorporating each component of the encoder will increase the correlation; however, the two layer normalizations should be considered together. \input{tables/aggregation} \subsubsection{On the role of aggregation} We carried out an additional analysis to verify if incorporating vector norms, residual connection and layer normalizations in individual layers is adequate for achieving high correlations, or if it is also necessary to aggregate them via rollout. Table~\ref{tab:aggregation} shows the correlation results in different layers for raw attributions (without aggregation) and for the aggregated attributions using the rollout method. Applying rollout method on attribution maps up to each layer results in higher correlations with the saliency scores than the raw single layer attribution maps, especially in deeper layers. Therefore, attention aggregation is essential for global input token attribution analysis. An interesting point in Figure~\ref{fig:sst2_spearman}, which shows the correlation of the aggregated methods throughout the layers, is that the correlation curves flatten out after only a few layers.\footnote{ $\mathcal{W_\textsc{Res}}$ is the only exception with a constant increase; this method is gradually and artificially corrected by $\mathcal{N_\textsc{Enc}}$ context mixing ratios. } This indicates that BERT identifies decisive tokens only after the first few layers. The final layers only make minor adjustments to this order. Nevertheless, it is worth noting that the order of attribution does not necessarily imply the model's final decision and the final result may still change for the better or worse \cite{zhou2020bert}. \subsubsection{Qualitative analysis} To qualitatively answer if the aggregated attribution maps provide plausible and meaningful interpretations, we take a closer look at the attribution maps generated by \methodName. Figure~\ref{fig:sst2_qualitative} shows the \methodName~attribution of the model trained on SST-2. Each layer demonstrates the \textsc{[CLS]} token's aggregated attribution to input tokens up to the corresponding layer. The example inputs are ``a deep and meaningful film.'' and ``big fat waste of time.'', both correctly classified by the model. In both cases, \methodName~focuses on the relevant words for sentiment classification, i.e., ``meaningful'' and ``waste''. An interesting observation in Figure~\ref{fig:sst2_qualitative} is that in the first few layers, the \textsc{[CLS]} token mostly attends to itself while other tokens have marginal impact. As the representations get more contextualized in deeper layers, the attribution correctly shifts to the words which indicate the sentiment of the sentence.\footnote{Complete attention maps in Figure~\ref{fig:sst2_tokens} show that, similarly to \textsc{[CLS]}, other tokens also focus on sentiment tokens.} More examples from MNLI and SST2 datasets, including misclassified examples are available at \S\ref{more_examples}. Our qualitative analysis suggests that \methodName~can be useful for a reasonable interpretation of attention mechanism in BERT, ELECTRA, and possibly any other transformer-based model. \section{Related Work} While numerous studies have used attention weights to analyze and interpret the self-attention mechanism \citep{clark-etal-2019-bert-look, kovaleva-etal-2019-revealing, reif2019visualizing, bert-track-syntactic-dep}, the use of mere attention weights to explain a model's inner workings has been an active topic of debate \citep{serrano-smith-2019-attention, jain-wallace-2019-attention, wiegreffe-pinter-2019-attention}. Several solutions have been proposed to address this issue, usually through converting raw attention weights to scores that provide better explanations. \citet{Brunner2020On} used the transformation function $f^h(\bm{x}_j)$ to introduce \emph{effective attentions}\textemdash the orthogonal component of the attention matrix in $f^h(\bm{x}_j)$ null space\textemdash to explain the inner workings of each layer. However, this technique ignores other components in the encoder and is computationally expensive due to the SVD required to compute the effective attentions. \citet{kobayashi-etal-2020-attention-norm} incorporated the modified vector and introduced a vector norms-based analysis. This was later extended by integrating residual connections and layer normalization components to enhance the accuracy of explanations \cite{kobayashi-etal-2021-incorporating-residual}. But, as discussed in \S\ref{sec:results}, relying solely on LN\#1 does not produce accurate results. While these methods can be employed for single-layer (local) analysis, multi-layer attributions are not necessarily correlated with single-layer attributions due to the significant degree of information combination through multi-layer language models \citep{pascual-etal-2021-telling-full-story, Brunner2020On}. Various saliency methods exist for explaining the model's decision based on the input \citep{li-etal-2016-visualizing, bastings-filippova-2020-elephant, atanasova-etal-2020-diagnostic, on_explaining_your_explanationsBERT, mohebbi-etal-2021-exploring}. However, these approaches are not primarily designed for computing inter-token attributions. To fill this gap, \citet{Brunner2020On} proposed HTA, which is based on the gradient of each hidden embedding in relation to the input embeddings. In \S\ref{sec:HTA_x_inputs}, we extend HTA to incorporate the impact of the input vectors. However, HTA is extremely computationally intensive. Attention rollout (see \S\ref{sec:methodology}) and attention flow\textemdash which involve solving a max-flow problem on the attention graph\textemdash are two aggregation approaches introduced by \citet{abnar-zuidema-2020-quantifying}, in which raw attention weights (with equally weighted residual weights) are aggregated within multiple layers. We showed that attention rollout does not perform well on the raw attention maps of language models fine-tuned on downstream tasks and that this problem can be resolved by utilizing attribution norms. \section{Conclusions} In this work, we proposed a novel method for single layer token attribution analysis which incorporates the whole encoder layer, i.e., the attention block and the output layer normalization. When aggregated across layers using the rollout method, our technique achieves quantitatively and qualitatively plausible results. Our evaluation of different analysis methods provided evidence on roles played by individual components of the encoder layer, i.e., the vector norms, the residual connections, and the layer normalizations. Furthermore, our in-depth analysis suggested that the two layer normalizations in the encoder layer counteract each other; hence, it is important to couple them for an accurate analysis. Additionally, using a newly proposed and improved version of Hidden Token Attribution, we demonstrated that encoder-based attribution analysis is more accurate when compared to other partial solutions in a single layer (local-level). This is consistent with our global observations. Quantifying global input token attribution based on our work can provide a meaningful explanation of the whole model's behavior. In future work, we plan to apply our global analysis method on various datasets and models, to provide valuable insights into model decisions and interpretability.
\section{Introduction} Millimeter wave (mmWave) has been deemed as a key enabling technology for future wireless communications, as they can provide abundant underutilized spectrum resources to achieve higher data rates \cite{Heath_Overview_mmWave}. The short wavelength at mmWave frequency enables a large number of antennas to be packed in a small dimension, which facilitates the utilization of massive multiple-input multiple-output (MIMO) technique in mmWave systems to realize large-scale spatial multiplexing and perform highly directional beamforming \cite{Heath_Overview_mmWave, MassiveMIMOBS_First, Tse_FoWC}. Given the high cost and power consumptions of mmWave radio-frequency (RF) chains, the conventional fully-digital beamforming that requires one dedicated RF chain for each antenna is infeasible for mmWave massive MIMO systems. To address the mmWave hardware constraints while achieving good performance, the hybrid beamforming, using a reduced number of RF chains, has been proposed \cite{Heath_Overview_mmWave}. According to the connections between RF chains and antennas, the hybrid beamforming structures can be categorized as the fully-connected structure (FCS) and partially-connected structure (PCS). In the FCS, each RF chain connects to all antennas via phase shifters, making this structure enjoy full beamforming gains \cite{ JunZhang_MIMO_OFDM_HB, HBF_MUMIMO_BUPT}. The FCS has higher hardware efficiency than fully-digital beamforming but requires large numbers of phase shifters. To further reduce the hardware complexity, the PCS has been proposed. Most existing works focus on the fixed subarrays (FSs) that connect each RF chain to a fixed disjoint subset of antennas \cite{Heath_Overview_mmWave}. The FSs greatly reduce the number of phase shifters, while some beamforming gains are sacrificed. To improve the performance of the PCS, the dynamic subarrays (DSs) where each RF chain is connected to a nonempty disjoint subset of dynamically partitioned antennas have been studied \cite{Heath_SubA_HB, mmWaveWB_Dynamic_DUT, Dynamic_LowCom, Dyanmic_1Ant}. In \cite{Heath_SubA_HB}, the authors first proposed the DS architecture and presented the channel covariance matrix based hybrid beamforming. The authors in \cite{mmWaveWB_Dynamic_DUT} exploited the penalty dual decomposition (PDD) method to get the dynamic hybrid beamforming with low-resolution phase shifters. However, these two works cannot guarantee that each RF chain is connected to at least one antenna, which may result in the problem that the number of used RF chains is smaller than that of data streams. The work in \cite{Dynamic_LowCom} proposed a low complexity greedy hybrid beamforming for DSs. However, all the above works only consider point-to-point communications. In \cite{Dyanmic_1Ant}, the authors considered the multiuser (MU) scenario and proposed the subchannel difference based dynamic hybrid beamforming. However, this paper only considers the single-antenna users, and the proposed method is difficult to scale to the multi-stream communications for multi-antenna users. The main contributions of this letter are as follows: \begin{itemize} \item We consider a more generalized mmWave downlink (DL) MU-MIMO system, where the base station (BS) with DSs simultaneously provides multi-stream communications for each user. The hybrid beamforming for the considered system is more complicated than the scenario with single-antenna users and has been less well studied. \item We proposed a novel hybrid beamforming design for the considered system. We first assume no inter-user interference (IUI) and leverage the singular value decomposition (SVD) of user channels with the waterfilling strategy to get the optimal fully-digital beamformers and combiners. We then propose a Kuhn-Munkres (KM) algorithm aided hybrid beamforming design for DSs, which guarantees that each RF chain is connected to at least one antenna. To null out the IUI, we finally propose to project each obtained digital beamformer onto the null space of all the other equivalent user channels. \item We analyze the computational complexity of the proposed design. Numerical results demonstrate that our proposed design outperforms the conventional related methods. \end{itemize} \vspace{-0.4cm} \section{System Model and Problem Formulation} \subsection{System and Channel Model} Consider a single-cell narrowband mmWave DL MU-MIMO system as illustrated in \figurename{\ref{Fig1}}, in which the BS with DSs simultaneously serves $K$ multi-antenna users. When adopting DSs, the analog beamformer is implemented by the dynamic connection network (DCN) and phase shifters, as shown in \figurename{\ref{Fig1}}. The DCN, realized by a switch network, provides the dynamic connections between the RF chains and antennas. The BS is equipped with $N_{\mathrm{T}}$ antennas and $N_{\mathrm{RF}}$ transmit RF chains. Each user is a fully-digital receiver with $N_{\mathrm{R}}$ antennas. The number of data streams for each user is $N_{s}$. Constrained by the hybrid and fully-digital beamforming structures, we have $K N_{s} \le N_{\mathrm{RF}} \le N_{\mathrm{T}}$ and $N_{s} \le N_{\mathrm{R}}$. \begin{figure}[!t] \centering \includegraphics[width=8.2cm, height=3.5cm]{Systems.pdf} \vspace{-0.3cm} \caption{\label{Fig1} The mmWave MU-MIMO system with dynamic subarrays.} \vspace{-0.55cm} \end{figure} At the BS, the symbol vector for $K$ users $\mathbf{s} = [\mathbf{s}_{1}^{T}, \mathbf{s}_{2}^{T}, ..., \mathbf{s}_{K}^{T}]^{T} \in \mathbb{C}^{K N_{s} \times 1}$ satisfying $\mathbb{E} \{\mathbf{s} \mathbf{s}^{H}\} = \mathbf{I}_{K N_{s}}$, where $\mathbf{s}_{k}$ denotes the symbol vector for USER $k$, is first precoded by the digital beamformer $\mathbf{F}_{\mathrm{BB}} = [\mathbf{F}_{\mathrm{BB}1}, \mathbf{F}_{\mathrm{BB}2}, ..., \mathbf{F}_{\mathrm{BB}K}] \in \mathbb{C}^{N_{\mathrm{RF}} \times K N_{s}}$, in which $\mathbf{F}_{\mathrm{BB}k} \in \mathbb{C}^{N_{\mathrm{RF}} \times N_{s}}$ denotes the digital beamformer for the symbol vector $\mathbf{s}_{k}$, and then up-converted to the mmWave frequency through RF chains and processed by the analog beamformer $\mathbf{F}_{\mathrm{RF}} \in \mathbb{C}^{N_{\mathrm{T}} \times N_{\mathrm{RF}}}$. The final precoded signal $\mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}} \mathbf{s}$ is simultaneously transmitted from the BS to all users. At the receiver USER $k$, the received signal is first down-converted to the baseband and then processed by the fully-digital combiner $\mathbf{W}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{s}}$. Thus, the final received baseband signal is \begin{align*} \widetilde{\mathbf{y}}_{k} = & {} \mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}} \mathbf{s} + \mathbf{W}_{k}^{H} \mathbf{n}_{k} \\ = & {} \underbrace{\mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{k} \mathbf{s}_{k}}_{\text{desired signal}} + \underbrace{\mathbf{W}_{k}^{H} \mathbf{H}_{k} \sum_{i \neq k}^{K} \mathbf{F}_{i} \mathbf{s}_{i}}_{\text{inter-user interference}} + \underbrace{\mathbf{W}_{k}^{H} \mathbf{n}_{k}}_{\text{noise}}, \label{Eq1} \tag{1} \end{align*} where $\mathbf{H}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{T}}}$ is the DL channel from the BS to USER $k$, $\mathbf{n}_{k} \sim \mathcal{CN}\left(\mathbf{0}_{N_{\mathrm{R}} \times 1}, \sigma^{2} \mathbf{I}_{N_{s}}\right)$ is the additive white Gaussian noise vector at USER $k$, and $\mathbf{F}_{k} = \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k}$ denotes the overall hybrid beamformer for the symbol vector $\mathbf{s}_{k}$. We adopt the cluster channel model with consideration of the severe path loss \cite{mmWaveChannelModel_NYU} to characterize the narrowband mmWave channel from the BS to USER $k$, which is \begin{align*} \mathbf{H}_{k} = \sqrt{\frac{N_{\mathrm{T}} N_{\mathrm{R}} \rho_{k}}{N_{c}^{k} N_{ray}^{k}}} \sum_{c = 1}^{N_{c}^{k}} \sum_{r = 1}^{N_{ray}^{k}} \alpha_{cr}^{k} \mathbf{a}_{r}(\theta_{cr}^{k}) \mathbf{a}_{t} (\phi_{cr}^{k})^{H}, \label{Eq2} \tag{2} \end{align*} where $N_{c}^{k}$ is the number of clusters in the channel from the BS to USER $k$, each of which contributes $N_{ray}^{k}$ rays, and $\rho_{k}$ is the path loss. $\alpha_{cr}^{k} \sim \mathcal{CN} (0, 1)$, $\theta_{cr}^{k}$, and $\phi_{cr}^{k}$ denote the complex gain, the angle of departure (AoD) and the angle of arrival (AoA) of the $r$-th ray in the $c$-th cluster for USER $k$, respectively. $\mathbf{a}_{r}(\cdot)$ and $\mathbf{a}_{t} (\cdot)$ are respectively the normalized receive and transmit antenna array response vectors. \vspace{-0.4cm} \subsection{Problem Formulations} In this paper, we assume that the data streams for each user follow the Gaussian distribution and the channel state information is perfectly known at the BS. Then the achievable spectral efficiency (SE) of USER $k$ is \begin{align*} R_{k} = \log_{2} \vert \mathbf{I}_{N_{s}} + \mathbf{C}_{k}^{-1} \mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{k} \mathbf{F}_{k}^{H} \mathbf{H}_{k}^{H} \mathbf{W}_{k} \vert, \label{Eq3} \tag{3} \end{align*} where $\mathbf{C}_{k} = \mathbf{W}_{k}^{H} \mathbf{H}_{k} \left(\sum_{i \neq k}^{K} \mathbf{F}_{i} \mathbf{F}_{i}^{H}\right) \mathbf{H}_{k}^{H} \mathbf{W}_{k} + \sigma_{k}^{2} \mathbf{W}_{k}^{H} \mathbf{W}_{k}$ is the interference-plus-noise covariance matrix at USER $k$. The problem of interest is to jointly design the dynamic hybrid beamformer at the BS and the fully-digital combiner at each user to maximize the overall SE of the mmWave MU-MIMO systems, which is formulated as \begin{align*} \max_{\mathcal{A}} & {} \quad \frac{1}{K} \sum_{k = 1}^{K} R_{k}, \label{Eq4a} \tag{4a} \\ \mathrm{s.t.} \; & {} \quad \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2} = P, \label{Eq4b} \tag{4b} \\ & {} \quad \vert \mathbf{F}_{\mathrm{RF}}(i, j) \vert = 1, \quad \forall (i, j) \in \mathcal{F}, \label{Eq4c} \tag{4c} \\ & {} \quad \Vert \mathbf{F}_{\mathrm{RF}}(i, :) \Vert_{\mathrm{0}} = 1, \quad i = 1, 2, ..., N_{\mathrm{T}}, \label{Eq4d} \tag{4d} \\ & {} \quad \Vert \mathbf{F}_{\mathrm{RF}}(:, j) \Vert_{\mathrm{0}} \ge 1, \; \; \; j = 1, 2, ..., N_{\mathrm{RF}}, \label{Eq4e} \tag{4e} \end{align*} where $\mathcal{A} = \{\mathbf{F}_{\mathrm{RF}}, \{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}, \{\mathbf{W}_{k}\}_{k = 1}^{K}\}$ is the set of optimization variables. \eqref{Eq4b} is the coupling transmit power constraint at the BS, where $P$ is the total transmit power. \eqref{Eq4c} denotes the unit-modulus constraint on each nonzero element of the analog beamformer $\mathbf{F}_{\mathrm{RF}}$, in which $\mathcal{F}$ is the set of nonzero elements of the analog beamformer. \eqref{Eq4d} and \eqref{Eq4e} are two constraints introduced by DSs. The former constraint guarantees that each antenna is only connected to one RF chain, and the latter constraint ensures that each RF chain connects to at least one antenna. Subject to the above constraints and the IUI, problem (4) is highly nonconvex and very difficult to solve. \vspace{-0.5cm} \section{Proposed Hybrid Beamforming Design} In this section, we propose an effective three-stage hybrid beamforming design to solve the nonconvex problem (4). \vspace{-0.5cm} \subsection{Fully-Digital Beamforming When Assuming No IUI} When assuming no IUI, the transmissions from the BS to each user are independent and parallel. Thus, we get the optimal fully-digital beamformers and combiners using the SVD of the user channels and the waterfilling algorithm \cite{Tse_FoWC}. We denote by $\widetilde{\mathbf{F}}_{k}$ the fully-digital beamformer for the symbol vector $\mathbf{s}_{k}$. Let the SVD of the channel from the BS to USER $k$ be $\mathbf{H}_{k} = \mathbf{U}_{k} \mathbf{D}_{k} \mathbf{V}_{k}^{H}$, where $\mathbf{U}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{R}}}$ and $\mathbf{V}_{k} \in \mathbb{C}^{N_{\mathrm{T}} \times N_{\mathrm{T}}}$ are unitary matrices, and $\mathbf{D}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{T}}}$ is a rectangular diagonal matrix whose main diagonal elements are the singular values in decreasing order. Then the optimal fully-digital beamformer and combiner are given by \begin{align*} \widetilde{\mathbf{F}}_{k}^{*} = {} \mathbf{V}_{k}(:, (1:N_{s})) \mathbf{P}_{k}^{\frac{1}{2}}, \quad \mathbf{W}_{k}^{*} = {} \mathbf{U}_{k}(:, (1:N_{s})), \label{Eq5} \tag{5} \vspace{-0.2cm} \end{align*} where $\mathbf{P}_{k}$ is a diagonal matrix whose diagonal element denotes the allocated transmit power for the corresponding data stream by the waterfilling strategy such that $\sum_{k = 1}^{K} \mathrm{Tr}\left(\mathbf{P}_{k}\right) = P$. \vspace{-0.45cm} \subsection{KM Algorithm Aided Hybrid Beamforming for DSs} In mmWave MIMO systems, maximizing SE can be approximately addressed by minimizing the Frobenius norm of the gap between the optimal fully-digital and overall hybrid beamforming \cite{Heath_Overview_mmWave, JunZhang_MIMO_OFDM_HB}. Thus, assuming no IUI, the hybrid beamforming design at the BS can be further written as \begin{align*} \min_{\mathcal{B}} & {} \quad \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}, \label{Eq6a} \tag{6a} \\ \mathrm{s.t.} & {} \quad \Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2} = P_{k}, \quad \forall k = 1, 2, ..., K, \label{Eq6b} \tag{6b} \\ & {} \quad \eqref{Eq4c}-\eqref{Eq4e}, \end{align*} where $\mathcal{B} = \{\mathbf{F}_{\mathrm{RF}}, \{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}\}$, and $P_{k} = \mathrm{Tr}\left(\mathbf{P}_{k}\right)$ such that $\sum_{k = 1}^{K} P_{k} = P$. When solving the above problem, it has been proved that we can first remove the coupling transmit power constraint \eqref{Eq6b} and finally normalize the digital beamformer to satisfy this constraint \cite{JunZhang_MIMO_OFDM_HB}. Thus we propose the following KM algorithm aided hybrid beamforming design for DSs. \subsubsection{Analog beamformer design} As each antenna is only connected to one RF chain, there is only one nonzero element in each row of $\mathbf{F}_{\mathrm{RF}}$. Assuming the $i$-th antenna is connected to the $l_{i}$-th RF chain, the subproblem with respect to $\mathbf{F}_{\mathrm{RF}}$ is equivalently expressed as \begin{align*} \min_{\mathcal{C}} & {} \quad \sum_{i = 1}^{N_{\mathrm{T}}} \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*}(i,:) - \mathbf{F}_{\mathrm{RF}}(i, l_{i}) \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2}, \label{Eq7a} \tag{7a} \\ \mathrm{s.t.} & {} \quad \eqref{Eq4c}-\eqref{Eq4e}. \end{align*} where $\mathcal{C} = \{\mathbf{F}_{\mathrm{RF}}, \{l_{i}\}_{i = 1}^{N_{\mathrm{T}}}\}$. Since there is only one nonzero element in each row of $\mathbf{F}_{\mathrm{RF}}$, we can separately update the nonzero elements of $\mathbf{F}_{\mathrm{RF}}$ row-by-row. When removing the constant terms, the subproblem involving the $i$-th antenna is \begin{align*} \hspace{-0.1cm} \min_{\mathcal{D}_{i}} & {} \; \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2} - 2 \operatorname{Re}\{\mathrm{Tr}\left({A}_{i}^{l_{i}} \mathbf{F}_{\mathrm{RF}}(i, l_{i})^{H}\right)\}, \label{Eq8a} \tag{8a} \\ \hspace{-0.1cm} \mathrm{s.t.} & {} \; \vert \mathbf{F}_{\mathrm{RF}}(i, l_{i})\vert = 1, \quad l_{i} \in \{1, 2, ..., N_{\mathrm{RF}}\}, \label{Eq8b} \tag{8b} \\ \hspace{-0.1cm} & {} \; \Vert \mathbf{F}_{\mathrm{RF}}(i, :) \Vert_{\mathrm{0}} = 1, \label{Eq8c} \tag{8c} \end{align*} where $\mathcal{D}_{i} = \{\mathbf{F}_{\mathrm{RF}}(i, l_{i}), l_{i}\}$ and $A_{i}^{l_{i}} = \sum_{k = 1}^{K} \widetilde{\mathbf{F}}_{k}^{*}(i,:) \mathbf{F}_{\mathrm{BB}k}^{H}(l_{i},:)$. Thus, the optimal solutions to minimize \eqref{Eq8a} are \begin{align*} \hspace{-0.4cm} l_{i}^{*} \hspace{-0.05cm} = \hspace{-0.05cm} \min_{l_{i}} \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2} - 2 \vert A_{i}^{l_{i}} \vert, \mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}^{*}) \hspace{-0.05cm} = \hspace{-0.05cm} \frac{A_{i}^{l_{i}^{*}}}{\vert A_{i}^{l_{i}^{*}} \vert}. \hspace{-0.35cm} \label{Eq9} \tag{9} \end{align*} As constraint \eqref{Eq4e} is not considered in problem (8), the obtained solutions for each antenna using \eqref{Eq9} may not satisfy this constraint. In this case, we reallocate some antennas to the RF chains connected to no antennas. To reallocate antennas, two key questions must be addressed: \textit{how many antennas are required to be reallocated} and \textit{how to select and reallocate the required number of antennas}. For the first question, we give the following proposition. \begin{proposition} \vspace{-0.1cm} \label{Prop1} Let $N_{\mathrm{RF}}^{0}$ denote the number of RF chains connected to no antennas, and then the optimal number of antennas to be reallocated is $N_{\mathrm{RF}}^{0}$. \end{proposition} \begin{proof} Let $f_{i}(\mathcal{D}_{i}^{l_{i}})\hspace{-0.1cm} = \hspace{-0.1cm} \sum_{k = 1}^{K} \hspace{-0.05cm} \Vert \widetilde{\mathbf{F}}_{k}^{*}(i,:) \hspace{-0.05cm} - \hspace{-0.05cm} \mathbf{F}_{\mathrm{RF}}(i, l_{i}) \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2}$, where $\mathcal{D}_{i}^{l_{i}} = \{\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}), l_{i}\}$, $i = 1, 2, ..., N_{\mathrm{T}}$, denotes the $i$-th antenna is connected to the $l_{i}$-th RF chain with the corresponding optimal analog beamformer element $\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}) = \frac{A_{i}^{l_{i}}}{\vert A_{i}^{l_{i}} \vert}$. Thus for the $i$-th antenna, the obtained solution $\mathcal{D}_{i}^{l_{i}^{*}}$ using \eqref{Eq9} can minimize $f_{i}(\mathcal{D}_{i}^{l_{i}})$. Assuming that the $j$-th antenna is reallocated from the $l_{j}^{*}$-th RF chain to the $l_{j}^{\prime}$-th RF chain, we get $f_{j}(\mathcal{D}_{j}^{l_{j}^{\prime}}) \ge f_{j}(\mathcal{D}_{j}^{l_{j}^{*}})$ such that $\sum_{i \ne j}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + f_{j}(\mathcal{D}_{j}^{l_{i}^{\prime}}) \ge \sum_{i \ne j}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + f_{j}(\mathcal{D}_{j}^{l_{i}^{*}})$. Thus, we can infer that the more antennas are reallocated, the larger the objective function \eqref{Eq6a} is. To satisfy the constraint \eqref{Eq4e}, the number of reallocated antennas can not be fewer than $N_{\mathrm{RF}}^{0}$. Therefore, the optimal number of antennas to be reallocated is $N_{\mathrm{RF}}^{0}$. \vspace{-0.1cm} \end{proof} Based on Proposition {\ref{Prop1}}, the second question becomes \textit{how to select $N_{\mathrm{RF}}^{0}$ antennas and reallocate them to $N_{\mathrm{RF}}^{0}$ RF chains}. We denote by $\mathcal{S}_{\mathrm{RA}}$ the set of reallocated antennas thus $\vert \mathcal{S}_{\mathrm{RA}} \vert = N_{\mathrm{RF}}^{0}$. Let $\mathcal{S}_{\mathrm{RF}0}$ be the set of RF chains connected to no antennas. For $i \in \mathcal{S}_{\mathrm{RA}}$, we assume that the $i$-th antenna is only connected to the $l_{i}$-th RF chain, where $l_{i} \in \mathcal{S}_{\mathrm{RF}0}$. Then the objective function \eqref{Eq6a} after the antenna reallocation is \begin{align*} & {} \sum_{i \notin \mathcal{S}_{\mathrm{RA}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + \sum_{i \in \mathcal{S}_{\mathrm{RA}}} f_{i}(\mathcal{D}_{i}^{l_{i}}) \\ = & {} \sum_{i = 1}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + \sum_{i \in \mathcal{S}_{\mathrm{RA}}} (f_{i}(\mathcal{D}_{i}^{l_{i}}) - f_{i}(\mathcal{D}_{i}^{l_{i}^{*}})). \label{Eq10} \tag{10} \end{align*} When not considering constraint \eqref{Eq4e}, the obtained solutions $\{\mathcal{D}_{i}^{l_{i}^{*}}\}_{i = 1}^{N_{\mathrm{T}}}$ achieve the minimum of \eqref{Eq6a}, which is the first term in \eqref{Eq10}. Hence, to minimize the objective function \eqref{Eq6a} after the antenna reallocation, we should minimize the second term in \eqref{Eq10}, which denotes the total increase in \eqref{Eq6a} caused by the antenna reallocation. To address the problem, we first construct the \textit{reallocation cost matrix} $\mathbf{G} \in \mathbb{C}^{M \times N_{\mathrm{RF}}^{0}}$, where $M$ is the number of antennas that can be reallocated. Let $\mathcal{S}_{l}, l = 1, 2, ..., N_{\mathrm{RF}}$, denote the set of antennas connected to the $l$-th RF chain. For the $l$-th RF chain, if it only connects to one antenna, this antenna will not be reallocated to prevent the $l$-th RF chain from being probably connected to no antennas after the antenna reallocation. Thus the set of antennas that can be reallocated is defined as $\mathcal{S}_{\mathrm{CRA}} = \cup_{l} \mathcal{S}_{l}, \text{ where } \vert \mathcal{S}_{l} \vert > 1$, and thus $M = \vert \mathcal{S}_{\mathrm{CRA}} \vert$. $\forall a_{i} \in \mathcal{S}_{\mathrm{CRA}}, l_{j} \in \mathcal{S}_{\mathrm{RF}0}$, where $i$ and $j$ are respectively their positions in $\mathcal{S}_{\mathrm{CRA}}$ and $\mathcal{S}_{\mathrm{RF}0}$, we define the corresponding reallocation cost matrix element $\mathbf{G}(i,j)$ as \begin{align*} \mathbf{G}(i,j) = f_{a_{i}}(\mathcal{D}_{a_{i}}^{l_{j}}) - f_{a_{i}}(\mathcal{D}_{a_{i}}^{l_{a_{i}}^{*}}), \label{Eq11} \tag{11} \end{align*} which denotes the increase in the objective function \eqref{Eq6a} after reallocating the $a_{i}$-th antenna from the optimal $l_{a_{i}}^{*}$-th RF chain to the $l_{j}$-th RF chain. From the proof in Proposition {\ref{Prop1}}, we get $\mathbf{G}(i,j) \ge 0$. Thus the antenna reallocation to minimize the second term in \eqref{Eq10} can be further expressed as \textit{Given the reallocation cost matrix $\mathbf{G}$, where $\mathbf{G}(i, j) \ge 0$, $\forall i, j$, select one element in each column so that these selected elements are in different rows and their sum is minimum.} This is a classical unbalanced assignment problem, which can be efficiently solved by the extended KM algorithm \cite{ExMunkres_Assignment}. If $\mathbf{G}(m,n)$ is selected, we reallocate the $a_{m}$-th antenna from the $l_{a_{m}}^{*}$-th RF chain to the $l_{n}$-th RF chain. There is a special case where all the antennas connected to one RF chain are reallocated. If this happens, we keep the antenna that induces the maximum reallocation cost connected to this RF chain, remove the corresponding row in $\mathbf{G}$, and then reallocate the rest antennas again. Hence the proposed analog beamforming can guarantee that each RF chain is connected to at least one antenna. The details of our proposed KM aided dynamic analog beamforming is summarized in Algorithm {\ref{Algo1}}. \begin{figure}[!t] \let\@latex@error\@gobble \vspace{-9pt} \begin{algorithm}[H] \caption{KM Aided Dynamic Analog Beamformer Design\label{Algo1}} \begin{algorithmic}[1] \State \Input $\{\widetilde{\mathbf{F}}_{k}^{*}\}_{k = 1}^{K}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$, $N_{\mathrm{T}}$, $N_{\mathrm{RF}}$ \State \textbf{Output: } $\mathbf{F}_{\mathrm{RF}}$ \State Initialize $\mathcal{S}_{1} = \mathcal{S}_{2} = ... = \mathcal{S}_{N_{\mathrm{RF}}} = \varnothing$, $\mathcal{S}_{\mathrm{RF}0} = \varnothing$, $\mathcal{S}_{\mathrm{CRA}} = \varnothing$, $\mathbf{F}_{\mathrm{RF}}^{*} = \mathbf{0}_{N_{\mathrm{T}} \times N_{\mathrm{RF}}}$, $i = 1$, $j = 1$, $N_{\mathrm{RF}}^{0} = 0$, $M = 0$. \Repeat \State Get $l_{i}^{*}$ and $\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}^{*})$ according to \eqref{Eq9}, $\mathcal{S}_{l_{i}^{*}} = \mathcal{S}_{l_{i}^{*}} \cup {i}$, $i = i + 1$; \Until{($i > N_{\mathrm{T}}$)} \Repeat \State \textbf{if }{$\vert \mathcal{S}_{j} \vert == 0$} \textbf{then } $\mathcal{S}_{\mathrm{RF}0} = \mathcal{S}_{\mathrm{RF}0} \cup j$, $N_{\mathrm{RF}}^{0} = N_{\mathrm{RF}}^{0} + 1$; \State \textbf{else if }{$\vert \mathcal{S}_{j} \vert > 1$} \textbf{then } $\mathcal{S}_{\mathrm{CRA}} = \mathcal{S}_{\mathrm{CRA}} \cup \mathcal{S}_{j}$, $M = M + 1$; \textbf{end if} \State $j = j + 1$; \Until{($j > N_{\mathrm{RF}}$)} \If{$N_{\mathrm{RF}}^{0} > 0$} \State Construct the \textit{reallocation cost matrix} $\mathbf{G}$ according to \eqref{Eq11}; \Repeat \State Select one element in each column of $\mathbf{G}$ using the extended KM algorithm. Define $\mathcal{Q} = \{(x_{i}, y_{i}) | 1 \le x_{i} \le M, 1 \le y_{i} \le N_{\mathrm{RF}}^{0}, a_{x_{i}} \in \mathcal{S}_{\mathrm{CRA}}, l_{y_{i}} \in \mathcal{S}_{\mathrm{RF}0}, i = 1, 2, ..., N_{\mathrm{RF}}^{0} \}$ as the set of positions of the selected elements in $\mathbf{G}$, $q = 1$, $flag = 0$, $\mathbf{F}_{\mathrm{RF}} = \mathbf{F}_{\mathrm{RF}}^{*}$, $\mathbf{m} \in \mathbf{0}_{N_{\mathrm{RF}}^{0} \times 1}$, and $\mathbf{z} \in \mathbf{0}_{N_{\mathrm{RF}}^{0} \times 1}$; \State Let $\mathcal{S}_{n}^{\prime} = \mathcal{S}_{n}$, $\forall n = 1, 2, ..., N_{\mathrm{RF}}^{0}$; \Repeat \State Get $a_{x_{q}}$ from $\mathcal{S}_{\mathrm{CRA}}$ and $l_{y_{q}}$ from $\mathcal{S}_{\mathrm{RF}0}$, and let $n = 1$; \Repeat \If{$a_{x_{q}} \in \mathcal{S}_{n}^{\prime}$} \State $\mathcal{S}_{n}^{\prime} = \mathcal{S}_{n}^{\prime} \setminus a_{x_{q}}$, $\mathcal{S}_{l_{y_{q}}}^{\prime} = \mathcal{S}_{l_{y_{q}}}^{\prime} \cup a_{x_{q}}$; \State $\mathbf{F}_{\mathrm{RF}}(a_{x_{q}}, l_{a_{x_{q}}}^{*}) = 0$, $\mathbf{F}_{\mathrm{RF}}(a_{x_{q}}, l_{y_{q}}) = \frac{A_{a_{x_{q}}}^{l_{y_{q}}}}{\vert A_{a_{x_{q}}}^{l_{y_{q}}} \vert}$; \If{$\mathbf{m}(n) < \mathbf{G}(x_{q}, y_{q})$} \State $\mathbf{m}(n) = \mathbf{G}(x_{q}, y_{q})$, $\mathbf{z}(n) = x_{q}$; \EndIf \State \textbf{if }{$\vert \mathcal{S}_{n}^{\prime} \vert$ == 0} \textbf{then } $flag = 1$; \textbf{end if} \State \textbf{break}; \Else \State $n = n + 1$; \EndIf \Until{($n > N_{\mathrm{RF}}^{0}$)} \If{$flag == 1$} \State $\mathbf{G} = [\mathbf{G}(1:(\mathbf{z}(n)-1), :)^{T}, \mathbf{G}((\mathbf{z}(n)+1):M, :)^{T}]^{T}$; \State $\mathcal{S}_{\mathrm{CRA}} = \mathcal{S}_{\mathrm{CRA}} \setminus a_{\mathbf{z}(n)}$, $M = \vert \mathcal{S}_{\mathrm{CRA}} \vert$; \State \textbf{break}; \EndIf \State $q = q + 1$; \Until{($flag == 0$ and $q > N_{\mathrm{RF}}^{0}$)} \Until{($flag == 0$)} \Else \State $\mathbf{F}_{\mathrm{RF}} = \mathbf{F}_{\mathrm{RF}}^{*}$; \EndIf \State \Return $\mathbf{F}_{\mathrm{RF}}$. \end{algorithmic} \end{algorithm} \vspace{-1cm} \end{figure} \subsubsection{Digital beamformer design} When the analog beamformer is fixed and the constant terms are removed, the subproblem with respect to the digital beamformer $\mathbf{F}_{\mathrm{BB}k}$ is \begin{align*} \hspace{-0.25cm} \min_{\mathbf{F}_{\mathrm{BB}k}} \hspace{-0.05cm} \mathrm{Tr} (\mathbf{F}_{\mathrm{BB}k}^{H} \mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k}) \hspace{-0.05cm} - \hspace{-0.05cm} 2 \operatorname{Re}\{\mathrm{Tr}(\mathbf{F}_{\mathrm{BB}k}^{H} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*})\}. \hspace{-0.2cm} \label{Eq12} \tag{12} \end{align*} Checking the first-order optimality condition for $\mathbf{F}_{\mathrm{BB}k}$ yields \begin{align*} \mathbf{F}_{\mathrm{BB}k}^{*} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}. \label{Eq13} \tag{13} \end{align*} Update the analog and digital beamformers alternatively until some termination condition triggers. Then we normalize $\mathbf{F}_{\mathrm{BB}k}$ by a factor of $\frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}$ to satisfy the constraint \eqref{Eq6b}. \vspace{-0.4cm} \subsection{Null Space Projection to Cancel the IUI} As the assumption that there is no IUI usually cannot be satisfied, we resort to the null space projection (NSP) method to null out the IUI. For USER $k$, we define $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$ as \begin{align*} \widetilde{\mathbf{H}}_{\mathrm{eq}k} = [\mathbf{H}_{\mathrm{eq}1}^{T}, ..., \mathbf{H}_{\mathrm{eq}(k-1)}^{T}, \mathbf{H}_{\mathrm{eq}(k+1)}^{T}, ..., \mathbf{H}_{\mathrm{eq}K}^{T}]^{T}, \label{Eq14} \tag{14} \end{align*} where $\mathbf{H}_{\mathrm{eq}i} = \mathbf{W}_{i}^{H} \mathbf{H}_{i} \mathbf{F}_{\mathrm{RF}}$ is the equivalent channel for USER $i$. To cancel the IUI, we project the obtained digital beamformer $\mathbf{F}_{\mathrm{BB}k}$ onto the null space of $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$. Let $\mathbf{C}_{k} = \mathcal{N}(\widetilde{\mathbf{H}}_{\mathrm{eq}k})$ be the orthogonal basis for the null space of $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$, and then its projection matrix is $\mathbf{Q}_{k} = \mathbf{C}_{k} (\mathbf{C}_{k}^{H} \mathbf{C}_{k})^{-1} \mathbf{C}_{k}^{H}$. Thus, the obtained digital beamformer after NSP is \begin{align*} \mathbf{F}_{\mathrm{BB}k} = \mathbf{Q}_{k} \mathbf{F}_{\mathrm{BB}k}, \label{Eq15} \tag{15} \end{align*} which is further normalized by a factor of $\frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}$. We summarize our proposed three-stage design in Algorithm {\ref{Algo2}}. We simply analyze the complexity of Algorithm {\ref{Algo2}}. In the first stage, the complexity is dominated by the SVD of the user channels, which is $\mathcal{O}(K(N_{\mathrm{T}} N_{\mathrm{R}}^{2} + N_{\mathrm{T}}^{2} N_{\mathrm{R}}))$. In the second stage, the complexity of updating the analog and digital beamformers is respectively $\mathcal{O}(K N_{\mathrm{T}} N_{\mathrm{RF}} N_{s} + I_{1} I_{2} M (N_{\mathrm{RF}}^{0})^{2})$ and $\mathcal{O}(K I_{1} N_{\mathrm{T}} N_{\mathrm{RF}}^{2})$, where $I_{1}$ and $I_{2}$ denote the number of iterations required by the second stage and Algorithm {\ref{Algo1}}. In the third stage, the complexity of NSP to cancel the IUI is $\mathcal{O}(K (N_{\mathrm{T}} N_{\mathrm{RF}} N_{s} + N_{\mathrm{RF}}^{3}))$. Thus, the overall complexity is $\mathcal{O}(K(N_{\mathrm{T}} N_{\mathrm{R}}^{2} + N_{\mathrm{T}}^{2} N_{\mathrm{R}} + I_{1} N_{\mathrm{T}} N_{\mathrm{RF}}^{2}) + I_{1} I_{2} M (N_{\mathrm{RF}}^{0})^{2})$. \normalem \begin{figure}[t] \let\@latex@error\@gobble \vspace{-9pt} \begin{algorithm}[H] \caption{Proposed Hybrid Beamforming Design for mmWave MU-MIMO Systems with Dynamic Subarrays \label{Algo2}} \begin{algorithmic}[1] \State \Input $\{\mathbf{H}_{k}\}_{k = 1}^{K}$, $N_{\mathrm{T}}$, $N_{\mathrm{R}}$, $N_{\mathrm{RF}}$, $N_{\mathrm{s}}$, $P$ \State \textbf{Output: } $\{\mathbf{W}_{k}\}_{k = 1}^{K}$, $\mathbf{F}_{\mathrm{RF}}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$ \State Define the tolerance of accuracy $\varepsilon$ and the maximum number of iterations $L$. Initialize $k = 1$. \Repeat \Comment{the first stage} \State Get $\widetilde{\mathbf{F}}_{k}^{*}$ and $\mathbf{W}_{k}$ according to \eqref{Eq5}, $P_{k} = \mathrm{Tr}\left(\mathbf{P}_{k}\right)$, $k = k + 1$; \Until{($k > K$)} \State Initialize $\mathbf{F}_{\mathrm{RF}}$ randomly satisfying constraints \eqref{Eq4c}-\eqref{Eq4e}, $\mathbf{F}_{\mathrm{BB}k} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}$, $k = 1, 2, ..., K$, and $l = 1$; \Repeat \Comment{the second stage} \State Update $\mathbf{F}_{\mathrm{RF}}$ using Algorithm {\ref{Algo1}}; \State $\Delta_{1} = \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$; \State $\mathbf{F}_{\mathrm{BB}k} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}$, $k = 1, 2, ..., K$; \State $\Delta_{2} = \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$, $l = l + 1$; \Until{($l > L$ or $\vert \Delta_{1} - \Delta_{2}\vert < \varepsilon$)} \State $\mathbf{F}_{\mathrm{BB}k} = \frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}\mathbf{F}_{\mathrm{BB}k}$, $\forall k = 1, 2, ..., K$. Let $k = 1$; \Repeat \Comment{the third stage} \State Construct $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$ according to \eqref{Eq14}; \State $\mathbf{C}_{k} = \mathcal{N}(\widetilde{\mathbf{H}}_{\mathrm{eq}k})$, $\mathbf{Q}_{k} = \mathbf{C}_{k} (\mathbf{C}_{k}^{H} \mathbf{C}_{k})^{-1} \mathbf{C}_{k}^{H}$; \State $\mathbf{F}_{\mathrm{BB}k} = \mathbf{Q}_{k} \mathbf{F}_{\mathrm{BB}k}$, $\mathbf{F}_{\mathrm{BB}k} = \frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}\mathbf{F}_{\mathrm{BB}k}$, $k = k + 1$; \Until{($k > K$)} \State \Return $\{\mathbf{W}_{k}\}_{k = 1}^{K}$, $\mathbf{F}_{\mathrm{RF}}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$. \end{algorithmic} \end{algorithm} \vspace{-0.66cm} \end{figure} \ULforem \vspace{-0.35cm} \section{Numerical Results} \vspace{-0.1cm} \begin{figure}[!t] \centering \includegraphics[width=5cm, height=3.8cm]{Convg.pdf} \vspace{-0.35cm} \caption{\label{Fig2} Convergence of the second stage in the proposed design.} \vspace{-0.7cm} \end{figure} \vspace{-0.05cm} In this section, we present numerical results to evaluate the performance of the proposed hybrid beamforming design for mmWave MU-MIMO systems with DSs. For comparison, the classical hybrid beamforming for DSs, i.e., \textbf{Mink-L1}\cite{Heath_SubA_HB}, \textbf{DHBF}\footnote{For fair comparisons, we only consider the fully-digital beamforming obtained by the SVD of user channels as in \eqref{Eq5} instead of the PDD method.}\cite{mmWaveWB_Dynamic_DUT}, and \textbf{LowCom}\cite{Dynamic_LowCom}, and that for FSs, i.e., \textbf{SDR-AltMin}\cite{JunZhang_MIMO_OFDM_HB}, are used in the second stage as benchmarks. The hybrid beamforming for mmWave MU-MIMO systems with FCSs in \cite{HBF_MUMIMO_BUPT}, termed \textbf{HBF-FCS}, and the fully-digital beamforming assuming no IUI, named \textbf{FD}, are both considered. In the simulations, the carrier frequency is assumed to be $28 \text{ GHz}$. The cell radius is $40 \text{ m}$, and the path loss for each user is referred to \cite{mmWaveChannelModel_NYU}. For user channel $\mathbf{H}_{k}$, $k = 1, 2, ..., K$, the number of clusters and rays is respectively set as $N_{c}^{k} = 6$ and $N_{ray}^{k} = 15$. The AoAs/AoDs of rays in the same cluster follow the Laplacian distribution with the mean angle uniformly distributed in $[0, 2\pi]$ and the angular spread of $10^{\degree}$. We consider the uniform linear arrays, and the antenna spacing is a half wavelength. Unless otherwise specified, the BS is equipped with $N_{\mathrm{T}} = 64$ antennas and $N_{\mathrm{RF}} = 16$ RF chains and each user with $N_{\mathrm{R}} = 4$ antennas. The number of users is set as $K = 6$, and that of the data streams for each user is $N_{s} = 2$. The total transmit power is $P = 30 \text{ dBm}$, and signal-to-noise ratio (SNR) is defined as $\mathrm{SNR} = \frac{P_{rx}}{\sigma^{2}}$, where $P_{rx}$ is the received power. We set the tolerance of accuracy $\varepsilon = 10^{-4}$ and the maximum number of iterations $L = 200$. Simulation results are averaged over 500 random channel realizations. \begin{figure*}[!t] \centering \subfigcapskip=-5pt \subfigure[]{ \label{Fig3a} \includegraphics[width=0.31 \linewidth]{SE.pdf}} \subfigure[]{ \label{Fig3b} \includegraphics[width=0.31 \linewidth]{SE-OneAnt.pdf}} \subfigure[]{ \label{Fig3c} \includegraphics[width=0.31 \linewidth]{SE-Users.pdf}} \vspace{-0.6em} \caption{\label{Fig3} The spectral efficiency performance of the proposed design. (a) The average spectral efficiency of each multi-antenna user versus SNR. (b) The average spectral efficiency of each single-antenna user versus SNR. (c) The sum spectral efficiency of all users versus the number of users.} \vspace{-1.8em} \end{figure*} \figurename{\ref{Fig2}} shows the convergence of the second stage in our proposed dynamic hybrid beamforming when $\mathrm{SNR} = 10 \text{ dB}$. We observe that the approximation error between the full-digital and hybrid beamformers, which is $\sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$, converges monotonically and well in a few iterations. \figurename{\ref{Fig3a}} presents the average SE of each multi-antenna user in the considered system versus SNR. We observe that the proposed design achieves the SE close to the Mink-L1 method and better than the other hybrid beamforming methods for DSs and FSs. Given that the Mink-L1 method cannot guarantee that each RF chain is connected to at least one antenna, our proposed design has its superiority. The SE of our proposed design is inferior to the HBF-FCS method mainly due to the better beamforming gains in the FCSs. When $\mathrm{SNR} = 20 \text{ dB}$, the proposed design can achieve approximately $79\%$ SE of the HBF-FCS method. Our proposed design is generalized and can also be used in the scenario with single-antenna users. In \figurename{\ref{Fig3b}}, we evaluate the average SE versus SNR in the case where $N_{\mathrm{R}} = 1, N_{\mathrm{s}} = 1$, and $K = 16$. It is seen that the proposed design outperforms the DC-HP (ZF) method in \cite{Dyanmic_1Ant}. \figurename{\ref{Fig3c}} illustrates the sum SE of all users versus the number of users when $\mathrm{SNR} = 10 \text{ dB}$. It is observed that with the increase in users, the sum SE achieved by the proposed design first increases and then decreases, which reaches the maximum at the number of users $K = 6$. This is because when $K$ grows beyond $6$, the IUI increases severely so that the sum SE degrades gradually. The sum SE of the proposed design is better than the DHBF, LowCom, and SDR-AltMin methods. However, when $K$ is large, the Mink-L1 method achieves a little better SE than our proposed design. The probable reason is that the Mink-L1 method cannot guarantee that each RF chain is connected to at least one antenna, making this method less vulnerable to the IUI than our proposed design. \vspace{-0.4cm} \section{Conclusion} \vspace{-0.15cm} In this letter, we proposed an effective three-stage hybrid beamforming design for mmWave MU-MIMO systems with DSs, which can guarantee that each RF chain is connected to at least one antenna and effectively null out the IUI. Numerical results demonstrated that the proposed design can achieve better performance than the related methods for DSs and FSs. \ifCLASSOPTIONcaptionsoff \newpage \fi \vspace{-0.45cm} \normalem \bibliographystyle{IEEEtran} \section{Introduction} Millimeter wave (mmWave) has been deemed as a key enabling technology for future wireless communications, as they can provide abundant underutilized spectrum resources to achieve higher data rates \cite{Heath_Overview_mmWave}. The short wavelength at mmWave frequency enables a large number of antennas to be packed in a small dimension, which facilitates the utilization of massive multiple-input multiple-output (MIMO) technique in mmWave systems to realize large-scale spatial multiplexing and perform highly directional beamforming \cite{Heath_Overview_mmWave, MassiveMIMOBS_First, Tse_FoWC}. Given the high cost and power consumptions of mmWave radio-frequency (RF) chains, the conventional fully-digital beamforming that requires one dedicated RF chain for each antenna is infeasible for mmWave massive MIMO systems. To address the mmWave hardware constraints while achieving good performance, the hybrid beamforming, using a reduced number of RF chains, has been proposed \cite{Heath_Overview_mmWave}. According to the connections between RF chains and antennas, the hybrid beamforming structures can be categorized as the fully-connected structure (FCS) and partially-connected structure (PCS). In the FCS, each RF chain connects to all antennas via phase shifters, making this structure enjoy full beamforming gains \cite{ JunZhang_MIMO_OFDM_HB, HBF_MUMIMO_BUPT}. The FCS has higher hardware efficiency than fully-digital beamforming but requires large numbers of phase shifters. To further reduce the hardware complexity, the PCS has been proposed. Most existing works focus on the fixed subarrays (FSs) that connect each RF chain to a fixed disjoint subset of antennas \cite{Heath_Overview_mmWave}. The FSs greatly reduce the number of phase shifters, while some beamforming gains are sacrificed. To improve the performance of the PCS, the dynamic subarrays (DSs) where each RF chain is connected to a nonempty disjoint subset of dynamically partitioned antennas have been studied \cite{Heath_SubA_HB, mmWaveWB_Dynamic_DUT, Dynamic_LowCom, Dyanmic_1Ant}. In \cite{Heath_SubA_HB}, the authors first proposed the DS architecture and presented the channel covariance matrix based hybrid beamforming. The authors in \cite{mmWaveWB_Dynamic_DUT} exploited the penalty dual decomposition (PDD) method to get the dynamic hybrid beamforming with low-resolution phase shifters. However, these two works cannot guarantee that each RF chain is connected to at least one antenna, which may result in the problem that the number of used RF chains is smaller than that of data streams. The work in \cite{Dynamic_LowCom} proposed a low complexity greedy hybrid beamforming for DSs. However, all the above works only consider point-to-point communications. In \cite{Dyanmic_1Ant}, the authors considered the multiuser (MU) scenario and proposed the subchannel difference based dynamic hybrid beamforming. However, this paper only considers the single-antenna users, and the proposed method is difficult to scale to the multi-stream communications for multi-antenna users. The main contributions of this letter are as follows: \begin{itemize} \item We consider a more generalized mmWave downlink (DL) MU-MIMO system, where the base station (BS) with DSs simultaneously provides multi-stream communications for each user. The hybrid beamforming for the considered system is more complicated than the scenario with single-antenna users and has been less well studied. \item We proposed a novel hybrid beamforming design for the considered system. We first assume no inter-user interference (IUI) and leverage the singular value decomposition (SVD) of user channels with the waterfilling strategy to get the optimal fully-digital beamformers and combiners. We then propose a Kuhn-Munkres (KM) algorithm aided hybrid beamforming design for DSs, which guarantees that each RF chain is connected to at least one antenna. To null out the IUI, we finally propose to project each obtained digital beamformer onto the null space of all the other equivalent user channels. \item We analyze the computational complexity of the proposed design. Numerical results demonstrate that our proposed design outperforms the conventional related methods. \end{itemize} \vspace{-0.4cm} \section{System Model and Problem Formulation} \subsection{System and Channel Model} Consider a single-cell narrowband mmWave DL MU-MIMO system as illustrated in \figurename{\ref{Fig1}}, in which the BS with DSs simultaneously serves $K$ multi-antenna users. When adopting DSs, the analog beamformer is implemented by the dynamic connection network (DCN) and phase shifters, as shown in \figurename{\ref{Fig1}}. The DCN, realized by a switch network, provides the dynamic connections between the RF chains and antennas. The BS is equipped with $N_{\mathrm{T}}$ antennas and $N_{\mathrm{RF}}$ transmit RF chains. Each user is a fully-digital receiver with $N_{\mathrm{R}}$ antennas. The number of data streams for each user is $N_{s}$. Constrained by the hybrid and fully-digital beamforming structures, we have $K N_{s} \le N_{\mathrm{RF}} \le N_{\mathrm{T}}$ and $N_{s} \le N_{\mathrm{R}}$. \begin{figure}[!t] \centering \includegraphics[width=8.2cm, height=3.5cm]{Systems.pdf} \vspace{-0.3cm} \caption{\label{Fig1} The mmWave MU-MIMO system with dynamic subarrays.} \vspace{-0.55cm} \end{figure} At the BS, the symbol vector for $K$ users $\mathbf{s} = [\mathbf{s}_{1}^{T}, \mathbf{s}_{2}^{T}, ..., \mathbf{s}_{K}^{T}]^{T} \in \mathbb{C}^{K N_{s} \times 1}$ satisfying $\mathbb{E} \{\mathbf{s} \mathbf{s}^{H}\} = \mathbf{I}_{K N_{s}}$, where $\mathbf{s}_{k}$ denotes the symbol vector for USER $k$, is first precoded by the digital beamformer $\mathbf{F}_{\mathrm{BB}} = [\mathbf{F}_{\mathrm{BB}1}, \mathbf{F}_{\mathrm{BB}2}, ..., \mathbf{F}_{\mathrm{BB}K}] \in \mathbb{C}^{N_{\mathrm{RF}} \times K N_{s}}$, in which $\mathbf{F}_{\mathrm{BB}k} \in \mathbb{C}^{N_{\mathrm{RF}} \times N_{s}}$ denotes the digital beamformer for the symbol vector $\mathbf{s}_{k}$, and then up-converted to the mmWave frequency through RF chains and processed by the analog beamformer $\mathbf{F}_{\mathrm{RF}} \in \mathbb{C}^{N_{\mathrm{T}} \times N_{\mathrm{RF}}}$. The final precoded signal $\mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}} \mathbf{s}$ is simultaneously transmitted from the BS to all users. At the receiver USER $k$, the received signal is first down-converted to the baseband and then processed by the fully-digital combiner $\mathbf{W}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{s}}$. Thus, the final received baseband signal is \begin{align*} \widetilde{\mathbf{y}}_{k} = & {} \mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}} \mathbf{s} + \mathbf{W}_{k}^{H} \mathbf{n}_{k} \\ = & {} \underbrace{\mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{k} \mathbf{s}_{k}}_{\text{desired signal}} + \underbrace{\mathbf{W}_{k}^{H} \mathbf{H}_{k} \sum_{i \neq k}^{K} \mathbf{F}_{i} \mathbf{s}_{i}}_{\text{inter-user interference}} + \underbrace{\mathbf{W}_{k}^{H} \mathbf{n}_{k}}_{\text{noise}}, \label{Eq1} \tag{1} \end{align*} where $\mathbf{H}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{T}}}$ is the DL channel from the BS to USER $k$, $\mathbf{n}_{k} \sim \mathcal{CN}\left(\mathbf{0}_{N_{\mathrm{R}} \times 1}, \sigma^{2} \mathbf{I}_{N_{s}}\right)$ is the additive white Gaussian noise vector at USER $k$, and $\mathbf{F}_{k} = \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k}$ denotes the overall hybrid beamformer for the symbol vector $\mathbf{s}_{k}$. We adopt the cluster channel model with consideration of the severe path loss \cite{mmWaveChannelModel_NYU} to characterize the narrowband mmWave channel from the BS to USER $k$, which is \begin{align*} \mathbf{H}_{k} = \sqrt{\frac{N_{\mathrm{T}} N_{\mathrm{R}} \rho_{k}}{N_{c}^{k} N_{ray}^{k}}} \sum_{c = 1}^{N_{c}^{k}} \sum_{r = 1}^{N_{ray}^{k}} \alpha_{cr}^{k} \mathbf{a}_{r}(\theta_{cr}^{k}) \mathbf{a}_{t} (\phi_{cr}^{k})^{H}, \label{Eq2} \tag{2} \end{align*} where $N_{c}^{k}$ is the number of clusters in the channel from the BS to USER $k$, each of which contributes $N_{ray}^{k}$ rays, and $\rho_{k}$ is the path loss. $\alpha_{cr}^{k} \sim \mathcal{CN} (0, 1)$, $\theta_{cr}^{k}$, and $\phi_{cr}^{k}$ denote the complex gain, the angle of departure (AoD) and the angle of arrival (AoA) of the $r$-th ray in the $c$-th cluster for USER $k$, respectively. $\mathbf{a}_{r}(\cdot)$ and $\mathbf{a}_{t} (\cdot)$ are respectively the normalized receive and transmit antenna array response vectors. \vspace{-0.4cm} \subsection{Problem Formulations} In this paper, we assume that the data streams for each user follow the Gaussian distribution and the channel state information is perfectly known at the BS. Then the achievable spectral efficiency (SE) of USER $k$ is \begin{align*} R_{k} = \log_{2} \vert \mathbf{I}_{N_{s}} + \mathbf{C}_{k}^{-1} \mathbf{W}_{k}^{H} \mathbf{H}_{k} \mathbf{F}_{k} \mathbf{F}_{k}^{H} \mathbf{H}_{k}^{H} \mathbf{W}_{k} \vert, \label{Eq3} \tag{3} \end{align*} where $\mathbf{C}_{k} = \mathbf{W}_{k}^{H} \mathbf{H}_{k} \left(\sum_{i \neq k}^{K} \mathbf{F}_{i} \mathbf{F}_{i}^{H}\right) \mathbf{H}_{k}^{H} \mathbf{W}_{k} + \sigma_{k}^{2} \mathbf{W}_{k}^{H} \mathbf{W}_{k}$ is the interference-plus-noise covariance matrix at USER $k$. The problem of interest is to jointly design the dynamic hybrid beamformer at the BS and the fully-digital combiner at each user to maximize the overall SE of the mmWave MU-MIMO systems, which is formulated as \begin{align*} \max_{\mathcal{A}} & {} \quad \frac{1}{K} \sum_{k = 1}^{K} R_{k}, \label{Eq4a} \tag{4a} \\ \mathrm{s.t.} \; & {} \quad \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2} = P, \label{Eq4b} \tag{4b} \\ & {} \quad \vert \mathbf{F}_{\mathrm{RF}}(i, j) \vert = 1, \quad \forall (i, j) \in \mathcal{F}, \label{Eq4c} \tag{4c} \\ & {} \quad \Vert \mathbf{F}_{\mathrm{RF}}(i, :) \Vert_{\mathrm{0}} = 1, \quad i = 1, 2, ..., N_{\mathrm{T}}, \label{Eq4d} \tag{4d} \\ & {} \quad \Vert \mathbf{F}_{\mathrm{RF}}(:, j) \Vert_{\mathrm{0}} \ge 1, \; \; \; j = 1, 2, ..., N_{\mathrm{RF}}, \label{Eq4e} \tag{4e} \end{align*} where $\mathcal{A} = \{\mathbf{F}_{\mathrm{RF}}, \{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}, \{\mathbf{W}_{k}\}_{k = 1}^{K}\}$ is the set of optimization variables. \eqref{Eq4b} is the coupling transmit power constraint at the BS, where $P$ is the total transmit power. \eqref{Eq4c} denotes the unit-modulus constraint on each nonzero element of the analog beamformer $\mathbf{F}_{\mathrm{RF}}$, in which $\mathcal{F}$ is the set of nonzero elements of the analog beamformer. \eqref{Eq4d} and \eqref{Eq4e} are two constraints introduced by DSs. The former constraint guarantees that each antenna is only connected to one RF chain, and the latter constraint ensures that each RF chain connects to at least one antenna. Subject to the above constraints and the IUI, problem (4) is highly nonconvex and very difficult to solve. \vspace{-0.5cm} \section{Proposed Hybrid Beamforming Design} In this section, we propose an effective three-stage hybrid beamforming design to solve the nonconvex problem (4). \vspace{-0.5cm} \subsection{Fully-Digital Beamforming When Assuming No IUI} When assuming no IUI, the transmissions from the BS to each user are independent and parallel. Thus, we get the optimal fully-digital beamformers and combiners using the SVD of the user channels and the waterfilling algorithm \cite{Tse_FoWC}. We denote by $\widetilde{\mathbf{F}}_{k}$ the fully-digital beamformer for the symbol vector $\mathbf{s}_{k}$. Let the SVD of the channel from the BS to USER $k$ be $\mathbf{H}_{k} = \mathbf{U}_{k} \mathbf{D}_{k} \mathbf{V}_{k}^{H}$, where $\mathbf{U}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{R}}}$ and $\mathbf{V}_{k} \in \mathbb{C}^{N_{\mathrm{T}} \times N_{\mathrm{T}}}$ are unitary matrices, and $\mathbf{D}_{k} \in \mathbb{C}^{N_{\mathrm{R}} \times N_{\mathrm{T}}}$ is a rectangular diagonal matrix whose main diagonal elements are the singular values in decreasing order. Then the optimal fully-digital beamformer and combiner are given by \begin{align*} \widetilde{\mathbf{F}}_{k}^{*} = {} \mathbf{V}_{k}(:, (1:N_{s})) \mathbf{P}_{k}^{\frac{1}{2}}, \quad \mathbf{W}_{k}^{*} = {} \mathbf{U}_{k}(:, (1:N_{s})), \label{Eq5} \tag{5} \vspace{-0.2cm} \end{align*} where $\mathbf{P}_{k}$ is a diagonal matrix whose diagonal element denotes the allocated transmit power for the corresponding data stream by the waterfilling strategy such that $\sum_{k = 1}^{K} \mathrm{Tr}\left(\mathbf{P}_{k}\right) = P$. \vspace{-0.45cm} \subsection{KM Algorithm Aided Hybrid Beamforming for DSs} In mmWave MIMO systems, maximizing SE can be approximately addressed by minimizing the Frobenius norm of the gap between the optimal fully-digital and overall hybrid beamforming \cite{Heath_Overview_mmWave, JunZhang_MIMO_OFDM_HB}. Thus, assuming no IUI, the hybrid beamforming design at the BS can be further written as \begin{align*} \min_{\mathcal{B}} & {} \quad \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}, \label{Eq6a} \tag{6a} \\ \mathrm{s.t.} & {} \quad \Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2} = P_{k}, \quad \forall k = 1, 2, ..., K, \label{Eq6b} \tag{6b} \\ & {} \quad \eqref{Eq4c}-\eqref{Eq4e}, \end{align*} where $\mathcal{B} = \{\mathbf{F}_{\mathrm{RF}}, \{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}\}$, and $P_{k} = \mathrm{Tr}\left(\mathbf{P}_{k}\right)$ such that $\sum_{k = 1}^{K} P_{k} = P$. When solving the above problem, it has been proved that we can first remove the coupling transmit power constraint \eqref{Eq6b} and finally normalize the digital beamformer to satisfy this constraint \cite{JunZhang_MIMO_OFDM_HB}. Thus we propose the following KM algorithm aided hybrid beamforming design for DSs. \subsubsection{Analog beamformer design} As each antenna is only connected to one RF chain, there is only one nonzero element in each row of $\mathbf{F}_{\mathrm{RF}}$. Assuming the $i$-th antenna is connected to the $l_{i}$-th RF chain, the subproblem with respect to $\mathbf{F}_{\mathrm{RF}}$ is equivalently expressed as \begin{align*} \min_{\mathcal{C}} & {} \quad \sum_{i = 1}^{N_{\mathrm{T}}} \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*}(i,:) - \mathbf{F}_{\mathrm{RF}}(i, l_{i}) \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2}, \label{Eq7a} \tag{7a} \\ \mathrm{s.t.} & {} \quad \eqref{Eq4c}-\eqref{Eq4e}. \end{align*} where $\mathcal{C} = \{\mathbf{F}_{\mathrm{RF}}, \{l_{i}\}_{i = 1}^{N_{\mathrm{T}}}\}$. Since there is only one nonzero element in each row of $\mathbf{F}_{\mathrm{RF}}$, we can separately update the nonzero elements of $\mathbf{F}_{\mathrm{RF}}$ row-by-row. When removing the constant terms, the subproblem involving the $i$-th antenna is \begin{align*} \hspace{-0.1cm} \min_{\mathcal{D}_{i}} & {} \; \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2} - 2 \operatorname{Re}\{\mathrm{Tr}\left({A}_{i}^{l_{i}} \mathbf{F}_{\mathrm{RF}}(i, l_{i})^{H}\right)\}, \label{Eq8a} \tag{8a} \\ \hspace{-0.1cm} \mathrm{s.t.} & {} \; \vert \mathbf{F}_{\mathrm{RF}}(i, l_{i})\vert = 1, \quad l_{i} \in \{1, 2, ..., N_{\mathrm{RF}}\}, \label{Eq8b} \tag{8b} \\ \hspace{-0.1cm} & {} \; \Vert \mathbf{F}_{\mathrm{RF}}(i, :) \Vert_{\mathrm{0}} = 1, \label{Eq8c} \tag{8c} \end{align*} where $\mathcal{D}_{i} = \{\mathbf{F}_{\mathrm{RF}}(i, l_{i}), l_{i}\}$ and $A_{i}^{l_{i}} = \sum_{k = 1}^{K} \widetilde{\mathbf{F}}_{k}^{*}(i,:) \mathbf{F}_{\mathrm{BB}k}^{H}(l_{i},:)$. Thus, the optimal solutions to minimize \eqref{Eq8a} are \begin{align*} \hspace{-0.4cm} l_{i}^{*} \hspace{-0.05cm} = \hspace{-0.05cm} \min_{l_{i}} \sum_{k = 1}^{K} \Vert \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2} - 2 \vert A_{i}^{l_{i}} \vert, \mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}^{*}) \hspace{-0.05cm} = \hspace{-0.05cm} \frac{A_{i}^{l_{i}^{*}}}{\vert A_{i}^{l_{i}^{*}} \vert}. \hspace{-0.35cm} \label{Eq9} \tag{9} \end{align*} As constraint \eqref{Eq4e} is not considered in problem (8), the obtained solutions for each antenna using \eqref{Eq9} may not satisfy this constraint. In this case, we reallocate some antennas to the RF chains connected to no antennas. To reallocate antennas, two key questions must be addressed: \textit{how many antennas are required to be reallocated} and \textit{how to select and reallocate the required number of antennas}. For the first question, we give the following proposition. \begin{proposition} \vspace{-0.1cm} \label{Prop1} Let $N_{\mathrm{RF}}^{0}$ denote the number of RF chains connected to no antennas, and then the optimal number of antennas to be reallocated is $N_{\mathrm{RF}}^{0}$. \end{proposition} \begin{proof} Let $f_{i}(\mathcal{D}_{i}^{l_{i}})\hspace{-0.1cm} = \hspace{-0.1cm} \sum_{k = 1}^{K} \hspace{-0.05cm} \Vert \widetilde{\mathbf{F}}_{k}^{*}(i,:) \hspace{-0.05cm} - \hspace{-0.05cm} \mathbf{F}_{\mathrm{RF}}(i, l_{i}) \mathbf{F}_{\mathrm{BB}k}(l_{i},:) \Vert_{\mathrm{F}}^{2}$, where $\mathcal{D}_{i}^{l_{i}} = \{\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}), l_{i}\}$, $i = 1, 2, ..., N_{\mathrm{T}}$, denotes the $i$-th antenna is connected to the $l_{i}$-th RF chain with the corresponding optimal analog beamformer element $\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}) = \frac{A_{i}^{l_{i}}}{\vert A_{i}^{l_{i}} \vert}$. Thus for the $i$-th antenna, the obtained solution $\mathcal{D}_{i}^{l_{i}^{*}}$ using \eqref{Eq9} can minimize $f_{i}(\mathcal{D}_{i}^{l_{i}})$. Assuming that the $j$-th antenna is reallocated from the $l_{j}^{*}$-th RF chain to the $l_{j}^{\prime}$-th RF chain, we get $f_{j}(\mathcal{D}_{j}^{l_{j}^{\prime}}) \ge f_{j}(\mathcal{D}_{j}^{l_{j}^{*}})$ such that $\sum_{i \ne j}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + f_{j}(\mathcal{D}_{j}^{l_{i}^{\prime}}) \ge \sum_{i \ne j}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + f_{j}(\mathcal{D}_{j}^{l_{i}^{*}})$. Thus, we can infer that the more antennas are reallocated, the larger the objective function \eqref{Eq6a} is. To satisfy the constraint \eqref{Eq4e}, the number of reallocated antennas can not be fewer than $N_{\mathrm{RF}}^{0}$. Therefore, the optimal number of antennas to be reallocated is $N_{\mathrm{RF}}^{0}$. \vspace{-0.1cm} \end{proof} Based on Proposition {\ref{Prop1}}, the second question becomes \textit{how to select $N_{\mathrm{RF}}^{0}$ antennas and reallocate them to $N_{\mathrm{RF}}^{0}$ RF chains}. We denote by $\mathcal{S}_{\mathrm{RA}}$ the set of reallocated antennas thus $\vert \mathcal{S}_{\mathrm{RA}} \vert = N_{\mathrm{RF}}^{0}$. Let $\mathcal{S}_{\mathrm{RF}0}$ be the set of RF chains connected to no antennas. For $i \in \mathcal{S}_{\mathrm{RA}}$, we assume that the $i$-th antenna is only connected to the $l_{i}$-th RF chain, where $l_{i} \in \mathcal{S}_{\mathrm{RF}0}$. Then the objective function \eqref{Eq6a} after the antenna reallocation is \begin{align*} & {} \sum_{i \notin \mathcal{S}_{\mathrm{RA}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + \sum_{i \in \mathcal{S}_{\mathrm{RA}}} f_{i}(\mathcal{D}_{i}^{l_{i}}) \\ = & {} \sum_{i = 1}^{N_{\mathrm{T}}} f_{i}(\mathcal{D}_{i}^{l_{i}^{*}}) + \sum_{i \in \mathcal{S}_{\mathrm{RA}}} (f_{i}(\mathcal{D}_{i}^{l_{i}}) - f_{i}(\mathcal{D}_{i}^{l_{i}^{*}})). \label{Eq10} \tag{10} \end{align*} When not considering constraint \eqref{Eq4e}, the obtained solutions $\{\mathcal{D}_{i}^{l_{i}^{*}}\}_{i = 1}^{N_{\mathrm{T}}}$ achieve the minimum of \eqref{Eq6a}, which is the first term in \eqref{Eq10}. Hence, to minimize the objective function \eqref{Eq6a} after the antenna reallocation, we should minimize the second term in \eqref{Eq10}, which denotes the total increase in \eqref{Eq6a} caused by the antenna reallocation. To address the problem, we first construct the \textit{reallocation cost matrix} $\mathbf{G} \in \mathbb{C}^{M \times N_{\mathrm{RF}}^{0}}$, where $M$ is the number of antennas that can be reallocated. Let $\mathcal{S}_{l}, l = 1, 2, ..., N_{\mathrm{RF}}$, denote the set of antennas connected to the $l$-th RF chain. For the $l$-th RF chain, if it only connects to one antenna, this antenna will not be reallocated to prevent the $l$-th RF chain from being probably connected to no antennas after the antenna reallocation. Thus the set of antennas that can be reallocated is defined as $\mathcal{S}_{\mathrm{CRA}} = \cup_{l} \mathcal{S}_{l}, \text{ where } \vert \mathcal{S}_{l} \vert > 1$, and thus $M = \vert \mathcal{S}_{\mathrm{CRA}} \vert$. $\forall a_{i} \in \mathcal{S}_{\mathrm{CRA}}, l_{j} \in \mathcal{S}_{\mathrm{RF}0}$, where $i$ and $j$ are respectively their positions in $\mathcal{S}_{\mathrm{CRA}}$ and $\mathcal{S}_{\mathrm{RF}0}$, we define the corresponding reallocation cost matrix element $\mathbf{G}(i,j)$ as \begin{align*} \mathbf{G}(i,j) = f_{a_{i}}(\mathcal{D}_{a_{i}}^{l_{j}}) - f_{a_{i}}(\mathcal{D}_{a_{i}}^{l_{a_{i}}^{*}}), \label{Eq11} \tag{11} \end{align*} which denotes the increase in the objective function \eqref{Eq6a} after reallocating the $a_{i}$-th antenna from the optimal $l_{a_{i}}^{*}$-th RF chain to the $l_{j}$-th RF chain. From the proof in Proposition {\ref{Prop1}}, we get $\mathbf{G}(i,j) \ge 0$. Thus the antenna reallocation to minimize the second term in \eqref{Eq10} can be further expressed as \textit{Given the reallocation cost matrix $\mathbf{G}$, where $\mathbf{G}(i, j) \ge 0$, $\forall i, j$, select one element in each column so that these selected elements are in different rows and their sum is minimum.} This is a classical unbalanced assignment problem, which can be efficiently solved by the extended KM algorithm \cite{ExMunkres_Assignment}. If $\mathbf{G}(m,n)$ is selected, we reallocate the $a_{m}$-th antenna from the $l_{a_{m}}^{*}$-th RF chain to the $l_{n}$-th RF chain. There is a special case where all the antennas connected to one RF chain are reallocated. If this happens, we keep the antenna that induces the maximum reallocation cost connected to this RF chain, remove the corresponding row in $\mathbf{G}$, and then reallocate the rest antennas again. Hence the proposed analog beamforming can guarantee that each RF chain is connected to at least one antenna. The details of our proposed KM aided dynamic analog beamforming is summarized in Algorithm {\ref{Algo1}}. \begin{figure}[!t] \let\@latex@error\@gobble \vspace{-9pt} \begin{algorithm}[H] \caption{KM Aided Dynamic Analog Beamformer Design\label{Algo1}} \begin{algorithmic}[1] \State \Input $\{\widetilde{\mathbf{F}}_{k}^{*}\}_{k = 1}^{K}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$, $N_{\mathrm{T}}$, $N_{\mathrm{RF}}$ \State \textbf{Output: } $\mathbf{F}_{\mathrm{RF}}$ \State Initialize $\mathcal{S}_{1} = \mathcal{S}_{2} = ... = \mathcal{S}_{N_{\mathrm{RF}}} = \varnothing$, $\mathcal{S}_{\mathrm{RF}0} = \varnothing$, $\mathcal{S}_{\mathrm{CRA}} = \varnothing$, $\mathbf{F}_{\mathrm{RF}}^{*} = \mathbf{0}_{N_{\mathrm{T}} \times N_{\mathrm{RF}}}$, $i = 1$, $j = 1$, $N_{\mathrm{RF}}^{0} = 0$, $M = 0$. \Repeat \State Get $l_{i}^{*}$ and $\mathbf{F}_{\mathrm{RF}}^{*}(i, l_{i}^{*})$ according to \eqref{Eq9}, $\mathcal{S}_{l_{i}^{*}} = \mathcal{S}_{l_{i}^{*}} \cup {i}$, $i = i + 1$; \Until{($i > N_{\mathrm{T}}$)} \Repeat \State \textbf{if }{$\vert \mathcal{S}_{j} \vert == 0$} \textbf{then } $\mathcal{S}_{\mathrm{RF}0} = \mathcal{S}_{\mathrm{RF}0} \cup j$, $N_{\mathrm{RF}}^{0} = N_{\mathrm{RF}}^{0} + 1$; \State \textbf{else if }{$\vert \mathcal{S}_{j} \vert > 1$} \textbf{then } $\mathcal{S}_{\mathrm{CRA}} = \mathcal{S}_{\mathrm{CRA}} \cup \mathcal{S}_{j}$, $M = M + 1$; \textbf{end if} \State $j = j + 1$; \Until{($j > N_{\mathrm{RF}}$)} \If{$N_{\mathrm{RF}}^{0} > 0$} \State Construct the \textit{reallocation cost matrix} $\mathbf{G}$ according to \eqref{Eq11}; \Repeat \State Select one element in each column of $\mathbf{G}$ using the extended KM algorithm. Define $\mathcal{Q} = \{(x_{i}, y_{i}) | 1 \le x_{i} \le M, 1 \le y_{i} \le N_{\mathrm{RF}}^{0}, a_{x_{i}} \in \mathcal{S}_{\mathrm{CRA}}, l_{y_{i}} \in \mathcal{S}_{\mathrm{RF}0}, i = 1, 2, ..., N_{\mathrm{RF}}^{0} \}$ as the set of positions of the selected elements in $\mathbf{G}$, $q = 1$, $flag = 0$, $\mathbf{F}_{\mathrm{RF}} = \mathbf{F}_{\mathrm{RF}}^{*}$, $\mathbf{m} \in \mathbf{0}_{N_{\mathrm{RF}}^{0} \times 1}$, and $\mathbf{z} \in \mathbf{0}_{N_{\mathrm{RF}}^{0} \times 1}$; \State Let $\mathcal{S}_{n}^{\prime} = \mathcal{S}_{n}$, $\forall n = 1, 2, ..., N_{\mathrm{RF}}^{0}$; \Repeat \State Get $a_{x_{q}}$ from $\mathcal{S}_{\mathrm{CRA}}$ and $l_{y_{q}}$ from $\mathcal{S}_{\mathrm{RF}0}$, and let $n = 1$; \Repeat \If{$a_{x_{q}} \in \mathcal{S}_{n}^{\prime}$} \State $\mathcal{S}_{n}^{\prime} = \mathcal{S}_{n}^{\prime} \setminus a_{x_{q}}$, $\mathcal{S}_{l_{y_{q}}}^{\prime} = \mathcal{S}_{l_{y_{q}}}^{\prime} \cup a_{x_{q}}$; \State $\mathbf{F}_{\mathrm{RF}}(a_{x_{q}}, l_{a_{x_{q}}}^{*}) = 0$, $\mathbf{F}_{\mathrm{RF}}(a_{x_{q}}, l_{y_{q}}) = \frac{A_{a_{x_{q}}}^{l_{y_{q}}}}{\vert A_{a_{x_{q}}}^{l_{y_{q}}} \vert}$; \If{$\mathbf{m}(n) < \mathbf{G}(x_{q}, y_{q})$} \State $\mathbf{m}(n) = \mathbf{G}(x_{q}, y_{q})$, $\mathbf{z}(n) = x_{q}$; \EndIf \State \textbf{if }{$\vert \mathcal{S}_{n}^{\prime} \vert$ == 0} \textbf{then } $flag = 1$; \textbf{end if} \State \textbf{break}; \Else \State $n = n + 1$; \EndIf \Until{($n > N_{\mathrm{RF}}^{0}$)} \If{$flag == 1$} \State $\mathbf{G} = [\mathbf{G}(1:(\mathbf{z}(n)-1), :)^{T}, \mathbf{G}((\mathbf{z}(n)+1):M, :)^{T}]^{T}$; \State $\mathcal{S}_{\mathrm{CRA}} = \mathcal{S}_{\mathrm{CRA}} \setminus a_{\mathbf{z}(n)}$, $M = \vert \mathcal{S}_{\mathrm{CRA}} \vert$; \State \textbf{break}; \EndIf \State $q = q + 1$; \Until{($flag == 0$ and $q > N_{\mathrm{RF}}^{0}$)} \Until{($flag == 0$)} \Else \State $\mathbf{F}_{\mathrm{RF}} = \mathbf{F}_{\mathrm{RF}}^{*}$; \EndIf \State \Return $\mathbf{F}_{\mathrm{RF}}$. \end{algorithmic} \end{algorithm} \vspace{-1cm} \end{figure} \subsubsection{Digital beamformer design} When the analog beamformer is fixed and the constant terms are removed, the subproblem with respect to the digital beamformer $\mathbf{F}_{\mathrm{BB}k}$ is \begin{align*} \hspace{-0.25cm} \min_{\mathbf{F}_{\mathrm{BB}k}} \hspace{-0.05cm} \mathrm{Tr} (\mathbf{F}_{\mathrm{BB}k}^{H} \mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k}) \hspace{-0.05cm} - \hspace{-0.05cm} 2 \operatorname{Re}\{\mathrm{Tr}(\mathbf{F}_{\mathrm{BB}k}^{H} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*})\}. \hspace{-0.2cm} \label{Eq12} \tag{12} \end{align*} Checking the first-order optimality condition for $\mathbf{F}_{\mathrm{BB}k}$ yields \begin{align*} \mathbf{F}_{\mathrm{BB}k}^{*} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}. \label{Eq13} \tag{13} \end{align*} Update the analog and digital beamformers alternatively until some termination condition triggers. Then we normalize $\mathbf{F}_{\mathrm{BB}k}$ by a factor of $\frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}$ to satisfy the constraint \eqref{Eq6b}. \vspace{-0.4cm} \subsection{Null Space Projection to Cancel the IUI} As the assumption that there is no IUI usually cannot be satisfied, we resort to the null space projection (NSP) method to null out the IUI. For USER $k$, we define $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$ as \begin{align*} \widetilde{\mathbf{H}}_{\mathrm{eq}k} = [\mathbf{H}_{\mathrm{eq}1}^{T}, ..., \mathbf{H}_{\mathrm{eq}(k-1)}^{T}, \mathbf{H}_{\mathrm{eq}(k+1)}^{T}, ..., \mathbf{H}_{\mathrm{eq}K}^{T}]^{T}, \label{Eq14} \tag{14} \end{align*} where $\mathbf{H}_{\mathrm{eq}i} = \mathbf{W}_{i}^{H} \mathbf{H}_{i} \mathbf{F}_{\mathrm{RF}}$ is the equivalent channel for USER $i$. To cancel the IUI, we project the obtained digital beamformer $\mathbf{F}_{\mathrm{BB}k}$ onto the null space of $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$. Let $\mathbf{C}_{k} = \mathcal{N}(\widetilde{\mathbf{H}}_{\mathrm{eq}k})$ be the orthogonal basis for the null space of $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$, and then its projection matrix is $\mathbf{Q}_{k} = \mathbf{C}_{k} (\mathbf{C}_{k}^{H} \mathbf{C}_{k})^{-1} \mathbf{C}_{k}^{H}$. Thus, the obtained digital beamformer after NSP is \begin{align*} \mathbf{F}_{\mathrm{BB}k} = \mathbf{Q}_{k} \mathbf{F}_{\mathrm{BB}k}, \label{Eq15} \tag{15} \end{align*} which is further normalized by a factor of $\frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}$. We summarize our proposed three-stage design in Algorithm {\ref{Algo2}}. We simply analyze the complexity of Algorithm {\ref{Algo2}}. In the first stage, the complexity is dominated by the SVD of the user channels, which is $\mathcal{O}(K(N_{\mathrm{T}} N_{\mathrm{R}}^{2} + N_{\mathrm{T}}^{2} N_{\mathrm{R}}))$. In the second stage, the complexity of updating the analog and digital beamformers is respectively $\mathcal{O}(K N_{\mathrm{T}} N_{\mathrm{RF}} N_{s} + I_{1} I_{2} M (N_{\mathrm{RF}}^{0})^{2})$ and $\mathcal{O}(K I_{1} N_{\mathrm{T}} N_{\mathrm{RF}}^{2})$, where $I_{1}$ and $I_{2}$ denote the number of iterations required by the second stage and Algorithm {\ref{Algo1}}. In the third stage, the complexity of NSP to cancel the IUI is $\mathcal{O}(K (N_{\mathrm{T}} N_{\mathrm{RF}} N_{s} + N_{\mathrm{RF}}^{3}))$. Thus, the overall complexity is $\mathcal{O}(K(N_{\mathrm{T}} N_{\mathrm{R}}^{2} + N_{\mathrm{T}}^{2} N_{\mathrm{R}} + I_{1} N_{\mathrm{T}} N_{\mathrm{RF}}^{2}) + I_{1} I_{2} M (N_{\mathrm{RF}}^{0})^{2})$. \normalem \begin{figure}[t] \let\@latex@error\@gobble \vspace{-9pt} \begin{algorithm}[H] \caption{Proposed Hybrid Beamforming Design for mmWave MU-MIMO Systems with Dynamic Subarrays \label{Algo2}} \begin{algorithmic}[1] \State \Input $\{\mathbf{H}_{k}\}_{k = 1}^{K}$, $N_{\mathrm{T}}$, $N_{\mathrm{R}}$, $N_{\mathrm{RF}}$, $N_{\mathrm{s}}$, $P$ \State \textbf{Output: } $\{\mathbf{W}_{k}\}_{k = 1}^{K}$, $\mathbf{F}_{\mathrm{RF}}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$ \State Define the tolerance of accuracy $\varepsilon$ and the maximum number of iterations $L$. Initialize $k = 1$. \Repeat \Comment{the first stage} \State Get $\widetilde{\mathbf{F}}_{k}^{*}$ and $\mathbf{W}_{k}$ according to \eqref{Eq5}, $P_{k} = \mathrm{Tr}\left(\mathbf{P}_{k}\right)$, $k = k + 1$; \Until{($k > K$)} \State Initialize $\mathbf{F}_{\mathrm{RF}}$ randomly satisfying constraints \eqref{Eq4c}-\eqref{Eq4e}, $\mathbf{F}_{\mathrm{BB}k} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}$, $k = 1, 2, ..., K$, and $l = 1$; \Repeat \Comment{the second stage} \State Update $\mathbf{F}_{\mathrm{RF}}$ using Algorithm {\ref{Algo1}}; \State $\Delta_{1} = \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$; \State $\mathbf{F}_{\mathrm{BB}k} = (\mathbf{F}_{\mathrm{RF}}^{H} \mathbf{F}_{\mathrm{RF}})^{-1} \mathbf{F}_{\mathrm{RF}}^{H} \widetilde{\mathbf{F}}_{k}^{*}$, $k = 1, 2, ..., K$; \State $\Delta_{2} = \sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$, $l = l + 1$; \Until{($l > L$ or $\vert \Delta_{1} - \Delta_{2}\vert < \varepsilon$)} \State $\mathbf{F}_{\mathrm{BB}k} = \frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}\mathbf{F}_{\mathrm{BB}k}$, $\forall k = 1, 2, ..., K$. Let $k = 1$; \Repeat \Comment{the third stage} \State Construct $\widetilde{\mathbf{H}}_{\mathrm{eq}k}$ according to \eqref{Eq14}; \State $\mathbf{C}_{k} = \mathcal{N}(\widetilde{\mathbf{H}}_{\mathrm{eq}k})$, $\mathbf{Q}_{k} = \mathbf{C}_{k} (\mathbf{C}_{k}^{H} \mathbf{C}_{k})^{-1} \mathbf{C}_{k}^{H}$; \State $\mathbf{F}_{\mathrm{BB}k} = \mathbf{Q}_{k} \mathbf{F}_{\mathrm{BB}k}$, $\mathbf{F}_{\mathrm{BB}k} = \frac{\sqrt{P_{k}}}{\Vert \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}}\mathbf{F}_{\mathrm{BB}k}$, $k = k + 1$; \Until{($k > K$)} \State \Return $\{\mathbf{W}_{k}\}_{k = 1}^{K}$, $\mathbf{F}_{\mathrm{RF}}$, $\{\mathbf{F}_{\mathrm{BB}k}\}_{k = 1}^{K}$. \end{algorithmic} \end{algorithm} \vspace{-0.66cm} \end{figure} \ULforem \vspace{-0.35cm} \section{Numerical Results} \vspace{-0.1cm} \begin{figure}[!t] \centering \includegraphics[width=5cm, height=3.8cm]{Convg.pdf} \vspace{-0.35cm} \caption{\label{Fig2} Convergence of the second stage in the proposed design.} \vspace{-0.7cm} \end{figure} \vspace{-0.05cm} In this section, we present numerical results to evaluate the performance of the proposed hybrid beamforming design for mmWave MU-MIMO systems with DSs. For comparison, the classical hybrid beamforming for DSs, i.e., \textbf{Mink-L1}\cite{Heath_SubA_HB}, \textbf{DHBF}\footnote{For fair comparisons, we only consider the fully-digital beamforming obtained by the SVD of user channels as in \eqref{Eq5} instead of the PDD method.}\cite{mmWaveWB_Dynamic_DUT}, and \textbf{LowCom}\cite{Dynamic_LowCom}, and that for FSs, i.e., \textbf{SDR-AltMin}\cite{JunZhang_MIMO_OFDM_HB}, are used in the second stage as benchmarks. The hybrid beamforming for mmWave MU-MIMO systems with FCSs in \cite{HBF_MUMIMO_BUPT}, termed \textbf{HBF-FCS}, and the fully-digital beamforming assuming no IUI, named \textbf{FD}, are both considered. In the simulations, the carrier frequency is assumed to be $28 \text{ GHz}$. The cell radius is $40 \text{ m}$, and the path loss for each user is referred to \cite{mmWaveChannelModel_NYU}. For user channel $\mathbf{H}_{k}$, $k = 1, 2, ..., K$, the number of clusters and rays is respectively set as $N_{c}^{k} = 6$ and $N_{ray}^{k} = 15$. The AoAs/AoDs of rays in the same cluster follow the Laplacian distribution with the mean angle uniformly distributed in $[0, 2\pi]$ and the angular spread of $10^{\degree}$. We consider the uniform linear arrays, and the antenna spacing is a half wavelength. Unless otherwise specified, the BS is equipped with $N_{\mathrm{T}} = 64$ antennas and $N_{\mathrm{RF}} = 16$ RF chains and each user with $N_{\mathrm{R}} = 4$ antennas. The number of users is set as $K = 6$, and that of the data streams for each user is $N_{s} = 2$. The total transmit power is $P = 30 \text{ dBm}$, and signal-to-noise ratio (SNR) is defined as $\mathrm{SNR} = \frac{P_{rx}}{\sigma^{2}}$, where $P_{rx}$ is the received power. We set the tolerance of accuracy $\varepsilon = 10^{-4}$ and the maximum number of iterations $L = 200$. Simulation results are averaged over 500 random channel realizations. \begin{figure*}[!t] \centering \subfigcapskip=-5pt \subfigure[]{ \label{Fig3a} \includegraphics[width=0.31 \linewidth]{SE.pdf}} \subfigure[]{ \label{Fig3b} \includegraphics[width=0.31 \linewidth]{SE-OneAnt.pdf}} \subfigure[]{ \label{Fig3c} \includegraphics[width=0.31 \linewidth]{SE-Users.pdf}} \vspace{-0.6em} \caption{\label{Fig3} The spectral efficiency performance of the proposed design. (a) The average spectral efficiency of each multi-antenna user versus SNR. (b) The average spectral efficiency of each single-antenna user versus SNR. (c) The sum spectral efficiency of all users versus the number of users.} \vspace{-1.8em} \end{figure*} \figurename{\ref{Fig2}} shows the convergence of the second stage in our proposed dynamic hybrid beamforming when $\mathrm{SNR} = 10 \text{ dB}$. We observe that the approximation error between the full-digital and hybrid beamformers, which is $\sum_{k = 1}^{K} \Vert \widetilde{\mathbf{F}}_{k}^{*} - \mathbf{F}_{\mathrm{RF}} \mathbf{F}_{\mathrm{BB}k} \Vert_{\mathrm{F}}^{2}$, converges monotonically and well in a few iterations. \figurename{\ref{Fig3a}} presents the average SE of each multi-antenna user in the considered system versus SNR. We observe that the proposed design achieves the SE close to the Mink-L1 method and better than the other hybrid beamforming methods for DSs and FSs. Given that the Mink-L1 method cannot guarantee that each RF chain is connected to at least one antenna, our proposed design has its superiority. The SE of our proposed design is inferior to the HBF-FCS method mainly due to the better beamforming gains in the FCSs. When $\mathrm{SNR} = 20 \text{ dB}$, the proposed design can achieve approximately $79\%$ SE of the HBF-FCS method. Our proposed design is generalized and can also be used in the scenario with single-antenna users. In \figurename{\ref{Fig3b}}, we evaluate the average SE versus SNR in the case where $N_{\mathrm{R}} = 1, N_{\mathrm{s}} = 1$, and $K = 16$. It is seen that the proposed design outperforms the DC-HP (ZF) method in \cite{Dyanmic_1Ant}. \figurename{\ref{Fig3c}} illustrates the sum SE of all users versus the number of users when $\mathrm{SNR} = 10 \text{ dB}$. It is observed that with the increase in users, the sum SE achieved by the proposed design first increases and then decreases, which reaches the maximum at the number of users $K = 6$. This is because when $K$ grows beyond $6$, the IUI increases severely so that the sum SE degrades gradually. The sum SE of the proposed design is better than the DHBF, LowCom, and SDR-AltMin methods. However, when $K$ is large, the Mink-L1 method achieves a little better SE than our proposed design. The probable reason is that the Mink-L1 method cannot guarantee that each RF chain is connected to at least one antenna, making this method less vulnerable to the IUI than our proposed design. \vspace{-0.4cm} \section{Conclusion} \vspace{-0.15cm} In this letter, we proposed an effective three-stage hybrid beamforming design for mmWave MU-MIMO systems with DSs, which can guarantee that each RF chain is connected to at least one antenna and effectively null out the IUI. Numerical results demonstrated that the proposed design can achieve better performance than the related methods for DSs and FSs. \ifCLASSOPTIONcaptionsoff \newpage \fi \vspace{-0.45cm} \normalem \bibliographystyle{IEEEtran}
\section{Introduction} Resource theory measures quantum resources (e.g., entanglement and coherence) and considers the difference between what tasks are possible with and without the resources. The generality of resource theory enables us to analyze fundamental physical problems in resource-theoretical settings. Within this background, resource theory has produced many variants \cite{QT1,QT2,RToC0,RToC1,Marvian_thesis,skew_resource,Takagi_skew,Marvian_distillation,YT,WAY_RToA1,WAY_RToA2,TN,TSS,TSS2,TS,Marvian2018,Lostaglio2018,TSL_RToA,e-EKZhou,e-EKYang,Liu1,Liu2}. These variants differ in the types of situations and resources they treat, depending on the target problem, and each of them constitutes a field in quantum physics. One of the most fundamental variants is the resource theory of asymmetry (RTA) \cite{Marvian_thesis,skew_resource,Takagi_skew,Marvian_distillation,YT,WAY_RToA1,WAY_RToA2,TN,TSS,TSS2,TS,Marvian2018,Lostaglio2018,TSL_RToA,e-EKZhou,e-EKYang,Liu1,Liu2}, the subject of this paper. RTA is a resource theory that treats symmetries of dynamics \cite{Marvian_thesis,skew_resource,Takagi_skew,Marvian_distillation}. Because it is related to symmetry, a fundamental concept in physics, it has a wide range of applications including constructing accurate clocks \cite{Marvian_distillation,woods_autonomous_2019}, accurate measurements on non-conserved quantities \cite{WAY_RToA1,WAY_RToA2,TN}, unitary gate implementation \cite{TSS,TSS2,TS}, coherence distribution \cite{Marvian2018,Lostaglio2018}, quantum speed limit \cite{TSL_RToA}, quantum error correction \cite{TS,e-EKZhou,e-EKYang,Liu1,Liu2}, and black hole information loss problem \cite{TS}. Despite these applications, the foundations of RTA still have several parts that can be extended. One such part is in quantifying resources. In resource theories, we often try to clarify the limitations of performance given a certain amount of a resource. Therefore, quantifying resources is important in every variant of resource theory. Given its importance, a quantification has also been done in RTA \cite{skew_resource,Takagi_skew,Marvian_distillation,YT}. When the symmetry is described by U(1), i.e., with a single conserved quantity, a good resource measure is known. Quantum Fisher information \cite{Helstrom} satisfies the suitable properties of a resource measure and has a clear physical meaning related to quantum fluctuation of the conserved quantity corresponding to the symmetry \cite{skew_resource,Takagi_skew,Marvian_distillation}. Quantum Fisher information is also useful in constructing a theory for the convertibility of pure states in the non-i.i.d. (independent and identically distributed) regime in RTA \cite{YT}. However, it is not clear what the resource measure with similar properties is for general symmetries, for which there are multiple conserved quantities. In this paper, we show that the quantum Fisher information matrix is a resource measure whenever the symmetry is described by a connected linear Lie group. Here, all the basic properties of the resource measure, including monotonicity, are given as matrix inequalities. So far, resource measures have never been given as matrices, and our result is the first example in resource theory where a matrix provides a resource measure. Our result also corresponds to the multivariable extension of the results that Fisher information is a resource measure if the symmetry described by U(1) \cite{skew_resource,Takagi_skew,Marvian_distillation}. If we restrict the symmetry to that described by U(1), our results recover the known results produced so far. We also consider the physical meanings of the quantum Fisher information matrix. In each variant of resource theory, each resource has a physical meaning much like entanglement means a type of quantum correlation. Quantum Fisher information, which is a resource measure when the symmetry is described by U(1), relates to the quantum fluctuation of the conserved quantity corresponding to the symmetry \cite{min_V_Petz,min_V_Yu,Luo,Hansen,Marvian_distillation}. In this paper, we extend the above meaning of quantum Fisher information to the quantum Fisher information matrix and give three results. The first result is a proof that the quantum Fisher information matrix satisfies the conditions that characterize quantum fluctuation. There are several criteria given by Luo for the characterization of quantum fluctuations \cite{Luo}, and it is known that Fisher information satisfies them \cite{skew_resource,Takagi_skew,GII}. We extend Luo's criteria to matrices and show that the quantum Fisher information matrix satisfies these extended criteria. The second result is a comprehension of the relationship between the quantum Fisher information of a mixed state and the covariance matrix of its purification. It is known that the quantum Fisher information of a mixed state is equal to the minimum of the variance of its purification \cite{Marvian_distillation}. We extend this result to situations having multiple conserved quantities. As a result, we show that the quantum Fisher information matrix is equal to four times the minimum of the covariance matrix of its purification. The third result is the relationship between the quantum Fisher information matrix of the mixed state and the average of the covariance matrix when decomposing the mixed state into its pure state. It is also known that quantum Fisher information is equal to four times the minimum average of the variances \cite{min_V_Petz,min_V_Yu}. We show by giving a counterexample that this theorem does not hold in the case of multiple conserved quantities. The structure of this paper is as follows. In section \ref{preliminary}, we overview the elementary basics required for this paper. In particular, we review that, given U(1) symmetry, the quantum Fisher information is a resource measure, and is a measure of the quantum fluctuation of the conserved quantity. In section \ref{results}, we show the main results in this paper. Specificaly, the quantum Fisher information matrix is a resource measure whenever symmetry is described by a connected linear Lie group and then consider how other properties of the quantum Fisher information are inherited by the quantum Fisher information matrix. In section \ref{conclusion}, we summarize this paper. All proofs of the theorems in section \ref{results} are given in the appendix. \section{Preliminary}\label{preliminary} In this section, we outline the prerequisites required in this paper. \subsection{Resource theory} In resource theory, we define ``free states" as states that we can easily prepare and ``free operations" as operations that we can easily perform. We consider ``resource states" as states that we cannot realize by combining free states and free operations. Depending on the definition of the free state and free operation, resource theory treats different resources. For example, suppose we define free states as separable states and free operations as local operations and classical communications (LOCC). In this scenario, the resource is called entanglement, and quantum teleportation can be performed using it. To consider what operations are possible with a certain amount of a resource, knowing how much of that resource is available in a state is essential. We call a function a resource measure when the function of a quantum state $R(\rho)$ satisfies the following conditions \cite{resource-review}: \begin{enumerate} \item \(R(\rho)\ge0\) \item \(R(\rho)=0\Longleftrightarrow\)\(\rho\) is free state \item \(\mathcal{E}\) is free operation \(\Longrightarrow R(\rho) \ge R(\mathcal{E}(\rho))\). \end{enumerate} The first condition means that the function $R$ assesses the amount of the resource. The second condition implies that a free state is a state without resources, and the third condition implies that a free operation is a quantum operation that does not increase the resource. \subsection{Groups and symmetry} When a system's properties are invariant under a class of operations, e.g., rotations and translations, we say the system is symmetric under the operations. In general, symmetries of a system are described by a group, which we now define. \begin{definition} A group is a set $G$ together with a binary operation on $G$ that combines any two elements $a,b\in G$ to form an element $ab\in G$ such that following three requirements are satisfied: \begin{enumerate} \item \(\forall a,b,c\in G,\ (ab)c=a(bc)\) \item \(\exists e\in G,\forall a\in G,\ ae=ea=a\) \item \(\forall a\in G,\exists a^{-1}\in G,\ a^{-1}a=aa^{-1}=e\). \end{enumerate} \end{definition} When a quantum system is isolated from the environment, its time evolution is described by a unitary operator. That is, a state $\rho$ on the system evolves as \(\rho\rightarrow U\rho U^{-1}\) where $U$ is a unitary operator that acts on the Hilbert space describing the system. When the isolated quantum system has symmetry described by a group $G$, the unitary dynamics $U$ is an element of the projective unitary representationof the group $G$. A projective unitary representationof group $G$ on a Hilbert space \(\mathcal{H}\) is a map from group $G$ to the Hilbert space $\mathcal{H}$ satisfying \begin{equation}\label{eq:projective-representation} U(g_1)U(g_2)=e^{i\omega(g_1,g_2)}U(g_1 g_2). \end{equation} In particular, if \(e^{i\omega(g_1,g_2)}=1\) holds for any $g_1,g_2\in G$, then \(U(g)\) is a unitary representation. In general, situations where the group $G$ is U(1) or $\mathbb{R}$ correspond to situations where there is one conserved quantity. In contrast, symmetries described by the more general group $G$ correspond to situations with multiple conserved quantities. \subsection{Linear Lie groups and Lie rings} When a system has continuous symmetry, a linear Lie group describes the symmetry. Let \(M(n,\mathbb{C})\) be the set of complex matrices and \(GL(n,\mathbb{C})\coloneqq\{X\in M(n,\mathbb{C})\mid\det X \neq 0\}\) be the set of regular matrices, which is called a general Lie group. \begin{definition} A linear Lie group is defined as a closed subgroup of the general Lie group $GL(n,\mathbb{C})$ \end{definition} A closed set implies that any sequences of points in \(G\) converge to the element in \(G\). The unitary group of degree $n$, denoted $U(n)$, is a linear Lie group for which the elements satisfy $uu^\dagger=1=u^\dagger u$ for all $u\in U(n)$. \begin{definition} A Lie ring $V$ is a vector space over real numbers $\mathbb{R}$ or complex numbers $\mathbb{C}$ together with a binary operation $[\cdot,\cdot]\colon V\times V\to V$ called the Lie bracket satisfying \begin{align} &[x+y,z]=[x,z]+[y,z]\\ &[ax,y]=a[x,y],\quad \forall a\in \mathbb{R}\ (\mathrm{or} \ a\in\mathbb{C})\\ &[x,y]=-[y,x]\\ &[x,[y,z]]+[y,[z,x]]+[z,[x,y]]=0. \end{align} If the vector space $V$ is a real vector space, $V$ is called a real Lie ring. \end{definition} Defining a set $\mathfrak{g}$ as $\mathfrak{g}:=\{X\in M(n,\mathbb{C})\mid\forall t,\exp tX\in G\}$ for a Lie group $G$, the set $\mathfrak{g}$ is a real Lie ring and called the Lie ring of linear Lie group $G$ for which the Lie bracket $[\cdot,\cdot]$ is defined as $[X,Y]=YX-XY$. For example, the Lie ring of a general linear Lie group $GL(n,\mathbb{C}) $ is \(\mathfrak{gl}(n,\mathbb{C})=M(n,\mathbb{C})\) and the Lie ring of the unitary group $U(n)$ is \(\mathfrak{u}(n)=\{X\in M(n,\mathbb{C})\mid X^\dagger=-X\}\). A representation of a Lie ring $\mathfrak{g}$ is a homomorphism from the Lie ring $\mathfrak{g}$ to the Lie ring $\mathfrak{gl}(n,\mathbb{C})$, formally, a map \(\Phi:\mathfrak{g}\to\mathfrak{gl}(n,\mathbb{C})\) satisfying three conditions: \begin{align} &\Phi(aX)=a\Phi(X)\\ &\Phi(X+Y)=\Phi(X)+\Phi(Y)\\ &\Phi([X,Y])=[\Phi(X),\Phi(Y)]. \end{align} The following theorem implies that a representation of a linear Lie group \(G\) naturally yields a representation of its Lie ring \(\mathfrak{g}\). \begin{theorem}\label{Th-differential-representation} Let $G$ and $H$ be linear Lie groups and \(\Phi:G\to H\) be a continuous homomorphism. And let $\mathfrak{g}$ and $\mathfrak{h}$ be the Lie rings of the linear Lie groups $G$ and $H$, respectively. Then, there exists a unique linear map \(L(\Phi)=\varphi\colon\mathfrak{g}\to \mathfrak{h}\) satisfying \(\exp\varphi(X)=\Phi(\exp X)\). Furthermore, the following holds: \begin{enumerate} \item \(\varphi([X,Y])=[\varphi(X),\varphi(Y)]\) \item \(\left.\varphi(X)=\frac{d}{dt}\Phi(\exp tX)\right|_{t=0}\). \end{enumerate} \end{theorem} Next, we consider a connected linear Lie group. \begin{definition} A set $G$ is said to be path-connected if, for any $x$ and $b$ in $G$, there exists a continuous function \(f:[0,1]\to G\) such that \(f(0)=x\) and \(f(1)=y\). \end{definition} If a set $G$ is a linear Lie group, connectedness and path-connectedness are equivalent. The following theorem holds for a connected linear Lie group \(G\). \begin{theorem}\label{Th-connected} For a linear Lie group, the following conditions are equivalent: \begin{enumerate}[(i)] \item \(G\) is connected. \item \(G\) is generated by \(\exp \mathfrak{g}\). That is, for any \(g\in G\), there exists \(x_1,x_2,\ldots,x_m\in \mathfrak{g}\) such that \(g=\exp x_1 \exp x_2 \cdots \exp x_m\) \end{enumerate} \end{theorem} \subsection{Resource theory of asymmetry} RTA is a resource theory that treats the sensitivity of quantum states for the transformations caused by dynamics with symmetry. We first define within RTA the free states and free operations, which are known as symmetric states and covariant operations, respectively. We define them for a group \(G\) and its projective unitary representation \(\{U(g)\}_{g\in G}\) as follows \cite{Marvian_thesis} \begin{definition} A symmetric state is a quantum state $\rho$ satisfying \begin{equation} U(g) \rho U(g)^{-1}=\rho,\enskip\forall g\in G. \end{equation} \end{definition} Otherwise, the state is called asymmetric. \begin{definition} A covariant operation is a completely positive and trace preserving (CPTP) map $\mathcal{E}$ satisfying \begin{equation} \mathcal{E} (U_{\mathrm{in}}(g) \rho U_{\mathrm{in}}(g)^{-1}) = U_{\mathrm{out}}(g) \mathcal{E} (\rho) U_{\mathrm{out}}(g)^{-1} \end{equation} for any $g\in G$ where \(\{U_{\mathrm{in}}(g)\}\) and \(\{U_\mathrm{out}(g)\}\) are projective unitary representations of $G$ on input and output Hilbert spaces \(\mathcal{H}_{\mathrm{in}}\) and \(\mathcal{H}_{\mathrm{out}}\), respectively. \end{definition} From the above definition, we see that asymmetric states cannot be produced by symmetric states and covariant operations. Indeed, if \(\mathcal{E}\) is a covariant operation, we know that, for any symmetric state \(\rho\), $\calE(\rho)$ is also a symmetric state: \begin{align} U_{\mathrm{out}}(g)\mathcal{E}(\rho)U_{\mathrm{out}}(g)^{-1}&=\mathcal{E}(U_{\mathrm{in}}(g) \rho U_{\mathrm{in}}(g)^{-1})\nonumber\\ & = \mathcal{E}(\rho),\enskip \forall g\in G. \end{align} For simplicity in the following discussion, we restrict ourselves to instances for which $\{U_{\mathrm{in}}(g)\}$ and $\{U_{\mathrm{out}}(g)\}$ are equal. We here remark that the physical meaning of a covariant operation. A unitary operation $V$ is said to be a covariant unitary if for any $g\in G$, $[V,U(g)]=0$. Defining \(\mathcal{E}_V(\rho)\coloneqq V\rho V^{-1}\) for a covariant unitary operation $V$, $\mathcal{E}$ is a covariant operation. In this case, \(\mathcal{E}_V\) is a quantum operation implemented by dynamics satisfying the conservation law. The same is true for general covariant operations; specifically, the following theorem holds\cite{Marvian_thesis}. \begin{theorem} Let $\{U(g)\}_{g\in G}$ be a projective unitary representation of a linear Lie group that describes a symmetry of system $S$ and a quantum operation $\mathcal{E}$ be a covariant operation on $S$. Then, there exists a Hilbert space $\mathcal{H}$ with a (non-projective) unitary representation $\{U_R(g)\}$ of $G$ and a symmetric pure state $\ket{\eta}$ in this space and a covariant unitary $V$ acting on Hilbert space $\mathcal{H}_S\otimes\mathcal{H}_R$ such that \begin{equation} \mathcal{E} (\rho) = \mathrm{tr} _R [V \rho\otimes \ketbra{\eta}{\eta} V^{-1}]. \end{equation} \end{theorem} This theorem implies that a covariant operation is implemented by the dynamics that satisfies the conservation law and a state commuting with the conserved quantity. \subsection{Fisher information} When the group $G$ describing the symmetry is U(1), several known resource measures exist, in particular, the quantum Fisher information. Although the quantum Fisher information for a quantum system depends on the inner product chosen, there is a well-known definition of the quantum Fisher information applicable to a wide range of inner products \cite{MCFisher, Petz1996}. We introduce this definition in the following. A standard operator function $f$ is a monotonic function satisfying \begin{enumerate} \item \(f(1)=1\) \item \(f(x)=xf(x^{-1})\) \item \(0 \le A \le B \Rightarrow f(A) \le f(B)\). \end{enumerate} Using this, we define the quantum Fisher information for a smooth quantum state family $\{\rho_t\}_{t\in\mathbb{R}}$ as \begin{equation} J^f_{\rho_t}=\mathrm{tr} \left[ \left( \frac{\partial \rho_t}{\partial t} \right) \left( \mathbb{J}^f_{\rho_t} \right) ^{-1} \left( \frac{\partial\rho_t}{\partial t} \right) \right] \end{equation} where \(\mathbb{J}^f_{\rho}=f(\mathbb{L_\rho}\mathbb{R_\rho}^{-1})\mathbb{R}_\rho\), \(\mathbb{L}_\rho(X)=\rho X\) and \(\mathbb{R}_\rho(X)=X\rho\). A projective unitary representation of U(1) for system $S$ is written as \(U_t=e^{-itH}\) where $H$ is a periodic Hermitian operator ,i.e, \(e^{iH\tau}=1\) holds for some non-zero real number $\tau$. The quantum Fisher information for a family of quantum states $\{\rho_t\}_{t\in\mathbb{R}}$ is \begin{equation} F_\rho^f (H) = \left. J^f_{U_t \rho U_t^{-1}} \right|_{t=0}, \end{equation} which is a resource measure satisfying Conditions 1--3 \cite{skew_resource,Takagi_skew}. We derive this fact from the monotonicity of the quantum Fisher information under a CPTP map and the definition of the covariant operation. Also, given the spectral decomposition of the quantum state $\rho$ with \(\rho=\sum_{i=1}^d p_i \ketbra{\psi_i}{\psi_i}\), we represent \begin{equation} F_\rho^f(H)=\sum_{i,j=1}^d \frac{(p_i-p_j)^2}{p_j f \left(\frac{p_i}{p_j}\right)}\left|\Braket{\psi_i|H|\psi_j}\right|^2. \end{equation} \subsection{Relationship between Fisher information and quantum fluctuation} The quantum Fisher information defined in the previous section has the property of a measure of quantum fluctuation. Here we use "quantum fluctuation" as the part of fluctuation caused through quantum superposition. To define what quantity can measure a quantum fluctuation, we employ in this paper the criteria adopted by Luo \cite{Luo}. Given a function $Q_\rho(H)$ of a quantum state $\rho$ and a Hermitian operator $H$, $Q_\rho(H)$ measures the quantum fluctuation of $H$ in $\rho$ if it satisfies Luo's criteria: \begin{align} &0\le Q_{\rho}(H)\le V_{\rho}(H)\\ &\rho\ is\ pure \Rightarrow Q_{\rho}(H)=V_{\rho}(H)\\ &[\rho,H]=0 \Rightarrow Q_\rho(H)=0\\ &Q_{\sum_ip_i\rho_i}(H)\le\sum_ip_iQ_{\rho_i}(H) \end{align} where \(V_\rho(H)\) is the variance of $H$ in the state \(\rho\). A metric adjusted skew information is defined as \begin{equation} I_{\rho}^f(H)=(f(0)/2)F_{\rho}^f(H) \end{equation} which satisfies Luo's criteria for any $f$ \cite{Hansen}. Therefore, for any $f$, the quantum Fisher information is the quantum fluctuation of the conserved quantity. Specifically, the quantum Fisher information for \(f(x)=(1+x)/2\) is called the symmetric logarithmic derivatve (SLD) Fisher information, which we write simply as \(F_{\rho}(H)\). The SLD quantum Fisher information has excellent properties in describing quantum fluctuations, and concerning the variance the following theorem holds \cite{Marvian_distillation}. \begin{theorem}\label{th:Marvian} Consider a system $S$ with a Hermitian operator $H_S$ and a quantum state $\rho$. The quantum Fisher information $F_\rho(H_S)$ can then be written as \begin{equation} F_{\rho}(H_S)=4\min_{\ket{\psi_{\rho}},H_R}V_{\ket{\psi_{\rho}}}(H_S+H_R) \end{equation} where \(V_{\ket{\phi}} (H) \) denotes the variance, which is defined as $V_{ \ket{\phi} } (H) := \braket{\phi|H^2|\phi} - \braket{\phi|H|\phi}^2$, and $\ket{\psi_\rho}$ is purification of the state $\rho$, and $H_R$ is a Hermitian operator of the auxiliary system $R$. \end{theorem} From this theorem, another critical theorem concerning the relationship between the quantum Fisher information and variance is derived \cite{min_V_Petz,min_V_Yu}. \begin{theorem}\label{th:YU} Consider a system $S$ with a Hermitian operator $H_S$ and a quantum state $\rho$ with decomposition \(\rho=\sum_i p_i \ketbra{\phi_i}{\phi_i}\). Note that this decomposition is not necessarily a spectral decomposition and is not unique. Then, the quantum Fisher information $F_\rho(H_S)$ can be written as \begin{equation} F_\rho(H)=4\min_{p_i,\ket{\phi_i}}\sum_i p_i V_{\ket{\phi_i}}(H). \end{equation} \end{theorem} \section{Main results}\label{results} In the previous section, we saw that Fisher information is a resource measure when U(1) represents the symmetry. This section shows what quantity is a resource measure when the system has a more general symmetry than U(1). As we shall see, the quantum Fisher information matrix is a resource measure for an arbitrary connected Lie group symmetry. First, we consider the case where the $N$-dimensional real numbers $\mathbb{R}^N$ describe the symmetry. It corresponds to the situation where linearly independent multiple conserved quantities exist. Next, we show that the quantum Fisher information matrix is a resource measure whenever a connected linear Lie group describes the symmetry. We then see which properties of the quantum Fisher information when $G=U(1)$ carry over to the quantum Fisher information matrix. \subsection{Fisher information matrix as a resource measure} Let $\{\rho_t\}_{t\in \mathbb{R}^{N}}$ be a smooth quantum state family. The $(i,j)$ component of the quantum Fisher matrix is defined as \cite{Petz2002} \begin{equation} \left(J^f_{\rho_t}\right)_{ij}=\mathrm{tr} \left[ \left( \frac{\partial \rho_t}{\partial t_i} \right) \left( \mathbb{J}^f_{\rho_t} \right) ^{-1} \left( \frac{\partial\rho_t}{\partial t_j} \right) \right]. \end{equation} Define the unitary operator $U_t=e^{-i\sum_k t_k X_k}$ with $X=(X_1,X_2,\ldots,X_N)$ as a set of $N$ linearly independent Hermitian operators. The quantum Fisher information matrix for a family of quantum states $\{\rho_t\}_t=\{U_t\rho U_t^{-1}\}_t$ is denoted by \begin{equation} \left( \hat{F}_\rho ^f (X_1,\ldots,X_N) \right)_{kl}=\left.\left( \hat{J}_{U_t\rho U_t^{-1}}^f \right)_{kl}\right|_{t=0} \end{equation} which is a function of the state $\rho$ and the set of operators $X_1,\ldots,X_N$. In particular, given a quantum state \(\rho\) with spectral decomposition \(\rho=\sum_{i=1}^d p_i\ketbra{\psi_i}{\psi_i}\), the quantum Fisher information matrix can be expressed as \begin{equation} \left( \hat{F}_{\rho}^f(\{X_k\}) \right)_{kl}=\sum_{i,j=1}^d\frac{(p_i-p_j)^2}{p_j f\left( \frac{p_i}{p_j} \right)} \Braket{\psi_i|X_k|\psi_j}\Braket{\psi_j|X_l|\psi_i} \end{equation} The following theorem implies that the quantum Fisher information matrix $\hat{F}_\rho^f(\{X_n\}^{N}_{n=1})$ is a resource measure when there are multiple conserved quantities. \begin{theorem}\label{th:multiple-conserved} Let $(X_1,X_2,\ldots,X_N)$ be a set of linearly independent Hermitian operators and $U_t=e^{-i\sum_k t_k X_k}$ be a projective unitary representation of the $N$-dimensional real numbers $\mathbb{R}^N$. Then, the quantum Fisher information matrix is a resource measure, i.e., it satisfies \begin{align} &\hat{F}_{\rho}^f(X_1,\ldots,X_N)\ge0 \label{Fisher-matrix-positivity} \\ &\hat{F}_{\rho}^f(X_1,\ldots,X_N)=0\Leftrightarrow [\rho,U_t]=0,\ \forall t\in \mathbb{R}^N \label{Fisher-matrix-free-state} \\ &\hat{F}_\rho^f(X_1,\ldots,X_N)\ge\hat{F}_{\mathcal{E}(\rho)}^f(X_1,\ldots,X_N) \label{Fisher-matrix-free-operation} \end{align} where \(\mathcal{E}\) is a covariant operation. Here, all of the above inequalities are matrix inequalities. \end{theorem} We can extend the above theorem to the more general case, in which a more general Lie group $G$ describes the symmetry. \begin{theorem}\label{th:resoruce-measure1} Let $G$ be a linear Lie group and $\{U(g)\}_{g\in G}$ be a projective unitary representation of $G$ on a Hilbert space $\mathcal{H}$. Then, there exists a map \(\varphi\) from the Lie ring $\mathfrak{g}$ of $G$ to the Lie ring $\mathfrak{u}(\mathcal{H})$ such that \begin{equation} \hat{F}_\rho^f(\{X_n\})=0\Rightarrow [\rho,U(g)]=0,\quad \forall g\in G\label{eq:fmrsp} \end{equation} where \(X_l\coloneqq -i\varphi(x_l)\) with basis $\{x_l\}$ in $\mathfrak{g}$. If $G$ is connected, the converse is also true. Furthermore, the quantum Fisher information matrix $\hat{F}_\rho^f(\{X_n\})$ is monotonic under a covariant operation, i.e. \begin{equation}\label{eq:mononicity-general} \hat{F}_\rho^f(\{X_l\})\ge{F}_{\mathcal{E}(\rho)}^f(\{X_l\}) \end{equation} where $\mathcal{E}$ is covariant operation. \end{theorem} This theorem shows that when $G$ is a connected Lie group, the quantum Fisher information for any $f$ is a resource measure satisfying Conditions 1--3. In addition to its property as a resource measure, the quantum Fisher information matrix has the following property called selective monotonicity. \begin{theorem}\label{th:selective} Let $G$ be a linear Lie group, $\{U(g)\}_{g\in G}$ be a projective unitary representation of $G$ on Hilbert space $\mathcal{H}$, and $\mathcal{E}=\sum_j \mathcal{E}_j$ be a quantum operation with a covariant CP trace non-increasing map $\mathcal{E}_j$. The quantum Fisher information does not increase on average, i.e., \begin{equation} \hat{F}_\rho^f(\{X_n\})\ge \sum_j p_j \hat{F}_{\sigma_j}^f(\{X_n\}) \end{equation} where $p_j=\mathrm{tr}[\mathcal{E}_j(\rho)]$ and $\sigma_j=\mathcal{E}_j(\rho)/p_j$. \end{theorem} \subsection{Relationship between quantum Fisher information matrix and quantum fluctuation} When there is only one conserved quantity, the quantum Fisher information satisfies Luo's criteria and the physical meaning of quantifying the quantum fluctuation. In considering the physical meaning of the quantum Fisher information matrix, we first show that Luo's criteria can be extended to the form applicable to matrices and that the quantum Fisher information matrix satisfies the criteria. Specifically, the following theorem holds. \begin{theorem}\label{th:q-fluc} Defining $\hat{I}^f_\rho(\{X_n\}\coloneqq\frac{f(0)}{2}\hat{F}_\rho^f(\{X_n\})$, it satisfies \begin{align} &0\le \hat{I}_{\rho}^f(\{X_n\})\le \hat{V}_{\rho}(\{X_n\})\label{eq:q-fluc1}\\ &\rho\ is\ pure \Rightarrow \hat{I}_{\rho}^f(\{X_n\})=\hat{V}_{\rho}^f(\{X_n\})\label{eq:q-fluc2}\\ &[\rho,X_k]=0,\ \forall k \Rightarrow \hat{I}_\rho^f(\{X_n\})=0\label{eq:q-fluc3}\\ &\hat{I}_{\sum_i p_i\rho_i}^f(\{X_n\})\le\sum_i p_i \hat{I}_{\rho_i}^f(\{X_n\}).\label{eq:q-fluc4} \end{align} \end{theorem} This theorem shows that the quantum Fisher information matrix for any $f$ is a measure of quantum fluctuation. Furthermore, let us consider multivariable extensions of Theorem \ref{th:Marvian} and Theorem \ref{th:YU}. First, the following theorem holds as a multivariable extension of Theorem \ref{th:Marvian}. \begin{theorem}\label{th:min-V} Consider a system $S$ with a set of linearly independent Hermitian operators $\{X_n^S\}$ and a quantum state $\rho$. The quantum Fisher information matrix $\hat{F}_\rho(\{X_n^F\})$ can be written as \begin{equation} \hat{F}_{\rho}(\{X_n\}) = 4\min_{\ket{\psi_{\rho}},\{X_n^R\}}\hat{V}_{\ket{\psi_\rho}}(\{X_n^S+X_n^R\}) \end{equation} where \(\hat{V}_{\ket{\phi}} (H) \) is a covariance matrix, defined as $(\hat{V}_{\rho}(\{X_n\}))_{kl}=\frac{1}{2}\langle (X_k-\langle X_k\rangle_{\rho} ) (X_l- \langle X_l \rangle_{\rho} ) + (X_l-\langle X_l \rangle_{\rho} ) (X_k-\langle X_k\rangle_{\rho} ) \rangle_{\rho}$ and $\langle Y\rangle_{\sigma}$ is expected value of a Hermitian operator $Y$ in a state $\sigma$, defined as $\langle Y\rangle_{\sigma}\coloneqq\Tr[\sigma Y]$ and $\ket{\psi_\rho}$ is purification of the state $\rho$ and $\{X_n^R\}$ is a set of Hermitian operators of auxiliary system R. \end{theorem} This theorem is proved by giving another proof of Theorem \ref{th:Marvian} and considering its multivariable extension. In the proof, we combine Uhlmann's theorem that that the fidelity of the mixed state is equal to the maximum of the fidelity of the purification and the fact that the second-order derivative of fidelity is equal to the SLD Fisher information. Finally, we show that, by constructing a counterexample, the multivariable extension of Theorem \ref{th:YU} does not hold. The counterexample is as follows. Consider a qubit system $S$ with state \(\rho=I/2\) with $I$ the identity. For noncommutative Hermitian operators \(X_1\) and \(X_2\) are, we have \begin{equation} \hat{F}_\rho (X_1, X_2)=0. \end{equation} Because \(X_1\) and \(X_2\) are noncommutative, for any decomposition \(\rho=\sum_i p_i \ketbra{\phi_i}{\phi_i}\), either \(V_{\ket{\phi_i}}(X_1)>0\) or \(V_{\ket{\phi_i}}(X_2)>0\) holds. This implies \begin{equation} \sum_ip_i\hat{V}_{\ket{\phi_i}} (X_1,X_2)>0. \end{equation} Hence, the multivariable extension of Theorem \ref{th:YU} does not hold. \section{Conclusion}\label{conclusion} We have shown that the quantum Fisher matrix is a resource measure when a connected linear Lie group describes the symmetry, i.e., the following conditions are satisfied. \begin{itemize} \item{\(\hat{F}_\rho(\{X_k\})\ge 0\)} \item{\(\hat{F}_\rho(\{X_k\})=0\Leftrightarrow \rho\mbox{ is a symmetric state}\)} \item{If \(\mathcal{E}\) is a covariant operation, \(\hat{F}_\rho(\{X_k\})\ge \hat{F}_{\mathcal{E}(\rho)}(\{X_k\})\) holds.} \end{itemize} In proving that the quantum Fisher information matrix satisfies these conditions, we used the fact that a connected linear Lie group is generated by its Lie ring and the properties of the representation of the Lie ring obtained from its unitary or projective unitary representations. Our result is a generalization of the quantum Fisher information as a resource measure with U(1) symmetry and is the first example of a resource measure being a matrix in resource theory. We also extended three known results, given as theorems, concerning the physical meaning of the quantum Fisher information for multiple conserved quantities. The first is Luo's criteria, which we extended to be applicable to matrices and showed that the quantum Fisher information matrix satisfies these extended criteria. The second is that the quantum Fisher information matrix is equal to the minimum of the covariance matrix of its purification, and we gave another proof using Ullman's theorem. As an extension of this theorem for multiple conserved quantities, we showed that for the quantum Fisher information matrix the equality \begin{equation} \hat{F}_{\rho}(\{X_n\}) =4\times\min_{\ket{\psi_{\rho}},\{X_n^R\}}\hat{V}_{\ket{\psi_\rho}}(\{X_n^S+X_n^R\}) \end{equation} holds. The third theorem states that the quantum Fisher information is equal to the minimum average of the variance of the pure state. And we showed, by giving a counterexample, that this theorem cannot be extended to general symmetry scenario. \textbf{Note added:} After completing our analysis, a new paper \cite{Marvian_new} was uploaded on arXiv. The paper contains another proof of Theorem \ref{th:Marvian} for U(1) symmetry. The proof uses a similar method of the proof for Theorem \ref{th:min-V}, although Theorem \ref{th:min-V} treats general symmetries. We also remark that the main results of our article are features of the quantum Fisher information matrices for the case of the general symmetry, and the main results have no overlap with Ref. \cite{Marvian_new}. \begin{acknowledgments} The present work was supported by JSPS Grants-in-Aid for Scientific Research No. JP19K14610 (HT), JST PRESTO No. JPMJPR2014 (HT), and JST MOONSHOT (H. T. Grant No. JPMJMS2061). We thank Richard Haase, PhD, from Edanz for editing a draft of this manuscript. \end{acknowledgments} \bibliographystyle{apsrev4-2}
\section{Introduction} We investigate resilience of gossip-based information dissemination over networks used for timeliness purposes, against intentional jamming. We focus on a ring network, see Fig.~\ref{fig:ring_network}, where a source node which keeps the latest version of a file updates $n$ nodes placed on a ring with equal update rates $\frac{\lambda}{n}$. The source itself is updated with a rate $\lambda_s$. The nodes on the ring update their neighbors with equal update rates of $\frac{\lambda}{2}$. Without any jammers, the version age of a node in this network scales as $\sqrt{n}$ with the network size $n$ \cite{Yates21gossip, baturalp21comm_struc}. We address the following questions: If there are $\tilde{n}$ jammers in this network, how high can they drive the version age? What are the worst and least-harm jammer configurations? How many jammers does it take to drive the version age to order $n$, the version age with no gossiping among the nodes? Gossip-based algorithms are used to disseminate information efficiently in large-scale networks with no central entity to coordinate exchange of information between users. Instead, users arbitrarily contact their neighbors and exchange information based on their local status, oblivious to the simultaneous dynamics of the network as a whole, thereby causing information to spread like a gossip/rumor. Gossip algorithms are simple and scalable, and have been applied in a wide range of contexts, such as, ad-hoc routing, distributed peer sampling, autonomic self management, data aggregation, and consensus. Gossiping is introduced in \cite{Demers1987EpidemicAF-short} to fix inconsistency in clearinghouse database servers, and since then has been studied extensively, e.g., \cite{Demers1987EpidemicAF-short, Minsky02cornellthesis, vocking2000, Pittel1987OnSA, deb2006AlgebraicGossip, devavrat2006, Sanghavi2007GossipFileSplit, amazondynamo-short, Cassandra, Yates21gossip, baturalp21comm_struc, Bastopcu21gossip, kaswan22slicingcoding}. For example, \cite{vocking2000} shows that a single rumor can be disseminated to $n$ nodes in $O(\log n)$ rounds, \cite{deb2006AlgebraicGossip} shows that using random linear coding (RLC) $n$ messages can be disseminated to $n$ nodes in $O(n)$ time in fully connected networks, \cite{devavrat2006} further extends this result to arbitrarily connected graphs, and \cite{Sanghavi2007GossipFileSplit} presents an improved dissemination time by dividing files into $k$ pieces. However, data in realistic systems is not static; it keeps changing asynchronously over time as new information becomes available. For example, distributed databases like Amazon DynamoDB \cite{amazondynamo-short} and Apache Cassandra \cite{Cassandra} use gossiping for real-time peer discovery and metadata propagation. In Cassandra, cluster metadata at each node is stored in endpoint state which tracks the version number or timestamp of the data. During a single gossip exchange between two nodes, the version number of the data at the two nodes is compared, and the node with older version number discards its data in favor of the more up-to-date data present at the other node. Hence, a specific information may get discarded or lost in the network before it can reach all nodes of the network. This renders the choice of total dissemination time as a performance metric inadequate, and in such networks, the \emph{age of information} at the nodes may prove to be a more suitable performance metric. Age of information has been studied in a range of contexts \cite{Kosta17agesurvey, Sun19agesurvey, yates21agesurvey}. In this paper, we use \emph{version} age of information metric \cite{Yates21gossip, Eryilmaz21, bastopcu20_google} together with exponential inter-update times as used previously in \cite{bastopcu20_google, Yates17sqrt, bastopcu2020LineNetwork, kaswan_isit2021}. Version age tracks the difference between the version number of the latest file at a node and the current version prevailing at the source. Gossip networks have been studied from an age of information point of view in \cite{Yates21gossip, baturalp21comm_struc, Bastopcu21gossip, kaswan22slicingcoding}, where \cite{Yates21gossip} derives a recursion to find the version age in arbitrary networks and characterizes the version age scaling in fully connected graphs, \cite{baturalp21comm_struc} proves the version age for ring networks and improves the version age scaling by introducing clustering, \cite{Bastopcu21gossip} derives analogous results for the binary freshness metric, and \cite{kaswan22slicingcoding} improves version age scaling using file slicing and network coding. In this work, we focus on the version age in the presence of jammers \cite{Nguyen17interferencegame, Garnaev19jamming,Xiao18jamming, Banerjee22adversary, Banerjee22game} for gossip networks. A jammer is a malicious entity that disrupts communication between two nodes, say by jamming the channel with noise. The jammer can also be a proxy for communication link failure, network partitioning, network congestion or information corruption during transfer, prevalent in distributed networks. Several works have characterized the effect of adversarial interference on gossip networks for the total dissemination time \cite{Augustine16_adversaries, Georgiou08_complexitygossip}. In this paper, we initiate a study of adversarial robustness of gossip networks from an age of information perspective. As an initial work in this direction, we focus on characterizing the impact of number of jammers on the version age scaling of gossip based \emph{ring networks} shown in Fig.~\ref{fig:ring_network}. We show that when the number of jammers $\tilde{n}$ scales as a fractional power of network size $n$, i.e., $\tilde n= cn^\alpha$, the average version age scales with a lower bound $\Omega(\sqrt{n})$ and an upper bound $O(\sqrt{n})$ when $\alpha \in \left[0,\frac{1}{2}) \right.$, and with a lower bound $\Omega(n^{\alpha})$ and an upper bound $O(n^{\alpha})$ when $\alpha \in \left[\frac{1}{2},1\right]$. To this purpose, we construct an alternate system model of mini-rings (see Fig.~\ref{fig:best_worst_jammer_positions}) and prove that the version age of the original model can be sandwiched between constant multiples of the version age of the alternate model. Along the way, we consider average version age in line networks (see Fig.~\ref{fig:line_network_model}) and prove structural results. \begin{figure}[t] \centerline{\includegraphics[width=0.5\linewidth]{Figs/test_ring_2.pdf}} \caption{Ring network of $n$ nodes.} \label{fig:ring_network} \vspace*{-0.4cm} \end{figure} \section{System Model and Preliminaries} \label{sec:sys_model} The system model consists of a source, which maintains the most up-to-date version of a file and a large network of $n$ user nodes arranged on a ring (Fig.~\ref{fig:ring_network}), that wish to acquire the latest version of the file. The source is updated with newer file versions with exponential inter-update times with rate $\lambda_s$. The source forwards the current file to each user node with exponential inter-update times with rate $\frac{\lambda}{n}$, and further, each user node sends updates to each of its two nearest neighbors with exponential inter-update times with rate $\frac{\lambda}{2}$. In addition, the system is faced with the presence of $\tilde{n}$ jammers which jam, i.e., cut, inter-node links, thereby disrupting any communication between the nodes connected by these links. When two jammers try to cut the same link, they will together be considered as a single jammer. That is, each jammer in our model is assumed to cut a distinct inter-node link. At time $t$, if $N_i(t)$ is the latest version of a file available at user node $i$ and $N(t)$ is the current version prevailing at the source, then the instantaneous version age at node $i$ at time $t$ is $\Delta_i(t)=N(t)-N_i(t)$. The long-term expected version age of node $i$ is given by $\Delta_i=\lim_{t \to \infty} \mathbb{E}[\Delta_i(t)]$. For a set $S$ of nodes, $\Delta_S(t)=\min_{i\in S}\Delta_i(t)$, and $\Delta_S=\lim_{t \to \infty} \mathbb{E}[\Delta_S(t)]$. When multiple adversaries cut inter-node communication links in this symmetric ring, the ring network is dismembered into a collection of isolated groups of nodes, where each group has the structure of a \emph{line network} shown in Fig.~\ref{fig:line_network_model}. The age of nodes in each such group are no longer statistically identical, owing to disappearance of circular symmetry. In this respect, we begin by examining the spatial variation of version age over a line network of $n_0$ nodes in the next section. \begin{figure}[t] \centerline{\includegraphics[width=0.73\linewidth]{Figs/line_network_model.pdf}} \caption{Line network model with $n_0$ nodes.} \label{fig:line_network_model} \vspace*{-0.4cm} \end{figure} \section{Version Age in a Line Network} \label{sec:age_progress_line} Consider the line network of $n_0$ nodes as shown in Fig.~\ref{fig:line_network_model}. In Theorem~\ref{thm:age_variation_line} below, we show that the expected version age in this network is highest at the corner nodes and decreases towards the center. Intuitively, this is due to the fact that corner nodes are updated less frequently as they are connected with only one inter-node link, and thus, the exchanges towards the network corners are based on relatively staler file versions. Here, superscript $\ell(n_0)$ denotes a line network of size $n_0$. \begin{theorem}\label{thm:age_variation_line} In a line network, $\Delta^{\ell(n_0)}_{i+1} \leq \Delta^{\ell(n_0)}_i$, $i\leq\frac{n_0}{2}$. \end{theorem} \begin{Proof} Fix the $i$ in the statement of the theorem. Let $S_{j,k}=\{j,\ldots,j+k-1\}$ denote a set of $k$ contiguous nodes, beginning with node $j$, in a size $n_0$ line network, where $j+k-1\leq n_0$, see Fig.~\ref{fig:line_network_blocks}. We use $\Delta^{\ell(n_0)}_{j,k}$ to denote $\Delta^{\ell(n_0)}_{S_{j,k}}$, i.e., replace the set with its indices. Define $\bar{S}_{j,k}$ as the mirror image of set $S_{j,k}$ about the dotted line between nodes $i$ and $i+1$. Note that $\bar{S}_{j,k}=S_{2i-j-k+2,k}$; see Fig.~\ref{fig:line_network_blocks} for examples. Similarly, we use $\bar{\Delta}^{\ell(n_0)}_{j,k}$ to denote $\Delta^{\ell(n_0)}_{\bar{S}_{j,k}}$. We will consider sets $S_{j,k}$ where majority of the elements of $S_{j,k}$ lie to the left of node $i$, i.e., $j\leq i+1-\frac{k}{2}$, and prove that $\bar{\Delta}^{\ell(n_0)}_{j,k}\leq \Delta^{\ell(n_0)}_{j,k}$. Then, taking $k=1$ (size one set) with $j=i$ gives the desired result. We provide a proof by induction, beginning with the case $k=2i$, where $j=1$ is the only value that meets the condition $j\leq i+1-\frac{k}{2}$. This case gives $\bar{S}_{j,k} = S_{j,k}$ and $\bar{\Delta}^{\ell(n_0)}_{j,k}=\Delta^{\ell(n_0)}_{j,k}$ which satisfies the claim. Next, we assume that the claim holds for some $k$, i.e., $\bar{\Delta}^{\ell(n_0)}_{j,k}\leq \Delta^{\ell(n_0)}_{j,k}$ for all $j\leq i+1-\frac{k}{2}$, and prove it for $k-1$. To relate version ages of size $k$ and $k-1$ sets, we apply \cite[Thm.~1]{Yates21gossip} to obtain the version age of $S_{j,k-1}$ \begin{align} \Delta^{\ell(n_0)}_{j,k-1}= \begin{cases} \label{eqn:k-1_block_age_trans_cases} \frac{\lambda_s+\frac{\lambda}{2}\Delta^{\ell(n_0)}_{j,k}+\frac{\lambda}{2}\Delta^{\ell(n_0)}_{j-1,k}}{\frac{(k-1)\lambda}{n}+\lambda}, & j> 1\\ \frac{\lambda_s+\frac{\lambda}{2}\Delta^{\ell(n_0)}_{j,k}}{\frac{(k-1)\lambda}{n}+\frac{\lambda}{2}},& j=1 \end{cases} \end{align} and for its mirrored set $\bar{S}_{j,k-1}$ as \begin{align} \label{eqn:k-1_mirrorblock_age_trans} \bar{\Delta}^{\ell(n_0)}_{j,k-1}=\frac{\lambda_s+\frac{\lambda}{2} \bar{\Delta}^{\ell(n_0)}_{j,k} +\frac{\lambda}{2} \bar{\Delta}^{\ell(n_0)}_{j-1,k}}{\frac{(k-1)\lambda}{n}+\lambda} \end{align} Since $\bar{S}_{j,k-1} \subset \bar{S}_{j-1,k}$, we have $\bar{\Delta}^{\ell(n_0)}_{j,k-1} \geq \bar{\Delta}^{\ell(n_0)}_{j-1,k}$ as an extended feasible region provides a lower minimum. Using this inequality to eliminate the last term in (\ref{eqn:k-1_mirrorblock_age_trans}) gives \begin{align} \label{eqn:k-1_mirrorblock_age_trans_inequality} \bar{\Delta}^{\ell(n_0)}_{j,k-1} \leq \frac{\lambda_s+\frac{\lambda}{2}\bar{\Delta}^{\ell(n_0)}_{j,k}}{\frac{(k-1)\lambda}{n}+\frac{\lambda}{2}} \end{align} We wish to prove the claim for $k-1$, i.e., $\bar{\Delta}^{\ell(n_0)}_{j,k-1} \leq \Delta^{\ell(n_0)}_{j,k-1}$ under the condition $j\leq i+1-\frac{(k-1)}{2}$. If $j=i+1-\frac{(k-1)}{2}$, then we get $j=2i-j-k+3$, giving $\bar{S}_{j,k-1} = S_{j,k-1}$ and $\bar{\Delta}^{\ell(n_0)}_{j,k-1} = \Delta^{\ell(n_0)}_{j,k-1}$ which satisfies the claim. For other $j$, as $j$ must be integer valued, $j\leq i+1-\frac{(k-1)}{2}$ is automatically implied from $j\leq i+1-\frac{k}{2}$. Consequently, since the claim is assumed to hold for $k$, we have $\bar{\Delta}^{\ell(n_0)}_{j,k}\leq \Delta^{\ell(n_0)}_{j,k}$ and $\bar{\Delta}^{\ell(n_0)}_{j-1,k}\leq \Delta^{\ell(n_0)}_{j-1,k}$. Now, comparing the terms in (\ref{eqn:k-1_block_age_trans_cases}) and (\ref{eqn:k-1_mirrorblock_age_trans}) for case $j>1$, and (\ref{eqn:k-1_block_age_trans_cases}) and (\ref{eqn:k-1_mirrorblock_age_trans_inequality}) for case $j=1$ gives $\bar{\Delta}^{\ell(n_0)}_{j,k-1} \leq \Delta^{\ell(n_0)}_{j,k-1}$, and thus, the claim holds for $k-1$. Finally, setting $k=1$ and $j=i$, we have $\Delta^{\ell(n_0)}_{i+1}=\Delta^{\ell(n_0)}_{i+1,1}=\bar{\Delta}^{\ell(n_0)}_{i,1}\leq \Delta^{\ell(n_0)}_{i,1}=\Delta^{\ell(n_0)}_i$, which completes the proof. \end{Proof} \begin{figure}[t] \centerline{\includegraphics[width=1\linewidth]{Figs/labelled_blocks.pdf}} \caption{$S_{j,k}$ (pink blocks) and $\bar{S}_{j,k}=S_{2i-j-k+2,k}$ (blue blocks) positioned symmetrically about the dotted line between nodes $i$ and $i+1$.} \label{fig:line_network_blocks} \vspace*{-0.4cm} \end{figure} \section{Bounds on Age of Line Network} \label{sec:bounds_line} Here, we bound $\Delta^{\ell(n_0)}_{i}$, age in a line network of size $n_0$ with $\Delta^{r(n_0)}_{i}$, age in a ring network of size $n_0$, see Fig.~\ref{fig:line_to_miniring}. \subsection{Lower Bound} \label{subsec:lowerbound_line} Heuristically, due to the presence of an additional link compared to the line network, the ring network will have more age-conformed transitions, and therefore, improved age at the nodes. Mathematically, the recursive equation in \cite[Thm.~1]{Yates21gossip} is identical in the two networks for every subset of nodes $S_{j,k} \in \{2,\ldots,n_0-1\}$ that excludes corner nodes $1$ and $n_0$. Further, for subsets $S_{1,k}$ which include corner node $1$, similar to (\ref{eqn:k-1_block_age_trans_cases}) for case $j=1$, we have \begin{align} \label{eqn:line_end_node} \Delta^{\ell(n_0)}_{1,k}=\frac{\lambda_s+\frac{\lambda}{2}\Delta^{\ell(n_0)}_{1,k+1}}{\frac{k\lambda}{n}+\frac{\lambda}{2}} \end{align} The corresponding equation for the ring, similar to (\ref{eqn:k-1_mirrorblock_age_trans})-(\ref{eqn:k-1_mirrorblock_age_trans_inequality}), is \begin{align} \!\!\! \Delta^{r(n_0)}_{1,k}=\frac{\lambda_s+\frac{\lambda}{2}\Delta^{r(n_0)}_{1,k+1}+\frac{\lambda}{2}\Delta^{r(n_0)}_{n_0,k+1}}{\frac{k\lambda}{n}+\lambda} \leq \frac{\lambda_s+\frac{\lambda}{2}\Delta^{r(n_0)}_{1,k+1}}{\frac{k\lambda}{n}+\frac{\lambda}{2}} \label{eqn:ring_end_node} \end{align} where $S_{n_0,k+1}$ refers to the set $\{n_0,1,2,\ldots,k\}$, and hence, $S_{1,k}\subset S_{n_0,k+1}$ gives the inequality $\Delta^{r(n_0)}_{n_0,k+1} \leq \Delta^{r(n_0)}_{1,k}$. Now, comparing (\ref{eqn:line_end_node}) and (\ref{eqn:ring_end_node}) gives $\Delta^{r(n_0)}_{1,k} \leq \Delta^{\ell(n_0)}_{1,k}$. By symmetry, $ \Delta^{r(n_0)}_{n_0+1-k,k} \leq \Delta^{\ell(n_0)}_{n_0+1-k,k}$ for subsets which include the other corner node $n_0$. Thus, $\Delta^{r(n_0)}_{j,k} \leq \Delta^{\ell(n_0)}_{j,k}$, for all $j,k$, and $\Delta^{r(n_0)}_{i} \leq \Delta^{\ell(n_0)}_{i}$, which gives us a lower bound on $\Delta^{\ell(n_0)}_{i}$. \begin{figure}[t] \centerline{\includegraphics[width=0.8\linewidth]{Figs/line_to_miniring.pdf}} \caption{(a) A line network of size $n_0$. (b) A ring network of size $n_0$. Compared to (a), an extra link is introduced between end nodes bringing radial symmetry.} \label{fig:line_to_miniring} \vspace*{-0.4cm} \end{figure} \subsection{Upper Bound} Note that due to the radial symmetry of the ring network, $\Delta^{r(n_0)}_i=\Delta^{r(n_0)}_1$, for all $i$. Hence, combining results of Sections~\ref{sec:age_progress_line}~and~\ref{subsec:lowerbound_line}, with bilateral symmetry of line network, \begin{align} \Delta^{r(n_0)}_{1} &\leq \Delta^{\ell(n_0)}_{\lceil\frac{n_0}{2}\rceil}=\Delta^{\ell(n_0)}_{\lfloor\frac{n_0}{2}\rfloor}\leq \ldots \nonumber \\ &\ldots \leq\Delta^{\ell(n_0)}_{n_0-1}=\Delta^{\ell(n_0)}_{2}\leq \Delta^{\ell(n_0)}_{n_0}=\Delta^{\ell(n_0)}_{1} \end{align} Hence, an upper bound on $\Delta^{\ell(n_0)}_{1}$ is an upper bound on $\Delta^{\ell(n_0)}_{i}$ for all $i$. Recursively applying \cite[Thm.~1]{Yates21gossip}, see also \cite[Lem.~2]{baturalp21comm_struc}, \begin{align}\label{eqn:ring_end_node_detailage} \Delta^{r(n_0)}_1=\frac{\lambda_s}{\lambda}\Bigg[\sum_{j=1}^{n_0-1}\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}+\frac{1}{\frac{n_0}{n}}\prod_{k=1}^{n_0-1}\frac{1}{\frac{k}{n}+1}\Bigg] \end{align} and \begin{align} \Delta^{\ell(n_0)}_1=&\frac{2\lambda_s}{\lambda} \Bigg[\sum_{j=1}^{n_0-1}\prod_{k=1}^{j}\frac{1}{\frac{k}{n/2}+1} +\frac{1}{\frac{n_0}{n/2}}\prod_{k=1}^{n_0-1}\frac{1}{\frac{k}{n/2}+1}\Bigg]\\ \leq & \frac{\lambda_s}{\lambda}\Bigg[\sum_{j=1}^{n_0-1}\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}+\frac{1}{\frac{n_0}{n}}\prod_{k=1}^{n_0-1}\frac{1}{\frac{k}{n}+1}\Bigg] \\ =&2\Delta^{r(n_0)}_1 \end{align} Hence for each node $i$, \begin{align} \Delta^{r(n_0)}_1\leq \Delta^{\ell(n_0)}_i \leq 2\Delta^{r(n_0)}_1 \end{align} Since $\Delta^{\ell(n_0)}_i$ is sandwiched between constant multiples of $\Delta^{r(n_0)}_1$, they both scale similarly when $n$ is large. Intuitively, when the number of nodes is large, the effect of one additional link in the \emph{line} versus \emph{ring} models becomes insignificant. \begin{figure}[t] \centerline{\includegraphics[width=1\linewidth]{Figs/best_worst_minirings2.pdf}} \vspace*{-0.2cm} \caption{Jammer position on line network (a) most favorable, (b) most harmful.} \label{fig:best_worst_rings} \vspace*{-0.4cm} \end{figure} \section{Jammer Positioning for Age Deterioration} \label{subsec:position_jammers} To characterize the total age of the system, we define $\Delta^{\ell(n_0)}=\sum_{i=1}^{n_0}\Delta^{\ell(n_0)}_i$ and $\Delta^{r(n_0)}=\sum_{i=1}^{n_0}\Delta^{r(n_0)}_i$, the sum of version ages in size $n_0$ line and ring networks, respectively. \begin{lemma}\label{lemma:ring_age_difference} $\Delta^{r(n_0)} -\Delta^{r(n_0+1)}$ decreases with increase in $n_0$. \end{lemma} \begin{Proof} We have $\Delta^{r(n_0)}=n_0 \Delta^{r(n_0)}_1$ due to the radial symmetry of a ring. Hence, by obtaining expressions for $\Delta^{r(n_0)}_1$ and $\Delta^{r(n_0+1)}_1$ from (\ref{eqn:ring_end_node_detailage}), we get \begin{align} \Delta^{r(n_0)}-\Delta^{r(n_0+1)}=& n_0\Delta^{r(n_0)}_1-(n_0+1)\Delta^{r(n_0+1)}_1 \\ =&\frac{\lambda_s}{\lambda}\Bigg[-\sum_{j=1}^{n_0}\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}\Bigg] \end{align} which decreases with increasing $n_0$. \end{Proof} Next, we consider the problem where a single jammer cuts a single link in the line network model of Fig.~\ref{fig:line_network_model}. Let the jammer cut the link between nodes $m$ and $m+1$, effectively converting the line network of size $n_0$ into two smaller line networks of sizes $m$ and $n_0-m$. The age of the resulting system is $\Delta^{\ell(n_0)(m)}=\Delta^{\ell(m)} +\Delta^{\ell(n_0-m)}$. We will consider the mini-ring approximation to the resulting two line networks, and assume that the end points of the individual line networks are connected to form mini-rings as shown in Fig.~\ref{fig:best_worst_rings}. The age of this network with mini-rings is $\Delta^{r(n_0)(m)}=\Delta^{r(m)} +\Delta^{r(n_0-m)}$. From Section~\ref{sec:bounds_line}, the total ages of the actual dismembered line network and the mini-ring approximation are related as $\Delta^{r(n_0)(m)} \leq \Delta^{\ell(n_0)(m)}\leq 2\Delta^{r(n_0)(m)}$. Next, as an approximation to finding $m$ that maximizes (worst case jammer) and minimizes (most favorable jammer) $\Delta^{\ell(n_0)(m)}$, we will find $m$ that maximizes/minimizes $\Delta^{r(n_0)(m)}$ instead. We show in Theorem~\ref{thm:best_position_for_jammer} below that most harmful jammer cuts the link that separates the node at the corner, and the most favorable jammer cuts the center link, as shown in Fig.~\ref{fig:best_worst_rings}. \begin{theorem} \label{thm:best_position_for_jammer} In a ring, $\Delta^{r(n_0)(m+1)}\leq \Delta^{r(n_0)(m)}$, $m \leq \frac{n_0}{2}$. \end{theorem} \begin{Proof} We have \begin{align} &\Delta^{r(n_0)(m)}-\Delta^{r(n_0)(m+1)} \nonumber\\ &= \left[\Delta^{r(m)} +\Delta^{r(n_0-m)}\right]- \left[\Delta^{r(m+1)} +\Delta^{r(n_0-m-1)}\right] \\ &= \left[\Delta^{r(m)} -\Delta^{r(m+1)}\right] - \left[\Delta^{r(n_0-m-1)} -\Delta^{r(n_0-m)}\right]\\ &\geq 0 \end{align} where the last inequality follows from Lemma~\ref{lemma:ring_age_difference}, as $m<n_0-m-1$ since we are only considering $m\leq \frac{n_0}{2}$. \end{Proof} Consider the original ring network of $n$ nodes in Fig.~\ref{fig:ring_network} in the presence of $\tilde{n}$ jammers cutting $\tilde{n}$ communication links. This results in $\tilde{n}$ isolated line networks. Let $\Delta^\ell$ denote the average version age at in this dismembered ring, which is composed of $\tilde{n}$ line networks. Consider the alternate model, where all the $\tilde{n}$ line networks are replaced by their mini-ring versions, as shown in Fig.~\ref{fig:best_worst_jammer_positions}(a), and let $\Delta^r$ denote the average age of this alternate system. Then, from Section~\ref{sec:bounds_line}, we know that $\Delta^\ell$ is bounded by constant multiples of $\Delta^r$. From Theorem~\ref{thm:best_position_for_jammer}, the least harmful positioning of jammers for $\Delta^r$ is the equidistant placement around the ring, as shown in Fig.~\ref{fig:best_worst_jammer_positions}(a), since we can keep switching a jammer's position untill it has equal size mini-rings on both sides. Likewise, the most detrimental positioning of jammers is if they cut adjacent links, as shown in Fig.~\ref{fig:best_worst_jammer_positions}(b), which results in $\tilde{n}-1$ isolated nodes and a single line network of $n-\tilde{n}+1$ nodes. This is because from Theorem~\ref{thm:best_position_for_jammer}, presence of two line networks of $i_1$ and $i_2$ nodes has lower age than presence of a single line network of $i_1+i_2-1$ nodes and an isolated node. \section{Average Age of Ring Network with Jammers} \begin{lemma}\label{lemma:gaussian_approx} (a) $\sum_{j=1}^{n_0}\left[\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}\right]=O(\sqrt{n})$. (b) If $n_0=\omega(\sqrt{n})$, then $\sum_{j=1}^{n_0}\left[\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}\right]=\Omega(\sqrt{n})$. \end{lemma} \begin{Proof} We use $\frac{x}{1+x} \leq \log(1+x) \leq x$ and $\sum_{k=1}^{j} \frac{k}{n} = \frac{j(j+1)}{2n}$ to bound $\sum_{k=1}^{j} \log \big( 1+\frac{k}{n} \big)$ and then exponentiate to obtain \begin{align}\label{eqn:negative_exponent_bounds} e^{-\frac{j^2}{n}} \leq \prod_{k=1}^{j} \frac{1}{1+\frac{k}{n}} \leq e^{-\frac{j^2}{4n}} \end{align} Then, we sum over $j$ and use Riemann sums to obtain \begin{align} \int_{\frac{1}{\sqrt{n}}}^{\frac{n_0}{\sqrt{n}}}e^{-\frac{t^2}{C}}dt \leq \frac{1}{\sqrt{n}}\sum_{j=1}^{n_0} e^{-\frac{j^2}{Cn}} \leq \int_{0}^{\frac{n_0}{\sqrt{n}}}e^{-\frac{t^2}{C}}dt \end{align} and note that $\int_{0}^{\infty}e^{-\frac{t^2}{C}}dt = \frac{\sqrt{C\pi}}{2}$ for a constant $C>0$. \end{Proof} \begin{figure}[t] \centerline{\includegraphics[width=0.8\linewidth]{Figs/best_worst_jammer_positions.pdf}} \vspace*{-0.2cm} \caption{Jammer positions on a ring (a) most favorable, (b) most harmful.} \label{fig:best_worst_jammer_positions} \vspace*{-0.5cm} \end{figure} \subsection{Lower Bound on System Age} \begin{theorem} \label{thm:lowerbound} For a ring network of $n$ nodes with $\tilde{n} =c n^{\alpha}$ jammers, where $\alpha \in [0,1]$ and $c$ is a scaling constant, \begin{align} \Delta^{\ell} = \begin{cases} \Omega(n^{\alpha}), & \alpha\geq \frac{1}{2}\\ \Omega(\sqrt{n}), & \alpha<\frac{1}{2} \end{cases} \end{align} \end{theorem} \begin{Proof} Based on Section~\ref{subsec:position_jammers}, to lower bound $\Delta^r(\leq \Delta^{\ell})$, we consider the least detrimental model of Fig.~\ref{fig:best_worst_jammer_positions}(a), where each node is a part of $n_0=\frac{n}{\tilde n}=\frac{1}{c}n^{1-\alpha}$size mini-ring, and hence all nodes have identical average age giving $\Delta^r=\Delta^{r(n_0)}_1$. For $\alpha<\frac{1}{2}$, using Lemma~\ref{lemma:gaussian_approx}(b) in (\ref{eqn:ring_end_node_detailage}) gives \begin{align} \label{eqn:lowerbound_alpha3} \!\!\!\Delta^{r(n_0)}_1 \!\geq\! \frac{\lambda_s}{\lambda}\Bigg[\sum_{j=1}^{n_0-1}\!\prod_{k=1}^{j}\frac{1}{\frac{k}{n}+1}\!+\!\frac{n}{n_0}\!\prod_{k=1}^{n_0}\frac{1}{\frac{k}{n}+1}\Bigg] \!\geq\!\Omega(\sqrt{n}) \end{align} For $\alpha \geq \frac{1}{2}$, using (\ref{eqn:negative_exponent_bounds}) in (\ref{eqn:ring_end_node_detailage}) gives \begin{align} \label{eqn:lowerbound_alpha8} \Delta^{r(n_0)}_1 \geq &\frac{\lambda_s}{\lambda}\left[0 +c n^{\alpha}e^{-\frac{n_0^2}{n}} \right] =\Omega(n^{\alpha}) \end{align} where $e^{-\frac{n_0^2}{n}}= e^{-\frac{n^{-(2\alpha-1)}}{2c^2}}\to 1$ for large $n$. \end{Proof} \subsection{Upper Bound on System Age} \begin{theorem} \label{thm:upperbound} For a ring network of $n$ nodes with $\tilde{n} =c n^{\alpha}$ jammers, where $\alpha \in (0,1)$ and $c$ is a scaling constant, \begin{align} \Delta^{\ell} = \begin{cases} O(n^{\alpha}), & \alpha\geq \frac{1}{2}\\ O(\sqrt{n}), & \alpha<\frac{1}{2} \end{cases} \end{align} \end{theorem} \begin{Proof} To upper bound $\Delta^r(\geq \frac{1}{2}\Delta^{\ell})$, we consider the most detrimental model of Fig.~\ref{fig:best_worst_jammer_positions}(b), which has $\tilde n -1$ isolated nodes and a line network of $n-\tilde{n} +1$ nodes. Then, \begin{align} \label{eqn:average_worstcase_jammer} \Delta^r&= \frac{(\tilde n -1)\Delta^{r(1)}_1 + (n-\tilde n +1) \Delta^{r(n-\tilde{n} +1)}_1}{n} \end{align} Since $\frac{\tilde n-1}{n} \leq \frac{\tilde n}{n}$ and $\frac{n-\tilde n+1}{n}=\frac{n(1-cn^{-(1-\alpha)}+\frac{1}{n})}{n} \leq 1$, using (\ref{eqn:ring_end_node_detailage}), (\ref{eqn:negative_exponent_bounds}) and Lemma~\ref{lemma:gaussian_approx}(a) in (\ref{eqn:average_worstcase_jammer}) gives \begin{align} \label{eqn:upperbound} \Delta^r \leq& \frac{\tilde n}{n}\frac{\lambda_s n}{\lambda}+\frac{n-\tilde n+1}{n} \frac{\lambda_s}{\lambda} \left[ O(\sqrt{n}) + \frac{n c e^{-\frac{(n-\tilde n)^2}{4n}} }{n-\tilde n+1}\right] \\ \leq&\frac{\lambda_s}{\lambda}\left[cn^{\alpha} + O(\sqrt{n}) + c \right] \end{align} completing the proof. \end{Proof} \section{Numerical Results} We now validate the aforementioned bounds by performing real-time gossip protocol simulations for both dismembered ring and its altered mini-ring model for three cases of jammer positions, a) most harmful (colluding), b) random, and c) least harmful (favorable) jammer positions. For $\tilde{n}= n^{\alpha}$ and $\frac{\lambda_s}{\lambda}=1$, Fig.~\ref{fig:average_age_with_alpha3}(a) and (b) show the average age plots as a function of the network size $n$ for $\alpha=0.3$ and $\alpha=0.8$, respectively. We observe that $\Delta^{\ell}$ is closely approximated by its lower bound $\Delta^r$ in all cases. Comparing $\alpha=0.3$ and $\alpha =0.8$ plots, the ages in the latter case increase steeply owing to the presence of larger number of jammers, and the graphs look almost linear because as $\alpha$ approaches $1$, $n^{\alpha}$ begins to appear linear. \begin{figure}[t] \begin{center} \subfigure[]{\includegraphics[width=0.49\linewidth]{Figs/18graphs_5values_alpha3.pdf}} \subfigure[]{\includegraphics[width=0.49\linewidth]{Figs/18graphs_5values_alpha8.pdf}} \end{center} \vspace{-0.4cm} \caption{(a) Average age with $n^{0.3}$. (b) Average age with $n^{0.8}$ jammers.} \label{fig:average_age_with_alpha3} \vspace{-0.65cm} \end{figure} \bibliographystyle{unsrt}
\section{Introduction} Forming stable highly compact objects, matter in neutron stars is balancing the tremendous gravitational force with the help of repulsive nuclear forces against collapse. The extreme conditions existing in neutron stars make them outstanding laboratories, to learn about gravity on the one hand and particle physics on the other hand. On the particle physics side the equation of state (EOS) of nuclear matter in neutron stars is still unknown, although recent years have seen much progress (see e.g.,\cite{Lattimer:2021emm}). At the same time neutron star properties are being explored in numerous alternative theories of gravity that are motivated by cosmology and quantum gravity \cite{Faraoni:2010pgm,Berti:2015itd,CANTATA:2021ktz}. \\ The observations of gravitational waves in merger events involving neutron stars and the associated multi-messenger observations are providing an unprecedented wealth of data \cite{LIGOScientific:2016aoc,LIGOScientific:2017vwq,LIGOScientific:2017ync,LIGOScientific:2020aai}. Such merger events are consisting of three phases: inspiral, merger and ringdown, where the gravitational waves emitted in the ringdown phase of the newly formed highly excited compact object comprise its quasinormal modes (QNMs) (see e.g.~\cite{Andersson:1996pn,Andersson:1997rn,Kokkotas:1999bd,Berti:2015itd}). These represent characteristic modes of gravitational radiation from the object, encoding its properties and its reaction to perturbations. QNMs are also sensitive to the nuclear EOS and to the gravitational force, of course. Thus the study of QNMs can, in principle, strongly enhance the current knowledge of neutron stars and gravity, once sufficiently accurate data is provided by future gravitational wave detectors. \\ While at first a caveat seems to be a possible degeneracy of effects arising from the EOS dependence of the QNMs, the use of \textit{universal relations} allows to reduce the EOS dependence and thus lift the degeneracy to a large extent (see the reviews \cite{Yagi:2016bkt,Doneva:2017jop}). Universal relations are typically obtained for adequately scaled dimensionless physical quantities, such that when considered for a large set of EOSs relations between properties hold, that retain very little EOS dependence. Since universal relations arise both in general relativity and in alternative theories of gravity, deviations of these relations may betray the proper gravity theory, or at least yield constraints on the coupling parameters of these theories. \\ Universal relations of QNMs were first noticed and studied in general relativity \cite{Andersson:1996pn,Andersson:1997rn,Benhar:1998au,Benhar:2004xg,Tsui:2004qd,Lau:2009bu,Blazquez-Salcedo:2012hdg,Blazquez-Salcedo:2013jka,Chirenti:2015dda,Lioutas:2021jbl,Sotani:2021nlx,Sotani:2021kiw,Zhao:2022tcw}. They have been shown to exist for axial and polar quadrupole ($l=2$) modes including the fundamental (f) mode, the first pressure (p) mode, and the first curvature (w) mode of static neutron stars. For axial modes, universal relations have also been studied in some alternative theories of gravity \cite{Blazquez-Salcedo:2015ets,Blazquez-Salcedo:2018tyn,Blazquez-Salcedo:2018qyy,AltahaMotahar:2018djk,Blazquez-Salcedo:2018pxo,AltahaMotahar:2019ekm}. Axial modes are pure gravity modes, and there is no coupling to matter or possible scalar degrees of freedom, reducing the complexity of the axial perturbation equations. Polar modes, on the other hand, couple to matter as well as scalar fields, when present in alternative theories of gravity. This leads to highly involved sets of perturbation equations, unless the Cowling approximation is used, where the perturbations of the spacetime and the gravitational scalar field are frozen (see e.g., \cite{Sotani:2004rq,Staykov:2015cfa}). Clearly, the full set of perturbations equations results in a much richer spectrum of QNMs, including scalar monopole and dipole radiation as well as scalar-led quadrupole and higher $l$ modes \cite{Sotani:2014tua,Mendes:2018qwo,Blazquez-Salcedo:2020ibb,Kruger:2021yay,Dima:2021pwx,Blazquez-Salcedo:2021exm,Blazquez-Salcedo:2022dxh}. \\ Among the alternative theories of gravity, $f(R)$ theories have received much attention \cite{Sotiriou:2008rp,DeFelice:2010aj,Capozziello:2011et}. Here a rather attractive theory is $R^2$ gravity with $f(R) = R + a R^2$, and coupling constant $a$. Whereas $f(R)$ theories are formulated in the physical Jordan frame, they are more amenable to detailed neutron star analysis after transformation to the Einstein frame corresponding to a scalar-tensor theory, as formulated for $R^2$ gravity by Yazadjiev et al.~\cite{Yazadjiev:2014cza,Staykov:2014mwa} (see, however, \cite{Astashenok:2017dpo}). The coupling constant $a$ is then simply related to the mass $m_\phi$ of the gravitational scalar field. Due to their relative simplicity, axial modes and some of the their associated universal relations have been analyzed first for $R^2$ gravity \cite{Blazquez-Salcedo:2018qyy}. The analysis of the full set of polar modes has only recently been initiated, with calculations of monopole ($l=0$) and quadrupole ($l=2$) modes \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}.\\ The monopole modes represent radial modes. In general relativity the radial matter ($F$, $H_i$) modes correspond to normal modes, since monopole radiation is not allowed. Moreover, analysis of the radial modes beyond the maximum mass of the neutron stars reveals their instability. When a scalar degree of freedom is present, however, monopole radiation arises, manifesting itself in $R^2$ gravity in the form of ultra-long lived radial matter (F) modes as well as in additional scalar ($\phi$) modes \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. The scale of the frequency of the radial matter modes is set by the size of the star for the $F$-mode (and its multiples for the $H$-modes), when the Compton wavelength of the scalar field is small as compared to size of the star. Otherwise, the scale is set by the scalar field mass, with the $F$-mode following roughly the frequency dependence of the $\phi$-mode \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. \\ Here we extend our previous analysis and obtain also the lowest polar dipole ($l=1$) F-modes. Moreover, we present to our knowledge for the first time universal relations for polar dipole and quadrupole modes in an alternative theory of gravity, beyond the Cowling approximation. We have organized the paper as follows. In section 2 we present the theoretical settings, recalling the action of nuclear matter coupled to $R^2$ gravity in both the Einstein and the Jordan frame. We then discuss the background equations for the neutron stars, including slow rotation, and present the polar perturbation equations. Next we present our results in section 3, starting with a discussion of the neutron star mass, radius and moment of inertia. Then the spectrum of quadrupole f-modes and their universal relations are discussed. Finally, the spectrum and universal relations for the dipole F-mode are presented. We give our conclusions in section 4. The Appendix shows the set of the explicit $l=1$ equations (\ref{Appendix_eqs_l1}), and exhibits the Tables with the fit parameters for the universal relations (\ref{Appendix_tables_l2} and \ref{App_dipole}). \section{Theoretical Setting} \subsection{Neutron stars in $R^2$ gravity} We consider the scalar-tensor theory action in the Einstein frame ($G=c=1$) \cite{Yazadjiev:2014cza,Staykov:2014mwa}, \begin{equation} S [g_{\mu\nu},\phi] = \frac{1}{16\pi } \int d^4x \sqrt{-g} \big( R - 2\partial_{\mu}\phi \, \partial^{\mu}\phi - V(\phi) + L_{M}(A^2(\phi)g_{\mu\nu},\chi) \big)~, \label{EinsteinAction} \end{equation} with the Brans-Dicke coupling function \begin{equation} A(\phi)= e^{-\frac{1}{\sqrt{3}}\phi} \end{equation} in the matter action $L_M$, and the potential term \begin{equation} V=\frac{3m_{\phi}^2}{2} \big(1- e^{-\frac{2\phi}{\sqrt{3}}}\big)^2 \ . \label{pots} \end{equation} The Einstein frame action (\ref{EinsteinAction}) is equivalent to the {$R^2$ gravity} action in the Jordan frame \begin{equation} S[g_{\mu\nu}^*] = \frac{1}{16\pi} \int d^4x \sqrt{-g^*} \big( R^* + {a} {R^*}^2 + L_{M} (g_{\mu\nu}^*, \chi) \big) ~. \label{fR} \end{equation} The theory parameter ${a}$ is related to the scalar field mass, \begin{equation} m_{\phi} = \frac{1}{\sqrt{6 {a}}} \ . \end{equation} From the action (\ref{EinsteinAction}), the field equation for the metric $g_{\mu\nu}$ is given by, \begin{equation} G_{\mu\nu} = T^{(S)}_{\mu\nu} + 8 \pi T^{(M)}_{\mu\nu} -\frac{1}{2}V(\phi)g_{\mu\nu} ~, \label{eq_G} \end{equation} with Einstein tensor $G_{\mu\nu} = R_{\mu\nu} - \frac{1}{2}Rg_{\mu\nu}$. The energy-momentum tensor for the scalar field is \begin{equation} T^{(S)}_{\mu\nu}=2\partial_{\mu}\phi\partial_{\nu}\phi - g_{\mu\nu} \partial^{\sigma}\phi\partial_{\sigma}\phi \ , \end{equation} and for the matter, it is \begin{equation} T^{(M)}_{\mu\nu} = (\rho + p)u_{\mu}u_{\nu} + pg_{\mu\nu} ~, \label{T_matter} \end{equation} where the pressure {$p$} and density {$\rho$} in the Einstein frame are related to the {respective physical} Jordan frame quantities $\hat{p}$ and $\hat{\rho}$ via the coupling function $A$, \begin{equation} p = A^4 \hat{p}~, \quad \rho = A^4 \hat{\rho} ~. \label{p_rho_EJ} \end{equation} The dynamical field equation {for the scalar field following} from action (\ref{EinsteinAction}) is \begin{equation} \nabla_{\mu}\nabla^{\mu}\phi = -4\pi\frac{1}{A}\frac{dA}{d\phi} T^{(M)} + \frac{1}{4} \frac{dV}{d\phi} ~. \label{scalar_eom} \end{equation} \subsection{Background ansatz and properties} The metric is {chosen} static and spherically symmetric \begin{equation} ds^2 = g_{\mu\nu}^{(0)} dx^{\mu} dx^{\nu} = -e^{2\nu(r)} dt^2 + e^{2\lambda(r)} dr^2 + r^2 (d\theta^2 + \text{sin}^2 \theta \, d\varphi^2 ) ~, \end{equation} the scalar field, energy density and pressure are then functions of $r$, \begin{eqnarray} \phi=\phi_0(r) ~, \hat{\rho}=\hat{\rho}_0(r) ~, \hat{p}=\hat{p}_0(r) ~, \end{eqnarray} and the four-velocity of the static fluid is given by \begin{eqnarray} u^{(0)}=-e^{\nu}dt ~. \end{eqnarray} The equations for the static functions inside the star are {then given by} \begin{eqnarray} &&\frac{1}{r^2}\frac{d}{dr}\left[r(1- e^{-2\lambda})\right]= 8\pi A_0^4 {\hat{\rho}_0} + e^{-2\lambda}\left(\frac{d\phi_0}{dr}\right)^2 + \frac{1}{2} V_0 ~, \label{eq_lambda} \\ &&\frac{2}{r}e^{-2\lambda} \frac{d\nu}{dr} - \frac{1}{r^2}(1- e^{-2\lambda})= 8\pi A_0^4 \hat{p}_0 + e^{-2\lambda}\left(\frac{d\phi_0}{dr}\right)^2 - \frac{1}{2} V_0 ~, \label{eq_nu} \\ &&\frac{d\hat{p}_0}{dr}= - (\hat{\rho}_0 + \hat{p}_0) \left(\frac{d\nu}{dr} +\frac{1}{A_0}\frac{dA_0}{d\phi_0}\frac{d\phi_0}{dr} \right) ~, \label{eq_pJ} \\ &&\frac{d^2\phi_0}{dr^2} + \left(\frac{d\nu}{dr} - \frac{d\lambda}{dr} + \frac{2}{r} \right)\frac{d\phi_0}{dr}= 4\pi\frac{1}{A_0}\frac{dA_0}{d\phi_0} A_0^4(\hat{\rho}_0-3\hat{p}_0)e^{2\lambda} + \frac{1}{4} \frac{dV_0}{d\phi_0} e^{2\lambda} ~, \label{eq_phi} \end{eqnarray} where $A_0=A(\phi_0)$ and $V_0=V(\phi_0)$. To calculate the moment of inertia at first order in the slow rotation approximation, we introduce the angular velocity of the star $\Omega$ and the inertial dragging $\omega(r)=\Omega-w(r)$ \cite{Hartle:1967he,Sotani:2012eb}, \begin{equation} ds^2 = -e^{2\nu(r)} dt^2 + e^{2\lambda(r)} dr^2 + r^2 (d\theta^2 + \text{sin}^2 \theta \, d\varphi^2 )-2(\Omega-w)r^2 \text{sin}^2 \theta \, dt \, d\varphi ~. \end{equation} The energy density and pressure do not change, but the four-velocity is \begin{eqnarray} u=-e^{\nu}(dt+r^2\sin^2{\theta} \, w \, d\varphi) ~, \end{eqnarray} and the resulting equation for $w$ is \begin{equation} \frac{e^{\nu-\lambda}}{r^4}\frac{d}{dr}\left[ e^{-(\nu+\lambda)}r^4\frac{dw}{dr}\right]= 16\pi A_0^4 {(\hat{\rho}_0+\hat{p}_0)}w \ . \end{equation} The asymptotic behaviour {of the metric and scalar functions is given by} \begin{eqnarray} e^{2\nu}=e^{-2\lambda}\sim 1-2M/r ~, \\ w \sim \frac{2J}{r^3} ~, \\ \phi_0 \sim \frac{1}{r}e^{-m_\phi r} ~, \end{eqnarray} where $M$ is the star mass, and $J$ its angular momentum. {Thus} $I=J/\Omega$ is its moment of inertia. Regularity at the center {of the star requires} \begin{eqnarray} \nu(0) = \nu_c ~, \ \ \lambda(0) = 0 ~, \ \ \phi_0(0) = \phi_c ~, \\ \hat{p}(0)=\hat{p}_c ~, \ \ \hat{\rho}(0)=\hat{\rho}_c ~, \\ w(0) =0 ~. \end{eqnarray} The border of the star is {located at} $r=R$, where $\hat{p}(R)=\hat{\rho}(R)=0$. \subsection{Polar perturbations} Here we focus on polar perturbations {(see e.g. \cite{Regge:1957td,Zerilli:1970se,Thorne:1967a,Price:1969,Thorne:1969rba,Campolattaro:1970,Thorne:1980ru,Detweiler:1985zz,Chandrasekhar:1991fi,Chandrasekhar:1991,Chandrasekhar:1991_,Ipser:1991ind,Kojima:1992ie} for derivation of the appropriate decomposition and ansatz)} and, in particular, on dipolar and quadrupolar perturbations. The zeroth order is given by the static and spherically symmetric background. Introducing the perturbation parameter $\epsilon<<1$, we perturb the background metric, the scalar field and the fluid as follows \begin{eqnarray} g_{\mu\nu} = g_{\mu\nu}^{(0)}(r) + \epsilon h_{\mu\nu}(t,r,\theta,\varphi)~, \\ \label{Phiperturb} \phi = \phi_{0}(r) + \epsilon \delta\phi (t,r,\theta,\varphi)~, \\ \rho = \rho_0 (r) + \epsilon \delta\rho(t,r,\theta,\varphi)~, \\ p = p_0(r) + \epsilon \delta p(t,r,\theta,\varphi)~, \\ u_{\mu} = u^{(0)}_{\mu} (r) + \epsilon \delta u_{\mu} (t,r,\theta,\varphi) ~. \end{eqnarray} The polar metric perturbations can be written as \begin{equation} h_{\mu\nu}^{(\text{polar})} = \sum\limits_{l,m}\,\int \left[ \begin{array}{c c c c} r^l e^{2\nu} H_0 Y_{lm} & -i \omega r^{l+1} H_1 Y_{lm} & 0 & 0 \\ -i \omega r^{l+1} H_1 Y_{lm} & r^l e^{2\lambda} H_2 Y_{lm} & 0 & 0 \\ 0 & 0 & r^{l+2} K Y_{lm} & 0 \\ 0 & 0 & 0 & r^{l+2} \sin^2\theta K Y_{lm} \\ \end{array} \right] e^{-i\omega t} d\omega ~, \end{equation} {where $Y_{lm}$ are the spherical harmonic functions.} The scalar field and fluid perturbations read \begin{equation} \delta \phi = \sum\limits_{l,m}\,\int r^l \phi_1 \, Y_{lm} e^{-i\omega t} d\omega ~, \end{equation} \begin{equation} \delta \rho = \sum\limits_{l,m}\, \int r^l E_{1 } Y_{lm} e^{-i\omega t }d\omega~, \quad \delta p = \sum\limits_{l,m}\, \int r^l \Pi_{1} Y_{lm} e^{-i\omega t} d\omega~, \end{equation} \begin{eqnarray} \delta u_{\mu} = \sum\limits_{l,m}\,\int \left[ \begin{array}{c} \frac{1}{2} r^l e^{\nu} H_0 Y_{lm} \\ r^l i\omega e^{-\nu} \left(e^{\lambda}W/r -r H_1 \right) Y_{lm} \\ -i\omega r^l e^{-\nu} V \partial_{\theta} Y_{lm} \\ -i\omega r^l e^{-\nu} V \partial_{\varphi} Y_{lm} \\ \end{array} \right] e^{-i\omega t} d\omega ~. \end{eqnarray} We have introduced the complex frequency $\omega=\omega_R+i\omega_I$ of the QNMs, {where $\omega_R$ represents the characteristic frequency and $\omega_I$ represents the decay rate of the mode.} Outside the star there is no fluid, meaning $\Pi_1=E_1=0$, so the perturbations simplify considerably. Substituting this ansatz into the field equations, it is possible to reduce the problem to a set of ordinary differential equations. These equations can be found, for the general case, in \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. In this paper we will focus on $l=1$ (dipole) and $l=2$ (quadrupole) perturbations. {The resulting set of equations for $l=1$ is shown in Appendix \ref{Appendix_eqs_l1}.} The procedure to obtain the QNMs is similar to the one followed in \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}: we must impose outgoing-wave conditions as $r\to\infty$, while at the center and at the surface of the star, the perturbation functions must be regular. These translate into a number of conditions that can be imposed numerically (see also \cite{Blazquez-Salcedo:2018pxo} for a description of the general method employed to calculate the modes). \section{Results} In this section we present our results. As discussed above, the field equations have to be supplemented by an equation of state {$\hat{\rho}(\hat{p})$ (usually given in the Jordan frame)}. Here we choose the following set of realistic EOSs: \begin{itemize} \itemsep=-1pt \item Two EOSs containing plain nuclear matter: SLy \cite{Douchin:2001sv} and APR4 \cite{Akmal:1998cf}. \item Two EOSs containing nucleons and hyperons: GNH3 \cite{Glendenning:1984jr}, H4 \cite{Lackey:2005tk}. \item Two EOSs containing hybrid nuclear-quark matter: ALF2 \cite{Alford:2004pf}, WSPHS3 \cite{Weissenborn:2011qu}. \end{itemize} {We also consider} a simple non-relativistic polytropic equation of state $p=\kappa\rho^{5/3}$, with $\kappa = 0.53802 \cdot 10^{10}$ dyn/(g/cm$^3$)$^{5/3}$ used {for dipole F-modes} \cite{Lindblom:1989} {(see Appendix \ref{App_dipole})}. {We perform a detailed QNM analysis for a set of $R^2$ theories with coupling constants $a$ satisfying the observational bound from Gravity Probe B, $a\lesssim 5 \cdot 10^{11}$ m$^2$ \cite{Naf:2010zy}. In terms of the scalar mass this bound translates into $m_\phi \gtrsim 10^{-4}$ neV (see also \cite{Yazadjiev:2014cza}). In particular, we choose for the scalar field mass the values $m_\phi=0.0108$ neV, 0.0343 neV, 0.0766 neV, 0.1084 neV and 0.3428 neV. These values belong to the physically interesting mass range \cite{Naf:2010zy,Ramazanoglu:2016kul,Brito:2017zvb}, and at the same time cover well the full range of QNM values for the fundamental quadrupole mode, ranging basically between the limiting theories, general relativity on the one hand and a massless Brans-Dicke theory on the other hand. As already earlier noted, for $m_\phi=1.08$ neV the fundamental modes approach those of general relativity very closely, whereas $m_\phi = 1$ peV the modes are very close to those of the massless case \cite{Blazquez-Salcedo:2018qyy,Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. } \subsection{Mass, radius and moment of inertia} \begin{figure}[t!] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_R_panel.eps} \includegraphics[width=.32\textwidth, angle =-90]{plot_M_I_panel.eps} \caption{(left) Mass-radius {relation: mass $M$ in solar masses $M_\odot$ versus physical radius $R$ in km.} (right) Moment of inertia-mass {relation: moment of inertia $I$ in units of $M_\odot r_S^2$ (with solar gravitational radius $r_s$). The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:M_I_panel_l1} \end{figure} For reference we include here {some relevant} results on the global properties of neutron stars. In Figure \ref{fig:M_I_panel_l1} (left) we show the mass-radius relation (see also \cite{Blazquez-Salcedo:2018qyy}). In each panel we present a different EOS. Inside each panel, we show in black {the limiting case of} general relativity, in orange $m_\phi=0.343$ neV, in blue $m_\phi=0.108$ neV, in purple $m_\phi=0.034$ neV, and in red the massless limit. The radius $R$ (in km) is the physical radius of the star, i.e., the radius in the Jordan frame. {The mass $M$ (in solar masses $M_\odot$) is independent of the frame. The ratio of mass and radius yields the compactness $C=M/R$ of the star.} Figure \ref{fig:M_I_panel_l1} (right) is an analogous figure for the moment of inertia $I$ as a function of the total mass $M$. The moment of inertia is given in units of $M_\odot r_s^2$, where $r_s=1.47664$ km is the {gravitational radius corresponding to one solar mass} $M_\odot$. Similar results have been obtained before in \cite{Staykov:2014mwa,Staykov:2015mma,Staykov:2016mbt}. With the moment of inertia one can define the radius of gyration, $\hat{R}=\sqrt{I/M}$, and with this the so-called generalized compactness $\eta = M/\hat{R} = \sqrt{M^3/I}$. \subsection{Quadrupole f-mode: spectrum} Here we present our results for the $l = 2$ perturbations. In this case, there are, apart from fluid-led modes and scalar-led modes, also curvature-led modes. {Previous investigation of the scalar-led $\phi$-modes revealed very little dependence of the frequency and the damping time on the mass of the neutron stars \cite{Blazquez-Salcedo:2021exm}.} However, {the scalar-led and the curvature-led modes} are expected to be physically less relevant, since they possess shorter damping times (milliseconds), and they are expected to be more difficult to excite during astrophysical phenomena that produce gravitational waves. % \begin{figure}[h!] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaR_l2_panel.eps} \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaI_l2_panel.eps} \caption{Frequency $\omega_R$ in kHz (left) and damping time $\tau$ in seconds (right) versus neutron star mass $M$ in $M_{\odot}$ for the fundamental quadrupole f-mode. {The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:MR_MI_pcp_panel_l2} \end{figure} Hence, we here focus on the quadrupole f-mode. In Figure \ref{fig:MR_MI_pcp_panel_l2} we show the frequency in kHz (left) and the damping time in seconds (right) for several EOSs (one per panel) and several values of the scalar mass (colored curves). {For comparison, the corresponding f-modes of general relativity (black) are also shown}. For heavier neutron stars, general relativity {leads} typically to the highest frequency values and the {longest} damping times. The effect of the scalar {degree of freedom} is to decrease these values, the lighter the scalar, the more important this effect. For small values of the neutron star mass, a crossing of the frequencies is observed, {such that} for intermediate values of the scalar mass, the frequencies may be slightly larger than the corresponding general relativistic values. \subsection{Universal relations for the quadrupole f-mode}\label{Uni_rel_l2} We now present our results concerning universal relations for the quadrupole f-mode. We have performed our analysis for scalar field masses $m_\phi= 0.0108$ neV, 0.0343 neV, 0.1084 neV and 0.3428 neV and for the limiting case of general relativity including all six EOSs, SLy, APR4, H4, GNH3, ALF2 and WSPHS3. Only for the highest scalar mass of $m_\phi=0.3428$ neV we have not included EOS WSPHS3, since the modes were very close to the modes of general relativity. The fitting procedure has been based on a polynomial of order 4, $f=ax^4+bx^3+ cx^2 + dx + e$. When the fit error in a specific term went up to 100\% or beyond, the particular term has been considered redundant in the fitting procedure and has therefore been discarded. In the following we exhibit a set of figures exploring various possibilities for universal relations for the frequencies $\omega_R$ and damping times $\tau$ of the modes, that involve a variety of properly scaled (in geometric units) dimensionless quantities on both axes. For each fit we also present the corresponding fitting coefficients and errors in tables, {along with the average error of the fits for better comparison among the various relations}. {For a better overview, the tables with the fit parameters for all these universal relations for the f-modes have been collected in Appendix \ref{Appendix_tables_l2}.} We start our discussion with relations that involve only either the frequency $\omega_R$ or the damping time $\tau$, and continue subsequently with relations involving both $\omega_R$ and $\tau$. In Figure \ref{fig:uni_rel_2_mass_omega} we have scaled the frequency $\omega_R$ with the neutron star mass $M$, and exhibit the dimensionless frequency $M\omega_R/c$ versus the compactness $C=M/R$ on the left hand side of the figure in the upper panel. The various symbols indicate the numerical results of the calculations of the modes for their respective EOS. At the same time the colors indicate the respective values of the scalar field mass $m_{\phi}$. The general relativistic limit is shown in black. For each theory, the curve with the respective color represents the corresponding best fit. The lower panel contains the associated fit errors. The right hand side is an analogous figure where the dimensionless frequency $M\omega_R/c$ is now shown versus the generalized compactness $\eta$ together with the fit errors. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_omega.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_mass_omega.pdf} \caption{{f-mode universal relations: dimensionless frequency $M\omega_R/c$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_2_mass_omega} \end{figure} The dimensionless f-mode frequency $M\omega_R/c$ exhibits a rather linear dependence on the compactness $C=M/R$ and (to a slightly lesser degree) on the generalized compactness $\eta$. While a polynomial of degree 4 is used when fitting all results in this section to accommodate a larger class of dependencies between the dimensionless variables, for this particular example, almost all of the fit parameters of the higher-order terms ($a,b,c$) carry an error larger than 50\%, thus hinting at a linear fit. We provide the corresponding values of the fit parameters and errors in Table \ref{rel_fit_MOmegaR_C_l2_lhs} and Table \ref{rel_fit_MOmegaR_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}. As noted already before in general relativity \cite{Lau:2009bu} and evident from Figure \ref{fig:uni_rel_2_mass_omega} also for $R^2$ gravity, the distribution of data points for the f-mode frequency exhibits a smaller fit error, when the generalized compactness $\eta$ is considered instead of the compactness $C$. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_tau.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_mass_tau.pdf} \caption{ {f-mode universal relations: dimensionless inverse damping time $M/(c\tau)$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.}} \label{fig:uni_rel_mass_tau_full} \end{figure} Figure \ref{fig:uni_rel_mass_tau_full} is an analogous figure for the dimensionless inverse damping time $M/(c\tau)$, where the neutron star mass $M$ has also been used to obtain the relevant dimensionless quantity. Again, the figure and also the corresponding tables for the fits, Tables \ref{rel_fit_MOmegaI_l2_lhs} and \ref{rel_fit_MOmegaI_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}, show that the errors in the fit parameters are generally lower when the generalized compactness $\eta$ is employed instead of the compactness $C$. {Comparing Figures \ref{fig:uni_rel_2_mass_omega} and \ref{fig:uni_rel_mass_tau_full} shows that the dimensionless frequency $M\omega_R/c$ provides a better fit than the dimensionless damping time $M/(c \tau)$. However, the dimensionless damping time $M/(c \tau)$ exhibits a larger split between the universal relations for the different scalar masses $m_\phi$.} Such a split is of course needed, if one is to exploit the universal relations to obtain bounds on the theory. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_omega_scale_hat.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_omega_scale.pdf} \caption{{f-mode universal relations: dimensionless frequency $\omega_R/\hat \omega_o$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_omega_omegao} \end{figure} {Significant improvement of the fits is observed when we consider a different type of scaling of the frequency $\omega_R$, as shown in Figure \ref{fig:uni_rel_omega_omegao}. Here we have employed the reference frequency $\hat \omega_o= \sqrt{\frac{3Mc^2}{4\hat{R}^3}}=\frac{c}{M}\sqrt{\frac{3}{4}\eta^3}$ (with $\hat{R}=\sqrt{I/M}$), that involves the generalized compactness. % We exhibit the scaled frequency {$\omega_R/\hat{\omega}_o$} versus both compactness and generalized compactness. While both are rather good, taking compactness instead of generalized compactness is {slightly} better. Also here we observe the desired splitting of the universal relations, as the scalar mass is varied. {For the corresponding tables for the fits, see Table \ref{rel_fit_omega_scale_hat_l2_lhs} and \ref{rel_fit_omega_scale_hat_l2_rhs}.} We have also performed the analysis with the reference frequency $\omega_o= \sqrt{\frac{3Mc^2}{4{R}^3}}=\frac{c}{M}\sqrt{\frac{3}{4}C^3}$, that is analogous but involves compactness \cite{Lindblom:1989}. The corresponding fits fare much worse again, therefore we do not show them here.} { {Apart from that}, the dimensionless frequency $\omega_R/\hat{\omega}_o$ {also} yields a much better universal relation than the dimensionless quantities $R\omega_R/(c\eta)$ {and} $R\omega_R/(c\eta^3)$, {with the latter being the worst of all}. } \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_tau_scale.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_function_tau_eta.pdf} \caption{{f-mode universal relations: dimensionless damping time $\tau \hat \omega_o$ versus generalized compactness $\eta$ (left upper panel) and fit errors (left lower panel); dimensionless function of damping time $\hat{R}I^{1/2}/(cM^{3/2}\tau)$ versus generalized compactness $\eta$ (right upper panel) and fit errors (right lower panel). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_tau_omegao} \end{figure} { Figure \ref{fig:uni_rel_tau_omegao} (left) exhibits the fits for the damping time scaled with $\hat \omega_o$. Here we consider the scaled damping time {$\tau\hat{\omega}_o$} versus the generalized compactness. Table \ref{rel_fit_tau_scale_hat_l2_rhs} shows the corresponding fit parameters. {As opposed to} the scaled frequency, we observe an improvement for the scaled damping time, with the generalized compactness faring slightly better than the compactness. Again, when employing the reference frequency $\omega_o$ we see worse fits, so we neither display them here. We have also investigated the scaled frequency $R\omega_R/(c\eta^3)$ and the scaled damping time $R/( c\eta^3 \tau)$, but the results of the fits were again worse than those above based on scaling with $\hat \omega_o$. Figure \ref{fig:uni_rel_tau_omegao} (right) shows the relations involving the damping time $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ and the generalized compactness, with improved errors, where the fit parameters can be found in Table \ref{rel_fit_tau_scale_hat_l2_lhs}.} { The universal relations with the dimensionless function of the damping time $R^4/ (c M^3 \tau)=R/(c C^3 \tau)$ and the compactness $C$ possess an error bounded by at most 10\%. This fit is worse as the mean errors from the theories are considerably larger than those produced by the relations in Figure \ref{fig:uni_rel_tau_omegao} (right). {It does not improve if one replaces $C$ by $\eta$, i.e. $R/(c\eta^3\tau)$.} However, if one considers $R/(c\eta^3\tau)$ against the generalized compactness, the average error {improves slightly}. {We also tested the universal relation of $R/(c\eta\tau)$ with the compactness $C$ and the generalized compactness $\eta$. The {average} error of these fits is roughly the same as when scaling the damping time with $\hat{\omega}_o$, {although it results in a clearer splitting of the universal relations for different scalar masses}.} We find that the average errors can be even lowered when we consider universal relations utilizing the radius of gyration $\hat{R}$ in a dimensionless function of the real frequency as in $\hat{R}\omega_R I^{1/2}/ (c M^{3/2})$ and the generalized compactness $\eta$, shown in Figure \ref{fig:uni_rel_mass_tau__mass_omega_full} (left). Table \ref{rel_fit_R4_l2_rhs} of Appendix \ref{Appendix_tables_l2} presents the associated fits. They give an average error slightly smaller than their imaginary frequency counterpart in Figure \ref{fig:uni_rel_tau_omegao} (right). \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_function_omega_eta.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_tau__mass_omega.pdf} \caption{ {f-mode universal relations: dimensionless function of real frequency $\hat{R}\omega_R I^{1/2}/ (c M^{3/2})$ versus compactness $\eta=M/\hat{R}$ (left upper panel) and fit errors (left lower panel); dimensionless inverse damping time $M/(c\tau)$ versus dimensionless frequency $M\omega_R/c$ (right upper panel) and fit errors (right lower panel). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_mass_tau__mass_omega_full} \end{figure} } We now consider universal relations containing both the frequency $\omega_R$ and the damping time $\tau$. In Figure \ref{fig:uni_rel_mass_tau__mass_omega_full} (right) we display universal relations where the dimensionless inverse damping time $M/(c\tau)$ is considered as a function of the dimensionless frequency $M\omega_R/c$, and we have scaled with the neutron star mass $M$. The associated fits are presented in Table \ref{rel_fit_tau-OmegaR_l2_lhs} of Appendix \ref{Appendix_tables_l2}. These universal relations turn out to be currently the best fits that involve both $\omega_R$ and $\tau$. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_omega_tau.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_omega_tau.pdf} \caption{ {f-mode universal relations: dimensionless product of frequency and damping time $\omega_R\, \tau$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_omega_tau_full} \end{figure} For comparison we also exhibit universal relations containing the product of the frequency $\omega_R$ and the damping time $\tau$. Figure \ref{fig:uni_rel_omega_tau_full} exhibits this product $\omega_R\, \tau$ versus compactness $C$ (left) and generalized compactness $\eta$ (right). The respective fit parameters are shown in Table \ref{rel_fit_tauOmegaR_l2_lhs} and Table \ref{rel_fit_tauOmegaR_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}. The quality of the fits is reasonable but represents no improvement, quite to the contrary. {{Other universal relations we tested, such as $M \tau \omega_R^2 /c$ and $R \tau \omega_R^2 /c$ versus $C$ and $\eta$, are not convincing either and we refrain from exhibiting them here.}} { Among the universal relations which contain solely the frequency, the relations of $\omega_R/\hat{\omega}_o$ versus the compactness are the best, while for damping time (e.g. in Figure \ref{fig:uni_rel_mass_tau_full} and Figure \ref{fig:uni_rel_tau_omegao} (left)), the universal relations of $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ and generalized compactness are the best. In the case when both frequency and damping time are involved, $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ relations are comparable to the relations of $\omega_R\tau$, and the best relations are given by $M/(c\tau)$ and $M\omega_R/c$. } {Concluding we note, that the f-mode can be rather well described in terms of universal relations involving scaling with $\hat \omega_o$, shown in Figure \ref{fig:uni_rel_omega_omegao} and \ref{fig:uni_rel_tau_omegao}, {as is as well evident from their lower average error $\bar{\epsilon}$}. Other relations tested range from reasonable to rather unconvincing. Most of the universal relations reveal a monotonic change with the scalar mass $m_\phi$, smoothly reaching the general relativistic limit for sufficiently large scalar mass. Depending on the accuracy of future observations of the gravitational radiation from neutron stars, the split might suffice to put stronger lower bounds on the coupling constant $a$ and the associated scalar mass $m_\phi$.} \subsection{Dipole F-mode: spectrum}\label{Dipole_spectrum} We now turn to the dipole ($l=1$) perturbations. Analogous to the radial ($l=0$) sector, the dipole perturbations possess fluid-led modes and scalar-led modes. Here we will focus on the fundamental fluid mode, the dipole F-mode. Dipole modes were studied previously for several EOSs in general relativity (see e.g. \cite{Lindblom:1989,Takata:2008}). The most important point here is, however, that dipole modes (like radial modes) do not propagate in general relativity. Therefore the modes are normal modes, that possess real eigenvalues, i.e, only a frequency $\omega_R$, while $\omega_I=0$. Consequently, when the general relativistic modes are smoothly reached in the limit of infinite scalar mass $m_\phi$, the imaginary part of the mode eigenvalue should decrease to zero, making the modes ultra-long lived, as long as $m_\phi$ is finite, and approach the non-propagating modes of general relativity in the limit. \begin{figure}[H] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaR_l1_panel.eps} \caption{ Frequency $\omega_R$ in kHz versus neutron star mass $M$ in $M_{\odot}$ for the fundamental dipole F-mode. {The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:M_OmegaR_pcp_panel_l1} \end{figure} In Figure \ref{fig:M_OmegaR_pcp_panel_l1} we show the frequency $\omega_R$ of the dipole F-mode (in kHz) versus the mass $M$ (in $M_\odot$) analogously to the quadrupole f-mode in Figure \ref{fig:MR_MI_pcp_panel_l2}, i.e., the panels correspond to different EOSs, and the colors to different values of the scalar field mass $m_\phi$ with general relativity in black. {The figure contains only the real part of the mode eigenvalue and not the imaginary part, however, since the $\omega_I$ is very small and therefore cannot be extracted with sufficient accuracy. The smallness of $\omega_I$ then translates into the largeness of its inverse $\tau$, making these dipole F-modes ultra-long lived. At the same time, this conforms to the above expectation of approaching the general relativistic limit of non-propagating modes.} {When recalling and comparing with the pattern observed for the radial F-mode in $R^2$ gravity \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm} we see a strong correspondence. The frequencies $\omega_R$ are % almost independent of the neutron star mass, except for the scalar masses closest to general relativity and neutron star masses close to the maximum mass. Moreover, both the radial F-mode and the dipole F-mode are ultra-long lived in the full range of scalar masses studied. A clear difference is, however, their behavior along a family of neutron stars rather close to the maximum neutron star mass. The radial F-mode frequency must decrease to zero, since the radial mode signals the instability of neutron stars beyond the maximum mass. There the eigenvalue of the mode becomes purely imaginary, indicating the instability timescale. Since the dipole F-mode frequency does not decrease to zero towards the maximum mass, this signals that this mode does not carry a further instability.} {When considering the frequency $\omega_R$ as a function of the scalar mass $m_\phi$, the analysis of the radial F-mode revealed, that its scale is set by the size of the neutron star as long as the Compton wavelength {$L_\phi$} corresponding to $m_\phi$ is small with respect to the size. However, when the Compton wavelength is large as compared to the size of the neutron star, it is simply the scalar mass $m_\phi$ itself that sets the scale of the frequency. Moreover, in this case this behavior of the scalar F-mode follows roughly the scalar $\phi$-mode \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. Since the dipole F-mode shows so much similarity to the radial F-mode, a similar pattern may be present also in this respect. While this is supported by our current data, a systematic study of the dependence on the scalar mass $m_\phi$ has not yet been made. } \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{omega_mass_l1_fit_constant.pdf} % \caption{ {F-mode analysis: frequency $\omega_R$ versus mass $M$ (upper panel) and fit errors (lower panel) for a constant fit. % The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ for $m_{\phi}=0.108$ neV, $0.0767$ neV, and $0.0343$ neV.} } \label{fig:analysis_l1} \end{figure} {However, our current study lends additional support to this conjecture that arises from the investigation of the mode for a set of EOSs. Here Figure \ref{fig:M_OmegaR_pcp_panel_l1} shows, that the value of the frequency is not only rather independent of the neutron star mass but also of the employed EOS. An analysis of this independence is shown in Figure \ref{fig:analysis_l1} {for the lower values of the scalar field mass}, where we exhibit the frequency $\omega_R$ versus the neutron star mass $M$ for all EOSs, as if it where a universal relation, with the corresponding constant fit and error analysis. % {The corresponding fit parameters including the errors can be found in Table \ref{rel_fit_analysis_l1_lhs} in Appendix \ref{App_dipole}.} The constant fit yields for $m_{\phi}=0.108$ neV a frequency $\omega_R =3.96$ kHz, for $m_{\phi}=0.0767$ neV: $\omega_R =2.88$ kHz, and for $m_{\phi}=0.0343$ neV: $\omega_R =1.295$ kHz. Note, that the respective values of the frequency would be $\omega_R =4.16$ kHz for $m_{\phi}=0.108$ neV, $\omega_R =2.95$ kHz for $m_{\phi}=0.0767$ neV, and $\omega_R =1.32$ kHz for $m_{\phi}=0.0343$ neV, if we simply employed the formula $2\pi \omega_R=c/L_\phi$ found for the $l=0$ F-mode. Here this behavior is seen up to somewhat higher scalar masses, and is ending when general relativity dominates the behavior of the $l=1$ F-modes. Clearly, for the two lowest scalar masses $m_{\phi}=0.0343$ neV and $0.0767$ neV the constant fit is rather convincing, while the quality declines for $m_{\phi}=0.108$ neV as can be expected towards larger scalar mass. } {The above observation makes in principle a search for universal relations for sufficiently small scalar masses in $R^2$ theory superfluous. It would fully suffice to % measure the frequency $\omega_R$ of the F-mode to determine the scalar field mass and thus the theory. It would be interesting though to investigate, whether other theories involving scalars would exhibit an analogous phenomenon, and if they would, to see whether there would be a way to distinguish among the theories. } \subsection{Universal relations for the ultra-long lived dipole F-modes}\label{Uni_rel_l1} We now look for universal relations for the fluid dipole F-modes, restricting to relations that involve only the frequency $\omega_R$. We begin again with the simple scaling relations involving the mass $M$, and exhibit in Figure \ref{fig:uni_rel_MOmegaR_error_eta_linear_affine} the dimensionless frequency $M\omega_R/c$ versus compactness $C=M/R$ (left) and versus generalized compactness $\eta$ (right) together with the fits and error analysis. The parameters are given in Table \ref{rel_fit_MOmegaR_lhs} for the relation with respect to compactness (left) and for the relation with respect to generalized compactness (right) in Table \ref{rel_fit_MOmegaR_rhs} in Appendix \ref{App_dipole}. \begin{figure}[h!] \centering \includegraphics[width=.45\textwidth, angle =0]{plot_rel_MOmegaR_scaled_w_error_affine_vp.pdf} \includegraphics[width=.45\textwidth, angle =0]{plot_rel_MOmegaR_scaled_w_error_eta_all_truelinear_vp.pdf} \caption{{F-mode universal relations: dimensionless frequency $M\omega_R/c$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} % } \label{fig:uni_rel_MOmegaR_error_eta_linear_affine} \end{figure} In both cases the relations are not convincing. While the errors seem to be largest for general relativity and decrease with decreasing scalar mass $m_\phi$, also the values themselves decrease, and therefore the relative error remains large also for the smallest considered scalar mass, as seen in the lower panels of the figures. \begin{figure}[h!] \centering \includegraphics[width=.48\textwidth, angle =0]{uni_rel_omega_scale_l1_wopi.pdf} \includegraphics[width=.48\textwidth, angle =0]{uni_rel_eta_omega_scale_l1_wopi.pdf} \caption{{F-mode universal relations: dimensionless frequency {$\omega_R/\omega_o$} (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} % } \label{fig:uni_rel_c_2_l1_error_no_log_linear} \end{figure} {Figure \ref{fig:uni_rel_c_2_l1_error_no_log_linear} illustrates the dimensionless frequency {$\omega_R/\omega_o$} versus the compactness $C=M/R$ (left) and the generalized compactness $\eta$ (right).} The corresponding fit parameters are given in Table \ref{rel_fit_Omegao_MR} and Table \ref{rel_fit_Omegao_rhs}. {In contrast to the f-modes (see Figure \ref{fig:uni_rel_omega_omegao}), the reference frequency $\omega_0$ {in the scaling} provides a small improvement for the F-modes compared to {using} $\hat{\omega}_0$.} {While these fits for the F-mode are by far not as good as for the f-mode, they are so far the best fits we have obtained for the F-mode.} Clearly, when looking for universal relations for the F-mode a significant dependence on the EOS is retained, and the considered universal relations are not as good as for other modes. We also do not see a strong improvement for theories with light scalars as compared to general relativity. {However, as noted in the previous subsection, for sufficiently small scalar masses universal relations for the F-mode may not be needed, since the frequency $\omega_R$ itself is basically independent of the neutron star mass and, in particular, also independent of the EOS. {This is further supported by the much lower average error of the fit $\bar{\epsilon}$ {in Table \ref{rel_fit_analysis_l1_lhs}}.} For larger scalar masses this independence of the EOS (and the neutron star mass) disappears largely, and universal relations would be appreciated just as in the case of general relativity itself, although in the latter case, the modes are non-propagating normal modes.} \section{Conclusions} Universal relations of neutron stars are very important as long as their equation of state is not known. The (approximate) EOS independence of universal relations makes them valuable tools not only for the analysis of the properties of neutron stars in general relativity, but also to put bounds on generalized gravity theories, when their universal relations deviate from those of general relativity. In this paper we have for the first time constructed universal relations for polar quasinormal modes in a generalized theory of gravity, beyond the Cowling approximation. In particular, we have chosen $R^2$ gravity and formulated it in the Einstein frame. This makes the additional degree of freedom explicit in the form of a scalar field coupled to the neutron star matter, where for the scalar field we have chosen masses in the physically allowed range. We have focused our investigations on the fundamental quadrupole f-mode and the dipole F-mode and considered scalar masses in the range $m_\phi=0.0108$ neV to $m_\phi=0.3428$ neV. The lower of these masses lead to distinct effects as compared to general relativity, whereas the highest masses yield for these fluid modes results very close to general relativity. Of course, in general relativity the dipole fluid modes do not propagate, but for the larger scalar masses the F-modes of $R^2$ theory become ultra-long lived, thus approaching the general relativistic limit also with respect to the imaginary part of the mode. To obtain universal relations we have considered six EOSs, covering plain nuclear matter, nucleons and hyperons, and hybrid nuclear-quark matter. We have constructed a variety of dimensionless quantities involving the frequency of the modes $\omega_R$ and the damping time $\tau$, starting with a scaling with the neutron star mass and considering the relations with respect to compactness and generalized compactness. In the latter the radius has been replaced by the gyration radius, that involves the moment of inertia of the neutron star. The best universal relations found for the quadrupole f-mode are obtained from scaling with a reference frequency $\hat \omega_o$, that involves the {{{{generalized}}}} compactness $\eta$, versus the compactness $C$, and leads to fit errors smaller than 1\% for the scaled frequency in these $R^2$ theories as well as a significant splitting between these theories. Future observations of these modes might therefore lead to new constraints on the coupling parameter $a$. The dipole F-mode of these theories shows a very different behavior. For the set of scalar masses considered, the frequency $\omega_R$ of the mode itself is very independent of the particular EOS and of the neutron star model employed. Instead, for a given scalar mass, $\omega_R$ is basically a constant that is determined by the relation $2\pi \omega_R=c/L_\phi$ with Compton wavelength $L_\phi$. Only for the largest masses considered, deviations occur, and the frequencies of general relativity are approached. Therefore, for the smaller masses, the frequency itself $\omega_R$ is universal, and a detection would directly yield the scalar mass. This is very similar to the case of scalar radiation, where we also found this dependency of the frequency on the Compton wavelength \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. However, there we did not yet show independence of the EOS, as well. Our next tasks will involve the calculation and analysis of further quasinormal modes for a representative set of EOSs. For quadrupole radiation we would like to analyze also the fundamental p mode, the spacetime w-mode and the $\phi$-mode. For dipole radiation we would like to understand better the $\phi$-mode in $R^2$ theory. Another direction will be to not only take the moment of inertia into account for the universal relations, but also the tidal deformability and the quadrupole moment of the neutron stars. Finally, the rapid rotation case will have to be tackled for quasinormal modes in alternative gravities. \section{Acknowledgements} {We would like to gratefully acknowledge support by the DFG Research Training Group 1620 \textit{Models of Gravity}, DFG projects BL1553 and Ku612/18-1, FCT project PTDC/FIS-AST/3041/2020, and the COST Actions CA15117 and CA16104. FSK thanks the Department of Theoretical Physics and IPARCOS of the Complutense University of Madrid for their hospitality. } \section{Introduction} Forming stable highly compact objects, matter in neutron stars is balancing the tremendous gravitational force with the help of repulsive nuclear forces against collapse. The extreme conditions existing in neutron stars make them outstanding laboratories, to learn about gravity on the one hand and particle physics on the other hand. On the particle physics side the equation of state (EOS) of nuclear matter in neutron stars is still unknown, although recent years have seen much progress (see e.g.,\cite{Lattimer:2021emm}). At the same time neutron star properties are being explored in numerous alternative theories of gravity that are motivated by cosmology and quantum gravity \cite{Faraoni:2010pgm,Berti:2015itd,CANTATA:2021ktz}. \\ The observations of gravitational waves in merger events involving neutron stars and the associated multi-messenger observations are providing an unprecedented wealth of data \cite{LIGOScientific:2016aoc,LIGOScientific:2017vwq,LIGOScientific:2017ync,LIGOScientific:2020aai}. Such merger events are consisting of three phases: inspiral, merger and ringdown, where the gravitational waves emitted in the ringdown phase of the newly formed highly excited compact object comprise its quasinormal modes (QNMs) (see e.g.~\cite{Andersson:1996pn,Andersson:1997rn,Kokkotas:1999bd,Berti:2015itd}). These represent characteristic modes of gravitational radiation from the object, encoding its properties and its reaction to perturbations. QNMs are also sensitive to the nuclear EOS and to the gravitational force, of course. Thus the study of QNMs can, in principle, strongly enhance the current knowledge of neutron stars and gravity, once sufficiently accurate data is provided by future gravitational wave detectors. \\ While at first a caveat seems to be a possible degeneracy of effects arising from the EOS dependence of the QNMs, the use of \textit{universal relations} allows to reduce the EOS dependence and thus lift the degeneracy to a large extent (see the reviews \cite{Yagi:2016bkt,Doneva:2017jop}). Universal relations are typically obtained for adequately scaled dimensionless physical quantities, such that when considered for a large set of EOSs relations between properties hold, that retain very little EOS dependence. Since universal relations arise both in general relativity and in alternative theories of gravity, deviations of these relations may betray the proper gravity theory, or at least yield constraints on the coupling parameters of these theories. \\ Universal relations of QNMs were first noticed and studied in general relativity \cite{Andersson:1996pn,Andersson:1997rn,Benhar:1998au,Benhar:2004xg,Tsui:2004qd,Lau:2009bu,Blazquez-Salcedo:2012hdg,Blazquez-Salcedo:2013jka,Chirenti:2015dda,Lioutas:2021jbl,Sotani:2021nlx,Sotani:2021kiw,Zhao:2022tcw}. They have been shown to exist for axial and polar quadrupole ($l=2$) modes including the fundamental (f) mode, the first pressure (p) mode, and the first curvature (w) mode of static neutron stars. For axial modes, universal relations have also been studied in some alternative theories of gravity \cite{Blazquez-Salcedo:2015ets,Blazquez-Salcedo:2018tyn,Blazquez-Salcedo:2018qyy,AltahaMotahar:2018djk,Blazquez-Salcedo:2018pxo,AltahaMotahar:2019ekm}. Axial modes are pure gravity modes, and there is no coupling to matter or possible scalar degrees of freedom, reducing the complexity of the axial perturbation equations. Polar modes, on the other hand, couple to matter as well as scalar fields, when present in alternative theories of gravity. This leads to highly involved sets of perturbation equations, unless the Cowling approximation is used, where the perturbations of the spacetime and the gravitational scalar field are frozen (see e.g., \cite{Sotani:2004rq,Staykov:2015cfa}). Clearly, the full set of perturbations equations results in a much richer spectrum of QNMs, including scalar monopole and dipole radiation as well as scalar-led quadrupole and higher $l$ modes \cite{Sotani:2014tua,Mendes:2018qwo,Blazquez-Salcedo:2020ibb,Kruger:2021yay,Dima:2021pwx,Blazquez-Salcedo:2021exm,Blazquez-Salcedo:2022dxh}. \\ Among the alternative theories of gravity, $f(R)$ theories have received much attention \cite{Sotiriou:2008rp,DeFelice:2010aj,Capozziello:2011et}. Here a rather attractive theory is $R^2$ gravity with $f(R) = R + a R^2$, and coupling constant $a$. Whereas $f(R)$ theories are formulated in the physical Jordan frame, they are more amenable to detailed neutron star analysis after transformation to the Einstein frame corresponding to a scalar-tensor theory, as formulated for $R^2$ gravity by Yazadjiev et al.~\cite{Yazadjiev:2014cza,Staykov:2014mwa} (see, however, \cite{Astashenok:2017dpo}). The coupling constant $a$ is then simply related to the mass $m_\phi$ of the gravitational scalar field. Due to their relative simplicity, axial modes and some of the their associated universal relations have been analyzed first for $R^2$ gravity \cite{Blazquez-Salcedo:2018qyy}. The analysis of the full set of polar modes has only recently been initiated, with calculations of monopole ($l=0$) and quadrupole ($l=2$) modes \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}.\\ The monopole modes represent radial modes. In general relativity the radial matter ($F$, $H_i$) modes correspond to normal modes, since monopole radiation is not allowed. Moreover, analysis of the radial modes beyond the maximum mass of the neutron stars reveals their instability. When a scalar degree of freedom is present, however, monopole radiation arises, manifesting itself in $R^2$ gravity in the form of ultra-long lived radial matter (F) modes as well as in additional scalar ($\phi$) modes \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. The scale of the frequency of the radial matter modes is set by the size of the star for the $F$-mode (and its multiples for the $H$-modes), when the Compton wavelength of the scalar field is small as compared to size of the star. Otherwise, the scale is set by the scalar field mass, with the $F$-mode following roughly the frequency dependence of the $\phi$-mode \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. \\ Here we extend our previous analysis and obtain also the lowest polar dipole ($l=1$) F-modes. Moreover, we present to our knowledge for the first time universal relations for polar dipole and quadrupole modes in an alternative theory of gravity, beyond the Cowling approximation. We have organized the paper as follows. In section 2 we present the theoretical settings, recalling the action of nuclear matter coupled to $R^2$ gravity in both the Einstein and the Jordan frame. We then discuss the background equations for the neutron stars, including slow rotation, and present the polar perturbation equations. Next we present our results in section 3, starting with a discussion of the neutron star mass, radius and moment of inertia. Then the spectrum of quadrupole f-modes and their universal relations are discussed. Finally, the spectrum and universal relations for the dipole F-mode are presented. We give our conclusions in section 4. The Appendix shows the set of the explicit $l=1$ equations (\ref{Appendix_eqs_l1}), and exhibits the Tables with the fit parameters for the universal relations (\ref{Appendix_tables_l2} and \ref{App_dipole}). \section{Theoretical Setting} \subsection{Neutron stars in $R^2$ gravity} We consider the scalar-tensor theory action in the Einstein frame ($G=c=1$) \cite{Yazadjiev:2014cza,Staykov:2014mwa}, \begin{equation} S [g_{\mu\nu},\phi] = \frac{1}{16\pi } \int d^4x \sqrt{-g} \big( R - 2\partial_{\mu}\phi \, \partial^{\mu}\phi - V(\phi) + L_{M}(A^2(\phi)g_{\mu\nu},\chi) \big)~, \label{EinsteinAction} \end{equation} with the Brans-Dicke coupling function \begin{equation} A(\phi)= e^{-\frac{1}{\sqrt{3}}\phi} \end{equation} in the matter action $L_M$, and the potential term \begin{equation} V=\frac{3m_{\phi}^2}{2} \big(1- e^{-\frac{2\phi}{\sqrt{3}}}\big)^2 \ . \label{pots} \end{equation} The Einstein frame action (\ref{EinsteinAction}) is equivalent to the {$R^2$ gravity} action in the Jordan frame \begin{equation} S[g_{\mu\nu}^*] = \frac{1}{16\pi} \int d^4x \sqrt{-g^*} \big( R^* + {a} {R^*}^2 + L_{M} (g_{\mu\nu}^*, \chi) \big) ~. \label{fR} \end{equation} The theory parameter ${a}$ is related to the scalar field mass, \begin{equation} m_{\phi} = \frac{1}{\sqrt{6 {a}}} \ . \end{equation} From the action (\ref{EinsteinAction}), the field equation for the metric $g_{\mu\nu}$ is given by, \begin{equation} G_{\mu\nu} = T^{(S)}_{\mu\nu} + 8 \pi T^{(M)}_{\mu\nu} -\frac{1}{2}V(\phi)g_{\mu\nu} ~, \label{eq_G} \end{equation} with Einstein tensor $G_{\mu\nu} = R_{\mu\nu} - \frac{1}{2}Rg_{\mu\nu}$. The energy-momentum tensor for the scalar field is \begin{equation} T^{(S)}_{\mu\nu}=2\partial_{\mu}\phi\partial_{\nu}\phi - g_{\mu\nu} \partial^{\sigma}\phi\partial_{\sigma}\phi \ , \end{equation} and for the matter, it is \begin{equation} T^{(M)}_{\mu\nu} = (\rho + p)u_{\mu}u_{\nu} + pg_{\mu\nu} ~, \label{T_matter} \end{equation} where the pressure {$p$} and density {$\rho$} in the Einstein frame are related to the {respective physical} Jordan frame quantities $\hat{p}$ and $\hat{\rho}$ via the coupling function $A$, \begin{equation} p = A^4 \hat{p}~, \quad \rho = A^4 \hat{\rho} ~. \label{p_rho_EJ} \end{equation} The dynamical field equation {for the scalar field following} from action (\ref{EinsteinAction}) is \begin{equation} \nabla_{\mu}\nabla^{\mu}\phi = -4\pi\frac{1}{A}\frac{dA}{d\phi} T^{(M)} + \frac{1}{4} \frac{dV}{d\phi} ~. \label{scalar_eom} \end{equation} \subsection{Background ansatz and properties} The metric is {chosen} static and spherically symmetric \begin{equation} ds^2 = g_{\mu\nu}^{(0)} dx^{\mu} dx^{\nu} = -e^{2\nu(r)} dt^2 + e^{2\lambda(r)} dr^2 + r^2 (d\theta^2 + \text{sin}^2 \theta \, d\varphi^2 ) ~, \end{equation} the scalar field, energy density and pressure are then functions of $r$, \begin{eqnarray} \phi=\phi_0(r) ~, \hat{\rho}=\hat{\rho}_0(r) ~, \hat{p}=\hat{p}_0(r) ~, \end{eqnarray} and the four-velocity of the static fluid is given by \begin{eqnarray} u^{(0)}=-e^{\nu}dt ~. \end{eqnarray} The equations for the static functions inside the star are {then given by} \begin{eqnarray} &&\frac{1}{r^2}\frac{d}{dr}\left[r(1- e^{-2\lambda})\right]= 8\pi A_0^4 {\hat{\rho}_0} + e^{-2\lambda}\left(\frac{d\phi_0}{dr}\right)^2 + \frac{1}{2} V_0 ~, \label{eq_lambda} \\ &&\frac{2}{r}e^{-2\lambda} \frac{d\nu}{dr} - \frac{1}{r^2}(1- e^{-2\lambda})= 8\pi A_0^4 \hat{p}_0 + e^{-2\lambda}\left(\frac{d\phi_0}{dr}\right)^2 - \frac{1}{2} V_0 ~, \label{eq_nu} \\ &&\frac{d\hat{p}_0}{dr}= - (\hat{\rho}_0 + \hat{p}_0) \left(\frac{d\nu}{dr} +\frac{1}{A_0}\frac{dA_0}{d\phi_0}\frac{d\phi_0}{dr} \right) ~, \label{eq_pJ} \\ &&\frac{d^2\phi_0}{dr^2} + \left(\frac{d\nu}{dr} - \frac{d\lambda}{dr} + \frac{2}{r} \right)\frac{d\phi_0}{dr}= 4\pi\frac{1}{A_0}\frac{dA_0}{d\phi_0} A_0^4(\hat{\rho}_0-3\hat{p}_0)e^{2\lambda} + \frac{1}{4} \frac{dV_0}{d\phi_0} e^{2\lambda} ~, \label{eq_phi} \end{eqnarray} where $A_0=A(\phi_0)$ and $V_0=V(\phi_0)$. To calculate the moment of inertia at first order in the slow rotation approximation, we introduce the angular velocity of the star $\Omega$ and the inertial dragging $\omega(r)=\Omega-w(r)$ \cite{Hartle:1967he,Sotani:2012eb}, \begin{equation} ds^2 = -e^{2\nu(r)} dt^2 + e^{2\lambda(r)} dr^2 + r^2 (d\theta^2 + \text{sin}^2 \theta \, d\varphi^2 )-2(\Omega-w)r^2 \text{sin}^2 \theta \, dt \, d\varphi ~. \end{equation} The energy density and pressure do not change, but the four-velocity is \begin{eqnarray} u=-e^{\nu}(dt+r^2\sin^2{\theta} \, w \, d\varphi) ~, \end{eqnarray} and the resulting equation for $w$ is \begin{equation} \frac{e^{\nu-\lambda}}{r^4}\frac{d}{dr}\left[ e^{-(\nu+\lambda)}r^4\frac{dw}{dr}\right]= 16\pi A_0^4 {(\hat{\rho}_0+\hat{p}_0)}w \ . \end{equation} The asymptotic behaviour {of the metric and scalar functions is given by} \begin{eqnarray} e^{2\nu}=e^{-2\lambda}\sim 1-2M/r ~, \\ w \sim \frac{2J}{r^3} ~, \\ \phi_0 \sim \frac{1}{r}e^{-m_\phi r} ~, \end{eqnarray} where $M$ is the star mass, and $J$ its angular momentum. {Thus} $I=J/\Omega$ is its moment of inertia. Regularity at the center {of the star requires} \begin{eqnarray} \nu(0) = \nu_c ~, \ \ \lambda(0) = 0 ~, \ \ \phi_0(0) = \phi_c ~, \\ \hat{p}(0)=\hat{p}_c ~, \ \ \hat{\rho}(0)=\hat{\rho}_c ~, \\ w(0) =0 ~. \end{eqnarray} The border of the star is {located at} $r=R$, where $\hat{p}(R)=\hat{\rho}(R)=0$. \subsection{Polar perturbations} Here we focus on polar perturbations {(see e.g. \cite{Regge:1957td,Zerilli:1970se,Thorne:1967a,Price:1969,Thorne:1969rba,Campolattaro:1970,Thorne:1980ru,Detweiler:1985zz,Chandrasekhar:1991fi,Chandrasekhar:1991,Chandrasekhar:1991_,Ipser:1991ind,Kojima:1992ie} for derivation of the appropriate decomposition and ansatz)} and, in particular, on dipolar and quadrupolar perturbations. The zeroth order is given by the static and spherically symmetric background. Introducing the perturbation parameter $\epsilon<<1$, we perturb the background metric, the scalar field and the fluid as follows \begin{eqnarray} g_{\mu\nu} = g_{\mu\nu}^{(0)}(r) + \epsilon h_{\mu\nu}(t,r,\theta,\varphi)~, \\ \label{Phiperturb} \phi = \phi_{0}(r) + \epsilon \delta\phi (t,r,\theta,\varphi)~, \\ \rho = \rho_0 (r) + \epsilon \delta\rho(t,r,\theta,\varphi)~, \\ p = p_0(r) + \epsilon \delta p(t,r,\theta,\varphi)~, \\ u_{\mu} = u^{(0)}_{\mu} (r) + \epsilon \delta u_{\mu} (t,r,\theta,\varphi) ~. \end{eqnarray} The polar metric perturbations can be written as \begin{equation} h_{\mu\nu}^{(\text{polar})} = \sum\limits_{l,m}\,\int \left[ \begin{array}{c c c c} r^l e^{2\nu} H_0 Y_{lm} & -i \omega r^{l+1} H_1 Y_{lm} & 0 & 0 \\ -i \omega r^{l+1} H_1 Y_{lm} & r^l e^{2\lambda} H_2 Y_{lm} & 0 & 0 \\ 0 & 0 & r^{l+2} K Y_{lm} & 0 \\ 0 & 0 & 0 & r^{l+2} \sin^2\theta K Y_{lm} \\ \end{array} \right] e^{-i\omega t} d\omega ~, \end{equation} {where $Y_{lm}$ are the spherical harmonic functions.} The scalar field and fluid perturbations read \begin{equation} \delta \phi = \sum\limits_{l,m}\,\int r^l \phi_1 \, Y_{lm} e^{-i\omega t} d\omega ~, \end{equation} \begin{equation} \delta \rho = \sum\limits_{l,m}\, \int r^l E_{1 } Y_{lm} e^{-i\omega t }d\omega~, \quad \delta p = \sum\limits_{l,m}\, \int r^l \Pi_{1} Y_{lm} e^{-i\omega t} d\omega~, \end{equation} \begin{eqnarray} \delta u_{\mu} = \sum\limits_{l,m}\,\int \left[ \begin{array}{c} \frac{1}{2} r^l e^{\nu} H_0 Y_{lm} \\ r^l i\omega e^{-\nu} \left(e^{\lambda}W/r -r H_1 \right) Y_{lm} \\ -i\omega r^l e^{-\nu} V \partial_{\theta} Y_{lm} \\ -i\omega r^l e^{-\nu} V \partial_{\varphi} Y_{lm} \\ \end{array} \right] e^{-i\omega t} d\omega ~. \end{eqnarray} We have introduced the complex frequency $\omega=\omega_R+i\omega_I$ of the QNMs, {where $\omega_R$ represents the characteristic frequency and $\omega_I$ represents the decay rate of the mode.} Outside the star there is no fluid, meaning $\Pi_1=E_1=0$, so the perturbations simplify considerably. Substituting this ansatz into the field equations, it is possible to reduce the problem to a set of ordinary differential equations. These equations can be found, for the general case, in \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. In this paper we will focus on $l=1$ (dipole) and $l=2$ (quadrupole) perturbations. {The resulting set of equations for $l=1$ is shown in Appendix \ref{Appendix_eqs_l1}.} The procedure to obtain the QNMs is similar to the one followed in \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}: we must impose outgoing-wave conditions as $r\to\infty$, while at the center and at the surface of the star, the perturbation functions must be regular. These translate into a number of conditions that can be imposed numerically (see also \cite{Blazquez-Salcedo:2018pxo} for a description of the general method employed to calculate the modes). \section{Results} In this section we present our results. As discussed above, the field equations have to be supplemented by an equation of state {$\hat{\rho}(\hat{p})$ (usually given in the Jordan frame)}. Here we choose the following set of realistic EOSs: \begin{itemize} \itemsep=-1pt \item Two EOSs containing plain nuclear matter: SLy \cite{Douchin:2001sv} and APR4 \cite{Akmal:1998cf}. \item Two EOSs containing nucleons and hyperons: GNH3 \cite{Glendenning:1984jr}, H4 \cite{Lackey:2005tk}. \item Two EOSs containing hybrid nuclear-quark matter: ALF2 \cite{Alford:2004pf}, WSPHS3 \cite{Weissenborn:2011qu}. \end{itemize} {We also consider} a simple non-relativistic polytropic equation of state $p=\kappa\rho^{5/3}$, with $\kappa = 0.53802 \cdot 10^{10}$ dyn/(g/cm$^3$)$^{5/3}$ used {for dipole F-modes} \cite{Lindblom:1989} {(see Appendix \ref{App_dipole})}. {We perform a detailed QNM analysis for a set of $R^2$ theories with coupling constants $a$ satisfying the observational bound from Gravity Probe B, $a\lesssim 5 \cdot 10^{11}$ m$^2$ \cite{Naf:2010zy}. In terms of the scalar mass this bound translates into $m_\phi \gtrsim 10^{-4}$ neV (see also \cite{Yazadjiev:2014cza}). In particular, we choose for the scalar field mass the values $m_\phi=0.0108$ neV, 0.0343 neV, 0.0766 neV, 0.1084 neV and 0.3428 neV. These values belong to the physically interesting mass range \cite{Naf:2010zy,Ramazanoglu:2016kul,Brito:2017zvb}, and at the same time cover well the full range of QNM values for the fundamental quadrupole mode, ranging basically between the limiting theories, general relativity on the one hand and a massless Brans-Dicke theory on the other hand. As already earlier noted, for $m_\phi=1.08$ neV the fundamental modes approach those of general relativity very closely, whereas $m_\phi = 1$ peV the modes are very close to those of the massless case \cite{Blazquez-Salcedo:2018qyy,Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. } \subsection{Mass, radius and moment of inertia} \begin{figure}[t!] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_R_panel.eps} \includegraphics[width=.32\textwidth, angle =-90]{plot_M_I_panel.eps} \caption{(left) Mass-radius {relation: mass $M$ in solar masses $M_\odot$ versus physical radius $R$ in km.} (right) Moment of inertia-mass {relation: moment of inertia $I$ in units of $M_\odot r_S^2$ (with solar gravitational radius $r_s$). The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:M_I_panel_l1} \end{figure} For reference we include here {some relevant} results on the global properties of neutron stars. In Figure \ref{fig:M_I_panel_l1} (left) we show the mass-radius relation (see also \cite{Blazquez-Salcedo:2018qyy}). In each panel we present a different EOS. Inside each panel, we show in black {the limiting case of} general relativity, in orange $m_\phi=0.343$ neV, in blue $m_\phi=0.108$ neV, in purple $m_\phi=0.034$ neV, and in red the massless limit. The radius $R$ (in km) is the physical radius of the star, i.e., the radius in the Jordan frame. {The mass $M$ (in solar masses $M_\odot$) is independent of the frame. The ratio of mass and radius yields the compactness $C=M/R$ of the star.} Figure \ref{fig:M_I_panel_l1} (right) is an analogous figure for the moment of inertia $I$ as a function of the total mass $M$. The moment of inertia is given in units of $M_\odot r_s^2$, where $r_s=1.47664$ km is the {gravitational radius corresponding to one solar mass} $M_\odot$. Similar results have been obtained before in \cite{Staykov:2014mwa,Staykov:2015mma,Staykov:2016mbt}. With the moment of inertia one can define the radius of gyration, $\hat{R}=\sqrt{I/M}$, and with this the so-called generalized compactness $\eta = M/\hat{R} = \sqrt{M^3/I}$. \subsection{Quadrupole f-mode: spectrum} Here we present our results for the $l = 2$ perturbations. In this case, there are, apart from fluid-led modes and scalar-led modes, also curvature-led modes. {Previous investigation of the scalar-led $\phi$-modes revealed very little dependence of the frequency and the damping time on the mass of the neutron stars \cite{Blazquez-Salcedo:2021exm}.} However, {the scalar-led and the curvature-led modes} are expected to be physically less relevant, since they possess shorter damping times (milliseconds), and they are expected to be more difficult to excite during astrophysical phenomena that produce gravitational waves. % \begin{figure}[h!] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaR_l2_panel.eps} \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaI_l2_panel.eps} \caption{Frequency $\omega_R$ in kHz (left) and damping time $\tau$ in seconds (right) versus neutron star mass $M$ in $M_{\odot}$ for the fundamental quadrupole f-mode. {The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:MR_MI_pcp_panel_l2} \end{figure} Hence, we here focus on the quadrupole f-mode. In Figure \ref{fig:MR_MI_pcp_panel_l2} we show the frequency in kHz (left) and the damping time in seconds (right) for several EOSs (one per panel) and several values of the scalar mass (colored curves). {For comparison, the corresponding f-modes of general relativity (black) are also shown}. For heavier neutron stars, general relativity {leads} typically to the highest frequency values and the {longest} damping times. The effect of the scalar {degree of freedom} is to decrease these values, the lighter the scalar, the more important this effect. For small values of the neutron star mass, a crossing of the frequencies is observed, {such that} for intermediate values of the scalar mass, the frequencies may be slightly larger than the corresponding general relativistic values. \subsection{Universal relations for the quadrupole f-mode}\label{Uni_rel_l2} We now present our results concerning universal relations for the quadrupole f-mode. We have performed our analysis for scalar field masses $m_\phi= 0.0108$ neV, 0.0343 neV, 0.1084 neV and 0.3428 neV and for the limiting case of general relativity including all six EOSs, SLy, APR4, H4, GNH3, ALF2 and WSPHS3. Only for the highest scalar mass of $m_\phi=0.3428$ neV we have not included EOS WSPHS3, since the modes were very close to the modes of general relativity. The fitting procedure has been based on a polynomial of order 4, $f=ax^4+bx^3+ cx^2 + dx + e$. When the fit error in a specific term went up to 100\% or beyond, the particular term has been considered redundant in the fitting procedure and has therefore been discarded. In the following we exhibit a set of figures exploring various possibilities for universal relations for the frequencies $\omega_R$ and damping times $\tau$ of the modes, that involve a variety of properly scaled (in geometric units) dimensionless quantities on both axes. For each fit we also present the corresponding fitting coefficients and errors in tables, {along with the average error of the fits for better comparison among the various relations}. {For a better overview, the tables with the fit parameters for all these universal relations for the f-modes have been collected in Appendix \ref{Appendix_tables_l2}.} We start our discussion with relations that involve only either the frequency $\omega_R$ or the damping time $\tau$, and continue subsequently with relations involving both $\omega_R$ and $\tau$. In Figure \ref{fig:uni_rel_2_mass_omega} we have scaled the frequency $\omega_R$ with the neutron star mass $M$, and exhibit the dimensionless frequency $M\omega_R/c$ versus the compactness $C=M/R$ on the left hand side of the figure in the upper panel. The various symbols indicate the numerical results of the calculations of the modes for their respective EOS. At the same time the colors indicate the respective values of the scalar field mass $m_{\phi}$. The general relativistic limit is shown in black. For each theory, the curve with the respective color represents the corresponding best fit. The lower panel contains the associated fit errors. The right hand side is an analogous figure where the dimensionless frequency $M\omega_R/c$ is now shown versus the generalized compactness $\eta$ together with the fit errors. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_omega.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_mass_omega.pdf} \caption{{f-mode universal relations: dimensionless frequency $M\omega_R/c$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_2_mass_omega} \end{figure} The dimensionless f-mode frequency $M\omega_R/c$ exhibits a rather linear dependence on the compactness $C=M/R$ and (to a slightly lesser degree) on the generalized compactness $\eta$. While a polynomial of degree 4 is used when fitting all results in this section to accommodate a larger class of dependencies between the dimensionless variables, for this particular example, almost all of the fit parameters of the higher-order terms ($a,b,c$) carry an error larger than 50\%, thus hinting at a linear fit. We provide the corresponding values of the fit parameters and errors in Table \ref{rel_fit_MOmegaR_C_l2_lhs} and Table \ref{rel_fit_MOmegaR_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}. As noted already before in general relativity \cite{Lau:2009bu} and evident from Figure \ref{fig:uni_rel_2_mass_omega} also for $R^2$ gravity, the distribution of data points for the f-mode frequency exhibits a smaller fit error, when the generalized compactness $\eta$ is considered instead of the compactness $C$. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_tau.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_mass_tau.pdf} \caption{ {f-mode universal relations: dimensionless inverse damping time $M/(c\tau)$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.}} \label{fig:uni_rel_mass_tau_full} \end{figure} Figure \ref{fig:uni_rel_mass_tau_full} is an analogous figure for the dimensionless inverse damping time $M/(c\tau)$, where the neutron star mass $M$ has also been used to obtain the relevant dimensionless quantity. Again, the figure and also the corresponding tables for the fits, Tables \ref{rel_fit_MOmegaI_l2_lhs} and \ref{rel_fit_MOmegaI_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}, show that the errors in the fit parameters are generally lower when the generalized compactness $\eta$ is employed instead of the compactness $C$. {Comparing Figures \ref{fig:uni_rel_2_mass_omega} and \ref{fig:uni_rel_mass_tau_full} shows that the dimensionless frequency $M\omega_R/c$ provides a better fit than the dimensionless damping time $M/(c \tau)$. However, the dimensionless damping time $M/(c \tau)$ exhibits a larger split between the universal relations for the different scalar masses $m_\phi$.} Such a split is of course needed, if one is to exploit the universal relations to obtain bounds on the theory. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_omega_scale_hat.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_omega_scale.pdf} \caption{{f-mode universal relations: dimensionless frequency $\omega_R/\hat \omega_o$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_omega_omegao} \end{figure} {Significant improvement of the fits is observed when we consider a different type of scaling of the frequency $\omega_R$, as shown in Figure \ref{fig:uni_rel_omega_omegao}. Here we have employed the reference frequency $\hat \omega_o= \sqrt{\frac{3Mc^2}{4\hat{R}^3}}=\frac{c}{M}\sqrt{\frac{3}{4}\eta^3}$ (with $\hat{R}=\sqrt{I/M}$), that involves the generalized compactness. % We exhibit the scaled frequency {$\omega_R/\hat{\omega}_o$} versus both compactness and generalized compactness. While both are rather good, taking compactness instead of generalized compactness is {slightly} better. Also here we observe the desired splitting of the universal relations, as the scalar mass is varied. {For the corresponding tables for the fits, see Table \ref{rel_fit_omega_scale_hat_l2_lhs} and \ref{rel_fit_omega_scale_hat_l2_rhs}.} We have also performed the analysis with the reference frequency $\omega_o= \sqrt{\frac{3Mc^2}{4{R}^3}}=\frac{c}{M}\sqrt{\frac{3}{4}C^3}$, that is analogous but involves compactness \cite{Lindblom:1989}. The corresponding fits fare much worse again, therefore we do not show them here.} { {Apart from that}, the dimensionless frequency $\omega_R/\hat{\omega}_o$ {also} yields a much better universal relation than the dimensionless quantities $R\omega_R/(c\eta)$ {and} $R\omega_R/(c\eta^3)$, {with the latter being the worst of all}. } \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_tau_scale.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_function_tau_eta.pdf} \caption{{f-mode universal relations: dimensionless damping time $\tau \hat \omega_o$ versus generalized compactness $\eta$ (left upper panel) and fit errors (left lower panel); dimensionless function of damping time $\hat{R}I^{1/2}/(cM^{3/2}\tau)$ versus generalized compactness $\eta$ (right upper panel) and fit errors (right lower panel). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_tau_omegao} \end{figure} { Figure \ref{fig:uni_rel_tau_omegao} (left) exhibits the fits for the damping time scaled with $\hat \omega_o$. Here we consider the scaled damping time {$\tau\hat{\omega}_o$} versus the generalized compactness. Table \ref{rel_fit_tau_scale_hat_l2_rhs} shows the corresponding fit parameters. {As opposed to} the scaled frequency, we observe an improvement for the scaled damping time, with the generalized compactness faring slightly better than the compactness. Again, when employing the reference frequency $\omega_o$ we see worse fits, so we neither display them here. We have also investigated the scaled frequency $R\omega_R/(c\eta^3)$ and the scaled damping time $R/( c\eta^3 \tau)$, but the results of the fits were again worse than those above based on scaling with $\hat \omega_o$. Figure \ref{fig:uni_rel_tau_omegao} (right) shows the relations involving the damping time $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ and the generalized compactness, with improved errors, where the fit parameters can be found in Table \ref{rel_fit_tau_scale_hat_l2_lhs}.} { The universal relations with the dimensionless function of the damping time $R^4/ (c M^3 \tau)=R/(c C^3 \tau)$ and the compactness $C$ possess an error bounded by at most 10\%. This fit is worse as the mean errors from the theories are considerably larger than those produced by the relations in Figure \ref{fig:uni_rel_tau_omegao} (right). {It does not improve if one replaces $C$ by $\eta$, i.e. $R/(c\eta^3\tau)$.} However, if one considers $R/(c\eta^3\tau)$ against the generalized compactness, the average error {improves slightly}. {We also tested the universal relation of $R/(c\eta\tau)$ with the compactness $C$ and the generalized compactness $\eta$. The {average} error of these fits is roughly the same as when scaling the damping time with $\hat{\omega}_o$, {although it results in a clearer splitting of the universal relations for different scalar masses}.} We find that the average errors can be even lowered when we consider universal relations utilizing the radius of gyration $\hat{R}$ in a dimensionless function of the real frequency as in $\hat{R}\omega_R I^{1/2}/ (c M^{3/2})$ and the generalized compactness $\eta$, shown in Figure \ref{fig:uni_rel_mass_tau__mass_omega_full} (left). Table \ref{rel_fit_R4_l2_rhs} of Appendix \ref{Appendix_tables_l2} presents the associated fits. They give an average error slightly smaller than their imaginary frequency counterpart in Figure \ref{fig:uni_rel_tau_omegao} (right). \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_function_omega_eta.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_mass_tau__mass_omega.pdf} \caption{ {f-mode universal relations: dimensionless function of real frequency $\hat{R}\omega_R I^{1/2}/ (c M^{3/2})$ versus compactness $\eta=M/\hat{R}$ (left upper panel) and fit errors (left lower panel); dimensionless inverse damping time $M/(c\tau)$ versus dimensionless frequency $M\omega_R/c$ (right upper panel) and fit errors (right lower panel). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_mass_tau__mass_omega_full} \end{figure} } We now consider universal relations containing both the frequency $\omega_R$ and the damping time $\tau$. In Figure \ref{fig:uni_rel_mass_tau__mass_omega_full} (right) we display universal relations where the dimensionless inverse damping time $M/(c\tau)$ is considered as a function of the dimensionless frequency $M\omega_R/c$, and we have scaled with the neutron star mass $M$. The associated fits are presented in Table \ref{rel_fit_tau-OmegaR_l2_lhs} of Appendix \ref{Appendix_tables_l2}. These universal relations turn out to be currently the best fits that involve both $\omega_R$ and $\tau$. \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{uni_rel_omega_tau.pdf} \includegraphics[width=.45\textwidth, angle =0]{uni_rel_eta_omega_tau.pdf} \caption{ {f-mode universal relations: dimensionless product of frequency and damping time $\omega_R\, \tau$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} } \label{fig:uni_rel_omega_tau_full} \end{figure} For comparison we also exhibit universal relations containing the product of the frequency $\omega_R$ and the damping time $\tau$. Figure \ref{fig:uni_rel_omega_tau_full} exhibits this product $\omega_R\, \tau$ versus compactness $C$ (left) and generalized compactness $\eta$ (right). The respective fit parameters are shown in Table \ref{rel_fit_tauOmegaR_l2_lhs} and Table \ref{rel_fit_tauOmegaR_eta_l2_rhs} of Appendix \ref{Appendix_tables_l2}. The quality of the fits is reasonable but represents no improvement, quite to the contrary. {{Other universal relations we tested, such as $M \tau \omega_R^2 /c$ and $R \tau \omega_R^2 /c$ versus $C$ and $\eta$, are not convincing either and we refrain from exhibiting them here.}} { Among the universal relations which contain solely the frequency, the relations of $\omega_R/\hat{\omega}_o$ versus the compactness are the best, while for damping time (e.g. in Figure \ref{fig:uni_rel_mass_tau_full} and Figure \ref{fig:uni_rel_tau_omegao} (left)), the universal relations of $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ and generalized compactness are the best. In the case when both frequency and damping time are involved, $\hat{R} I^{1/2}/ (c M^{3/2} \tau)$ relations are comparable to the relations of $\omega_R\tau$, and the best relations are given by $M/(c\tau)$ and $M\omega_R/c$. } {Concluding we note, that the f-mode can be rather well described in terms of universal relations involving scaling with $\hat \omega_o$, shown in Figure \ref{fig:uni_rel_omega_omegao} and \ref{fig:uni_rel_tau_omegao}, {as is as well evident from their lower average error $\bar{\epsilon}$}. Other relations tested range from reasonable to rather unconvincing. Most of the universal relations reveal a monotonic change with the scalar mass $m_\phi$, smoothly reaching the general relativistic limit for sufficiently large scalar mass. Depending on the accuracy of future observations of the gravitational radiation from neutron stars, the split might suffice to put stronger lower bounds on the coupling constant $a$ and the associated scalar mass $m_\phi$.} \subsection{Dipole F-mode: spectrum}\label{Dipole_spectrum} We now turn to the dipole ($l=1$) perturbations. Analogous to the radial ($l=0$) sector, the dipole perturbations possess fluid-led modes and scalar-led modes. Here we will focus on the fundamental fluid mode, the dipole F-mode. Dipole modes were studied previously for several EOSs in general relativity (see e.g. \cite{Lindblom:1989,Takata:2008}). The most important point here is, however, that dipole modes (like radial modes) do not propagate in general relativity. Therefore the modes are normal modes, that possess real eigenvalues, i.e, only a frequency $\omega_R$, while $\omega_I=0$. Consequently, when the general relativistic modes are smoothly reached in the limit of infinite scalar mass $m_\phi$, the imaginary part of the mode eigenvalue should decrease to zero, making the modes ultra-long lived, as long as $m_\phi$ is finite, and approach the non-propagating modes of general relativity in the limit. \begin{figure}[H] \centering \includegraphics[width=.32\textwidth, angle =-90]{plot_M_omegaR_l1_panel.eps} \caption{ Frequency $\omega_R$ in kHz versus neutron star mass $M$ in $M_{\odot}$ for the fundamental dipole F-mode. {The six panels represent six EOSs, and the colors indicate the values of the scalar field mass $m_{\phi}$, with the general relativistic limit in black.} } \label{fig:M_OmegaR_pcp_panel_l1} \end{figure} In Figure \ref{fig:M_OmegaR_pcp_panel_l1} we show the frequency $\omega_R$ of the dipole F-mode (in kHz) versus the mass $M$ (in $M_\odot$) analogously to the quadrupole f-mode in Figure \ref{fig:MR_MI_pcp_panel_l2}, i.e., the panels correspond to different EOSs, and the colors to different values of the scalar field mass $m_\phi$ with general relativity in black. {The figure contains only the real part of the mode eigenvalue and not the imaginary part, however, since the $\omega_I$ is very small and therefore cannot be extracted with sufficient accuracy. The smallness of $\omega_I$ then translates into the largeness of its inverse $\tau$, making these dipole F-modes ultra-long lived. At the same time, this conforms to the above expectation of approaching the general relativistic limit of non-propagating modes.} {When recalling and comparing with the pattern observed for the radial F-mode in $R^2$ gravity \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm} we see a strong correspondence. The frequencies $\omega_R$ are % almost independent of the neutron star mass, except for the scalar masses closest to general relativity and neutron star masses close to the maximum mass. Moreover, both the radial F-mode and the dipole F-mode are ultra-long lived in the full range of scalar masses studied. A clear difference is, however, their behavior along a family of neutron stars rather close to the maximum neutron star mass. The radial F-mode frequency must decrease to zero, since the radial mode signals the instability of neutron stars beyond the maximum mass. There the eigenvalue of the mode becomes purely imaginary, indicating the instability timescale. Since the dipole F-mode frequency does not decrease to zero towards the maximum mass, this signals that this mode does not carry a further instability.} {When considering the frequency $\omega_R$ as a function of the scalar mass $m_\phi$, the analysis of the radial F-mode revealed, that its scale is set by the size of the neutron star as long as the Compton wavelength {$L_\phi$} corresponding to $m_\phi$ is small with respect to the size. However, when the Compton wavelength is large as compared to the size of the neutron star, it is simply the scalar mass $m_\phi$ itself that sets the scale of the frequency. Moreover, in this case this behavior of the scalar F-mode follows roughly the scalar $\phi$-mode \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. Since the dipole F-mode shows so much similarity to the radial F-mode, a similar pattern may be present also in this respect. While this is supported by our current data, a systematic study of the dependence on the scalar mass $m_\phi$ has not yet been made. } \begin{figure}[H] \centering \includegraphics[width=.45\textwidth, angle =0]{omega_mass_l1_fit_constant.pdf} % \caption{ {F-mode analysis: frequency $\omega_R$ versus mass $M$ (upper panel) and fit errors (lower panel) for a constant fit. % The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ for $m_{\phi}=0.108$ neV, $0.0767$ neV, and $0.0343$ neV.} } \label{fig:analysis_l1} \end{figure} {However, our current study lends additional support to this conjecture that arises from the investigation of the mode for a set of EOSs. Here Figure \ref{fig:M_OmegaR_pcp_panel_l1} shows, that the value of the frequency is not only rather independent of the neutron star mass but also of the employed EOS. An analysis of this independence is shown in Figure \ref{fig:analysis_l1} {for the lower values of the scalar field mass}, where we exhibit the frequency $\omega_R$ versus the neutron star mass $M$ for all EOSs, as if it where a universal relation, with the corresponding constant fit and error analysis. % {The corresponding fit parameters including the errors can be found in Table \ref{rel_fit_analysis_l1_lhs} in Appendix \ref{App_dipole}.} The constant fit yields for $m_{\phi}=0.108$ neV a frequency $\omega_R =3.96$ kHz, for $m_{\phi}=0.0767$ neV: $\omega_R =2.88$ kHz, and for $m_{\phi}=0.0343$ neV: $\omega_R =1.295$ kHz. Note, that the respective values of the frequency would be $\omega_R =4.16$ kHz for $m_{\phi}=0.108$ neV, $\omega_R =2.95$ kHz for $m_{\phi}=0.0767$ neV, and $\omega_R =1.32$ kHz for $m_{\phi}=0.0343$ neV, if we simply employed the formula $2\pi \omega_R=c/L_\phi$ found for the $l=0$ F-mode. Here this behavior is seen up to somewhat higher scalar masses, and is ending when general relativity dominates the behavior of the $l=1$ F-modes. Clearly, for the two lowest scalar masses $m_{\phi}=0.0343$ neV and $0.0767$ neV the constant fit is rather convincing, while the quality declines for $m_{\phi}=0.108$ neV as can be expected towards larger scalar mass. } {The above observation makes in principle a search for universal relations for sufficiently small scalar masses in $R^2$ theory superfluous. It would fully suffice to % measure the frequency $\omega_R$ of the F-mode to determine the scalar field mass and thus the theory. It would be interesting though to investigate, whether other theories involving scalars would exhibit an analogous phenomenon, and if they would, to see whether there would be a way to distinguish among the theories. } \subsection{Universal relations for the ultra-long lived dipole F-modes}\label{Uni_rel_l1} We now look for universal relations for the fluid dipole F-modes, restricting to relations that involve only the frequency $\omega_R$. We begin again with the simple scaling relations involving the mass $M$, and exhibit in Figure \ref{fig:uni_rel_MOmegaR_error_eta_linear_affine} the dimensionless frequency $M\omega_R/c$ versus compactness $C=M/R$ (left) and versus generalized compactness $\eta$ (right) together with the fits and error analysis. The parameters are given in Table \ref{rel_fit_MOmegaR_lhs} for the relation with respect to compactness (left) and for the relation with respect to generalized compactness (right) in Table \ref{rel_fit_MOmegaR_rhs} in Appendix \ref{App_dipole}. \begin{figure}[h!] \centering \includegraphics[width=.45\textwidth, angle =0]{plot_rel_MOmegaR_scaled_w_error_affine_vp.pdf} \includegraphics[width=.45\textwidth, angle =0]{plot_rel_MOmegaR_scaled_w_error_eta_all_truelinear_vp.pdf} \caption{{F-mode universal relations: dimensionless frequency $M\omega_R/c$ (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} % } \label{fig:uni_rel_MOmegaR_error_eta_linear_affine} \end{figure} In both cases the relations are not convincing. While the errors seem to be largest for general relativity and decrease with decreasing scalar mass $m_\phi$, also the values themselves decrease, and therefore the relative error remains large also for the smallest considered scalar mass, as seen in the lower panels of the figures. \begin{figure}[h!] \centering \includegraphics[width=.48\textwidth, angle =0]{uni_rel_omega_scale_l1_wopi.pdf} \includegraphics[width=.48\textwidth, angle =0]{uni_rel_eta_omega_scale_l1_wopi.pdf} \caption{{F-mode universal relations: dimensionless frequency {$\omega_R/\omega_o$} (upper panels) and fit errors (lower panels) versus compactness $C=M/R$ (left panels); versus generalized compactness $\eta$ (right panels). The symbols indicate the respective EOS and the colors the values of the scalar field mass $m_{\phi}$ with the general relativistic limit in black.} % } \label{fig:uni_rel_c_2_l1_error_no_log_linear} \end{figure} {Figure \ref{fig:uni_rel_c_2_l1_error_no_log_linear} illustrates the dimensionless frequency {$\omega_R/\omega_o$} versus the compactness $C=M/R$ (left) and the generalized compactness $\eta$ (right).} The corresponding fit parameters are given in Table \ref{rel_fit_Omegao_MR} and Table \ref{rel_fit_Omegao_rhs}. {In contrast to the f-modes (see Figure \ref{fig:uni_rel_omega_omegao}), the reference frequency $\omega_0$ {in the scaling} provides a small improvement for the F-modes compared to {using} $\hat{\omega}_0$.} {While these fits for the F-mode are by far not as good as for the f-mode, they are so far the best fits we have obtained for the F-mode.} Clearly, when looking for universal relations for the F-mode a significant dependence on the EOS is retained, and the considered universal relations are not as good as for other modes. We also do not see a strong improvement for theories with light scalars as compared to general relativity. {However, as noted in the previous subsection, for sufficiently small scalar masses universal relations for the F-mode may not be needed, since the frequency $\omega_R$ itself is basically independent of the neutron star mass and, in particular, also independent of the EOS. {This is further supported by the much lower average error of the fit $\bar{\epsilon}$ {in Table \ref{rel_fit_analysis_l1_lhs}}.} For larger scalar masses this independence of the EOS (and the neutron star mass) disappears largely, and universal relations would be appreciated just as in the case of general relativity itself, although in the latter case, the modes are non-propagating normal modes.} \section{Conclusions} Universal relations of neutron stars are very important as long as their equation of state is not known. The (approximate) EOS independence of universal relations makes them valuable tools not only for the analysis of the properties of neutron stars in general relativity, but also to put bounds on generalized gravity theories, when their universal relations deviate from those of general relativity. In this paper we have for the first time constructed universal relations for polar quasinormal modes in a generalized theory of gravity, beyond the Cowling approximation. In particular, we have chosen $R^2$ gravity and formulated it in the Einstein frame. This makes the additional degree of freedom explicit in the form of a scalar field coupled to the neutron star matter, where for the scalar field we have chosen masses in the physically allowed range. We have focused our investigations on the fundamental quadrupole f-mode and the dipole F-mode and considered scalar masses in the range $m_\phi=0.0108$ neV to $m_\phi=0.3428$ neV. The lower of these masses lead to distinct effects as compared to general relativity, whereas the highest masses yield for these fluid modes results very close to general relativity. Of course, in general relativity the dipole fluid modes do not propagate, but for the larger scalar masses the F-modes of $R^2$ theory become ultra-long lived, thus approaching the general relativistic limit also with respect to the imaginary part of the mode. To obtain universal relations we have considered six EOSs, covering plain nuclear matter, nucleons and hyperons, and hybrid nuclear-quark matter. We have constructed a variety of dimensionless quantities involving the frequency of the modes $\omega_R$ and the damping time $\tau$, starting with a scaling with the neutron star mass and considering the relations with respect to compactness and generalized compactness. In the latter the radius has been replaced by the gyration radius, that involves the moment of inertia of the neutron star. The best universal relations found for the quadrupole f-mode are obtained from scaling with a reference frequency $\hat \omega_o$, that involves the {{{{generalized}}}} compactness $\eta$, versus the compactness $C$, and leads to fit errors smaller than 1\% for the scaled frequency in these $R^2$ theories as well as a significant splitting between these theories. Future observations of these modes might therefore lead to new constraints on the coupling parameter $a$. The dipole F-mode of these theories shows a very different behavior. For the set of scalar masses considered, the frequency $\omega_R$ of the mode itself is very independent of the particular EOS and of the neutron star model employed. Instead, for a given scalar mass, $\omega_R$ is basically a constant that is determined by the relation $2\pi \omega_R=c/L_\phi$ with Compton wavelength $L_\phi$. Only for the largest masses considered, deviations occur, and the frequencies of general relativity are approached. Therefore, for the smaller masses, the frequency itself $\omega_R$ is universal, and a detection would directly yield the scalar mass. This is very similar to the case of scalar radiation, where we also found this dependency of the frequency on the Compton wavelength \cite{Blazquez-Salcedo:2020ibb,Blazquez-Salcedo:2021exm}. However, there we did not yet show independence of the EOS, as well. Our next tasks will involve the calculation and analysis of further quasinormal modes for a representative set of EOSs. For quadrupole radiation we would like to analyze also the fundamental p mode, the spacetime w-mode and the $\phi$-mode. For dipole radiation we would like to understand better the $\phi$-mode in $R^2$ theory. Another direction will be to not only take the moment of inertia into account for the universal relations, but also the tidal deformability and the quadrupole moment of the neutron stars. Finally, the rapid rotation case will have to be tackled for quasinormal modes in alternative gravities. \section{Acknowledgements} {We would like to gratefully acknowledge support by the DFG Research Training Group 1620 \textit{Models of Gravity}, DFG projects BL1553 and Ku612/18-1, FCT project PTDC/FIS-AST/3041/2020, and the COST Actions CA15117 and CA16104. FSK thanks the Department of Theoretical Physics and IPARCOS of the Complutense University of Madrid for their hospitality. }
\section{Introduction} Many empirical economic analyses involve the process of estimating parameters $\theta$ from a sample of $n$ observations and assessing sampling uncertainty. The typical routine is to first produce a consistent M-estimator $\hat\theta_n$ of the true $\theta^\dagger$ by minimizing the sample objective $Q_n$. Then, standard errors and confidence intervals are computed to perform inferences. Because the sandwich estimator is harder to implement for more complicated models, it is very common to use a bootstrap at that stage. For more computationally intensive nonlinear estimations, it is common to report standard errors based on few bootstrap draws, e.g. 20, 25, or 50.\footnote{71 of all papers published in the American Economic Review between 2012 and 2016 relied on bootstrap inference, 49 of them report bootstrap standard errors. More than one in five of those 49 papers use $100$ bootstrap replications or fewer to compute standard errors. Survey conducted by the author, details available upon request.} The main bottleneck is that each replication requires another estimation on resampled data, which is nontrivial for these complex models. There is a long-standing interest in finding shortcuts to relieve this computational burden without sacrificing too much accuracy. Examples include \citet{Davidson1999}, \citet{Andrews2002}, \citet{Kline2012}, and more recently \citet{Honore2017}. These methods compute standard errors taking a converged estimate $\hat\theta_n$ as given. As such, estimation always precedes inference. This paper proposes to combine resampling with optimization to produce estimates, confidence intervals, and standard errors in a single step. This is very close in spirit to Markov-chain Monte Carlo (MCMC) methods that produce draws from a Bayesian posterior to be used for both estimation and inference. Unlike MCMC, the information matrix equality is not required for valid inference. The main loop of the Algorithm is a stochastic optimization routine which evaluates the objective on batches of resampled data with size $m\leq n$. Starting from an initial guess $\theta_0$, one updates $\theta_b$ to $\theta_{b+1}$, $b\geq 0$, using the resampled gradient and inverse Hessian (or an approximation) as a conditioning matrix, with a fixed learning rate $\gamma$. The Algorithm can also be used with reweighted samples of data. For a suitable choice of $\gamma$ and a strictly convex objective $Q_n$, it is shown that the average over $B$ draws $\theta_b$ is equal to $\hat\theta_n$ up to order $1/\text{min}(m,B)$. Even with $m$ and $B \ll n$, the estimates are consistent and asymptotically normal as long as $m$ and $B \gg \sqrt{n}$. The results also show that the distribution, conditional on the sample, of $\sqrt{m}(\theta_b-\hat\theta_n)$ is first-order equivalent to that of $\sqrt{n}(\hat\theta_n-\theta^\dagger)$, up to scale, and standard errors are consistent. Inference results are valid for a resampled Newton-Raphson (r\textsc{nr}) and a resampled quasi-Newton (rq\textsc{n}) algorithm based on a new quasi-Newton update. For other conditioning matrices, the draws can produce consistent estimates but they need not be valid for inference. The main theoretical insight of the paper is that r\textsc{nr}\, and rq\textsc{n}\, draws are well approximated by a simple AR(1) process when the resampling size $m$ is sufficiently large. The process is centered around the full sample estimate $\hat\theta_n$, and its innovations have variance proportional to the sandwich formula. Hence, after burning-in the first couple of iterations, the distribution of the draws can be used as a bootstrap distribution -- up to a simple adjustment which accounts for the Markov-chain properties of the algorithms. The main results assume the sample and resampled objective functions are smooth and strictly convex. Additional results and illustrations are given in the Supplement for some non-strictly convex settings. In particular, the algorithms can perform well in situations where their non-resampled counterparts are typically challenged and return inconsistent estimates. This is another advantage of combining optimization with resampling. After introducing the algorithms, a small empirical example illustrates the properties of the methods. Then one simulated and two empirical examples illustrate different ways in which they can be applied in empirical work. First, the Monte-Carlo example considers the estimation of a dynamic discrete choice model with heterogeneous agents. Estimates are significantly biased because of non-linearity, resulting in poor inferences due to size distortions. A bootstrap bias correction would be computationally intensive. rq\textsc{n}, combined with a simple split-panel bias-correction technique, produces accurate estimates and valid inferences in reasonable time. Next, using data from \citet{helpman2008}, r\textsc{nr}\, and rq\textsc{n}\, are benchmarked against MCMC and stochastic gradient-descent (s\textsc{gd}) on a large-scale probit. r\textsc{nr}\, and rq\textsc{n}\, converge faster and have better mixing so that fewer draws are needed. Allowing for dependence to compute cluster robust standard errors is straightforward, which is not the case with MCMC. Finally, a more complex model is considered. A replication of \citet{donaldson2018} shows how a computationally intensive grid search used for both estimation and bootstrapping on a 100-core cluster environment can be replaced with r\textsc{nr}, running in less than six hours on a desktop computer. The time saved allows to explore other model specifications. The results also highlight identification issues which are easily diagnosed with r\textsc{nr}. Additional empirical and simulated examples are given in a companion paper \citep{jjng-aerpp:21}. Finally, while the results in this paper are targeted at a class of smooth and convex M-estimation problems, the challenges of non-smooth and non-convex estimation constitute a serious impediment to empirical research. Another companion paper provides algorithms and theoretical results for finite-sample generalized method of moments estimation without assuming smoothness or convexity \citep{Forneron2022}. \paragraph{Outline of the paper.} Section \ref{sec:classical} begins with a review of classical and stochastic optimization. The proposed algorithms are presented in Section \ref{sec:algorithm}, related methods are discussed. A simple analytical and empirical example highlight the theoretical aspects of the paper. Section \ref{sec:rnr1} provides the theoretical results. Section \ref{sec:examples} covers the simulated and empirical examples. Appendices \ref{apx:inter}-\ref{apx:add_ex} provide proofs, sample R codes, and primitive conditions for some of the assumptions. Issues related to non-convexity are covered in Appendix \ref{sec:discussion}. \section{Setting and Overview of Gradient-Based Optimization} \label{sec:classical} Consider minimizing a twice-differentiable and convex sample objective function $Q_n(\theta)$ with respect to parameters $\theta \in \Theta \subset \mathbb{R}^{d_\theta}$: \[ \hat\theta_n = \text{argmin}_{\theta \in \Theta} Q_n(\theta),\quad Q_n(\theta) = \frac{1}{n} \sum_{i=1}^n q(z_i;\theta), \] using a sample of $n$ iid observations $z_i = (y_i,x_i)$. Examples include non-linear least-squares (NLS) for which $q(z_i;\theta) = [y_i - f(x_i;\theta)]^2$ where $f$ is the regression function, known up to the parameters of interest $\theta$. For (pseudo) maximum likelihood estimation (MLE), $q(z_i;\theta) = -\ell(y_i;\theta|x_i)$ is the negative of the log-likelihood. The true value, denoted by $\theta^\dagger$, minimizes the limiting objective $Q = \text{plim}_{n\to \infty} Q_n$. Under the conditions in Theorem 2.1 of \citet{newey-mcfadden-handbook}, $\hat\theta_n$ is consistent for $\theta^\dagger$. If, in addition, the assumptions in Theorem 3.1 of \citet{newey-mcfadden-handbook} hold, then $\hat\theta_n$ is also asymptotically normal: \[\sqrt{n}V_n^{-1/2}(\hat\theta_n-\theta^\dagger)\overset{d}{\to} N(0,I_d), \] where $V_n =[H_n(\hat\theta_n)]^{-1} \Sigma_n [H_n(\hat\theta_n)]^{-1}$ is a consistent estimator of the sandwich variance, $[H_n(\hat\theta_n)]^{-1} \overset{p}{\to} [H(\theta^\dagger)]^{-1}$ approximates the bread, and $\Sigma_n \overset{p}{\to} \lim_{n\to\infty}\text{var}[\sqrt{n}G_n(\theta^\dagger)]$ approximates the meat. Practitionners are often interested in conducting inference for a function of the parameters $h(\theta) \in \mathbb{R}$. Examples include inference on a single coefficient or a counterfactual based on the structural estimates $\hat\theta_n$. When $h$ is continuously differentiable, the delta-method gives the standard error formula $\text{se}[h(\hat\theta_n)] = \sqrt{ \nabla h(\hat\theta_n) V_n \nabla h(\hat\theta_n)^\prime /n}$ and the $95\%$ level confidence interval $h(\hat\theta_n) \pm 1.96 \times \text{se}[h(\hat\theta_n)]$. It is also common to compute confidence intervals from bootstrap draws using quantiles or the standard deviation of $h(\theta_n^{(b)})$, where $\hat\theta_n^{(b)}$ minimizes the resampled objectives $Q_n^{(b)}$. For most problems, the estimator $\hat\theta_n$ does not have closed-form and is usually obtained by numerical optimization. The methods below rely on the sample gradient and Hessian of $Q_n$, defined respectively by: \begin{eqnarray*} G_n(\theta)=\nabla Q_n(\theta) = \frac{1}{n} \sum_{i=1}^n \nabla q(z_i;\theta),\quad H_n(\theta)=\nabla^2 Q_n(\theta) = \frac{1}{n} \sum_{i=1}^n \nabla^2 q(z_i;\theta). \end{eqnarray*} \subsection{Classical Optimizers} \label{sec:classic} When $Q_n$ is quadratic, as in OLS or IV regressions, the solution has closed form and $\hat\theta_n = \theta_0-[H_n(\theta_0)]^{-1} G_n(\theta_0)$, for any initial guess $\theta_0$. For general non-quadratic objectives, the solution does not have closed-form. A typical strategy is to consider a sequence of approximations: \begin{align} Q_n(\theta) \simeq Q_n(\theta_k) + G_n(\theta_k)(\theta-\theta_k) + \frac{1}{2\gamma_k} (\theta-\theta_k)^\prime P_k^{-1} (\theta-\theta_k),\quad k=0,1,2,\dots \label{eq:approx_quad} \end{align} where $P_k$ is a symmetric positive definite conditioning matrix, $\gamma_k \in (0,1]$ is called the learning rate, it penalizes for the quality of the approximation (\ref{eq:approx_quad}). For $\gamma_k=1$ and $P_k^{-1} = H_n(\theta_k)$, the approximation is exact for $Q_n$ quadratic. Otherwise, it coincides with a second-order Taylor expansion around $\theta=\theta_k$, which is not exact. From a guess $\theta_k$, minimizing (\ref{eq:approx_quad}) leads to: \begin{eqnarray} \theta_{k+1} &\equiv &\theta_k-\gamma_k P_k G_n(\theta_k),\quad k=0,1,2,\dots \label{eq:gradient-rule} \end{eqnarray} Different choices of conditioning matrix $P_k$ lead to different algorithms. Newton-Raphson (\textsc{nr}) iterations use $P_k = [H_n(\theta_k)]^{-1}$ and $\gamma_k=1$; a damped update uses $\gamma_k<1$. For strongly convex problems, \textsc{nr}\, enjoys a fast quadratic convergence property, but it comes at the cost of computing both the gradient and the Hessian at each iteration $k$.\footnote{In statistical computing, the convergence of $\theta_k$ to $\hat\theta_n$ is said to be linear if $\|\theta_{k+1}-\hat\theta_n\|/\|\theta_k-\hat\theta_n\|^q<r$ for some $r\in (0,1)$ if $q=1$ and quadratic if $q=2$. Convergence is superlinear if $\lim_{k\rightarrow\infty} \|\theta_{k+1}-\hat\theta_n\|/ \|\theta_k-\hat\theta_n\|=0$. See \citet{boyd-vandenberghe:04} Section 9.3.1 for linear convergence of gradient methods, and \citet[Theorem 3.5]{nocedal-wright:06} for quadratic convergence of Newton's method when $\gamma=1$ or $\gamma_k \to 1$ at an appropriate rate. `Damped Newton' updating with $\gamma_k \in (0,1)$ has a linear convergence rate, see \citet{boyd-vandenberghe:04} Section 9.5.3 and \citet{nesterov2018} Section 1.2.4.} To avoid the cost of computing the $(d_\theta+1)d_\theta/2$ second-order derivatives in $H_n$. Other updates rely on different choices of $P_k$. These include quasi-Newton (q\textsc{n}) and gradient-descent (\textsc{gd}). The most popular quasi-Newton update is \textsc{bfgs} for which $P_k$ approximates $[H_n(\theta_k)]^{-1}$ iteratively using only gradients. Although not as fast as \textsc{nr}, convergence for quasi-Newton with an appropriate choice of $\gamma_k$ can be superlinear.\footnote{See \citet{dennis1977} and \citet[Ch6]{nocedal-wright:06} for an overview of quasi-Newton updates and their properties.} Quasi-Newton methods bypass Hessian computations, but analytical convergence results are more difficult to obtain. The gradient-descent algorithm (\textsc{gd}) sets $P_k=I_d$, it only requires computing a single gradient $G_n(\theta_k)$. Convergence, however, requires choosing $\gamma_k$ small enough that all eigenvalues of $I_d-\gamma_k H_n(\tilde \theta_k)$ lie in the restricted region $(-1,1)$, for some intermediate value $\tilde\theta_k$. This results in very slow convergence when the ratio of the largest to smallest eigenvalue of $H_n$ is large. The necessary conditions for a local minimum are $\|G_n(\hat\theta_n)\|=0$ and $H_n(\hat\theta_n)$ positive semi-definite. The sufficient conditions are $\|G_n(\hat\theta_n)\|=0$ and $H_n(\hat\theta_n)$ positive definite. Note that for non-convex objectives, any $\theta_k$ with $G_n(\theta_k)=0$ is a fixed-point of the update rule (\ref{eq:gradient-rule}). This includes local and global minima and maxima as well as locally suboptimal solutions, called saddle points, for which $H_n$ has both positive and negative eigenvalues. \subsection{Stochastic Optimizers} \label{sec:stochastic} In their seminal paper on stochastic approximation, \citet{Robbins1951} consider the situation where only noisy gradients are available $G_n(\theta_{k})+e_k$ with $e_k$ iid, mean-zero. Using the notation above, they propose the gradient-descent update : $ \theta_{k+1}=\theta_{k}- \gamma_{k} [G(\theta_{k})+e_k]$, and show under regularity conditions that $\theta_k \overset{a.s.}{\to} \hat\theta_n$ when $\gamma_k > 0$ satisfy \begin{equation} \label{eq:monro-robbins-conditions} \text{(i)}\quad \sum_{k=1}^\infty \gamma_k= +\infty, \quad\quad \text{(ii)} \quad\sum_{k=1}^\infty \gamma_k^2<+\infty. \end{equation} The first condition ensures that all possible solutions will be reached with high probability regardless of the $\theta_0$ while the second ensures convergence to the true value. \citet{Kiefer1952Stochastic} extend the results to non-linear least squares with gradients computed by finite-differences. Feasible choices of learning rate schedules include $\gamma_k = \gamma_0 k^{-\delta}$, with $\delta \in (1/2,1]$ and $\gamma_0>0$ as choice parameters. Depending on $\delta$, convergence as measured by $\mathbb{E}(\|\theta_k-\hat\theta_n\|^2)$ can occur at a $1/k$ rate or slower. \citet{ruppert1988efficient} and \citet{polyak1992acceleration} show that the averaged values $\overline{\theta}_k = \frac{1}{k}\sum_{i=1}^k \theta_i$, converge at the fastest $1/k$ rate for all choices of $\delta \in (1/2,1]$. This is commonly refered to as Polyak-Ruppert averaging. Building on these results, modern stochastic gradient-descent updates are given by \begin{eqnarray*} \theta_{k+1}&=&\theta_{k}- \gamma_k G_m(\theta_{k}) \end{eqnarray*} where $G_m(\theta_k)=\frac{1}{m}\sum_{i=1}^m \nabla q(z_i^{(k)},\theta_k)$ is an unbiased estimate of $G_n(\theta_k)$ based on $m<n$ randomly chosen observations $z_1^{(k)},\dots,z_m^{(k)}$ drawn at each $k$. Setting $e_k = G_m(\theta_k) - G_n(\theta_k)$ results in the same setting as stochastic approximation above. Though $m=1$ is computationally inexpensive and is a popular choice, the stochastic gradients $G_m(\theta_k)$ are very noisy and a small $\gamma_k$ satisfying (\ref{eq:monro-robbins-conditions}) is needed to compensate. This results in slow convergence making it well suited for problems where the gradients $G_m$ are very cheap to computed and running very many iterations is feasible. Unfortunately, this is typically not the case for more complicated economic models. A number of methods can accelerate convergence,\footnote{Improvements to s\textsc{gd}\, include momentum \citep{polyak:64} and accelerated gradient-descent \citep{nesterov:83}. As for \textsc{gd}, using $P_k=I_d$ in s\textsc{gd}\, can lead to very slow convergence. Popular extensions of stochastic gradient descent include \textsc{adagrad} \citep{duchi-acm:11}, and \textsc{adam} \citep{kingma2014}.} but they tend to converge slower than \textsc{nr}, or \textsc{bfgs}. More closely related to this paper, some study stochastic \textsc{bfgs}, but compute the full sample $G_n$ many times which is more demanding.\footnote{See e.g. Algorithm 1, step 4, in \citet{pmlr-v51-moritz16}. Note that stochastic Newton-Raphson (s\textsc{nr}), with a small $m =1$, is not used in practice because $H_m^{(k)}$ is often not invertible when $m<d_\theta$.} Beyond reducing the computional cost, stochastic optimization can improve on classical methods in non-convex settings. For instance, suboptimal solutions aren't fixed points for s\textsc{gd}\, \citep{ge2015escaping,jin2017escape}. Though s\textsc{gd}\, requires $\gamma_k \to 0$, it is common to use $\gamma_k = \gamma$ fixed in practice. \citet{dieuleveut-aos:20} consider $Q_n$ quadratic with $\gamma$ and $m$ fixed and find that it leads to estimation bias which needs to be corrected. Few results are available for inference, notably \citet{chen-aos:20} consider the computation of standard errors for s\textsc{gd}. This paper considers $\gamma$ fixed with $Q_n$ non-quadratic but requires $m \to \infty$. For inference, $P_k$ is either a Hessian or the new quasi-Newton update. The connection with bootstrap inference and the AR(1) representation are new. \section{Algorithms and Intuition} \label{sec:algorithm} Because the iterations are used both for estimation and bootstrap inference, they will be indexed by $b=0,1,2,\dots$, rather than $k=0,1,2,\dots$ used for estimation only. The main algorithm below relies on an resampled objective $Q_m^{(b)}$, and its derivatives $G_m^{(b)},H_m^{(b)}$, computed using either $m \leq n$ resampled observations, or using all $m=n$ observations but with random reweighting. Unless otherwise stated, $Q_m^{(b)}$ will refer to either a resampled or reweighted objective. Using these quantities, Algorithm \ref{algo:REI} describes a way to perform both estimation and inference for a function $h$ of $\theta$. \begin{algorithm}[h] \caption{Resampled Estimation and Inference} \label{algo:REI} \begin{algorithmic} \State 1) \textbf{Inputs} (a) an initial guess $\theta_{0}$, (b) a bootstrap sample size $B$ and a burn-in period \textsc{burn}, (c) a batch size $m\leq n$ such that $m/n\rightarrow c \in [0,1]$, and $\sqrt{n}/m\rightarrow 0$, (d) a fixed learning rate $\gamma \in (0,1]$, (e) a resampling or re-weighting scheme. \State 2) \textbf{Burn-in and Resample} \For{$b=0,\dots,\textsc{burn}+B-1$} \State Resample, or re-weight, the data, \Comment{see (\ref{eq:resample}), (\ref{eq:reweight})} \State Update the conditioning matrix $P_b$, \Comment{see Algorithms \ref{algo:rnr} and \ref{algo:rqn}} \State Compute $\theta_{b+1} = \theta_{b} - \gamma P_b G_m^{(b+1)}(\theta_{b}).$ \EndFor \State 3) \textbf{Discard} the first \textsc{burn} draws, re-index $\theta_{\text{burn}+b}$ to $\theta_{b}$ for $b=1,\ldots B$. \State 4) \textbf{Estimation} \begin{itemize} \setlength\itemsep{0em} \item Estimates: $\overline{\theta}_{\textsc{re}}=\frac{1}{B} \sum_{b = 1}^B \theta_{b}$ \end{itemize} \State 5) \textbf{Inference} (r\textsc{nr}\, and rq\textsc{n}) \begin{itemize} \setlength\itemsep{0em} \item Standard errors: $\textsc{se}[h(\hat\theta_n)] = \sqrt{ \frac{m}{n\phi(\gamma)}\frac{1}{B} \sum_{b=1}^B [h(\theta_b)-h(\overline{\theta}_{\textsc{re}})]^2 }$, \item Confidence interval ($1-\alpha$ level): $\Big[c_{h,b}(\alpha/2),c_{h,b}(1-\alpha/2)\Big]$, \end{itemize} where $\phi(\gamma)=\frac{\gamma^2}{1-(1-\gamma)^2}$, $c_{h,b}(\alpha)$ is the $\alpha$-th quantile of $h(\tilde\theta_b)-\overline{h}_B$, $\alpha \in (0,1)$, and $\tilde\theta_b = \overline{\theta}_{\textsc{re}} + \sqrt{\frac{m}{n\phi(\gamma)}}(\theta_b-\overline{\theta}_{\textsc{re}})$. \end{algorithmic} \end{algorithm} Similar to MCMC, after discarding an initial burn-in period, estimates are computed by averaging over draws. Also, standard errors and confidence intervals are computed from the standard deviation and quantiles of the draws but here with an adjustment $\sqrt{\frac{m}{n\phi(\gamma)}}$ which accounts for $m$ potentially smaller than $n$, and $\phi(\gamma)$ adjusts for the Markov-chain properties of $\theta_b$ as explained below. Compared to s\textsc{gd}, Algorithm \ref{algo:REI} requires $m \gg 1$ but allows for $m/n \to 0$ with the restriction that $\sqrt{n}/m \to 0$. This is the cost of using a fixed learning rate $\gamma$ rather than a decaying sequence $\gamma_k$ satisfying (\ref{eq:monro-robbins-conditions}), used in nearly all of the literature. The learning rate $\gamma$ controls the optimization behaviour of the Algorithm, a larger value of $\gamma$ is associated with faster convergence. For quadratic $Q_n$, any $\gamma \in (0,1]$ is feasible, otherwise a smaller $\gamma < 1$ is needed, $\gamma \in [0.1,0.3]$ performs well in the Examples. The parameter $\gamma$ also affects the distributional properties of $\theta_b$ which can be more concentrated around $\hat\theta_n$ than conventional bootstrap draws. For instance, with $m=n$ and $\gamma=0.1$ we have $1/\phi(\gamma) = 19$: the variance of $\theta_b$ is $19$ times smaller than the variance of $\hat\theta_n$.\footnote{$\phi$ is decreasing in $\gamma$: the smaller $\gamma$, the more localized the Markov-chain will be. For comparison $\phi(1)=1$, $\phi(0.4)=4$, $\phi(0.2)=9$, and $\phi(0.01)=199$.} A number of different implementations are possible, a resampled Gradient-Descent (r\textsc{gd}) would use the same $P_b = I_d$ for each iteration $b$. Valid inference, however, requires implementations for which $P_b$ approximates the inverse Hessian sufficiently well. This is the case for the resampled Newton-Raphson and resampled quasi-Newton algorithms. The first is conceptually simple and provides good intuition for the results. For most applications, the second is more computationally efficient and will be preferred. Depending on the choice of resampling or reweighting scheme, $G_m^{(b)},H_m^{(b)}$ will be computed differently. First, the resampled objective, gradient, and Hessian are: \begin{align} &Q_m^{(b)}(\theta) = \frac{1}{m} \sum_{i=1}^m q(z_i^{(b)},\theta), \notag\\ &G_m^{(b)}(\theta) = \frac{1}{m} \sum_{i=1}^m \nabla q(z_i^{(b)},\theta),\quad H_m^{(b)}(\theta) = \frac{1}{m} \sum_{i=1}^m \nabla^2 q(z_i^{(b)},\theta), \label{eq:resample} \end{align} where $z_1^{(b)},\dots,z_m^{(b)}$ are drawn independently with replacement from the empirical data $(z_1,\dots,z_n)$ at each iteration $b$. Unlike s\textsc{gd}, the resampling should match the dependence structure of the data. For instance, clustered data should be resampled at the cluster rather than individual level. Second, the re-weighted objective, gradient, and Hessian are: \begin{align} &Q_n^{(b)}(\theta) = \frac{1}{n} \sum_{i=1}^n w_i^{(b)} q(z_i,\theta),\notag\\ &G^{(b)}_n(\theta) = \frac{1}{n} \sum_{i=1}^n w_i^{(b)} \nabla q(z_i,\theta),\quad H^{(b)}_m(\theta) = \frac{1}{n} \sum_{i=1}^n w_i^{(b)} \nabla^2 q(z_i,\theta), \label{eq:reweight} \end{align} where $w_i^{(b)}$ are iid with mean and variance equal to $1$. Examples include Gaussian weights $w_i^{(b)} \sim \mathcal{N}(1,1)$, exponential $w_i^{(b)} \sim \exp(1)$, or Poisson $w_i^{(b)} \sim \text{Pois}(1)$. This is known as a multiplier, or exchangeably weighted, bootstrap.\footnote{See \citet[Ch3.6.2]{VanderVaart1996} and \citet[Ch10]{kosorok2007}. The Poisson bootstrap approximates, with computational advantages, the standard $n$ out of $n$ bootstrap \citep{chamandy2012}.} Similar to resampling, the weights should vary only between clusters in clustered data, and more generally match the dependence of the data. Depending on the setting, reweighting can be preferred to resampling. For instance, if $\theta$ includes fixed effects, resampling can produce samples with no observation that is informative about one of the fixed effects.\footnote{This is also an issue for censored models where resampling can result in datasets with no censored observations. This also affects s\textsc{gd}; with $m=1$ a gradient is only informative about at one fixed effect at a time. This makes convergence very slow, see Appendix \ref{apx:add_ex2} for an illustration.} \subsection{Resampled Newton-Raphson (r\textsc{nr})} The resampled Newton-Raphson update described in Algorithm \ref{algo:rnr} below can be used within Algorithm \ref{algo:REI} to produce consistent estimates and valid inferences. \begin{algorithm}[h] \caption{Resampled Newton-Raphson (r\textsc{nr})} \label{algo:rnr} \begin{algorithmic} \State Compute $P_b = [H_m^{(b+1)}(\theta_b)]^{-1}$ \end{algorithmic} \end{algorithm} The implementation is very simple, as it only requires computing a Hessian. In many settings, however, repeatedly computing this matrix of second-order derivatives can be very demanding so that a quasi-Newton update is often preferred. Nevertheless, the r\textsc{nr}\, implementation gives a good first intuition about why and how Algorithm \ref{algo:REI} produces estimates and valid inferences. This is illustrated with a simple analytical and a small empirical example below. \paragraph{A pen and pencil example.} The following illustrates the main optimization and bootstrap properties of r\textsc{nr}\, using a tractable OLS regression of $y_i$ on $x_i$: $Q_n(\theta) = \frac{1}{2n} \sum_{i=1}^n (y_i - x_i^\prime \theta)^2$. Using $m$ out of $n$ resampling, we have $G_m^{(b+1)}(\theta) = -\frac{1}{m} \sum_{i=1}^m x_i^{(b+1)} (y_i^{(b+1)} - x_i^{(b+1)\prime} \theta)$, and $H_m^{(b)}(\theta) = \frac{1}{m} \sum_{i=1}^m x_i^{(b+1)} x_i^{(b+1)\prime}$. In more compact notation: $G_m^{(b+1)}(\theta) = - \frac{1}{m} X_m^{(b+1)\prime} ( y_m^{(b+1)} - X_m^{(b+1)}\theta)$, $H_m^{(b+1)}(\theta) = \frac{1}{m} X_m^{(b+1)\prime} X_m^{(b+1)}$. For $b \geq 0$, one r\textsc{nr}\, update takes the form:\footnote{Derivations for r\textsc{nr}\, and other methods are given in Appendix \ref{apx:OLS}.} \[ \theta_{b+1} = \theta_b + \gamma \left( X_m^{(b+1)\prime} X_m^{(b+1)} \right)^{-1} X_m^{(b+1)\prime} ( y_m^{(b+1)} - X_m^{(b+1)}\theta_b). \] Notice that $\left( X_m^{(b+1)\prime} X_m^{(b+1)} \right)^{-1} X_m^{(b+1)\prime} y_m^{(b+1)} = \hat\theta_m^{(b+1)}$ is the bootstrap OLS estimate. Substract $\hat\theta_n$ on both sides and re-arrange terms to find that: \[ \theta_{b+1} -\hat\theta_n = (1-\gamma)(\theta_b-\hat\theta_n) + \gamma ( \hat\theta_m^{(b+1)}-\hat\theta_n) \] is an AR(1) process with conditionally iid innovations based on the centered bootstrap estimates: $\hat\theta_m^{(b)}-\hat\theta_n$. Notice that neither $\hat\theta_n$ nor $\hat\theta_m^{(b)}$ are computed explicitly in the r\textsc{nr}\, update. Using a backwards recursion, we have: \[ \theta_{b+1} -\hat\theta_n = \underbrace{(1-\gamma)^b(\theta_0-\hat\theta_n) \vphantom{\gamma \sum_{j=0}^{b} (1-\gamma)^j ( \hat\theta_m^{(b-j)}-\hat\theta_n)}}_{\text{Starting value bias}} + \underbrace{\gamma \sum_{j=0}^{b} (1-\gamma)^j ( \hat\theta_m^{(b+1-j)}-\hat\theta_n)}_{\text{Resampling noise}} \] Suppose, for simplicity, that under the bootstrap expectation $\mathbb{E}^\star(\hat\theta_m^{(b+1)})=\hat\theta_n$. Then the starting value bias due to $\theta_0 \neq \hat\theta_n$ is \[ \mathbb{E}^\star(\theta_{b+1}-\hat\theta_n) = (1-\gamma)^b(\theta_0-\hat\theta_n),\] which converges exponentially fast to zero. Very quickly, the bias becomes negligible and the average draw consistently estimates $\hat\theta_n$. A seamless transition occurs from optimization to resampling. Using the formula for the variance of an AR(1) process, we have \[ \text{var}^\star ( \theta_{b+1} ) = \gamma^2\frac{1- (1-\gamma)^{b+1}}{1-(1-\gamma)^2} \text{var}^\star(\hat\theta_m^{(b)}) \simeq \phi(\gamma) \text{var}^\star ( \hat\theta_{m}^{(b)} ),\] which also converges exponentially fast. The factor $\phi(\gamma) = \gamma^2/[1-(1-\gamma)^2]$ is used in Algorithm \ref{algo:REI}. Assuming $\text{var}^\star ( \hat\theta_{m}^{(b)} )$ consistently estimates standard errors, then so does r\textsc{nr}\, with the suggested adjustment. The AR(1) representation only holds if $P_b$ approximates the inverse Hessian sufficiently well, this is not the case for \textsc{gd}\, and several quasi-Newton updates. \paragraph{Illustration with real data.} The main results extend the properties described for OLS above to more general non-quadratic strictly convex objectives. The main insight is that even though the AR(1) representation above does not hold exactly, there exists a sequence $\theta_b^\star$, called coupling, which follows an AR(1) process and is uniformly close to the Markov-chain $\theta_b$ up to an error of order $1/m$. A good approximation requires $m \to \infty$ but still allows for $m/n \to 0$. \begin{figure}[ht] \caption{Probit Example: draws for $\theta_{\text{educ}}$} \label{fig:mroz} \centering \includegraphics[scale=0.75]{Mroz.png} \end{figure} To illustrate this feature, Figure \ref{fig:mroz} shows the draws for the coefficient on education for a probit model fitted on data from \citet{mroz:87}. This example uses $\gamma=0.3$ and resamples $m=n/2$ out of $n=753$ observations with replacement. The top left panel shows the first $20$ iterations, which corresponds to the initial convergence phase. The resampled r\textsc{nr}\, (black) and the deterministic \textsc{nr}\, (blue) have very similar paths, moving quickly to the true value (dashed black). Then, the top right panel shows the next $200$ iterations -- the resampling phase. Even with $m<n$, the r\textsc{nr}\, draws (black) are very close to the AR(1) process $\theta_b^\star$ (blue) used to prove the results. The bottom panel illustrates the bootstrap properties of the draws. The left panel compares a $\mathcal{N}(\hat\theta_n,V_n/n)$ with the standard $n$ out of $n$ bootstrap, and r\textsc{nr}\, draws adjusted for $m$ and $\phi(\gamma)$. The distributions are very close. The right panel further confirms this with a more detailed q-q plot view. Replication code for this example is provided in Appendix \ref{apx:Rcode} with a detailed comparison of r\textsc{nr}, rq\textsc{n}, for different choices of $m$, with standard errors computed using the sandwich formula, the standard bootstrap, and methods by \citet{Davidson1999}, \citet{Kline2012}. Additional comparisons with these methods can be found in \citet{jjng-aerpp:21}. \subsection{Resampled quasi-Newton (rq\textsc{n})} In practice, quasi-Newton methods are often preferred to Newton-Raphson because the latter requires computing the full Hessian matrix many times, which can be costly.\footnote{In some settings, it is possible to compute the Hessian `for free' once the gradient is computed; see Example 3, Section \ref{sec:examples} and Appendix \ref{apx:Ex3}.} The main idea behind the quasi-Newton update in Algorithm \ref{algo:rqn} below is that the $d_\theta(d_\theta+1)/2$ unique elements in the Hessian can be recovered using only $d_\theta$ scalar derivatives. Consider the Hessian-vector product $y_b = H_m^{(b+1)}(\theta_b)s_b$, for a direction $s_b \neq 0$. Notice that $y_b = \lim_{\varepsilon \to 0} [G_m^{(b+1)}(\theta_b + \varepsilon s_b)-G_m^{(b+1)}(\theta_b - \varepsilon s_b)]/2\varepsilon$ is a scalar derivative which can be computed without the full matrix $H_m^{(b+1)}(\theta_b)$. The full Hessian matrix can be recovered from Hessian-vector products computed in $d_\theta$ linearly independent directions $s_b,s_{b-1},\dots$ by running a simple linear regression of $y_b$ on $s_b$. Using an overdetermined system with $L > d_\theta$ directions ensures the linear regression is well conditionned. In practice, the different $y_b$ are computed at different values of $\theta_b$ so that the Hessian recovered by least-squares need not be symmetric nor positive definite. A simple transformation is used to enforce these two features, while retaining its approximation properties. The resulting quasi-Newton update is new. The while loop ensures the regression is well-conditionned. It never ran in the examples of Section \ref{sec:examples} but should included as a safeguard. A more detailed discussion of difference with existing updates and the choice of tuning parameters is deferred to Section \ref{sec:corro} \begin{algorithm}[H] \caption{Resampled quasi-Newton (rq\textsc{n})} \label{algo:rqn} \begin{algorithmic} \State 1) \textbf{Inputs} (a) number of secants $L \geq d_\theta$, (b) cutoffs $\lambda_S>0$, $\underline{\lambda}>0$ \State 2) \textbf{Least-Squares Approximation} \If{$b=0$} \Comment{Initialization} \State Set an initial guess $\hat H_0$, e.g. $H_m^{(0)}(\theta_0)$ \State Draw $s_j$, normalize $s_j = s_j/\|s_j\|_2$, $j = 0,\dots,-L+1$ \State Compute $y_j = \hat H_0 s_j$, $j=0\dots,-L+1$ \Else \State Compute $s_b = \theta_b-\theta_{b-1}$, normalize $s_b = s_b/\|s_b\|_2$ \Comment{Update direction} \State Compute $y_b = H_m^{(b+1)}(\theta_b)s_b$ \Comment{Hessian-vector product} \EndIf \State Combine $S_b = (s_b,\dots,s_{b-L+1})^\prime$, $Y_b = (y_b,\dots,y_{b-L+1})^\prime$ \While{ $\lambda_{\text{min}}(S_b^\prime S_b) < \underline{\lambda}_S$ } \State Discard $s_{b-L+1}$, re-index $s_j$ to $s_{j-1}$, $j = b,\dots,b-L+2$ \State Draw $s_b$, normalize $s_b = s_b/\|s_b\|_2$ \State Compute $y_b = H_m^{(b+1)}(\theta_b)s_b$ \State Combine $S_b = (s_b,\dots,s_{b-L+1})^\prime$, $Y_b = (y_b,\dots,y_{b-L+1})^\prime$ \EndWhile \State Compute $\hat H_b = Y_b^\prime S_b (S_b^\prime S_b)^{-1}$ \Comment{Least-Squares Approximation} \State 3) \textbf{Conditioning Matrix} \State Compute $P_b = ( \hat H_b^\prime \hat H_b + \tau_b I_d )^{-1/2}$, where $\tau_b = \underline{\lambda}^2$ if $\lambda_{\text{min}}(\hat H_b^\prime \hat H_b) \leq \underline{\lambda}^2$, $\tau_b = 0$ otherwise \end{algorithmic} \end{algorithm} \subsection{Comparison with other methods} To generate $B$ draws, the standard bootstrap with resampling or reweighting requires solving the minimization problem $\hat\theta_m^{(b)} = \text{argmin}_{\theta \in \Theta} Q_m^{(b)}(\theta)$ $B$ times which can be computationally intensive. Faster alternatives have been proposed in the literature. \citet[\textsc{dmk}]{Davidson1999} consider a $k$-step \textsc{nr}\, update: $\hat\theta_{n,k+1}^{(b)} = \hat\theta_{n,k}^{(b)} - [H_n^{(b)}(\hat\theta_{n,k}^{(b)})]^{-1}G_n^{(b)}(\hat\theta_{n,k}^{(b)})$ starting at the same full sample estimate $\hat\theta_{n,0}^{(b)} = \hat\theta_n$ for all $b$. \citet{Andrews2002} shows that $k=1$ is enough for asymptotically valid inference, and $k>1$ provides asymptotic refinements. \textsc{dmk}\, also propose a $k$-step quasi-Newton update which requires $k>1$ steps.\footnote{Following earlier work by \citet{robinson1988}, the results are based on quadratic and super-linear convergence properties of \textsc{nr}\, and \textsc{bfgs}, respectively, when $\gamma=1$ which holds only if $\|\hat\theta_{n}^{(b)}-\hat\theta_n\|$ is sufficiently small and if (and only if) the quasi-Newton matrix $P_k$ satisfies certain properties \citep[Th3.1]{dennis1977}.} In comparison, using the same $m=n$, a $k=1$-step implementation of \textsc{dmk}\, has the same cost as r\textsc{nr}, but is higher than r\textsc{nr}\, for $k>1$ steps. The $k$-step quasi-Newton update requires $k>1$ making it $k$ times more costly than rq\textsc{n}\, for $m=n$. Using $m<n$ further reduces the cost of both estimation and inference for r\textsc{nr} , rq\textsc{n}. The original idea of \textsc{dmk}\, has been extended to fast subsampling \citep{hong2006}, two-step estimation \citep{Armstrong2014}, and $\ell_1$-penalized estimation \citep{li2021}. Building on \citet{hu1995} and \citet{hu2000}, \citet[\textsc{ks}]{Kline2012} propose a wild score bootstrap which can be written as a one-step \textsc{nr}\, update: $\hat\theta_{n}^{(b)} = \hat\theta_{n} - [H_n(\hat\theta_{n})]^{-1}G_n^{(b)}(\hat\theta_{n})$ where $G_n^{(b)}$ is reweighted using de-meaned weights. If both the estimation and using $m=n$ are not too demanding, this approach is computationally attractive. \citet[Sec6.2]{fastwild:19} point out some caveats with this approach. By only evaluating $G_m^{(b)}$ at $\hat\theta_n$, it does not capture sampling variation in $H_n(\hat\theta_{n})$ or non-linearities in the objective. The latter also applies to \textsc{dmk}\, with $k=1$. By design, r\textsc{nr}\, and rq\textsc{n}\, reflect variation in $H_m^{(b)},G_m^{(b)}$ around $\hat\theta_n$. Notice that if the optimizer returns a suboptimal solution $\tilde\theta_n$, then \textsc{dmk}\, with $k>1$ may not be centered around $\tilde\theta_n$ which is a red flag. By de-meaning the weights, \textsc{ks}\, produces draws centered around $\tilde\theta_n$ so that the issue goes unnoticed.\footnote{Appendix \ref{apx:add_ex}, Table \ref{tab:DDC_het_50}, illustrates failed optimizations for a dynamic discrete choice model, in comparison rq\textsc{n}\, produces accurate estimates. It would be problematic to apply \textsc{dmk}\, or \textsc{ks}\, to the inconsistent estimates.} \citet{Honore2017} propose to approximate the sandwich $V_n$ using $ d_\theta(d_\theta+1)/2 \times B$ scalar minimizations of $Q_n^{(b)}$. When $d_\theta$ increases, this quickly becomes taxing.\footnote{In Section \ref{sec:examples}, Example 2, $55945 \times B$ scalar optimizations would be needed which is quite large.} Using a preliminary estimate $\hat\theta_n$ to resample is the defining characteristic of these methods compared to r\textsc{nr}\, and rq\textsc{n}\, which never compute $\hat\theta_n$ explicitly. For likelihood problems, it is common to use Bayesian inference and deploy the MCMC toolkit. Unlike frequentist estimation, Bayesian analyses rely on sampling from a posterior distribution rather than optimization. Well known samplers include Gibbs and Metropolis-Hastings. Because they can be slow to converge, gradient-based samplers are increasingly popular with Metropolis-adjusted Langevin dynamics (MALA), Hamiltonian Monte-Carlo (HMC), or stochastic gradient Langevin dynamics (SGLD) algorithms. A comparison between r\textsc{nr}, rq\textsc{n}, and MALA is given in Section \ref{sec:examples}. Unlike Bayesian inference, this paper does not require the information matrix equality for valid inference. Convergence diagnostics used for MCMC algorithms such as trace plots or formal tests \citep[][Ch11.4]{gelman1992,Gelman1998,gelman2013} can also be used to monitor convergence of r\textsc{nr}\, and rq\textsc{n}. Lastly, while the detailed balance condition guarantees the posterior is a stationary solution of a Metropolis-Hastings algorithm, convergence rate results typically assume a (nearly) concave log-posterior -- similar to the convexity assumption in this paper.\footnote{Recall that the detailed balance condition ensures that the random walk Metropolis-Hastings algorithm is ergodic but deriving the rate of convergence is more difficult. See e.g. \citet{mengersen1996}, \citet{brooks1998}, \citet{belloni2009}.} \citet{jjng-16} show how optimization can be used to sample from a Bayesian posterior with an intractable likelihood. Here, optimization is used for resampling. \section{Statistical Properties of r\textsc{nr}\, and rq\textsc{n}} \label{sec:rnr1} This section has three parts. The first subsection presents the main assumptions on $Q_n$, $Q_m^{(b)}$, $P_b$, and derives convergence results for classical optimizers and Algorithm \ref{algo:REI} as well as the pivotal coupling result with the AR(1) process $\theta_b^\star$. These results are non-asymptotic. The second subsection focuses on large sample estimation and inference. The theorems can be applied to any implementation of Algorithm \ref{algo:REI} for which $P_b$ has the required properties. The third subsection specializes them to r\textsc{nr}\, and rq\textsc{n}\, described in Algorithms \ref{algo:rnr} and \ref{algo:rqn}. \subsection{Convergence of Classical and Resampled Optimizers} The econometric theory for extremum estimation in e.g. \citet{newey-mcfadden-handbook} takes as a given that an optimizer finds the unique solution. But the econometric assumptions are not enough to ensure a numerical optimizer will provide a globally convergent solution to the sample problem $Q_n(\theta)$. The following is standard in gradient-based optimization theory: \vspace{-0.5cm} \begin{assumption} \label{ass:A1} There exist constants $\underline{\lambda}_H,\overline{\lambda}_H,C_1$ such that for all $\theta \in \Theta$: \vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[i.] $0 < \underline{\lambda}_H \leq \lambda_{\text{min}}(H_n(\theta)) \leq \lambda_{\text{max}}(H_n(\theta)) \leq \overline{\lambda}_H < \infty$ with probability $1$, \item[ii.] $\|H_n(\theta)-H_n(\hat\theta_n)\|_2 \leq C_1\|\theta-\hat\theta_n\|_2$ with probability $1$. \end{itemize} The matrix $P_k$ is symmetric, such that for some $\underline{\lambda}_P,\overline{\lambda}_P$ and all $k \geq 1$: \vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[iii.] $0 < \underline{\lambda}_P \leq \lambda_{\text{min}}(P_k) \leq \lambda_{\text{max}}(P_k) \leq \overline{\lambda}_P < \infty$. \end{itemize} \end{assumption} \noindent Condition i. implies that $Q_n$ is strongly convex with probability $1$ while condition ii. requires Lipschitz continuity of the Hessian.\footnote{A function $Q_n$ is strongly convex on $\Theta$ if for all $\theta\in\Theta$, there exists some $\underline{\lambda}>0$ such that $\nabla^2 Q_n(\theta) \ge \underline{\lambda} I_d$. For bounded $\Theta$, there also exists $\overline{\lambda}$ such that $\nabla^2 Q_n(\theta) \le \overline{\lambda} I_d$. Then $\overline{\lambda}/\underline{\lambda}$ is an upper bound on the condition number of $\nabla^2 Q_n(\theta)$.} Strong convexity of the sample objective function can be less restrictive than it appears as some non-convex problems can be convexified by penalization.\footnote{In some cases, the strict convexity assumption restricts the parameter space to be bounded in the absence of penalization. See e.g. the discussion of Assumption (H3) in \citet{Bach2011}.} Assumption \ref{ass:A1} implies the so-called Polyak-\L{}ojasiewicz inequalities: \begin{align} \label{eq:cvx1} \langle \theta - \hat \theta_n, G_n(\theta) \rangle &= (\theta - \hat \theta_n)^\prime H_n(\tilde \theta_n) (\theta - \hat \theta_n) \geq \underline{\lambda}_{H} \|\theta-\hat\theta_n\|_2^2, \\ \label{eq:cvx2} \| G_n(\theta) \|_2^2 &= (\theta - \hat \theta_n)^\prime H_n(\tilde \theta_n)^2 (\theta - \hat \theta_n) \leq \overline{\lambda}_H^2 \|\theta-\hat\theta_n\|^2_2, \end{align} where $\tilde{\theta}_n$ is an intermediate value, between $\theta$ and $\hat{\theta}_n$. The first inequality follows from the positive definiteness of $H_n(\hat\theta_n)$. To see the usefulness of Assumption \ref{ass:A1}, note that for any symmetric positive definite conditioning matrix $P_k$: \begin{align*} \|\theta_{k+1}-\hat\theta_n\|_2^2 &= \|\theta_{k}-\hat\theta_n - \gamma P_k G_n(\theta_k)\|_2^2 \nonumber\\ &= \|\theta_{k}-\hat\theta_n\|_2^2 - 2 \gamma \langle \theta_{k}-\hat\theta_n, P_k G_n(\theta_k) \rangle + \gamma^2 \| P_k G_n(\theta_k) \|_2^2 \nonumber\\ &\le \underbrace{\left( 1 - 2\gamma \underline{\lambda}_P \underline{\lambda}_H +\gamma^2 [\overline{\lambda}_P \overline{\lambda}_H]^2 \right)}_{=A(\gamma)} \|\theta_{k}-\hat\theta_n\|_2^2, \end{align*} where the last inequality follows from Assumption \ref{ass:A1} and $0<\underline{\lambda}_P \leq \overline{\lambda}_P < \infty$ bound the eigenvalues of $P_k$ (see Assumption \ref{ass:A1} iii). Now a contraction occurs if the choice of $\gamma$ is such that $A(\gamma)\in [0,1)$. To see that this is feasible, note that $A(0)=1$ and $\partial _\gamma A(0)<0$. Thus by continuity and local monotonicity of $A(\cdot)$, there exists a $\gamma^\star \in(0,1]$ such that $A(\gamma)\in[0,1)$ for all $\gamma\in(0,\gamma^\star]$ as desired. For such choice of $\gamma$, define $\overline{\gamma}(\underline \lambda_P,\underline \lambda_H,\overline\lambda_P,\overline\lambda_H) \in (0,1]$ independent of $k$ be such that: $A(\gamma) = (1-\overline{\gamma})^2 \in [0,1)$. It follows that: \begin{align*} \|\theta_{k+1}-\hat\theta_n\|_2 &\leq \sqrt{A(\gamma)}\|\theta_{k}-\hat\theta_n\|_2\\& \leq (1-\overline{\gamma}) \|\theta_{k}-\hat\theta_n\|_2 \nonumber \\ &\leq (1-\overline{\gamma})^{k} \|\theta_{0} - \hat\theta_n\|_2\rightarrow 0,\quad \text{as } k\rightarrow \infty.\qed \end{align*} Global convergence follows from iterating on the contraction at each $k$. The derivations above rely on the positive definiteness of both $H_n$ and $P_k$. A non-definite $P_k$ can be problematic for convergence. While Assumption \ref{ass:A1} i-ii require a smooth and strictly convex objective function, Assumption \ref{ass:A1} iii restricts the choice of conditioning matrix. The finite upper bound in Assumption \ref{ass:A1} iii is particularly important to ensure the optimizer is well behaved. It is automatically satisfied for \textsc{gd}\, since $P_b = I_d$ but requires the lower bound in Assumption \ref{ass:A1} i for \textsc{nr}. For quasi-Newton, it needs to be enforced as in Algorithm \ref{algo:rqn}. Note that for \textsc{nr}, with an adjustement similar to the $\tau_b$ in Algorithm \ref{algo:rqn}, it possible to get convergence even when $H_n$ is singular away from $\hat\theta_n$.\footnote{This is illustrated in Appendix \ref{sec:bad}. Note that modifications to the resampled hessian is also present in \citet{gonccalveswhite2005} when deriving consistency of bootstrap standard errors in OLS regressions.} \begin{lemma} \label{lem:cv_non_stochastic} Under Assumption \ref{ass:A1} i-iii there exists $\gamma \in (0,1]$ such that $A(\gamma)\in [0,1)$. Let $\overline{\gamma}$ be such that $A(\gamma) = (1-\overline{\gamma})^2$. Then $ \|\theta_k - \hat\theta_n\|_2 \leq (1-\overline{\gamma})^k\|\theta_0-\hat\theta_n\|_2 \to 0, \text{ as } k\to\infty. $ \end{lemma} The first Lemma derives the deterministic global convergence of a classical gradient-based optimizer for an appropriate choice of $\gamma$ at a dimension-free linear rate of $(1-\overline{\gamma})$. Convergence of Newton-Raphson with $P_k=H_k^{-1}$ is implied by the Lemma under Assumption \ref{ass:A1} only. This first result is useful for deriving the stochastic convergence of the resampled Algorithm \ref{algo:REI}. In particular, notice that the resampled update is: \[ \theta_{b+1} = \underbrace{ \vphantom{\theta_b - \gamma P_b G_n(\theta_b)} \vphantom{\gamma P_b [ G_n(\theta_b) - G_m^{(b+1)}(\theta_b) ]}\theta_b - \gamma P_b G_m^{(b+1)}(\theta_b)}_{\text{Resampled update}} = \underbrace{ \vphantom{\gamma P_b [ G_n(\theta_b) - G_m^{(b+1)}(\theta_b) ]}\vphantom{\theta_b - \gamma P_b G_m^{(b+1)}(\theta_b)} \theta_b - \gamma P_b G_n(\theta_b)}_{\text{Deterministic update}} + \underbrace{ \vphantom{\theta_b - \gamma P_b G_n(\theta_b)} \vphantom{\theta_b - \gamma P_b G_m^{(b+1)}(\theta_b)} \gamma P_b [ G_n(\theta_b) - G_m^{(b+1)}(\theta_b) ]}_{\text{Resampling noise}}, \] which is the sum of the deterministic update studied in Lemma \ref{lem:cv_non_stochastic} with resampling noise. The convergence has a deterministic and a stochastic component. The deterministic part is covered by Assumption \ref{ass:A1} and the condition on $\gamma$ in Lemma \ref{lem:cv_non_stochastic}. The following assumption will be used to study the stochastic part of the update. \begin{assumption} \label{ass:A2} Let $\mathbb{E}^\star$ denote the expectation under resampling or reweighting, i.e. conditional on $(z_1,\dots,z_n)$. Suppose there exists $\underline{\lambda}_H,\overline{\lambda}_H,C_2,C_3$ such that for $p \geq 2$: \vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[i.] $[\mathbb{E}^\star(\sup_{\theta \in \Theta}\|G_m^{(b)}(\theta)-G_n(\theta)\|^p)]^{1/p} \leq C_2 m^{-1/2}$ and $\mathbb{E}^\star[G_m^{(b)}(\theta)]=G_n(\theta)$, \item[ii.] $[\mathbb{E}^\star(\sup_{\theta \in \Theta}\|H_m^{(b)}(\theta)-H_n(\theta)\|^p)]^{1/p} \leq C_3 m^{-1/2}$, \item[iii.] $0 < \underline{\lambda}_H \leq \lambda_{\text{min}}(H_m^{(b)}(\theta)) \leq \lambda_{\text{max}}(H_m^{(b)}(\theta)) \leq \overline{\lambda}_H < \infty$, with probability $1$. \end{itemize} The conditioning matrix $P_b$ is such that for all $b \geq 1$: \vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[iv.] $0 < \underline{\lambda}_P \leq \lambda_{\text{min}}(P_b) \leq \lambda_{\text{max}}(P_b) \leq \overline{\lambda}_P < \infty$, with probability $1$. \end{itemize} \end{assumption} These high-level conditions will be used to prove convergence of $\theta_{b}$ in $L_p$-norm, $p \geq 2$. Appendix \ref{apx:primA2} provides sufficient conditions for i-ii. using either $m$ out of $n$ resampling with replacement or reweighting with Gaussian multiplier weights.\footnote{Dependence of $C_2,C_3$ on $n$ is omitted to simplify notation. The conditions under Gaussian reweighting are the same for $p=2$ and $p>2$ but not with resampling. The results can be extended to other weighting distributions with the same conditions as resampling by adapting the proof of Theorem 3.6.13 in \citet{VanderVaart1996} similar to \citet[pp18-20]{cheng2015}.} Consistent estimation and valid inference using quantiles in Algorithm \ref{algo:REI} (steps 4 and 5), will require $p=2$ in Assumption \ref{ass:A2}. Consistency of standard errors further requires $p=4$. Consistency of moments for the standard bootstrap is also associated with particular moment conditions, see \citet{gonccalveswhite2005}, \citet{Kato:11}, \citet{cheng2015}. Since the estimator in Algorithm \ref{algo:REI} is computed by averaging draws, the derivations are fundamentally moment-based. Assumption \ref{ass:A2} iv reiterates the importance of the bounds for $P_b$ for convergence but in the stochastic case. Under Assumptions \ref{ass:A1}, \ref{ass:A2}, and the same choice of $\gamma$ used in Lemma \ref{lem:cv_non_stochastic}: \[ \|\theta_{b+1}-\hat\theta_n\|_2 \leq (1-\overline{\gamma})\|\theta_{b}-\hat\theta_n\|_2 + \gamma \overline{\lambda}_P \sup_{\theta \in \Theta} \| G_m^{(b+1)}(\theta)-G_n(\theta) \|_2, \] with probability 1. Iterating the recursion reveals the general behaviour of $\theta_b$: \[ \|\theta_{b+1}-\hat\theta_n\|_2 \leq (1-\overline{\gamma})^b\|\theta_{0}-\hat\theta_n\|_2 + \gamma \overline{\lambda}_P \sum_{j=0}^{b-1} (1-\overline{\gamma})^j\sup_{\theta \in \Theta} \| G_m^{(b+1-j)}(\theta)-G_n(\theta) \|_2, \] with probability 1. The leading term converges deterministically and exponentially fast to zero. It corresponds to a starting values bias. When Assumption \ref{ass:A2} i holds for some $p \geq 2$ and $(1-\overline{\gamma})\in [0,1)$, the second term has bounded $L_p$-norm, of order $1/\sqrt{m}$. This characterizes the stochastic convergence of $\theta_b$ as show in the following Lemma. \begin{lemma} \label{lem:cv_stochastic} Suppose Assumptions \ref{ass:A1}-\ref{ass:A2} hold and $\gamma\in(0,1]$ is such that $(1-\overline{\gamma})^2=A(\gamma)\in[0,1)$, as defined in Lemma \ref{lem:cv_non_stochastic}. Then there exists a constant $C_4$ which only depends on $\gamma,\overline{\lambda}_P,C_3$ such that: \begin{eqnarray*} \left[ \mathbb{E}^\star \left( \|\theta_{b+1}-\hat\theta_n\|_2^p \right) \right]^{1/p} &\le & (1-\overline{\gamma})^{b+1} \bigg[\mathbb{E}^\star(\|\theta_0-\hat\theta_n\|_2^p)\bigg]^{1/p}+\frac{C_4}{\overline{\gamma} \sqrt{m}} . \end{eqnarray*} \end{lemma} Lemma \ref{lem:cv_stochastic} shows that $\theta_b$ converges in $L_p$-norm to a $1/\sqrt{m}$-neighborhood of $\hat\theta_n$. Unlike classical optimizers or s\textsc{gd}\, with $\gamma_k \to 0$ where $\theta_k \to \hat\theta_n$ either deterministically or in probability, here $\theta_{b} \not\to \hat\theta_n$ as $b$ increases -- this is similar to MCMC which produces draws around $\hat\theta_n$. Except for quadratic objectives, the Markov-process followed by $\theta_b$ around $\hat\theta_n$ is intractable. Nevertheless, the following will show that \begin{equation} \theta_{b+1}^\star - \hat \theta_n = \Psi_n(\theta_{b}^\star - \hat\theta_n) - \gamma \overline{P}_m G_m^{(b+1)}(\hat\theta_n), \quad \theta^\star_0 = \theta_0, \label{eq:lin} \end{equation} gives a good approximation of $\theta_b$ and its distribution. The autoregressive coefficient $\Psi_n$ and $\overline{P}_m$ depend on the choice of update $P_b$. Table \ref{tab:thetastar} makes them explicit for r\textsc{gd}, r\textsc{nr}, and rq\textsc{n}. \begin{table}[H] \caption{Coefficients in the linear coupling process $\theta_b^\star$ } \label{tab:thetastar} \centering \begin{tabular}{l|ccc} \hline \hline Algorithm & $P_b$ & $\overline{P}_m$ & $\Psi_n$ \\ \hline Resampled Gradient Descent (r\textsc{gd}) & $I_d$ & $I_d$ & $I_d - \gamma H_n(\hat\theta_n)$ \\ Resampled Newton-Raphson (r\textsc{nr}) & $[H_m^{(b+1)}(\theta_b)]^{-1}$ & $[H_n(\hat\theta_n)]^{-1}$ & $(1-\gamma)I_d$ \\ Resampled quasi-Newton (rq\textsc{n}) & Algorithm (\ref{algo:rqn}) & $[H_n(\hat\theta_n)]^{-1}$ & $(1-\gamma)I_d$ \\ \hline \hline \end{tabular} \end{table} \begin{assumption} \label{ass:A3} Let $d_{0,n} = [ \mathbb{E}^\star(\|\theta_0-\hat\theta_n\|^p_2) ]^{1/p}$, suppose that there exists a matrix $\overline{P}_m$ symmetric positive definite and constants $C_5$, $\rho \in [0,1)$ such that for $\Psi_n = I -\gamma \overline{P}_m H_n(\hat\theta_n)$:\vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[i.] $0 \leq \lambda_{\text{max}}(\Psi_n) < 1$, \item[ii.] $\left[ \mathbb{E}^\star(\|I-P_b[\overline{P}_m]^{-1}\|^p_2) \right]^{1/p} \leq C_5 \left( \rho^b d_{0,n} + 1/\sqrt{m} \right)$. \end{itemize} \end{assumption} In the literature, $\theta_{b}^\star$ is known as a coupling of $\theta_{b}$. The two have different marginal distributions because one follows a linear and the other a non-linear process. Nonetheless, they live on the same probability space because they are generated from the same resampled objective $Q_m^{(b)}$. Hence if we can show that $\|\overline{\theta}_{r\textsc{nr}}-\overline{\theta}_{r\textsc{nr}}^\star\|$ is negligible, we can work with the distribution of $\theta_{b}^\star$ which is more tractable. \begin{proposition} \label{prop:coupling} Suppose that Assumptions \ref{ass:A1}, \ref{ass:A2}, and \ref{ass:A3} hold for $p\geq 2$ and $\gamma \in (0,1]$ is such that Lemma \ref{lem:cv_stochastic} is satisfied. Let $\overline{\rho} = \text{max}[1-\overline{\gamma},\rho,\lambda_{\text{max}}(\Psi_n)]$, and $d_{0,n}=[\mathbb{E}^\star(\|\theta_0-\hat\theta_n\|_2^p)]^{1/p}$. There exists a $C_6$, which depends on $C_1,\dots,C_5,\overline{\rho},\gamma,\overline{\gamma},\overline{\lambda}_H,\overline{\lambda}_P$ such that: \begin{align} \left[\mathbb{E}^\star \bigg(\| \theta_b-\theta^\star_{b}\|_2^{p/2}\bigg)\right]^{2/p}\le C_6 \bigg(\frac{1}{m}+\overline{\rho}^b[d_{0,n}+d_{0,n}^2] \bigg). \label{eq:avg_coupling} \end{align} \end{proposition} The constant $\overline{\gamma} \in (0,1]$ is the global rate of convergence in Lemma \ref{lem:cv_stochastic}. Putting $p=2$, the lemma states that that the expected deviation $\mathbb{E}^\star(\|\theta_{b}-\theta_{b}^\star\|)$ is of order $1/m$ plus a term that vanishes exponentially fast in $b$. This in turn implies that for $p=2$, upon averaging, $\mathbb{E}^\star(\|\overline{\theta}_{\textsc{re}}-\overline{\theta}_{\textsc{re}}^\star\|_2)$ is of order $1/m$ plus a $1/B$ term due to $d_{0,n}$. Using these non-asymptotic bounds, the large sample estimation and inference properties of Algorithm \ref{algo:REI} can be derived. \subsection{Large Sample Estimation and Inference} Proposition \ref{prop:coupling} is pivotal for what follows. Suppose for simplicity that there is no approximation error, i.e. $\theta_b=\theta_b^\star$, then: \[ \mathbb{E}^\star(\theta_b) = \hat\theta_n + [\Psi_n]^b (\theta_0-\hat\theta_n), \] converges to $\hat\theta_n$ exponentially fast under Assumption \ref{ass:A3} i. This implies that r\textsc{gd}, r\textsc{nr}, and rq\textsc{n}\, deliver consistent estimates. This should be of interest for practitionners using s\textsc{gd}\, with $\gamma_k = \gamma$ fixed and Polyak-Ruppert averaging, which is common in practice, since the theory gives restrictions on $m$ for the bias to be negligible. Furthermore, $\theta_b^\star$ being an ergodic first-order vector autoregressive process: \[ m \times \text{var}^\star(\theta_b) \to \gamma^2 \Psi_n \text{var}^\star[\sqrt{m}G_m^{b}(\hat\theta_n)] \Psi_n^\prime , \] converging exponentially fast. It consistently estimates the asymptotic variance, up to scale, when $\text{var}^\star[\sqrt{m}G_m^{b}(\hat\theta_n)]$ consistently estimates the meat and $\Psi_n$ approximates the bread $[H_n(\hat\theta_n)]^{-1}$ (up to scale). This is the case for r\textsc{nr}\, and rq\textsc{n}, but not r\textsc{gd}. Suppose $\sqrt{m}G_m^{b}(\hat\theta_n) \sim \mathcal{N}(0,\Sigma_n)$ then, for large $b$ we approximately have $\theta_b \sim \mathcal{N}(\hat\theta_n,\gamma^2 \Psi_n \Sigma_n \Psi_n^\prime/n)$ which matches the asymptotic distribution, after re-scaling the variance, if $\Psi_n$ approximates the bread (up to scale). The following Theorem gives a non-asympotic bound for the approximation error $\|\overline{\theta}_{\textsc{re}}-\hat\theta_n\|_2$ and the large-sample consistency result. \begin{theorem}[Large Sample Estimation] \label{th:average_estimation} Suppose that $\Sigma_n = \text{var}^\star [\sqrt{m}G_m^{(b)}(\hat\theta_n)]$ is finite and bounded. If the conditions of Proposition \ref{prop:coupling} hold for $p=2$, then $\overline{\theta}_{\textsc{re}}$ satisfies: \begin{itemize} \setlength\itemsep{0em} \item[i.] $ \mathbb{E}^\star\left( \| \overline{\theta}_{\textsc{re}} - \hat\theta_n \|_2 \right) \leq C_7 \left( \frac{1}{m} + \frac{d_{0,n} + d_{0,n}^2}{B} + \frac{1}{\sqrt{mB}} \right)$ where $C_7$ depends on $C_{6}$ and $\text{trace}(\Sigma_n)$. \item[ii.] If $\sqrt{n}/\text{min}(B,m) \to 0$: $\sqrt{n} \left( \overline{\theta}_{\textsc{re}} - \theta^\dagger \right) = \sqrt{n} \left( \hat\theta_n - \theta^\dagger \right) + o_{p^\star}(1).$ \end{itemize} \end{theorem} First-order asymptotic equivalence of $\overline{\theta}_{\textsc{re}}$ and $\hat\theta_n$ requires both $B$ and $m$ to be large relative to $\sqrt{n}$. Using fixed $m$ and $\gamma$ does not produce consistent estimates. This is relevant for s\textsc{gd}\, with $m\ll n$ and $\gamma_k=\gamma$. For inference, consider the standard bootstrap as a benchmark. Let $\overset{d^\star}{\to}$ denote convergence in distribution conditional on $(z_1,\dots,z_n)$. Under regularity conditions, an $n$ out of $n$ bootstrap estimate $\hat \theta_n^{(b)} =\text{argmin}_{\theta \in \Theta} Q_n^{(b)}(\theta)$ is such that \begin{align*} \label{eq:stdboot} \sqrt{n}(\hat \theta_n^{(b)} - \hat\theta_n) =- [H_n(\hat\theta_n)]^{-1} \sqrt{n}G_n^{(b)}(\hat\theta_n)+o^\star_p(1). \end{align*} If $\sqrt{n}G_n^{(b)}(\hat\theta_n)$ satisfies a conditional CLT then the bootstrap distribution targets the correct asymptotic distribution. The bootstrap is often used to compute standard errors. Consistency of moments further requires uniform integrability.\footnote{See \citet[Th16.14]{billingsley2013}. Specifically, to consistently estimate the variance $V_n$, the condition requires $\sup_{n} \mathbb{E}^\star(\|\sqrt{n}(\hat \theta_n^{(b)} - \hat\theta_n)\|^{2+\varepsilon})$ finite for some $\varepsilon >0$. See \citet{gonccalveswhite2005}, \citet{Kato:11}, \citet{cheng2015}, for applications to moment convergence of the bootstrap in OLS regressions and M-estimation.} Here, convergence in distribution of $\theta_b$ comes from Proposition \ref{prop:coupling} and a conditional CLT for $\theta_b^\star$, i.e. the growing sum $\sum_{j=0}^b (1-\gamma)^j [H_n(\hat\theta_n)]^{-1}\sqrt{m}G_m^{(b)}(\hat\theta_n)$. Assumption \ref{ass:A4} is used to ensure that distributional convergence for $\sqrt{m}G_m^{(b)}(\hat\theta_n)$ extends to $\theta_b^\star$. Primitive conditions are given in Appendix \ref{apx:primA4} for $m$ out of $n$ resampling, and reweighting with Gaussian weights. \begin{assumption} \label{ass:A4} Let $V_n = [H_n(\hat\theta_n)]^{-1} \Sigma_n [H_n(\hat\theta_n)]^{-1}$, where $\Sigma_n \ m \times \text{var}^\star [G_m^{(b)}(\hat\theta_n)]$. There exists constants $\beta \in (0,1/2]$, $\kappa > 0$, and a remainder $\|r_m(\tau)\| \leq C_\psi \|\tau\|^\kappa$ such that for $\mathbf{i}^2=-1$, $\mathbb{E}^\star \left( \exp \left[\sqrt{m} \mathbf{i}\tau^\prime (V_n^{-1/2} [H_n(\hat\theta_n)]^{-1}G_m^{(b)}(\hat\theta_n) \right] \right) = \exp \left( - \frac{\|\tau\|_2^2}{2}\right) \times \left( 1+ \frac{r_m(\tau)}{m^{\beta}} \right).$ \end{assumption} \begin{assumption} \label{ass:A5} Suppose the following holds: \vspace{-\topsep} \begin{itemize} \setlength\itemsep{0em} \item[i.] $V_n \overset{p}{\to} V = [H(\theta^\dagger)]^{-1} \Sigma [H(\theta^\dagger)]^{-1}$, $\sqrt{n}(\hat\theta_n-\theta^\dagger) \overset{d}{\to} \mathcal{N}(0,V)$, \item[ii.] $h: \Theta \to \mathbb{R}$ is continuously differentiable, $\nabla h$ is Lipschitz-continous, $\nabla h(\theta^\dagger) \neq 0$. \end{itemize} \end{assumption} Assumption \ref{ass:A5} is standard. It requires asymptotic normality of $\hat\theta_n$, consistency of the sandwich estimator, and validity of the delta method for inference on a function $h$ of $\theta$. Theorem \ref{th:asym_norm} presents the large sample inference. First, the asympotic validity quantile-based confidence intervals. Second, consistency of standard errors computed in Algorithm \ref{algo:REI}. Both results require a choice of $P_b$ satisfying $\overline{P}_m = [H_n(\hat\theta_n)]^{-1}$. \begin{theorem}[Large Sample Inference] \label{th:asym_norm} Suppose that the conditions of Proposition \ref{prop:coupling} hold with $\overline{P}_m = [H_n(\hat\theta_n)]^{-1}$ and $p=2$, that $\Sigma_n$ is bounded and non-singular, and Assumptions \ref{ass:A4}-\ref{ass:A5} hold, then as $m,n,$ and $b\rightarrow\infty$, with $\log(m)/b \to 0$, for any $\alpha \in (0,1)$: \begin{itemize} \setlength\itemsep{0em} \item[i.] $\lim_{n\to\infty} \mathbb{P}_n[ c_{h,b}(\alpha/2) \leq h(\theta^\dagger) - h(\hat\theta_n) \leq c_{h,b}(1-\alpha/2) ] = 1-\alpha$, \end{itemize} where $c_{h,b}(\alpha)$ is the $\alpha$-th quantile of the adjusted draws $h(\tilde \theta_b)$, $\tilde \theta_b = \hat\theta_n + \sqrt{\frac{m}{n\phi(\gamma)}}(\theta_{b} - \hat\theta_n)$. If, in addition, the assumptions hold with $p=4$: \begin{itemize} \setlength\itemsep{0em} \item[ii.] $\frac{m}{\phi(\gamma)} \text{var}^\star [h(\theta_b)] = \nabla h(\hat\theta_n) V_n \nabla h(\hat\theta_n)^\prime + o(1).$ \end{itemize} \end{theorem} \subsection{Implications for r\textsc{nr}\, and rq\textsc{n}} \label{sec:corro} Having the general estimation and inference results for Algorithm \ref{algo:REI}, the following verifies the implementation-specific Assumptions \ref{ass:A2} iv, \ref{ass:A3} to show that Theorems \ref{th:average_estimation}-\ref{th:asym_norm} apply to r\textsc{nr}\, and rq\textsc{n}. For rq\textsc{n}, it is assumed, without loss of generality, that $\underline{\lambda} = \underline{\lambda}_H/2$.\footnote{The proof only relies on $\underline{\lambda} < \lambda{\text{min}}(H_n(\theta))$ around $\hat\theta_n$.} \begin{corollary}[Estimation and Inference with r\textsc{nr}\, and rq\textsc{n}] \label{coro:rnrqn} Consider an implementation of Algorithm \ref{algo:REI} using either r\textsc{nr}\, or rq\textsc{n}, i.e. the choice of $P_b$ described in Algorithms \ref{algo:rnr} and \ref{algo:rqn}. Suppose Assumptions \ref{ass:A1} i-ii and \ref{ass:A2} i-iii hold with $p \geq 2$, then Assumption \ref{ass:A2} iv holds for the same $p$. If the assumptions for Lemma \ref{lem:cv_stochastic} also hold, then Assumption \ref{ass:A3} holds with the same $p$ and $\overline{P}_m = [H_n(\hat\theta_n)]^{-1}$. Then, under the additional assumptions required for each set of results, Theorems \ref{th:average_estimation} and \ref{th:asym_norm} apply to r\textsc{nr}\, and rq\textsc{n}. \end{corollary} Consistency of standard errors implies that they can be used to compute t-statistics, confidence intervals of the form $h(\overline{\theta}_{\textsc{re}}) \pm 1.96 \sqrt{m/[n\phi(\gamma)] \widehat{\text{var}}[h(\theta_b)]}$, where $\widehat{\text{var}}[h(\theta_b)]$ is the sample variance of $h(\theta_b)$, after discarging the first $\textsc{burn} \gg \log(m)$ iterations. A simple rule-of-thumb to gauge the order of magnitude for $\textsc{burn}$ is that $(1-\overline{\gamma}) \geq (1-\gamma)$ and the initial value bias is of order $(1-\overline{\gamma})^b d_{0,n}$. Suppose, we target a bias of order $d_{0,n}/100$, then we need $b > \log(1/100)/\log(1-\overline{\gamma}) \geq \log(1/100)/\log(1-\gamma) \simeq 43$ for $\gamma=0.1$. This implies that the burn-in should include at least $40-50$ draws. A burn-in of $225$ draws corresponds to setting $\overline{\gamma}=0.02$ in the same calculations. The quasi-Newton update proposed in Algorithm \ref{algo:rqn} differs from \textsc{bfgs} and other methods in the literature to ensure the following three properties are satisfied: i) $P_b$ is symmetric, and ii) positive definite with strictly positive eigenvalues, iii) Assumption \ref{ass:A3} holds when $\|\theta_b - \hat\theta_n\|$ is small. Conditions i-ii) are required to ensure optimization is stable and apply Lemma \ref{lem:cv_stochastic}. Condition iii) is needed for valid inference. Other methods do not satisfy i), ii), and iii) simultaneously. Amongst the most widely used methods, \textsc{bfgs} enforces i) and ii) plus the so-called secant equation: $P_b y_{k} = s_k$ so that $P_b H_n(\theta_k)s_{k} = s_k$ always holds but is only guaranteed in this direction so that iii) need not hold for non-quadratic $Q_n$.\footnote{See \citet{ren1983} for counter-examples. The BFGS matrix $P_k$ can have negative eigenvalues when $Q_n$ is non-convex. This is problematic for convergence as illustrated in Section \ref{sec:saddle}.} The \textsc{sr1} update, used with trust-region algorithms, satisfies i) and iii) but not ii) which makes it unstable in estimation using (\ref{eq:gradient-rule}).\footnote{See \citet{fiacco1990}, \citet{Conn1991} for derivations of iii) with SR1.} Both methods update $P_k$ from $P_{k-1}$ using a rank-one update based on the secant equation above. Here $P_b$ is fully updated using OLS, this is related to the multi-secant update in \citet{schnabel:83} which can satisfy iii) but typically not i-ii), and requires $L \leq d_{\theta}$. In the proof of the Corollary, the OLS estimate $\hat H_b$ is shown to satisfy iii) but not necessarily i)-ii). The transformation $\hat H_b^\prime \hat H_b$ enforces i), and the regularization $\tau_b$ enforces ii).\footnote{These two transformations can also be useful for \textsc{nr}\, and r\textsc{nr}\, as illustrated in Section \ref{sec:discussion}.} Algorithm \ref{algo:rqn} requires three inputs. At least $L \geq d_\theta$ secant updates are needed to compute $\hat H_b$ by OLS; $L \geq \text{max}(25,1.5 \times d_\theta)$ works well in the examples. The cutoff $\underline{\lambda}_S$ ensures the least-squares problem is well-conditionned. With $\underline{\lambda}_S=10^{-6}$, the while loop never runs in the applications, but it should be included as a safeguard. The requirement for $\underline{\lambda}$ is to be small enough to satisfy $0<\underline{\lambda} < \lambda_{\text{min}}(H_n)$ around $\hat\theta_n$. \section{Three Examples} \label{sec:examples} The following provides one Monte-Carlo and two empirical examples which illustrate the properties of r\textsc{nr}\, and rq\textsc{n}\, for estimation and inference. \subsection{Example 1: Dynamic Discrete Choice with Unobserved Heterogeneity} \label{sec:DDCh} The first example considers likelihood estimation and inference in a single-agent dynamic discrete choice model with unobserved heterogeneity.\footnote{See e.g. \citet{aguirregabiria2010} and \citet{arcidiacono-ellickson:11} for reviews on the estimation of dynamic discrete choice models.} It is common in this class of models to use a parametric mixture distribution to model heterogeneity since it is parsimonious relative to a more computationally demanding non-linear fixed effect estimation. There are two challenges in this example. First, the likelihood is non-convex because of the unobserved mixture component. Second, the non-linear transformation used to integrate out the unobserved heterogeneity results in finite sample bias and sizable distortion for inference. Analytical bias correction can be challenging to implement, because the terms are not easily tractable. Standard bootstrap bias correction would be computationally intensive. Using a large-T linearization of the bias, it is shown that the split panel jackknife of \citet{dhaene2015} can reduce this bias, and straightforward to use with rq\textsc{n}.\footnote{See Appendix \ref{apx:add_ex} for the derivations under simplifying assumptions.} A comparison of r\textsc{nr}\, and rq\textsc{n}\, with MLE and the standard bootstrap for a simpler homogeneous agents model are given in Appendix \ref{apx:add_ex1}, Table \ref{tab:homDDC}. The setting is similar to the seminar model of \citet{rust:87}, each agent $i$ solves a dynamic programming problem at each period $t$ with a flow utility for the set of actions $a_{it}=0$ or $1$: \[ U_{i0}(x_{it},a_{it-1}) = \varepsilon_{it}(0), \quad U_{i1}(x_{it},a_{it-1}) = \beta_{0i} + \beta_{1i}x_{it} -(1-a_{it-1})\delta_1 + \varepsilon_{it}(1), \] where $\delta_1$ is the entry cost, $\varepsilon_{it}(0)$ and $\varepsilon_{it}(1)$ follow an extreme-value type I distribution, $x_{it}$ is an exogenous regressor which has finite support and follows a first-order Markov process with transition probability $\Pi$. Both $a_{it}$ and $x_{it}$ are observed for $i=1,\dots,n$ and $t=1,\dots,T$. Here the heterogeneity is modeled on the intercept and slope parameters of the utility function. The intercept $\beta_{0i}$ equals $\mu_{0}^1$ with probability $\omega \in [0,1]$, and $\mu_{0}^2$ with probability $1-\omega$. The slope is continuously distributed $\beta_{1i} \sim \omega \mathcal{N}(\mu_1,\sigma_1^2) + (1-\omega)\mathcal{N}(\mu_2,\sigma_2^2)$. The parameters of interest are $\theta=(\mu_0^1,\mu_1^1,\mu_0^2,\mu_1^2,\sigma_1,\sigma_2,\omega,\delta_1)$, the discount factor $\rho=0.98$ is fixed. The matrix $\Pi$ is estimated by sample average and taken as input in the log-likelihood below: \[ \ell_{nT}(\theta,\Pi) = \frac{1}{nT}\sum_{i=1}^n \log \left( \int \exp[\sum_{t=1}^T \ell_{it}(\theta,\Pi,\beta_i)]f(\beta_i|\theta)d\beta_i \right), \] where $\ell_{it}(\theta,\Pi,\beta_i) = \log[\mathbb{P}(a_{it}|x_{it},a_{it-1},\theta,\Pi,\beta_i)]$ is the conditional probability of choice $a_{it} \in \{0,1\}$ computed by solving the dynamic programming problem by fixed point iterations, and $f(\cdot|\theta)$ is the mixture distribution for $\beta_i = (\beta_{0i},\beta_{1i})$. The split panel jacknife is implemented using a full sample implementation of rq\textsc{n}\, $\theta_{b,nT}$ and two half panel implementations $\theta_{b,nT/2}^1,\theta_{b,nT/2}^2$ based on the first and last $T/2$ time-observations each. All three use the same $m=n/2$ out of $n$ resampled observations at each $b$. Bias-corrected draws are given by $\tilde{\theta}_{b,nT}=2\theta_{b,nT}-[\theta_{b,nT/2}^1+\theta_{b,nT/2}^2]/2$. Table \ref{tab:DDC_het} summarizes the results from $400$ Monte Carlo replications. Full panel rq\textsc{n}\, estimates (denoted as rq\textsc{n}) are close to $\theta^\dagger$. Some coefficients have a bias comparable in magnitude to sampling uncertainty. Inference for these coefficient is far from the nominal $5\%$ size using either quantiles or standard errors. The split panel correction (rq\textsc{n}-bc) reduces bias by an order of magnitude and bias-corrected inference is much closer to nominal size. Table \ref{tab:DDC_het_50} provides additional results with $T=50$ and a comparison with R's \textsc{bfgs} optimizer. In that configuration, \textsc{bfgs} estimates are very inaccurate, and far less reliable than rq\textsc{n}. \begin{table}[ht] \caption{Dynamic Discrete Choice Model with Heterogeneity} \label{tab:DDC_het} \centering \begin{tabular}{l|cccccccc} \hline \hline & $\mu_0^1$ & $\mu_1^1$ & $\mu_0^2$ & $\mu_1^2$ & $100 \sigma_1$ & $100 \sigma_2$ & $\omega$ & $\delta_1$ \\ \hline $\theta^\dagger$ & -2.000 & 0.300 & -1.000 & 0.900 & 1.000 & 1.000 & 0.300 & 1.000 \\ \hline & \multicolumn{8}{c}{Average Estimates} \\\hline rq\textsc{n} & -2.033 & 0.307 & -0.982 & 0.903 & 1.015 & 1.154 & 0.302 & 0.976 \\ rq\textsc{n}-bc & -2.019 & 0.307 & -0.991 & 0.896 & 1.006 & 1.046 & 0.302 & 1.001 \\ \hline & \multicolumn{8}{c}{Standard Deviation} \\\hline rq\textsc{n} & 0.044 & 0.013 & 0.020 & 0.009 & 0.127 & 0.181 & 0.012 & 0.018 \\ rq\textsc{n}-bc & 0.043 & 0.013 & 0.021 & 0.011 & 0.146 & 0.155 & 0.013 & 0.019 \\ \hline & \multicolumn{8}{c}{Rejection Rate} \\ \hline rq\textsc{n} & 0.315 & 0.025 & 0.030 & 0.041 & 0.036 & 0.330 & 0.028 & 0.122 \\ rq\textsc{n}-bc & 0.025 & 0.030 & 0.028 & 0.030 & 0.030 & 0.033 & 0.028 & 0.046 \\ rq\textsc{n}-bc$_{se}$ & 0.023 & 0.033 & 0.030 & 0.033 & 0.028 & 0.033 & 0.030 & 0.041 \\ \hline \hline \end{tabular}\\ {\footnotesize Legend: rq\textsc{n}-bc = split panel bias-corrected rq\textsc{n}; rq\textsc{n}, rq\textsc{n}-bc = quantile-based CIs, rq\textsc{n}-bc$_{se}$ = std-error based CIs. $\gamma=0.1,n=1000,T=100,m=n/2, B=2000, \textsc{burn}=250,$ nominal level $=5\%.$} \end{table} \subsection{Example 2: A Probit with Many Regressors} It is common to use MCMC methods for large-scale estimation problems. The second example compares the properties of r\textsc{nr}\, and rq\textsc{n}\, with a Metropolis-Hastings algorithm called MALA (Metropolis-adjusted Langevin Algorithm). The idea is to compare the convergence and mixing properties of the draws when there are hundreds of parameters to estimate.\footnote{A description of and implementation details for MALA are given in the Appendix.} The model is a simple Probit using the data from \citet{helpman2008}. There are 10 regressors plus 324 exporter and importer fixed effects for a total of 334 parameters to be estimated using 248,060 country/year observations. r\textsc{nr}\, and rq\textsc{n}\, are implemented with $\gamma = 0.1$ by re-weighting with Gaussian multiplier weights. Implementation details for the different algorithms are given in the Appendix. While rq\textsc{n}\, accepts all draws by design, MALA only accepts 57\% of them which makes the Markov-chain more persistent as illustrated in Figure \ref{fig:BigProbit} below. The top panel shows the faster convergence r\textsc{nr}\, and rq\textsc{n}. After discarding the initial burn-in, the autocorrelation coefficients are $0.889$ for r\textsc{nr}\, and rq\textsc{n}; $0.995$ for MALA, which indicates better mixing.\footnote{Note that $0.995^{25} \simeq 0.889$ this is why $25$ times more draws are generated for MCMC than rq\textsc{n}.} The bottom panel shows that r\textsc{nr}\, and rq\textsc{n}\, draws are more localized around $\hat\theta_{n}$ than MCMC. Indeed, $\gamma=0.1$ implies $\phi(\gamma)=19$: the variance of $\theta^{rq\textsc{n}}_b$ is 19 times smaller than $\theta^{\text{\textsc{mcmc}}}_b$. Table \ref{tab:BigProbit} in the Appendix further reports estimates and standard errors for the 10 regressors and the intercept. MLE and its standard errors are computed using R's \textit{glm} function and \textit{vcovHC} for robust standard errors. Results for rq\textsc{n}\, are close to MLE for all 11 coefficients. Bayesian posterior standard deviations tend to underestimate. Clustered re-weighting with exponential weights are also reported for comparison, it only requires modifying the line of code generating the weights. In terms of computation, the likelihood, gradient, and hessian are computed in C++ using Rcpp for performance. R's built-in \textit{glm} takes about 2min for estimation using iteratively reweighted least-squares, rq\textsc{n}\, 4min, r\textsc{nr}\, 10min, and MCMC 1h30min. As for most applications of gradient-based optimization on large datasets with many parameters, a good implementation of the code computing the gradient and Hessian is crutial for fast computation: unoptimized code runs is about 2 hours for rq\textsc{n}, and 1.5 days for MCMC. Results for s\textsc{gd}\, and an infeasible implementation of s\textsc{nr}, which relies on the full sample $H_n(\hat\theta_n)$, are reported in the Appendix. Even after 5 million iterations ($>2$ hours), s\textsc{gd}\, is still far from the solution $\hat\theta_n$. \begin{figure}[h] \caption{Probit - Comparison of r\textsc{nr}, rq\textsc{n}\, and \textsc{mcmc}} \label{fig:BigProbit} \includegraphics[scale=0.55]{BigProbit.png}\\ {\footnotesize Legend: Solid line: r\textsc{nr} (black), rq\textsc{n} (blue), and \textsc{mcmc} (black) draws. Dashed line: full sample MLE estimate.} \end{figure} \subsection{Example 3: NLS Estimation of Transportation Costs} The third and final example replicates an estimation in \citet{donaldson2018} of the transportation costs of salt in India between 1861-1930. The model is a simple NLS regression using the log-price of salt of type $o$ at destination $d$ in year $t$: \[ \log(\text{price}_{dt}) = \beta_0 + \delta \log( \text{LCRED}(R_t,\alpha)_{odt} ) + \text{controls} + \varepsilon_{odt}. \] The main regressor $\text{LCRED}(R_t,\alpha)_{odt}$, measures the lowest-cost route effective distance between origin $o$ and destination $d$ in year $t$ given the transportation network $R_t$ and the transportation costs $\alpha = (\alpha_{\text{rail}},\alpha_{\text{road}},\alpha_{\text{river}},\alpha_{\text{coast}})$ for each mode of transportation for the salt products.\footnote{The normalization $\alpha_{\text{rail}}=1$ is used so that all costs are relative to rail.} The regressor $\text{LCRED}(R_t,\alpha)_{odt}$ is not observed directly. For a given value $\alpha$, it is constructed using Dijkstra’s shortest-path algorithm applied to each triplet $o,d,t$ to find the most cost-effective route along the transportation network $R_t$. The parameters of interest are transportation costs $\alpha$, inferred from the regression and the price elasticity $\delta$. This particular example is interesting for two reasons. First, the model is fairly difficult and time-consuming to estimate. \citet{donaldson2018} uses a grid search for both estimation and bootstrap inference in a 100 core cluster environment.\footnote{The estimation relied on a coarse grid $(\alpha_{\text{road}},\alpha_{\text{river}},\alpha_{\text{coast}}) \in [1,10]^3$ with step size $0.125$ for a total of 373248 grid points, and bootstrap inference was conducted using 200 replications on a coarser grid with step size 0.5 totalling in 5832 grid points.} r\textsc{nr}\, runs in less than 6 hours on a desktop computer. Second, the model is potentially unidentified for several values. This is the case if $\delta=0$, or for $\delta \neq 0$ when a transportation mode systematically dominates the others, e.g. if $\alpha_{\text{road}}$ is small and $\alpha_{\text{river}},\alpha_{\text{coast}}$ are large. The specific values for which this occurs depend on the structure of the transportation network $R_t$. A quadratic penalty is added to the objective: $\text{pen}(\theta) = \lambda ( \|\alpha-\overline{\alpha}\|_2^2 + \delta^2)$, with $\lambda = 0.1/n$ and $\overline{\alpha} = (\overline{\alpha}_{\text{road}},\overline{\alpha}_{\text{river}},\overline{\alpha}_{\text{coast}}) = (4.5,3.0,2.25)$ are observed historical relative freight rate estimates reported in \citet[p916]{donaldson2018}. Notice that if e.g. $\alpha_{\text{river}}$ is unidentified, then $\partial_{\alpha_{\text{river}}}Q_m^{(b)}(\theta)=0$ around $\hat\theta_n$ so that only the penalty determines the path of $\alpha_{b,\text{river}}$, and, after convergence, the draws are degenerate $\alpha_{b,\text{river}}=\overline{\alpha}_{\text{river}}$. With a penalty, degeneracy is indicative that the coefficient is unindentified. This is not the case for a Bayesian posterior. \begin{figure}[ht] \caption{Transportations Costs: Estimation and Inference using r\textsc{nr}} \label{fig:Rails} \includegraphics[scale=0.55]{Roads.png}\\ {\footnotesize Legend: Top panel: solid line r\textsc{nr}\, draws for transportation costs $\alpha$ and price elasticity $\delta$. Dashed line: average historical costs $\overline{\alpha}_j$ and \textsc{ols} estimate $\hat\delta_{\textsc{ols}}(\overline{\alpha})$. Bottom panel: distribution after discarding the first $b=75$ iterations, and adjusting for $\phi(\gamma)$. } \end{figure} Figure \ref{fig:Rails} shows the draws and the adjusted r\textsc{nr}\, distribution for $(\alpha,\delta)$. Baseline OLS results evaluated for $\alpha= \overline{\alpha}$ are reported with bootstrap standard errors clustered at the district level -- indexed by $d$. There are also $142$ origin/destination fixed effects, a linear time trend and the intercept, totalling in $147$ parameters to be estimated using 7345 observations.\footnote{\citet{donaldson2018} includes origin/time fixed effects instead of a linear time trend but the design matrix is singular with these controls in the baseline OLS regression. Hence, they are replaced with the linear trend.} r\textsc{nr}\, converges quickly in about 75 iterations. 1000 draws are produced in 5h40m on a desktop computer with 7000 calls to Dijkstra’s algorithm, the main computational bottleneck.\footnote{For reference, a grid search using a small set of 19 equally spaced points for each $\alpha_j$ requires $19^3=6859$ calls to the algorithm.} The bottom panel shows the distribution of the draws after discarding the first 75 iterations, and adjusting for $\phi(\gamma)$. The distributions for coast and road are degenerate, suggesting they are not identified. The results are not sensitive to the choice of $\theta_0$ and $\lambda$. Table \ref{tab:Rails} reports estimates and standard errors with and without fixed effects. The price elasticity is very similar to the one estimated by OLS when fixing $\alpha=\overline{\alpha}$. The estimated coefficient $\alpha_{\text{river}}$ is less than half the historical average $\overline{\alpha}_{\text{river}}$. The null that river transportation is more cost effective than rail, $\alpha_{\text{river}}<1$, cannot be rejected at the 5\% significance level. \begin{table}[H] \caption{Transportations Costs: Estimates and Standard Errors} \label{tab:Rails} \begin{center} \begin{tabular}{l|c|cccc||c|cccc} \hline \hline & \multicolumn{1}{c|}{\textsc{ols}} & \multicolumn{4}{c||}{r\textsc{nr}}& \multicolumn{1}{c|}{\textsc{ols}} & \multicolumn{4}{c}{r\textsc{nr}}\\ \hline & $\delta$ & $\alpha_{\text{river}}$ & $\alpha_{\text{coast}}$ & $\alpha_{\text{road}}$ & $\delta$ & $\delta$ & $\alpha_{\text{river}}$ & $\alpha_{\text{coast}}$ & $\alpha_{\text{road}}$ & $\delta$ \\ \hline Estimates & 0.22 & 1.29 & 2.25 & 4.50 & 0.24 & 0.22 & 1.86 & 2.25 & 4.50 & 0.22 \\ Standard Errors & 0.02 & 0.34 & 0.00 & 0.00 & 0.03 & 0.04 & 0.61 & 0.00 & 0.00 & 0.04\\ \hline Controls? & \multicolumn{5}{c||}{Yes} & \multicolumn{5}{c}{No}\\ \hline \hline \end{tabular}\end{center} {\footnotesize Legend: \textsc{ols}: estimated using $\alpha = \overline{\alpha}$, the observed historical relative freight rate estimates. r\textsc{nr}: $\gamma=0.1$. Both: standard errors computed with Gaussian multiplier reweighting, clustered at the district level. Controls: origin/destination fixed effects.} \end{table} \section{Conclusion} This paper proposes Algorithms that produce estimates, bootstrap confidence intervals and standard errors in a single run. While the theory relies on convexity of the sample and resample objectives, Appendix \ref{sec:discussion} discusses implementation and convergence in some non-convex settings. In Examples 1 and 3, r\textsc{nr}\, and rq\textsc{n}\, perform well without convexity. Extending the Algorithms to handle general non-convex problems would be a useful avenue for future research. \citet{Forneron2022} shows how to modify a local gradient-based algorithm to design a fast globally convergent one without using multiple starts. This could also be very useful for sampling, as considered here. \newpage \baselineskip=12.0pt \bibliographystyle{ecta}
\section{Introduction} \label{chap:introduction} Let $G$ be the complete Euclidean graph on a given set $P$ of $n$ points embedded in the Euclidean plane. A \emph{geometric $t$-spanner} on $P$ is a geometric graph $G':=(P,E)$, a subgraph of $G$ such that for every pair of points $u,v\in P$, the distance between them in $G'$ (the Euclidean length of a shortest path between $u,v$ in $G'$) is at most $t$ times their Euclidean distance $|uv|$, for some $t\geq 1$. It is easy to check that $G$ itself is a $1$-spanner with $\Theta(n^2)$ edges. The quantity $t$ is referred to as the \emph{stretch factor} of $G'$. If there is no need to specify $t$, we simply use the term \emph{geometric spanner} and assume that there exists some $t$ for $G'$. We say that $G'$ is \emph{plane} if it is crossing-free. $G'$ is \emph{degree-$k$} or is said to have \emph{bounded-degree} if its degree is at most $k$. In this work, we experiment with bounded-degree plane geometric spanners. See Figure~\ref{fig: example} for an example of such a spanner. \begin{figure} \begin{center} \includegraphics[scale=0.5]{Demo-RPIS-150.pdf} \hspace{20pt} \includegraphics[scale=0.5]{Demo-RPIS-150-BGHP2010.pdf} \end{center} \caption{Left: A set $P$ of $150$ points, generated randomly within a square. Right: A plane degree-$6$ spanner on $P$ with stretch factor $\approx 1.82$. The pair of points for which the spanner achieves a stretch factor of $\approx 1.82$ is shown in red along with the shortest path between them.} \label{fig: example} \end{figure} Bounded-degree plane geometric spanners have been an area of interest in computational geometry for a long time. Non-crossing edges make them suitable for wireless network applications where edge crossings create communication interference. The absence of crossing edges also makes them useful for the design of road networks to eliminate high-budget flyovers. Such spanners have $O(n)$ edges (at most $3n-6$ edges); as a result, they are less expensive to store and navigate. Further, shortest-path algorithms run quicker on them since they are sparse. Bounded-degree helps in reducing on-site equipment costs. Bose, Gudmundsson, and Smid~\cite{bose2005constructing} were the first to show that there always exists a plane geometric $\sigma(\pi+1)$-spanner of degree at most $27$ on any pointset, where $\sigma$ denotes an upper bound for the stretch factor of $L_2$-Delaunay triangulations\footnote{A triangulation $T$ for a pointset $P$ is referred to as a $L_2$-Delaunay triangulation if no point in $P$ lies inside the circumcircle of any triangle in $T$.} (the current best known value is $\sigma=1.998$ due to Xia~\cite{xia2013stretch}). This result was subsequently improved in a long series of papers~\cite{li2004efficient, bose2009delaunay, kanj2010spanners, bonichon2010plane, bose2012bounded, kanj2012improved, bose2018improved} in terms of degree and/or stretch factor. Bonichon et al.~\cite{bonichon2015there} reduced the degree to $4$ with $t \approx 156.8$. Soon after this, Kanj et al. improved this stretch factor upper bound to $20$ in~\cite{kanj2017degree}. A summary of these results is presented in Table~\ref{tab:summary}. This family of spanner construction algorithms has turned out to be a fascinating application of the Delaunay triangulation. Note that all these algorithms produce bounded-degree plane subgraphs of the complete Euclidean graph on $P$ with constant stretch factors. \begin{table}[htb] \centering \footnotesize \begin{tabular}{|c|c|c|} \hline \textsc{Reference} & \textsc{Degree} & \textsc{Stretch factor} \\ \hline \hline { Bose, Gudmundsson, and Smid}~\cite{bose2005constructing} & $27$ & $\sigma(\pi+1)\approx 8.3$ \\ \hline { Li and Wang}~\cite{li2004efficient} & $23$ & $\sigma(1 + \frac{\pi}{\sqrt{2}})\approx 6.4$ \\ \hline { Bose, Smid, and Xu}~\cite{bose2009delaunay} & $17$ & $\sigma(2+2\sqrt{3}+\frac{3\pi}{2} + 2\pi \sin \frac{\pi}{12}) \approx 23.6$ \\ \hline { Kanj, Perkovi{\'c}, and Xia}~\cite{kanj2010spanners} & $14$ & $\sigma (1 + \frac{2\pi}{14 \cos (\pi/14)})\approx 2.9$ \\ \hline { Kanj and Xia}~\cite{kanj2012improved} & $11$ & $\sigma (\frac{2\sin (2\pi/5)\cos (\pi/5)}{2\sin (2\pi/5)\cos (\pi/5)-1})\approx 5.7$ \\ \hline {Bose, Hill, and Smid}~\cite{bose2018improved} & $8$ & $\sigma \left( 1 + \frac{2\pi}{6 \cos (\pi/6) } \right) \approx 4.4$ \\ \hline {Bose, Carmi, and Chaitman-Yerushalmi}~\cite{bose2012bounded} & $7$ & $\sigma (1 + \sqrt{2})^2 \approx 11.6$ \\ \hline {Bose, Carmi, and Chaitman-Yerushalmi}~\cite{bose2012bounded} & $6$ & $\sigma\left(\frac{1}{1-\tan (\pi/7)(1 + 1/\cos (\pi/14))} \right)\approx 81.7$ \\ \hline {Bonichon, Gavoille, Hanusse, and Perkovi{\'c}}~\cite{bonichon2010plane} & $6$ & $6$ \\ \hline { Bonichon, Kanj, Perkovi{\'c}, and Xia}~\cite{bonichon2015there} & $4$ & $\sqrt{4+2\sqrt{2}}(19+29\sqrt{2})\approx 156.8$ \\ \hline { Kanj, Perkovi{\'c}, and T{\"u}rkoǧlu}~\cite{kanj2017degree} & $4$ & $20$ \\ \hline \end{tabular} \caption{A summary of results on constructions of bounded-degree plane geometric spanners, sorted by the degree they guarantee. The best known upper bound of $\sigma=1.998$ for the stretch factor of the $L_2$-Delaunay triangulation~\cite{xia2013stretch} is used in this table for expressing the stretch factors. } \label{tab:summary} \end{table} The intriguing question that remains to be answered is whether the degree can be reduced to $3$ while keeping $t$ bounded; refer to~\cite[Problem 14]{bose2013plane} and~\cite[Chapter 32]{toth2017handbook}. Interestingly, if one does not insist on constructing a \textit{plane} spanner, Das and Heffernan~\cite{das1996constructing} showed that degree 3 is always achievable. Narasimhan and Smid ~\cite[Section 20.1]{narasimhan2007geometric} show that no degree-2 plane spanner of the infinite integer lattice can have a constant stretch factor. Thus, a minimum degree of 3 is necessary to achieve a constant stretch factor. If $P$ is convex, then it is always possible to construct a degree-3 plane geometric spanners, see~\cite{biniaz2017towards,kanj2017degree,bakhshesh2020degree}. From the other direction, lower bounds on the stretch factors of plane spanners for finite pointsets have been investigated in~\cite{dumitrescu2016lower, dumitrescu2016lattice, klein2015most, mulzer2004minimum}. In-browser visualizations of some of the algorithms (those based on the $L_2$-Delaunay triangulation) have been recently presented in~\cite{anderson2021interactive}. In related works, the construction of plane hop spanners (where the number of hops in shortest paths is of interest) for unit disk graphs has been considered in~\cite{catusse2010planar, biniaz2020plane, dumitrescu2020sparse}. The most notable experimental work for geometric spanners is done by Farshi and Gudmundsson~\cite{farshi2009experimental}. The authors engineered and experimented with some of the well-known geometric spanners construction algorithms published before 2009. However, the authors did not use the algorithms considered in this work in their experiments. Planarity and bounded-degree are important concerns in geometric network design. Hence, we found it motivating to implement the eleven algorithms (refer to Table~\ref{tab:summary}) meant to construct bounded-degree plane geometric spanners. Asymptotic runtimes and various theoretical bounds do not always do justice in explaining the real-world performance of algorithms, especially in computational geometry, because of heavy floating-point operations needed for various geometric calculations. Experiments reveal their real-world performance. A unique aspect of the family of bounded-degree plane spanner construction algorithms is that users cannot specify an arbitrary value of $t$ and/or degree for spanner construction. It is a deviation from many standard spanner algorithms; see~\cite{narasimhan2007geometric,bose2012bounded} for a review of such algorithms. This makes experiments with them even more interesting. \textbf{Our contributions.} (i) We experimentally compare the aforementioned eleven bounded-degree plane spanner construction algorithms by implementing them carefully in \textsf{C}\texttt{++} using the popular \textsf{CGAL} library~\cite{cgal:eb-21b} and running them on large synthetic and real-world pointsets. The largest pointset contains $1.9$ million points approximately. For broader uses of these sophisticated algorithms, we share the \textsf{C}\texttt{++} implementations via \textsf{GitHub}\footnote{\url{https://github.com/ghoshanirban/BoundedDegreePlaneSpannersCppCode}}. The comparisons are performed based on their runtimes and degree, stretch factor, and lightness of the generated spanners. We present a brief overview of the algorithms implemented and our experimental results in Sections~\ref{chap:algorithms} and \ref{chap:experiments}, respectively.\\ (ii) In doing experiments with spanners, we find that stretch factor measurement turns out to be a severe bottleneck when $n$ is large. To address this, we have designed a new fast algorithm named \textsc{AppxStretchFactor} that can estimate the stretch factor of a given spanner (not necessarily plane). In our experiments, we find that it can estimate stretch factors with high accuracy for the class of geometric spanners dealt with in this work. It is considerably faster than the naive Dijkstra-based exact stretch factor measurement algorithm in practice. To our knowledge, no such practical algorithm exists in the literature. Further, it can be easily parallelized, making it very useful for estimating stretch factors of large spanners. See Section~\ref{chap:stretchfactor} for a description of this algorithm. \section{Algorithms implemented} \label{chap:algorithms} Every algorithm designed to date for constructing bounded-degree plane geometric spanners relies on some variant of Delaunay triangulation. The rationale behind this is that such triangulations are geometric spanners~\cite{xia2013stretch, chew1989there, chew1986there, bonichon2012stretch} and are plane by definition. As a result, the family of plane spanner construction algorithms considered in this work has turned out to be a fascinating application of Delaunay triangulation. It is essential to know that Delaunay triangulations have unbounded degrees and cannot be used as bounded-degree plane spanners. In this section, we provide a brief description for each of the eleven algorithms considered in this work. Appropriate abbreviations using the authors’ names and dates of publication are used for naming purposes. Since most of these algorithms are involved, so we urge the reader to refer to the original papers for a deeper understanding and correctness proofs. For visualizing some of these algorithms, we recommend the interactive in-browser applet\footnote{\url{https://ghoshanirban.github.io/bounded-degree-plane-spanners/index.html}} developed by us; refer to~\cite{anderson2021interactive}. To observe variations in spanner construction between the algorithms see Appendix~\ref{chap:samples}. In these algorithms, the surrounding of every input point is frequently divided into multiple cones (depending on the algorithm) for carefully selecting edges from the Delaunay triangulation used as the starting point. In our pseudocodes, the cone $i$ of point $u$, considered clockwise, is denoted by $C_i^u$. A triangulation $T$ of a pointset $P$ is said to be a $L_2$-Delaunay triangulation of $P$ if no point in $P$ lies inside the circumcircle of any triangle in $T$. Eight of the eleven algorithms use $L_2$-Delaunay triangulation as the starting point. The remaining three use $L_\infty$ or $TD$-Delaunay triangulations, as described later in this section. In the following, $n$ denotes the size of the input pointset. \vspace*{-5pt} \begin{itemize}[leftmargin=*]\itemsep0pt \item \texttt{BGS05}: \textbf{Bose, Gudmundsson, and Smid}~\cite{bose2005constructing}. This was the first algorithm that can construct bounded-degree plane spanners using the classic $L_2$-Delaunay triangulation. First, a Delaunay triangulation $DT$ of $P$ is constructed. Next, a degree-$3$ spanning subgraph $SG$ of $DT$ is computed that contains the convex hull of $P$ and is a (possibly degenerate) simple polygon with $P$ as its vertex set. The polygon is then transformed into a simple non-degenerate polygon $Q$. The vertices of $Q$ are processed in an order that is obtained from a breadth-first order of $DT$,  and then Delaunay edges are carefully added to $Q$.  The resulting graph denoted $G'$, is a plane spanner for the vertices of $Q$. Refer to Algorithm~\ref{code:BSG2005} for a pseudocode of this algorithm. The authors show that their algorithm generates degree-$27$ plane spanners with a stretch factor of $1.998(\pi+1) \approx 8.3$ and runs in $O(n\log n)$ time. \vspace{-5pt} \begin{algorithm2e} {\small \SetAlgoLined Allocate $\Phi[1,\ldots,n]$\; Make a copy of $DT$ and call it $H$\; Let \texttt{reserved} be a set of two consecutive vertices $v_1,v_2$ on the convex hull of $H$\; $\Phi_1 \gets v_1, \Phi_2 \gets v_2$\; \For{$i=1$ \KwTo $n-2$}{ Let $u$ be a vertex of the outer face of $H \setminus \texttt{reserved}$ that is adjacent to at most two other vertices on the outer face\; $\Phi_{u} \gets n-i+1$\; Remove $u$ and all incident edges from $H$\; } \Return $\Phi$\;} \caption{{\small \texttt{CanonicalOrdering}($DT$)}} \label{CanonicalOrdering} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $\Phi[1,\ldots,n] \gets \texttt{CanonicalOrdering}(DT)$ (Algorithm~\ref{CanonicalOrdering})\; $SG \leftarrow \emptyset$\; Add edges between $v_1, v_2, v_3 \in \Phi$ to $SG$ and mark the vertices as \texttt{done}\; \For{$v_i \in \Phi\setminus \{v_1,v_2,v_3\}$ }{ Let $u_1, ..., u_k$ be the vertices neighboring $v_i$ in $DT$ marked as \texttt{done}\; Remove edge $\{u_1,u_2\}$ from $SG$\; Add edges $\{v_i, u_1\}$ and $\{v_i, u_2\}$ to $SG$\; \If{$k>2$}{ Remove edge $\{u_{k-1}, u_k\}$ from $SG$\; Add edge $\{v_i, u_k\}$ to $SG$\; } } \Return $SG$\;} \caption{{\small \texttt{SpanningGraph}($DT$})} \label{SpanningGraph} \end{algorithm2e} \vspace{-9pt} \begin{algorithm2e} {\small \SetAlgoLined $V \gets \emptyset, E \gets \emptyset$\; Let $s_1,v_1$ be two consecutive vertices on the convex hull of $SG$ in counterclockwise order\; $v_{prev} \gets s_1, v_i \gets v_1$\; Add $v_{prev}$ to $V$\; \Do{$v_{prev} \neq s_1$ \textup{\textbf{and}} $v_i \neq v_1$}{ Add $v_i$ to $V$\; Add $\{v_i,v_{prev}\}$ to $E$\; Let $v_{next}$ be the neighbor of $v_i \in SG$ such that $v_{next}$ is the next neighbor clockwise from $v_{prev}$\; $v_{prev} \gets v_i, v_i \gets v_{next}$\; } $E=E \cup \{\{v_i,v_{prev}\}\} \cup DT \setminus SG$\; \Return $\left(V,E\right)$\;} \caption{{\small \texttt{TransformPolygon}($SG, DT$)}} \label{TransformPolygon} \end{algorithm2e} \vspace{-2pt} \begin{algorithm2e} {\small \SetAlgoLined Let $V,E$ be the vertices and edges of $Q$, respectively\; Let $\rho[1,\ldots,n]$ be the breadth-first ordering of $V$ in $Q$, starting at any vertex in $V$\; $E' \gets SG$\; \ForEach{$u \in \rho$}{ Let $s_1,s_2,...,s_m$ be the clockwise ordered neighbors of $u$ in $Q$\; $s_j,s_k \gets s_m$\; \If{$u \neq \rho_1$}{ Set $s_j$ and $s_k$ to the first and last vertex in the ordered neighborhood of $u$ where $s_j,s_k \in E'$\; } Divide $\angle s_1 u s_j$ and $\angle s_k u s_m$ into an minimum number of cones with maximum angle $\pi/2$\; In each cone, add the shortest edge in $E$ incident upon $u$\ to $E'$ and all edges $\{s_\ell,s_{\ell+1}\}$ such that $ 1 \leq \ell < j$ \textbf{\textup{or}} $k \leq \ell < m$\; } \Return $E'$\;} \caption{{\small \texttt{PolygonSpanner}($Q,SG$)}} \label{PolygonSpanner} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; $SG \gets \texttt{SpanningGraph}(DT)$ (Algorithm~\ref{SpanningGraph})\; $Q \gets \texttt{TransformPolygon}(SG, DT)$ (Algorithm~\ref{TransformPolygon})\; $G' \gets \texttt{PolygonSpanner}(Q, SG)$ (Algorithm~\ref{PolygonSpanner})\; \Return $G'$\; \caption{{\small \texttt{BGS05}($P$)}} \label{code:BSG2005}} \end{algorithm2e} \item \texttt{LW04}: \textbf{Li and Wang}~\cite{li2004efficient}. This algorithm is inspired from \texttt{BSG2005} but is a lot simpler and avoids the use of intermediate (possibly degenerate) polygons. The algorithm computes a reverse low degree ordering of the vertices of the $L_2$-Delaunay triangulation $DT$ constructed on $P$. Then it sequentially considers the vertices in this ordering, divides the surrounding of every such vertex into multiple cones, and then adds short edges from $DT$ to preserve planarity. Refer to Algorithm~\ref{code:LW04} for a pseudocode of this algorithm. The authors have shown that this algorithm generates degree-$23$ plane spanners (when the input parameter $\alpha$ of this algorithm is set to $\pi/2$) having a stretch factor of $1.998\left(1 + \pi/\sqrt{2} \right)\approx 6.4$ and runs in $O(n\log n)$ time. \begin{algorithm2e} {\small Allocate $\Phi[1\ldots n]$\; Make a copy of $DT$ and call it $H$\; \For{$i=1$ \KwTo $n$}{ Let $u$ be a vertex in $H$ with minimal degree\; $\Phi[u] \gets n-i+1$\; Remove $u$ and all incident edges from $H$\; } \Return $\Phi$\;} \caption{{\small \texttt{ReverseLowDegreeOrdering}($DT$)}} \label{code:ReverseLowDegreeOrdering} \end{algorithm2e} \begin{algorithm2e} {\small $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; $\Phi[1\ldots n] \gets \texttt{ReverseLowDegreeOrdering}(DT)$ (Algorithm~\ref{code:ReverseLowDegreeOrdering})\; $E \gets \emptyset$\; \ForEach{$u \in \Phi$}{ Divide the area surrounding $u$ into sectors delineated by $u$'s already \texttt{processed} neighbors in $DT$\; Divide each sector into a minimum number of cones $C^0_u,C^1_u,\ldots$ with angle at most $\alpha$\; \ForEach{$C^i_u$}{ Let $v_1, v_2, ..., v_m$ be the clockwise-ordered Delaunay neighbors of $u$ in $C^i_u$\; Add an edge between $u$ and the closest of such neighbors to $E$\; Add all edges $\{v_j,v_{j+1}\}$ such that $1 \leq j < m$ to $E$\; } Mark $u$ as \texttt{processed}\; } \Return $E$\;} \caption{{\small \texttt{LW04}($P,\ 0 < \alpha \leq \pi/2$})} \label{code:LW04} \end{algorithm2e} \item \texttt{BSX09}: \textbf{Bose, Smid, and Xu}~\cite{bose2009delaunay}. This algorithm is quite similar to \texttt{LW04} in design and also relies on reverse low-degree ordering of the vertices of the Delaunay triangulation. Refer to Algorithm~\ref{code:BSX09}. The authors have generalized their algorithm so that it can construct bounded-degree plane spanners from any triangulation of $P$, not necessarily just the $L_2$-Delaunay triangulation (although the $L_2$-Delaunay triangulation is of primary interest to us). When the $L_2$-Delaunay triangulation is used and the parameter $\alpha$ is set to $2\pi/3$, the algorithm generates degree-$17$ plane spanners having a stretch factor of $\sigma(2+2\sqrt{3}+\frac{3\pi}{2} + 2\pi \sin \frac{\pi}{12}) \approx 23.6$ in $O(n\log{n})$ time. After computing the triangulation and the reverse low-degree ordering, at every vertex $u$, $\delta=\lceil 2\pi/\alpha \rceil$ Yao cones are initialized such that the closest unprocessed triangulation neighbor falls on a cone boundary and occupies both cones as the \textit{short} edge, which is added to the spanner. In the remaining cones, the closest unprocessed neighbor of $u$ in each cone is added. In all cones, special edges between pairs of neighbors of $u$ are added to the spanner if both the neighbors are unprocessed. \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; $\Phi[1\ldots n] \gets \texttt{ReverseLowDegreeOrdering}(DT)$ (use Algorithm~\ref{code:ReverseLowDegreeOrdering})\; $E \gets \emptyset$\; \ForEach{$u \in \Phi$}{ \If{$u$ \textup{has \texttt{unprocessed} Delaunay neighbors}}{ Let $v_{closest}$ be the closest \texttt{unprocessed} neighbor to $u$\; Add the edge $\{u,v_{closest}\}$ to $E$\; Divide the area surrounding $u$ into a minimum number of cones $C^0_u, C^1_u,\ldots$ with angle at most $\alpha$, such that $v_{closest}$ is on the boundary between the first and last cones\; \ForEach{\textup{$C^i_u$ except the first and last}}{ \If{\textup{$u$ has \texttt{unprocessed} neighbors in $C^i_u$}}{ Let $w$ be the closest \texttt{unprocessed} neighbor to $u$ in the cone\; Add edge $\{u,w\}$ to $E$\; } Let $v_0, v_1, ..., v_{m-1}$ be the clockwise-ordered neighbors of $u$\; Add all edges $\{v_j,v_{(j+1) \bmod m}\}$ to $E$ such that $0 \leq j < m$ and $v_j, v_{(j+1)\bmod m}$ are \texttt{unprocessed}\; } } Mark $u$ as \texttt{processed}\; } \Return $E$;} \caption{{\small \texttt{BSX09}($P,\ 0<\alpha\leq 2\pi / 3$)}} \label{code:BSX09} \end{algorithm2e} \item \texttt{BGHP10}: \textbf{Bonichon, Gavoille, Hanusse, and Perkovi{\'c}}~\cite{bonichon2010plane}. It was the first algorithm that deviated from the use of $L_2$-Delaunay triangulation; instead, it used $TD$-Delaunay triangulation to select spanner edges, introduced by Chew back in $1989$~\cite{chew1989there}. For such triangulations, empty equilateral triangles are used for characterization instead of empty circles, as needed in the case of $L_2$-Delaunay triangulations. $TD$-Delaunay triangulations are plane $2$-spanners but may have an unbounded degree. \texttt{BGHP10} first extracts a degree-$9$ subgraph from the $TD$-Delaunay triangulation that has a stretch factor of $6$. Then using some local modifications, the degree is reduced from $9$ to $6$ but the stretch factor remains unchanged. Refer to Algorithm~\ref{code:BGHP10}. It uses internally Algorithms~\ref{irelevant} - \ref{charge}. In this algorithm, each edge incident to a node is charged to some cone of that node. The algorithm runs in $O(n\log n)$ time, as shown by the authors. \item \texttt{KPX10}: \textbf{Kanj, Perkovi{\'c}, and Xia}~\cite{kanj2010spanners}. For every vertex $u$ in the $L_2$-Delaunay triangulation, its surrounding is divided into $k \geq 14$ cones. In every nonempty cone of $u$, the shortest Delaunay edge incident on $u$ is selected. After this, a few additional Delaunay edges are also selected using some criteria based on cone sequences. See Algorithm~\ref{code:KPX10} for a complete description of this algorithm with the technical details. When $k$ is set to $14$, degree-$14$ plane spanners are generated having a stretch factor of $1.998 \left(1 + \frac{2\pi}{14 \cos (\pi/14)}\right) \approx 2.9$. Note that out of the $11$ algorithms we have implemented in this work, this algorithm gives the best theoretical guarantee on the stretch factor; see Table~\ref{tab:summary}. \texttt{KPX10} runs in $O(n\log n)$ time. \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{TD-DelaunayTriangulation}(P)$\; $E \gets \emptyset$\; \ForEach{\textup{nonempty cone $i$ of vertex }$u \in DT$ \textup{where} $i \in \{1,3,5\}$ }{ Add edge $\{u,\texttt{closest}(u,i)\}$ to $E$\; $\texttt{charge}(u,i)\gets \texttt{charge}(u,i)+1$\; $\texttt{charge}(\texttt{closest}(u,i),i+3)) \gets \texttt{charge}(\texttt{closest}(u,i),i+3)+1$\; \If{\textup{\texttt{first}$(u,i) \neq$ \texttt{closest}($u,i$) $\land$ \texttt{i-relevant}(\texttt{first}$(u,i),u,i-1$)}}{ Add edge $u,\texttt{first}(u,i)$ to $E$\; $\texttt{charge}(u,i-1) \gets \texttt{charge}(u,i-1)+1$\; } \If{\textup{\texttt{last}$(u,i) \neq$ \texttt{closest}($u,i$) $\land$ \texttt{i-relevant}(\texttt{last}$(u,i),u,i+1$)}}{ Add edge $\{u, \texttt{last}(u,i)\}$ to $E$\; $\texttt{charge}(u,i+1)\gets \texttt{charge}(u,i+1)+1$\; } } \ForEach{\textup{cone $i$ of vertex $u \in DT$ \textup{where} $i \in \{0,2,4\}$, such that \texttt{i-distant}($u,i$) is true } }{ $v_{next} \gets \texttt{first}(u,i+1)$\; $v_{prev} \gets \texttt{last}(u,i-1)$\; Add edge $\{v_{next},v_{prev}\}$ to $E$\; $\texttt{charge}(v_{next},i+1)\gets\texttt{charge}(v_{next},i+1)+1$\; $\texttt{charge}(v_{prev},i-1)\gets\texttt{charge}(v_{prev},i-1)+1$\; Let $v_{remove}$ be the vertex from ${v_{next},v_{prev}}$ where $\angle (\texttt{parent}(u,i), u, v_{remove})$ is maximized\; Remove edge $\{u,v_{remove}\}$ from $E$\; $\texttt{charge}(u,i)\gets \texttt{charge}(u,i)-1$\; } \ForEach{\textup{cone $i$ of vertex $u \in DT$ where $i \in \{0,1,\ldots,5\}$, such that \texttt{charge}($u,i$) $= 2$ $\land$ \texttt{charge}($u,i-1$) $= 1$ $\land$ \texttt{charge}($u,i+1$) $= 1$}}{ \eIf{\textup{$u = \texttt{last}(\texttt{parent}(u,i),i)$}}{ $v_{remove} \gets \texttt{last}(u,i-1)$\; }{ $v_{remove} \gets \texttt{first}(u,i+1)$\; } Remove edge $\{u,v_{remove}\}$ from $E$\; $\texttt{charge}(u,i)\gets\texttt{charge}(u,i) -1$\; } \Return $E$\;} \caption{{\small \texttt{BGHP10}($P$)}} \label{code:BGHP10} \end{algorithm2e} \vspace{-3pt} \begin{algorithm2e} {\small \SetAlgoLined $w \gets \texttt{parent}(u,i)$\; \Return{\textup{$v \neq \texttt{closest}(u,i) \land v \in C^i_w$}}\;} \caption{{\small \texttt{i-relevant}($v,u,i$)}} \label{irelevant} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $u \gets \texttt{parent}(w,i)$\; \Return{\textup{$\{w,u\} \notin E$ $\land$ \texttt{i-relevant}($\texttt{first}(w,i+1),u, i+1$) $\land$ \texttt{i-relevant}($\texttt{last}(w,i-1),u,i-1$)}}\;} \caption{{\small \texttt{i-distant}($w,i$)}} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return{\textup{the closest vertex to $u$ in a even cone $i$, if it exists}}\; } \caption{{\small \texttt{parent}($u,i$)}} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return{\textup{the closest vertex to $u$ in a odd cone $i$, if it exists}}\;} \caption{{\small \texttt{closest}($u,i$)}} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return{\textup{the first vertex in a odd cone $i$, if it exists}}\;} \caption{{\small \texttt{first}($u,i$)}} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return{\textup{the last vertex in a odd cone $i$, if it exists}}\;} \caption{{\small \texttt{last}($u,i$)}} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return{\textup{the number of edges charged to cone $i$ of $u$}}\;} \caption{{\small \texttt{charge}($u,i$)}} \label{charge} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; \ForEach{\textup{vertex} $u \in DT$}{ Partition the area surrounding $u$ into $k$ disjoint cones of angle $2\pi/k$\; In each nonempty cone, \texttt{select} the shortest edge in $DT$ incident to $u$\; \ForEach{\textup{maximal sequence of $\ell\geq 1$ consecutive empty cones}}{ \eIf{$\ell>1$}{ \texttt{select} the first $\lfloor \ell/2 \rfloor$ \texttt{unselected} incident $DT$ edges on $u$ clockwise from the sequence of empty cones and the first $\lceil \ell/2 \rceil$ \texttt{unselected} $DT$ edges incident on $u$ counterclockwise from the sequence of empty cones\; }{ let $ux$ and $uy$ be the incident $DT$ edges on $m$ clockwise and counterclockwise, respectively, from the empty cone\; if either $ux$ or $uy$ is selected then \texttt{select} the other edge (in case it has not been selected); otherwise \texttt{select} the shorter edge between $ux$ and $uy$ breaking ties arbitrarily; } } } \Return the $DT$ edges \texttt{selected} by both endpoints\;} \caption{{\small \texttt{KPX10}($P$, integer $k\geq 14$)}} \label{code:KPX10} \end{algorithm2e} \item \texttt{KX12}: \textbf{Kanj and Xia}~\cite{kanj2012improved}. This $O(n\log n)$-time algorithm takes a different approach in contrast with the previous ones, although it still uses the $L_2$-Delaunay triangulation $DT$ as the starting point. Every vertex $u$ in $DT$ selects at most $11$ of its incident edges in $DT$, and edges that are selected by both endpoints are kept. As such, it is guaranteed that the degree of the resulting subgraph is at most $11$. The stretch factors of the generated spanners is shown to be at most $1.998 \left(\frac{2\sin (2\pi/5)\cos (\pi/5)}{2\sin (2\pi/5)\cos (\pi/5)-1}\right) \approx 5.7$. Refer to Algorithm~\ref{code:KX12}. \item \texttt{BCC12-7}, \texttt{BCC12-6}: \textbf{Bose, Carmi, and Chaitman-Yerushalmi}~\cite{bose2012bounded}. The authors present two algorithms in their paper. Whereas previous algorithms used strategies involving iterating over the vertices one-by-one, this algorithm takes the approach of {iterating over the edges of the Delaunay triangulation in order of non-decreasing length} to query agreement among the vertices for bounding degrees. \texttt{BCC12-7}, the simpler of the two, produces $1.998 (1 + \sqrt{2})^2 \approx 11.6$-spanners with degree $7$. \texttt{BCC12-6}, on the other hand, constructs $11.998 \left(\frac{1}{1-\tan (\pi/7)(1 + 1/\cos (\pi/14))} \right)\approx 81.7$-spanners with degree $6$ but not all edges come from the $L_2$-Delaunay triangulation. Both these algorithms run in $O(n \log n)$ time. See Algorithm~\ref{alg:bcc}. The parameter $\Delta \in \{7,6\}$ is used to control the degree. Depending on $\Delta$, either Algorithm~\ref{alg:bcc_wedge6} or Algorithm~\ref{alg:bcc_wedge7} is invoked. \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; \ForEach{\textup{vertex} $u \in DT$}{ In each \texttt{wide} sequence (a sequence of exactly three consecutive edges incident to a vertex whose overall angle is at least $4\pi/5$) around $u$, \texttt{select} the edges of the sequence\; Partition the remaining space surrounding $u$ not in a \texttt{wide} sequence into a minimum number of disjoint cones of maximum angle $\pi/5$\; In each nonempty cone, \texttt{select} the shortest edge incident to $u$\; In each empty cone, let $ux$ and $uy$ be the incident $DT$ edges on $u$ clockwise and counterclockwise, respectively, from the empty cone\; If either $ux$ or $uy$ is selected then \texttt{select} the other edge (in case it has not been selected); otherwise \texttt{select} the longer edge between $ux$ and $uy$ breaking ties arbitrarily; } \Return{\textup{all edges \texttt{selected} by both incident vertices}}\;} \caption{{\small \texttt{KX12}($P$)}} \label{code:KX12} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; $E, E^* \gets \emptyset$\; Initialize $k=\Delta+1$ cones surrounding each vertex $u$, oriented such that the shortest edge incident on $u$ falls on a boundary\; \ForEach{$\{u,v\} \in DT$\textup{ in order of non-decreasing length}}{ \If{$\forall C^i_u$\textup{ containing }$\{u,v\}$, $C^i_u \cap E = \emptyset$\textup{ \textbf{and} }$\forall C^j_v$\textup{ containing }$\{u,v\}$, $C^j_v \cap E = \emptyset$}{ Add edge $\{u,v\}$ to $E$\; } } \ForEach{$\{u,v\} \in E$}{ $\texttt{Wedge}_\Delta(u,v)$\; $\texttt{Wedge}_\Delta(v,u)$\; } \Return $E \cup E^*$\;} \caption{{\small \texttt{BCC12}($P, \Delta \in \{6,7\}$})} \label{alg:bcc} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \ForEach{$C^z_u$\textup{ containing }$\{u,v_i\}$}{ Let $\{u,v_j\}$ and $\{u,v_k\}$ be the first and last edges of $DT$ in the cone\; Add all edges $\{v_m,v_{m+1}\}$ to $E^*$ such that $j<m<i-1$ or $i<m<k-1$\; \If{$\{u,v_{i+1}\} \in C^z_u$\textup{ \textbf{and} }$v_{i+1} \neq v_k$\textup{ \textbf{and} }$\angle uv_iv_{i+1} > \pi/2$}{ Add edge $\{v_i,v_{i+1}\}$ to $E^*$\; } \If{$\{u,v_{i-1}\} \in C^z_u$\textup{ \textbf{and} }$v_{i-1} \neq v_k$\textup{\textbf{ \textbf{and} }}$\angle uv_iv_{i-1} > \pi/2$}{ Add edge $\{v_i,v_{i-1}\}$ to $E^*$\; } } } \caption{{\small $\texttt{Wedge}_7(u,v_i)$}} \label{alg:bcc_wedge7} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \ForEach{$C^z_u \textup{ containing } \{u,v_i\}$}{ Let $Q = \{v_n: \{u,v_n\} \in C^z_u \cap DT\} = \{v_j,...,v_k\}$\; Let $Q' = \{v_n: \angle v_{n-1}v_nv_{n+1} < 6\pi/7, v_n \in Q \setminus \{v_j,v_i,v_k\}$\}\; Add all edges $\{v_n,v_{n+1}\}$ to $E^*$ such that $v_n,v_{n+1} \notin Q'$ and $n \in \left[j+1,i-2\right] \cup \left[i+1,k-2\right]$\; \tcc{W.l.o.g. the points of $Q'$ lie between $v_i$ and $v_k$ (the symmetric case is handled analogously)} \If{$\angle uv_iv_{i-1} > 4\pi/7$ \textup{ and } $i,i-1 \neq j$}{ Add edge $\{v_i,v_{i-1}\}$ to $E^*$\; } Let $v_f$ be the first point in $Q'$\; Let $a = \min\{ n|n>f \textrm{ and } v_n \in Q \setminus Q' \}$\; \eIf{$f=i+1$}{ \If{$\angle uv_iv_{i+1} \leq 4\pi/7 \textup{ and } a\neq k$}{ Add edge $\{v_f,v_a\}$ to $E^*$\; } \If{$\angle uv_iv_{i+1} > 4\pi/7 \textup{ and } f+1\neq k$}{ Add edge $\{v_i,v_{f+1}\}$ to $E^*$\; } }{ Let $v_\ell$ be the last point in $Q'$\; Let $b = \max\{ n|n<\ell \textrm{ and } v_n \in Q \setminus Q' \}$\; \eIf{$\ell=k-1$}{ Add edge $\{v_\ell,v_b\}$ to $E^*$\; }{ Add edge $\{v_b,v_{\ell+1}\}$ to $E^*$\; \If{$v_{\ell-1} \in Q'$}{ Add edge $\{v_\ell,v_{\ell-1}\}$ to $E^*$\; } } } }} \caption{{\small $\texttt{Wedge}_6(u,v_i)$}} \label{alg:bcc_wedge6} \end{algorithm2e} \vspace{-4pt} \item \texttt{BKPX15}: \textbf{{Bonichon, Kanj, Perkovi{\'c}, and Xia}~\cite{bonichon2015there}}. This algorithm uses the $L_\infty$-Delaunay triangulation and was the first degree-$4$ algorithm. For such triangulations, empty axis parallel squares are used for characterization instead of empty circles, as needed in the case of $L_2$-Delaunay triangulations. The $L_\infty$-distance between two points $u,w$ is defined as $d_\infty(u,w) = \max(d_x(u,w),d_y(u,w))$. From the $L_\infty$-Delaunay triangulation, a directed $L_\infty$-distance-based Yao graph $\overrightarrow{Y_4^\infty}$ is constructed that is a plane $\sqrt{20+14\sqrt{2}}$-spanner. Then a degree-$8$ subgraph $H_8$ of $Y_4^\infty$ is constructed. Finally, some redundant edges are removed and new shortcut edges are added to obtain the final plane degree-$4$ spanner with a stretch factor of $\sqrt{20+14\sqrt{2}} (19+29\sqrt{2})\approx 156.8$. No runtime analysis is presented by the authors. Refer to Algorithm~\ref{code:BKPX15}. The algorithm divides the space around each point into $4$ cones, separated by the $x$ and $y$-axes after translating the point to the origin. Each cone has an associated \texttt{charge}, which can be $0, 1,$ or $2$. The algorithm labels certain edges as follows. Each edge will be an \texttt{anchor} or a \texttt{\texttt{non-anchor}} and \texttt{weak} or \texttt{strong}. Further, each edge may have an additional label of \texttt{start-of-odd-chain-anchor}. A \texttt{weak anchor chain} is a path $w_0,w_1,w_2,...w_k$ of maximal length consisting of \texttt{weak anchors} such that the cone of each edge (wrt the source vertex) alternates between some $i$ and $i+2$. \texttt{Canonical} edges are edges between consecutive vertices in the ordered neighborhood of a vertex $u$ in a common cone $i$. An edge $(u,v)$ is said to be \texttt{dual} if there are two or more edges of $\overrightarrow{Y^{\infty}_4}$ incident to cone $i$ of $u$ and cone $i+2$ of $v$. \vspace*{-5pt} \begin{algorithm2e} {\small \SetAlgoLined $\overrightarrow{Y^{\infty}_4} \gets \emptyset$\; \ForEach{$u \in DT$ }{ \ForEach{$C^i_u$}{ Let $v \in C^i_u$ be the vertex with the smallest $L_\infty$ distance\; Add $\left(u,v\right)$ to $\overrightarrow{Y^{\infty}_4}$\; } } \Return $\overrightarrow{Y^{\infty}_4}$\;} \caption{{\small \texttt{constructYaoInfinityGraph}($DT$})} \label{constructYaoInfinityGraph} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \ForEach{$\left(u,v\right) \in \overrightarrow{Y^{\infty}_4}$}{ Let $i$ be the cone of $u$ containing $v$\; $v_{anchor} \gets v$\; \If{\textup{$\lnot$\texttt{isMutuallySingle}$(\overrightarrow{Y^{\infty}_4},u,v,i)$}\textup{ \textbf{and} $u$ has more than one $\overrightarrow{Y^{\infty}_4}$ edge in $C^i_u$}}{ Let $\ell$ be the position of $v$ and $k$ the number of vertices in \texttt{fan}($DT,u,i$)\; \uIf{$\ell \geq 2 \textup{ \textbf{and}}\left(v_{\ell -1},v_\ell\right) \in \overrightarrow{Y^{\infty}_4}\textup{ \textbf{and}}\left(v_{\ell},v_{\ell-1}\right) \notin \overrightarrow{Y^{\infty}_4}$}{ Let $v_{\ell'}$ such that $\ell' < \ell$ be the starting vertex of the maximal unidirectional \texttt{canonical} path ending at $v_\ell$\; $v_{anchor} \gets v_{\ell'}$\; } \uElseIf{$\ell \leq k-1 \textup{ \textbf{and}}\left(v_{\ell +1},v_\ell\right) \in \overrightarrow{Y^{\infty}_4}\textup{ \textbf{and}}\left(v_{\ell},v_{\ell+1}\right) \notin \overrightarrow{Y^{\infty}_4}$}{ Let $v_{\ell'}$ such that $\ell' > \ell$ be the starting vertex of the maximal unidirectional \texttt{canonical} path ending at $v_\ell$\; $v_{anchor} \gets v_{\ell'}$\; } } Mark $(u,v_{anchor})$ as the \texttt{anchor} of $C^i_u$\; } $A \gets \emptyset$\; \ForEach{\textup{\texttt{anchor} $(u,v)$ in each $C^i_u$}}{ \eIf{\textup{\texttt{anchor} of $C^{i+2}_v$ is $(v,u)$ \textbf{or} undefined}}{ Mark $(u,v)$ as \texttt{strong} and add it to $A$\; }{ Mark $(u,v)$ as \texttt{weak}\; } } \ForEach{\textup{\texttt{weak anchor} $(u,v)$ in each $C^i_u$}}{ \If{\textup{$u$ begins the \texttt{weak anchor chain} $\left(w_0,w_1,...,w_k\right)$}}{ \If{$k$ \textup{is odd}}{ Mark $\left(w_0,w_1\right)$ as a \texttt{start-of-odd-chain-anchor}\; } \For{$\ell = k-1;\ \ell\geq 0;\ \ell=\ell-2$}{ Add $\left(w_{\ell -1},w_\ell\right)$ to $A$\; } } } \Return $A$\; } \caption{{\small \texttt{selectAnchors}($\protect\overrightarrow{Y_4^\infty}, DT$)}} \label{selectAnchors} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \Return all neighboring vertices $\left(v_1,v_2,...,v_k\right)$ in $C^i_u$ in counterclockwise order\;} \caption{{\small \texttt{fan}($DT,u,i$)}} \end{algorithm2e} \vspace*{-8pt} \begin{algorithm2e} {\small \SetAlgoLined \Return $u$ has one $\overrightarrow{Y^{\infty}_4}$ edge in $C^i_u$ \textbf{and} $v$ has one $\overrightarrow{Y^{\infty}_4}$ edge in $C^{i+2}_v$\;} \caption{{\small \texttt{isMutuallySingle}($\protect\overrightarrow{Y^{\infty}_4},u,v,i$)}} \label{isMutuallySingle} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined \texttt{Charge} each anchor $\left(u,v\right) \in A$ to the cones of each vertex in which the edge lies\; $H_8 \gets A$\; \ForEach{\textup{vertex $u$ and cone $i$ of $u$}}{ $\{v_1,...,v_k\} \gets \texttt{fan}(DT,u,i)$\; \If{$k \geq 2$}{ Add all uni-directional \texttt{canonical} edges to $H_8$ except $\left(v_2,v_1\right)$ and $\left(v_{k-1},v_k\right)$\; \If{\textup{$\left(v_2,v_1\right)$ is a \texttt{non-anchor}, uni-directional edge such that $\left(v_2,v_1\right) \in \overrightarrow{Y_4^\infty} \land \left(v_1,v_2\right) \notin \overrightarrow{Y_4^\infty} \land \left(v_1,u\right)$ is a \texttt{dual} edge $\land$ not a \texttt{start-of-odd-chain} anchor chosen by $v_1$}} { Add $\left(v_2,v_1\right)$ to $H_8$\; } \If {\textup{$\left(v_{k-1},v_k\right)$ is a \texttt{non-anchor}, uni-directional edge such that $\left(v_{k-1},v_k\right) \in \overrightarrow{Y_4^\infty} \land \left(v_k,v_{k-1}\right) \notin \overrightarrow{Y_4^\infty} \land \left(v_k,u\right)$ is a \texttt{dual} edge $\land$ not a \texttt{start-of-odd-chain} anchor chosen by $v_k$}} { Add $\left(v_{k-1},v_k\right)$ to $H_8$\; } \ForEach{\textup{\texttt{canonical} edge $\left(v,w\right)$ added to $H_8$}}{ $v_{charge} \gets v$\; \If{\textup{$\left(v,w\right)$ is a \texttt{non-anchor}}}{ $v_{charge} \gets u$\; } \texttt{Charge} $\left(v,w\right)$ to the cone of $v$ containing $w$ and the cone of $w$ containing $v_{charge}$\; } } } \Return $H_8$\;} \caption{{\small \texttt{degree8Spanner}$(A,\protect\overrightarrow{Y^{\infty}_4},DT)$}} \label{degree8Spanner} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $H_6 \gets H_8$\; \ForEach{\textup{uni-directional \texttt{non-anchor} $\left(u,v\right)$ in cone $i$ of $u$ in $H_8$ with \texttt{charge} $= 1$}}{ \If{\textup{cone $i+1$ or $i-1$ of $v$ has \texttt{charge} $=2 \land \left(u,v\right)$ is \texttt{charged} to cone $i+1$ or $i-1$ of $v$}}{ Let $j$ be the cone of $v$ where ($u$, $v$) is \texttt{charged}\; $v_{current}\gets u, v_{next}\gets v$, $D\gets \emptyset$\; \While{\textup{cone $j$ of $v_{next}$ has \texttt{charge} $=2 \land (v_{current},v_{n ext})$ is in cone $j$ of $v_{next}$}}{ Add $(v_{current},v_{next})$ to $D$\; $v_{current}\gets v_{next}$\; Set $v_{next}$ to the target of the $\overrightarrow{Y^{\infty}_4}$ edge beginning in cone $j$ of $v_{current}$\; swap($i,j$)\; } Starting with the last edge in the path induced by $D$, remove every other edge from $H_6$\; } } \Return $H_6$\;} \caption{{\small \texttt{processDupEdgeChains}$(H_8,\protect\overrightarrow{Y^{\infty}_4})$}} \label{processDupEdgeChains} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $H_4 \gets H_6$\; \ForEach{\textup{pair of \texttt{non-anchor} uni-directional \texttt{canonical} edges $(v_{r-1},v_r), (v_{r+1}, v_r)$ in cone $i$ of $u$}}{ Remove $(v_{r-1},v_r)$ and $(v_{r+1}, v_{r})$ from $H_4$\; Add $(v_{r-1},v_{r+1})$ to $H_4$\; \texttt{Charge} this edge to the cones of each vertex in which the edge lies\; } \Return $H_4$\;} \caption{{\small \texttt{createShortcuts}$(H_6,\protect\overrightarrow{Y^{\infty}_4},DT)$}} \label{createShortcuts} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_{\infty}$-DelaunayTriangulation}(P)$\; $\overrightarrow{Y^{\infty}_4} \gets \texttt{constructYaoInfinityGraph}(DT)$ (Algorithm~\ref{constructYaoInfinityGraph})\; $A \gets \texttt{selectAnchors}(\overrightarrow{Y^{\infty}_4},DT)$ (Algorithm~\ref{selectAnchors})\; $H_8 \gets \texttt{degree8Spanner}(A,\overrightarrow{Y^{\infty}_4},DT)$ (Algorithm~\ref{degree8Spanner})\; $H_6 \gets \texttt{processDupEdgeChains}(H_8,\overrightarrow{Y^{\infty}_4})$ (Algorithm~\ref{processDupEdgeChains})\; $H_4 \gets \texttt{createShortcuts}(H_6,\overrightarrow{Y^{\infty}_4},DT)$ (Algorithm~\ref{createShortcuts})\; \Return $H_4$;} \caption{{\small \texttt{BKPX15}($P$)}} \label{code:BKPX15} \end{algorithm2e} \item \texttt{KPT17}: \textbf{Kanj, Perkovi{\'c}, and T{\"u}rkoǧlu}~\cite{kanj2017degree}. Akin to \texttt{BGHP10}, this algorithm uses the $TD$-Delaunay triangulation and $\Theta$-graph to introduce fresh techniques in spanner construction. Refer to Algorithm~\ref{code:KPT17} for a pseudocode of this algorithm. The authors show that their algorithm generates degree-$4$ spanners with a stretch factor of $20$ and runs in $O(n\log n)$ time. In the following, we define the notations used in the pseudocode. \begin{itemize} \item For each vertex, the shortest edge in each odd cone is called an anchor. \item Cones $1$ and $4$ are labelled as \texttt{blue} and the rest as \texttt{white}. \item The first and last edges incident upon a vertex $u$ in a cone $i$ are called the \texttt{boundary} edges of $u$ in $i$. \item The \texttt{canonical} path is made up of all \texttt{canonical} edges incident on $u$ in cone $i$, forming a path from one \texttt{boundary} edge in the cone to the other. \end{itemize} \item \texttt{BHS18}: {\textbf{Bose, Hill, and Smid}~\cite{bose2018improved}}. This algorithm produces a plane degree-$8$ spanner with stretch factor at most $1.998 \left( 1 + \frac{2\pi}{6 \cos (\pi/6) } \right) \approx 4.4$ using the $L_2$-Delaunay triangulation and $\Theta$-graph. However, the authors do not present any runtime analysis of their algorithm. In \texttt{BHS18}, the space around every point $p$ is divided into six cones and are oriented such that a boundary lies on the $x$-axis after translating $p$ to the origin. The algorithm starts with the $L_2$-Delaunay triangulation $DT$, then, in order of non-decreasing {bisector distance}, each edge is added to the spanner if the cones containing it are both empty. For each edge added here, certain \textit{canonical} edges will also be carefully added to the spanner. Refer to Algorithm~\ref{code:BHS18}. In the following, we define the notations used in this pseudocode. \vspace*{-5pt} \begin{itemize} \item The \texttt{bisector-distance} $\left[pq\right]$ between $p$ and $q$ is the distance from $p$ to the orthogonal projection of $q$ onto the bisector of $C^p_i$ where $q \in C^p_i$. \item Let $\{q_0,q_1,...,q_{d-1}\}$ be the sequence of all neighbors of $p$ in $DT$ in consecutive clockwise order. The neighborhood $N_p$ with apex $p$ is the graph with the vertex set $\{p,q_0,q_1,...,q_{d-1}\}$ and the edge set $\{\{q_j,q_{j+1}\}\} \cup \{\{q_j,q_{j+1}\}\}, 0 \leq j \leq d-1$, with all values mod $d$. The edges $\{\{q_j,q_{j+1}\}\}$ are called \textit{canonical edges}. \item $N^p_i$ is the subgraph of $N_p$ induced by all the vertices of $N_p$ in $C^p_i$, including $p$. \item Let $Can^{\{p,r\}}_i$ be the subgraph of $DT$ consisting of the ordered subsequence of canonical edges $\{s,t\}$ of $N^p_i$ in clockwise order around apex $p$ such that $\left[ps\right] \geq \left[pr\right]$ and $\left[pt\right] \geq \left[pr\right]$. \end{itemize} \begin{algorithm2e} {\small \SetAlgoLined $DT \leftarrow \texttt{TD-DelaunayTriangulation}(P)$\; $E, A \gets \emptyset$\; \ForEach{\textup{\texttt{white} anchor $\left(u,v\right)$ in increasing order of $d_\triangledown$ length}} { \If{\textup{$u$ and $v$ do not have a \texttt{white} anchor in a cone adjacent to $\left(u,v\right)$'s cone}} { Add $\left(u,v\right)$ to $A$\; } } Add all \texttt{blue} anchors to $A$\; \ForEach{\textup{\texttt{blue} anchor $u$}}{ Let $s_1,s_2,...,s_m$ be the clockwise ordered neighbors of $u$ in $DT$\; Add all \texttt{canonical} edges $\left(s_\ell,s_{\ell+1}\right) \notin A$ to $E$ such that $1 \leq \ell < m$\; } \ForEach{\textup{pair of \texttt{canonical} edges $\left(u,v\right), \left(w,v\right) \in E$ in a \texttt{blue} cone}}{ Remove $\left(u,v\right)$ and $\left(w,v\right)$ from $E$\; Add a shortcut edge $\left(u,w\right)$ to E\; } \ForEach{\textup{\texttt{white} canonical edge $\left(u,v\right)$ on the \texttt{white} side of its anchor $a$}}{ \If{$a \notin A$}{ Add $\left(u,v\right)$ to $E$\; } } \ForEach{\textup{\texttt{white} anchor $\left(v,w\right)$ and its \texttt{boundary} edge $\left(u,w\right) \neq \left(v,w\right)$ on the \texttt{white} side}}{ Let $u=s_1,s_2,...,s_m=v$ be the \texttt{canonical} path between $u$ and $v$\; \For{$i=0$ \KwTo $m$}{ \If{$\left(s_{i+1},s_i\right)$ \textup{is \texttt{blue}}}{ Let $j$ be the smallest index in $P_i=\{s_{i+1},...,s_m\}$ such that $s_j$ is in a \texttt{white} cone of $s_i$ and $P_i$ lies on the same side (or on) the straight line $s_{i}s_{j}$\; Add the shortcut $\left(s_{j},s_{i}\right)$ to $E$\; \If{$\left(s_{j},s_{j-1}\right) \in E$}{ Remove $\left(s_{j},s_{j-1}\right)$ from $E$\; } $i \gets j$\; } } } \Return $E \cup A$;} \caption{\texttt{KPT17}($P$)} \label{code:KPT17} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; Let $m$ be the number of edges in $DT$\; $L$ be the edges $\in DT$ sorted in non-decreasing order of \texttt{bisector-distance}\; $E_A \gets$ \texttt{addIncident}($L$), $E_{CAN} \gets \emptyset$\; \ForEach{$\{u,v\} \in E_A$}{ $E_{CAN}\gets E_{CAN}\ \cup$ \texttt{addCanonical}($u,v$) $\cup$ \texttt{addCanonical}($v,u$)\; } \Return $E_A \cup E_{CAN}$\;} \caption{\texttt{BHS18}($P$)} \label{code:BHS18} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $E_A \gets \emptyset$\; \ForEach{$\{u,v\} \in L$}{ Let $i$ be the cone of $u$ containing $v$\; \If{$\{u,w\} \notin E_A$ \textup{for all} $w\in N^u_i$ $\land$ $\{v,y\} \notin E_A$ \textup{for all} $y\in N^v_{i+3}$}{ Add $\{u,v\}$ to $E_A$\; } } \Return{$E_A$}\;} \caption{\texttt{addIncident}($L$)} \end{algorithm2e} \begin{algorithm2e} {\small \SetAlgoLined $E' \gets \emptyset$\; Let $i$ be the cone of $u$ containing $v$\; Let $e_{first}$ and $e_{last}$ be the first and last canonical edge in $Can^{\{u,v\}}_i$\; \If{$Can^{\{u,v\}}_i$ \textup{has at least} $3$ \textup{edges}}{ \ForEach{$\{s,t\} \in Can^{\{u,v\}}_i \setminus \{e_{first},e_{last}\}$}{ Add $\{s,t\}$ to $E'$\; } } \If{$v \in \{e_{first},e_{last}\}$ \textup{\textbf{and} there is more than one edge in} $Can^{\{u,v\}}_i$}{ Add the edge of $Can^{\{u,v\}}_i$ incident to $v$ to $E'$\; } \ForEach{$\{y,z\} \in \{e_{first},e_{last}\}$}{ \If{$\{y,z\} \in N^z_{i-1}$}{ Add $\{y,z\}$ to $E'$\; } \If{$\{y,z\} \in N^z_{i-2}$}{ \If{$N^z_{i-2} \cap E_A$ \textup{does not have an edge incident to} $z$}{ Add $\{y,z\}$ to $E'$\; } \If{$N^z_{i-2} \cap E_A \setminus \{y,z\}$ \textup{has an edge incident to} $z$}{ Let $\{w,y\}$ be the canonical edge of $z$ incident to $y$\; Add $\{w,y\}$ to $E'$\; } } } \Return{$E'$}\;} \caption{\texttt{addCanonical}($u,v$)} \end{algorithm2e} \end{itemize} \section{Estimating stretch factors of large spanners} \label{chap:stretchfactor} Measuring exact stretch factors of large graphs is a tedious job, and so is for geometric spanners. Although many algorithms exist in the literature for constructing geometric spanners, nothing is known about practical algorithms for computing stretch factors of large geometric spanners. It is a severe bottleneck for conducting experiments with large spanners since the stretch factor is considered a fundamental quality of geometric spanners. For any spanner (not necessarily geometric) on $n$ vertices, its exact stretch factor can be computed in $O(n^3\log n)$ time by running the folklore Dijkstra algorithm (implemented using a Fibonacci heap) from every vertex, and in $\Theta(n^3)$ time by running the classic Floyd-Warshall algorithm. Note that the Dijkstra-based algorithm runs $O(n^2\log n)$ time for plane spanners since the number of edges is $O(n)$. Both of these are very slow in practice. However, the latter has a quadratic space-complexity and is unusable when $n$ is large. Consequently, they are practically useless when $n$ is large. Stretch factor estimation of large geometric graphs appears to be a far cry despite theoretical studies on this problem; refer to \cite{agarwal2008computing,narasimhan2000approximating,cheng2012approximating,federickson1987fast,wulff2010computing}. We believe these algorithms are either involved from an algorithm engineering standpoint or rely on well-separated pair decomposition~\cite{callahan1995decomposition}, which may potentially slow down practical implementations due to the large number of well-separated pairs needed by those algorithms. This has motivated us to design a practical algorithm, named \textsc{AppxStretchFactor}, that gives a lower-bound on the actual stretch factor of any geometric spanner (not necessarily plane). However, we will consider the universe of plane geometric spanners as the input domain in this work. To our knowledge, we are not aware of any such algorithm in the literature. Refer to Algorithm~\ref{alg:approximatesf}. It takes as input an $n$-element pointset $P$ and a geometric graph $G$, constructed on $P$. \begin{algorithm2e} {\small \SetAlgoLined $DT \gets \texttt{$L_2$-DelaunayTriangulation}(P)$\; $t \gets 1$\; \ForEach{$p \in P$}{ $h \gets 1$, $t_p \gets 1$\; \While{\textup{true}}{ Let $X$ denote the set of points which are exactly $h$ hops away from $p$ in $DT$\, found using a breadth-first traversal originating at $u$\; $t' \gets 1$\; \ForEach{$q \in X$}{ $t' \gets \max{ \left( \frac{{|\pi_G(p,q)|}}{|pq|}, t' \right) }$\; } \uIf{$t' > t_p$}{ $h \gets h + 1$; $t_p \gets t'$\; } \uElse { \textbf{break}\; } } $t \gets \max(t,t_p)$\; } \Return $t$;} \caption{\textsc{AppxStretchFactor}($P, G$)} \label{alg:approximatesf} \end{algorithm2e} The underlying idea of our algorithm is as follows. We observe that most geometric spanners are well-constructed; meaning it is likely that far away points (having many hops in the shortest paths between them) have low detour ratios (ratio of the length of a shortest path to that of the Euclidean distance) between them and the worst-case detour is achieved by point pairs that are a few hops apart. Note that stretch factor of a graph is the maximum detour ratio over all vertex pairs. To capture \textit{closeness}, we use the $L_2$-Delaunay triangulation constructed on $P$ as the basis. For every point $p \in P$, we start a breadth-first traversal on the Delaunay triangulation $DT$. At every level, we compute the detour ratios in $G$ from $p$ to all the points in that level. If a worse detour ratio is found in the current level compared to the worst found in the previous level, we continue to the next level; otherwise, the process is terminated. For finding detour ratios in $G$, we use the folklore Dijkstra algorithm since computation of shortest paths are required. In our algorithm, $\pi_G(p,q)$ denotes a shortest path between the points $p,q \in P$ in $G$ and $|\pi_G(p,q)|$ its total length. The detour between $p,q$ in $G$ can be easily calculated as $|\pi_G(p,q)|/|pq|$. The current level is denoted by $h$. It is assumed that the neighbors of $p$ in $G$ are at level $1$. For efficiency reasons, we do not restart the Dijkstra at every level of the breadth-first traversal; instead, we save our progress from the previous level and continue after that. To our surprise, we find that for the class of spanners used in this work, \textsc{AppxStretchFactor} returned exact stretch factors almost every time. The precision error was very low whenever it failed to compute the exact stretch factor. Further, our algorithm can be parallelized very easily by spawning parallel iterations of the \textbf{foreach} loop. Apart from the $L_2$-Delaunay triangulation (which can be constructed very fast in practice), it does not use any advanced geometric structure, making it fast in practice. We present our experimental observations for this algorithm in Section~\ref{subsec:appx}. \section{Experiments} \label{chap:experiments} We have implemented the algorithms in \textsf{GNU C}\texttt{++}$17$ using the \textsf{CGAL} library~\cite{cgal:eb-21b}. The machine used for experiments is equipped with a \textsf{AMD Ryzen 5 1600 (3.2 GHz)} processor and $24$ GB of main memory, and runs \textsf{Ubuntu Linux 20.04 LTS}. The \texttt{g++} compiler was invoked with \texttt{-O3} flag to achieve fast real-world speed. From \textsf{CGAL}, the \texttt{Exact\_predicates\_inexact\_constructions\_kernel} is used for accuracy and speed. We have tried our best to tune our codes to run fast. All the eleven algorithms considered in this work use one of the following three kinds of Delaunay triangulation as the starting point: $L_2$, $TD$, and $L_\infty$. For constructing $L_2$ and $L_\infty$-Delaunay triangulations, the \texttt{CGAL::Delaunay\_triangulation\_2} and \texttt{CGAL::Segment\_Delaunay\_graph\_Linf\_2} implementations have been used, respectively. As of now, a $TD$-Delaunay triangulation implementation is not available in the \textsf{CGAL}. It was pointed out by Chew in~\cite{chew1989there} that such triangulations can be constructed in $O(n\log n)$ time. However, no precise implementable algorithm was presented. But luckily, it is shown in~\cite{bonichon2010connections} by Bonichon~{et~al.}~that $TD$-Delaunay triangulation of a pointset is same as its $\frac{1}{2}$-$\Theta$ graph. We leveraged this result and used the $O(n\log n)$ time \texttt{CGAL::Construct\_theta\_graph\_2} implementation for constructing the $TD$-Delaunay triangulations. For faster speed, the input pointsets are always sorted using \texttt{CGAL::spatial\_sort} before constructing Delaunay triangulations on them. We share the implementations via \textsf{GitHub}\footnote{\url{https://github.com/ghoshanirban/BoundedDegreePlaneSpannersCppCode}}. In our experiments, we have used both synthetic and real-world pointsets, as described next. \subsection{Synthetic pointsets} We have used the following eight distributions to generate synthetic pointsets for our experiments. The selection of these distributions are inspired by the ones used in \cite{narasimhan2001geometric, ghosh2019unit,bentley1990k,FriederichUDC} for geometric experiments. See Figure~\ref{fig:dist} to visualize these eight distributions. \begin{figure}[H] \centering \begin{minipage}{\linewidth} \begin{subfigure}[b]{0.27\linewidth} \centering \resizebox{0.65\linewidth}{!}{\includegraphics{ex-pis}} \caption{\texttt{uni-square}} \end{subfigure} \hfill \begin{subfigure}[b]{0.22\linewidth} \centering \resizebox{0.77\linewidth}{!}{\includegraphics{ex-pid}} \caption{\texttt{uni-disk}} \end{subfigure} \hfill \begin{subfigure}[b]{0.28\linewidth} \centering \resizebox{0.75\linewidth}{!}{\includegraphics{ex-norm-clus}} \caption{\texttt{normal-clustered}} \end{subfigure} \hfill \begin{subfigure}[b]{0.20\linewidth} \centering \resizebox{0.75\linewidth}{!}{\includegraphics{ex-normal}} \caption{\texttt{normal}} \end{subfigure} \end{minipage} \vspace{1em} \begin{minipage}{\linewidth} \begin{subfigure}[b]{0.27\linewidth} \centering \resizebox{0.6\linewidth}{!}{\includegraphics{ex-grid-cont}} \caption{\texttt{grid-contiguous}} \end{subfigure} \hfill \begin{subfigure}[b]{0.22\linewidth} \centering \resizebox{0.75\linewidth}{!}{\includegraphics{ex-grid-rand}} \caption{\texttt{grid-random}} \end{subfigure} \hfill \begin{subfigure}[b]{0.28\linewidth} \centering \resizebox{0.67\linewidth}{!}{\includegraphics{ex-ann}} \caption{\texttt{annulus}} \end{subfigure} \hfill \begin{subfigure}[b]{0.20\linewidth} \centering \resizebox{0.85\linewidth}{!}{\includegraphics{ex-galaxy}} \caption{\texttt{galaxy}} \end{subfigure} \end{minipage} \caption{The eight distributions used to generate synthetic pointsets for our experiments.} \label{fig:dist} \end{figure} \begin{enumerate}[label=(\alph*)]\itemsep0pt \item \texttt{uni-square}. Points are generated uniformly inside a square of side length of $1000$ using the \texttt{CGAL::Random\_points\_in\_square\_2} generator. \item \texttt{uni-disk}. Points are generated uniformly inside a disc of radius $1000$ using the \\ \texttt{CGAL::Random\_points\_in\_disc\_2} generator. \item \texttt{normal-clustered}. A set of $10$ normally distributed clusters placed randomly in the plane. Each cluster contains $n/10$ normally distributed points (mean and standard-deviation are set to $2.0$). We have used \texttt{std::normal\_distribution<double>} to generate the point coordinates. \item \texttt{normal}. This is same as \texttt{normal-clustered} except that only one cluster is used. \item \texttt{grid-contiguous}. Points are generated contiguously on a $\lceil\sqrt{n}\rceil \times \lceil \sqrt{n} \rceil$ square grid using the \texttt{CGAL::points\_on\_square\_grid\_2} generator. \item \texttt{grid-random}. Points are generated on a $\lceil 0.7n \rceil \times \lceil 0.7n \rceil$ unit square grid. The value $0.7$ is chosen arbitrarily to obtain well-separated non-contiguous grid points. The coordinates of the generated points are integers and are generated independently using \texttt{std::uniform\_int\_distribution}. \item \texttt{annulus}. Points are generated inside an annulus whose outer radius is set to $1000$ and the inner-radius is set to $800$. The coordinates are generated using \texttt{std::uniform\_real\_distribution}. \item \texttt{galaxy}. Points are generated in the shape of a spiral galaxy having outer five arms; see \cite{itinerantgames_2014}. \end{enumerate} For seeding the random number generators from \textsf{C}\texttt{++}, we have used the Mersenne twister engine \texttt{std::mt19937}. Since some of the algorithms assume that no two points must have the same value $x$ or $y$-coordinates, the generated pointsets have been perturbed using the \texttt{CGAL::perturb\_points\_2} function with $0.0001, 0.0001$ as the two required parameters. \subsection{Real-world pointsets} The following real-world pointsets are obtained from various publicly available sources. We have removed duplicate points (wherever present) from the pointsets. The main reason behind the use of such pointsets is that they do not follow the popular synthetic distributions. Hence, experimenting with them is beneficial to see how the algorithms perform on them. \begin{itemize}\itemsep0pt \item \texttt{burma}~\cite{tsp}. An $33,708$-element pointset representing cities in Burma. \item \texttt{birch3}~\cite{bus2018practical,ghosh2019unit}. An $99,801$-element pointset representing random clusters at random locations. \item \texttt{monalisa}~\cite{tsp,ghosh2019unit}: A $100,000$-city TSP instance representing a continuous-line drawing of the Mona Lisa. \item \texttt{KDDCU2D}~\cite{bus2018practical,ghosh2019unit}. An $104,297$-element pointset representing the first two dimensions of a protein data-set. \item \texttt{usa}~\cite{tsp,ghosh2019unit}. A $115,475$-city TSP instance representing (nearly) all towns, villages, and cities in the United States. \item \texttt{europe}~\cite{bus2018practical,ghosh2019unit}. An $168,896$-element pointset representing differential coordinates of the map of Europe. \item \texttt{wiki}\footnote{\url{ https://github.com/placemarkt/wiki_coordinates}}. An $317,695$-element pointset of coordinates found in English-language Wikipedia articles. \item \texttt{vlsi}~\cite{tsp}. An $744,710$-element pointset representing a Very Large Scale Integration chip. \item \texttt{china}~\cite{bus2018practical,ghosh2019unit}. An $808,693$-element pointset representing cities in China. \item \texttt{uber}\footnote{\url{https://www.kaggle.com/fivethirtyeight/uber-pickups-in-new-york-city}}. An $1,381,253$-element pointset representing Uber pickup locations in New York City. \item \texttt{world}~\cite{tsp,ghosh2019unit}. An $1,904,711$-element pointset representing all locations in the world that are registered as populated cities or towns, as well as several research bases in Antarctica. \end{itemize} \subsection{Efficacy of \textsc{AppxStretchFactor}} \label{subsec:appx} We have seen in Section~\ref{chap:stretchfactor}, it is quite challenging to measure stretch factor of large spanners. This motivated us to design and use the \textsc{AppxStretchFactor} algorithm in our experiments for estimating stretch factors of the generated spanners. In the following, we compare \textsc{AppxStretchFactor} with the Dijkstra's algorithm (run from every vertex) and show that for the eight distributions it is not only much faster than Dijkstra but can also estimate stretch factors of plane spanners with high accuracy. The main reason behind the fast practical performance of \textsc{AppxStretchFactor} is early terminations of the breadth-first traversals (one traversal per vertex), which in turn makes Dijkstra run fast to find the shortest paths to the vertices in all the levels. We have noticed in our experiments that the pair that achieves the stretch factor for a bounded-degree plane spanner are typically a few hops away and pairwise stretch factors (ratio of detour between two vertices to that of their Euclidean distance) drop with the increase in hops. Consequently, the breadth-first traversals terminate very early most of the time. The total number of pointsets used in this comparison experiment is $11 \cdot 8 \cdot 10 \cdot 5 = 4400$ since there are $11$ algorithms, $8$ distributions, $10$ distinct values of $n~ (1K, 2K, . . . , 10K)$, and $5$ samples were used for every value of $n$. Out of these many, the number of times \textsc{AppxStretchFactor} has failed to return the exact stretch factor is just $8$. So, the observed failure rate is $\approx 0.18\%$. Interestingly, in the cases where \textsc{AppxStretchFactor} failed to compute the exact stretch factor, the largest observed error percentage between the exact stretch factor (found using Dijkstra) and the stretch factor returned by it is just $\approx 0.15$. This gives us the confidence that our algorithm can be safely used to estimate stretch factor of large spanners. Refer to the Figure~\ref{fig:sfcomp}. As evident from these graphs, \textsc{AppxStretchFactor} is substantially faster than Dijkstra everywhere. Henceforth, we use \textsc{AppxStretchFactor} (Algorithm~\ref{alg:approximatesf}) to estimate the stretch factors of the spanners in our experiments. \subsection{Experimental comparison of the algorithms} \label{chap:results} We compare the $11$ implemented algorithms based on their runtimes and degree, stretch factor, and lightness\footnote{The \emph{lightness} of a geometric graph $G$ on a pointset $P$ is defined as ratio of the weight of $G$ to that of a Euclidean minimum spanning tree on $P$.} of the generated spanners. In the interest of space, we avoid legend tables everywhere in our plots. Since the legends are used uniformly everywhere, we present them here for an easy reference; see Fig.~\ref{fig:legends}. \begin{figure}[H] \centering \includegraphics[scale=1]{legends.pdf} \caption{The plot legends.} \label{fig:legends} \end{figure} For synthetic pointsets, we vary $n$ from $10K$ to $100K$. For every value of $n$, we have used five random samples to measure runtimes and the above characteristics of the spanners. In the case of real-world pointsets, we run every one of them five times and report the average time taken. \begin{figure}[H] \centering \includegraphics[scale=0.7]{slowDemo.pdf} \caption{Points are generated using the \texttt{uni-square} distribution. For this particular experiment, $n$ is in the range $10K, 20K,\ldots,100K$. The plots for \texttt{BGHP10} and \texttt{KPT17} have overlapped in this figure.} \label{fig:slowDemo} \end{figure} In our experiments, we find that \texttt{BGHP10} and \texttt{KPT17} are considerably slower than the other algorithms considered in this work. The reason behind this is slow construction of $TD$-Delaunay triangulations. Refer to Fig.~\ref{fig:legends} for an illustration. When $n=100K$, both take more than $150$ seconds to finish. In contrast, other nine algorithms take less than $10$ seconds. Since real-world speed is an important factor for spanner construction algorithms, we do not consider them further in our runtime comparisons. \begin{enumerate} \item \textit{Runtime}. Fast execution speed is highly desired for spanner construction on large pointsets. We present the runtimes for all eight distributions in the Fig.~\ref{fig:runtimePlots}. As explained above, we have excluded \texttt{BGHP10} and \texttt{KPT17} from these plots since they are considerably slower than the other nine algorithms. Interestingly, we find that the relative performance of these algorithms is independent of the point distributions. For all the eight distributions, we find that \texttt{BKPX15} is much slower than the others. This is mainly due to the time taken to construct $L_\infty$-Delauanay triangulations. Among the ones that use $L_2$-Delauanay triangulations, \texttt{BGS05} is the slowest due to the overhead of creation of temporary geometric graphs needed to control the degree and stretch-factor of the ouput spanners. Refer to Section~\ref{chap:algorithms} to see more details on this algorithm. The fastest algorithms are \texttt{KPX10}, \texttt{BSX09}, \texttt{LW04}, and \texttt{KX12}. The main reason behind their speedy performance is fast construction of $L_2$-Delaunay triangulations and lightweight processing of the triangulations for spanner construction. The \texttt{BHS18}, \texttt{BCC12-7}, and \texttt{BCC12-6} algorithms came out quite close the above four algorithms. Note that these three algorithms also use $L_2$-Delaunay triangulation as the starting point. The same observations hold for the real-world pointsets used in our experiments. See the table presented in Fig.~\ref{fig:realworld-time} for the runtimes in seconds. \item \textit{Degree}. Refer to Fig.~\ref{fig:degree}. In the tables, $\Delta$ denotes the theoretical degree upper bound, as claimed by the authors of these algorithms, max $\Delta_{\text{observed}}$ denotes the maximum degree observed in our experiments, avg $\Delta_{\text{observed}}$ denotes the observed average degree, and avg $\Delta_{\text{vertex}}$ denotes the observed average degree per vertex. In our experiments, we find that spanners generated by \texttt{BGS05}, \texttt{LW04}, and \texttt{BSX09} have degrees much less than the degree upper-bounds derived by the authors. While it cannot be denied that there could be special examples where these upper-bounds are actually achieved, the maximum degrees achieved in our experiments are $14$, $11$, and $9$, respectively. Note that the theoretical degree upper bounds are $27$, $23$, and $17$, respectively. For the remaining eight algorithms, the claimed degree upper-bounds are achieved in our experiments thereby showing the analyses obtained by the authors of those algorithms are tight. However, the degree bound claimed by the authors of \texttt{BCC12-6} appears incorrect. We present an example in the Appendix (Section~\ref{chap:bcc_bad}) where the degree of the spanner generated by this algorithm exceeds $6$ (in fact, it is $7$ in this example). For every algorithm, we find that the average degree of the generated spanners is not far away from the maximum observed degrees. It shows that the algorithms are consistent in constructing the spanners. The average degree per vertex is another way to judge the quality of the spanners. In this regard, we find that it is always between $6$ and $3$ everywhere and is quite reasonable for practical purposes. This shows that all these algorithms are very careful when it comes to the selection of spanner edges. The lowest values are achieved by \texttt{BKPX15} and \texttt{KPT17}. For the real-world pointsets, we find similar performance from the algorithms when it comes to the degree and degree per vertex of the spanners. This is quite surprising since these real-world pointsets do not follow specific distributions. Refer to Figs.~\ref{fig:realworld-degree} and \ref{fig:realworld-degpervertex} for more details. Note that \texttt{BSG05} has produced a degree-$15$ spanner for the \texttt{vlsi} pointset. In contrast, for the synthetic pointsets the highest degree we could observe is $14$. \item \textit{Stretch factor}. Refer to Fig.~\ref{fig:sf-lightness}. In the tables, $t$ denotes the theoretical stretch factor, as derived by the authors of these algorithms; $t_\text{max}$ denotes the maximum stretch factor observed in our experiments, and $t_\text{avg}$ denotes the average observed stretch factor. Among the eleven algorithms, \texttt{KPX10} has the lowest guaranteed stretch factor - it is $2.9$. The stretch factors of the spanners generated by \texttt{KPX10} are always less than $1.6$, thereby making it the best among the eleven algorithms in terms of stretch factor. In this regard, \texttt{BKPX15} turned out to be the worst; the largest stretch factor we have observed is $7.242$, although it is substantially less than the theoretical stretch factor upper bound of $156.8$. Its competitor \texttt{KPX17} that can also generate degree-$4$ plane spanners has a lower observed maximum stretch factor - it is $5.236$ (theoretical upper bound is $20$ for this algorithm). Overall, we find that the stretch factors of the generated spanners are much less than the claimed theoretical upper bounds. This shows that the generated spanners are well-constructed in practice. With the exception of \texttt{BKPX15}, we find that the average stretch factors are quite close to the maximum stretch factors. Now let us turn our attention to the real-world pointsets. Refer to Fig.~\ref{fig:realworld-sf}. Once again \texttt{KPX10} produced lowest stretch factor spanners. The stretch factors seem quite reasonable everywhere except the two cases of \texttt{vlsi} and \texttt{uber} pointsets when fed to \texttt{BKPX15}. The produced spanners have stretch factors of $11.535$ and $27.929$, respectively. The later is interesting since the lower bound example constructed by the authors in \cite{bonichon2015there} for the worst-case stretch factor of the spanners produced by \texttt{BKPX15} has a stretch factor of $7+7\sqrt{2} \approx 16.899$. The \texttt{uber} pointset beats this lower bound. \item \textit{Lightness}. Since a minimum spanning tree is the cheapest (in terms of the sum of the total length of the edges) way to connect $n$ points, lightness can be used to judge the quality of spanners. This metric is beneficial when spanners are used for constructing computer or transportation networks. Refer to Fig.~\ref{fig:sf-lightness}. Lightness is denoted by $\ell$. With a few exceptions, we find that lightness somewhat correlates with degree. This is because using a lower number of carefully placed spanner edges usually leads to lower lightness. The spanners generated by \texttt{BGS05} are always found to have the highest lightness. This is expected because of their high degrees. Although, the difference in degree of the spanners generate by \texttt{BGXS05} and \texttt{LW04} is marginal (around $2$), the difference between their lightness is substantial (approximately $6$ for some cases). On the other hand, the degree-$4$ spanners generated by \texttt{KPT17} have the lowest lightnesses (less than $2.9$ everywhere). Interestingly, although \texttt{BKPX15} generates degree-$4$ spanners, their lightness is found to be approximately twice that of the ones generated by \texttt{KPT17}. In fact, their lightness turned out to be one of the highest. This shows that \texttt{KPT17} is more careful when it comes to placing long edges. The lightnesses of the spanners generated for real-world pointsets follow a similar trend, and we did not observe anything special. Refer to Fig.~\ref{fig:realworld-lightness} for more details. \end{enumerate} \textbf{Remark.} In our experiments, we find that the spanners' degree, stretch factor, and lightness remained somewhat constant with the increase in $n$. Hence, we do not present plots for them. \section{Conclusions} \label{chap:conclusion} Since there are various ways (speed, degree, stretch factor, lightness) to judge the eleven algorithms, it is hard to declare the winner(s). So, based on our experimental observations, we come to the following conclusions (are our recommendations as well): \begin{itemize}\itemsep0pt \item If speedy performance is the main concern, we recommend using \texttt{KPX10}, \texttt{BSX09}, \texttt{LW04}, or \texttt{KX12}. \item When it comes to minimization of degree, we recommend using \texttt{BCC12-7} or \texttt{BHS18} since they produce spanners of reasonable degrees in practice. If degree-$4$ spanners are desired, we recommend using \texttt{BKPX15} since \texttt{KPT17} is much slower in practice. \item In terms of stretch factor, we find the \texttt{KPX10} as the clear winner. This is particularly important in the study of geometric spanners since not much is known about fast construction of low stretch factor spanners ($t \approx 1.6$) in the plane having at most $3n$ edges. However, the spanners produced by it have higher degrees compared to the ones produced by some of the other algorithms such as \texttt{BCC12} and \texttt{BHS18}. \item In our experiments, \texttt{KPT17} produced spanners with the lowest lightnesses. But in practice, we found it to be very slow compared to the other algorithms except for \texttt{BGHP10} (which is as slow as \texttt{KPT17}). If degree-$4$ spanners is not a requirement, we recommend using \texttt{BHS18} or \texttt{BCC12-7} since they produced spanners of reasonable lightness (less than $4$ most of the times). \end{itemize} \textbf{Acknowledgment.} We sincerely thank Nicolas Bonichon (one of the authors of \texttt{BKPX15}) for sharing the applet code for the algorithm \texttt{BKPX15}~\cite{bonichon2015there}. The code has helped us to understand the algorithm clearly and create a \textsf{CGAL} implementation of the algorithm. \clearpage \begin{figure}[ht!] \begin{center} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-UniformInsideSquare.pdf} \caption{\texttt{uni-square}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-UniformInsideDisc.pdf} \caption{\texttt{uni-disk}} \end{subfigure} \vspace{2mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-NormalInsideSquarewithClusters.pdf} \caption{\texttt{normal-clustered}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-NormalInsideSquare.pdf} \caption{\texttt{normal}} \end{subfigure} \vspace{2mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-ContiguousGrid.pdf} \caption{\texttt{grid-contiguous}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-UniformRandomGrid.pdf} \caption{\texttt{grid-random}} \end{subfigure} \vspace{2mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-UniformInsideAnnulus.pdf} \caption{\texttt{annulus}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=1]{sfcomparison-Galaxy.pdf} \caption{\texttt{galaxy}} \end{subfigure} \caption{Runtime comparison: \text{Dijkstra} (run from every vertex) vs \textsc{AppxStretchFactor}. For every value of $n$, we have used $11 \cdot 5 = 55$ spanner samples since there are $11$ algorithms and $5$ pointsets were generated for that value of $n$ using the same distribution.} \label{fig:sfcomp} \end{center} \end{figure} \begin{figure} \begin{center} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-UniformInsideSquare-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{uni-square}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-UniformInsideDisc-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{uni-disk}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-NormalInsideSquareWithClusters-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{normal-clustered}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-NormalInsideSquare-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{normal}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-ContiguousGrid-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{grid-contiguous}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-UniformRandomGrid-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{grid-random}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-UniformInsideAnnulus-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{annulus}} \end{subfigure} \hspace{8mm} \begin{subfigure}{0.35\textwidth} \centering \includegraphics[scale=0.7]{document-plot-Galaxy-nonTD-runtime_body.pdf} \vspace{-8pt} \caption{\texttt{galaxy}} \end{subfigure} \caption{Runtime comparisons of the nine algorithms (\texttt{BGHP10} and \texttt{KPT17} are excluded). } \label{fig:runtimePlots} \end{center} \end{figure} \begin{figure} \begin{center} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideSquare-degree_body.pdf} \caption{\texttt{uni-square}} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideDisc-degree_body.pdf} \caption{\texttt{uni-disk}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-NormalInsideSquarewithClusters-degree_body.pdf} \caption{\texttt{normal-clustered}} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-NormalInsideSquare-degree_body.pdf} \caption{\texttt{normal}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-ContiguousGrid-degree_body.pdf} \caption{\texttt{grid-contiguous}} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformRandomGrid-degree_body.pdf} \caption{\texttt{grid-random}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideAnnulus-degree_body.pdf} \caption{\texttt{annulus}} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-Galaxy-degree_body.pdf} \caption{\texttt{galaxy}} \end{subfigure} \caption{Degree comparisons of the spanners generated by the eleven algorithms.} \label{fig:degree} \end{center} \end{figure} \begin{figure} \begin{center} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideSquare-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-UniformInsideSquare-lightness_body.pdf} \caption{\texttt{uni-square}} \end{subfigure} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideDisc-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-UniformInsideDisc-lightness_body.pdf} \caption{\texttt{uni-disk}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-NormalInsideSquarewithClusters-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-NormalInsideSquarewithClusters-lightness_body.pdf} \caption{\texttt{normal-clustered}} \end{subfigure} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-NormalInsideSquare-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-NormalInsideSquare-lightness_body.pdf} \caption{\texttt{normal}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-ContiguousGrid-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-ContiguousGrid-lightness_body.pdf} \caption{\texttt{grid-contiguous}} \end{subfigure} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformRandomGrid-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-UniformRandomGrid-lightness_body.pdf} \caption{\texttt{grid-random}} \end{subfigure} \vspace{5mm} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-UniformInsideAnnulus-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-UniformInsideAnnulus-lightness_body.pdf} \caption{\texttt{annulus}} \end{subfigure} \begin{subfigure}{0.45\textwidth} \centering \includegraphics[scale=0.7]{document-table-summary-Galaxy-sf_body.pdf}~~~\includegraphics[scale=0.7]{document-table-summary-Galaxy-lightness_body.pdf} \caption{\texttt{galaxy}} \end{subfigure} \caption{Stretch-factor and lightness comparisons of the spanners generated by the eleven algorithms.} \label{fig:sf-lightness} \end{center} \end{figure} \begin{figure} \centering \small \rowcolors{1}{ffffff}{cccccc} { \tiny \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Pointset & $n$ & \texttt{BGS05} & \texttt{LW04} & \texttt{BSX09} & \texttt{KPX10} & \texttt{KX12} & \texttt{BHS18} & \texttt{BCC12-7} & \texttt{BCC12-6} & \texttt{BGHP10} & \texttt{BKPX15} & \texttt{KPT17} \\ \hline \hline $\texttt{burma}$ & $33708\mathrm{}$ &$2.888$ &$0.711$ &$0.627$ &$0.599$ &$0.832$ &$1.101$ &$1.569$ &$1.549$ &$173.528$ &$5.885$ &$173.447$ \\ $\texttt{birch3}$ & $99801\mathrm{}$ &$9.700$ &$2.459$ &$2.139$ &$2.117$ &$3.001$ &$4.458$ &$5.188$ &$5.079$ &$640.619$ &$20.003$ &$641.839$ \\ $\texttt{mona-lisa}$ & $100000$ &$8.527$ &$2.450$ &$2.127$ &$2.236$ &$3.189$ &$4.960$ &$5.863$ &$5.588$ &$704.980$ &$27.988$ &$706.000$ \\ $\texttt{KDDCU2D}$ & $104297$ &$10.024$ &$2.579$ &$2.252$ &$2.250$ &$3.146$ &$4.837$ &$5.569$ &$5.460$ &$811.921$ &$21.424$ &$812.665$ \\ $\texttt{usa}$ & $115475$ &$10.575$ &$2.878$ &$2.497$ &$2.521$ &$3.559$ &$5.600$ &$6.426$ &$6.258$ &$1033.99$ &$35.769$ &$1035.64$ \\ $\texttt{europe}$ & $168896$ &$15.516$ &$4.520$ &$3.985$ &$3.968$ &$5.685$ &$8.386$ &$9.402$ &$9.230$ &$1494.69$ &$39.133$ &$1497.09$ \\ $\texttt{wiki}$ & $317695$ &$35.374$ &$9.041$ &$7.687$ &$8.004$ &$11.432$ &$17.274$ &$18.105$ &$17.794$ &$3507.06$ &$98.975$ &$3510.20$ \\ $\texttt{vsli}$ & $744710$ &$81.461$ &$21.655$ &$19.457$ &$19.693$ &$28.165$ &$46.630$ &$47.297$ &$46.183$ &$13296.6$ &$509.795$ &$13312.2$ \\ $\texttt{china}$ & $808693$ &$91.243$ &$24.078$ &$21.642$ &$21.775$ &$30.793$ &$52.637$ &$54.367$ &$53.029$ &$17028.4$ &$451.383$ &$17057.3$ \\ $\texttt{uber}$ & $1381253$ &$170.493$ &$42.199$ &$38.227$ &$38.268$ &$54.486$ &$89.577$ &$94.444$ &$92.359$ &$29584.6$ &$1689.042$ &$29633.1$ \\ $\texttt{world}$ & $1904711$ &$259.147$ &$57.657$ &$52.078$ &$52.337$ &$74.570$ &$125.078$ &$128.316$ &$125.787$ &$58707.7$ &$1358.70$ &$58780.3$ \\ \hline \end{tabular} } \caption{Average execution time (in seconds).} \label{fig:realworld-time} \end{figure} \begin{figure} \centering \rowcolors{1}{ffffff}{cccccc} {\tiny \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Pointset & $n$ & \texttt{BGS05} & \texttt{LW04} & \texttt{BSX09} & \texttt{KPX10} & \texttt{KX12} & \texttt{BHS18} & \texttt{BCC12-7} & \texttt{BCC12-6} & \texttt{BGHP10} & \texttt{BKPX15} & \texttt{KPT17} \\ \hline \hline $\texttt{burma}$ & $33708\mathrm{}$ &$11$ &$10$ &$8$ &$14$ &$11$ &$6$ &$7$ &$6$ &$6$ &$4$ &$4$ \\ $\texttt{birch3}$ & $99801\mathrm{}$ &$13$ &$10$ &$8$ &$13$ &$11$ &$6$ &$7$ &$6$ &$6$ &$4$ &$4$ \\ $\texttt{mona-lisa}$ & $100000$ &$11$ &$8$ &$8$ &$12$ &$10$ &$7$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ $\texttt{KDDCU2D}$ & $104297$ &$13$ &$10$ &$8$ &$14$ &$10$ &$6$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ $\texttt{usa}$ & $115475$ &$12$ &$10$ &$8$ &$14$ &$11$ &$7$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ $\texttt{europe}$ & $168896$ &$12$ &$10$ &$8$ &$13$ &$10$ &$6$ &$7$ &$6$ &$6$ &$4$ &$4$ \\ $\texttt{wiki}$ & $317695$ &$14$ &$10$ &$9$ &$14$ &$11$ &$7$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ $\texttt{vsli}$ & $744710$ &$15$ &$11$ &$9$ &$14$ &$10$ &$7$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ $\texttt{china}$ & $808693$ &$13$ &$11$ &$9$ &$14$ &$11$ &$7$ &$7$ &$6$ &$6$ &$4$ &$4$ \\ $\texttt{uber}$ & $1381253$ &$13$ &$11$ &$9$ &$14$ &$10$ &$7$ &$7$ &$6$ &$6$ &$4$ &$4$ \\ $\texttt{world}$ & $1904711$ &$14$ &$11$ &$9$ &$14$ &$11$ &$7$ &$7$ &$7$ &$6$ &$4$ &$4$ \\ \hline \end{tabular} } \caption{Degree of the spanners.} \label{fig:realworld-degree} \end{figure} \begin{figure} \centering \rowcolors{1}{ffffff}{cccccc} {\tiny \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Pointset & $n$ & \texttt{BGS05} & \texttt{LW04} & \texttt{BSX09} & \texttt{KPX10} & \texttt{KX12} & \texttt{BHS18} & \texttt{BCC12-7} & \texttt{BCC12-6} & \texttt{BGHP10} & \texttt{BKPX15} & \texttt{KPT17} \\ \hline \hline $\texttt{burma}$ & $33708\mathrm{}$ &$5.761$ &$5.192$ &$4.454$ &$5.994$ &$5.512$ &$4.166$ &$4.292$ &$4.068$ &$4.347$ &$3.346$ &$3.187$ \\ $\texttt{birch3}$ & $99801\mathrm{}$ &$5.745$ &$5.149$ &$4.417$ &$5.995$ &$5.429$ &$4.081$ &$4.287$ &$3.970$ &$4.222$ &$3.327$ &$3.130$ \\ $\texttt{mona-lisa}$ & $100000$ &$5.938$ &$5.596$ &$4.617$ &$5.996$ &$5.981$ &$5.259$ &$5.741$ &$5.165$ &$5.434$ &$3.572$ &$3.613$ \\ $\texttt{KDDCU2D}$ & $104297$ &$5.720$ &$5.127$ &$4.399$ &$5.985$ &$5.390$ &$4.047$ &$4.294$ &$4.015$ &$4.216$ &$3.325$ &$3.122$ \\ $\texttt{usa}$ & $115475$ &$5.761$ &$5.208$ &$4.447$ &$5.993$ &$5.529$ &$4.248$ &$4.493$ &$4.132$ &$4.398$ &$3.366$ &$3.211$ \\ $\texttt{europe}$ & $168896$ &$5.745$ &$5.160$ &$4.427$ &$5.997$ &$5.438$ &$4.090$ &$4.310$ &$3.991$ &$4.234$ &$3.325$ &$3.135$ \\ $\texttt{wiki}$ & $317695$ &$5.679$ &$5.061$ &$4.379$ &$5.987$ &$5.333$ &$3.931$ &$4.016$ &$3.732$ &$4.070$ &$3.308$ &$3.016$ \\ $\texttt{vsli}$ & $744710$ &$5.749$ &$5.152$ &$4.416$ &$5.994$ &$5.438$ &$4.096$ &$4.334$ &$4.007$ &$4.277$ &$3.316$ &$3.176$ \\ $\texttt{china}$ & $808693$ &$5.770$ &$5.209$ &$4.437$ &$5.996$ &$5.519$ &$4.245$ &$4.506$ &$4.154$ &$4.368$ &$3.344$ &$3.208$ \\ $\texttt{uber}$ & $1381253$ &$5.742$ &$5.147$ &$4.394$ &$5.996$ &$5.437$ &$4.086$ &$4.288$ &$3.968$ &$4.232$ &$3.326$ &$3.130$ \\ $\texttt{world}$ & $1904711$ &$5.748$ &$5.171$ &$4.438$ &$5.991$ &$5.489$ &$4.151$ &$4.371$ &$4.020$ &$4.318$ &$3.344$ &$3.168$ \\ \hline \end{tabular} } \caption{Average degree per vertex.} \label{fig:realworld-degpervertex} \end{figure} \begin{figure} \centering \rowcolors{1}{ffffff}{cccccc} {\tiny \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Pointset & $n$ & \texttt{BGS05} & \texttt{LW04} & \texttt{BSX09} & \texttt{KPX10} & \texttt{KX12} & \texttt{BHS18} & \texttt{BCC12-7} & \texttt{BCC12-6} & \texttt{BGHP10} & \texttt{BKPX15} & \texttt{KPT17} \\ \hline \hline $\texttt{burma}$ & $33708\mathrm{}$ &$2.414$ &$2.414$ &$3.681$ &$1.482$ &$1.738$ &$2.856$ &$2.156$ &$2.162$ &$3.161$ &$4.404$ &$4.409$ \\ $\texttt{birch3}$ & $99801\mathrm{}$ &$2.233$ &$2.234$ &$3.520$ &$1.481$ &$1.923$ &$2.719$ &$2.318$ &$2.460$ &$2.933$ &$3.624$ &$4.102$ \\ $\texttt{mona-lisa}$ & $100000$ &$2.523$ &$2.237$ &$3.373$ &$1.413$ &$1.609$ &$2.872$ &$1.778$ &$2.278$ &$2.872$ &$4.190$ &$3.768$ \\ $\texttt{KDDCU2D}$ & $104297$ &$2.211$ &$2.435$ &$3.953$ &$1.492$ &$2.068$ &$2.937$ &$2.174$ &$2.603$ &$2.937$ &$4.299$ &$4.218$ \\ $\texttt{usa}$ & $115475$ &$2.300$ &$2.351$ &$3.564$ &$1.480$ &$2.038$ &$2.765$ &$2.241$ &$2.576$ &$3.430$ &$3.740$ &$4.455$ \\ $\texttt{europe}$ & $168896$ &$2.245$ &$2.343$ &$4.072$ &$1.459$ &$1.840$ &$2.745$ &$2.310$ &$2.659$ &$2.981$ &$4.081$ &$4.121$ \\ $\texttt{wiki}$ & $317695$ &$2.408$ &$2.421$ &$3.926$ &$1.458$ &$1.978$ &$2.757$ &$2.350$ &$2.610$ &$3.222$ &$4.353$ &$4.017$ \\ $\texttt{vsli}$ & $744710$ &$2.468$ &$2.999$ &$3.650$ &$1.471$ &$1.970$ &$2.942$ &$2.355$ &$2.263$ &$3.521$ &$11.535$ &$5.472$ \\ $\texttt{china}$ & $808693$ &$2.478$ &$2.421$ &$4.082$ &$1.511$ &$2.055$ &$2.731$ &$2.237$ &$2.711$ &$2.981$ &$4.061$ &$4.506$ \\ $\texttt{uber}$ & $1381253$ &$2.535$ &$2.418$ &$3.987$ &$1.485$ &$2.204$ &$2.902$ &$2.407$ &$2.816$ &$3.073$ &$27.929$ &$4.966$ \\ $\texttt{world}$ & $1904711$ &$2.989$ &$2.961$ &$4.228$ &$1.522$ &$1.997$ &$3.056$ &$2.357$ &$2.657$ &$3.545$ &$6.140$ &$5.422$ \\ \hline \end{tabular}} \caption{Stretch factor of the spanners.} \label{fig:realworld-sf} \end{figure} \begin{figure} \centering \rowcolors{1}{ffffff}{cccccc} {\tiny \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline Pointset & $n$ & \texttt{BGS05} & \texttt{LW04} & \texttt{BSX09} & \texttt{KPX10} & \texttt{KX12} & \texttt{BHS18} & \texttt{BCC12-7} & \texttt{BCC12-6} & \texttt{BGHP10} & \texttt{BKPX15} & \texttt{KPT17} \\ \hline \hline $\texttt{burma}$ & $33708\mathrm{}$ &$10.755$ &$4.538$ &$3.768$ &$5.672$ &$4.922$ &$3.374$ &$3.609$ &$3.365$ &$3.620$ &$5.048$ &$2.345$ \\ $\texttt{birch3}$ & $99801\mathrm{}$ &$11.008$ &$4.660$ &$3.845$ &$5.805$ &$4.989$ &$3.453$ &$3.770$ &$3.434$ &$3.699$ &$5.124$ &$2.426$ \\ $\texttt{mona-lisa}$ & $100000$ &$7.070$ &$3.259$ &$2.656$ &$3.574$ &$3.542$ &$3.012$ &$3.326$ &$2.934$ &$3.147$ &$3.934$ &$1.994$ \\ $\texttt{KDDCU2D}$ & $104297$ &$10.576$ &$4.491$ &$3.719$ &$5.605$ &$4.830$ &$3.316$ &$3.670$ &$3.355$ &$3.511$ &$4.954$ &$2.311$ \\ $\texttt{usa}$ & $115475$ &$10.264$ &$4.427$ &$3.663$ &$5.431$ &$4.753$ &$3.336$ &$3.642$ &$3.305$ &$3.602$ &$4.935$ &$2.336$ \\ $\texttt{europe}$ & $168896$ &$10.136$ &$4.365$ &$3.593$ &$5.395$ &$4.736$ &$3.274$ &$3.588$ &$3.233$ &$3.428$ &$4.746$ &$2.254$ \\ $\texttt{wiki}$ & $317695$ &$12.137$ &$5.087$ &$4.227$ &$6.555$ &$5.385$ &$3.607$ &$3.877$ &$3.525$ &$3.860$ &$5.477$ &$2.481$ \\ $\texttt{vsli}$ & $744710$ &$11.344$ &$4.850$ &$4.024$ &$5.989$ &$5.110$ &$3.521$ &$3.899$ &$3.539$ &$3.864$ &$5.130$ &$2.513$ \\ $\texttt{china}$ & $808693$ &$9.918$ &$4.304$ &$3.531$ &$5.232$ &$4.605$ &$3.286$ &$3.594$ &$3.247$ &$3.445$ &$4.719$ &$2.263$ \\ $\texttt{uber}$ & $1381253$ &$11.225$ &$4.497$ &$4.291$ &$5.900$ &$5.424$ &$2.797$ &$2.843$ &$2.888$ &$3.015$ &$4.584$ &$1.861$ \\ $\texttt{world}$ & $1904711$ &$11.145$ &$4.744$ &$3.923$ &$5.917$ &$5.003$ &$3.476$ &$3.777$ &$3.432$ &$3.967$ &$5.272$ &$2.541$ \\ \hline \end{tabular} } \caption{Lightness of the spanners.} \label{fig:realworld-lightness} \end{figure} \newpage \clearpage \bibliographystyle{spmpsci.bst}
\section{\label{sec1}Introduction} Silicon (Si) grown in the diamond structure is the key material of modern micro- and nano-electronic devices and integrated circuits. However, it is an indirect semiconductor, like other group-IV elements as germanium (Ge). Active optoelectronic devices, such as light-emitting diodes and lasers, cannot be produced using Si and Ge \cite{Soref:1993:InProc,Zimmermann:2010:Book}. Therefore, optical intrachip communication cannot be realized within the Si-based CMOS technology, that avoids the combination with III-V compounds, because of possible unintentional doping. The semiconductor Ge possesses a direct gap only slightly above the indirect gap energy \cite{NSMArchive:html}. Various strategies to make Ge a direct-gap semiconductor, therefore suitable for Ge-on-Si optoelectronics, have been explored \cite{Liu.ea:2012:TSF}. One favored manipulation of Ge is the application of uniaxial or biaxial strains \cite{Zhang.Crespi.ea:2009:PRL,Saladukha.Clavel.ea:2018:PRB,Jung.ea:OE:2021,Mellaerts.Afanasaev.ea:2021:AAMI}. Another approach is the use of hexagonal polytypes $n$H ($n=2,4,6$) \cite{Raffy.Furthmueller.ea:2002:PRB}, in particular the 2H crystal structure, also called lonsdaleite, of Si \cite{Roedl.Sander.ea:2015:PRB} and Ge \cite{Roedl.Furthmueller.ea:2019:PRM}. Indeed, these latter crystals can be grown in form of nanowires \cite{Hauge.Verheijen.ea:2015:NL,Dixit.Shukla:2018:JoAP,Fadaly:2020:N}. Crystalline 2H-Ge has a direct fundamental gap, but is a pseudodirect semiconductor, since its lowest-energy optical transitions only show a negligible dipole strength \cite{Roedl.Furthmueller.ea:2019:PRM}. Tensile uniaxial strain parallel to the $c$-axis of the lonsdaleite geometry is predicted to lead to a conduction band inversion and, therefore, to strong optical transitions \cite{Suckert.Roedl.ea:2021:PRM}. In general, structural and chemical perturbations to the ideal bulk crystal tend to make 2H-Ge suitable for optoelectronic applications \cite{Belabbes.Bechstedt.ea:2021:PSSRRL}. Indeed, alloying hexagonal Ge with Si to 2H-Si$_x$Ge$_{1-x}$ gives rise to strong photoluminescence, whose photon energy shifts toward higher energies with increasing Si composition \cite{Fadaly:2020:N}. Both effects have been also predicted theoretically \cite{Cartoixa.Palummo.ea:2017:NL,Borlido.Suckert.ea:2021:PRM}. The energy-light conversion in light-emitting diodes (LEDs) and lasers can be improved by quantum confinement effects, e.g. in quantum-well LEDs and lasers \cite{Weisbuch.Nagle:2007:PS,Chuang:1995:Book}. In addition, quantum confinement leads to a decrease of the emission wavelength. Confinement and its effect depend on the band alignment at interfaces, that can produce discontinuities between well and barrier materials. Moreover, during pseudomorphic growth, due to the different lattice constants, biaxial strain is induced in the quantum well system, which also modifies the quantum confinement and the light emission. The combination of these effects may also help to increase the light emission efficiency of Si$_x$Ge$_{1-x}$ alloy systems. However, its understanding and control require the detailed knowledge of band discontinuities $\Delta E_c$ and $\Delta E_v$ of the conduction band minimum (CBM) and valence band maximum (VBM), respectively, at the interface of two alloys forming the heterostructure, namely 2H-Si$_x$Ge$_{1-x}$ and 2H-Si$_y$Ge$_{1-y}$ ($x<y$), resulting in so-called band lineups. To this end, the chemical effects due to the different Si contents $x$ and $y$ and the strain effects due to biaxial growth have to be studied. For the corresponding diamond Si and Ge alloys, theoretical studies of band discontinuities have been carried on several decades ago \cite{VandeWalle.Martin:1986:PRB} and have been refined over the years \cite{VandeWalle.Neugebauer:2003:N,ElKurdi.Sauvage.ea:2006:PRB}. In the hexagonal case, only in a very recent paper the first investigation for alloys has been proposed \cite{Wang.Zhang.ea:2021:APL}. In this paper, we perform accurate \textit{ab initio} calculations to investigate hexagonal Si$_x$Ge$_{1-x}$/Si$_y$Ge$_{1-y}$ heterostructures. We combine density function theory (DFT), that we use for the optimization of the atomic geometry, with approximate quasiparticle (QP) approaches based on DFT for the determination of the electronic structure. More specifically, we compare two state-of-the-art approaches for the calculations of band structures of solids. Moreover, we consider different band alignment methods and evaluate their performance. The resulting natural band discontinuities are analyzed and compared with values for the cubic case. The occurrence of realistic pseudomorphic interfaces is simulated using short-range superlattices composed by two different alloys. The accompanying biaxial strain is modeled by means of the calculated elastic constants and atomic distances in the constrained materials. At last, we present and compare two methods to compute band offsets based on the band deformation potentials. \section{\label{sec2}Methods} \subsection{\label{sec2a}Structural, elastic and electronic properties} The atomic configurations, lattice constants and elastic coefficients are optimized with DFT as implemented in the Vienna Ab-initio Simulation Package (VASP) \cite{Kresse.Furthmueller:1996:PRB,Kresse.Furthmuller:1996:CMS}, using the projector-augmented wave method \cite{Kresse.Joubert:1999:PRB} and a plane-wave cutoff of 500~eV. The Ge3$d$ electrons are treated as valence electrons. The Perdew-Becke-Ernzerhof XC functional PBEsol revised for solids \cite{Perdew.Ruzsinszky.ea:2008:PRL} is applied. For hexagonal four-atom unit cells the Brillouin zone (BZ) integration is performed using a $\Gamma$-centered 12$\times$12$\times$6 ${\bf k}$-point grid. Atomic geometries are relaxed until the Hellmann-Feynman forces are below 1~meV/{\AA}. All electronic structure calculations include the spin-orbit interaction. The Kohn-Sham band structures \cite{Kohn.Sham:1965} obtained using the DFT-PBEsol functional are known to significantly underestimate the band gap and interband-transition energies, inducing consequent uncontrollable errors in the band offsets $\Delta E_c$ and $\Delta E_v$ \cite{Bechstedt:2015:Book}. Accurate quasiparticle bandstructures are therefore required. To avoid the numerical effort associated to QP calculations within the GW approximation \cite{Bechstedt:2015:Book}, we apply two approximate DFT approaches for quasiparticle band structures that are known to yield high-quality results~\cite{Borlido-Aull:JCTC-2019}. The first approach relies on the XC potential of Tran and Blaha \cite{Tran.Blaha.ea:2007:JoPCM,Tran.Blaha:2009:PRL} that combines a modified Becke-Johnson (MBJ) exchange potential \cite{Becke.Johnson:2006:TJoCP} with the local density approximation (LDA) correlation \cite{Kohn.Sham:1965} to give the MBJLDA functional. The MBJLDA functional is known to yield excellent QP band energies around the fundamental gap for cubic and hexagonal Si and Ge crystals \cite{Roedl.Furthmueller.ea:2019:PRM,Suckert.Roedl.ea:2021:PRM,Belabbes.Bechstedt.ea:2021:PSSRRL,Borlido.Suckert.ea:2021:PRM,Laubscher.Kuefner.ea:2015:JoPCM}. The second approach relies on the hybrid XC functional of Heyd, Scuseria, and Ernzerhof (HSE06) \cite{Heyd.Scuseria.ea:2003,Heyd.Scuseria.ea:2006:JoCP}. The band energies resulting for 2H-Ge agree very well with the MBJLDA results \cite{Roedl.Furthmueller.ea:2019:PRM,Suckert.Roedl.ea:2021:PRM,Belabbes.Bechstedt.ea:2021:PSSRRL}. \subsection{\label{sec2b}Alloys and superlattices} Calculating band alignments for disordered-alloy supercells would imply to perform a large number of expensive total energy and electronic-structure calculations. To avoid this bottleneck, we simulate hexagonal Si$_x$Ge$_{1-x}$ alloys, in first approximation, using ordered four-atom hexagonal unit cells Si$_n$Ge$_{4-n}$ ($n=0,1,...,4$). Although this choice makes possible to directly study only three intermediate compositions $x=n/4$ ($n=1,2,3$), beside pure Si and pure Ge, it is a good compromise to speed up calculations and allow for the comparison of different methods. The atomic arrangements of the 4-atom cells with $n$ Si and $(4-n)$ Ge atoms ($n=0,...,4$) are equivalent by symmetry, apart from the case of Si$_2$Ge$_2$, for which three different bonding configurations, indicated with C1, C2 and C3 in Fig.~\ref{fig1}(a), have to be investigated. In C1 and C2 cells, SiGe bonds are stacked along the $[0001]$ direction so that Si and Ge atoms are aligned (C1), or alternate (C2). In the C3 cell the stacked bonds consist of alternating Si-Si and Ge-Ge pairs. The structure C2 has the highest symmetry, because the vertical bonds in the $[0001]$ direction are always equal Si-Ge pairs, and is the most energetically favorable. While the lonsdaleite systems Ge$_4$ and Si$_4$ possess the space group P6$_3$/mmc ($C^4_{6v}$), the symmetry is reduced to P3m1 ($C^1_{3v}$) for all considered hexagonal Si$_x$Ge$_{1-x}$ ordered alloys, irrespective of the chosen inequivalent configuration of the Si$_2$Ge$_2$ alloy (see Fig.~\ref{fig1}(a)). The structural, elastic, and energetic parameters needed to construct and discuss the electronic structures and the band lineups between two SiGe alloys are listed in Table~\ref{tab1}. All the values exhibit a monotonous variation in the composition range from pure Ge to pure Si. Complete band structures of the Si$_n$Ge$_{4-n}$ cells obtained using the MBJLDA functional can be found in Refs. \cite{Fadaly:2020:N,Belabbes.Bechstedt.ea:2021:PSSRRL,Weisbuch.Nagle:2007:PS}. For 2H-Ge and Si$_1$Ge$_3$ a comparison of HSE06 and MBJLDA band energies is presented in Refs. \cite{Roedl.Furthmueller.ea:2019:PRM,Belabbes.Bechstedt.ea:2021:PSSRRL}. \begin{table}[h!] \caption{Structural parameters (lattice parameters $a$, $c$, and $u$), elastic parameters (bulk modulus $B$, its pressure derivative $B'$, and biaxial strain modulus $Y$), and total energy $E_{\rm tot}$ for the seven chemically- or symmetry-inequivalent hexagonal compounds Si$_n$Ge$_{4-n}$. The values of $Y$ are taken from Ref.~\cite{Borlido:unpubl}. In the case of Si$_2$Ge$_2$, values for the three atomic configurations in Fig.~\ref{fig1} are listed together with their arithmetic averages. } \centering \footnotesize \begin{ruledtabular} \begin{tabular}{ccccccccl} configuration & $a$ ({\AA}) & $c$ ({\AA}) & $u$ & $B$ (GPa) & $B'$ & $Y$ (GPa) & $E_{\rm tot}$ (eV/cell) \\ \hline \ Ge$_4$ & 3.9960 & 6.5920 & 0.3743 & 68 & 4.76 & 171 & 0.000 \\ Si$_1$Ge$_3$ & 3.9464 & 6.5150 & 0.3742 & 74 & 4.69 & 189 & \llap{$-$}0.760 \\ Si$_2$Ge$_2$ (C1) & 3.8944 & 6.4375 & 0.3740 & 81 & 4.51 & 203 & \llap{$-$}1.592 \\ Si$_2$Ge$_2$ (C2) & 3.9002 & 6.4376 & 0.3746 & 81 & 4.54 & 203 &\llap{$-$}1.606 \\ Si$_2$Ge$_2$ (C3) & 3.9002 & 6.4377 & 0.3737 & 81 & 4.52 & 201 & \llap{$-$}1.596\\ Si$_2$Ge$_2$ (average) & 3.8981 & 6.4376 & 0.3741& 81 & 4.52 & 202 & \llap{$-$}1.598 \\ Si$_3$Ge$_1$ & 3.8626 & 6.3828 & 0.3740 & 87 &4.38 & 216 & \llap{$-$}2.398 \\ Si$_4$ & 3.8264 & 6.3272 & 0.3739 & 94 & 4.24 & 225&\llap{$-$}3.249& \label{tab1} \end{tabular} \end{ruledtabular} \end{table} \section{\label{sec3}Natural band discontinuities} \subsection{\label{sec3a}Vacuum level alignment} Natural band discontinuities can be predicted from the bulk band structures of two semiconductors and/or insulators that constitute an heterointerface. Such a prediction, however, asks for a method to align the energy scales of the adjacent materials. The electron affinity rule \cite{Anderson:1962:SE,Bechstedt.Enderlein:1988:Book} is based on the vacuum level alignment. The known electron affinities $A_1=-E^1_{c}$ and $A_2=-E^2_c$ of the two nonmetals $j=1,2$ in contact, with $E^j_c$ as the lowest CBM measured with respect to the vacuum level, define the conduction band discontinuity as \begin{equation}\label{eq1} \Delta E_c=A_1-A_2 \,. \end{equation} The QP gaps $E^j_g=I_j-A_j$ and the resulting ionization energies with respect to the vacuum level $I_j=-E^j_v$ yield the valence band discontinuities as $\Delta E_v=I_2-I_1$. The procedure to calculate band energies $E^j_c$ and $E^j_v$ with respect to the vacuum level \cite{Hoffling.Schleife.ea:2012:PRB} is illustrated in Fig.~\ref{fig2}(a) for the examples of hexagonal polytypes Ge$_4$ and Si$_4$ but also Si$_n$Ge$_{4-n}$ alloys and the cubic polytypes 3C-Ge and 3C-Si. First, the electrostatic potentials $V(z)$, averaged over the plane perpendicular to the $z$-axis, have to be extracted from the single-particle potential of the generalized Kohn-Sham equation. To define the vacuum level, the tail of $V(z)$ at a surface is needed. We studied the $(0001)$ surfaces by investigating slabs of eight atoms, i.e., two hexagonal unit cells, in the $[0001]$ direction, separated by vacuum layers as thick as 12~{\AA}. The oscillations of $V(z)$ inside the material slabs are compared with the electrostatic potential of the bulk calculation. The comparison allows the determination of $E_c$, but also $E^{ind}_c$, and $E_v$ with respect to the vacuum level (see Table~\ref{tab2}). The alignment gives rise to the band lineups displayed in Fig.~\ref{fig2}(b). \begin{table}[h!] \caption{ Positions of band extrema, $E_{v}$, $ E_{c}$ and $ E_{c}^{\mathrm{ind}}$, as determined via the electron affinity rule for Si$_{x}$Ge$_{1-x}$(0001) surfaces. For comparison the values of 3C-Ge(111) and 3C-Si(111) are also listed. The natural band discontinuities $\Delta E_c=E^{\rm lower}_c-E^{\rm upper}_c$ \eqref{eq1} and $\Delta E_v=E^{\rm upper}_v-E^{\rm lower}_v$ as well as that for the indirect CBM $\Delta E^{\rm ind}_c$ are also given. Because of the three configurations C1, C2, C3 and the average one, four offsets are displayed for either Si$_{0.25}$Ge$_{0.75}$/Si$_{0.5}$Ge$_{0.5}$ or Si$_{0.5}$Ge$_{0.5}$/Si$_{0.75}$Ge$_{0.25}$ heterostructures. All energies in eV.} \footnotesize \begin{ruledtabular} \begin{tabular}{cccccccccc} Interface/alloy Si$_{x}$Ge$_{1-x}$ & Orientation& $E_{v}$ & $E_{c}$ & $E_{c}^{\mathrm{ind}}$ & $\Delta E_{v}$ & $\Delta E_{c}$ & $\Delta E_{c}^{\mathrm{ind}}$ \\ \hline \ 3C-Ge & (111) & \llap{$-$}4.535 & \llap{$-$}3.879& \llap{$-$}3.910 &\llap{$-$}0.060 & \llap{$-$}0.283 &0.070 \\ 2H-Ge & (0001) &\llap{$-$}4.475 &\llap{$-$}4.162 &\llap{$-$}3.840 &0.056 & 0.198 & 0.043 \\ Si$_{0.25}$Ge$_{0.75}$ & (0001) &\llap{$-$}4.531 &\llap{$-$}3.964 &\llap{$-$}3.797 &0.152 & 0.317 & 0.029 \\ &&&&&0.170 & 0.324 &\llap{$-$}0.023\\ Si$_{0.5}$Ge$_{0.5}(\mathrm{C}1)$ & (0001) &\llap{$-$}4.683 &\llap{$-$}3.647&\llap{$-$}3.768 &\llap{$-$}0.026 & 0.101 &\llap{$-$}0.053\\ Si$_{0.5}$Ge$_{0.5}(\mathrm{C}2)$ & (0001) &\llap{$-$}4.701 &\llap{$-$}3.640&\llap{$-$}3.820 &0.099 & 0.248 & \llap{$-$}0.015\\ Si$_{0.5}$Ge$_{0.5}(\mathrm{C}3)$ & (0001) &\llap{$-$}4.505 &\llap{$-$}3.863&\llap{$-$}3.850 &0.052& 0.033 & \llap{$-$}0.059 \\ Si$_{0.5}$Ge$_{0.5}(\mathrm{average})$ & (0001) &\llap{$-$}4.630 &\llap{$-$}3.716 &\llap{$-$}3.812 &0.034 & 0.026 & \llap{$-$}0.007 \\ &&&&&0.230 & 0.249 & 0.023 \\ &&&&&0.105 & 0.102 & \llap{$-$}0.015 \\ Si$_{0.75}$Ge$_{0.2 5}$ & (0001) &\llap{$-$}4.735 &\llap{$-$}3.614 &\llap{$-$}3.827 &0.142 & 0.449 & \llap{$-$}0.021\\ 2H-Si & (0001) &\llap{$-$}4.877 &\llap{$-$}3.165 &\llap{$-$}3.848 &0.343 & 0.195 & \llap{$-$}0.121 \\ 3C-Si & (111) &\llap{$-$}5.220 &\llap{$-$}2.970&\llap{$-$}3.969 &&&& \label{tab2} \end{tabular} \end{ruledtabular} \end{table} For the alloy, the potential $V(z)$ at the surface depends on the surface termination, i.e., the distribution of the Si and Ge atoms in the four-atom cells and hence in the surface atomic layer. In comparison to the values in Table~\ref{tab2} and Fig.~\ref{fig2}(b), obtained for Si$_{1}$Ge$_{3}$ and a termination with the Si layer as the second one beneath the surface, other terminations induce small variations of 58 to 61 meV for $E_v$, $-$28 to 90 meV for $E_c$, and $-$26 to 84 meV for $E_{c}^{\mathrm{ind}}$. These numbers prove for Si$_{0.25}$Ge$_{0.75}$ that, fortunately, the termination has a negligibly small influence on the vacuum level position. Table~\ref{tab2} gathers several other interesting results. The ionization energy $I=-E_v$ is rather constant for Ge-rich alloys. Its increase to the larger value of 2H-Si, and finally to 3C-Si, Table~\ref{tab2}, begins for alloys with at least a 50\% Si content. The absolute values of the ionization potential for the hexagonal allotropes, $I=4.48$~eV (2H-Ge) and $I=4.88$~eV (2H-Si), are however significantly smaller than the experimental values for the cubic phases $4.5-4.8$~eV (3C-Ge) and $5.10-5.33$~eV (3C-Si), respectively \cite{Bechstedt.Enderlein:1988:Book,Guo.Li.ea:2019:JPCC}. An increase of the theoretical values to $I=4.54$~eV and $I=5.22$~eV occurs for 3C-Ge and 3C-Si, respectively, indicating not only the agreement with measured ionization energies but also the predictive power of the MBJLDA functional. Other calculations using the HSE or other screened exchange XC functionals for 3C-Si give rise to even larger values \cite{Hoffling.Schleife.ea:2012:PRB,Guo.Li.ea:2019:JPCC}. Full GW calculations deliver $I=5.46$~eV (3C-Si) and $I=5.05$~eV (3C-Ge) when (111)2$\times$1 surfaces are investigated \cite{Hinuma.Grueneis.ea:2014:PRB}. The good agreement of measured and MBJLDA values for $I$ and $A$ confirm the validity of the vacuum level alignment for the determination of natural band offsets. The latter values $\Delta E_{v}$, $ \Delta E_{c}$ and $ \Delta E_{c}^{\mathrm{ind}}$ are also listed in Table~\ref{tab2}. \subsection{\label{sec3b} Branch point alignment} A completely different alignment concept is based on the determination of the charge neutrality level (CNL) or branch point (BP) energy $E_{\rm BP}$ \cite{Bechstedt.Enderlein:1988:Book,Guo.Li.ea:2019:JPCC,Monch:2001:Book}. The use of such universal reference level has been first suggested by Frensley and Kroemer \cite{Frensley.Kroemer:1976}. Apart from empirical tight-binding descriptions of the BP energies \cite{Monch:2001:Book,Moench:1996:JoAP}, three different methods, which can be combined with electronic structure calculations based on DFT and QP approaches, have been applied in the last decades: a Green function method \cite{Tersoff:1984:PRB}, a determination through the zero of the integral of the density of states \cite{Guo.Li.ea:2019:JPCC,Robertson:2013:JoVSTA}, and the calculation from an approximate weighted sum of conduction- and valence-band energies \cite{Schleife.Fuchs.ea:2009:APL}. All these treatments require only bulk calculations. Here we apply the third method, where the BP is computed as an average over the BZ and bands: \cite{Schleife.Fuchs.ea:2009:APL} \begin{equation}\label{eq2} E_{\rm BP}=\frac{1}{2N}\sum_{\bf k}\left[\frac{1}{N_{\rm CB}}\sum^{N_{\rm CB}}_{c=1}\varepsilon_c({\bf k})+\frac{1}{N_{\rm VB}} \sum^{N_{\rm VB}}_{v=1}\varepsilon_v({\bf k})\right] \,, \end{equation} where $N$ is the number of {\bf k}-points, and for a 2H unit cell the number of conduction bands is fixed to $N_{\rm CB}=2$ and that of valence bands to $N_{\rm VB}=4$. Band alignment obtained using the branch point method of \eqref{eq2} are listed in Table~\ref{tab3} and displayed in Fig.~\ref{fig3}. Besides the hexagonal Si$_x$Ge$_{1-x}$ alloys, results are also shown for 3C-Ge and 3C-Si for comparison. For the cubic crystals we applied two different numerical descriptions of the electronic structure and BP energy. We studied the primitive diamond cell, with the resulting fcc BZ and halved number of bands in \eqref{eq1}, as well as the same atomic arrangement described using a non-primitive hexagonal cell together with the corresponding hexagonal BZ. The two procedures are indicated by 3C and 3C(hex), respectively. The first description is more appropriate for free standing diamond crystals, while the second one, 3C(hex), better accounts the situation of band lineups at cubic [111]/ hexagonal [0001] interfaces. We can conclude, first of all, that both approximate QP methods for band structures, namely MBJLDA and HSE06, can be applied with comparable results. Apart from the case of 3C-Si, the deviations are in fact smaller than 0.1~eV,. This latter value can be used to define the uncertainty in the determination of the natural band discontinuities $\Delta E_v$, $\Delta E_c$, and $\Delta E^{\rm ind}_c$ of heterostructures between systems with the smallest difference in composition (for the exact values see Table~\ref{tab3}). For low (high) Si content the MBJLDA band edges are higher (lower) than the HSE06 ones. Nevertheless, the results in Fig.~\ref{fig3} and Table~\ref{tab3} show that both approximate QP procedures can be applied to the SiGe systems with qualitatively similar results. Since, however, minor numerical efforts are necessary to perform MBJLDA calculation, we will apply in the following only this approach to describe the true band lineups. \begin{sidewaystable} \caption{Energies of the band extrema $E_c$ and $E_v$ at the $\Gamma$ point with respect to the BP position, taken as energy zero as computed with MBJLDA and HSE06 functionals (values given in parenthesis). In addition, the conduction band minimum at the $U$ point on the LM line, $E^{\rm ind}_c$, is listed, if the alloy is an indirect semiconductor. The natural band discontinuities $\Delta E_c=E^{\rm lower}_c-E^{\rm upper}_c$ \eqref{eq1} and $\Delta E_v=E^{\rm upper}_v-E^{\rm lower}_v$, as well as the discontinuity for the indirect CBM $\Delta E^{\rm ind}_c$ are also given. Because of the three possible configurations C1, C2, C3 and their average, four offsets are displayed for either Si$_{0.25}$Ge$_{0.75}$/Si$_{0.5}$Ge$_{0.5}$ or Si$_{0.5}$Ge$_{0.5}$/Si$_{0.75}$Ge$_{0.25}$ heterostructures. The lowest and highest values describe the 2H-Si/3C-Si and 3C-Ge/2H-Ge band lineups, respectively. Thereby, we distinguish between the band positions of 3C obtained using the diamond primitive cell with the fcc BZ for the BP determination (3C) or the equivalent hexagonal representation with the BP determination by integration over the smaller hexagonal BZ (denoted by 3C(hex)). The uppermost (lowest) two lines describe band offsets between 3C (in one of the two versions) and 2H. All energy values are in eV.} \begin{ruledtabular} \begin{tabular}{ccccccccccl} alloy/polytype & $ E_{v}$ & $ E_{c}$ & $ E_{c}^{\mathrm{ind}}$ & $ \Delta E_{v}$ & $ \Delta E_{c}$ & $ \Delta E_{c}^{\mathrm{ind}}$ \\ \hline \ 3C-Ge &0.221(0.300) &0.929(0.943) &0.877(0.935)$^{\mathrm{L}}$ & $-$0.039(0.095) &$-$0.363($-$0.443) & 0.011($-$0.115) \\ 3C-Ge(hex) & 0.027(0.061) &0.683(0.692) &0.652(0.645)$^{\mathrm{L}}$ &$-$0.233($-$0.144) & $-$0.117($-$0.192) & 0.236(0.175) \\ 2H-Ge &0.260(0.205) &0.566(0.500) &0.888(0.820)$^{\mathrm{U}}$ &$-$0.006($-$0.005) & 0.230(0.263) & 0.158(0.143)\\ Si$_{0.25}$Ge$_{0.75}$ &0.266(0.200) &0.796(0.763) &1.046(0.963)$^{\mathrm{U}}$ &0.183(0.002) & 0.323(0.450) & $-$0.048(0.085)\\ &&&&0.146($-$0.042) & 0.385(0.520) & $-$0.045(0.104)\\ Si$_{0.50}$Ge$_{0.50}\mathrm{(C1)}$ &0.083(0.198) &1.119(1.213) &0.998(1.048)$^{\mathrm{M}}$ &$-$0.03($-$0.148) & 0.142(0.233) & $-$0.095(0.042)\\ Si$_{0.50}$Ge$_{0.50}\mathrm{(C2)}$ &0.120(0.242) &1.181(1.283) &1.001(1.067)$^{\mathrm{U}}$& 0.100($-$0.045) & 0.283(0.456) & $-$0.063(0.077)\\ Si$_{0.50}$Ge$_{0.50}\mathrm{(C3)}$ &0.296(0.348) &0.938(0.996) &0.951(1.005)$^{\mathrm{M}}$ &0.029(0.008) & 0.235(0.236) & $-$0.036($-$0.036)\\ Si$_{0.50}$Ge$_{0.50}\mathrm{(average)}$ &0.166(0.262) &1.079(1.164)&0.983(1.040) &0.066(0.052) & 0.173(0.166) & $-$0.039($-$0.055)\\ &&&&0.242(0.158) & 0.416(0.453) & 0.011(0.007)\\ &&&&0.112(0.072) & 0.275(0.285) & $-$0.028($-$0.021)\\ Si$_{0.75}$Ge$_{0.25}$ &0.054(0.190) &1.354(1.449) &0.962(1.012)$^{\mathrm{M}}$& 0.165(0.190) & 0.246(0.238) & $-$0.045($-$0.058)\\ 2H-Si &\llap{$-$}0.111(0.000) &1.600(1.687) &0.917(0.954)$^{\mathrm{M}}$ &0.241(0.307) & 0.298(0.243) & $-$0.019($-$0.124)\\ 3C-Si(hex) & $-$0.352($-$0.307)&1.898(1.930)& 0.898(0.830)$^{\mathrm{M}}$&0.155(0.115) & $-$1.313( $-$1.493) & $-$0.067($-$0.061) \\ 3C-Si &\llap{$-$}0.266($-$0.115) &2.913(3.180) &0.984(1.015)$^{\mathrm{X}}$ \label{tab3} \end{tabular} \end{ruledtabular} \end{sidewaystable} From a qualitative analysis of Fig.~\ref{fig3} and Table~\ref{tab3} we can identify a clear tendency for a type-I heterostructure \cite{Bechstedt.Enderlein:1988:Book,Kittel:2005:Book} when hexagonal Si$_x$Ge$_{1-x}$ and Si$_y$Ge$_{1-y}$ alloys with $x<y$ are combined. Quantum wells are formed in the layer with the lower Si content for both electrons and holes. However, for Ge-rich alloys the heterostructure type is not very clear. The position of the top of the valence band is weakly dependent on the composition. In general, see Table~\ref{tab3}, the absolute values of the valence band offsets are smaller than the conduction band ones. Our results agree qualitatively with the predictions of Wang et al.\cite{Wang.Zhang.ea:2021:APL}. More precisely, we can compare the minimum fundamental gaps of 2H-Si$_x$Ge$_{1-x}$, calculated using MBJLDA (HSE06), are $E_g$ or $E^{\rm ind}_g$ = 0.31 (0.30), 0.53 (0.56), 0.82 (0.78), 0.91 (0.82) and 1.03 (0.95)~eV from Table~\ref{tab3} and the values $E_g$ or $E^{\rm ind}_g = 0.30$, 0.65, 0.90, 0.94, and 1.06~eV from Ref.\onlinecite{Wang.Zhang.ea:2021:APL}. The trends on the band edge position are also very similar. Only the fact, visible in Fig.~\ref{fig3}, that $E_v$ is above the BP energy for the Si$_x$Ge$_{1-x}$ alloys (apart from the 2H-Si case) is less pronounced in Ref.~\cite{Wang.Zhang.ea:2021:APL}. Interesting byproducts of the band lineups in Fig.~\ref{fig3} and Table~\ref{tab3} are the band offsets between the 3C and 2H polytypes of Ge and Si. We can see that the description of the cubic polytypes using the diamond cell, 3C, or the hexagonal representation strongly influences the resulting natural band offsets. Low conduction-band states at 2/3 $\Gamma$L (diamond) are mapped onto the $\Gamma$ (hexagonal representation) point. For Si a drastic lowering of the direct CBM in 3C(hex) occurs by about 1eV compared to the 3C case. This can be understood by the simple band-folding arguments that the second CBM at ${\Gamma}$ of 3C-Si(hex) at 3.179 eV almost agrees in energy with the first CBM at ${\Gamma}$ in 3C-Si, see Table~\ref{tab3}. It is also worth to mention that the CBM near M in 3C-Si(hex), located at 2.15 eV, agrees with the position of the indirect CBM near ${\mathrm{X}}$ in 3C-Si. In Ge the energy positions vary on an absolute scale because of the resulting different BPs. The BP in 3C-Ge(hex) is by about 0.2 eV higher in energy compared to the BP of 3C-Ge, but still below the VBM, independently of the chosen QP approximation. In close agreement to the vacuum level alignment, the BP alignment starting from MBJLDA and HSE06 electronic structures leads to similar heterostructure characters for 2C/2H junctions. However, the absolute values, sometimes also the signs, of the band discontinuities depend on the choice of the structure, 3C(hex) or 3C, and the direct or indirect nature of the gap. We focus the discussion on the heterocharacter of 2H/3C on the lowest conduction bands at $\Gamma$ (outside $\Gamma$) for Ge (Si) and identify the conduction band discontinuities by $\Delta E_{c}$ ($ \Delta E_{c}^{\mathrm{ind}}$). Using MBJLDA (HSE06), as we can deduce from Table~\ref{tab3}, delivers $ \Delta E_{c} = -0.36 (-0.44)$ or $-$0.12 ($-$0.19) and $ \Delta E_{v}$ = $-$0.04 (0.10) or $-$0.23 ($-$0.14) eV for Ge 2H/3C or 2H/3C(hex) heterostructures, while the corresponding values for Si heterostructures are $\Delta E_{c}$ = $-$0.02 ($-$0.12) or $-$0.07 ($-$0.06) eV and $\Delta E_{v}$ = 0.24 (0.31) or 0.16 (0.12) eV for 2H/3C(hex) or 2H/3C. Consequently, the heterojunction character varies somewhat with the selected QP approximation and the choice of the unit cell for the calculation of the approximate BP energy. Within the MBJLDA approximation, the heterocharacter tends generally toward type-I. Only the Si-based 2H/3C(hex) junction exhibits a type-II character. These findings are qualitatively similar to the results using the vacuum-level aligment shown in Fig.~\ref{fig2}. Using the HSE06 functional for the determination of the band structures, the 2H/3C(hex) Ge junction has a type-I lineup, while a type-II interface results for the Si case. These findings are in agreement with other HSE06 calculations for 'true' band offsets using supercells \cite{Kaewmaraya-jpcc-2017}. \par The uncertainties in the prediction of the type of 3H/3C or 2H/3C(hex) interfaces using the natural band lineup remember similar findings for InP and GaAs \cite{Bechstedt.Belabbes:2013:JoPCM}. Due to fluctuations in the bond stacking during growth of GaAs quantum wires indeed such quantum wells appear, where, however, the heterostructure type~I and II is under discussion \cite{Spirkoska.Arbiol.ea:2009:PRB,Akopian.Patriarche.ea:2010:NL}. The same statement is valid for other calculations of the heterocrystalline interface 2H/3C of silicon using several approaches. The band alignment method tends to type-II band lineup \cite{Wang.Zhang.ea:2021:APL,Raffy-PRB-2004,Amato.nanolett-2016}, whereas hexagonal/cubic Si superlattice (see also below) show type-I band offsets \cite{Raffy.Furthmueller.ea:2002:PRB,Murayama.Nakayama:1994:PRB,Kaewmaraya-jpcc-2017}. In the case of Ge the situation is more difficult, because of the metallic character of the material in DFT \cite{Raffy.Furthmueller.ea:2002:PRB}. Moreover, the band alignment method (type-II) \cite{Wang.Zhang.ea:2021:APL} and the superlattice method (type-I) \cite{Kaewmaraya-jpcc-2017} again suggest opposite heterostructure characters. For the BP position using the VBM as a energy zero we find $E_{\rm BP}=-0.22$ ($-$0.30), $-$0.03 ($-$0.06), $-$0.26 ($-$0.21), 0.11 (0.00), 0.35 (0.31), and 0.27 (0.12)~eV for 3C-Ge, 3C-Ge(hex), 2H-Ge, 2H-Si, 3C-Si(hex) and 3C-Si, respectively, using MBJLDA (HSE06). In the case of 3C-Si, there is a good agreement with other calculations of $E_{\rm BP}=0.29$ \cite{Hoffling.Schleife.ea:2012:PRB}, 0.16 \cite{Hinuma.Grueneis.ea:2014:PRB}, 0.03 \cite{Monch:2001:Book}, 0.36 \cite{Tersoff:1984:PRB}, and 0.2~eV \cite{Robertson:2013:JoVSTA}. The BP positions in 3C-Ge are $E_{\rm BP}=-0.28$ \cite{Hinuma.Grueneis.ea:2014:PRB}, $-$0.28 \cite{Monch:2001:Book}, 0.18 \cite{Tersoff:1984:PRB}, and 0.1~eV \cite{Robertson:2013:JoVSTA}. Despite similarities with the gap results of Wang et al. \cite{Wang.Zhang.ea:2021:APL}, a clear discrepancy appears for the positions of the CNL with respect to the VBM for both 3C- and 2H-Ge. In the latter references SOC has not been included. The tendency predicted here to find negative BP values for Ge is confirmed both by \emph{ab initio} GW as well as empirical tight-binding calculations. Such a prediction of a BP energy in a band may have significant consequences for the occurrence of $p$-type accumulation at Ge surfaces, as demonstrated for the surface electron accumulation of In compounds, e.g. In$_2$O$_3$ \cite{King.Veal.ea:2009:PRBa}. The BP positions allow to define a natural valence band discontinuity $\Delta E_v$ between 3C-Ge and 3C-Si or 3C-Ge(hex) and 3C-Si(hex) of $\Delta E_v=0.49$ (0.42)~eV or 0.38 (0.37)~eV (see Fig.~\ref{fig3}). These values are close to that $\Delta E_v=0.38$~eV of GW calculations \cite{Hinuma.Grueneis.ea:2014:PRB} and that $\Delta E_v=0.34$~eV measured by photoemission \cite{Katnani.Margaritondo:1983:PRB}. \subsection{\label{sec3c} Comparison of alignment methods} Tables~\ref{tab2} and \ref{tab3}, as well as Figs.~\ref{fig2}(b) and \ref{fig3}, show the natural band discontinuities $\Delta E_{v}$, $ \Delta E_{c}$ and $\Delta E_{c}^{\mathrm{ind}}$ of MBJLDA band structures, derived with different alignment procedures, namely the vacuum level alignment and the BP alignment. The resulting heterojunction behaviors agree qualitatively, but exhibit quantitative differences. The smallest deviations occur for the offsets of the VBM. For Ge(Si)-rich alloy heterostructures the two $ \Delta E_{v}$ values differ by $-$9 meV (23 meV). The differences increase toward 88 meV ($-$81 meV) including alloys with the same numbers of Si and Ge atoms in the heterojunction. The discrepancies are similar for the CBM offsets and increase for the CBM$^{\mathrm{ind}}$ offsets. For more Ge-rich heterostructures the direct CBM offsets vary by $-$19 or $-$52 meV, while for Si-rich junctions the indirect CBM offsets deviate by 81 or $-$24 meV. All these deviations are smaller than the accuracy of the underlying approximate QP methods for the gaps, that we estimate to be smaller than 0.1eV \cite{Bechstedt:2015:Book}. Interestingly, both alignment procedures also nearly give the same natural band lineups for the two heteropolytypic structures 3C/2H (see Figs.~\ref{fig2}(b) and \ref{fig3}, as well as Tables~\ref{tab2} and \ref{tab3}). Results of both alignments tend toward a type-I heterocharacter with deep electron and flat hole quantum wells in the region of the 2H polytype. In the Si case the agreement is complete for $\Delta E_{v}$ and $ \Delta E_{c}$. Only the positions of the indirect CBM differ by 81 meV. In the Ge case small deviations of only 39 meV ($\Delta E_{v}$), 31 meV ($\Delta E_{c}$) and 31 meV ($\Delta E_{c}^{\mathrm{ind}}$) are visible. The minor deviations of the band discontinuities between two polytypes 3C and 2H, as well as between two hexagonal alloys suggest the applicability of both alignment procedures. Nevertheless, we focus in the following on the BP alignment because it relies only on bulk calculations. \section{\label{sec4}True band lineup} \subsection{\label{sec4a}Interfacial biaxial strain} A heterostructure 2H-Si$_x$Ge$_{1-x}$/2H-Si$_y$Ge$_{1-y}$ ($x<y$) may be fabricated by controlled growth in the direction of the $c$-axis. For not too large differences in $x$ and $y$ lattice parameters, pseudomorphic epitaxial growth should be possible. Neglecting the interface mixing of regions with different compositions, the main effect of the pseudomorphic growth will be biaxial strain at the junction, resulting in compressive strain of the alloy with lower Si content and tensile strain of the Si-richer mixed crystal. Since the maximum lattice mismatch $f=2\frac{a(x)-a(y)}{a(x)+a(y)}$ amounts to 4.3~\% (see Table~\ref{tab1}), the resulting mismatch of Si$_n$Ge$_{4-n}$/Si$_{n+1}$Ge$_{3-n}$ ($n=0,1,2,3$) interfaces is approximately 1~\%, i.e., still in the validity range of Hooke's law. Setting the in-plane lattice constant of the heterojunction equal to $a$, assuming pseudomorphic growth, the resulting biaxial strain on the two sides of the heterointerface Si$_x$Ge$_{1-x}$/Si$_{y}$Ge$_{1-y}$ amounts to \begin{equation}\label{eq3} \epsilon_\|(x/y)=\frac{a-a(x/y)}{a(x/y)} \end{equation} where $a(x)$ and $a(y)$ are the lattice constant of the two bulk alloys. The band energies are shifted from the values $E_v$, $E_c$ and $E^{\rm ind}_c$ for the unstrained alloys to the values $E_v(\epsilon_\|)$, $E_c(\epsilon_\|)$, and $E^{\rm ind}_c(\epsilon_\|)$. In the framework of the validity of the Hooke's law \cite{Kittel:2005:Book} a linear strain dependence holds ($\nu=v,c,c^{\rm ind}$): \begin{equation}\label{eq4} E_\nu(\epsilon_\|)=E_\nu+\Xi_\nu\epsilon_\|. \end{equation} The band deformation potentials listed in Table~\ref{tab4} have been computed from the MBJLDA band energies of the unstrained and strained alloys given in the same table. Thereby, an arithmetic average of the deformation potentials arising for $\epsilon_\|=\pm0.01$ is used, in order to avoid nonlinear effects beyond the Hooke's law. Since the band energies are computed with respect to the BP energy \eqref{eq2}, the resulting deformation potentials have to be interpreted as the deformation potentials of the energy difference between band extrema and BP energy. \par The general effects of a biaxial strain on the band edges, measured with respect to the BP energy zero, are illustrated in Fig.~\ref{fig4}. In the limit of compressive strain, the $a$-lattice constant is shortened and the band gaps at $\Gamma$ are increased, although, in addition to the CBM, $E_c$, also the VBM, $E_v$, is shifted away from the BP. In the case of tensile strain the opposite shifts are visible, in particular the gaps get shrunk. Interestingly, the conduction band minima along the LM line hardly vary with strain, at least with respect to the BP used for band alignment. Moreover, the character of the heterostructure (type I or II) is rather independent of the biaxial strain. The type-I character of the 2H/3C heterostructures (with MBJLDA) with 2H as quantum-well and 3C as barrier material, known from the natural band lineup, is conserved. The indirect character of the band gap is more pronounced under compressive strain, but disappears for tensile strain. \begin{table*}[h!] \caption{Energies of band extrema $E_v$, $E_c$ and $E^{\rm ind}_c$ measured to the BP position of SiGe alloys and polytypes under biaxial strain $-$1, 0, +1~\%. The MBJLDA approach is applied. The deformation potentials resulting from the strain-induced band displacements are also given. All values are in eV.} \centering \footnotesize \begin{ruledtabular} \begin{tabular}{ccccccccccccccccl} Material & \multicolumn{3}{c}{Compressive} & \multicolumn{3}{c}{Zero} & \multicolumn{3}{c}{Tensile} & \multicolumn{3}{c}{ Resulting } \\ & \multicolumn{3}{c}{biaxial strain $-1\%$}&\multicolumn{3}{c}{biaxial strain $0\%$}&\multicolumn{3}{c}{biaxial strain $1\%$ } &\multicolumn{3}{c}{deformation potential } \\ \cline{2-4} \cline{5-7} \cline{8-10} \cline{10-13} \\ Si$_{x}$Ge$_{1-x}$& $E_{v}$ & $ E_{c}$ & $ E_{c}^{\mathrm{ind}}$& $E_{v}$ & $ E_{c}$ & $ E_{c}^{\mathrm{ind}}$ & $E_{v}$ & $ E_{c}$ & $ E_{c}^{\mathrm{ind}}$ & $\Xi_{v}$ & $\Xi_{c}$ & $\Xi_{c}^{\mathrm{ind}}$ \\ \hline 3C-Ge & 0.248 & 1.197 & 1.031 & 0.221 & 0.929 & 0.877 & 0.195 & 0.656 & 0.715 & $-$2.65 & $-$27.15 &$-$15.80 \\ 3C-Ge(hex) &0.05 &0.834&0.676& 0.027 &0.683 &0.652& 0.004&0.525&0.628 & $-$2.30&$-$15.45&$-$2.36 \\ 2H-Ge & 0.321 & 0.788 & 0.876 & 0.260 & 0.566 & 0.888 & 0.213 & 0.364 & 0.897 & $-$5.40& $-$21.15 &1.07 \\ Si$_{0.25}$Ge$_{0.75}$ & 0.334 & 1.003 & 1.088 & 0.266 & 0.796 & 1.046 & 0.223 & 0.647 & 1.003 & $-$5.55 & $-$17.83 & $-$4.25 \\ Si$_{0.50}$Ge$_{0.50}(\mathrm{C1}$) & 0.132 & 1.354 & 1.045 & 0.083 &1.119 & 0.998 & 0.034 & 0.899 & 0.949 & $-$4.90& $-$22.75 &$-$4.80\\ Si$_{0.50}$Ge$_{0.50}(\mathrm{C2}$) & 0.173 & 1.412 & 1.046 & 0.120 &1.181 & 1.001& 0.067 & 0.965 & 0.959 & $-$5.30 & $-$22.40 & $-$4.30\\ Si$_{0.50}$Ge$_{0.50}(\mathrm{C3}$) & 0.360 & 1.124 & 1.012 & 0.296 & 0.938 & 0.951 & 0.231 & 0.744& 0.895 & $-$6.45 &$-$19.00 & $-$5.85 \\ Si$_{0.50}$Ge$_{0.50}\mathrm{(average)}$ & 0.221 & 1.296 & 1.034 & 0.166 & 1.079 & 0.983 & 0.110 & 0.869 & 0.934 & $-$5.55 &$-$21.38 &$-$5.00 \\ Si$_{0.75}$Ge$_{0.25}$ & 0.126 & 1.573 & 1.023 & 0.054 & 1.354 & 0.962 & $-$0.005 & 1.139 & 0.906 & $-$6.55 & $-$21.68 &$-$5.95 \\ 2H-Si & \llap{$-$}0.043 & 1.827 & 0.975 & $-$0.111 & 1.600 & 0.917 & $-$0.170 & 1.372 & 0.859 & $-$6.35 &$-$22.75 & $-$5.80 \\ 3C-Si(hex) & \llap{$-$}0.346 & 2.116 & 0.906 & $-$0.352&1.898& 0.898 & $-$0.360 &1.673 & 0.910 & $-$0.68 & $-$22.13& 0.17 \\ 3C-Si & \llap{$-$}0.236& 2.945 & 0.951 & $-$0.266 & 2.913 & 0.984 & $-$0.293 & 2.880 & 1.000 & $-$2.85 &$-$3.30 & 2.45 \label{tab4} \end{tabular} \end{ruledtabular} \end{table*} To predict `true' band discontinuities by estimating the biaxial strain at Si$_x$Ge$_{1-x}$/Si$_y$Ge$_{1-y}$ interfaces, we use the band deformation potentials in Table~\ref{tab4}. However, they are calculated with respect to the BP, which cannot be measured directly. For comparison with measurements it is better to study the deformation potentials of the gaps, $E_g=E_c-E_v$ and $E_{g}^{\rm ind}=E^{\rm ind}_c-E_v$. In the cubic limit biaxial deformation potentials $\Xi=-13.15$ ($-$21.45)~eV and $\Xi^{\rm ind}=0.06$ (0.85)~eV result for 3C-Ge (3C-Si) but using the hexagonal BZ to describe the high-symmetry points $\Gamma$, L, and M. Our estimates of deformation potentials of 3C-Ge at the $\Gamma$ and L points of the fcc BZ deliver $\Xi(\Gamma)=-24.5$~eV and $\Xi(\mathrm{L})=-13.15$~eV. Because of the projection of the L point in the fcc BZ onto the $\Gamma$ point of the hexagonal BZ, the indirect gap value in the cubic case $\Xi(\mathrm{L})$ should be comparable with the $\Xi=-13.15$ eV value estimated for the direct gap of 3C-Ge, using a hexagonal {\bf k}-point sampling. Independently of the description, in diamond-Si the indirect gaps possess positive deformation potentials of 5.30 eV for 3C-Si and 0.85 eV for 3C-Si(hex). Our estimates approach measured deformation potentials at the zone boundaries \cite{Yu.Cardona:1999:Book}. In the hexagonal alloys the deformation potentials $\Xi$ for the direct gaps relatively weakly vary with the composition around $\Xi= -21$ eV. Only for $x=0.25$ a slightly smaller absolute value with $\Xi=-17.83$~eV is estimated. The situation is completely different for the deformation potential of the lowest indirect gap. Because of similar values of the CBM with mixed $sp$ character and the $p$-like VBM the gap deformation potentials remain small. An exception appears for 2H-Ge, for which the indirect gap deformation potential tends to be small of 6.5 eV but positive. \subsection{\label{sec4b}Interface influence} The band lineups of conduction and valence bands can be simulated for supercells containing an itterface between the two materials, forming a heterostructure. In general, the theoretical modeling of interfaces is difficult because of possible lattice mismatches, crystal structure misfits, heterovalencies, chemical and structural disorder, and presence of defect states. In the case of hexagonal Si$_x$Ge$_{1-x}$ alloys, grown pseudomorphically on top of each other, one can focus on the lattice mismatch and the configuration of Si and Ge atoms on the atomic sites at the heterointerface. A powerful tool is the superlattice method with superlattice structures based on hexagonal Si$_x$Ge$_{1-x}$/Si$_y$Ge$_{1-y}$ heterostructures in the [0001] direction building a superlattice unit cell. In the simplest case we can match two hexagonal unit cells of Si$_n$Ge$_{4-n}$ and Si$_{n+1}$Ge$_{3-n}$ ($n=0,1,2,3$), joining the surfaces perpendicular to the $c$-axis to create a hexagonal supercell of (Si$_n$Ge$_{4-n}$)$_{1}$ (Si$_{n+1}$Ge$_{3-n}$)$_{1}$(0001) with an in-plane lattice constant $a$ and a $c$-lattice constant that is approximately twice the value of the corresponding lattice constant of the isolated hexagonal alloys. The resulting superlattice represents a hexagonal crystal with eight atoms, ($2n+1$) Si and ($7-2n$) Ge atoms in the unit cell with the lattice parameters $a$ and $c$. The highest complexity of the atomic arrangements in such a superlattice cell appears if a stoichiometric alloy Si$_{2}$Ge$_{2}$ is included. Because of the existence of the three configurations C1, C2, and C3 (see Fig.~\ref{fig1}(a)) several arrangements are possible at the interface. We consider three different atomic arrangements at the heterointerface of Si$_{2}$Ge$_{2}$ with Si$_{1}$Ge$_{3}$ to simulate Ge-rich junctions, as shown in Fig.~\ref{fig1}(b). We start with a minimum Si-Si bond distance along the $c$-axis, e.g. configuration C1, and then we consecutively move out one of the Si atoms in order to generate a maximum of Si-Si atomic separations, e.g. configuration C3 from Fig.~\ref{fig1}(b). Although the difference between these atomic configurations is very small in terms of the resulting lattice parameters, the actual atomic arrangement has a strong impact on the band-gap energy and the position of the CBM in \textbf{k}-space. A direct-indirect gap crossover occurs in the set of (Si$_{1}$Ge$_{3}$)$_{1}$(Si$_{2}$Ge$_{2}$)$_{1}$(0001) superlattices. A similar procedure is applied for the (Si$_{2}$Ge$_{2}$)$_{1}$(Si$_{3}$Ge$_{1}$)$_{1}$(0001) superlattices. For the two other superlattices (Ge$_{4}$)$_{1}$(Si$_{1}$Ge$_{3}$)$_{1}$(0001) and (Si$_{3}$Ge$_{1}$)(Si$_{4}$)$_{1}$(0001) only one configuration has to be studied. All these short-period superlattice geometries have to be optimized by atomic relaxations and minimization of the total energy. The resulting lattice parameters $a$ and $c$ are listed in Table~\ref{tab5}. In the cases of presence of Si$_{2}$Ge$_{2}$ alloys we only list the average values. These $a$-parameters, together with the $a$-lattice constants in Table~\ref{tab1}, allow to define the biaxial strain $\epsilon_\|$ \eqref{eq3} at the interface between two alloys. \begin{table*}[h!] \caption{Results of the superlattice approach and the macroscopic treatment using elastic moduli for four different heterostructures. Lattice constants $a$ and $c$ (in {\AA}), biaxial strain $\epsilon_\|$ (in \%), and band energies $E_v$, $E_c$, and $E^{\rm ind}_c$ (in eV) estimated with the deformation potentials in Table~\ref{tab4}. For the Si$_2$Ge$_2$ alloys energies are computed for the configurations C1, C2, C3 and their average. Therefore, four different sets of band energies appear for Si$_{1}$Ge$_{3}$/Si$_{2}$Ge$_{2}$ and Si$_{2}$Ge$_{2}$/Si$_{3}$Ge$_{1}$ heterostructures. } \begin{tabular}{cccccccccccc} \hline hetero- & \multicolumn{3}{c}{super. app.} & \multicolumn{2}{c}{macro. app.} & \multicolumn{3}{c}{super. app.} & \multicolumn{3}{c}{macro. app.} \\ \cline{2-12} structure & $a$ & $c$ & $\epsilon_\|$ & $a$ & $\epsilon_\|$ & $E_v$ & $E_{c}$ & $E^{\rm ind}_c$ & $E_v$ & $E_{c}$ & $E^{\rm ind}_c$ \\ \hline Ge$_4$ & & & $-$0.96 & & \llap{$-$}0.65 & 0.319 & 0.763 & 0.875 & 0.300 & 0.710 & 0.880 \\ Ge$_4$/Si$_1$Ge$_3$ & 3.9577 & 13.0676 & & 3.969 & & & & & & & \\ Si$_1$Ge$_3$ & & & { } 0.29 & & 0.60 & 0.253 & 0.777 & 1.033 & 0.240 & 0.720 & 1.020 \\ Si$_1$Ge$_3$ & & & $-$0.77 & & \llap{$-$}0.61 & 0.316 & 0.944 & 1.078 & 0.307 & 0.918 &1.019 \\ Si$_1$Ge$_3$/Si$_2$Ge$_2$ & 3.9161 & 12.9289 & & 3.922 & & & & & & & \\ Si$_2$Ge$_2$ & & & { } 0.41 & & $0.57$ & 0.063 & 1.020 & 0.977 & 0.055 & 0.992 &0.969 \\ & & & & & & 0.097 & 1.070 & 0.983 & 0.089 &0.976 & 0.977 \\ & & & & & & 0.268 & 0.791 & 0.927 & 0.257 & 0.821 & 0.918 \\ & & & & & & 0.143 & 0.960 & 0.962 &0.133 & 0.930 & 0.955\\ & & & & & & 0.117 &1.241 & 1.022 & 0.115 & 1.236 & 1.021 \\ & & & & & & 0.154 & 1.311 & 1.024 & 0.153 & 1.292 & 1.023 \\ & & & & & & 0.334 & 1.035 &0.982 &0.336 & 1.031 & 0.981\\ Si$_2$Ge$_2$ & & & $-$0.52 & & \llap{$-$}0.50 & 0.202 & 1.195 & 1.009 & 0.201 &1.186 & 1.008 \\ Si$_2$Ge$_2$/Si$_3$Ge$_1$ & 3.8796 & 12.8128 & & 3.880 & & & & & & & \\ Si$_3$Ge$_1$ & & & { }0.44 & & 0.47 & 0.026 & 1.259 & 0.937 & 0.024 & 1.249 & 0.935 \\ Si$_3$Ge$_1$ & & & $-$0.49 & & \llap{$-$}0.48 & 0.090 & 1.459 & 0.993 & 0.087 &1.452 & 0.992 \\ Si$_3$Ge$_1$/Si$_4$ & 3.8435 & 12.7039 & & 3.844 & & & & & & & \\ Si$_4$ & & & { } 0.45 & & 0.46 & $-$0.137 & 1.501 & 0.892 &$-$0.139 & 1.487 & 0.891\\ \hline \end{tabular} \label{tab5} \end{table*} The lattice constants and strains found for short-period superlattices should be evaluated in comparison with results of calculations for heterostructures with thicker layers. In fact, the elastic energy \cite{Kittel:2005:Book} of a superlattice of pseudomorphically grown hexagonal materials has to be minimized. For thicker layers of Si$_x$Ge$_{1-x}$ and Si$_y$Ge$_{1-y}$, with thickness $D(x)$ and $D(y)$, one finds as the minimum condition for the common in-plane lattice constant: \begin{equation}\label{eq5} a=\frac{D(x)Y(x)a(x)+D(y)Y(y)a(y)}{D(x)Y(x)+D(y)Y(y)} \,, \end{equation} using the biaxial moduli $Y=C_{11}+C_{12}-2(C_{13})^2/C_{33}$ and the in-plane lattice constants $a(x)$ and $a(y)$.This condition defines biaxial strain of the two materials forming the heterostructure, \begin{eqnarray}\label{eq6} \epsilon_\|(x)=\frac{D(y)Y(y)}{D(x)Y(x)+D(y)Y(y)}\frac{a(y)-a(x)}{a(x)}, \nonumber \\ \epsilon_\|(y)=\frac{D(x)Y(x)}{D(x)Y(x)+D(y)Y(y)}\frac{a(x)-a(y)}{a(y)}. \end{eqnarray} In the case of equal thicknesses $D(x)=D(y)$, the mismatch in the elastic properties $Y(x)\neq Y(y)$ destroys the almost (apart from sign) symmetric distribution $\epsilon_\|(x)\approx -\epsilon_\|(y)$. If one layer is much thicker than the other one, e.g. $D(y)\gg D(x)$, it holds that $a=a(y)$, $\epsilon_\|(x)=\frac{a(y)-a(x)}{a(x)}$ and $\epsilon_\|(y)=0$. In the case $D(x)=D(y)$, employing the $a$ and $Y$ parameters from Table~\ref{tab1}, expressions \eqref{eq5} and \eqref{eq6} deliver similar common lattice constants and biaxial strains in Table~\ref{tab5} as in the case of short-period superlattices. The common lattice constant of the heterostructure \eqref{eq5} and the strains on both sides of the interface \eqref{eq6} tend, indeed, to approach the symmetric case $a=\frac{1}{2}[a(x)+a(y)]$ and $\epsilon_\|(x)\approx -\epsilon_\|(y)$. \subsection{\label{sec4c} Band edges and confinement in strained heterostructures} The \emph{ab initio} calculations of the atomic geometry of the (Si$_n$Ge$_{4-n}$)$_{1}$/(Si$_{n+1}$Ge$_{3-n}$)$_{1}$(0001) ($n=0,1,2,3$) superlattices can be also combined with MBJLDA calculations of the electronic structure. However, the resulting band structures in {\bf k}-space cannot be immediately related to the band edges $E_v$, $E_c$, and $E^{\rm ind}_c$ versus a real space coordinate along the layer stacking. An approximate approach to the band-edge profiles through the heterointerface in $z$-direction is possible by calculating the local site-projected density of states (PDOS). The PDOS is estimated by projection of the DOS onto each atom and by plotting the band edges around the local fundamental gap versus the $z$-coordinate of the atomic layer \cite{Yamasaki.Kaneta.ea:2001:PRB,Seino.Bechstedt.ea:2010:PRB,Rauch.Marques.ea:2020:JCTC}. Results for the four studied superlattices, however, indicate that the projection technique is not applicable. The superlattice layers are too thin. They mainly consist of interface regions, so that nearly constant band edge positions on both sides of an interface cannot be determined. For that reason we also studied superlattices with significantly thicker layers. A method described in detail in Ref.~\cite{Belabbes.Carvalho.ea:2011:PRB} is applied. The electronic structure results are displayed in Figs.~\ref{fig5} and \ref{fig6} for superlattices with 32 atomic layers, more precisely 16 atomic layers on each side of an interface, in one superlattice unit cell. In other words hexagonal (Si$_{n}$Ge$_{4-n}$)$_4$(Si$_{n+1}$Ge$_{3-n}$)$_4$(0001) superlattices with $n=0,1,2,3$ are studied. The resulting band structures are shown in Fig.~\ref{fig5} together with a background that illustrates the band regions of the projected band structure of the hexagonal barrier materials consisting of Si$_{n+1}$Ge$_{3-n}$ four-atom unit cells. The BP alignment is applied to align the superlattice and the projected band structures in each panel of Fig.~\ref{fig5}. The VBM of the superlattices is used as energy zero for all superlattices. The direct gaps at $\Gamma$ of the four superlattices are 0.43 ($n=0$), 0.74 ($n=1$), 1.26 ($n=2$), and 1.55 ($n=3$) eV larger than the direct gaps of the hexagonal Si$_n$Ge$_{4-n}$ materials given in Table~\ref{tab3}. This observation indicates the presence of quantum confinement of electrons and holes at $\Gamma$ in the Ge-richer superlattice layers, or type-I heterostructure behavior of carriers in these regions, in agreement with the natural band lineups of Fig.~\ref{fig3}. For the indirect gaps, we report a gap increase of 0.62 ($n=0$), 0.77 $(n=1)$, 0.94 ($n=2$), and 1.00 ($n=3$) eV for the CBM at the M point of the superlattice BZ, showing that confinement is less pronounced. Electron confinement is present in the direct-gap $n=0$ and $n=1$ superlattices, while the indirect-gap $n=2$ and $n=3$ superlattices tend to smaller values, clearly visible for the (Si$_3$Ge$_1$)$_4$(Si$_4$)$_4$(0001) superlattice, where the projected bulk Si band structure is below the superlattice CBM at M. These findings are in agreement with Fig.~\ref{fig3}, which clearly suggests hole confinement in the Ge-rich regions when the MBJLDA approach is applied. We observe that the energy distance between the band extrema of the superlattice bands and the projected band structure are somewhat smaller than the values found for the natural band discontinuities in Fig.~\ref{fig5} and Table~\ref{tab3}. The hole confinement in the Si-poorer alloy regions of all superlattices is visible. From the distance to the shaded region one may conclude that the deepness of the corresponding hole quantum well increases with rising Si composition in the superlattice. For electrons the situation is more complex. For Si-poor compositions the superlattices are direct semiconductors and localized electron states appear at $\Gamma$. This behavior at $\Gamma$ continues in Si-richer superlattices. However, the true conduction band minima appear at M in the superlattice BZ. The confinement of electrons at $\Gamma$ in the Ge-richer layers is hardly visible. Summarizing, the band structures of the Ge-rich superlattices clearly show a type-I heterobehavior using MBJLDA bands, as suggested by the natural band lineups in Fig.~\ref{fig3}. The situation for lower Ge contents is less clear. This tendency for type-I heterobehavior is not only indicated by the lowest conduction band and highest valence band in the fundamental gap of the barrier material in the Ge-richer direct-gap superlattices in Fig.~\ref{fig5}. A pronounced type-I (type-II) heterostructure behavior of the Ge-rich (Si-rich) superlattices is also demonstrated by the wave function squares of the superlattice Bloch functions of the lowest conduction and highest valence band, as shown in Fig.~\ref{fig6}. In Ge-richer superlattices both wave functions, for electrons and holes at $\Gamma$, are localized in the Ge-rich layer of the superlattice structure, clearly representing a type-I behavior. One may speak about a multi-quantum well structure with electron and hole wells in the Ge-rich layers, while Si-richer layers form barriers for both carrier types. There is a complete change in Fig.~\ref{fig6} for the Si-richer superlattices. Hole and electron wave functions are now localized in different regions of the superlattice. A type-II heterojunction behavior is suggested by the wave function localization. The holes remain localized in the Si-poorer layers, while electrons are more likely to be in Si-richer layers. In order to determine the pure effect of the biaxial strain on the band lineups between the two different materials, biaxial strains are extracted for short-period superlattices with layers of equal thickness in the unit cell and listed in Table~\ref{tab5}. These strains \eqref{eq3}, together with the deformation potentials of Table~\ref{tab4}, lead to band edge positions \eqref{eq4} with respect to the BP as energy zero. They lead to the plots of Fig.~\ref{fig7} for the band positions and band discontinuities. We note that in Fig.~\ref{fig7}(a) the strains directly extracted from the \emph{ab initio} optimized geometries of the short-period superlattice are used, while the biaxial strains \eqref{eq6} estimated by means of the elastic moduli $Y$ and the in-plane lattice constants $a$ of the unstrained alloys, both in Table~\ref{tab1}, are applied in Fig.~\ref{fig7}(b). Qualitatively, both Figs.~\ref{fig7}(a) and \ref{fig7}(b) show the same band lineups with pronounced quantum wells for holes in the Ge-rich material layer. However, in the light of the goal to fabricate hexagonal Si$_x$Ge$_{1-x}$ heterostructures, which are suitable for active optoelectronic devices, Fig.~\ref{fig7} exhibits a somewhat more pronounced tendency for hole confinement compared to the natural band lineups in Fig.~\ref{fig3}. The conduction band offsets guaranteeing a type-I heterostructure are generally reduced and all the heterojunctions with more silicon mixed-in into the well, as well as barrier material, exhibit a clear tendency to become indirect semiconductors, with the lowest conduction band minimum located at the LM line in {\bf k}-space or M point in the superlattice BZ. Only the hexagonal Ge/Si$_{0.25}$Ge$_{0.75}$ heterojunction, and perhaps also the Si$_{0.25}$Ge$_{0.75}$/Si$_{0.5}$Ge$_{0.5}$ interface, represents a type-I heterostructure, however, with two deficiencies. (i) The barrier for the electrons and, therefore, their quantization in the pure 2H-Ge or Si$_{0.25}$Ge$_{0.75}$ layer is much smaller compared to the result for natural alignment in Fig.~\ref{fig3}. (ii) The lowest-energy optical transitions inside 2H-Ge still possesses only a small oscillator strength \cite{Belabbes.Bechstedt.ea:2021:PSSRRL}. In order to improve the situation for the construction of a heterostructure laser based on a hexagonal Si$_x$Ge$_{1-x}$/Si$_y$Ge$_{1-y}$ alloy system, one has to find a way to reduce the compressive biaxial strain in the Ge-richer layer. One option to do so is to increase the thickness $D(x)$ compared to $D(y)$. Then, according to \eqref{eq6} the compressive strain $|\epsilon_\|(x)|$ can be reduced in comparison to the tensile strain $|\epsilon_\|(y)|$. Together with the condition to have a reasonable strength of the optical transitions \cite{Belabbes.Bechstedt.ea:2021:PSSRRL}, the heterostructure Si$_{0.25}$Ge$_{0.75}$/Si$_{0.5}$Ge$_{0.5}$ could be a promising system if, indeed, a larger thickness of the Ge-rich layer is reached. In Fig.~\ref{fig7} average values are presented in the Si$_2$Ge$_2$ case. Figure~\ref{fig8} shows the band lineups for a situation where in the heterostructures the alloy with $y=0.5$ is realized by only one configuration, C1, C2, or C3 (see Fig.~\ref{fig1}). The hole wells appear to be in the Ge-rich regions independent of the atomic configuration. However, the position of the CBM varies with the atomic distribution corresponding to the Si-richer layer. A type-I (with C1 and C2) or type-II (with C3) heterostructure character appears in dependence of the actual atomic configuration. \section{\label{sec5}Summary and conclusions} The electronic properties of heterostructures made of hexagonal Si$_x$Ge$_{1-x}$ alloys have been studied by means of \emph{ab initio} calculations of atomic geometries, based on density functional theory and using approximate quasiparticle approaches for the band structures. Two different alignment procedures to construct natural band lineups are tested, together with the direct calculation of various hexagonal unit cells to describe alloys and heterojunctions. We applied elastic theory to model the influence of biaxial strain, in particular in the case of pseudomorphically grown heterosystems. The natural band lineups have been investigated comparing the branch point and vacuum level alignments. Moreover, the influence of the underlying approximate quasiparticle method, namely the MBJLDA or HSE06 functionals, is considered. We can conclude that the selection of one of these approximation has a negligible effect in terms of the general accuracy of the band offsets $\Delta E_c$ and $\Delta E_v$. The different alignment methods lead also to similar results, so that we decided to choose the branch point alignment, that only requires bulk calculations. Calculations for diamond Si and Ge allowed to validate the values of the branch point energies and the natural band discontinuities, comparing with experiemnts and previous calculations. Consequences of the negative branch points in Ge-rich alloys have been predicted for carrier accumulation at hexagonal Ge and alloy surfaces. The true band offsets appearing at almost pseudomorphic heterointerfaces have been investigated for different thicknesses of the alloy layers composing the heterojunction. The limit of thin layers has been studied within a superlattice approach. It gives rise to compressive (tensile) biaxial strains of order of $\pm0.5$~\% in the Ge-richer (less Ge-rich) alloys. However, for larger thicknesses, but always in the range of validity of elastic theory, similar strains result from the minimization of the elastic energy of the junction. The strain profiles with compressive strain at the Ge-richer side and tensile strain at the Si-richer side tend to deepen the hole quantum wells, and flatten the electron quantum wells in the Ge-poorer layers. Also the type-I character of the heterostructures is reduced. This tendency is accompanied by a transition of the heterostructure from a direct semiconductor to an indirect one with rising Si composition. These results are confirmed by electronic structure calculations of the band structures and the wave functions, performed for superlattices with thicker layers. Consequently, we propose to achieve a reduction of the compressive strain at the Ge-rich side to make the pseudomorphic heterojunctions suitable for active optoelectronic applications. \section*{Acknowledgements} We acknowledge financial support from the H2020-FETOpen project OptoSilicon (grant agreement No. 964191).
\section{Introduction} Galaxy clusters are the most massive gravitationally self-bound objects in the Universe. These clusters form at the rare high peaks of the initial density field and the abundance of clusters and its time evolution are sensitive to the growth of structure in the Universe. Hence, clusters have been used to constrain cosmological parameters \citep{Whieetal:93,Haiman:2001,Vikhlininetal:09,Rozoetal:10,TakadaBridle:07,OguriTakada:2011} \citep[also see][for a review]{Weinberg:2013}. Many ongoing and future galaxy surveys, such as the Hyper Suprime-Cam (HSC) survey \citep{HSCOverview:17}, the Dark Energy Survey\footnote{\url{ https://www.darkenergysurvey.org}} (DES) \citep{DES2005}, the Kilo Degree Survey\footnote{\url{http://kids.strw.leidenuniv.nl/}} (KiDS) \citep{KiDs2015}, the Rubin Observatory Legacy Survey of Space and Time\footnote{\url{https://www.lsst.org}} (LSST) \citep{LSST2009}, \textit{Euclid}\footnote{\url{ https://sci.esa.int/web/euclid}} \citep{euclid2018}, and the Nancy Grace Roman Telescope\footnote{\url{https://wfirst.gsfc.nasa.gov}} \citep{WFIRST2019}, will provide unprecedented numbers of clusters and enable us to carry out cluster cosmology analyses with great precision if all the systematic effects are under control. In particular, these optically identified clusters from the photometric surveys are known to be susceptible to the systematic effects due to the photometric redshift uncertainties of galaxies. One of the main systematic effects for optically identified clusters is so-called “projection effects” that interloper galaxies along the line-of-sight (LOS) to a cluster are mistakenly identified as members of the cluster. The projection effects alter the mass-observable relation such that the observable for the optical clusters, which is the weighted sum of member galaxies (referred to “richness”), is boosted concerning its halo mass \citep[e.g.][]{costanzietalprojection}. In addition to the alternation of the mass-richness relation, \cite{Sunayama_etal2020} found that projection effects boost the amplitude of cluster lensing and clustering signals on large scales due to the preferential identification of filaments aligned with the LOS direction as a cluster. This results in the anisotropic distribution of matter around the optical clusters. The predicted size of this anisotropic boost from \cite{Sunayama_etal2020} is roughly $20-30\%$. These anisotropic boosts have been parameterized in a few cluster cosmology analysis. \cite{To_Krause2021} modeled the boost in their combined cosmology analysis with clusters and galaxies and obtained a similar size of the boost as the study by \cite{Sunayama_etal2020}. \cite{Park_etal2021} also employed this boost model in their cluster cosmology analyses and applied their full forward modeling method to the red-sequence Matchedfilter Probabilistic Percolation (redMaPPer) cluster catalog \citep{Rykoff_etal2014}, constructed from the Sloan Digital Sky Survey (SDSS) DR8 data \citep{Aihara:2011}. While the constrained value for the boost parameter in \cite{Park_etal2021} was consistent with \cite{To_Krause2021}, the result for the cosmological parameters favored low $\Omega_m$ and high $\sigma_8$. This questions how the boost exactly manifests in the real data observables, i.e., in the measured lensing and clustering signals. Even though the boost of the lensing and clustering amplitudes has been modeled and constrained in these cosmology analyses, no study finds a direct evidence of this effect. The goal of this study is to quantitatively constrain the size of this anisotropic boost in the amplitude of clustering and lensing signals seen in \cite{Sunayama_etal2020}. For this, we develop a novel method to quantify the boost caused by the projection effects with two simple assumptions using cluster-galaxy cross-correlation functions. The cross-correlation with spectroscopic galaxies provides a way to evaluate the anisotropic structure around the optical clusters. We first validate our method using mock cluster catalogs built from cosmological N-body simulations, and measure the anisotropic boost parameter in the SDSS redMaPPer clusters using this method. This is the first study to directly constrain the boost parameter using cluster-galaxy cross-correlation functions and provide a self-consistency test for the projection effects. This paper is organized as follows: in Section 2 we describe the details of the mock cluster catalog as well as the galaxy cluster sample. In Section 3 we explain our method to quantify the boost using the cluster-galaxy cross-correlation functions. In Section 4, we first validate our method using the mock cluster catalog and apply it to the SDSS redMaPPer clusters. We summarize our work and discuss its implication in Section 5. \section{Data} \label{sec:data} In this section, we describe the details of the simulations as well as how we build the galaxy and cluster mock catalogs. In principle, we are following these procedures from \cite{Sunayama_etal2020}. \subsection{$N$-body Simulations and Halo Catalogs} \label{sec:sim:nbody} We use the $N$-body simulations and halo catalogs from \cite{darkemu}. These $N$-body simulations were performed with $2048^3$ particles in a comoving cubic box with side lengths of $1h^{-1}{\rm Gpc}$, assuming the best-fit flat $\Lambda$CDM model\footnote{$\{\omega_{\rm b},\omega_{\rm c},\Omega_{\rm \Lambda},\ln(10^{10}A_{\rm s}),n_{\rm s}\} = \{0.02225,0.1198,0.6844,3.094,0.9645\}$} from \textit{Planck} Data Release 2 \citep{Planck:2015}. The initial displacement vector and the initial velocity of each $N$-body particle was set by second-order Lagrangian perturbation theory \citep{scoccimarro98,crocce06a,crocce06b,nishimichi09} with an input linear matter power spectrum computed from the publicly available Boltzmann code {\tt CAMB} \citep{camb}, and the subsequent time evolution of the particle distribution was simulated using the parallel Tree-Particle Mesh code {\tt Gadget2} \citep{Springel:2005}. The {\it Planck} model has $\Omega_{\rm m}=0.3156$ (the present-day matter density parameter), $\sigma_8=0.831$ (the present-day RMS linear mass density fluctuations within a top-hat sphere of radius $8~h^{-1}{\rm Mpc}$) and $h=0.672$ for the Hubble parameter. The particle mass is $1.02\times 10^{10}~h^{-1}M_\odot$. To generate halo catalogs, we first take simulation snapshots at redshift $z=0.251$ -- chosen to be close to the mean redshift of SDSS redMaPPer clusters -- and identify halos using the Friends-of-Friends (FoF) halo finder \texttt{Rockstar} developed in \cite{Behroozi:2013} \citep[also see][for details]{darkemu}. We use the ``200m'' halo definition, defining halo masses as $M\equiv M_{\rm 200m}=(4\pi/3)(R_{\rm 200m})^3(200\bar{\rho}_{\rm m0})$ where $R_{\rm 200m}$ is the spherical halo boundary radius within which the mean mass density is $200\times \bar{\rho}_{\rm m0}$, where we use the present-day mean mass density $\bar{\rho}_{\rm m0}$ using comoving coordinates. Note that we use comoving length units for $R_{\rm 200m}$. Our definition of halo mass includes all particles within the radius $R_{\rm 200m}$ from the halo center, i.e. includes particles even if they are not gravitationally bound to the halo. We only keep halos with masses above $10^{12}\,h^{-1}M_\odot$ in the final halo catalog used in this paper. The ``minimum halo'' at $M=10^{12}~h^{-1}M_\odot$ consists of 100 $N$-body particles. \subsection{Mock Catalogs of Red-Sequence Galaxies/LOWZ Galaxies} \label{sec:sim:mocks_galaxy} We construct two types of mock catalogs from the $N$-body simulations discussed in Section~\ref{sec:sim:nbody}. One is mock red-sequence galaxies which represent the SDSS DR8 photometric galaxy catalog \citep{Aihara:2011} to build a cluster mock catalog, and the other is mock bright galaxies whose number in a halo and spatial distribution are similar to the BOSS LOWZ galaxies \citep{parejko_etal2012}. To construct these mock catalogs, we use the halo occupation distribution (HOD) formulation \citep{1998ApJ...494....1J,seljak:2000uq,peacock:2000qy,2005ApJ...633..791Z} to populate mock galaxies in halos. Our HOD model gives the expected numbers of central and satellite galaxies, $N_{\rm cen}(M)$ and $N_{\rm sat}(M)$, as a function of halo mass $M$: \begin{align} N_{\rm cen}(M)= \frac{1}{2}\left[ 1+{\rm erf}\left(\frac{\log M-\log M_{\rm cut}}{\sigma_{\log M}}\right) \right] \end{align} and \begin{align} N_{\rm sat}(M)=N_{\rm cen}(M)\left(\frac{M-\kappa M_{\rm cut}}{M_1}\right)^\alpha , \label{eq:HOD_sat} \end{align} where $M_{\rm cut}, M_1, \sigma_{\log M}, \kappa,$ and $\alpha$ are model parameters. With the HOD prescription in hand, we populate galaxies in halos by following \citep[also see][]{Kobayashi:2019jrn}: \begin{itemize} \item[(i)] {\it Central galaxies} -- a central galaxy is populated at the center of each halo with $M\ge 10^{12}~h^{-1}M_\odot$. We do not consider any off-centering between central galaxies and halo centers in this work for simplicity. We also set the velocity of the central galaxy to be equal to the velocity of the host halo. \item[(ii)] {\it Satellite galaxies} -- For each halo with $M\ge 10^{12}~h^{-1}M_\odot$, the number of satellite galaxies $N_{\rm sat}$ is determined from a Poisson random draw with mean given by Eq.~(\ref{eq:HOD_sat}). Once $N_{\rm sat}$ is set, we distribute each satellite galaxy according to a Navarro-Frenk-White \citep[][hereafter NFW]{nfw97} profile specified by the halo mass and the \cite{2015ApJ...799..108D} mass-concentration relation. Note that we limit the extent of the NFW profile to within the $R_{\rm 200m}$ boundary. For velocity assignment, we assume that satellite galaxies are randomly moving inside the host halos. Therefore, the velocities of the satellite galaxies are the sum of their host halo velocity and a random virial component. For this random component, we draw from a Gaussian distribution with zero mean and variance given by \begin{align} \left < v_x^2 \right >=\left <v_y^2 \right >=\left <v_z^2\right >=\frac{1}{3}\frac{GM_{\rm 200m}}{R_{\rm 200m}}. \label{eq:v_sat} \end{align} \end{itemize} Following \cite{2018arXiv181009456C}, we use parameter values of $M_{\rm cut}=10^{11.7}~h^{-1}M_\odot$, $M_1=10^{12.9}~h^{-1}M_\odot$, $\sigma_{\log M}=0.1$, $\kappa=1.0$, and $\alpha=1.0$ for the red-sequence galaxy mock catalog. This parameter configuration implies $N_{\rm cen}(M)= 1 \mbox{ for } M\ge 10^{12}h^{-1}M_\odot$, i.e. all identified halos in our halo catalogs receive a central galaxy. The resulting galaxy number density of our mock catalogs is about $7.4\times 10^{-3}~(h^{-1}{\rm Mpc})^{-3}$ on average, which is roughly consistent with the number density of red galaxies used to identify the SDSS redMaPPer clusters. In addition, we generate a galaxy mock catalog for SDSS LOWZ galaxies with $M_{\rm cut}=10^{13.25}~h^{-1}M_\odot$, $M_1=10^{14.18}~h^{-1}M_\odot$, $\sigma_{\log M}=0.70$, $\kappa=1.04$, and $\alpha=0.94$ following \cite{parejko_etal2012}. We perform this procedure on 19 independent realizations of the $(1~{h^{-1}{\rm Gpc}})^3$ box simulations. \subsection{Cluster Finder and Mock Cluster Catalogs} \label{sec:sim:mocks_cluster} With the mock red-sequence galaxies in hand, we construct the cluster mock catalog using the cluster finder based on the redMaPPer cluster finder \citep{Rykoff_etal2014,Rozo2014, Rozo2015, Rozo2015_2}. The details of the algorithm and its implementation are described in the following \cite{SunayamaMore} and \cite{Sunayama_etal2020}. At first, we consider all the galaxies in the catalog as potential cluster central galaxies with a probability $p_{\rm free}=1$. $p_{\rm free}$ is the prior that the galaxy does not belong to any other richer galaxy cluster, and a membership probability $p_{\rm mem}$ is the probability to be a member of the cluster. $p_{\rm mem}$ and $p_{\rm free}$ have a simple relation of $p_{\rm free}=1-p_{\rm mem}$. We model the photometric redshift uncertainty by assuming the specific projection length $d_{\rm proj}$. This is the simplifying assumption that the photometric redshift filter used to group galaxies along the redshift direction will have a poor resolution and therefore identify galaxies within a certain distance along the LOS as cluster members. Then, we compute the initial richness $\lambda$ for each candidate central galaxy by taking all the galaxies within a radius of $0.5h^{-1}{\rm Mpc}$ and the LOS length $|\pi| < d_{\rm proj}$. We use $d_{\rm proj}=120h^{-1}{\rm Mpc}$ as our default choice, but we generate cluster mock catalogs with $d_{\rm proj}=30h^{-1}{\rm Mpc}$ and $d_{\rm proj}=60h^{-1}{\rm Mpc}$ as well. In this first step, the membership probability will not be changed even after the galaxy is assigned to one of the cluster candidates and the cluster finder continues to go down the list of galaxy centers to find overall over-density regions. Once the first iteration is done, we eliminate all the cluster candidates with $\lambda <3$ from the list of the candidates. Then, we rank-order the clusters in a descending order based on the initial richness $\lambda$ and take percolation steps iteratively. Starting from the cluster with the largest richness, we take the following steps. \begin{enumerate} \item Given the $i^{\rm th}$ central galaxy in the list, recompute $\lambda$ and the membership probability based on the percolated galaxy catalog. \item Compute the radius of $R_{c}(\lambda)$ and take all the galaxies within the radius of $R_{c}(\lambda)$ and the projection length $d_{\rm proj}$. The radial cut scales with $\lambda$ is defined as \begin{equation} R_{\rm c}(\lambda) = R_0 (\lambda/100.0)^{\beta}\, \label{eq:radius} \end{equation} where $R_0=1.0h^{-1}{\rm Mpc}$ and $\beta=0.2$ as adopted in redMaPPer. \item Among all the member galaxies, if there is a more massive central galaxy than the currently considered one (i.e., the central galaxy in a more massive halo), check whether that galaxy is already considered as a cluster center or not. If not, consider that central galaxy as a new cluster center and recompute $\lambda$ and $R_{c}(\lambda)$. \item Determine the membership probability by numerically solving Eqn. \ref{eq:pmem} and \ref{eq:lambda}, using all the galaxies within the radius of $R_{c}(\lambda)$ and the projection length $d_{\rm proj}$. The membership probability is defined as \begin{equation} p_{\rm mem} = \frac{\lambda u(x|\lambda)}{\lambda u(x|\lambda) + b(x)}\, \label{eq:pmem} \end{equation} where $x$ denotes the projected distance of the galaxy from the cluster center and $b(x)$ denotes the background contamination, which is assumed to be a constant to model the uncorrelated galaxies in the foreground and the background. We use the projected NFW profile \citep{nfw97,Bartelmann96} for $u(x|\lambda)$ and the profile is truncated smoothly at a projected radius $R=R_{\rm c}$ with an error function as described in \cite{Rykoff_etal2014}. The richness $\lambda$ is defined as \begin{equation} \lambda = \sum_{R<R_{\rm c}(\lambda)} p_{\rm free} p_{\rm mem}(x|\lambda)\,, \label{eq:lambda} \end{equation} where the sum goes over all members of a galaxy cluster within a cluster radius $R<R_{\rm c}(\lambda)$ and the LOS separation $|\pi|<d_{\rm proj}$. \item Update the probability $p_{\rm free}$ for each galaxy to be $p_{\rm free}(1-p_{\rm mem})$ based on their membership probabilities of the current cluster. If $p_{\rm free}>0.5$, then these galaxies are eliminated from the list. \item Repeat the steps for the next galaxy cluster in the ranked list. \end{enumerate} By running this cluster finder to the mock red galaxy catalog, we generate the mock cluster catalogs. We select clusters with richness $20\leq \lambda \leq 200$ at $z=0.25$. \begin{figure*} \includegraphics[width=0.43\textwidth]{ratio_pre_r.pdf} \includegraphics[width=0.43\textwidth]{ratio_post_r_dproj120_v2.pdf} % \caption{\label{fig:example} {\it Left}: The projected cross-correlation function of clusters and galaxies relative to the galaxy auto-correlation function with $\pi_{\rm max}=30$, $60$, and $100h^{-1}{\rm Mpc}$. We use the halos whose masses are greater than $10^{14}h^{-1}{\rm M}_{\odot}$ (i.e., no projection effects). {\it Right}: The same as the left figure, the cross-correlation functions with the "observed" clusters which are identified by the cluster finder explained in Sec.~\ref{sec:sim:mocks_cluster}. When the clusters suffer from the projection effects, the clustering amplitude depends on the choice of the integral scale $\pi_{\rm max}$. } \end{figure*} \subsection{SDSS redMaPPer galaxy clusters} \label{sec:obs:redmapper} We use the publicly available catalog of galaxy clusters identified from the SDSS DR8 photometric galaxy catalog v5.10 by the redMaPPer cluster finding algorithm \citep{Rykoff_etal2014,Rozo2014}. The cluster finder uses the $ugriz$ magnitudes and their errors, to identify overdensities of red-sequence galaxies with similar colors as galaxy clusters. For each cluster, the catalog contains an optical richness estimate $\lambda$, a entering probability $p_{\rm cen}$, position as well as a photometric redshift $z_\lambda$ and a spectroscopic redshift $z_{\rm spec}$ if available. This redMaPPer cluster catalog is volume-limited up to $z=0.33$, and we select galaxy clusters with $20 \leq \lambda \leq 200$ at $0.1 \leq z \leq 0.33$. We limit our cluster sample to the ones with a spectroscopic redshift. This is to reduce uncertainties due to the photometric redshift in the clustering measurement. In total, we have 8648 clusters, which is $81.5\%$ of all the clusters selected in the same condition with a photometric redshift. Throughout this paper, we use the position of the most probable central galaxy in each cluster region as a proxy of the cluster center. We also use the random catalogs provided along with the redMaPPer cluster catalog. These catalogs contain corresponding position information, redshift, richness, and a weight for each random cluster. \subsection{BOSS DR12 LOWZ sample} \label{sec:obs:dr12_lowz} We will carry out a cross-correlation of the redMaPPer galaxy clusters with spectroscopic galaxies to study the effect of the projection effects on the redMaPPer clusters. We use the spectroscopic galaxies in the large-scale structure catalogs constructed from SDSS DR12 \citep{Alam:2015}. In particular, we will use the LOWZ sample, since it has a large overlap in redshift range as our galaxy cluster sample. We restrict ourselves to LOWZ galaxies with redshifts between $0.1 \leq z \leq 0.33$, the same redshift range as our galaxy clusters. The galaxy catalogs also come with associated random galaxy catalogs that we use to perform our cross-correlation analysis. \section{Methods} \label{sec:method} \begin{figure*} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj30.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj60.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj120.pdf} % \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj30.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj60.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj120.pdf} \caption{\label{fig:var_dproj} The projected cross-correlation functions of clusters and galaxies relative to the galaxy auto-correlation functions. The clusters are identified by the cluster finder with the projection length of $d_{\rm proj}=30h^{-1}{\rm Mpc}$ (left), $60h^{-1}{\rm Mpc}$ (middle), and $120h^{-1}{\rm Mpc}$ (right). The top panels are the ratios of the projected correlation functions in real-space, while the bottom panels are the ones in redshift-space. These figures indicate that the increase of clustering amplitude based on the integral scale stops when the integral scale exceeds the projection length. } \end{figure*} In this section, we introduce necessary tools to quantitatively constrain the size of the anisotropic boost in the amplitude of clustering and lensing signals caused by the projection effects. \subsection{Projected Correlation Functions} \label{sec:method:wp} To measure the boost of the cluster sample, we first calculate the cluster-galaxy cross correlation function $\xi_{\rm cg}$ via the Landy-Szalay estimator \citep{LandySzalay:93}, and then compute the projected correlation function by integrating $\xi_{\rm cg}(r)$ over the LOS direction (denoted as $\pi$), \begin{equation} w_{\rm p,cg}(R,\pi_{\rm max})=2\int_{0}^{\pi_{\rm max}}dr_{\pi}\xi_{\rm gc}(R,r_{\pi}),\label{eq:wp} \end{equation} where $\pi_{\rm max}$ is the maximum integral scale. For mocks, we simply split each $(1h^{-1}{\rm Gpc})^3$ box into eight $(0.5h^{-1}{\rm Gpc})^3$ sub-boxes and compute the covariance matrix using these sub-boxes. In total, we use 136 sub-boxes to compute the covariance matrix. For observational data, we use 83 jackknife regions, which is about $10\times10$ square degrees corresponding to roughly $100\times100(h^{-1}{\rm Mpc})^{2}$ for our cluster and galaxy samples. Due to the anisotropic distribution of matter/galaxy around clusters, the clustering amplitude of $w_{\rm p,cg}(R)$ depends on the choice of $\pi_{\rm max}$. As a demonstrative purpose, we use two mock cluster catalogs based on the N-body simulations described in Sec.~\ref{sec:sim:nbody} and compute the cluster-galaxy projected correlation functions. We refer the halos identified by the halo finder \texttt{Rockstar} and $M_{\rm 200m}>10^{14}h^{-1}{\rm M}_{\odot}$ as ``True'' cluster catalog. These cluster-sized halos do not suffer from the projection effects, because they are identified based on six-dimensional phase-space information of dark matter particles and there is no preferential selection of filamentary structure aligned to the LOS direction. So, the distribution of cluster-sized halos identified by \texttt{Rockstar} is isotropic. The left panel of Fig.~\ref{fig:example} shows the ratio of $w_{\rm p,cg}/w_{\rm p, gg}$ for the case of ``True'' clusters. The distribution of the clusters is isotropic, and therefore the ratio does not depend on $\pi_{\rm max}$. The right panel of Fig.~\ref{fig:example} shows the same ratio but for the clusters identified by the cluster finder. We call the clusters identified by our cluster finder described in Sec.~\ref{sec:sim:mocks_cluster} as ``Observed'' clusters. Due to the anisotropic distribution of matter around ``Observed'' clusters, the ratio increases as the integral scale $\pi_{\rm max}$ increases. The reason we use the galaxy auto-correlation functions $w_{\rm p, gg}$ to extract the anisotropic boost from $w_{\rm p,cg}$ is that we need some reference objects whose distribution is isotropic. \begin{figure*} \includegraphics[width=0.8\textwidth]{mcmc_post_s_l20to30_pca.pdf} % \caption{\label{fig:sim_mcmc_20to30} [The richness is from 20 to 30.] The posterior distribution of our model parameters using the ratio of the cross and autocorrelation functions with various integral scales. The measured parameters for the anisotropic boost parameter $\alpha$ and the projection length of $d_{\rm proj}$ are $0.283$ and $108h^{-1}{\rm Mpc}$, while the expected parameter values (shown as dotted lines) are boost=$0.273$ and $d_{\rm proj}=120h^{-1}{\rm Mpc}$. } \end{figure*} \subsection{Theoretical Modeling of Projection Effects} \label{sec:method:model} We model the anisotropic boost on $w_{\rm p,cg}(R)$ with two parameters $\alpha_0$ and $d_{\rm proj}$, \begin{align} w_{\rm p,cg}(R,\pi_{\rm max})=(1+\alpha_0(\pi_{\rm max}, d_{\rm proj}))w_{\rm iso,cg}(R) \label{eq:inertia} \end{align} where $\alpha_0$ is the boost of the clustering amplitude and $d_{\rm proj}$ is the projection length of the clusters (i.e., the maximum LOS distance of the member galaxies from the cluster center). $w_{\rm iso,cg}(R)$ is the expected projected cross-correlation function for the case of isotropically distributed clusters with the same halo masses. We assume that the boost parameter $\alpha_0$ is scale-independent on large scales. To model $\alpha_0$, we make the following assumptions: \begin{enumerate} \item $\alpha_0$ increases constantly as $\pi_{\rm max}$ increases, \item the increase of $\alpha_0$ stops when $\pi_{\rm max}>d_{\rm proj}$. \end{enumerate} These two assumptions are made based on the findings in \cite{BuschWhite:17} and \cite{SunayamaMore}. Both studies investigated the cause of large assembly signals detected in \cite{Miyatake:2016}. These studies found that the projection effects can boost the clustering amplitude and therefore can give a false detection of the assembly bias. These studies built a cluster finder with the projection effects and found that the anisotropic matter distribution around the clusters due to the projection effects can only extend up to $\pi \leq d_{\rm proj}$ (see Fig. 12 in \cite{BuschWhite:17} and Fig. 4 in \cite{SunayamaMore}). The above two assumptions are based on these findings. With these assumptions, we can describe $\alpha_0$ as \begin{equation} \alpha_0= \begin{cases} \alpha, & \text{if}\ \pi_{\rm max}>d_{\rm proj} \\ \alpha \frac{\pi_{\rm max}}{d_{\rm proj}}. & \text{otherwise} \end{cases} \end{equation} The top panels of Fig.~\ref{fig:var_dproj} show the ratio of $w_{\rm p,cg}/w_{\rm p,gg}$ for "Observed" clusters with richness $20 \leq \lambda \leq 30$. Each panel shows the clusters identified with $d_{\rm proj}=30 h^{-1}{\rm Mpc}$ (left), $60 h^{-1}{\rm Mpc}$ (middle), and $120 h^{-1}{\rm Mpc}$ (right). We compute the projected correlation functions in real-space. This is the supportive evidence for the second assumption that the increase of the boost stops roughly after $\pi_{\rm max}>d_{\rm proj}$ for the case of $\pi_{\rm max}=60h^{-1}{\rm Mpc}$ and $120h^{-1}{\rm Mpc}$, but not for the case of $\pi_{\rm max}=30h^{-1}{\rm Mpc}$. This means that our model is only valid for clusters with the large projection length. Since velocity dispersion of galaxies in clusters is roughly $\sigma_{v}\sim 3000{\rm km/s}$, we can only achieve $d_{\rm proj}=30h^{-1}{\rm Mpc}$ even for the case of spectroscopically identified clusters, and therefore assuming larger projection lengths than $30h^{-1}{\rm Mpc}$ is a fine assumption. In real-space, the ratio of the projected correlation functions is assumed to be constant, and therefore its model requires only three parameters $b_c/b_g$, $\alpha$, and $d_{\rm proj}$: \begin{equation} \frac{w_{\rm cg}(R,\pi_{\rm max})}{w_{\rm gg}(R,\pi_{\rm max})} = \frac{b_c}{b_g} (1+\alpha_0(\pi_{\rm max},d_{\rm proj})). \label{eq:ratio_real} \end{equation} The projected correlation function, however, is sensitive to the redshift-space distortion (RSD) effect when a sufficiently small value of $\pi_{\rm max}$ is taken (see Fig. 6 in \cite{vdBosch2013}). Even though we take the ratio of the two projected correlation functions, the scale-dependence induced by the RSD effect is different for the cluster-galaxy cross-correlation functions and galaxy auto-correlation functions. The model with the RSD effect has the following additional term to Eqn.~\ref{eq:ratio_real}. \begin{equation} \frac{(1+\frac{\beta_c+\beta_g}{3}+\frac{\beta_c \beta_g}{5}) w_{\rm p,0}+(\frac{2(\beta_c+\beta_g)}{3}+\frac{4\beta_c \beta_g}{7})w_{\rm p,2}+\frac{8\beta_c \beta_g}{35} w_{\rm p,4}}{(1+\frac{2 \beta_g}{3}+\frac{\beta_g^2}{5})w_{\rm p,0}+(\frac{4\beta_g}{3}+\frac{4 \beta_g^2}{7})w_{\rm p,2}+\frac{8 \beta_g^2}{35} w_{\rm p,4}}, \label{eq:ratio_RSD} \end{equation} where $\beta_c$ and $\beta_g$ are the growth rate $f$ divided by cluster and galaxy biases $b_c$ and $b_g$ respectively, $w_{\rm p,0}(R)$, $w_{\rm p,2}(R)$, and $w_{\rm p,4}(R)$ are the monopole, quadrupole, and hexadecapole of the projected correlation function: \begin{equation} w_{\rm{p},n}(R) = 2\int_{R}^{\infty}\xi_n(r) L_n(\mu) \frac{r dr}{\sqrt{(r^2-R^2)}}, \label{eq:abel} \end{equation} where $L_n(\mu)$ is the $n$th Legendre polynomials with $\mu=\sqrt{(r^2-R^2)}/r$. Following Eqn. 52-54 in \cite{vdBosch2013}, we define $\xi_n(r)$ as \begin{align} \xi_0(r) &= \xi_{\rm NL}(r),\\ \xi_2(r) &= \xi_{\rm NL}(r)-3J_3(r),\\ \xi_4(r) &= \xi_{\rm NL}(r)+\frac{15}{2}J_3(r)-\frac{35}{2}J_5(r), \label{eq:xi_n} \end{align} where $\xi_{\rm NL}(r)$ is the non-linear matter correlation function and \begin{align} J_n(r) =\frac{1}{r^n}\int^{r}_0 \xi_{\rm lin}(y)y^{n-1}{\rm d}y. \label{eq:J_n} \end{align} The bottom panels of Fig.~\ref{fig:var_dproj} show the ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ in redshift-space for the case of $d_{\rm proj}=30h^{-1}{\rm Mpc}$, $60h^{-1}{\rm Mpc}$, and $120h^{-1}{\rm Mpc}$. Compared to the case of real-space (top panels), the ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ in redshift-space shows a stronger scale-dependence due to the RSD effect, and the second assumption (i.e., the increase of the boost stops roughly after $\pi_{\rm max}>d_{\rm proj}$) seems violated. However, as long as the second assumption holds in real-space, this seeming violation of the assumption can be modeled following \cite{vdBosch2013} and will not be a problem. For the rest of the paper, we use the mock cluster catalog with $d_{\rm proj}=120h^{-1}{\rm Mpc}$ if it is not specified. \subsection{Parameter Inference} \label{sec:method:mcmc} We assume a Gaussian likelihood model and compute the likelihoods with the measurements $\mathbf{d}$ and the model predictions $\bm\upmu(\bm\uptheta)$, where $\bm\uptheta$ are the parameters, with covariances $\mathbf{C}$: \begin{equation} \ln \mathcal{L}(\mathbf{d}|\bm\uptheta) = -\frac{1}{2} \left[\mathbf{d}-\bm{\upmu}(\bm\uptheta)\right]^\intercal \mathbf{C}^{-1} \left[\mathbf{d}-\bm{\upmu}(\bm\uptheta)\right]. \end{equation} The data vector $\mathbf{d}$ is given by the ratios $w_{\rm p cg}/w_{\rm p,gg}$ for $\pi_{\rm max}=30, 60, 90, 120, 150 h^{-1}{\rm Mpc}$ on scales $R$. The parameters used for the model are $b_c$, $b_g$, $\alpha$, and $d_{\rm proj}$. We use flat priors for $\alpha$ and $d_{\rm proj}$: $\alpha \in [0,1]$, and $d_{\rm proj} \in [30,150]$. For $b_g$ and $b_c$, we use Gaussian priors: $b_g \sim \mathcal{N}(1.5,1.)$ and $b_c \sim \mathcal{N}(3.,1.)$. This is because the values of $b_g$ and $b_c$ are constrained independently only from the difference in the scale-dependence due to the RSD effect, and therefore these parameters are not strongly constrained with flat priors. To estimate the covariance matrix, we use roughly 80 independent realizations either by sub-dividing a set of the simulation realizations or by using the jackknife resampling method. Due to the large size of our data vector, the number of realizations or the jackknife regions is not enough to obtain the unbiased inverse covariance matrix. To mitigate this issue, we use a Principal Component Analysis on the covariance matrix $\mathbf{C}$ following the way described in Appendix C7 of \cite{Behroozi2019}. We first diagonalize the covariance matrix through an orthoganal matrix $\mathbf{U}$, $\mathbf{C}=\mathbf{U}\mathbf{D}\mathbf{U}^{-1}$ where $\mathbf{D}={\rm diag}(\sigma_1,\sigma_2,...)$, and then replace the $i$-th diagonal element $\sigma_i$ with the effective error $\sigma_{\rm eff,i}={\rm max}(0.1,\sigma_i)$ for the case of mock analysis. This is to include the systematic errors due to observational measurements such as fiber collisions and edge effects. The corresponding data vector for this diagonal covariance matrix $\mathbf{D}$ is $\mathbf{U}^{-1}(\mathbf{d}-\bm{\upmu}(\bm\uptheta))$. We perform Bayesian parameter inferences with the above likelihoods to obtain the posterior distribution of the parameters. To do that, we use the affine invariant Monte Carlo Markov Chain (MCMC) ensemble sampler \textit{emcee} \citep{emcee}. \section{Results} \label{sec:results} In this section, we first show the results from the mock cluster catalog described in Sec.~\ref{sec:sim:mocks_galaxy} and validate our model of the projection effects. Then, we apply our model to SDSS redMaPPer cluster catalog (details in Sec.~\ref{sec:obs:redmapper}). \subsection{Simulations} \label{sec:res:sim} We show the derived posterior constraints of our model parameter for the mock cluster catalog with $20 \leq \lambda \leq 30$ and $d_{\rm proj}=120^{-1}{\rm Mpc}$ in Fig.~\ref{fig:sim_mcmc_20to30}. For this analysis, we use the ratios $w_{\rm p cg}/w_{\rm p,gg}$ for $\pi_{\rm max}=30, 60, 90, 120,$ and $150 h^{-1}{\rm Mpc}$ on scales $12h^{-1}{\rm Mpc} \leq R \leq 40h^{-1}{\rm Mpc}$ with 13 bins each, and the covariance matrix is computed from 136 $(0.5h^{-1}{\rm Mpc})^3$ sub-boxes. The diagonal panels show the one-dimensional marginalized posterior distributions of each of the four parameters and the contours in the off-diagonal panels are the $1 \sigma$ confidence region for each of the parameter combinations. Since the value of $\alpha$ is not an input parameter, we measured it using a different method to validate our model. Using the same cluster mock catalog, we first measured the lensing signal and compared it with the prediction from the emulator \textit{darkemu} \citep{darkemu}. \textit{darkemu} takes the halo masses of the clusters as an input and gives the predicted lensing signal. Since \textit{darkemu} assumes that the distribution of halos is isotropic, the deviation of the measured lensing signal from the prediction is the size of the anisotropic boost. The measured value of $\alpha$ from the lensing signal is $\alpha=27.6\pm{4.7}\%$. The details of the measurements and the results for other cluster catalogs with different richness bins and other projection lengths are in Appendix~\ref{sec:appA}. Fig.~\ref{fig:sim_mcmc_20to30} shows that the posterior distribution of $\alpha$ from our method nicely agrees with the measured value of $\alpha$ from lensing. However, the posterior distribution of $d_{\rm proj}$ is not well-constrained and the best-fit value is smaller than the expected value of $d_{\rm proj}=120h^{-1}{\rm Mpc}$. This may be because the second assumption (i.e., the increase of the amplitude ratio stops at $\pi_{\rm max}=d_{\rm proj}$) is too simple. However, the important thing here is not to precisely constrain the value of $d_{\rm proj}$, but rather to get some rough ideas of how long the distribution of member galaxies is extended along the LOS. At least, the posterior distribution of $d_{\rm proj}$ is not significantly under/over-estimating $d_{\rm proj}$. Further improvements to constrain $d_{\rm proj}$ on our model will be future work. \begin{figure} \includegraphics[width=0.45\textwidth]{check_post_s_l20to30_pca.pdf} \caption{\label{fig:sim_pred_20to30} The projected cross-correlation functions of clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$. The circles with error bars are based on the mock measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} \begin{figure} \includegraphics[width=0.45\textwidth]{alphas_post_s_pca.pdf} \caption{\label{fig:alphas_mock} The best-fit values of the anisotropic boost parameter $\alpha$ as a function of richness $\lambda$. As richness increases, the value of $\alpha$ decreases (i.e., smaller anisotropic boost due to the projection effects). } \end{figure} \begin{figure*} \includegraphics[width=0.8\textwidth]{mcmc_obs_l20to30_s_pca_hartlap.pdf} % \caption{\label{fig:obs_mcmc_20to30} The same figures as Fig.~\ref{fig:sim_example} but using SDSS redMaPPer clusters and DR12 galaxies at $0.1 \leq z \leq 0.33$ with richness $20 \leq \lambda \leq 30$. The posterior distribution of cluster projection model parameters given the ratio of the cross and autocorrelation functions with various integral scales. The measured parameters for boost and $d_{\rm proj}$ are 0.16 and $136h^{-1}{\rm Mpc}$. } \end{figure*} Fig.~\ref{fig:sim_pred_20to30} compares the amplitude ratio of $w_{\rm cg}(R)/w_{\rm gg}(R)$ predicted by the best-fit values from the posterior distributions (solid line) to the mock measurements (circles with error bars). Overall, the model predictions well describe the data points from the mock measurement. However, the scale-dependent suppression on large scales is slightly stronger for the measurements than the prediction from the RSD effects. This might be due to unmodeled correlations of the clusters with tidal fields. The reason the $\chi^2$ value is so small despite the large degree of freedom (=61) is that we use the covariance matrix including observational systematic errors, which are not present in the mock data vector. Fig.~\ref{fig:alphas_mock} shows the anisotropic boost $\alpha$ as a function of richness $\lambda$. For larger richness clusters, the value of $\alpha$ gets smaller. This is mainly because the fraction of the "projected" clusters, whose member galaxies are mostly interlopers, gets smaller for more massive clusters. \cite{Sunayama_etal2020} showed that these clusters are the cause of the anisotropic boost and the size of the boost mostly depends on the fraction of these "projected" clusters. \subsection{Observations} \label{sec:res:obs} In this section, we present the results using the SDSS redMaPPer clusters and LOWZ spectroscopic galaxies. As is described in Sec.~\ref{sec:obs:redmapper} and \ref{sec:obs:dr12_lowz}, we select clusters and galaxies at $0.1 \leq z \leq 0.33$ and measure the cluster-galaxy projected correlation functions as well as galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120,$ and $150h^{-1}{\rm Mpc}$ on scales $10h^{-1}{\rm Mpc} \leq R \leq 42 h^{-1}{\rm Mpc}$ with 8 bins each. To look for the features of the projection effect in the ratio of $w_{\rm p,cg}(R)/w_{\rm p,gg}(R)$, we limit to use the redMaPPer clusters with spectroscopic redshifts. This is because the photometric redshift uncertainties dilute the dependence of the ratio on the choice of integral scale $\pi_{\rm max}$. We use 83 jackknife regions in order to compute the error in the measurements and its covariance matrix. The typical size of each of these jackknife patches is about $10 \times 10$ square degrees, which corresponds to roughly $100 \times 100 (h^{-1}{\rm Mac})^2$ for our cluster and galaxy samples. Note that we do include the correction factors in \cite{Hartlapetal2007}. Fig.~\ref{fig:obs_mcmc_20to30} shows the derived posterior constraints of our model parameters for the redMaPPer clusters with richness $20 \leq \lambda \leq 30$. The anisotropic boost factor $\alpha$ is constrained to $\alpha=18.4\pm 8.6\%$, which is consistent with the values from \cite{Park_etal2021} and \cite{To_Krause2021}. The predicted value for $d_{\rm proj}$ is $d_{\rm proj}=136h^{-1}{\rm Mpc}$. Due to the limited range of $d_{\rm proj}$ up to $150h^{-1}{\rm Mpc}$, our posterior is truncated on the large $d_{\rm proj}$ end, but the size of the 1$\sigma$ error on the small $d_{\rm proj}$ is roughly $\Delta d_{\rm proj}=30h^{-1}{\rm Mpc}$. This large $d_{\rm proj}$ does not mean that the structure of all the clusters is extended to $136h^{-1}{\rm Mpc}$, but rather member galaxies of some clusters are distributed to roughly $136h^{-1}{\rm Mpc}$ along the LOS. While the simulation analysis in Fig.~\ref{fig:sim_mcmc_20to30} shows a weak degeneracy between $\alpha$ and $b_c$/$b_g$, Fig.~\ref{fig:obs_mcmc_20to30} shows no degeneracy between these parameters. This is because the scale-dependence of $w_{\rm cg}(R)/w_{\rm gg}(R)$ is weaker for the observational data than the mock data as shown in Fig.~\ref{fig:obs_pred_20to30}. \begin{figure} \includegraphics[width=0.45\textwidth]{check_obs_l20to30_pca_hartlap.pdf} \caption{\label{fig:obs_pred_20to30} The projected cross-correlation functions of SDSS RM clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$ with $20 \leq \lambda \leq 30$. The circles with error bars are from the measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} \begin{figure} \includegraphics[width=0.45\textwidth]{alphas_obs_pca_hartlap.pdf} \caption{\label{fig:alphas_obs} The best-fit values of the anisotropic boost parameter $\alpha$ as a function of richness $\lambda$. As richness increases, the value of $\alpha$ decreases (i.e., smaller anisotropic boost due to the projection effects) except for the cluster sample with $30 \leq \lambda \leq 40$. } \end{figure} Fig.~\ref{fig:obs_pred_20to30} compares the amplitude ratio of $w_{\rm cg}(R)/w_{\rm gg}(R)$ predicted by the best-fit values from the posterior distributions (solid line) to the observational measurements (circles with error bars). Overall the model predictions agree well with the measurements. Lastly, Fig.~\ref{fig:alphas_obs} shows the best-fit value for the anisotropic boost $\alpha$ as a function of richness $\lambda$. Unlike the result from the simulation analysis whose $\alpha$ values decrease as richness $\lambda$ increases, the $\alpha$ values are almost constant ($\sim 20\%$) across all the richness bins except the one with $30 \leq \lambda \leq 40$. The value of $\alpha$ for the cluster sample with $30 \leq \lambda \leq 40$ is $55 \pm 15 \%$, which is unexpectedly large. To investigate further the cause of this large $\alpha$ value, Fig.~\ref{fig:obs_pred_30to40} shows the measured ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ and the prediction from the best-fit parameters for the case of $30 \leq \lambda \leq 40$. Unlike Fig.~\ref{fig:obs_pred_20to30}, the best-fit model does not fit well with the measured ratio, in particular for the case of large $\pi_{\rm max}$. While the ratio with $\pi_{\rm max}=30h^{-1}{\rm Mpc}$ is almost constant on $10h^{-1}{\rm Mpc} \leq R \leq 42 h^{-1}{\rm Mpc}$, the ratios with other $\pi_{\rm max}$ increase as $R$ increases. This increase is against the predicted scale-dependence by the RSD effect, and it is unclear what can cause this increase in the ratio. We tried different $R$ ranges to constrain the value of $\alpha$. However, any choice of $R$ did not significantly change the best-fit value of $\alpha$. We will leave the further investigation of the cause to the future work. \section{Summary} \label{sec:summary} In this paper, we implemented the model and the method to quantitatively evaluate the anisotropic boost to the cluster clustering and lensing due to the projection effects. We validated our model against the mock cluster catalogs and then applied it to the SDSS redMaPPer cluster catalog. We summarize our conclusions as follows: \begin{itemize} \item The anisotropic boosts can be quantitatively measured using the cluster-galaxy projected correlation functions concerning galaxy auto-correlation functions. We assume that the selection of galaxies is isotropic, and varying integral scales is a key to measure the boost. \item To model the projection effects, we made two assumptions: $\alpha$ increases constantly as $\pi_{\rm max}$ increases, and the increase of $\alpha$ stops when $\pi_{\rm max}>d_{\rm proj}$. \item Upon validation with the mock cluster catalog using the projection length of $d_{\rm proj}=120h^{-1}{\rm Mpc}$, our model was able to measure the expected anisotropic boost through the cluster-galaxy cross-correlation functions. \item We applied our model to the SDSS redMaPPer cluster catalog and measured the boost factor to be roughly $\sim 20\%$ for all the richness bins except the $\lambda \in [30,40]$ bin. The size of the boosts is consistent with the constraints in the cluster cosmology analysis by \cite{Park_etal2021} and \cite{To_Krause2021}. \item While the ratios $w_{\rm cg}(R)/w_{\rm gg}(R)$ of the mock cluster samples exhibit the scale-dependence consistent with the prediction from the RSD effect, the ratios measured from the SDSS redMaPPer clusters show little or opposite scale-dependence. Understanding the cause of this is our future work. \item Our model also enabled to constrain the projection length of clusters along the LOS. Even though the accuracy is somewhat questionable based on the validation from the mock, our model constrained $d_{\rm proj}$ to be $ \geq 100h^{-1}{\rm Mpc}$. \end{itemize} \begin{figure} \includegraphics[width=0.45\textwidth]{check_obs_l30to40_pca_hartlap.pdf} \caption{\label{fig:obs_pred_30to40} The projected cross-correlation functions of SDSS RM clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$ with $30 \leq \lambda \leq 40$. The circles with error bars are from the measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} In this work, we develop a method to measure the anisotropic boost on the amplitude of cluster clustering through cluster-galaxy cross-correlation functions and measure the anisotropic boost in the SDSS redMaPPer clusters is roughly $20\%$ except the clusters with $30 \leq \lambda \leq 40$. We plan to investigate further the cause of large anisotropic boost ($\sim 60\%$) for these clusters in our future work. Additionally, we plan to extend our method for clusters without spectroscopic follow-ups in our future works. \section*{Acknowledgements} We thank Youngsoo Park, Peter Behroozi, Eduardo Rozo, Ryuichi Takahashi and Kiyotomo Ichiki for their comments, and thank Surhud More, Takahiro Nishimichi and Dark Quest collaboration team who provided an original cluster finder and Dark Quest simulations. TS thanks Masahiro Takada to encourages this publication. TS is supported by Grant-in-Aid for JSPS Fellows 20J01600 and JSPS KAKENHI Grant Number 20H05855. Funding for SDSS-III has been provided by the Alfred P. Sloan Foundation, the Participating Institutions, the National Science Foundation, and the U.S. Department of Energy Office of Science. The SDSS-III web site is \url{http://www.sdss3.org/.} SDSS-III is managed by the Astrophysical Research Consortium for the Participating Institutions of the SDSS-III Collaboration including the University of Arizona, the Brazilian Participation Group, Brookhaven National Laboratory, Carnegie Mellon University, University of Florida, the French Participation Group, the German Participation Group, Harvard University, the Instituto de Astrofisica de Canarias, the Michigan State/Notre Dame/JINA Participation Group, Johns Hopkins University, Lawrence Berkeley National Laboratory, Max Planck Institute for Astrophysics, Max Planck Institute for Extraterrestrial Physics, New Mexico State University, New York University, Ohio State University, Pennsylvania State University, University of Portsmouth, Princeton University, the Spanish Participation Group, University of Tokyo, University of Utah, Vanderbilt University, University of Virginia, University of Washington, and Yale University. \bibliographystyle{mnras} \section{Introduction} Galaxy clusters are the most massive gravitationally self-bound objects in the Universe. These clusters form at the rare high peaks of the initial density field and the abundance of clusters and its time evolution are sensitive to the growth of structure in the Universe. Hence, clusters have been used to constrain cosmological parameters \citep{Whieetal:93,Haiman:2001,Vikhlininetal:09,Rozoetal:10,TakadaBridle:07,OguriTakada:2011} \citep[also see][for a review]{Weinberg:2013}. Many ongoing and future galaxy surveys, such as the Hyper Suprime-Cam (HSC) survey \citep{HSCOverview:17}, the Dark Energy Survey\footnote{\url{ https://www.darkenergysurvey.org}} (DES) \citep{DES2005}, the Kilo Degree Survey\footnote{\url{http://kids.strw.leidenuniv.nl/}} (KiDS) \citep{KiDs2015}, the Rubin Observatory Legacy Survey of Space and Time\footnote{\url{https://www.lsst.org}} (LSST) \citep{LSST2009}, \textit{Euclid}\footnote{\url{ https://sci.esa.int/web/euclid}} \citep{euclid2018}, and the Nancy Grace Roman Telescope\footnote{\url{https://wfirst.gsfc.nasa.gov}} \citep{WFIRST2019}, will provide unprecedented numbers of clusters and enable us to carry out cluster cosmology analyses with great precision if all the systematic effects are under control. In particular, these optically identified clusters from the photometric surveys are known to be susceptible to the systematic effects due to the photometric redshift uncertainties of galaxies. One of the main systematic effects for optically identified clusters is so-called “projection effects” that interloper galaxies along the line-of-sight (LOS) to a cluster are mistakenly identified as members of the cluster. The projection effects alter the mass-observable relation such that the observable for the optical clusters, which is the weighted sum of member galaxies (referred to “richness”), is boosted concerning its halo mass \citep[e.g.][]{costanzietalprojection}. In addition to the alternation of the mass-richness relation, \cite{Sunayama_etal2020} found that projection effects boost the amplitude of cluster lensing and clustering signals on large scales due to the preferential identification of filaments aligned with the LOS direction as a cluster. This results in the anisotropic distribution of matter around the optical clusters. The predicted size of this anisotropic boost from \cite{Sunayama_etal2020} is roughly $20-30\%$. These anisotropic boosts have been parameterized in a few cluster cosmology analysis. \cite{To_Krause2021} modeled the boost in their combined cosmology analysis with clusters and galaxies and obtained a similar size of the boost as the study by \cite{Sunayama_etal2020}. \cite{Park_etal2021} also employed this boost model in their cluster cosmology analyses and applied their full forward modeling method to the red-sequence Matchedfilter Probabilistic Percolation (redMaPPer) cluster catalog \citep{Rykoff_etal2014}, constructed from the Sloan Digital Sky Survey (SDSS) DR8 data \citep{Aihara:2011}. While the constrained value for the boost parameter in \cite{Park_etal2021} was consistent with \cite{To_Krause2021}, the result for the cosmological parameters favored low $\Omega_m$ and high $\sigma_8$. This questions how the boost exactly manifests in the real data observables, i.e., in the measured lensing and clustering signals. Even though the boost of the lensing and clustering amplitudes has been modeled and constrained in these cosmology analyses, no study finds a direct evidence of this effect. The goal of this study is to quantitatively constrain the size of this anisotropic boost in the amplitude of clustering and lensing signals seen in \cite{Sunayama_etal2020}. For this, we develop a novel method to quantify the boost caused by the projection effects with two simple assumptions using cluster-galaxy cross-correlation functions. The cross-correlation with spectroscopic galaxies provides a way to evaluate the anisotropic structure around the optical clusters. We first validate our method using mock cluster catalogs built from cosmological N-body simulations, and measure the anisotropic boost parameter in the SDSS redMaPPer clusters using this method. This is the first study to directly constrain the boost parameter using cluster-galaxy cross-correlation functions and provide a self-consistency test for the projection effects. This paper is organized as follows: in Section 2 we describe the details of the mock cluster catalog as well as the galaxy cluster sample. In Section 3 we explain our method to quantify the boost using the cluster-galaxy cross-correlation functions. In Section 4, we first validate our method using the mock cluster catalog and apply it to the SDSS redMaPPer clusters. We summarize our work and discuss its implication in Section 5. \section{Data} \label{sec:data} In this section, we describe the details of the simulations as well as how we build the galaxy and cluster mock catalogs. In principle, we are following these procedures from \cite{Sunayama_etal2020}. \subsection{$N$-body Simulations and Halo Catalogs} \label{sec:sim:nbody} We use the $N$-body simulations and halo catalogs from \cite{darkemu}. These $N$-body simulations were performed with $2048^3$ particles in a comoving cubic box with side lengths of $1h^{-1}{\rm Gpc}$, assuming the best-fit flat $\Lambda$CDM model\footnote{$\{\omega_{\rm b},\omega_{\rm c},\Omega_{\rm \Lambda},\ln(10^{10}A_{\rm s}),n_{\rm s}\} = \{0.02225,0.1198,0.6844,3.094,0.9645\}$} from \textit{Planck} Data Release 2 \citep{Planck:2015}. The initial displacement vector and the initial velocity of each $N$-body particle was set by second-order Lagrangian perturbation theory \citep{scoccimarro98,crocce06a,crocce06b,nishimichi09} with an input linear matter power spectrum computed from the publicly available Boltzmann code {\tt CAMB} \citep{camb}, and the subsequent time evolution of the particle distribution was simulated using the parallel Tree-Particle Mesh code {\tt Gadget2} \citep{Springel:2005}. The {\it Planck} model has $\Omega_{\rm m}=0.3156$ (the present-day matter density parameter), $\sigma_8=0.831$ (the present-day RMS linear mass density fluctuations within a top-hat sphere of radius $8~h^{-1}{\rm Mpc}$) and $h=0.672$ for the Hubble parameter. The particle mass is $1.02\times 10^{10}~h^{-1}M_\odot$. To generate halo catalogs, we first take simulation snapshots at redshift $z=0.251$ -- chosen to be close to the mean redshift of SDSS redMaPPer clusters -- and identify halos using the Friends-of-Friends (FoF) halo finder \texttt{Rockstar} developed in \cite{Behroozi:2013} \citep[also see][for details]{darkemu}. We use the ``200m'' halo definition, defining halo masses as $M\equiv M_{\rm 200m}=(4\pi/3)(R_{\rm 200m})^3(200\bar{\rho}_{\rm m0})$ where $R_{\rm 200m}$ is the spherical halo boundary radius within which the mean mass density is $200\times \bar{\rho}_{\rm m0}$, where we use the present-day mean mass density $\bar{\rho}_{\rm m0}$ using comoving coordinates. Note that we use comoving length units for $R_{\rm 200m}$. Our definition of halo mass includes all particles within the radius $R_{\rm 200m}$ from the halo center, i.e. includes particles even if they are not gravitationally bound to the halo. We only keep halos with masses above $10^{12}\,h^{-1}M_\odot$ in the final halo catalog used in this paper. The ``minimum halo'' at $M=10^{12}~h^{-1}M_\odot$ consists of 100 $N$-body particles. \subsection{Mock Catalogs of Red-Sequence Galaxies/LOWZ Galaxies} \label{sec:sim:mocks_galaxy} We construct two types of mock catalogs from the $N$-body simulations discussed in Section~\ref{sec:sim:nbody}. One is mock red-sequence galaxies which represent the SDSS DR8 photometric galaxy catalog \citep{Aihara:2011} to build a cluster mock catalog, and the other is mock bright galaxies whose number in a halo and spatial distribution are similar to the BOSS LOWZ galaxies \citep{parejko_etal2012}. To construct these mock catalogs, we use the halo occupation distribution (HOD) formulation \citep{1998ApJ...494....1J,seljak:2000uq,peacock:2000qy,2005ApJ...633..791Z} to populate mock galaxies in halos. Our HOD model gives the expected numbers of central and satellite galaxies, $N_{\rm cen}(M)$ and $N_{\rm sat}(M)$, as a function of halo mass $M$: \begin{align} N_{\rm cen}(M)= \frac{1}{2}\left[ 1+{\rm erf}\left(\frac{\log M-\log M_{\rm cut}}{\sigma_{\log M}}\right) \right] \end{align} and \begin{align} N_{\rm sat}(M)=N_{\rm cen}(M)\left(\frac{M-\kappa M_{\rm cut}}{M_1}\right)^\alpha , \label{eq:HOD_sat} \end{align} where $M_{\rm cut}, M_1, \sigma_{\log M}, \kappa,$ and $\alpha$ are model parameters. With the HOD prescription in hand, we populate galaxies in halos by following \citep[also see][]{Kobayashi:2019jrn}: \begin{itemize} \item[(i)] {\it Central galaxies} -- a central galaxy is populated at the center of each halo with $M\ge 10^{12}~h^{-1}M_\odot$. We do not consider any off-centering between central galaxies and halo centers in this work for simplicity. We also set the velocity of the central galaxy to be equal to the velocity of the host halo. \item[(ii)] {\it Satellite galaxies} -- For each halo with $M\ge 10^{12}~h^{-1}M_\odot$, the number of satellite galaxies $N_{\rm sat}$ is determined from a Poisson random draw with mean given by Eq.~(\ref{eq:HOD_sat}). Once $N_{\rm sat}$ is set, we distribute each satellite galaxy according to a Navarro-Frenk-White \citep[][hereafter NFW]{nfw97} profile specified by the halo mass and the \cite{2015ApJ...799..108D} mass-concentration relation. Note that we limit the extent of the NFW profile to within the $R_{\rm 200m}$ boundary. For velocity assignment, we assume that satellite galaxies are randomly moving inside the host halos. Therefore, the velocities of the satellite galaxies are the sum of their host halo velocity and a random virial component. For this random component, we draw from a Gaussian distribution with zero mean and variance given by \begin{align} \left < v_x^2 \right >=\left <v_y^2 \right >=\left <v_z^2\right >=\frac{1}{3}\frac{GM_{\rm 200m}}{R_{\rm 200m}}. \label{eq:v_sat} \end{align} \end{itemize} Following \cite{2018arXiv181009456C}, we use parameter values of $M_{\rm cut}=10^{11.7}~h^{-1}M_\odot$, $M_1=10^{12.9}~h^{-1}M_\odot$, $\sigma_{\log M}=0.1$, $\kappa=1.0$, and $\alpha=1.0$ for the red-sequence galaxy mock catalog. This parameter configuration implies $N_{\rm cen}(M)= 1 \mbox{ for } M\ge 10^{12}h^{-1}M_\odot$, i.e. all identified halos in our halo catalogs receive a central galaxy. The resulting galaxy number density of our mock catalogs is about $7.4\times 10^{-3}~(h^{-1}{\rm Mpc})^{-3}$ on average, which is roughly consistent with the number density of red galaxies used to identify the SDSS redMaPPer clusters. In addition, we generate a galaxy mock catalog for SDSS LOWZ galaxies with $M_{\rm cut}=10^{13.25}~h^{-1}M_\odot$, $M_1=10^{14.18}~h^{-1}M_\odot$, $\sigma_{\log M}=0.70$, $\kappa=1.04$, and $\alpha=0.94$ following \cite{parejko_etal2012}. We perform this procedure on 19 independent realizations of the $(1~{h^{-1}{\rm Gpc}})^3$ box simulations. \subsection{Cluster Finder and Mock Cluster Catalogs} \label{sec:sim:mocks_cluster} With the mock red-sequence galaxies in hand, we construct the cluster mock catalog using the cluster finder based on the redMaPPer cluster finder \citep{Rykoff_etal2014,Rozo2014, Rozo2015, Rozo2015_2}. The details of the algorithm and its implementation are described in the following \cite{SunayamaMore} and \cite{Sunayama_etal2020}. At first, we consider all the galaxies in the catalog as potential cluster central galaxies with a probability $p_{\rm free}=1$. $p_{\rm free}$ is the prior that the galaxy does not belong to any other richer galaxy cluster, and a membership probability $p_{\rm mem}$ is the probability to be a member of the cluster. $p_{\rm mem}$ and $p_{\rm free}$ have a simple relation of $p_{\rm free}=1-p_{\rm mem}$. We model the photometric redshift uncertainty by assuming the specific projection length $d_{\rm proj}$. This is the simplifying assumption that the photometric redshift filter used to group galaxies along the redshift direction will have a poor resolution and therefore identify galaxies within a certain distance along the LOS as cluster members. Then, we compute the initial richness $\lambda$ for each candidate central galaxy by taking all the galaxies within a radius of $0.5h^{-1}{\rm Mpc}$ and the LOS length $|\pi| < d_{\rm proj}$. We use $d_{\rm proj}=120h^{-1}{\rm Mpc}$ as our default choice, but we generate cluster mock catalogs with $d_{\rm proj}=30h^{-1}{\rm Mpc}$ and $d_{\rm proj}=60h^{-1}{\rm Mpc}$ as well. In this first step, the membership probability will not be changed even after the galaxy is assigned to one of the cluster candidates and the cluster finder continues to go down the list of galaxy centers to find overall over-density regions. Once the first iteration is done, we eliminate all the cluster candidates with $\lambda <3$ from the list of the candidates. Then, we rank-order the clusters in a descending order based on the initial richness $\lambda$ and take percolation steps iteratively. Starting from the cluster with the largest richness, we take the following steps. \begin{enumerate} \item Given the $i^{\rm th}$ central galaxy in the list, recompute $\lambda$ and the membership probability based on the percolated galaxy catalog. \item Compute the radius of $R_{c}(\lambda)$ and take all the galaxies within the radius of $R_{c}(\lambda)$ and the projection length $d_{\rm proj}$. The radial cut scales with $\lambda$ is defined as \begin{equation} R_{\rm c}(\lambda) = R_0 (\lambda/100.0)^{\beta}\, \label{eq:radius} \end{equation} where $R_0=1.0h^{-1}{\rm Mpc}$ and $\beta=0.2$ as adopted in redMaPPer. \item Among all the member galaxies, if there is a more massive central galaxy than the currently considered one (i.e., the central galaxy in a more massive halo), check whether that galaxy is already considered as a cluster center or not. If not, consider that central galaxy as a new cluster center and recompute $\lambda$ and $R_{c}(\lambda)$. \item Determine the membership probability by numerically solving Eqn. \ref{eq:pmem} and \ref{eq:lambda}, using all the galaxies within the radius of $R_{c}(\lambda)$ and the projection length $d_{\rm proj}$. The membership probability is defined as \begin{equation} p_{\rm mem} = \frac{\lambda u(x|\lambda)}{\lambda u(x|\lambda) + b(x)}\, \label{eq:pmem} \end{equation} where $x$ denotes the projected distance of the galaxy from the cluster center and $b(x)$ denotes the background contamination, which is assumed to be a constant to model the uncorrelated galaxies in the foreground and the background. We use the projected NFW profile \citep{nfw97,Bartelmann96} for $u(x|\lambda)$ and the profile is truncated smoothly at a projected radius $R=R_{\rm c}$ with an error function as described in \cite{Rykoff_etal2014}. The richness $\lambda$ is defined as \begin{equation} \lambda = \sum_{R<R_{\rm c}(\lambda)} p_{\rm free} p_{\rm mem}(x|\lambda)\,, \label{eq:lambda} \end{equation} where the sum goes over all members of a galaxy cluster within a cluster radius $R<R_{\rm c}(\lambda)$ and the LOS separation $|\pi|<d_{\rm proj}$. \item Update the probability $p_{\rm free}$ for each galaxy to be $p_{\rm free}(1-p_{\rm mem})$ based on their membership probabilities of the current cluster. If $p_{\rm free}>0.5$, then these galaxies are eliminated from the list. \item Repeat the steps for the next galaxy cluster in the ranked list. \end{enumerate} By running this cluster finder to the mock red galaxy catalog, we generate the mock cluster catalogs. We select clusters with richness $20\leq \lambda \leq 200$ at $z=0.25$. \begin{figure*} \includegraphics[width=0.43\textwidth]{ratio_pre_r.pdf} \includegraphics[width=0.43\textwidth]{ratio_post_r_dproj120_v2.pdf} % \caption{\label{fig:example} {\it Left}: The projected cross-correlation function of clusters and galaxies relative to the galaxy auto-correlation function with $\pi_{\rm max}=30$, $60$, and $100h^{-1}{\rm Mpc}$. We use the halos whose masses are greater than $10^{14}h^{-1}{\rm M}_{\odot}$ (i.e., no projection effects). {\it Right}: The same as the left figure, the cross-correlation functions with the "observed" clusters which are identified by the cluster finder explained in Sec.~\ref{sec:sim:mocks_cluster}. When the clusters suffer from the projection effects, the clustering amplitude depends on the choice of the integral scale $\pi_{\rm max}$. } \end{figure*} \subsection{SDSS redMaPPer galaxy clusters} \label{sec:obs:redmapper} We use the publicly available catalog of galaxy clusters identified from the SDSS DR8 photometric galaxy catalog v5.10 by the redMaPPer cluster finding algorithm \citep{Rykoff_etal2014,Rozo2014}. The cluster finder uses the $ugriz$ magnitudes and their errors, to identify overdensities of red-sequence galaxies with similar colors as galaxy clusters. For each cluster, the catalog contains an optical richness estimate $\lambda$, a entering probability $p_{\rm cen}$, position as well as a photometric redshift $z_\lambda$ and a spectroscopic redshift $z_{\rm spec}$ if available. This redMaPPer cluster catalog is volume-limited up to $z=0.33$, and we select galaxy clusters with $20 \leq \lambda \leq 200$ at $0.1 \leq z \leq 0.33$. We limit our cluster sample to the ones with a spectroscopic redshift. This is to reduce uncertainties due to the photometric redshift in the clustering measurement. In total, we have 8648 clusters, which is $81.5\%$ of all the clusters selected in the same condition with a photometric redshift. Throughout this paper, we use the position of the most probable central galaxy in each cluster region as a proxy of the cluster center. We also use the random catalogs provided along with the redMaPPer cluster catalog. These catalogs contain corresponding position information, redshift, richness, and a weight for each random cluster. \subsection{BOSS DR12 LOWZ sample} \label{sec:obs:dr12_lowz} We will carry out a cross-correlation of the redMaPPer galaxy clusters with spectroscopic galaxies to study the effect of the projection effects on the redMaPPer clusters. We use the spectroscopic galaxies in the large-scale structure catalogs constructed from SDSS DR12 \citep{Alam:2015}. In particular, we will use the LOWZ sample, since it has a large overlap in redshift range as our galaxy cluster sample. We restrict ourselves to LOWZ galaxies with redshifts between $0.1 \leq z \leq 0.33$, the same redshift range as our galaxy clusters. The galaxy catalogs also come with associated random galaxy catalogs that we use to perform our cross-correlation analysis. \section{Methods} \label{sec:method} \begin{figure*} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj30.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj60.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_r_dproj120.pdf} % \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj30.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj60.pdf} \includegraphics[width=0.3\textwidth]{ratio_post_s_dproj120.pdf} \caption{\label{fig:var_dproj} The projected cross-correlation functions of clusters and galaxies relative to the galaxy auto-correlation functions. The clusters are identified by the cluster finder with the projection length of $d_{\rm proj}=30h^{-1}{\rm Mpc}$ (left), $60h^{-1}{\rm Mpc}$ (middle), and $120h^{-1}{\rm Mpc}$ (right). The top panels are the ratios of the projected correlation functions in real-space, while the bottom panels are the ones in redshift-space. These figures indicate that the increase of clustering amplitude based on the integral scale stops when the integral scale exceeds the projection length. } \end{figure*} In this section, we introduce necessary tools to quantitatively constrain the size of the anisotropic boost in the amplitude of clustering and lensing signals caused by the projection effects. \subsection{Projected Correlation Functions} \label{sec:method:wp} To measure the boost of the cluster sample, we first calculate the cluster-galaxy cross correlation function $\xi_{\rm cg}$ via the Landy-Szalay estimator \citep{LandySzalay:93}, and then compute the projected correlation function by integrating $\xi_{\rm cg}(r)$ over the LOS direction (denoted as $\pi$), \begin{equation} w_{\rm p,cg}(R,\pi_{\rm max})=2\int_{0}^{\pi_{\rm max}}dr_{\pi}\xi_{\rm gc}(R,r_{\pi}),\label{eq:wp} \end{equation} where $\pi_{\rm max}$ is the maximum integral scale. For mocks, we simply split each $(1h^{-1}{\rm Gpc})^3$ box into eight $(0.5h^{-1}{\rm Gpc})^3$ sub-boxes and compute the covariance matrix using these sub-boxes. In total, we use 136 sub-boxes to compute the covariance matrix. For observational data, we use 83 jackknife regions, which is about $10\times10$ square degrees corresponding to roughly $100\times100(h^{-1}{\rm Mpc})^{2}$ for our cluster and galaxy samples. Due to the anisotropic distribution of matter/galaxy around clusters, the clustering amplitude of $w_{\rm p,cg}(R)$ depends on the choice of $\pi_{\rm max}$. As a demonstrative purpose, we use two mock cluster catalogs based on the N-body simulations described in Sec.~\ref{sec:sim:nbody} and compute the cluster-galaxy projected correlation functions. We refer the halos identified by the halo finder \texttt{Rockstar} and $M_{\rm 200m}>10^{14}h^{-1}{\rm M}_{\odot}$ as ``True'' cluster catalog. These cluster-sized halos do not suffer from the projection effects, because they are identified based on six-dimensional phase-space information of dark matter particles and there is no preferential selection of filamentary structure aligned to the LOS direction. So, the distribution of cluster-sized halos identified by \texttt{Rockstar} is isotropic. The left panel of Fig.~\ref{fig:example} shows the ratio of $w_{\rm p,cg}/w_{\rm p, gg}$ for the case of ``True'' clusters. The distribution of the clusters is isotropic, and therefore the ratio does not depend on $\pi_{\rm max}$. The right panel of Fig.~\ref{fig:example} shows the same ratio but for the clusters identified by the cluster finder. We call the clusters identified by our cluster finder described in Sec.~\ref{sec:sim:mocks_cluster} as ``Observed'' clusters. Due to the anisotropic distribution of matter around ``Observed'' clusters, the ratio increases as the integral scale $\pi_{\rm max}$ increases. The reason we use the galaxy auto-correlation functions $w_{\rm p, gg}$ to extract the anisotropic boost from $w_{\rm p,cg}$ is that we need some reference objects whose distribution is isotropic. \begin{figure*} \includegraphics[width=0.8\textwidth]{mcmc_post_s_l20to30_pca.pdf} % \caption{\label{fig:sim_mcmc_20to30} [The richness is from 20 to 30.] The posterior distribution of our model parameters using the ratio of the cross and autocorrelation functions with various integral scales. The measured parameters for the anisotropic boost parameter $\alpha$ and the projection length of $d_{\rm proj}$ are $0.283$ and $108h^{-1}{\rm Mpc}$, while the expected parameter values (shown as dotted lines) are boost=$0.273$ and $d_{\rm proj}=120h^{-1}{\rm Mpc}$. } \end{figure*} \subsection{Theoretical Modeling of Projection Effects} \label{sec:method:model} We model the anisotropic boost on $w_{\rm p,cg}(R)$ with two parameters $\alpha_0$ and $d_{\rm proj}$, \begin{align} w_{\rm p,cg}(R,\pi_{\rm max})=(1+\alpha_0(\pi_{\rm max}, d_{\rm proj}))w_{\rm iso,cg}(R) \label{eq:inertia} \end{align} where $\alpha_0$ is the boost of the clustering amplitude and $d_{\rm proj}$ is the projection length of the clusters (i.e., the maximum LOS distance of the member galaxies from the cluster center). $w_{\rm iso,cg}(R)$ is the expected projected cross-correlation function for the case of isotropically distributed clusters with the same halo masses. We assume that the boost parameter $\alpha_0$ is scale-independent on large scales. To model $\alpha_0$, we make the following assumptions: \begin{enumerate} \item $\alpha_0$ increases constantly as $\pi_{\rm max}$ increases, \item the increase of $\alpha_0$ stops when $\pi_{\rm max}>d_{\rm proj}$. \end{enumerate} These two assumptions are made based on the findings in \cite{BuschWhite:17} and \cite{SunayamaMore}. Both studies investigated the cause of large assembly signals detected in \cite{Miyatake:2016}. These studies found that the projection effects can boost the clustering amplitude and therefore can give a false detection of the assembly bias. These studies built a cluster finder with the projection effects and found that the anisotropic matter distribution around the clusters due to the projection effects can only extend up to $\pi \leq d_{\rm proj}$ (see Fig. 12 in \cite{BuschWhite:17} and Fig. 4 in \cite{SunayamaMore}). The above two assumptions are based on these findings. With these assumptions, we can describe $\alpha_0$ as \begin{equation} \alpha_0= \begin{cases} \alpha, & \text{if}\ \pi_{\rm max}>d_{\rm proj} \\ \alpha \frac{\pi_{\rm max}}{d_{\rm proj}}. & \text{otherwise} \end{cases} \end{equation} The top panels of Fig.~\ref{fig:var_dproj} show the ratio of $w_{\rm p,cg}/w_{\rm p,gg}$ for "Observed" clusters with richness $20 \leq \lambda \leq 30$. Each panel shows the clusters identified with $d_{\rm proj}=30 h^{-1}{\rm Mpc}$ (left), $60 h^{-1}{\rm Mpc}$ (middle), and $120 h^{-1}{\rm Mpc}$ (right). We compute the projected correlation functions in real-space. This is the supportive evidence for the second assumption that the increase of the boost stops roughly after $\pi_{\rm max}>d_{\rm proj}$ for the case of $\pi_{\rm max}=60h^{-1}{\rm Mpc}$ and $120h^{-1}{\rm Mpc}$, but not for the case of $\pi_{\rm max}=30h^{-1}{\rm Mpc}$. This means that our model is only valid for clusters with the large projection length. Since velocity dispersion of galaxies in clusters is roughly $\sigma_{v}\sim 3000{\rm km/s}$, we can only achieve $d_{\rm proj}=30h^{-1}{\rm Mpc}$ even for the case of spectroscopically identified clusters, and therefore assuming larger projection lengths than $30h^{-1}{\rm Mpc}$ is a fine assumption. In real-space, the ratio of the projected correlation functions is assumed to be constant, and therefore its model requires only three parameters $b_c/b_g$, $\alpha$, and $d_{\rm proj}$: \begin{equation} \frac{w_{\rm cg}(R,\pi_{\rm max})}{w_{\rm gg}(R,\pi_{\rm max})} = \frac{b_c}{b_g} (1+\alpha_0(\pi_{\rm max},d_{\rm proj})). \label{eq:ratio_real} \end{equation} The projected correlation function, however, is sensitive to the redshift-space distortion (RSD) effect when a sufficiently small value of $\pi_{\rm max}$ is taken (see Fig. 6 in \cite{vdBosch2013}). Even though we take the ratio of the two projected correlation functions, the scale-dependence induced by the RSD effect is different for the cluster-galaxy cross-correlation functions and galaxy auto-correlation functions. The model with the RSD effect has the following additional term to Eqn.~\ref{eq:ratio_real}. \begin{equation} \frac{(1+\frac{\beta_c+\beta_g}{3}+\frac{\beta_c \beta_g}{5}) w_{\rm p,0}+(\frac{2(\beta_c+\beta_g)}{3}+\frac{4\beta_c \beta_g}{7})w_{\rm p,2}+\frac{8\beta_c \beta_g}{35} w_{\rm p,4}}{(1+\frac{2 \beta_g}{3}+\frac{\beta_g^2}{5})w_{\rm p,0}+(\frac{4\beta_g}{3}+\frac{4 \beta_g^2}{7})w_{\rm p,2}+\frac{8 \beta_g^2}{35} w_{\rm p,4}}, \label{eq:ratio_RSD} \end{equation} where $\beta_c$ and $\beta_g$ are the growth rate $f$ divided by cluster and galaxy biases $b_c$ and $b_g$ respectively, $w_{\rm p,0}(R)$, $w_{\rm p,2}(R)$, and $w_{\rm p,4}(R)$ are the monopole, quadrupole, and hexadecapole of the projected correlation function: \begin{equation} w_{\rm{p},n}(R) = 2\int_{R}^{\infty}\xi_n(r) L_n(\mu) \frac{r dr}{\sqrt{(r^2-R^2)}}, \label{eq:abel} \end{equation} where $L_n(\mu)$ is the $n$th Legendre polynomials with $\mu=\sqrt{(r^2-R^2)}/r$. Following Eqn. 52-54 in \cite{vdBosch2013}, we define $\xi_n(r)$ as \begin{align} \xi_0(r) &= \xi_{\rm NL}(r),\\ \xi_2(r) &= \xi_{\rm NL}(r)-3J_3(r),\\ \xi_4(r) &= \xi_{\rm NL}(r)+\frac{15}{2}J_3(r)-\frac{35}{2}J_5(r), \label{eq:xi_n} \end{align} where $\xi_{\rm NL}(r)$ is the non-linear matter correlation function and \begin{align} J_n(r) =\frac{1}{r^n}\int^{r}_0 \xi_{\rm lin}(y)y^{n-1}{\rm d}y. \label{eq:J_n} \end{align} The bottom panels of Fig.~\ref{fig:var_dproj} show the ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ in redshift-space for the case of $d_{\rm proj}=30h^{-1}{\rm Mpc}$, $60h^{-1}{\rm Mpc}$, and $120h^{-1}{\rm Mpc}$. Compared to the case of real-space (top panels), the ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ in redshift-space shows a stronger scale-dependence due to the RSD effect, and the second assumption (i.e., the increase of the boost stops roughly after $\pi_{\rm max}>d_{\rm proj}$) seems violated. However, as long as the second assumption holds in real-space, this seeming violation of the assumption can be modeled following \cite{vdBosch2013} and will not be a problem. For the rest of the paper, we use the mock cluster catalog with $d_{\rm proj}=120h^{-1}{\rm Mpc}$ if it is not specified. \subsection{Parameter Inference} \label{sec:method:mcmc} We assume a Gaussian likelihood model and compute the likelihoods with the measurements $\mathbf{d}$ and the model predictions $\bm\upmu(\bm\uptheta)$, where $\bm\uptheta$ are the parameters, with covariances $\mathbf{C}$: \begin{equation} \ln \mathcal{L}(\mathbf{d}|\bm\uptheta) = -\frac{1}{2} \left[\mathbf{d}-\bm{\upmu}(\bm\uptheta)\right]^\intercal \mathbf{C}^{-1} \left[\mathbf{d}-\bm{\upmu}(\bm\uptheta)\right]. \end{equation} The data vector $\mathbf{d}$ is given by the ratios $w_{\rm p cg}/w_{\rm p,gg}$ for $\pi_{\rm max}=30, 60, 90, 120, 150 h^{-1}{\rm Mpc}$ on scales $R$. The parameters used for the model are $b_c$, $b_g$, $\alpha$, and $d_{\rm proj}$. We use flat priors for $\alpha$ and $d_{\rm proj}$: $\alpha \in [0,1]$, and $d_{\rm proj} \in [30,150]$. For $b_g$ and $b_c$, we use Gaussian priors: $b_g \sim \mathcal{N}(1.5,1.)$ and $b_c \sim \mathcal{N}(3.,1.)$. This is because the values of $b_g$ and $b_c$ are constrained independently only from the difference in the scale-dependence due to the RSD effect, and therefore these parameters are not strongly constrained with flat priors. To estimate the covariance matrix, we use roughly 80 independent realizations either by sub-dividing a set of the simulation realizations or by using the jackknife resampling method. Due to the large size of our data vector, the number of realizations or the jackknife regions is not enough to obtain the unbiased inverse covariance matrix. To mitigate this issue, we use a Principal Component Analysis on the covariance matrix $\mathbf{C}$ following the way described in Appendix C7 of \cite{Behroozi2019}. We first diagonalize the covariance matrix through an orthoganal matrix $\mathbf{U}$, $\mathbf{C}=\mathbf{U}\mathbf{D}\mathbf{U}^{-1}$ where $\mathbf{D}={\rm diag}(\sigma_1,\sigma_2,...)$, and then replace the $i$-th diagonal element $\sigma_i$ with the effective error $\sigma_{\rm eff,i}={\rm max}(0.1,\sigma_i)$ for the case of mock analysis. This is to include the systematic errors due to observational measurements such as fiber collisions and edge effects. The corresponding data vector for this diagonal covariance matrix $\mathbf{D}$ is $\mathbf{U}^{-1}(\mathbf{d}-\bm{\upmu}(\bm\uptheta))$. We perform Bayesian parameter inferences with the above likelihoods to obtain the posterior distribution of the parameters. To do that, we use the affine invariant Monte Carlo Markov Chain (MCMC) ensemble sampler \textit{emcee} \citep{emcee}. \section{Results} \label{sec:results} In this section, we first show the results from the mock cluster catalog described in Sec.~\ref{sec:sim:mocks_galaxy} and validate our model of the projection effects. Then, we apply our model to SDSS redMaPPer cluster catalog (details in Sec.~\ref{sec:obs:redmapper}). \subsection{Simulations} \label{sec:res:sim} We show the derived posterior constraints of our model parameter for the mock cluster catalog with $20 \leq \lambda \leq 30$ and $d_{\rm proj}=120^{-1}{\rm Mpc}$ in Fig.~\ref{fig:sim_mcmc_20to30}. For this analysis, we use the ratios $w_{\rm p cg}/w_{\rm p,gg}$ for $\pi_{\rm max}=30, 60, 90, 120,$ and $150 h^{-1}{\rm Mpc}$ on scales $12h^{-1}{\rm Mpc} \leq R \leq 40h^{-1}{\rm Mpc}$ with 13 bins each, and the covariance matrix is computed from 136 $(0.5h^{-1}{\rm Mpc})^3$ sub-boxes. The diagonal panels show the one-dimensional marginalized posterior distributions of each of the four parameters and the contours in the off-diagonal panels are the $1 \sigma$ confidence region for each of the parameter combinations. Since the value of $\alpha$ is not an input parameter, we measured it using a different method to validate our model. Using the same cluster mock catalog, we first measured the lensing signal and compared it with the prediction from the emulator \textit{darkemu} \citep{darkemu}. \textit{darkemu} takes the halo masses of the clusters as an input and gives the predicted lensing signal. Since \textit{darkemu} assumes that the distribution of halos is isotropic, the deviation of the measured lensing signal from the prediction is the size of the anisotropic boost. The measured value of $\alpha$ from the lensing signal is $\alpha=27.6\pm{4.7}\%$. The details of the measurements and the results for other cluster catalogs with different richness bins and other projection lengths are in Appendix~\ref{sec:appA}. Fig.~\ref{fig:sim_mcmc_20to30} shows that the posterior distribution of $\alpha$ from our method nicely agrees with the measured value of $\alpha$ from lensing. However, the posterior distribution of $d_{\rm proj}$ is not well-constrained and the best-fit value is smaller than the expected value of $d_{\rm proj}=120h^{-1}{\rm Mpc}$. This may be because the second assumption (i.e., the increase of the amplitude ratio stops at $\pi_{\rm max}=d_{\rm proj}$) is too simple. However, the important thing here is not to precisely constrain the value of $d_{\rm proj}$, but rather to get some rough ideas of how long the distribution of member galaxies is extended along the LOS. At least, the posterior distribution of $d_{\rm proj}$ is not significantly under/over-estimating $d_{\rm proj}$. Further improvements to constrain $d_{\rm proj}$ on our model will be future work. \begin{figure} \includegraphics[width=0.45\textwidth]{check_post_s_l20to30_pca.pdf} \caption{\label{fig:sim_pred_20to30} The projected cross-correlation functions of clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$. The circles with error bars are based on the mock measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} \begin{figure} \includegraphics[width=0.45\textwidth]{alphas_post_s_pca.pdf} \caption{\label{fig:alphas_mock} The best-fit values of the anisotropic boost parameter $\alpha$ as a function of richness $\lambda$. As richness increases, the value of $\alpha$ decreases (i.e., smaller anisotropic boost due to the projection effects). } \end{figure} \begin{figure*} \includegraphics[width=0.8\textwidth]{mcmc_obs_l20to30_s_pca_hartlap.pdf} % \caption{\label{fig:obs_mcmc_20to30} The same figures as Fig.~\ref{fig:sim_example} but using SDSS redMaPPer clusters and DR12 galaxies at $0.1 \leq z \leq 0.33$ with richness $20 \leq \lambda \leq 30$. The posterior distribution of cluster projection model parameters given the ratio of the cross and autocorrelation functions with various integral scales. The measured parameters for boost and $d_{\rm proj}$ are 0.16 and $136h^{-1}{\rm Mpc}$. } \end{figure*} Fig.~\ref{fig:sim_pred_20to30} compares the amplitude ratio of $w_{\rm cg}(R)/w_{\rm gg}(R)$ predicted by the best-fit values from the posterior distributions (solid line) to the mock measurements (circles with error bars). Overall, the model predictions well describe the data points from the mock measurement. However, the scale-dependent suppression on large scales is slightly stronger for the measurements than the prediction from the RSD effects. This might be due to unmodeled correlations of the clusters with tidal fields. The reason the $\chi^2$ value is so small despite the large degree of freedom (=61) is that we use the covariance matrix including observational systematic errors, which are not present in the mock data vector. Fig.~\ref{fig:alphas_mock} shows the anisotropic boost $\alpha$ as a function of richness $\lambda$. For larger richness clusters, the value of $\alpha$ gets smaller. This is mainly because the fraction of the "projected" clusters, whose member galaxies are mostly interlopers, gets smaller for more massive clusters. \cite{Sunayama_etal2020} showed that these clusters are the cause of the anisotropic boost and the size of the boost mostly depends on the fraction of these "projected" clusters. \subsection{Observations} \label{sec:res:obs} In this section, we present the results using the SDSS redMaPPer clusters and LOWZ spectroscopic galaxies. As is described in Sec.~\ref{sec:obs:redmapper} and \ref{sec:obs:dr12_lowz}, we select clusters and galaxies at $0.1 \leq z \leq 0.33$ and measure the cluster-galaxy projected correlation functions as well as galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120,$ and $150h^{-1}{\rm Mpc}$ on scales $10h^{-1}{\rm Mpc} \leq R \leq 42 h^{-1}{\rm Mpc}$ with 8 bins each. To look for the features of the projection effect in the ratio of $w_{\rm p,cg}(R)/w_{\rm p,gg}(R)$, we limit to use the redMaPPer clusters with spectroscopic redshifts. This is because the photometric redshift uncertainties dilute the dependence of the ratio on the choice of integral scale $\pi_{\rm max}$. We use 83 jackknife regions in order to compute the error in the measurements and its covariance matrix. The typical size of each of these jackknife patches is about $10 \times 10$ square degrees, which corresponds to roughly $100 \times 100 (h^{-1}{\rm Mac})^2$ for our cluster and galaxy samples. Note that we do include the correction factors in \cite{Hartlapetal2007}. Fig.~\ref{fig:obs_mcmc_20to30} shows the derived posterior constraints of our model parameters for the redMaPPer clusters with richness $20 \leq \lambda \leq 30$. The anisotropic boost factor $\alpha$ is constrained to $\alpha=18.4\pm 8.6\%$, which is consistent with the values from \cite{Park_etal2021} and \cite{To_Krause2021}. The predicted value for $d_{\rm proj}$ is $d_{\rm proj}=136h^{-1}{\rm Mpc}$. Due to the limited range of $d_{\rm proj}$ up to $150h^{-1}{\rm Mpc}$, our posterior is truncated on the large $d_{\rm proj}$ end, but the size of the 1$\sigma$ error on the small $d_{\rm proj}$ is roughly $\Delta d_{\rm proj}=30h^{-1}{\rm Mpc}$. This large $d_{\rm proj}$ does not mean that the structure of all the clusters is extended to $136h^{-1}{\rm Mpc}$, but rather member galaxies of some clusters are distributed to roughly $136h^{-1}{\rm Mpc}$ along the LOS. While the simulation analysis in Fig.~\ref{fig:sim_mcmc_20to30} shows a weak degeneracy between $\alpha$ and $b_c$/$b_g$, Fig.~\ref{fig:obs_mcmc_20to30} shows no degeneracy between these parameters. This is because the scale-dependence of $w_{\rm cg}(R)/w_{\rm gg}(R)$ is weaker for the observational data than the mock data as shown in Fig.~\ref{fig:obs_pred_20to30}. \begin{figure} \includegraphics[width=0.45\textwidth]{check_obs_l20to30_pca_hartlap.pdf} \caption{\label{fig:obs_pred_20to30} The projected cross-correlation functions of SDSS RM clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$ with $20 \leq \lambda \leq 30$. The circles with error bars are from the measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} \begin{figure} \includegraphics[width=0.45\textwidth]{alphas_obs_pca_hartlap.pdf} \caption{\label{fig:alphas_obs} The best-fit values of the anisotropic boost parameter $\alpha$ as a function of richness $\lambda$. As richness increases, the value of $\alpha$ decreases (i.e., smaller anisotropic boost due to the projection effects) except for the cluster sample with $30 \leq \lambda \leq 40$. } \end{figure} Fig.~\ref{fig:obs_pred_20to30} compares the amplitude ratio of $w_{\rm cg}(R)/w_{\rm gg}(R)$ predicted by the best-fit values from the posterior distributions (solid line) to the observational measurements (circles with error bars). Overall the model predictions agree well with the measurements. Lastly, Fig.~\ref{fig:alphas_obs} shows the best-fit value for the anisotropic boost $\alpha$ as a function of richness $\lambda$. Unlike the result from the simulation analysis whose $\alpha$ values decrease as richness $\lambda$ increases, the $\alpha$ values are almost constant ($\sim 20\%$) across all the richness bins except the one with $30 \leq \lambda \leq 40$. The value of $\alpha$ for the cluster sample with $30 \leq \lambda \leq 40$ is $55 \pm 15 \%$, which is unexpectedly large. To investigate further the cause of this large $\alpha$ value, Fig.~\ref{fig:obs_pred_30to40} shows the measured ratio $w_{\rm cg}(R)/w_{\rm gg}(R)$ and the prediction from the best-fit parameters for the case of $30 \leq \lambda \leq 40$. Unlike Fig.~\ref{fig:obs_pred_20to30}, the best-fit model does not fit well with the measured ratio, in particular for the case of large $\pi_{\rm max}$. While the ratio with $\pi_{\rm max}=30h^{-1}{\rm Mpc}$ is almost constant on $10h^{-1}{\rm Mpc} \leq R \leq 42 h^{-1}{\rm Mpc}$, the ratios with other $\pi_{\rm max}$ increase as $R$ increases. This increase is against the predicted scale-dependence by the RSD effect, and it is unclear what can cause this increase in the ratio. We tried different $R$ ranges to constrain the value of $\alpha$. However, any choice of $R$ did not significantly change the best-fit value of $\alpha$. We will leave the further investigation of the cause to the future work. \section{Summary} \label{sec:summary} In this paper, we implemented the model and the method to quantitatively evaluate the anisotropic boost to the cluster clustering and lensing due to the projection effects. We validated our model against the mock cluster catalogs and then applied it to the SDSS redMaPPer cluster catalog. We summarize our conclusions as follows: \begin{itemize} \item The anisotropic boosts can be quantitatively measured using the cluster-galaxy projected correlation functions concerning galaxy auto-correlation functions. We assume that the selection of galaxies is isotropic, and varying integral scales is a key to measure the boost. \item To model the projection effects, we made two assumptions: $\alpha$ increases constantly as $\pi_{\rm max}$ increases, and the increase of $\alpha$ stops when $\pi_{\rm max}>d_{\rm proj}$. \item Upon validation with the mock cluster catalog using the projection length of $d_{\rm proj}=120h^{-1}{\rm Mpc}$, our model was able to measure the expected anisotropic boost through the cluster-galaxy cross-correlation functions. \item We applied our model to the SDSS redMaPPer cluster catalog and measured the boost factor to be roughly $\sim 20\%$ for all the richness bins except the $\lambda \in [30,40]$ bin. The size of the boosts is consistent with the constraints in the cluster cosmology analysis by \cite{Park_etal2021} and \cite{To_Krause2021}. \item While the ratios $w_{\rm cg}(R)/w_{\rm gg}(R)$ of the mock cluster samples exhibit the scale-dependence consistent with the prediction from the RSD effect, the ratios measured from the SDSS redMaPPer clusters show little or opposite scale-dependence. Understanding the cause of this is our future work. \item Our model also enabled to constrain the projection length of clusters along the LOS. Even though the accuracy is somewhat questionable based on the validation from the mock, our model constrained $d_{\rm proj}$ to be $ \geq 100h^{-1}{\rm Mpc}$. \end{itemize} \begin{figure} \includegraphics[width=0.45\textwidth]{check_obs_l30to40_pca_hartlap.pdf} \caption{\label{fig:obs_pred_30to40} The projected cross-correlation functions of SDSS RM clusters and galaxies relative to the galaxy auto-correlation functions with $\pi_{\rm max}=30, 60, 90, 120$, and $150h^{-1}{\rm Mpc}$ with $30 \leq \lambda \leq 40$. The circles with error bars are from the measurements and the solid lines are the predictions based on our model with the best-fit parameters. } \end{figure} In this work, we develop a method to measure the anisotropic boost on the amplitude of cluster clustering through cluster-galaxy cross-correlation functions and measure the anisotropic boost in the SDSS redMaPPer clusters is roughly $20\%$ except the clusters with $30 \leq \lambda \leq 40$. We plan to investigate further the cause of large anisotropic boost ($\sim 60\%$) for these clusters in our future work. Additionally, we plan to extend our method for clusters without spectroscopic follow-ups in our future works. \section*{Acknowledgements} We thank Youngsoo Park, Peter Behroozi, Eduardo Rozo, Ryuichi Takahashi and Kiyotomo Ichiki for their comments, and thank Surhud More, Takahiro Nishimichi and Dark Quest collaboration team who provided an original cluster finder and Dark Quest simulations. TS thanks Masahiro Takada to encourages this publication. TS is supported by Grant-in-Aid for JSPS Fellows 20J01600 and JSPS KAKENHI Grant Number 20H05855. Funding for SDSS-III has been provided by the Alfred P. Sloan Foundation, the Participating Institutions, the National Science Foundation, and the U.S. Department of Energy Office of Science. The SDSS-III web site is \url{http://www.sdss3.org/.} SDSS-III is managed by the Astrophysical Research Consortium for the Participating Institutions of the SDSS-III Collaboration including the University of Arizona, the Brazilian Participation Group, Brookhaven National Laboratory, Carnegie Mellon University, University of Florida, the French Participation Group, the German Participation Group, Harvard University, the Instituto de Astrofisica de Canarias, the Michigan State/Notre Dame/JINA Participation Group, Johns Hopkins University, Lawrence Berkeley National Laboratory, Max Planck Institute for Astrophysics, Max Planck Institute for Extraterrestrial Physics, New Mexico State University, New York University, Ohio State University, Pennsylvania State University, University of Portsmouth, Princeton University, the Spanish Participation Group, University of Tokyo, University of Utah, Vanderbilt University, University of Virginia, University of Washington, and Yale University. \bibliographystyle{mnras}
\section{Introduction} \label{sec:intro} Most massive galaxies in the Universe have at least one supermassive black hole (SMBH) at their centres \citep[e.g.][]{2013ARA&A..51..511K}. During the hierarchical formation of galaxies, SMBHs are expected to migrate towards the galactic centre through star scattering and/or gas friction, eventually forming an SMBH binary (SMBHB) on parsec scales \citep{1980Natur.287..307B,2003ApJ...582..559V}. Observations of SMBHBs will provide astronomers with information about the evolutionary path and history of galaxies towards their present morphology, that is, the shape and the size. Most previous studies of SHBHB evolution have assumed circular orbits for simplicity, and/or expected that the gas friction or star scattering may dampen out the orbit eccentricity. However, if the orbits of SMBHBs are highly eccentric \citep{2005ApJ...634..921A,2006ApJ...642L..21B,2011ApJ...729...13C}, the strong-gravity regime extends to larger orbital separation and earlier evolution age, such that SMBHBs may rapidly evolve to coalescence due to gravitational wave (GW) emission. With modern observational facilities, even using the highest resolution of the very long baseline interferometry (VLBI) technique, direct identification of close SMBHBs with a separation $\lesssim$1 pc from radio imaging is very challenging \citep{2018RaSc...53.1211A}. In the past decade, the rapid development of time-domain observations has promoted a non-imaging technique for searching for SMBHBs. This method targets periodic variations in the optical luminosity or emission line intensity of active galactic nuclei (AGNs) over sufficiently long timescales. If the underlying source is indeed an SMBHB, the periodic variability on a timescale comparable to the SMBHB orbital period may originate from accretion rate fluctuations \citep{2008ApJ...672...83M,2012ApJ...755...51N,2015Natur.518...74G} or relativistic Doppler modulation \citep{2015Natur.525..351D}. The famous SMBHB candidate OJ~287 \citep{1988ApJ...325..628S,1996A&A...305L..17S} provides a nice demonstration of this technique. On the other hand, a number of SMBHB candidates with inferred orbital sizes of 0.001--0.01 pc have been identified using this time-domain method \citep{2015Natur.518...74G,2014ApJ...789..140L,2016ApJ...827...56Z,2020MNRAS.499.2245C}, although it is worth mentioning that the interpretations of their optical variability periods remain highly controversial \citep{2015Natur.525..351D,2016MNRAS.461.3145V,Zhu2020}. A major concern is that the red noise in the AGN light curve may also produce apparently periodic signals. In order to rule out the cause of AGN red noise, Bayesian model selection is necessary to address the statistical significance of the observed signals. Furthermore, all known SMBHB candidates so far, including OJ~287, have relative large orbital separations. Assuming that only GW radiation is at play, their expected merger timescales exceed the Hubble time. It is therefore possible that they belong to a class of massive black hole binary sources different from those observable by space-borne gravitational wave observatories, such as \textit{LISA}, \textit{Tianqin,} and \textit{Taiji} \citep{2021NatAs...5..881G}. Recently, \citet{2022arXiv220111633J} reported the discovery of the SMBHB candidate SDSS~J143016.05+230344.4 (also called AT2019cuk; hereafter J1430+2303). It is located in a Seyfert type I galaxy at a redshift of 0.08105 \citep{2015ApJS..219....1O}. The optical light curves obtained from Zwicky Transient Facitity (ZTF) display a quasi-periodic pattern of variability (Figure 1 therein), and more intriguingly, the periodicity exhibits a trend of rapid decay in both period and amplitude. In the past three years, the period has decreased from $\text{an approximately}$ one-year cycle at the first peak in 2019 July to a fourth cycle with a period $ \text{of about three}$ months in 2021 June. No such chirping flares with decaying periods have been observed before. They are incompatible with known models of disc oscillations or disc instability \citep{2019Natur.573..381M,2008Natur.455..369G}. The analysis in \citet{2022arXiv220111633J} shows that the timings of the flares are consistent with the theoretical expectation of an SMBHB near its final coalescence. A Bayesian model selection analysis also disfavours AGN red noise as the origin of the chirping flares. Together with the X-ray and the hydrogen emission line measurements, the SMBHB scenario becomes the most plausible interpretation of the various models considered. If the SMBHB model is confirmed, J1430+2303\ would be the first SMBH coalescence ever observed. In the SMBHB scenario, the orbit is expected to be inclined (with respect to the accretion flow) and highly eccentric. Moving SMBHs collide with the accretion flow close to the pericentre and expel a certain amount of gas, forming expanding plasma balls that shine in the optical band as flares. The X-ray emission from this system is more complicated as it is susceptible to the variation of accretion conditions in the inner accretion disc. On the other hand, because the orbit is highly eccentric, a significant amount of the GWs is emitted near the pericentre passage, which causes rapid orbital decay, as evidenced by the timing of the flares. The orbital evolution model predicts that coalescence will occur within three years \citep{2022arXiv220111633J}. During the SMBHB inspiral stage, especially close to the final merger, a large amount of electromagnetic radiation is expected to be released in the X-ray to optical bands \citep{2005ApJ...622L..93M}. Following the black hole coalescence, a relativistic jet may be produced in the pre-merger wind bubble with non-thermal radiation, forming a slowly fading transient that yields an opportunity for monitoring at electromagnetic wavelengths \citep{2021ApJ...911L..15Y}. Therefore, observations across the entire electromagnetic spectrum before and after the coalescence are essential for a comprehensive understanding of this rare astrophysical phenomenon. In particular, observations of the radio emission from J1430+2303\ will provide a unique diagnostic of the energetics and environment of the SMBHB coalescence. Shocks can be generated during the disc crossings, which subsequently affect the AGN corona and produce synchrotron radiation in the radio band; ultra high velocity outflows observed in the optical emission lines and X-ray continuum may also produce shocks on larger scales beyond the broad line region (BLR). In addition, after the binary merger, as the accretion flow gradually settles on the coalesced black hole, a transient jet may be produced in a way similar to in tidal disruption events. The X-ray and optical monitoring campaigns are ongoing, and simultaneous radio observations will add valuable data for studying the accretion physics and evolution of the SMBH(s). J1430+2303 was previously observed by the Very Large Array (VLA) FIRST Survey (Radio Images of the Sky at Twenty-Centimeters) at 1.4 GHz \citep{1995ApJ...450..559B}, and by the Very Large Array Sky Survey (VLASS) at 3 GHz \citep{2020PASP..132c5001L}. A weak source of $\sim1.0 \pm 0.2$ mJy is seen at the position of J1430+2303\ in the FIRST image, observed on 1995 December 18. The source is detected with a flux density of $\sim0.6 \pm 0.1$ mJy in the 3 GHz VLASS image observed on 2017 November 17, but is not unambiguously detected on 2020 July 16. In the Rapid ASKAP Continuum Survey (RACS) at 888 MHz \citep{2020PASA...37...48M}, a compact component of $\sim0.9 \pm 0.2$ mJy is found at the position of the FIRST source on 2020 May 1. A recent enhanced Multi Element Remotely Linked Interferometer Network (e-MERLIN observation made on 2022 March 28 reported a compact source with a size of 85 mas $\times$ 34 mas and a flux density of $0.73 \pm 0.09$ mJy (ATel\#15306). These data suggest that the flux density of J1430+2303\ between 0.9 and 1.5 GHz is in the range of 0.7--1.0 mJy. Moreover, these archival data indicate that variability is unlikely to be the cause of the VLASS non-detection in 2020, while the quality of the 2020 data calibration is worthy of attention. In order to measure the radio spectrum of J1430+2303\ and detect possible radio signals from the SMBHB coalescence, we applied for the director's discretionary time (DDT) of the Australia Telescope Compact Array (ATCA), the Karl G. Jansky Very Large Array (JVLA), and the upgraded Giant Metrewave Radio Telescope (uGMRT), covering frequencies from 0.7 GHz to 22 GHz. ATCA, VLA, and uGMRT have resolutions on the order of arcseconds and are able to obtain the radio emission from the whole galaxy, but are unable to probe the state of radio emission from the galactic nucleus. High-resolution VLBI imaging is the only observational method with milliarcsecond-scale (corresponding to parsec-scale physical size) resolution that can confirm the presence of a compact radio core from its compactness and high brightness temperature, and possibly detect jet knots. Detection of the jet will pave the way for future monitoring of dynamical signatures associated with the inspiral binary black holes, such as the variation in jet position angle. Therefore, we applied for observations of J1430+2303\ with the European VLBI Network (EVN) and the US Very Long Baseline Array (VLBA). The main goal of this round of pilot VLBI observations is to use high-resolution images to verify the presence of compact radio source(s) in the galactic nucleus and to obtain their precise positions so as to provide a priori information for future VLBI monitoring programs. This paper focuses on our VLBI observations. The multi-frequency radio spectrum based on the ATCA, JVLA, and uGMRT is presented in a separate paper (Shu et al. in prep.). Details of the EVN and VLBA observations are given in Section \ref{sec:obs}, the results are presented in Section~\ref{sec:result}, and Section~\ref{sec:conc} summarises our study. In this paper, we assume a standard flat $\Lambda$ cold dark matter cosmology with $\Omega_{\rm m} = 0.27$, $\Omega_{\rm \Lambda} = 0.73$, $H_0 = 70$~km\,s$^{-1}$ Mpc$^{-1}$, and the 1 mas angular scale corresponds to a projected physical size of 1.53 pc at the redshift of J1430+2303. \section{Observations and data processing} \label{sec:obs} \subsection{VLBA observations} \label{sec:vlbaobs} The initial VLBA observations, approximately two weeks following the application of the DDT, were completed on March 2 UT 08:17 -- March 3 UT 0:44 at L band (central frequency of 1.57 GHz) and on March 3 from UT 08:49 to UT 13:19 at C band (central frequency of 4.90 GHz) (observation code: BA154). All ten VLBA antennas participated in the observations. Each session lasted for 4.5 hours (Table~\ref{tab:obs}). The total flux density of J1430+2303\ is $\lesssim$1 mJy at 1--3 GHz from the archive VLA observations (see Section \ref{sec:intro}), therefore the phase-reference mode was adopted. The pointing centre of the J1430+2303\ was at RA = $14^\mathrm{h} 30^\mathrm{m} 16.056^\mathrm{s}$, Dec = $+23^{\circ} 03^{\prime} 44.45^{\prime\prime}$ (J2000), which corresponds to the SDSS peak position and is close to the VLA FIRST peak. The positional accuracy of the SDSS and FIRST is about $0.2\arcsec$, which is practicable for VLBI observations in the absence of milliarcsecond-resolution images. The bright source J1427+2348 (200 mJy at 5 GHz, about $1\degr$ from the target) was used as the phase-reference calibrator. The coordinate of J1427+2348 is RA=14:27:00.3918, Dec=+23:48:00.038 with a position error of only 0.1 mas, obtained from the Astrogeo database \footnote{\url{http://astrogeo.org} maintained by L. Petrov.}. The cycle of the phase-reference observations is 6 min, of which 4.5 min were used for the target source and 1.5 min for the calibrator source. The data recording rate was 2~Gbps, that is, using 256~MHz bandwidth (divided into 16 channels, 16~MHz bandwidth per channel), one-bit sampling, and dual polarisations. This configuration enables a field of view of $1.4\arcsec$ centred on the pointing centre, which is less affected by the bandwidth smearing effect. The raw observational data recorded by the VLBA telescopes were transferred to the DiFX correlator \citep{2011PASP..123..275D} in Socorro, USA, for correlation processing. The integration time of the correlator is 2 s, which can reduce the time smearing effect. After this, the correlated data were sent to the China SKA Regional Centre \citep{2019NatAs...3.1030A} and were further processed using a VLBI data processing pipeline for the calibration of the visibility data and imaging. This pipeline is written in Python and executed in script. It uses Parseltongue as an interface to call programs from the Astronomical Image Processing System (\textsc{aips}) software package developed by the National Radio Astronomy Observatory (NRAO) \citep{2003ASSL..285..109G} to perform data calibration. The data in two bands were processed separately following the same procedure. After loading the raw correlation data, the visibility amplitudes were calibrated using the antenna gain curves and the system temperatures measured at each telescope. We then checked the data quality and removed some obviously odd data points caused by observational failures and radio frequency interference. Throughout the data quality check, we used the Pie Town (PT) antenna as the reference antenna. Considering the weather information in the auxiliary tables, we corrected the data for ionospheric dispersion delay using the total electron content map obtained from the Global Navigation Satellite System (GNSS) data, and we also calibrated the atmospheric opacity effect on the visibility amplitude. For radio telescopes of azimuth-elevation mounted structures, the phase variations due to the temporal variation of the source parallactic angles were corrected as well. A fringe fitting was then performed on the bright fringe-searching source 3C345 arranged in the experiment, and the gain solutions we obtained were used to correct for instrumental delays and phase errors between different sub-bands,with the solutions applied to all the data. At the next step, we ran the global fringe fitting using the \texttt{FRING} task \citep{1983AJ.....88..688S} on the phase-reference calibrator J1427+2348, and the resulting gain solutions were interpolated and applied to all the data. Finally, the bandpass function of each antenna was solved by using the \texttt{BPASS} task and applied to calibrate the amplitude of all visibility data. With the calibration procedures completed, the data of the phase-reference calibrator J1427+2348 were first exported as external single-source FITS files, averaged for each sub-band (128-MHz each) and 2-second sampling time to reduce the amount of data. The J1427+2348 data were then loaded into the \textsc{Difmap} software package \citep{1994BAAS...26..987S} for self-calibration and imaging. After several iterations of hybrid mapping \citep{1974A&AS...15..417H,1984ARA&A..22...97P}, a high-quality image of the calibrator source was obtained. We then estimated the antenna-based gain correction factors, which primarily reflect the uncertainty in the amplitude of the visibility data associated with the antenna gain curves and the system temperatures. We found that the gain correction factor ($g_n$) for most antennas deviated from the nominal value (=1.0) by no more than $\pm10\%$, with an average gain correction factor of $\bar{g} = 0.05$ with a standard deviation of 0.12 at 1.6 GHz, $\bar{g} = 0.02$ with a standard deviation of 0.07 at 4.9 GHz. Therefore, we adopted a mean amplitude calibration uncertainty of 5\% for the VLBA visibility data. We applied the correction factors to the visibility amplitudes of all calibrators and the target source in \textsc{aips}. The calibrator model components generated in \textsc{Difmap} were imported into \textsc{aips} as input models for fringe fitting of the calibrator source data. This operation took into account the calibrator structure to improve the phase solutions because it is very important to improve the image quality of the target source when the calibrator is not very compact (see Figure~\ref{fig:cal}). Finally, the fringe-fitting solutions obtained for the phase-reference calibrator were interpolated to the target source data. We should note that J1427+2348 essentially presents a compact structure at 1.7 GHz, but exhibits a resolved structure at $>5$ GHz: a core-jet structure extending to the south-east, but with a diffuse morphology in the jet beyond 2 mas. Simultaneous multi-frequency observations made by RATAN-600 show a steep radio spectrum above 5 GHz and a turnover below 5 GHz \citep{2012A&A...544A..25M}, indicating an absorption of the compact core-jet structure at low frequencies. Therefore the calibration of the jet structure at 5 GHz is necessary, but not very relevant at 1.6 GHz. With the above calibration procedures, all calibrations were completed. Finally, after applying all calibration solutions to the target source, its visibility data were exported from \textsc{aips} and imported in \textsc{Difmap} for imaging. \subsection{EVN observation} \label{sec:evnobs} The EVN observations were carried out from 2022 February 27 UT 21:30 to February 28 UT 3:00 at a central frequency of 1.66~GHz. e-VLBI mode was used in order to obtain observational results quickly \citep{2004evn..conf..257S}. Fourteen telescopes participated in this observation (see Table~\ref{tab:obs}). During the experiment, data from the radio telescopes were transferred in real time through a high-speed optical fiber network to the SFXC software correlator \citep{2015ExA....39..259K} for processing at the Joint Institute for VLBI European Research Infrastructure Consortium (JIVE) in Dwingeloo, the Netherlands. Data from some individual telescopes were first temporarily stored at the station due to network problems and transferred to JIVE via the internet within two weeks after the end of the observations. The observations were performed in phase-reference mode by rapidly switching the telescopes between the target and a nearby bright calibrator (J1427+2348). The phase errors in the visibility data caused by the atmosphere can be solved by observing the bright phase-reference calibrator and applying the solutions to the target source. The phase-reference cycle was 5 minutes (4 minutes on the target and 1 minute on the calibrator) and repeated 53 times during a total of 5.5 hours observing time to obtain a good (u,v) coverage. The SDSS coordinate (J2000) of J1430+2303\ was used for the pointing position of the EVN telescopes. While waiting for JIVE to perform the correlation process, our VLBA observational data were released on March 17, and they were subsequently processed to yield a successful detection of the compact component for J1430+2303. The position of the compact source deviates from the pointing position by about 1~arcsec. In order to obtain the best possible phase coherence and reduce the bandwidth smearing effect, we requested the JIVE to re-correlate the data at the VLBA peak position. The correlated EVN data were transferred to the China SKA Regional Centre and processed following the same pipeline described in Section \ref{sec:vlbaobs}. The EVN and VLBA observations were made within 3 days of each other, and the same phase-reference source and the same cycle was used to facilitate comparison of the two 1.66-GHz observations. Figure~\ref{fig:cal} shows the images of the calibrator J1427+2348, with a complex jet morphology. The brightest central component is the radio core, with a peak flux density of about 250 mJy~beam$^{-1}$\ at 1.6 GHz and $\sim$200 mJy~beam$^{-1}$\ at 4.9 GHz. The L-band (1.6 GHz) images from the EVN and VLBA appear to be very similar. The core is surrounded by diffuse emission to the east, south, and west. The integrated flux densities of the core derived from two observations agree well, suggesting that the uncertainty of the visibility amplitude calibration is within a few percent. A subtle difference is that the EVN has a higher resolution and is able to reveal a more detailed clump-like structure. The 4.9-GHz image shows only the inner 8 mas core-jet structure, and the extended emission on a larger scale is resolved out or becomes too weak to be detected at 4.9 GHz because its spectrum is steep. The amplitude self-calibration from the calibrator J1427+2348 yielded different antenna gain correction factors for individual antennas, in the range of 0.8--2.1. Compared with the VLBA telescopes, which have the same size and the same equipment, the performance of the heterogeneous EVN telescopes shows a relatively larger difference, as is also manifested in the amplitude measurement errors of different telescopes. We calibrated the EVN visibility data in \textsc{aips} using a median correction factor for each telescope. Moreover, we corrected the phase errors caused by the structure of the calibrator itself using the \texttt{CLEAN} model of the calibration source. \subsection{Model fitting and error estimate of fitted parameters} Because the target source is very weak, self-calibration is technically difficult. We performed only a few runs of \texttt{CLEAN} and used natural weighting for deconvolution imaging. A circular Gaussian brightness distribution model was used to fit to the visibility data \citep{1995ASPC...82..267P} to quantitatively describe the size and flux density (Table~\ref{tab:img}). However, we find that after several tens of fitting iterations, the circular Gaussian often degenerates into a point source, that is, it has a very small size close to 0. This situation indicates that the radio source has a very compact emission structure and that the resolution of the VLBI image is not sufficient to resolve it. In this case, we cannot measure its size exactly, but only estimate an upper limit value based on the array configuration and the sensitivity of the image \citep{2005astro.ph..3225L}. We used a method that takes both statistical and measurement errors into account to estimate the errors of the observational parameters. The error in the flux density is the root of the sum of the squares of the image noise and the visibility amplitude calibration error (see Section~\ref{sec:obs}). The astrometric error of the absolute position of J1430+2303\ is mainly sourced from the position error of the calibrator, which is about 0.1 mas. \section{Results}\label{sec:result} J1430+2303\ may have multiple sources of radio emission: star formation activity, a weak jet, accretion-disc-driven winds or outflows, and an accretion disc corona \citep{2019NatAs...3..387P}. The first source of emission (star formation) is on the galactic scale. In principle, the jet is able to extend from near the central engine up to kiloparsec scales, but most of the radio-quiet AGN jets are not powerful enough to break through the confinement of the host galaxy environment ($\lesssim 1$ kpc) \citep{2012ApJ...760...77A}. The outflow mainly affects the broad line region (BLR) and narrow line region (NLR) \citep{2007ApJ...668L.103B}. The size of the corona is very small, but may extend to a fraction of 1 pc in some cases \citep{2008MNRAS.390..847L}. These sources of radio emission are mixed together, but they can be distinguished by morphology, size, brightness temperature, and spectral index. \subsection{Nature of the parsec-scale compact component} Figure~\ref{fig:map} shows the images obtained from the EVN and VLBA observations. All images show a compact unresolved component. The difference between the peak positions (Table~\ref{tab:img}) in the 1.57 GHz VLBA and 1.66 GHz EVN images does not exceed 0.3 mas (three times the astrometric error; see Section \ref{sec:obs}). The difference between the peaks in the 4.9 GHz VLBA image and the 1.57 GHz VLBA image is slightly larger. In addition to the astrometric error, the differential optical depth at the two frequencies additionally contributes to the positional error. In the three figures, the noise is uniformly distributed, with average noise levels of 0.015 mJy~beam$^{-1}$\ (EVN 1.66 GHz), 0.018mJy~beam$^{-1}$\ (VLBA 1.57 GHz), and 0.008 mJy~beam$^{-1}$\ (VLBA 4.9 GHz). EVN has more antennas and contains large-diameter telescopes such as the Efflesberg 100m and Tianma 65m telescopes, so that the sensitivity of the EVN is slightly higher than that of the VLBA for the same frequency and observation configuration. The flux density of the EVN component is higher than that of the VLBA component at 1.6 GHz, and the difference is about four times the flux density uncertainty. The EVN and VLBA observations are very close in frequency and observation time. Rapid variability is very unlikely for such a radio-quiet AGN. This difference probably results from the observation and data calibration. That is, the correlation of the EVN data used the precise position obtained from the VLBA 4.9 GHz image (see Section \ref{sec:evnobs}), so that the coherence loss in the VLBA data may be the main reason that the flux density is lower than in the EVN data. We have used the VLBI observational results to calculate the brightness temperature $T_{\rm B}$ of the radio component \citep{1982ApJ...252..102C}, and the results are given in Table~\ref{tab:img}. As discussed above, the parsec-scale structure of this source is very compact and not resolved in our VLBI images, therefore we only constrained the upper limit of the source size from which the lower limit of $T_{\rm B}$ is obtained. The 4.95 GHz VLBA image yields an upper limit for the component size of 0.5 mas (corresponding to a projected size of $\sim$0.77 pc). The EVN data give the highest $T_{\rm B}$ limit, which is $>1.4 \times 10^8$~K. If a radio source is dominated by thermal emission, the maximum brightness temperature of a normal galaxy is $\lesssim10^5$~K \citep{1992ARA&A..30..575C}. The derived brightness temperature of $\gtrsim 10^8$~K for J1430+2303\ significantly exceeds this brightness temperature threshold, and it is certain that the VLBI component in J1430+2303\ is of non-thermal origin. VLBI imaging observations of nearby Seyfert galaxies and radio-quiet AGN with the radio flux density $>1$ mJy show that the majority of these sources are dominated by an unresolved radio core, and a few exhibit a compact symmetric object (CSO) morphology on scales of a few parsec \citep{1998MNRAS.299..165B,2005ApJ...621..123U}. The fraction of the compact cores we detected has a tendency to increase with the total flux density \citep{1998MNRAS.299..165B}. The brightness temperatures of compact cores exceed $10^8$ K \citep[e.g.][]{1996ApJ...468L..91B,2005ApJ...621..123U}. The brightness temperature of J1430+2303\ is consistent with the temperatures of the typical Seyfert I galaxies and radio-quiet AGN, suggesting that they may have the same physical origin. Therefore, a natural explanation of the compact VLBI component detected in J1430+2303\ is the radio core of the AGN. In addition to the possibility of the radio core (an optically thick weak jet), there may be other origins of compact radio emission in the galactic nucleus. Ultrafast outflows have been observed in optical emission lines and X-ray continuum in J1430+2303, which may collide with the interstellar medium to produce shocks. In addition, flares produced during disc crossing or pericentre passage can also produce shocks in the corona \citep{2022arXiv220111633J}. All these shocks may produce synchrotron radiation in the radio band. Although the high brightness temperature excludes optically thick thermal radiation, which cannot exceed the temperature of the ionised gas, the brightness temperature alone does not fully rule out the presence of compact optically thin thermal emission originated from ionised disc winds \citep{2007ApJ...668L.103B}. The spectral index calculated from the VLBA observations taken one day apart is $\alpha^{4.9}_{1.6} = 0.04 \pm 0.18$ (the spectral index is defined as $S_\nu \propto \nu^\alpha$). The spectral index obtained from the EVN 1.66 GHz and VLBA 4.9 GHz observations three days apart is $\alpha^{4.9}_{1.7} = -0.21 \pm 0.14$. Although the flux densities from the VLBA data may be slightly lower than the actual values because the pointing centre deviated by $\sim1\arcsec$ from the source position (see Section \ref{sec:obs}), both spectral indices consistently show a flat spectrum, so that the possibility of an optically thin steep-spectrum disc wind becomes implausible. Moreover, if wide-angle outflow structures were present, they would be resolved by the high-resolution VLBI into a number of clumpy features \citep[see an exmaple in the superwind quasar PDS~456;][]{2021MNRAS.500.2620Y}. However, this is obviously incompatible with the J1430+2303\ VLBI images, which show a single compact component. These pieces of evidence do not favour the wide-angle outflow or wind interpretation. A magnetically heated corona above the accretion disc can also produce radio emission, which has a very compact structure becaues the radiation region lies very close to the central engine, and it has a flat spectrum due to synchrotron self-absorption \citep{2019NatAs...3..387P}. The radio source produced by the accretion disc corona resembles the radio core in many observational characteristics and is considered to be one of the origins of radio emission from radio-quiet AGNs. One criterion for identifying coronal activity is the radio to X-ray luminosity ratio, which satisfies the G\"{u}del-Benz relation, that is, $L_R/L_X \sim 10^{-5}$ \citep{2008MNRAS.390..847L}. We examined the radio and X-ray data of J1430+2303\ on 2022 March 2. The radio luminosity of the VLBI component is $3.9\times10^{21}$ W Hz$^{-1}$ at 4.9 GHz, consistent with the radio luminosities of nearby Seyfert galaxies, which are between $10^{20} - 10^{23}$ W Hz$^{-1}$ \citep{1989ApJ...343..659U,2021MNRAS.500.4749B}. The X-ray luminosity in the 2--10 keV band is $L_X = 3.5\times10^{43}$ erg s$^{-1}$ on 2022 March 2. This gives $L_R/L_X = 5.5\times10^{-6}$, a factor of 0.55 of the G\"{u}del-Benz relation \citep{2008MNRAS.390..847L}, suggesting that both radio and X-ray emission are likely to be from coronal activity. Compact radio sources may also be young radio supernovae (RSNe), such as the RSNe observed in the southern nuclei of the dual AGN system NGC~6240 \citep{2011AJ....142...17H}. VLBI observations from the so-called supernova factories Arp~220 and Arp~299 show that the vast majority of RSNe have luminosities below $10^{20}$ W Hz$^{-1}$, and only a very few are brighter than $10^{21}$ W Hz$^{-1}$ \citep{2009AJ....138.1529U,2019A&A...623A.173V}. The radio luminosity of RSNe is clearly not comparable with that of the J1430+2303\ VLBI component. Moreover, RSNe usually have a steep spectrum ($-0.7< \alpha <-0.5$), which is not consistent with the flat spectrum of J1430+2303. This further rules out the possibility of a RSNe. To summarise, a consistent conclusion is obtained from the radio morphology, size, brightness temperature, radio spectral index, and radio-X-ray luminosity ratio that the compact component detected in the VLBI images is either a compact jet or associated with the corona. \subsection{Understanding the radio structure} In the previous section, we discussed the physical nature of the compact VLBI component. In this section, we study the radio emission on larger scales. In parallel with the VLBI observations, we also carried out radio observations on the arcsecond scale to obtain the radio emission properties of the whole galaxy, including using the ATCA, JVLA, and uGMRT. The ATCA observations are the closest in time to the VLBI observations. The preliminary observational results from the ATCA have been reported in ATel\#15267 \citep[][]{2022ATel15267....1A}. The observations were carried out on 2022 February 28 UT 15-21, and J1430+2303\ is detected at all three frequencies of 2.1, 5.5, and 7.5 GHz. The flux density at 2.1 GHz is 0.76$\pm$0.05 mJy. Recently, Bruni et al. (ATel\#15306) reported an observation made with the e-MERLIN on 2022 March 28, detecting a compact source with a flux density of 0.73$\pm$0.09 mJy at 1.5 GHz with a deconvolved size of 85 mas $\times$ 34 mas. Despite the difference in resolution, the measured flux density by e-MERLIN with sub-arcsec resolution is very consistent with those by ATCA and uGMRT around 1.5 GHz with arcsec resolutions, suggesting that there is only very small room for a $>100$ mas scale extended emission contributed by galactic-scale star formation. This also indicates that the radio emission has remained stable over about one month after the latest optical and X-ray flares in the end of January \citep{2022arXiv220111633J}. This e-MERLIN flux density is about 2.3 times the VLBA and EVN flux densities at 1.6 GHz, suggesting that about 40\% of the radio emission of J1430+2303\ comes from the compact feature within $\sim$0.8 pc of the nuclear region. \textit{\textup{The question now is where the remaining 60\% of the radio flux density originates.} } We searched a larger region of 200$\times$200 mas$^2$ in the EVN and VLBA images centred on the location of the VLBI peak and found no other compact components above $5\sigma$, except for the radio core. Therefore, the remaining radio emission is probably from a scale between 12 (the lowest resolution of the VLBA at L band) and 120 mas (the highest resolution of the e-MERLIN). Extended jets and extended NLR winds are both possible on this size scale. This is similar to multi-scale radio observations of other Seyfert galaxies, in which a flat-spectrum core contributes a large fraction of the total flux density at centimetre wavelengths \citep{1989ApJ...343..659U}. The fraction of the radio core flux density seems to be correlated with the total flux density and observation frequency: the higher the total flux, the larger this fraction. At 4.9 GHz, a somewhat higher percentage of extended radio emission is resolved. An extended jet is a natural explanation of the missing flux in VLBI images. First of all, it is certain that J1430+2303\ lacks an extended jet on $\gtrsim 100$ pc scales. Compared to the highly relativistic jets in blazars, jets from radio-quiet AGNs have significantly lower kinetic power, a less collimated structure (or the jet direction varies), and they are likely to be intermittent (see Mrk~231 for a similar situation; \citealp{2009ApJ...706..851R,2021MNRAS.504.3823W}). On the other hand, J1430+2303\ may have a stratified or structured jet, and the entrainment of gas from the NLR clouds or torus into the outer sheath of the jet may result in hydrodynamic instability and lead to the fragmentation of the jet flow \citep[see an example of the disrupted jet in 3C~48;][]{1991Natur.352..313W,2010MNRAS.402...87A}. These factors hamper the expansion of the low-power jet to large scales, confining the jet flow within a cocoon \citep[e.g.][]{2007MNRAS.377..731M}. On the one hand, mildly relativistic jets are continuously generated in the nucleus, and the brightness of the jet knot rapidly declines through adiabatic expansion as it moves outwards. On the other hand, shocks are formed at the interface with the cocoon in the direction of the jet, producing the lobe structure commonly seen in CSO galaxies \citep{2021A&ARv..29....3O}. As a result, the radio structure consists of a central compact core, lobes at a few tens of parsec, and intervening invisible faint jets. e-MERLIN can detect all these emission features, but the extended lobes are completely resolved in the VLBI images. This type of structure is commonly seen in many Seyfert galaxies. Alternatively, the nuclear outflows can produce the extended radio emission. The Sloan Digital Sky Survey spectrum of J1430+2303\ exhibits blueshifted broad $H_\alpha$ emission line feature with a velocity offset of 2400 km s$^{-1}$ (see Figure 2 of \citealt{2022arXiv220111633J}), which in the SMBHB scenario is caused by the Doppler shift of the $H_\alpha$ line from BLR clouds as the secondary SMBH orbits the primary SMBH. The BLR clouds might be tidally disturbed and scattered by the primary black hole, resulting in additional high-velocity unbound components that may become ionised outflows driven by radiation pressure of the disc. High-velocity inflow and outflow components are also found in the X-ray continuum. Powerful high-speed AGN winds or outflows \citep[e.g.][]{2014MNRAS.442..784Z,2015MNRAS.447.3612N,2015Sci...347..860N,2018ApJ...854L...8R} can generate shocks that may affect scales from a few parsec to 100 parsec and produce synchrotron radiation in radio. Shocks created from the interactions between parsec-scale winds or outflows with a dense external medium can be distributed over a large opening angle. For instance, the E and F clumps discovered in the Seyfert galaxy NGC~3079, which deviate from the jet direction, are considered to be rapidly cooling remnants of interactions of the outflow with the interstellar medium \citep{2005ApJ...618..618K}. Studying the energetics of the outflow at multiple bands can help confirm or rule out whether it can produce the observed radio luminosity. \subsection{Accretion state and jet-disc coupling} From the trajectory models that match the optical light curves, the evolution of the binary orbit predicts a merger time of about 3 years \citep{2022arXiv220111633J}. Ongoing X-ray monitoring shows the latest flare at the end of 2022 January, after which the X-ray brightness decreases. For the dates of the radio VLBI observations, 2022 February 27 and 2022 March 2, the X-ray luminosities are at a local trough, with X-ray luminosities of $L_{\rm X} (\rm 2-10\, keV) = 5.9\times10^{43}$ erg s$^{-1}$ and $3.5\times10^{43}$ erg s$^{-1}$, respectively. The classical radio-loudness parameter $R$ is defined as the ratio of two monochromatic fluxes $R = f(6 cm)/f(4400 \AA)$ \citep{1989AJ.....98.1195K}, where $R<10$ for radio-quiet AGN. The monochromatic flux density at rest-frame $4400\AA$ derived from optical spectra taken on 2022 February 28 is $f(4400\AA)=0.24$~mJy, yielding a radio-loudness parameter of $R \sim 1$. By definition, J1430+2303\ is a radio-quiet AGN. Alternatively, the monochromatic luminosity at the 6 cm radio band and X-ray luminosity can be used to define the radio loudness \citep{2003ApJ...583..145T}, $R_X=\nu L_\nu {\rm (6 \,cm)}/L_X (2-10 \, {\rm keV})$. This gives a radio loudness of $R_X \sim 10^{-5}$, again confirming the radio-quiet nature. Previous studies have found a correlation between black hole accretion and jets, specifically, between the radio core luminosity at 5 GHz ($L_{R}$), the X-ray luminosity ($L_X$) at 2--10 keV, and the black hole mass ($M_{\rm BH}$), that is, the black hole fundamental plane (FP) relation \citep[e.g.][]{2003MNRAS.345.1057M,2004A&A...414..895F}, \begin{equation} \log L_{\rm R} = (0.60^{+0.11}_{-0.11}) \log L_{\rm X} + (0.78^{+0.11}_{-0.09})\log M_{\rm BH} + 7.33^{+4.05}_{-4.07} \label{eq1} .\end{equation} The extended radio emission observed in radio-quiet AGN is associated with a relic from earlier radio activity, and it is not a contemporaneous event with the current X-ray activity. Therefore, we used the radio luminosity $L_R$ obtained from the VLBI measurements, which is much closer to the recent X-ray activity. Substituting the observed X-ray luminosity and $M\sim 10^8 M_\odot$ \citep{2022arXiv220111633J} into the black hole FP relation, we find that the inferred radio flux density is more than one order of magnitude higher than the observed value. This discrepancy may be related to the enhanced X-ray luminosity during the coalescence phase that is used in the calculation. If we substitute the observed radio luminosity into Eq.~\ref{eq1}, we obtain an X-ray luminosity that is two orders of magnitude lower than the observed value, which could be the quiescent-state X-ray luminosity and needs to be confirmed by future X-ray observations. We note that the data points presented in \citet{2003MNRAS.345.1057M} for fitting the FP relation can vary by more than one order of magnitude, so that the physical implication that can be drawn from the mismatch obtained here is unclear. On the other hand, the black hole FP relation is affected by various AGN sample properties (e.g. radio spectral index or beaming effect) and different AGN accretion states (high or low states). Under the assumption of a scale-invariant jet, the relation is based on the existence of a coupling between the radiatively inefficient accretion flow and the jet, independent of the jet model, and on the assumption that the correlation coefficient depends only on the spectral index of the synchrotron radiation and the accretion mode. Whereas Seyfert galaxies are typically thought to contain radiatively efficient discs, the FP of Seyfert galaxies may not be the same as that obtained from low-luminosity AGN \citep{2019ApJ...871...80G}. If two black holes are present, the sources of X-ray and radio emission remain rather uncertain for the particular AGN studied here. Future multi-band observations may help understand the origin and location of the emitters. For X-ray binaries, observations indicate that the radiatively inefficient accretion flow can produce a weak steady jet when the accretion rate or X-ray emission is low; when the accretion state becomes higher to allow stronger X-ray emission, the jet production is suppressed. When the binary black holes merge, the accretion flow is likely significantly disturbed and later on settles to a new stationary state. A new transient jet may be produced at that time. Our current VLBI observations provide the necessary information for understanding the entire pre-merger radio emission of the SMBHB. \section{Conclusions} \label{sec:conc} We have conducted observations of J1430+2303\ using the European VLBI Network and the Very Long Baseline Array and obtained high-resolution images of this source for the first time. The main results and conclusions of this paper are summarised below. \begin{enumerate} \item A highly compact radio component with a brightness temperature higher than $10^8$~K and a flat radio spectrum is consistently detected in all three VLBI images. Based on its radio morphology, size, brightness temperature, and radio spectrum, we identify the VLBI component as an optically thick jet (i.e. a radio core) and/or a corona. \item The precise position of the nucleus with an accuracy of 0.1 mas is determined, paving the way for future VLBI monitoring. \item Approximately 40\% of the total radio flux comes from the compact component revealed in the VLBI images. The remaining 60\% of the flux density may come from extended radio lobes that extend to a few tens of parsecs from the nucleus, from the resolved outer layer of the structured jet, or from shocks generated by high-speed ionised outflows in the NLR. \item A mildly relativistic jet such as that in J1430+2303\ may be confined within the NLR of the host galaxy. Similar observations have been found in other radio-quiet AGNs and radio-intermediate AGNs (e.g. Mrk~231). In contrast, powerful Fanaroff-Riley I type jets, even if the jets have experienced strong interactions with the interstellar medium and lost a fraction of their mechanical energy (e.g. the distorted jet in 3C~48), still have high enough momentum to break through the interstellar medium to reach beyond 1 kpc. \item Based on the black hole FP relation, the X-ray luminosity estimated from the VLBI radio luminosity and black hole mass is two orders of magnitude lower than the observed values, and it may be associated with the radiatively inefficient accretion flow and not be identical to the currently active X-ray emission source(s). As the SMBHB coalescence is completed, a stable accretion disc will form and the accretion state may change significantly, resulting in a possible jet after the coalescence. \end{enumerate} The combined multi-band observations on future disc crossing events will be able to give a more stringent constraint on the SMBHB evolutionary model. In the coming years, continued radio spectrum and VLBI imaging observations will provide key observational information to track the last moments before the binary SMBH coalescence. \begin{acknowledgements} We thank the anonymous referee for the constructive comments and suggestions, the inclusion of which has improved the content and presentation of our work. This work is supported by National Key R\&D Programme of China (grant number 2018YFA0404603) and NSFC (1204130, 11833007, 12192221, 12022303). T.A. thanks for the grant support by the Youth Innovation Promotion Association of CAS. Y.Z. is sponsored by Shanghai Sailing Program under grant number 22YF1456100. H.Y. and Z.P. acknowledge supports by the Natural Sciences and Engineering Research Council of Canada and in part by Perimeter Institute for Theoretical Physics. Research at Perimeter Institute is supported in part by the Government of Canada through the Department of Innovation, Science and Economic Development Canada and by the Province of Ontario through the Ministry of Colleges and Universities. We thank the TACs and schedulers of the EVN and NRAO for approving the ToO/DDT observations and scheduling the observations quickly. We thank the staff at the NRAO and EVN telescopes and correlators for observing and quickly correlating the data. The European VLBI Network (EVN) is a joint facility of independent European, African, Asian, and North American radio astronomy institutes. Scientific results from data presented in this publication are derived from the following EVN project code(s): RS005. e-VLBI research infrastructure in Europe is supported by the European Union, Seventh Framework Programme (FP7/2007-2013) under grant agreement number RI-261525 NEXPReS. e-MERLIN is a National Facility operated by the University of Manchester at Jodrell Bank Observatory on behalf of STFC. The National Radio Astronomy Observatory is a facility of the National Science Foundation operated under cooperative agreement by Associated Universities, Inc. Scientific results from data presented in this publication are derived from the following VLBA project codes: BA154. The VLBI data processing made use of the compute resource of the China SKA Regional center prototype, funded by the Ministry of Science and Technology of China and the Chinese Academy of Sciences. \end{acknowledgements} \bibliographystyle{aa}
\section{Introduction} The strong emission features at 3.3, 6.2, 7.7, 8.6, 11.2, and 12.7 $\mu$m in a typical mid-infrared (mid-IR) spectrum are characteristic of a family of complex organic molecules known as Polycyclic Aromatic Hydrocarbons \citep[PAHs;][]{Sellgren:1983, Leger:1984, Allamandola:1985, Allamandola:1989}. PAH molecules account for $\sim$ 15\% of the total cosmic carbon \citep{Allamandola:1989} and $\sim$ 20 \% of the total IR power of the Milky Way and star-forming galaxies \citep{Madden:2006, Smith:2007}. Emission from PAHs typically originates from photo-dissociation regions (PDRs), where the physics and chemistry of the gas are driven by far-ultraviolet (FUV; 6--13.6 eV) photons \citep{Hollenbach:97}. Gas within a PDR is stratified, with regions of atomic gas found closer to the star and molecular gas further away. The atomic gas consists largely of hydrogen (H) and ionised carbon (C), and the molecular gas of molecular hydrogen (H$_{2}$) and carbon monoxide (CO). PAH emission typically outlines the PDR surface, decreasing into the PDR as the UV radiation field is attentuated. The physical conditions (radiation field strength $G_{0}$, gas density $n_{\rm gas}$, and gas temperature $T_{\rm gas}$) within the PDRs regulate the molecular properties of the PAH population such as their charge, size, and molecular structure \citep[e.g.][]{Hony:2001, Peeters:prof6:02, Galliano:2008}. Several experimental and theoretical studies have shown that changes in the PAH properties affect the spectral characteristics of the PAH population's emission features. For example, changes in the charge state of PAHs influence the intensity of the 6.2, 7.7, and 8.6 $\mu$m features relative to the 11.2 $\mu$m feature, changes in the size distribution influence the relative intensity of the 3.3 $\mu$m to 11.2 $\mu$m feature, and changes in the molecular structure influence the relative intensities of the features in the 11-14 $\mu$m region \citep[e.g.][]{Hudgins:1999, Allamandola:1999, Hony:2001, Peeters:prof6:02, Bauschlicher:2008, Bauschlicher:2009, Ricca:2012, Candian:14}. The PAH emission features observed in PDRs show spectral variations, the most prominent of which are due to changes in the charge state of the PAH population \citep[e.g.][]{Joblin:1996, Sloan:99, Allamandola:1999, Bregman:2005, Compiegne:2007, Galliano:2008, Rosenberg:11, Peeters:2017, Sidhu:2021}. \citet{Bakes:2001} presented a PAH emission model that calculates the charge distribution of PAHs and uses these results to determine the PAH emission in astrophysical environments. In this paper, we revisit the emission model adopting recent experimentally or quantum chemically determined PAH characteristics such as the ionization potentials, photo-absorption cross-sections, IR cross-sections, for individual PAHs. The aim of this paper is to demonstrate that the PAH charge distribution can account for the observed spectral characteristics of PAHs by comparing the model results with observations of PDRs exhibiting a wide range of physical conditions. This paper is organized as follows. In Section~\ref{sec:emission_model}, we describe the PAH emission model, which combines the charge distribution, PAH characteristics, and the IR emission from PAHs in a given astrophysical environment. In Section~\ref{sec:results}, we present the results of our model for five different PAH molecules, namely, tetracene ($\text{C}_{18}\text{H}_{12}$), pentacene ($\text{C}_{22}\text{H}_{14}$), ovalene ($\text{C}_{32}\text{H}_{14}$), circumcoronene ($\text{C}_{54}\text{H}_{18}$), and circumcircumcoronene ($\text{C}_{96}\text{H}_{24}$), over a range of physical conditions. We discuss the application of the model in five different environments, NGC~2023, NGC~7023, the Orion Bar, the Horsehead nebula, and the diffuse interstellar medium (ISM), in Section~\ref{sec:application}. Finally, we provide a summary of this work in Section~\ref{sec:summary}. \section{PAH emission Model} \label{sec:emission_model} Following \citet{Bakes:2001} we model the PAH emission taking into account the charge distribution of PAHs in astrophysical settings by adopting realistic properties of PAHs measured experimentally or calculated theoretically as available. In this section, we present a comprehensive overview of the three main components of our model: the calculation of the PAH charge distribution, the calculation of IR emission from PAHs, and the PAH characteristics, as well as a strategy for combining these to model PAH emission in astrophysical environments. We also compare our PAH emission model to other models used in previous studies. \subsection{The PAH charge distribution model} \label{subsec:Charge_dist_model} The charge distribution of molecular species in astronomical environments is set by the balance between the processes of ionization and electron recombination. \citet{Bakes:1994} developed a model using the principle of ionization equilibrium to determine the charge distribution of PAHs and very small graphitic grains in a variety of physical conditions pertaining to interstellar environments. In this work, we adopt the \citet{Bakes:1994} model solely for PAHs by using the ionization, electron recombination, and electron attachment rates derived from recent theoretically calculated or experimentally measured molecular characteristics of PAHs. In this section, we describe the framework of our charge distribution model. In our model, we assume that a PAH molecule in a given charge state, $Z$, can get ionized by absorbing a photon of energy $h\nu$ \begin{equation} \text{PAH}^{Z} \xrightarrow{h\nu} \text{PAH}^{Z+1} + e^{-} \end{equation} The ionized PAH can further undergo electron recombination \begin{equation} \text{PAH}^{Z+1} + e^{-} \to \text{PAH}^{Z} \end{equation} and the neutral PAH ($Z=0$) can undergo electron attachment \begin{equation} \text{PAH} + e^{-} \to \text{PAH}^{-} \end{equation} The fraction of PAHs in a given charge state, $f(Z)$, is then determined by considering the ionization balance which yields \begin{equation} f(Z) = \frac{k_{e}(Z+1)}{k_{\rm ion}(Z)}f(Z+1) \label{eq:frac_PAHs} \end{equation} \noindent where $k_{\rm ion}(Z)$ and $k_{e}(Z)$ are the photo-ionization and electron recombination rates of PAH molecule in a charge state $Z$ in units of s$^{-1}$. For $Z = -1$, $k_{e}(Z+1)$ is the electron attachment rate, $k_{ea}(Z)$. We determine the charge distribution of PAHs by solving the set of equations given by equation~(\ref{eq:frac_PAHs}) for each charge state in conjunction with the normalization condition \begin{equation} \sum_{Z\,=\,-1}^{Z\,=\,N_{\rm max}} f(Z) = 1 \end{equation} where $N_{\rm max}$ is the highest charge state accessible to the PAH molecule. \subsubsection{Photo-ionization rate} \label{subsec:photo_ionization_rate} We estimate the photo-ionization rate for a given PAH molecule in a charge state $Z$ using the following expression from \citet{Bakes:1994}: \begin{equation} k_{\rm ion}(Z) = \pi W\int_{\nu_{Z}}^{\nu_{H}} Y_{\rm ion}(Z, \nu) \sigma_{\rm abs}(Z, \nu) \frac{B_{\nu}(T_{\rm eff})}{h\nu} d\nu\;\;\;\;\; (\text{s}^{-1}) \label{eq:photo_ion_rate} \end{equation} where \[ \begin{array}{lp{0.8\linewidth}} Y_{\rm ion}(Z, \nu) & the ionization yield of a PAH molecule in a charge state $Z$ \\ \sigma_{\rm abs}(Z, \nu) & the photo-absorption cross-section of a PAH molecule in a charge state $Z$ \newline Units: cm$^{2}$ \\ B_{\nu}(T_{\rm eff}) & the Planck function for the incident blackbody radiation field at the effective temperature $T_{\rm eff}$ of the exciting star \newline Units: erg cm$^{-2}$ s$^{-1}$ Hz$^{-1}$ sr$^{-1}$\\ W & the FUV radiation field dilution factor \\ \nu_{Z} & the frequency of the photon corresponding to the ionization potential (IP) for a PAH molecule in charge state $Z$ \newline Units: Hz \\ \nu_{H} & the frequency of the photon corresponding to photon energy of 13.6 eV \newline Units: Hz \\ h & the Planck constant i.e. 6.6261$\times10^{-27}$ erg s \end{array} \] The Planck function is calculated as \begin{equation} B_{\nu}(T_{\rm eff}) = \frac{2h\nu^{3}}{c^{2}}\frac{1}{e^{h\nu/kT_{\rm eff}}-1} \end{equation} where \[ \begin{array}{lp{0.8\linewidth}} k & the Boltzmann constant i.e. 1.3807$\times10^{-16}$ erg $\text{K}^{-1}$ \\ c & the speed of light i.e. 2.99792458$\times10^{10}$ cm $\text{s}^{-1}$\\ \end{array} \] The FUV radiation field dilution factor is calculated as \begin{equation} W = \frac{1.6 \times 10^{-3} G_{0}}{\sigma T_{\rm eff}^{4} f_{\rm FUV}} \end{equation} where \[ \begin{array}{lp{0.8\linewidth}} G_{0} & the FUV radiation field strength in Habing Field \newline 1 $G_{0}$ = 1.6 $\times 10^{-3}$ erg cm$^{-2}$ s$^{-1}$ \\ \sigma & the Stefan-Boltzmann constant \newline 5.6704 $\times 10^{-5}$ erg s$^{-1}$ cm$^{-2}$ K$^{-4}$\\ f_{\rm FUV} & the fraction of the FUV flux in the radiation field of the star with an effective temperature $T_{\rm eff}$\\ \end{array} \] The fraction of the FUV flux, $f_{\rm FUV}$, is further calculated as \begin{equation} f_{\rm FUV} = \frac{\pi \int_{\nu_{6}}^{\nu_{H}}B_{\nu}(T_{\rm eff})d\nu}{\sigma T_{\rm eff}^{4}} \end{equation} where $\nu_{6}$ is the frequency of the photon corresponding to a photon energy of 6 eV. In the calculation of W, we use the fraction of the FUV flux because the ratio of $G_{0}$ and the FUV radiation provides a measure of the radiation field dilution. Since, by definition, $G_{0}$ is the FUV radiation field, we calculate the incident blackbody FUV radiation field by multiplying $f_{\rm FUV}$ with $\sigma T_{\rm eff}^{4}$. \subsubsection{Electron-recombination rate} \label{subsec:electron_recombination_rate} Measurements of electron recombination rates exist only for a few small PAHs. Therefore, we estimate the electron recombination rates theoretically by adopting the following formula proposed by \citet{Tielens:2005}: \begin{equation} k_{e}(Z) = 1.3 \times 10^{-6} Z \,\, \text{N}_{C}^{1/2}\left (\frac{300}{T_{\rm gas}}\right )^{1/2}n_{e}\;\;\;\;\; (\text{s}^{-1}) \label{eq:recombination_rate} \end{equation} where $\text{N}_{C}$ is the number of C atoms in a PAH molecule, $T_{\rm gas}$ is the gas temperature in K, and $n_{e}$ is the electron density in a given environment in units of cm$^{-3}$. This expression is based on the collisional rates of an electron's interaction with an ionized PAH molecule represented by a conductive disk \citep{Bakes:1994}. We note that \citet{Biennier:2006} compared the experimentally measured electron-recombination rates of small PAHs to theoretically calculated recombination rates (equation~\ref{eq:recombination_rate}) and found that the electron recombination rates increase with size and approach the theoretical estimate for larger sized PAHs. \subsubsection{Electron attachment rate} \label{subsec:electron_attachment_rate} We adopt the theoretical expression for electron attachment rates derived by \citet{Tielens:2005}: \begin{equation} k_{ea}(Z=0) = 1.3 \times 10^{-7} s_{e} \,\, \text{N}_{C}^{1/2} \,\, n_{e}\;\;\;\;\; (\text{s}^{-1}) \label{eq:electronattachmentrate} \end{equation} where $s_{e}$ is the dimensionless sticking coefficient for electron attachment. \subsection{Theoretical calculation of IR emission from PAHs} \label{subsec:spec_calc} In this section, we describe the procedure we use to calculate the IR emission from a PAH molecule with a charge state $Z$. First, we estimate the average photon energy, $E_{\rm avg}(Z)$, that a PAH molecule in a charge state $Z$ will absorb in a given environment that will lead to the IR emission using the following expression: \begin{equation} E_{\rm avg}(Z) = \frac{\int_{0}^{\nu_{H}}(1 - Y_{\rm ion}(Z,\nu)) \sigma_{\rm abs}(Z, \nu) h \nu \frac{B_{\nu}(T_{\rm eff})}{h\nu} d\nu}{\int_{0}^{\nu_{H}} (1 - Y_{\rm ion}(Z, \nu))\sigma_{\rm abs}(Z, \nu) \frac{B_{\nu}(T_{\rm eff})}{h\nu} d\nu } \label{eq:avg_energy} \end{equation} where $E_{\rm avg}(Z)$ is in units of erg. The average photon energy depends on the physical conditions of the environment and the photo-absorption cross-section of the PAH molecule itself. Moreover, for a photon that is absorbed by a PAH molecule, there is always a competition between the process of IR emission and ionization. Therefore, we include a factor of $1-Y_{\rm ion}(Z,\nu)$ in the calculation of the average photon energy to account for this competition between the IR emission and photo-ionization. The factor $1-Y_{\rm ion}(Z,\nu)$ is derived from the probability, $P_{\rm emission}(Z)$, that a PAH molecule in a charge state $Z$ will absorb a photon that leads to emission as opposed to ionization: \begin{equation} P_{\rm emission}(Z) = \frac{k_{\rm abs}(Z) - k_{\rm ion}(Z)}{k_{\rm abs}(Z)} \label{eq:P_emission} \end{equation} where $k_{\rm abs}(Z)$ is the photo-absorption rate given by \begin{equation} k_{\rm abs}(Z) = \pi W\int_{0}^{\nu_{H}} \sigma_{\rm abs}(Z, \nu) \frac{B_{\nu}(T_{\rm eff})}{h\nu} d\nu\;\;\;\;\; (\text{photons } \text{s}^{-1}) \label{eq:photo_abs_rate} \end{equation} and $k_{\rm ion}(Z)$ is the photo-ionization rate for a PAH molecule in a charge state $Z$ in a given environment. Substituting the expression for $k_{\rm abs}(Z)$ from equation~\ref{eq:photo_abs_rate} and $k_{\rm ion}(Z)$ from equation~\ref{eq:photo_ion_rate} in equation~\ref{eq:P_emission}, shows that $P_{\rm emission}(Z) \propto$ an averaged $\overline{1-Y_{\rm ion}(Z,\nu)}$; \begin{equation} P_{\rm emission}(Z) = \frac{\int_{0}^{\nu_{H}}\sigma_{\rm abs}(Z, \nu)(1-Y_{\rm ion}(Z,\nu))\frac{B_{\nu}(T_{\rm eff})}{h\nu}d\nu}{\int_{0}^{\nu_{H}}\sigma_{\rm abs}(Z,\nu)\frac{B_{\nu}(T_{\rm eff})}{h\nu}d\nu} \end{equation} Once the molecule absorbs the photon of energy, $E_{\rm avg}(Z)$, it redistributes the absorbed energy over its various vibrational modes. A molecule with $N$ number of atoms will have $3N-6$ number of vibrational modes called the fundamental vibrational modes. Out of these $3N-6$ modes, only a few will be IR active and have intrinsic strengths, $\sigma_{\nu}$. Upon absorption of a photon, the temperature of the molecule rises immediately. We calculate the temperature, $T_{\rm max}$, the molecule will attain upon absorption of a single photon using the following expression from \citet{Bakes:2001}: \begin{equation} E_{\rm avg}(Z) = \int_{2.7 K}^{T_{\rm max}} C_{v}(T, Z) dT \label{eq:max_temp_calc} \end{equation} where $C_{v}(T, Z)$ is the specific heat of a PAH molecule in a charge state $Z$ as a function of the temperature of the molecule in units of erg/K. We note that equation~\ref{eq:max_temp_calc} is used to calculate $T_{\rm max}$ using the $E_{\rm avg}(Z)$ determined from equation~\ref{eq:avg_energy}. In our calculation, we assume that initially before the absorption of a photon, the molecule has a temperature of 2.7 K and after the absorption of a photon of energy $E_{\rm avg}(Z)$ it reaches a temperature $T_{\rm max}$. Considering each fundamental vibrational mode of a molecule as a harmonic oscillator, we calculate the specific heat of a molecule, $C_{v}(T, Z)$, as follows \citep[equation 6.33 in][]{Tielens:2005}: \begin{equation} C_{v}(T, Z) = k \sum_{i=1}^{3N-6} \left (\frac{h\nu_{i, Z}}{kT}\right )^{2} \frac{exp \left (\frac{h\nu_{i, Z}}{kT}\right )}{\left [exp(\frac{h\nu_{i, Z}}{kT})-1\right ]^{2}} \end{equation} Here, the $\nu_{i}$'s correspond to the frequencies of the fundamental vibrational modes of the PAH with charge $Z$. In our model, we assume that the energy is quickly distributed over all available vibrational modes – the ergodic approximation. The molecule cools down via emission of IR photons through its IR active vibrational modes. We recognize that the PAH molecule can absorb yet another photon at any time during the cooling process and reach a higher temperature than $T_{\rm max}$. In other words, we consider the absorption of multiple photons by a PAH molecule before it completely cools down. We emphasize that in the case of multiple photon absorptions, each absorbed photon by a PAH molecule in a charge state $Z$ has an energy equal to $E_{\rm avg}(Z)$. We account for the effect of the absorption of multiple photons on the temperature of a PAH molecule in a charge state $Z$ and hence on its IR emission, by calculating a temperature distribution function, $G(T, Z)$. For the first photon absorption, $G_{1}(T, Z)$ is defined as follows assuming that the temperature distribution of a PAH molecule is a Poisson process \citep[see equation 6 in][]{Bakes:2001}: \begin{equation} G_{1}(T, Z) = \frac{k_{\rm abs}(Z)}{dT/dt}exp[-k_{\rm abs}(Z)\tau_{\rm min}(T)] \end{equation} where \[ \begin{array}{lp{0.8\linewidth}} k_{\rm abs}(Z) & the photo-absorption rate for a PAH molecule in a charge state $Z$ \newline Units: s$^{-1}$\\ dT/dt & the cooling rate of a PAH molecule \newline Units: K s$^{-1}$ \\ \tau_{\rm min}(T) & the time taken by the molecule to cool down from maximum temperature reached after one photon absorption, $T_{\rm max}$, to some temperature $T$ \newline Units: s \\ \end{array} \] We calculate the rate, $dT/dt$, at which the molecule cools down following equations 3 and 4 from \citet{Bakes:2001}: \begin{equation} \frac{dT}{dt} = \frac{4 \pi}{C_{v}(T, Z)} \sum_{i} \sigma_{\nu_{i, Z}} B_{\nu_{i}}(T) \label{eq:cooling_rate} \end{equation} emphasizing that in equation~\ref{eq:cooling_rate}, the summation is taken over IR active vibrational modes only. Here $\sigma_{\nu_{i}, Z}$ is the intrinsic intensity of the IR active mode of a PAH molecule in a charge state $Z$ expressed as IR cross-section in units of cm$^{2}$ Hz. To calculate $\tau_{\rm min}$, we then use the following expression \citep[see equation 6.31 in][]{Tielens:2005}: \begin{equation} \tau_{\rm min}(T) = \int_{T}^{T_{\rm max}} \frac{1}{dT/dt} dT \end{equation} For $n$ photon absorptions, we calculate the temperature distribution function, $G_{n}(T, Z)$, in an iterative fashion as follows: \begin{equation} G_{n}(T,Z) = \int_{2.7}^{T} G_{n-1, T_{n-1}\to T^{'}}(T_{n-1},Z)G_{T \gets T^{'}}(T,Z) dT_{n-1} \end{equation} \noindent where $G_{n-1,T_{n-1}\to T^{'}}(T_{n-1}, Z)$ is the probability of finding a PAH molecule at temperature $T_{n-1}$ after $n-1$ photon absorptions that can absorb the $n^{\text{th}}$ photon and reach the temperature $T^{'}$ and $G_{T \gets T^{'}}(T, Z)$ is the probability of finding the molecule at temperature $T$ after it began to cool down from the temperature $T^{'}$ it attained after the absorption of the $n^{\text{th}}$ photon. We calculate the temperatures $T^{'}$ using equation~\ref{eq:max_temp_calc} by replacing the left hand side with $E_{\rm avg} + E_{T_{n-1}}$, sum of the energy $E_{\rm avg}$ of a new photon absorbed and the energy $E_{T_{n-1}}$ remaining in a molecule from previous $n-1$ photon absorptions, and the upper limit of the integral with the temperature $T^{'}$ that the molecule will attain after the $n^{\text{th}}$ photon absorption. After determining the temperature distribution, $G_{n}(T,Z)$, for a PAH molecule after absorption of $n$ photons, we calculate the IR emission of a molecule through its IR active vibrational modes as follows: \begin{equation} I_{\nu_{i}}(Z) = \sigma_{\nu_{i, Z}} \int_{2.7}^{T_{max, n}} B_{\nu_{i}}(T) G_{n}(T, Z) dT \label{eq:IR_emission_IR_active} \end{equation} where $T_{max,n}$ is the highest possible temperature that a PAH molecule can attain after $n$ photon absorptions. \subsection{Resulting PAH emission in astrophysical environments} \label{subsec:final_model} In order to model the PAH emission in a given environment, we combine the calculation of the PAH charge distribution described in Section~\ref{subsec:Charge_dist_model} with the theoretical calculation of IR emission from a PAH molecule described in Section~\ref{subsec:spec_calc}. In other words, we multiply the intensity of each IR active mode of a molecule in a charge state $Z$, obtained from equation~\ref{eq:IR_emission_IR_active}, with the fraction of PAHs having the charge state $Z$, $f(Z)$, obtained from equation~\ref{eq:frac_PAHs}, and sum the product over all the charge states accessible to a PAH molecule in that environment as follows: \begin{equation} I_{\nu_{i}} = \sum_{Z\,=\,-1}^{Z\,=\,N_{\rm max}} f(Z) I_{\nu_{i}}(Z) \end{equation} \subsection{PAH characteristics} \label{subsec:characteristics_PAHs} \begin{figure*} \centering \includegraphics[scale=0.20]{Figures/Structures_PAHs.png} \caption{Molecular structure of acenes (top row) and compact PAHs (bottom row) considered in this work. The structure of each molecule is taken from version 3.20 of the NASA Ames PAH database \citep{Bauschlicher:10, Boersma:14, Bauschlicher:2018, Mattioda:2020}. } \label{fig:structure_PAHs} \end{figure*} In this paper, we study the IR emission from five representative PAHs, namely, tetracene ($\text{C}_{18}\text{H}_{12}$), pentacene ($\text{C}_{22}\text{H}_{14}$), ovalene ($\text{C}_{32}\text{H}_{14}$), circumcoronene ($\text{C}_{54}\text{H}_{18}$), and circumcircumcoronene ($\text{C}_{96}\text{H}_{24}$) covering a large range in size. The tetracene and pentacene molecules belong to the acene family, whereas the ovalene, circumcoronene, and circumcircumcoronene belong to the compact/pericondensed PAH family. Fig.~\ref{fig:structure_PAHs} shows the structure of the PAH molecules studied in this work. We chose compact PAHs in our study due to their potential relevance to the interstellar PAH family. Compact PAHs are highly stable and can withstand harsh conditions in the ISM \citep[][]{Ricca:2012}. Their spectra in the 15-20 $\mu$m range are simple in comparison to those of non-compact PAHs, highlighting their potential as candidates for the interstellar PAH family, which also exhibit relatively constant spectra in this wavelength range \citep{Boersma:2010, Ricca:2012, Andrews:2015}. We include acenes in our study as examples of catacondensed and small PAHs with a large number of solo C-H modes. The strong 11.2 $\mu$m PAH feature is associated with the out-of-plane bending of solo C-H mode and, due to their zig-zag edges, acenes have a large number of solo Hs thereby making them relevant for the 11.2 $\mu$m PAH feature \citep{Hony:2001, Bauschlicher:2008, Candian:2015}. Though not much explored in the context of the ultimate interstellar PAH family, acenes are studied in the context of $\text{H}_{2}$, formation on PAHs owing to their large reactivity \citep[e.g.][]{Campisi:2020}. In this section, we describe the molecular characteristics we adopt to model the IR emission from PAHs. The PAH emission model model takes into account the following molecular characteristics of PAHs: the ionization potential (IP), the ionization yield, the photo-absorption cross-section, the sticking coefficient, and the frequencies and corresponding intensities of the vibrational modes. \begin{table*} \caption{Ionization potential of PAHs in various charge states.} \centering \begin{threeparttable}[t] \begin{tabular}{l c c c c c} \hline \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{IP($Z$) [eV]}\\ & $Z$ = -1 & $Z$ = 0 & $Z$ = 1 & $Z$ = 2 & $Z$ = 3\\ \hline Tetracene ($\text{C}_{18}\text{H}_{12}$) & 1.06 \tnote{1} & 6.96 \tnote{3} & 11.64 \tnote{3} & & \\ Pentacene ($\text{C}_{22}\text{H}_{14}$) & 1.39 \tnote{1} & 6.61 \tnote{3} & 10.79 \tnote{3} & & \\ Ovalene ($\text{C}_{32}\text{H}_{14}$) & 1.17 \tnote{4} & 6.71 \tnote{2} & 9.82 \tnote{4} & & \\ Circumcoronene ($\text{C}_{54}\text{H}_{18}$) & 1.44 \tnote{4} & 6.14 \tnote{4} & 8.81 \tnote{4} & 12.9 \tnote{5} & \\ Circumcircumcoronene ($\text{C}_{96}\text{H}_{24}$) & 3.1 \tnote{5} & 5.7 \tnote{5} & 8.2 \tnote{5} & 10.8 \tnote{5} & 13.4 \tnote{5} \\ \hline \end{tabular} \begin{tablenotes}[para] \item[1] \citet{Mitsui:2007} \item[2] \citet{Clar:1981} \item[3] \citet{Tobita:1994} \item[4] \citet{Malloci:database} \item[5] \citet{Bakes:1994} \end{tablenotes} \end{threeparttable} \label{tab:Ionization_potential} \end{table*} \textbf{Ionization Potential of PAHs:} The number of charge states that are accessible to a PAH molecule depends on their IP. Since, in this work, we calculate the charge distribution of PAHs in the PDR environments where H ionizing photons are absent, the charge state $Z+1$ will be accessible to a PAH molecule if its $\text{IP}(Z)$ is less than 13.6 eV. Table \ref{tab:Ionization_potential} lists the IPs of the PAH molecules considered in this work for charge states with an IP of less than 13.6 eV. We adopt the experimentally measured IP values where available. Where experimental data was unavailable, we adopt the IP values estimated from quantum chemical calculations \citep{Malloci:database} or a conducting disk formula \citep{Bakes:1994}. Recently \citet{Wenzel:2020} modified an empirical relationship given by \citet{Weingartner:2001} to calculate the IP of PAHs. We employ the \citet{Bakes:1994} formalism for circumcoronene $Z=2$ and all the charge states for circumcircumcoronene. For these molecules, we compared the \% difference between the IPs determined using the \citet{Bakes:1994} with the IPs determined using the \citet{Wenzel:2020} formalism. We found that the difference is less than 10\% in all cases (see Appendix~\ref{sec:IPs_comparison}), demonstrating that the two formalisms produce comparable results for the large PAH molecules used in this study. Based on the IPs in Table \ref{tab:Ionization_potential}, the maximum accessible charge state for tetracene, pentacene, and ovalene is $Z = 2$, for circumcoronene $Z = 3$, and for circumcircumcoronene $Z = 4$. \textbf{Ionization yield:} For the PAH molecules considered in this work, the ionization yields have not been measured experimentally with the exception of the singly charged ($Z = 1$) cation of ovalene \citep{Wenzel:2020}. So we employ the semi-empirical relation proposed by \citet{Jochims:1996} to estimate the ionization yields: \begin{equation} Y_{\rm ion}(Z) \approx \begin{cases} 1, & h\nu \geq \text{IP(Z) + 9.2 eV} \\ \frac{h\nu - \text{IP(Z)}}{9.2}, & h\nu < \text{IP(Z) + 9.2 eV} \end{cases} \label{eq:yield} \end{equation} We note that \citet{Jochims:1996} derived this relationship for ionization yields of neutral PAHs only. However, due to the lack of available data and formalisms to calculate ionization yields for higher charge states, we adopt the \citet{Jochims:1996} relationship for higher charge states by choosing the appropriate IPs. It is worth pointing out that \citet{Wenzel:2020} proposed a relationship to estimate ionization yields of singly charged cations of PAHs with sizes N$_{C} > 32$. We compared their ionization yields of singly charged circumcoronene and circumcircumcoronene to the yields adopted in this work and found they agree well (see Appendix~\ref{sec:yieldcomparison}), lending further support for its general use in our analysis. \textbf{Photo-absorption cross-section:} We obtain the data for the photo-absorption cross-sections from the online database of quantum chemically calculated molecular properties of PAH molecules \citep{Malloci:database}\footnote[1]{\url{https://astrochemistry.oa-cagliari.inaf.it/database/pahs.html}}. The database holds absorption cross-sections of all the PAH molecules considered in this work except circumcircumcoronene in the anionic ($Z = -1$), neutral ($Z = 0$), and cationic ($Z = 1, Z = 2$, and $Z = 3$) states. We estimate the photo-absorption cross-sections for circumcircumcoronene in the desired charge state from the photo-absorption cross-sections of circumcoronene in a corresponding charge state by scaling it with the number of carbon atoms of circumcircumcoronene, i.e. multiplying the photo-absorption cross-sections of circumcoronene with a factor of $96$/$54$ = $1.8$. \textbf{Sticking coefficient}: The sticking coefficients, $s_{e}$, approach unity for PAHs with electron affinity $>$ 1 eV. None of the PAHs considered in this work have electron affinity, i.e. IP(-1) below 1 eV, therefore we adopt $s_{e} = 1$ following \citet{Tielens:2005}. \textbf{Frequencies and corresponding intensities of the vibrational modes}: We obtain the frequencies corresponding to the fundamental and the IR active vibrational modes, and the intrinsic intensities corresponding to the IR active vibrational modes from the the NASA Ames PAH IR Spectroscopic database \citep[PAHdb, version 3.20;][]{Bauschlicher:2018, Boersma:14, Bauschlicher:10, Mattioda:2020} except for the tetracene dication and the pentacene anion for which the database has no data. In Appendix~\ref{sec:UID}, we provide the UIDs of the molecules in PAHdb. For the tetracene dication and the pentacene anion, we obtain the relevant data from the \citet{Malloci:database} database. In both the databases, the intrinsic intensities of the IR active vibrational modes are expressed in terms of A-value, $A$ (km/mol). The A-value is related to the laboratory measured absorbance (see equation 6 in \citet{Mattioda:2020}). For the purpose of our calculation, we convert A-value in the units of cross-section integrated over frequency following \citet{Mattioda:2020}; \begin{equation} \sigma_{\nu_{i}} = \frac{10^{5}}{N_{A}}\times c \times A_{i} \label{eq:IR_cross-section} \end{equation} where $N_{A}$ is Avogadro's number i.e. $6.02 \times 10^{23}$. \subsection{Comparison with other PAH emission models} \label{subsec:comparison_PAH_models} The PAH emission has been modelled in the past following various approaches. The emission model presented in this paper is based on the work of \citet{Bakes:01:a} but differs in the following ways. Firstly, the \citet{Bakes:01:a} model does not account for the possibility of ionization when calculating the average energy absorbed by PAHs which is used to calculate the IR emission spectra. In contrast, in the current model, we include the possibility of ionization after photon absorption. Secondly, while \citet{Bakes:01:a} provided a framework to calculate the cooling rate for PAHs which we adopt in this work (see equation~\ref{eq:cooling_rate}), they used a simplified single analytical expression for calculating the cooling rate of different PAHs. Lastly, in this paper, we have adopted more recent calculations of molecular parameters of PAHs (see Section~\ref{subsec:characteristics_PAHs}). It is worth pointing out that \citet{Verstraete:2001} also presented a PAH emission model similar to the one presented in this work and in \citet{Bakes:01:a} but additionally incorporated the effect of the size distribution of PAHs in the calculation of the total PAH spectra in astrophysical environments. These authors adopted IR cross-sections for different PAH sizes by scaling the Einstein-A coefficients of the major PAH bands with their size. Since, in this work, we adopt the experimentally measured or theoretically calculated IR cross-sections of individual PAHs, we calculate the spectra of individual PAH molecules spanning a range from 18 - 96 carbon atoms. Other PAH emission models use a Monte Carlo based approach to model the IR emission from PAHs \citep[e.g.][]{Mulas:1998, Joblin:2002, Malloci:2003, Mulas:2006}. We benchmark our model by comparing our model calculations with the Monte Carlo based model presented in \citet{Mulas:2006}. For the comparison, we calculate the IR emission spectra of neutral coronene in the planetary nebula IRAS~21282+5050 whose photon flux is well represented by the radiation field of $G_{0} = 5 \times 10^{5}$ in the units of Habing field and a blackbody of temperature 40,000 K (see Fig.~\ref{fig:flux_comparison_IRAS_21282}). Subsequently, we compare the flux fraction of each band of neutral coronene for both models. We present the results of the comparison and the molecular parameters of neutral coronene used to model the IR emission in Appendix~\ref{sec:comparison_Mulas}. We find that the flux fraction of the strong bands (which combined carry 88\% of the flux) differs in the two models by at most 20\%. Although there is a discrepancy in the flux fraction of weak features in the 6.69-8.24, 12.5-12.9 $\mu$m range and at 26.5 $\mu$m when compared individually, that is not the case when comparing their combined fluxes. The combined flux of weak features in the 6.69-8.24 $\mu$m and 12.5-12.9 $\mu$m range agrees between the two models within 10\% and 21\%, respectively. The discrepancies in the flux of individual weaker features could either stem from the different molecular characteristics of coronene used in the two models or due to the use of an average energy for the absorbed photon in this model versus the inclusion of the full distribution of absorbed photons in the Monte Carlo model. \section{Results of the model for PAHs under astrophysical conditions} \label{sec:results} We use the PAH emission model to investigate the charge distribution and subsequent IR emission characteristics of the five PAHs described in Section~\ref{subsec:characteristics_PAHs} over a range of relevant astrophysical conditions. Since PAH charge distribution is set by the so-called ionization parameter, $\gamma = G_{0}\times\sqrt{T_{\rm gas}}/n_{e}$, we investigate the model results as a function of $\gamma$. \subsection{Charge distribution} \label{subsec:results_charge_5_molecules} \begin{figure} \centering \includegraphics[scale=0.40]{Figures/ovalene_charge.png} \caption{Charge distribution of ovalene as a function of the ionization parameter $\gamma$, for a fixed value of $G_{0} = 2600$, $T_{\rm gas} = 300$K, and $T_{\rm eff} = 17000$K.} \label{fig:charge_distribution_ovalene_gamma} \end{figure} Adopting a fixed value of $G_{0} = 2600$ in units of the Habing field, $T_{\rm gas} = 300$ K, an electron abundance of 1.6 $\times$ 10$^{-4}$, and $10^{3} < n_{\rm gas} < 10^{6}$ cm$^{-3}$, we obtain $\gamma$ values ranging from $\sim$30--2$\,\times\, 10^{5}$ Habings K$^{1/2}$ cm$^{3}$ for which we calculate the charge distribution of the PAH molecules considered in this work. This range of $\gamma$ values cover well the variety of the physical conditions prevalent in the PDRs (see Table~\ref{tab:physical_conditions_PDRs}). We first use $T_{\rm eff}$ = 17000 K for the blackbody radiation field, which is a required parameter for determining the photo-ionization rate in the charge distribution model (see Section~\ref{subsec:Charge_dist_model}); we will consider other values later. Fig.~\ref{fig:charge_distribution_ovalene_gamma} shows the results of the calculation for ovalene, one of the PAH molecules considered in this work. The results for the remaining PAH molecules are shown in Appendix~\ref{app:chargedist} (see Fig.~\ref{fig:charge_distribution_gamma}). In comparing the results for different PAHs, it should be kept in mind that the charge distribution is controlled by the ionization rate over the recombination rate. This ratio is proportional to the ionization parameter as well as the ratio of the photo-ionization cross section to the electron-PAH interaction cross section. To first order, the former varies as $N_{C}$ while the latter varies with $N_{C}^{1/2}$. The small differences in ionization potential between the different PAHs have only a small effect given the broad energy dependence of the ionizing flux distribution. Of course, with increasing PAH size, more charge states may become accessible for $h\nu <13.6$ eV. We find that with increasing $\gamma$ values, the dominant charge state shifts from anions through neutrals to cations. In the case of ovalene, the anions remain the dominant charge state up to $\gamma \sim$ 4$\times$ 10$^{2}$ after which the neutrals dominate up to $\gamma \sim$ 4$\times$ 10$^{4}$, beyond which the cationic charge states dominate. We note that for other PAH molecules, the general trend remains the same, but as outlined above, the precise distribution of the charge states varies somewhat with N$_{C}$; e.g., as the size of the molecule increases, cations begin to dominate at lower $\gamma$ values. Likewise, the highest $\gamma$ value for which anions dominate decreases with increasing size. While there are differences in the precise values of the fraction of charge for individual PAH molecules, the key result that emerges from the calculations is that the anions are the dominant charge state for $\gamma$ values less than $\sim 2 \times 10^{2}$, the neutrals for $\gamma$ values in the range $\sim 10^{3}$--$10^{4}$, and the cations for $\gamma$ values greater than $\sim 5 \times 10^{5}$. These results are consistent with the charge distribution results from \citet{Bakes:2001}. We note that although the trends observed in the charge distribution of five PAHs considered in this work are similar to \citet{Bakes:01:a}, the absolute value of the fraction of PAHs in a particular charge state at a given $\gamma$ value differs due to the use of more recent experimentally, or quantum chemically determined PAH characteristics. We now investigate how the charge distribution would change if we choose values of $G_{0}$, $T_{\rm gas}$, and $n_{e}$ other than those described above. We find that at a particular $\gamma$ value, we get the same result for the charge distribution regardless of the values of the individual parameters characterizing it. This is expected since the ratio of the photo-ionization rate and the electron-recombination rate that goes in equation~\ref{eq:frac_PAHs} is proportional to $\gamma=G_{0}\times\sqrt{T_{\rm gas}}/n_{e}$. We note that, in contrast to the electron recombination rate, the electron attachment rate (equation~(\ref{eq:electronattachmentrate})) does not depend on $T_{\rm gas}$. In any event, since any $T_{\rm gas}$ dependence scales only with $T_{\rm gas}^{1/2}$ and the relevant range in $T_{\rm gas}$ is rather limited, it has only a small effect on the charge distribution. However, we find that the results of the charge distribution of PAHs are sensitive to the excitation conditions, i.e. the effective temperature, $T_{\rm eff}$, of the radiation field (see Fig.~\ref{fig:charge_distribution_two_temperatures}). While the overall trend remains the same; that at low values of $\gamma$, anions dominate, and at high values of $\gamma$ cations dominate, the precise values of the fraction of each charge at a particular value of $\gamma$ vary with $T_{\rm eff}$. \subsection{PAH spectra} \label{subsec:PAH_spectra_5_molecules} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/spectra_tetracene.png} \caption{Calculated spectra of tetracene (C$_{18}$H$_{12}$) in the anionic, neutral, cationic, and dicationic states at excitation conditions characteristic of NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K).} \label{fig:spectra_tetracene} \end{figure} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/spectra_pentacene.png} \caption{Calculated spectra of pentacene (C$_{22}$H$_{14}$) in the anionic, neutral, cationic, and dicationic states at excitation conditions characteristic of NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K).} \label{fig:spectra_pentacene} \end{figure} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/spectra_ovalene.png} \caption{Calculated spectra of ovalene (C$_{32}$H$_{14}$) in the anionic, neutral, cationic, and dicationic states at excitation conditions characteristic of NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K).} \label{fig:spectra_ovalene} \end{figure} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/spectra_circumcoronene.png} \caption{Calculated spectra of circumcoronene (C$_{54}$H$_{18}$) in the anionic, neutral, cationic, dicationic, and tricationic states at excitation conditions characteristic of NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K).} \label{fig:spectra_circumcoronene} \end{figure} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/spectra_circumcircumcoronene.png} \caption{Calculated spectra of circumcircumcoronene (C$_{96}$H$_{24}$) in the anionic, neutral, cationic, dicationic, and tricationic states at excitation conditions characteristic of NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K).} \label{fig:spectra_circumcircumcoronene} \end{figure} The effect of the charge state on the intrinsic strengths of the vibrational modes of a PAH molecule has been extensively analyzed previously by several authors \citep[see, e.g.][]{Langhoff:1996, Hudgins:1999, Bauschlicher:2000, Bakes:2001, Bakes:01:a}. We present the intrinsic spectra of the molecules considered here in Appendix~\ref{sec:intrinsic_spectra}. We encourage the reader to refer to the studies by, e.g. \citet{Langhoff:1996, Hudgins:1999, Bauschlicher:2000, Bakes:2001, Bakes:01:a} for a detailed discussion on the effects of the charge state on intrinsic spectra. In this section, we discuss the effects of the charge on the spectra of the PAH molecules after we apply the PAH emission model. We emphasize that after applying the emission model, the relative strength of the features will differ from the intrinsic strengths; however, the entire character of a molecular spectrum will not change. Figs.~\ref{fig:spectra_tetracene}-\ref{fig:spectra_circumcircumcoronene} show the spectra of PAHs considered in this work after the application of the emission model. We calculate the spectra in each charge state for the excitation conditions typical of NGC~7023 ($G_{0}$ = 2600 and $T_{\rm eff}$=17000 K) following the procedure outlined in section~\ref{subsec:spec_calc}. The average energies absorbed by the PAH molecule corresponding to the excitation conditions for which we calculate the spectra in each charge state are given in Table~\ref{tab:average_energy}. To allow for multiphoton absorptions in calculating the IR emission from PAHs, we include three-photon absorptions to calculate the spectra presented in Figs.~\ref{fig:spectra_tetracene}-\ref{fig:spectra_circumcircumcoronene} and checked that the $G(T)dT$ function and the calculated spectra have converged at that point. Essentially, we perform three iterations on the temperature distribution function, $G(T)dT$, after which our calculated intensities of each vibrational mode converge. Once we obtain the strength of each IR active mode, we convolve the intensity of each vibrational mode with a Gaussian profile with a full width at half maximum (FWHM) determined by the spectral resolving power of 200. The anionic and cationic charge states exhibit the strongest features in the 6--9 $\mu$m region, characteristic of the C-C stretching and C-H in-plane bending modes for all of the PAH molecules considered here, while the neutral charge states exhibit the strongest features in the 10--15 $\mu$m region characteristic of the C-H out of plane bending modes. While there are differences in the relative intensities of the PAH features in the 6--9 $\mu$m region for cationic and anionic charge states, these differences are not as distinct as those that distinguish neutrals from the other charge states. The intensity of the 3.3 $\mu$m feature, on the other hand, appears to differentiate between different charge states. The 3.3 $\mu$m feature is strongest in neutral charge states and weakest in cationic charge states. The intensity of this feature varies between molecules in the anionic charge states, with tetracene exhibiting a strong 3.3 $\mu$m feature compared to the other molecules. However, for a given PAH molecule, the 3.3 $\mu$m feature is always stronger in anions than in cations. As a result, the relative intensity of the 3.3 $\mu$m and 6--9 $\mu$m features may serve as a distinguishing feature between anionic and cationic charge states. Finally, we note that there are few strong features in the region long wards of 15 $\mu$m, but we could not identify a systematic trend among the features in this region that can distinguish between different charge states. \subsubsection{The 6.2/11.2 band ratio} \label{subsubsec:62_112_ratio_5_molecules} \begin{figure} \centering \includegraphics[scale=0.37]{Figures/ratio_plot.png} \caption{The 6.2/(11.0+11.2) band ratio for the five PAH molecules considered in this work as a function of the ionization parameter $\gamma$. High values of 6.2/(11.0+11.2) on the right end of the curve result from the large fraction of cations at high $\gamma$ values, whereas high 6.2/(11.0+11.2) values on the left end of the curve result from the large fraction of anions at low $\gamma$ values. See text for details of the calculation of the 6.2/(11.0+11.2) band ratio.} \label{fig:ratio_plot} \end{figure} Traditionally, the ratio of the 6.2 and 11.2 $\mu$m PAH features is used as an indicator of the PAH charge state in astrophysical environments where low values imply neutrals as the dominant charge state and high values imply cations as the dominant charge state \citep[e.g.][]{Peeters:2002, Berne:2007, Boersma:2018}. In light of the results presented in Figs.~\ref{fig:spectra_tetracene}-\ref{fig:spectra_circumcircumcoronene} as discussed above, this interpretation may be unreliable for high values of this ratio. To investigate how the similarity between the features of anions and cations in the 6--9 $\mu$m region translate in the interpretation of the 6.2/11.2 band ratio, we analyze this ratio as a function of the ionization parameter $\gamma$. We obtain the spectra of a PAH molecule in all the charge states at the conditions that are typical of NGC~7023. We note that for circumcircumcoronene in charge state $Z=4$, there is no available data on the frequencies and the intensities of the vibrational modes, and therefore, we do not include it in our calculation. However, it does not have a significant impact on the results of the PAH ratio because the contribution from the $Z = 4$ state of circumcircumcoronene for the $\gamma$ values investigated here is negligible (see Fig.~\ref{fig:charge_distribution_gamma}). For the calculation of the 6.2/11.2, we do not convolve the spectra with Gaussian functions. Instead, for each charge state, we extract the intensities corresponding to the C-C modes (6.2 $\mu$m) by adding the intensities of all the modes in the 6.1--6.9 $\mu$m range. We recognize that we use a broad wavelength range to measure the 6.2 $\mu$m band in order to include the strongest C-C stretching mode in the measurement for all the PAH molecules. In this pursuit, we occasionally miss the traditional 6.2 $\mu$m band. Therefore, when comparing these results to the astronomical observations, we analyze trends rather than any spectroscopic detail in the PAH emission from astrophysical environments. For C-H modes (11.0+11.2 $\mu$m), we add the intensities of all the modes in the 10.0--12.0 $\mu$m range. We note that, although the wavelength range used to calculate the intensities of C-H modes theoretically consists of a couple of weak and strong features, only the features at 11.0 and 11.2 $\mu$m bands are observed, with the 11.2 $\mu$m PAH band being the dominant band. Therefore, for the remainder of the paper, we will refer to the intensities of the C-H modes as the 11.0+11.2 $\mu$m band. This will also serve as a reminder to the reader that the weak 11.0 $\mu$m PAH band characteristic of cations is also included in the measurement of the C-H modes. We multiply the extracted intensities of the C-C and C-H modes for a charge state $Z$ of a molecule with its corresponding charge fraction. Finally, we add up the weighted intensities of the C-C and C-H modes for all the charge states of a molecule to obtain the 6.2 and 11.0+11.2 $\mu$m band intensities, respectively. Fig.~\ref{fig:ratio_plot} shows the 6.2/(11.0+11.2) band ratio as a function of $\gamma$ for all the PAH molecules considered in this work. We note that high values of 6.2/(11.0+11.2) can be reached for both low and high values of $\gamma$. We recall from section~\ref{subsec:results_charge_5_molecules} that anions dominate at low values of $\gamma$ and cations at high values of $\gamma$. Therefore, the high values of 6.2/(11.0+11.2) at low values of $\gamma$ result from the contribution of anions to the 6.2 $\mu$m band, thereby illustrating that observed high values of 6.2/(11.0+11.2) do not always necessarily imply a large fraction of cations. For intermediate $\gamma$ values, where neutrals dominate, the curve of 6.2/(11.0+11.2) is relatively flat for all molecules exhibiting almost similar values. In contrast, the 6.2/(11.0+11.2) ratio varies for the different molecules at low and high $\gamma$ values, although there is no systematic trend between the molecules. Finally, we note that compared to compact PAHs, acenes exhibit relatively high 6.2/(11.0+11.2) values at the left end of the curve, where anions dominate. We discuss the implications of this result further in section~\ref{subsec:PAH_emission_PDR_environments} where we compare the results of the PAH emission model with observations of PDRs. \subsubsection{6.2/(11.0+11.2) vs 3.3/(11.0+11.2)} \label{subsubsec:62_112_vs_33_112} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.50]{Figures/ratio_plot_charge_distinction_tetracene.png} & \includegraphics[scale=0.50]{Figures/ratio_plot_charge_distinction_pentacene.png}\\ \includegraphics[scale=0.50]{Figures/ratio_plot_charge_distinction_ovalene.png} & \includegraphics[scale=0.50]{Figures/ratio_plot_charge_distinction_circumcoronene.png} \\ \includegraphics[scale=0.50]{Figures/ratio_plot_charge_distinction_circumcircumcoronene.png}\\ \end{tabular} \caption{Ratios of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) color-coded with $\gamma$ values for the five PAH molecules considered in this work. Except for circumcircumcoronene, there are two values of 3.3/(11.0+11.2) for a given value of 6.2/(11.0+11.2), one originating from low $\gamma$ values and the other from high $\gamma$ values. See text for details of the calculation of the 6.2/(11.0+11.2) and 3.3/(11.0+11.2) band ratios.} \label{fig:distinction_anions_cations} \end{figure*} Given that high values of the 6.2/(11.0+11.2) ratio can arise from both anions and cations, it becomes important to have a tool to distinguish between these two charge states while interpreting astronomical observations. As noted in section~\ref{subsec:PAH_spectra_5_molecules}, the relative intensities of the features in the 3.3 and 6--9 $\mu$m range can be used to distinguish between cations and anions. To investigate this, we analyze plots of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) for the PAH molecules considered here. To calculate the 3.3/(11.0+11.2) ratio, we extract the intensity of the 3.3 $\mu$m feature by adding up intensities of all the modes in the 3.0--4.0 $\mu$m range for each charge state before weighting them with their corresponding charge fraction. We show the resulting plots in fig.~\ref{fig:distinction_anions_cations}. There are essentially two branches for each molecule, with both branches overlapping in the case of circumcircumcoronene. In one branch, the 3.3/(11.0+11.2) values decrease with increasing 6.2/(11.0+11.2) values. This branch corresponds to $\gamma$ values $> 10^{3}$ where neutrals and cations dominate. However, in the second branch, the 3.3/(11.0+11.2) values increase with increasing 6.2/(11.0+11.2) values for the acenes and ovalene, remain almost constant with increasing 6.2/(11.0+11.2) values for circumcoronene, and decreases with increasing 6.2/(11.0+11.2) values for circumcircumcoronene. The second branch originates from $\gamma$ values $< 10^{3}$ where anions dominate. The 3.3/(11.0+11.2) vs 6.2/(11.0+11.2) plots separate cations from anions in acenes, ovalene, and circumcoronene, but not for circumcircumcoronene. We further note that the slope of the second branch originating from anions not only vary with respect to the molecule considered but also with respect to the excitation conditions (see Fig.~\ref{fig:distinction_anions_cations_Orion_bar}). For example, at $G_{0}=26000$ and $T_{\rm eff} = 40000 $K, the 3.3/(11.0+11.2) values in the second branch decrease with increasing 6.2/(11.0+11.2) values for circumcoronene whereas they remain constant for $G_{0}=2600$ and $T_{\rm eff}$ = 17000 K. Therefore, we conclude that the 3.3/(11.0+11.2) vs 6.2/(11.0+11.2) plots can not be used as a diagnostic tool for astronomical purposes. However, the plots presented here show that corresponding to a single value of 6.2/(11.0+11.2), there are two values of 3.3/(11.0+11.2). This result demonstrates the influence of charge state on 3.3/(11.0+11.2) ratio which is traditionally used to determine the PAH size \citep[e.g.][]{Allamandola:1989, Schutte:1993, Ricca:2012, Croiset:2016, Knight:2021}. It also has implications in interpreting the 3.3/(11.0+11.2) - 6.2/(11.0+11.2) diagnostic plots often used in the literature to determine PAH charge and size \citep[e.g.][]{Draine:2001, Maragkoudakis:2018, Maragkoudakis:2020}. We discuss this further in Section~\ref{subsec:grid_plots}. \section{Application of the model to PDRs} \label{sec:application} We apply the PAH emission model to the IR observations of four well-studied PDRs and the diffuse ISM that sample various physical conditions. \subsection{Environments} \label{subsec_environments} In the following sections, we describe the environments and present a relevant discussion on the measurements of physical conditions ($G_{0}$, $n_{\rm gas}$, and $T_{\rm gas}$) in these environments. We emphasize that the measurement of the physical conditions strongly depends on the method adopted to measure these, and as such, there exists a range of values for some of the parameters across the literature. In such cases, we adopt an average value of the parameters over the range present in the literature. To calculate $n_{e}$ from $n_{\rm gas}$, we adopt an electron abundance, $X_{e}$, of $1.6\times10^{-4}$ from \citet{Sofia:2004} assuming that the $X_{e}$ is a result of the ionization of C. Table~\ref{tab:physical_conditions_PDRs} presents the physical conditions we adopt, the $\gamma$ values we derive from these, and the $T_{\rm eff}$ of the radiation field in the environments considered here. For the diffuse ISM, we use the expression provided by \citet{Tielens:2005} for the energy dependence of the radiation field. \begin{table*} \caption{Physical conditions in the environments studied in this work.} \centering \begin{threeparttable}[t] \begin{tabular}{c c c c c c c} \hline PDR environment & $G_{0}$ (Habings field)\tnote{a} & $n_{\rm gas}$ (cm$^{-3}$) \tnote{b} & $T_{\rm gas}$ (K) \tnote{c} & $X_{e}$ \tnote{d} & $T_{\rm eff}$ (K) \tnote{e} & $\gamma$ \\ \hline NGC~7023 & 2600 & $10^{4}$ & 400 & $1.6\times 10^{-4}$ & 17000 & $3.3\times10^{4}$\\ NGC~2023 & 17000 & $2.0 \times 10^{5}$ & 500 & $1.6\times 10^{-4}$ & 23000 & $1.2\times10^{4}$\\ Horsehead Nebula & 100 & $2.0\times 10^{5}$ & 100 & $1.6\times 10^{-4}$ & 33000 & 30\\ Orion Bar & 26000 & $10^{5}$ & 500 & $1.6\times 10^{-4}$ & 40000 & $3.6\times10^{4}$\\ diffuse ISM & 1.7 & 30 & 80 & $1.6\times 10^{-4}$ & & $3.2\times10^{3}$\\ \hline \end{tabular} \begin{tablenotes}[para] \item[a] NGC~7023: \citet{Chokshi:88}; NGC~2023: \citet{Sheffer:11}; Horsehead Nebula: \citet{Abergel:2003}; Orion Bar: \citet{Marconi:1998}; diffuse ISM: \citep{Habing:1968, Draine:1978} \item[b] NGC~7023: \citet{Chokshi:88}, \citet{Joblin:10}, \citet{Kohler:2014}, \citet{Beranrd:2015}, \citet{Joblin:18}; NGC~2023: \citet{Steiman-Cameron:97}, \citet{Sheffer:11}; Horsehead Nebula: \citet{Habart:2005}; Orion Bar: \citet{Parmar:1991}, \citet{Tauber:1994}, \citet{Young_Owl:2000}, \citet{Bernard-Salas:2012}, \citet{Joblin:18}; diffuse ISM: \citep{Wolfire:2003} \item[c] NGC~7023: \citet{Fuente:1999}, \citet{Fleming:2010}; NGC~2023: \citet{Steiman-Cameron:97}, \citet{Sheffer:11}; Horsehead Nebula: \citet{Habart:2011}; Orion Bar: \citet{Allers:2005}; diffuse ISM: \citep{Wolfire:2003} \item[d] \citet{Sofia:2004} \item[e] NGC~7023: \citep{Racine:1968, Witt:1980, van_den:1997}; NGC~2023: \citep{Racine:1968, Mookerjea:09}; Horsehead Nebula: \citep{Edwards:1976, Abergel:2003}; Orion bar: \citep{Kraus:2007} \end{tablenotes} \end{threeparttable} \label{tab:physical_conditions_PDRs} \end{table*} \subsubsection{NGC~7023} \label{subsubsec:NGC_7023} NGC~7023 is a reflection nebula illuminated by HD~200775, a spectroscopic binary \citep[Herbig B3Ve - B5;][]{Racine:1968, Witt:1980, van_den:1997}. It is situated at a distance of 361 $\pm$ 6 pc \citep{gaia16,gaia18b} and is a well-studied reflection nebula due to its high surface brightness and proximity to the Earth. There are three PDRs in NGC~7023 towards the North West (NW), South West (SW), and East of the central star. In this work, we focus on the NW PDR. The structure of NGC~7023 towards the NW PDR is easy to visualize with stratified layers of a cavity carved out by the illuminating star, followed by the almost edge-on PDR at the edges of the cavity. The PDR is made of diffuse gas embedded with filaments of dense gas. In this work, we adopt the values of the physical conditions estimated previously by several authors. We take the estimate of $G_{0}=2600$ in units of Habing Field from \citet{Chokshi:88} who estimated this from the far-infrared (FIR) continuum intensity assuming that the UV radiation from the star is absorbed and reradiated in the IR by the dust. There are several estimates for $n_{\rm gas}$ in the literature. Using observations of O\,I (63 $\mu$m), C\,II (158 $\mu$m), and low J $^{12}$CO and $^{13}$CO lines, \citet{Chokshi:88} estimated $n_{\rm gas}\sim4\times 10^{3}$ cm$^{-3}$ in dense clumps and 500 cm$^{-3}$ outside of the clumps in the NW PDR. \citet{Joblin:10} estimated $n_{\rm gas}\sim7\times 10^{3}$ cm$^{-3}$ from the Herschel measurements of the C\,II (158 $\mu$m) line alone. \citet{Kohler:2014} modelled intermediate- to high-J CO lines in NGC~7023 and estimated $n_{\rm gas}\sim5\times 10^{4} - 5\times 10^{6}$ cm$^{-3}$ from high-J CO lines and $10^{4}-10^{5}$ cm$^{-3}$ from low-J CO lines. \citet{Beranrd:2015} estimated densities of $1.7\times 10^{4} - 1.8\times 10^{5}$ cm$^{-3}$ from the measurements of the O\,I (145 $\mu$m) line. Recently, \citet{Joblin:18} modelled high-J CO lines and estimated $n_{\rm gas}$ of $4\times10^{4}$ cm$^{-3}$ at the edge of the PDR. These estimates of $n_{\rm gas}$ range from values as low as 500 cm$^{-3}$ in the diffuse gas to as high as $10^{6}$ cm$^{-3}$ in the dense filaments. We note that the estimates of $n_{\rm gas}$ strongly depend on the line being used for the estimation that probe regions of different densities within the PDR. Here, we adopt an average value of $\sim 10^{4}$ cm$^{-3}$. For $T_{\rm gas}$, we adopt a value of $\sim$400 K measured using pure H$_{2}$ rotational lines by \citet{Fuente:1999} based on the Infrared Space Observatory (ISO) observations. This value of $T_{\rm gas}$ is in agreement with the calculation of $T_{\rm gas}$ by \citet{Fleming:2010} based on the Spitzer observations. \subsubsection{NGC~2023} \label{subsubsec:NGC_2023} NGC~2023 is a reflection nebula in the Orion constellation illuminated by B1.5V star HD~37903 \citep{Racine:1968, Mookerjea:09}. It is at a distance of 403 $\pm$ 4 pc from the Earth \citep{Kounkel:18}. The illuminating star has carved out a cavity in the molecular gas, the edges of which form the PDR. In this work, we focus on the bright ridge in the PDR known as the South ridge. We adopt the physical conditions in the ridge from \citet{Sheffer:11}. They determined a value of radiation field $\chi = 10^{4}$ in terms of Draine interstellar radiation field, which translates to a $G_{0} = 1.7\times 10^{4}$ in terms of the Habing field and $n_{\rm gas}$ of $2\times 10^{5}$ cm$^{-3}$ using pure rotational $\text{H}_{2}$ emission lines. They also measured excitation temperatures, $T_{\rm ex}$, and found that $T_{\rm ex}$ ranges from 240--700 K. Since transitions between low-J levels of the pure rotational $\text{H}_{2}$ probe $T_{\rm gas}$ owing to their low critical densities, we adopt an average $T_{\rm gas}$ value of $\sim 500$ K. These estimates for the physical conditions are consistent with the estimates obtained using measurements of [\textrm{O~{\textsc{i}}}] (63, 145 $\mu$m), [\textrm{C~{\textsc{ii}}}] (158 $\mu$m), [\textrm{Si~{\textsc{ii}}}] (35 $\mu$m) and CO lines \citep{Steiman-Cameron:97}. \subsubsection{Horsehead Nebula} \label{subsubsec:Horsehead} The Horsehead nebula is a dark nebula situated due west of NGC~2023 in the Orion constellation. The Horsehead nebula lies at the edge of the L1630 molecular cloud and is illuminated by the O9.5V binary system $\sigma$ Orionis star \citep{Edwards:1976, Abergel:2003}. The illuminating star and the horsehead nebula are almost in the same plane perpendicular to our line of sight, presenting an almost edge-on view of the PDR. It is also a prototypical example of a low illumination PDR. In this work, we focus on the narrow filament at the edge of the PDR. We adopt a $G_{0}$ of 100 Habings field from \citet{Abergel:2003}. These authors estimated $G_{0}$ based on dilution assuming a distance of $\sim$ 3.5 pc between $\sigma$ Orionis and the PDR. We take $n_{\rm gas}=2\times 10^{5}$ cm$^{-3}$ estimated from the H$_{2}$ 1-0 S(1) line, low-J CO lines, and dust continuum emission by \citet{Habart:2005}. \citet{Habart:2011} estimated rotational temperatures for low-J pure rotational lines of H$_{2}$ ranging from 250 -- 400 K. However, a quick look at the model parameters in the PhotoDissociation Region Toolbox, an online toolbox to estimate physical conditions from observations \citep{Kaufman:2006, Pound:2008}, shows that at $G_{0}$ = 100 and $n_{\rm gas}$ = $2\times 10^{5}$, the $T_{\rm gas}$ is $\sim 100$ K. Therefore, in this work, we adopt a $T_{\rm gas}$ of 100 K. \subsubsection{Orion Bar} \label{subsubsec:Orion_bar} The Orion Bar is a PDR situated in the Orion nebula at a distance of 414 $\pm$ 7 pc \citep{men07}. It is illuminated by four stars of type O-B in the trapezium cluster with $\theta^{1}$ Orionis C being the most massive and luminous star \citep{Kraus:2007}. It is one of the brightest and the most studied PDR. The Orion Bar lies at the edge of the \textrm{H~{\textsc{ii}}} region created by the star. For this work, we adopt a $G_{0}$ of $2.6 \times 10^{4}$ Habings field determined by \citet{Marconi:1998} using near-IR observations of an O\,I fluorescent line. The generally accepted picture of the Orion Bar entails dense clumps of density $10^{6}$ cm$^{-3}$ embedded in diffuse gas of density $5\times10^{4}$ cm$^{-3}$. These estimates for the density have been derived consistently by several authors using H$_{2}$, CO, HCN, and HCO$^{+}$ observations \citep{Parmar:1991, Tauber:1994, Young_Owl:2000, Bernard-Salas:2012}. \citet{Joblin:18} derived a gas density of $10^{5}$ cm$^{-3}$ at the PDR front by modelling the high-J CO lines and attributed the origin of this emission to small, high thermal pressure structures within the PDR rather than the interclump material. In this work, we adopt an average $n_{\rm gas}$ of $10^{5}$ cm$^{-3}$. For $T_{\rm gas}$, we use the value of 500 K estimated from pure rotational H$_{2}$ lines by \citet{Allers:2005}. \subsubsection{Diffuse ISM} \label{subsubsec:diffuse_ISM} In this work, we adopt the physical conditions characteristic of the Cold Neutral Medium. For $G_{0}$, we take a value of 1.7 in the units of Habing field \citep{Habing:1968, Draine:1978}. For $n_{\rm gas}$ and $T_{\rm gas}$, we take the values estimated by \citet{Wolfire:2003}. These authors estimated average $n_{\rm gas}$ and $T_{\rm gas}$ from detailed modelling of the gas heating rate and the gas-phase abundances of interstellar gas and found average $n_{\rm gas}$ of $\sim$ 30cm$^{-3}$, and $T_{\rm gas}$ of $\sim$ 80 K. \subsection{Charge distribution in PDR environments} \label{subsec:charge_distribution_PDRs} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.40]{Figures/charge_distribution_NGC_7023.png} & \includegraphics[scale=0.40]{Figures/charge_distribution_NGC_2023.png}\\ \includegraphics[scale=0.40]{Figures/charge_distribution_Horsehead.png} & \includegraphics[scale=0.40]{Figures/charge_distribution_Orion_bar.png} \\ \includegraphics[scale=0.40]{Figures/charge_distribution_diffuse_ISM.png} & \\ \end{tabular} \caption{Charge distribution of the five PAHs considered in this work in NGC~7023, NGC~2023, the Horsehead nebula, the Orion Bar, and the diffuse ISM.} \label{fig:charge_PDRs} \end{figure*} In Fig.~\ref{fig:charge_PDRs} we show the charge distribution predicted for the five PAH molecules, C$_{18}$H$_{12}$, C$_{22}$H$_{14}$, C$_{32}$H$_{14}$, C$_{54}$H$_{18}$, and C$_{96}$H$_{24}$, by the charge distribution model (see Section~\ref{subsec:Charge_dist_model}) in NGC~7023, NGC~2023, the Horsehead nebula, the Orion Bar, and the diffuse ISM. Here, we briefly summarize the model predictions for each of the environment. In NGC~7023, neutrals emerge as the dominant charge state for the small-sized PAHs (e.g., C$_{18}$H$_{12}$, C$_{22}$H$_{14}$, C$_{32}$H$_{14}$) and cations for the large-sized PAHs (e.g., C$_{96}$H$_{24}$). For the intermediate-sized PAHs (e.g., C$_{54}$H$_{18}$), both neutrals and cations have similar charge fractions of roughly 50\%. In NGC~2023, the neutrals emerge as the dominant charge state for all the PAHs considered here, though the fraction of neutrals decreases as the size of the PAH molecule increases. The Horsehead nebula presents an interesting case where the dominant charge state is anions for all the PAHs with a minimal decrease in the fraction of anions with increasing size of the PAH molecule. In the Orion Bar, the dominant charge state is cations with singly charged cations as the dominant charge state in small and intermediate-sized PAHs and singly and doubly charged cations as the dominant charge states in large-sized PAHs. Finally, in the diffuse ISM, neutrals are the dominant charge state for small sized PAHs and cations for the large sized PAHs. The charge distribution of PAHs in NGC~7023 has previously been modelled by \citet{Montillaud:2013} and \citet{Andrews:2016}. Our results are comparable with \citet{Andrews:2016} who also predicted a significant fraction of PAH cations in the NGC~7023 PDR. On the contrary, \citet{Montillaud:2013} predicts a higher fraction of PAH neutrals than the fraction of cations at the PDR front. This stark difference in the calculated charge fractions arises from the differences in the adopted values of the recombination rate coefficients, gas temperature, and electron density in the two studies. \citet{Montillaud:2013} used a recombination rate that was $\sim$50\% higher than the one adopted in the current work, resulting in a higher fraction of PAH neutrals than cations. \subsection{Validating the model} \label{subsec:PAH_emission_PDR_environments} \begin{table} \caption{Average energy absorbed by each charge state of PAH molecules considered in this work in NGC~7023, NGC~2023, the Horsehead nebula, the Orion Bar, and the diffuse ISM.} \centering \begin{tabular}{l c c c c c} \hline \multicolumn{6}{c}{\textbf{ NGC~7023}}\\ \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{$E_{\rm avg}$(Z) [eV]}\\ & Z = -1 & Z = 0 & Z = 1 & Z = 2 & Z = 3 \\ \hline Tetracene & 4.30 & 5.27 & 5.17 & 4.73 & \\ Pentacene & 4.07 & 4.89 & 4.81 & 4.44 & \\ Ovalene & 4.70 & 5.36 & 5.49 & 5.35 & \\ Circumcoronene & 4.51 & 5.05 & 5.15 & 5.15 & 5.16 \\ Circumcircumcoronene & 4.68 & 5.01 & 5.12 & 5.12 & 5.16 \\ \hline \multicolumn{6}{c}{\textbf{NGC~2023}}\\ \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{$E_{\rm avg}$(Z) [eV]}\\ & Z = -1 & Z = 0 & Z = 1 & Z = 2 & Z = 3 \\ \hline Tetracene & 4.66 & 6.03 & 6.32 & 5.91 & \\ Pentacene & 4.45 & 5.66 & 5.95 & 5.70 & \\ Ovalene & 5.04 & 6.00 & 6.36 & 6.34 & \\ Circumcoronene & 4.85 & 5.61 & 5.91 & 6.09 & 6.09 \\ Circumcircumcoronene & 5.10 & 5.55 & 5.85 & 5.98 & 6.09 \\ \hline \multicolumn{6}{c}{\textbf{Horsehead nebula}}\\ \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{$E_{\rm avg}$(Z) [eV]}\\ & Z = -1 & Z = 0 & Z = 1 & Z = 2 & Z = 3 \\ \hline Tetracene & 5.02 & 6.97 & 7.70 & 7.44 & \\ Pentacene & 4.84 & 6.64 & 7.37 & 7.35 & \\ Ovalene & 5.32 & 6.78 & 7.40 & 7.59 & \\ Circumcoronene & 5.14 & 6.32 & 6.88 & 7.30 & 7.31 \\ Circumcircumcoronene & 5.51 & 6.20 & 6.76 & 7.10 & 7.31 \\ \hline \multicolumn{6}{c}{\textbf{Orion Bar}}\\ \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{$E_{\rm avg}$(Z) [eV]}\\ & Z = -1 & Z = 0 & Z = 1 & Z = 2 & Z = 3 \\ \hline Tetracene & 5.16 & 7.39 & 8.29 & 8.11 & \\ Pentacene & 5.01 & 7.09 & 7.99 & 8.07 & \\ Ovalene & 5.43 & 7.15 & 7.88 & 8.16 & \\ Circumcoronene & 5.25 & 6.06 & 7.34 & 7.87 & 7.88 \\ Circumcircumcoronene & 5.69 & 6.53 & 7.21 & 7.63 & 7.88 \\ \hline \multicolumn{6}{c}{\textbf{diffuse ISM}}\\ \multirow{2}{*}{Molecule} & \multicolumn{5}{c}{$E_{\rm avg}$(Z) [eV]}\\ & Z = -1 & Z = 0 & Z = 1 & Z = 2 & Z = 3 \\ \hline Tetracene & 5.07 & 6.60 & 6.98 & 6.63 & \\ Pentacene & 4.90 & 6.30 & 6.71 & 6.50 & \\ Ovalene & 5.36 & 6.44 & 6.84 & 6.80 & \\ Circumcoronene & 5.19 & 6.05 & 6.40 & 6.57 & 6.57 \\ Circumcircumcoronene & 5.51 & 5.97 & 6.33 & 6.47 & 6.57 \\ \hline \end{tabular} \label{tab:average_energy} \end{table} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.40]{Figures/ratio_plot_NGC_7023.png} & \includegraphics[scale=0.40]{Figures/ratio_plot_NGC_2023.png}\\ \includegraphics[scale=0.40]{Figures/ratio_plot_Horsehead.png} & \includegraphics[scale=0.40]{Figures/ratio_plot_Orion_bar.png} \\ \includegraphics[scale=0.40]{Figures/ratio_plot_diffuse_ISM.png} & \\ \end{tabular} \caption{The 6.2/(11.0+11.2) band ratio as a function of the ionization parameter $\gamma$. Individual panels correspond to the 6.2/(11.0+11.2) ratio determined from the PAH spectra calculated at excitation conditions characteristic for NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K), NGC~2023 ($G_{0}=17000$ and $T_{\rm eff}=23000$K), the Horsehead nebula ($G_{0}=100$ and $T_{\rm eff}=33000$K), the Orion Bar ($G_{0}=26000$ and $T_{\rm eff}=40000$K), and the diffuse ISM. See text for details about the method of calculation of the 6.2/(11.0+11.2) band ratio. The observational data points are also shown in the corresponding panels (black square). The dashed line shows the adopted $\gamma$ value for the environments considered here.} \label{fig:ratio_62_112_PDRs} \end{figure*} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.40]{Figures/ratio_plot_33_62_NGC_7023.png} & \includegraphics[scale=0.40]{Figures/ratio_plot_33_62_NGC_2023.png}\\ \includegraphics[scale=0.40]{Figures/ratio_plot_33_62_Orion_bar.png} & \includegraphics[scale=0.40]{Figures/ratio_plot_33_62_diffuse_ISM.png}\\ \end{tabular} \caption{The 3.3/6.2 band ratio as a function of the ionization parameter $\gamma$. Individual panels correspond to the 3.3/6.2 ratio determined from the PAH spectra calculated at excitation conditions characteristic for NGC~7023 ($G_{0}=2600$ and $T_{\rm eff}=17000$K), NGC~2023 ($G_{0}=17000$ and $T_{\rm eff}=23000$K), the Orion Bar ($G_{0}=26000$ and $T_{\rm eff}=40000$K), and the diffuse ISM. See text for details about the method of calculation of the 3.3/6.2 band ratio. The observational data points are also shown in the corresponding panels (black square). The dashed line shows the adopted $\gamma$ value for the environments considered here.} \label{fig:ratio_33_62_PDRs} \end{figure*} In order to test the PAH emission model, we compare the relative intensities of the PAH features, in particular the 6.2/(11.0+11.2) and 3.3/6.2 band ratios, predicted by the model with the observations of the PDRs and the diffuse ISM. In the PDRs, we take the Spitzer Infrared Spectrograph (IRS) Short Low (SL) observations for the 6.2/(11.0+11.2) band ratio, and ISO - Short Wavelength Spectrometer (SWS) observations for the 3.3/6.2 band ratio. For the 6.2/(11.0+11.2) band ratios, we take the flux measurements at the NW PDR of NGC~7023 from \citet{Stock:16}, at the South ridge in NGC~2023 from \citet{Peeters:2017}, at the Horsehead PDR from the Spitzer archive (published previously by \citet{Ochsendorf:2015}), and the Orion Bar from \citet{Knight:2021:a}. For the 3.3/6.2 band ratio, we take the flux measurements in all the environments from \citet{Peeters:2002, van:2004}. We note that the ISO-SWS apertures are larger than the Spitzer IRS SL apertures and are not centered on the same positions, therefore the observations of 6.2/(11.0+11.2) and 3.3/6.2 are not necessarily at the same location. Moreover, because of the lack of the ISO-SWS observations in the Horsehead nebula, we do not calculate the 3.3/6.2 band ratios from the model for the excitation conditions corresponding to the Horesehead nebula. In the diffuse ISM, we take the observations for the 6.2/(11.0+11.2) and 3.3/6.2 from AROME observations from \citet{Giard:1994} and ISO camera (ISOCAM) from \citet{Flagey:2006}. To determine the 6.2/(11.0+11.2) and 3.3/6.2 band ratios from the model, we compute the spectra for each charge state of a PAH molecule at the average energy set by $T_{\rm eff}$ and the PAH characteristics (see equation~\ref{eq:avg_energy}). In Table~\ref{tab:average_energy}, we present the average energy absorbed by a specific PAH molecule in each charge state in the environments considered here. To validate our calculation of $E_{avg}(Z)$, we compare our calculated values for pentacene and ovalene with the values presented in Table~3 of \citet{Mulas:2006} (see Appendix~\ref{sec:validating_abs_energy_calc} for details) and conclude that the $E_{avg}(Z)$ values agree to better than 1\%. Except for the diffuse ISM, where a single photon absorption suffices, we used three photon absorptions to calculate the spectra. From the calculated spectra, we first determine the strengths of the 3.3, 6.2, and 11.0+11.2 $\mu$m bands in each charge state of a molecule following the procedure described in section~\ref{subsec:PAH_spectra_5_molecules} and weight the strengths with the fraction of charge states before adding the band strengths in all the charge states to determine the 3.3, 6.2, and 11.0+11.2 $\mu$m bands for a PAH molecule. Since the charge distribution is a sensitive function of $\gamma$, whose value for the PDRs is not strictly constrained (see discussion in section~\ref{subsec_environments}), we calculate the 3.3/6.2 and 6.2/(11.0+11.2) values as a function of $\gamma$. Fig.~\ref{fig:ratio_62_112_PDRs} shows the predicted values of the 6.2/(11.0+11.2) as a function of $\gamma$ for the excitation conditions characteristic for NGC~2023, NGC~7023, the Horsehead nebula, the Orion Bar and the diffuse ISM. The corresponding observed values of the 6.2/(11.0+11.2) band ratio are also shown in the figure. For NGC~7023 and NGC~2023, the predicted value of 6.2/(11.0+11.2) ratio for C$_{96}$H$_{24}$ compares well with the observational value, for the Horsehead nebula, the predicted value for C$_{22}$H$_{14}$ compares well the observational value. For the Orion Bar and the diffuse ISM, the predicted value for C$_{32}$H$_{14}$ compares well with the observational value. We emphasize that since the $\gamma$ of these sources is not strictly constrained, the observational data point can shift in the 6.2/(11.0+11.2) vs $\gamma$ plane and, as a consequence, the size of the molecule for which there will be a good match between the model prediction and the observation may change. The 6.2/(11.0+11.2) vs $\gamma$ plots shown here do not predict the size of the PAH molecule but rather shows that the PAH emission model based on the charge distribution can explain the observed PAH emission. Moreover, it shows that compact PAHs, which are considered potential candidates for grandPAHs - a set of few stable PAHs comprising the astronomical PAH population \citep{Andrews:2015} - can effectively produce the observed 6.2/(11.0+11.2) ratios in NGC~7023, NGC~2023, the Orion Bar, and the diffuse ISM. In contrast, in the Horsehead nebula, an acene shows a good comparison with the observed value. Thus, while the grandPAH hypothesis remains plausible in high illumination PDRs like NGC~7023, NGC~2023, and the Orion Bar, it is not the case in low illumination PDRs like the Horsehead nebula. We emphasize that a good match between the predicted 6.2/(11.0+11.2) for C$_{22}$H$_{14}$ and the observed value in the Horsehead nebula does not necessarily mean that acenes are present in the PDR environment of Horsehead nebula. It merely shows that either C$_{22}$H$_{14}$ or a molecule behaving like C$_{22}$H$_{14}$ (e.g., molecules with a high ratio for the intrinsic strength of the 6.2/(11.0+11.2) bands in anions) is responsible for the observed emission in the Horsehead nebula. Finally, we reiterate that a high value of 6.2/(11.0+11.2) does not always indicate the presence of a large fraction of cations in the astronomical environment. As shown in Fig.~\ref{fig:ratio_62_112_PDRs}, while the high 6.2/(11.0+11.2) ratio in the Orion Bar is a result of the large fraction of cations, the high 6.2/(11.0+11.2) ratio in the Horsehead nebula is a result of the large fraction of anions. Fig.~\ref{fig:ratio_33_62_PDRs} shows the plots of predicted and observed values of 3.3/6.2 as a function of $\gamma$ for NGC~7023, NGC~2023, the Orion Bar, and the diffuse ISM. The observed values of NGC~7023 compare well with predicted values for the compact PAHs C$_{54}$H$_{18}$ and C$_{96}$H$_{24}$. For the NGC~2023, the observed value shows a good match with C$_{96}$H$_{24}$, for the Orion bar and the diffuse ISM, it matches with C$_{54}$H$_{18}$. These results demonstrate that the PAH emission model based on the charge distribution presented here can effectively explain the observed PAH emission. However, as discussed above, a good match between the observed value and model prediction does not predict the precise size of the molecule as the observed value can shift in the plane of the 3.3/6.2 vs $\gamma$ due to uncertainty in $\gamma$ in the PDRs and the uncertainty in the electron recombination and attachment cross-sections (c.f., section~\ref{subsec:Caveat}). \subsection{Revisiting the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) as a diagnostic tool} \label{subsec:grid_plots} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.44]{Figures/diagnostic_tool_entire_range_compact_PAHs_17000.png} & \includegraphics[scale=0.44]{Figures/diagnostic_tool_entire_range_compact_PAHs_23000.png} \\ \includegraphics[scale=0.44]{Figures/diagnostic_tool_entire_range_compact_PAHs_40000.png} & \includegraphics[scale=0.44]{Figures/diagnostic_tool_entire_range_compact_PAHs_diffuse_ISM.png} \\ \end{tabular} \caption{The 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) plots of compact PAHs considered in this work over $\gamma$ values ranging from 30 - 2$\times 10^{5}$. The points of constant $\gamma$ values for each PAH molecule are joined together. In each panel, the high $\gamma$ values are at the right end of the plot and decrease towards the left. Each panel corresponds to the ratios determined from the PAH spectra calculated for different excitation conditions. $T_{\rm eff}=17000$K corresponds to conditions characteristic of NGC~7023, $T_{\rm eff}=23000$K to NGC~2023, and $T_{\rm eff}=40000$K to the Orion bar. The corresponding observational data point is also shown in each panel. } \label{fig:diagnostc_tool_entire_gamma_range} \end{figure*} \begin{figure*} \centering \begin{tabular}{cc} \includegraphics[scale=0.44]{Figures/diagnostic_tool_half_range_compact_NGC_7023.png} & \includegraphics[scale=0.44]{Figures/diagnostic_tool_half_range_compact_NGC_2023.png} \\ \includegraphics[scale=0.44]{Figures/diagnostic_tool_half_range_compact_Orion_bar.png} & \includegraphics[scale=0.44]{Figures/diagnostic_tool_half_range_compact_diffuse_ISM.png} \\ \end{tabular} \caption{A section of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) plots shown in Fig.~\ref{fig:diagnostc_tool_entire_gamma_range} demonstrating that the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) can be used as a tool to determine the precise $\gamma$ value and PAH size in astrophysical environments if we have a rough estimation of the range of $\gamma$ values. } \label{fig:diagnostc_tool_half_gamma_range} \end{figure*} The 6.2/11.2 and 3.3/11.2 band ratios are often employed to determine the charge and the size of the emitting PAH population in astrophysical environments \citep[e.g.][]{Draine:2001, Croiset:2016, Boersma:16, Maragkoudakis:2020, Knight:2021}. Furthermore, the 6.2/11.2 band ratio has been related to the ionization parameter $\gamma$ \citep[e.g.][]{Galliano:2008, Fleming:2010, Boersma:16, Stock:16}. However, the results of the PAH emission model show that the interpretation of the 6.2/(11.0+11.2) ratio is ambiguous in the low and high regimes of $\gamma$. Moreover, we find that for a PAH molecule, two values for the 3.3/(11.0+11.2) may correspond to one 6.2/(11.0+11.2) value (section~\ref{subsubsec:62_112_vs_33_112}); one for high $\gamma$ values and the other for low $\gamma$ values. This adds a layer of complexity to the interpretation of PAH size from observations of the 3.3/11.2 ratio in astronomical environments. Given these results, we revisit the diagnostic potential of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) ratios and investigate whether these are reliable indicators of $\gamma$ and the average size of the astronomical PAH population. We analyze the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) plots for the excitation conditions typical of NGC~7023, NGC~2023, the Orion bar, and the diffuse ISM (see Fig.~\ref{fig:diagnostc_tool_entire_gamma_range}). Essentially we plot the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) curves for compact PAHs in the same plane and join the curves for different PAH molecules corresponding to the same $\gamma$ values forming a grid. We note that the grid corresponding to each excitation temperature overlaps for a certain range of $\gamma$ values. We emphasize that this overlapping results from the fact that two values of 3.3/(11.0+11.2) corresponds to a single value of 6.2/(11.0+11.2). To understand the diagnostic potential of 6.2/(11.0+11.2) vs 3.3/(11.0+11.2), we investigate Fig.~\ref{fig:diagnostc_tool_entire_gamma_range} by considering two scenarios. In one scenario, we assume no prior knowledge of the $\gamma$ value of the astrophysical region, whereas, in the other scenario, we assume a rough estimate for the range of $\gamma$. In the first scenario, where we have no idea about the $\gamma$ value, it becomes unfeasible to use these plots as indicators of $\gamma$. For NGC~7023 and NGC~2023, the observed data point is in the region of the grid where there is no overlap, implying a unique solution for $\gamma$ and PAH size. In contrast, for the Orion bar and the diffuse ISM, the observed data point is in the overlapping region of the grid, implying a unique solution for PAH size but not for $\gamma$. As a result, in the first scenario, the 3.3/(11.0+11.2) ratio can be used to predict PAH size, but the 6.2/(11.0+11.2) ratio cannot be used to predict $\gamma$. However, in the second scenario, where we assume prior knowledge about the range of $\gamma$ values in an astrophysical environment, these diagnostic plots have enormous potential because now we are essentially sampling only a portion of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) grid, avoiding the grid-overlap problem (see Fig.~\ref{fig:diagnostc_tool_half_gamma_range}). For example, assuming that the $\gamma$ values for NGC~7023, NGC~2023, and the Orion bar range from $10^{3}$--$10^{5}$, we show the part of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) plot from Fig.~\ref{fig:diagnostc_tool_entire_gamma_range} corresponding to this range in Fig.~\ref{fig:diagnostc_tool_half_gamma_range}. From Fig.~\ref{fig:diagnostc_tool_half_gamma_range} we can now infer that in NGC~7023 the size of the emitting PAH population is $\sim$ 50 N$_{C}$, and the $\gamma$ value is $\sim$7$\times 10^{4}$, in NGC~2023, size is $\sim$ 70 N$_{C}$ and $\gamma$ is $\sim 3 \times 10^{4}$, in the Orion Bar, the size is $\sim$ 80 N$_{C}$ and $\gamma$ is $\sim 1.5 \times 10^{4}$, and in the diffuse ISM, the size is $\sim$ 70 N$_{C}$ and $\gamma$ is $\sim 2 \times 10^{3}$. We note that the inferred $\gamma$ values differ from the ones we adopt in this work (see Table~\ref{tab:physical_conditions_PDRs}) by about a factor of 2. This difference could be due to uncertainty in the $\gamma$ values we adopt (see section~\ref{subsec_environments}) or due to uncertainty in the electron recombination rates that we discuss in section~\ref{subsec:Caveat}. The key point of this discussion, however, is not to infer the precise values of PAH size and $\gamma$ values but to illustrate that the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) grids are only useful if we know an approximate range of $\gamma$ values for the astrophysical environment considered. If we have no prior knowledge of $\gamma$, only the 3.3/(11.0+11.2) can be used to predict the PAH size but the 6.2/(11.0+11.2) cannot predict the $\gamma$ values. \subsection{Caveat in the model} \label{subsec:Caveat} In this section, we highlight some of the caveats in the PAH model presented in this paper. Firstly, we acknowledge that the charge distribution based PAH emission model is not a complete model as it does not account for other changes in the molecular properties of PAHs, such as changes in the size distribution, hydrogenation, or molecular structure. While changes in the PAH charge state are the primary drivers of observed PAH variation \citep[e.g.][]{Joblin:1996, Galliano:2008, Rosenberg:11, Sidhu:2021}, a complete PAH emission model must also account for other changes in the molecular properties of PAHs in order to simulate the astronomical PAH observations fully. Secondly, to model the PAH emission, we have approximated the radiation fields of the astrophysical environments using black bodies with effective temperatures corresponding to the illuminating star in those environments. Such an approximation results in an uncertainty in the calculated photo-ionization rate and the average energy absorbed by a PAH molecule for which we calculate the IR emission spectrum. As excitation occurs through a broad range of energies, any changes introduced by this will be small and we elected to neglect this but a full model could account for this. Thirdly, due to uncertainty in the measurements of the physical conditions in astrophysical environments, there is an uncertainty in the $\gamma$ values that we adopt in this work which then influences the comparison of the predicted values of the 6.2/(11.0+11.2) and 3.3/6.2 with the observed values (see section~\ref{subsec:PAH_emission_PDR_environments}). Lastly, we calculate the band ratios using a model based on the PAH charge distribution, which is determined by the ratio of the photo-ionization and electron recombination/attachment rates. In our model, we use analytical relations involving PAH characteristics to calculate these rates. While the photo-ionization rate calculation involves PAH characteristics, the ionization yield, and absorption cross-sections that have been measured experimentally or calculated theoretically for astrophysically relevant PAHs, the electron recombination and attachment rates calculations involve no such experimentally measured PAH characteristics (see section~\ref{subsec:Charge_dist_model}). This lack of laboratory data on electron recombination and attachment rates results in uncertainty in the charge distribution calculations, which then propagates into calculations of PAH band ratios. Therefore, laboratory experiments to determine electron recombination and attachment rates of astrophysically relevant PAHs are highly desirable. \section{Conclusions} \label{sec:summary} We present a PAH emission model that calculates the IR emission from PAHs in PDRs taking into account the PAH charge distribution. Following \citet{Bakes:01:a}, the model first calculates the charge distribution of PAHs in the PDRs based on the physical conditions, $G_{0}$, $n_{\rm gas}$, $T_{\rm gas}$, $X_{e}$. The model then computes the IR emission from a specific PAH molecule by adding the emissions from all relevant charge states and weighing them according to their charge distribution. We model the IR emission from five different PAH molecules, tetracene ($\text{C}_{18}\text{H}_{12}$), pentacene ($\text{C}_{22}\text{H}_{14}$), ovalene ($\text{C}_{32}\text{H}_{14}$), circumcoronene ($\text{C}_{54}\text{H}_{18}$), and circumcircumcoronene ($\text{C}_{96}\text{H}_{24}$), adopting their recent experimentally measured or quantum chemically calculated data on PAH characteristics. The selected PAHs span a wide range in physical and chemical properties and are therefore a suitable set of species for the analysis of observations. We show that anions are the dominant charge state for $\gamma < 2 \times 10^{2}$, neutrals for $10^{3} < \gamma < 10^{4}$, and cations for $\gamma > 5 \times 10^{5}$. Based on the analysis of the PAH spectra of the molecules considered in this work in all the charge states, we show that anionic and cationic charge states exhibit similar spectral characteristics with strong features in the 6--9 $\mu$m region and weak features in the 10--15 $\mu$m region. We investigated the implications of this similarity between cationic and anionic charge states on the 6.2/(11.0+11.2) band ratio and discovered that the large contribution from either anions and cations can result in high values of the 6.2/(11.0+11.2) band ratio. We further found that the charge state of PAHs also influences the 3.3/(11.0+11.2) band ratio beyond the well-known dependence on the PAH size. We also model the PAH emission in five astrophysical environments (NGC~7023, NGC~2023, the Horsehead nebula, the Orion Bar, and the diffuse ISM) for the five PAH molecules considered and show that changes in the charge distribution can account for the observed variations in the IR emission in these environments. We further find that anions, which have previously been overlooked, are the dominant charge carriers in low illumination PDRs such as the Horsehead nebula. In light of the similarity between the spectral characteristics of cations and anions, we revisited the diagnostic potential of the 6.2/(11.0+11.2) vs 3.3/(11.0+11.2) plots to determine the $\gamma$ of astrophysical environments and PAH size, respectively. We find that even in the absence of prior knowledge about an approximate value of $\gamma$, the 3.3/(11.0+11.2) can be used to infer PAH size, but the 6.2/(11.0+11.2) cannot be used to infer $\gamma$. Comparing the model predictions of PAH emission with observations highlights the need for more experiments to determine the electron recombination and attachment cross-sections of astrophysically relevant PAHs as the lack of this experimental data results in an uncertainty in the charge distribution calculation which then propagates into PAH emission calculation. \section*{Acknowledgements} The authors thank the referee for providing valuable comments which led to the improvement of this paper. AS acknowledges support from the Mitacs Globalink Research Award. EP and JC acknowledge support from an NSERC Discovery Grant. \section*{Data Availability} The data underlying this article will be shared on reasonable request to the corresponding author. \bibliographystyle{apj}
\section{Introduction}\label{Sec_Intro} Wireless caching~\cite{Bastug2014} is a candidate method to alleviate the unprecedented data congestion and traffic escalation issues in cellular networks. To determine a cache policy, the two phases of cache placement and cache delivery have to be defined~\cite{Liu2016}, and both should be optimized to achieve a viable cache strategy. Content placement can be performed using a probabilistic \cite{Blaszczyszyn2015,Wu2017,Cheng2019}, or a deterministic approach \cite{Liu2016,Zhao2018,Zhou_2018}, where the probabilistic one can be applied to large networks in a scalable manner. In \cite{Blaszczyszyn2015}, probabilistic content placement was proposed by which the cache-equipped nodes independently and randomly store files based on a probability distribution. In \cite{Cheng2019}, a two-tier Heterogeneous Network (HetNet) was considered with a hybrid cache placement strategy, combining deterministic caching in one tier and probabilistic caching in the other. For the content delivery, multipoint multicast (MPMC), single-point multicast (SPMC), and single-point unicast (SPUC) transmission schemes should be distinguished. MPMC utilizes multiple serving nodes to cooperatively broadcast files through the whole network, whereas the SPUC exploits on-demand transmissions to individually satisfy requesting User Equipments (UEs). For the SPMC scheme, each caching Base Station (BS) multicasts a file to several requesting UEs. SPUC has been considered in \cite{Wu2017,Zhao2018,Wu2020} as an on-demand cache delivery scheme for HetNets. In \cite{Wu2017}, Zero Forcing Beamforming (ZFB) BSs and cache-equipped helper nodes were considered where the requesting UE is associated with the helper node with maximum received power. In \cite{Wu2020}, random resource allocation was utilized with SPUC. The fraction of bandwidth and the probabilistic cache placement were optimized to maximize offloading. SPMC has been used in \cite{Cui2017, Zhong2018, Ye2019} as a content delivery method. In \cite{Cui2017, Ye2019}, probabilistic caching is exploited for a two-tier HetNet where each BS multicasts $k$ files in disjoint resources. In \cite{Zhong2018}, coded caching is applied for a cellular network with multi-antenna BSs. The authors exploit joint SPUC and SPMC beamforming for content delivery, and the beamforming vectors are optimized to maximize the minimum rate of the UEs. Digital Terrestrial TV Broadcasting systems~\cite{Sari1995} deliver content based on multipoint broadcast transmissions, while multipoint multicast (MPMC) delivery is used in the Long Term Evolution (LTE) system in the context of Multimedia Broadcast Multicast Services \cite{Wibowo2011}. In a multi-cell transmission mode, all serving BSs stream the same file through the whole network in a Single-Frequency-Network (SFN) configuration. A SFN-configured MPMC was utilized in \cite{Ours_2020} for edge caching cellular networks. An orthogonal MPMC (OMPMC) was considered where resources are network-wide orthogonalized among cached files. The cache policy was then designed with respect to (w.r.t) file-specific resource allocation and probabilistic cache placement. In this paper, we devise a hybrid content delivery scheme for cache-enabled multiantenna HetNets, combining OMPMC and SPUC. SPUC can serve individual users, but suffers from Co-Channel Interference (CCI). In contrast, OMPMC can serve a population of users interested in a given file with limited CCI~\cite{Ours_2021}. However, this is obtained at the cost of the increase in the outage probability, as the multicast transmission can not individually satisfy UEs according to the resources need for successful reception. Also, if only few users are interested in a file, using OMPMC would consume large amounts of network resources as compared to SPUC. This portrays a trade-off between OMPMC and SPUC delivery. We exploit this to develop a hybrid scheme based on OMPMC that streams the files using a network-wide file-specific resource allocation, and on-demand SPUC that unicasts the files using UE-specific resource-allocations. In contrast to \cite{Zhong2018,Ours_2022}, we devise the hybrid scheme such that all UEs being dissatisfied by the multicast component can be properly served by the network. We optimize the network w.r.t. total amount of consumed resources subject to inevitable outages due to coping with the possibility of too large bandwidth requests. More specifically, for the proposed hybrid SPUC/OMPMC delivery scheme, we find expressions for the outage probability and network resource consumption, using stochastic geometry. We then formulate the optimal traffic offloading problem as a joint optimization problem over cache placement, resource allocation and multiuser beamforming. To solve this problem, we represent it as a parametric optimization problem and leverage a path-following method to find the global optimal policy from the perspective of total resource consumption. We compare the proposed hybrid scheme to cache delivery policies from the literature, in different settings. The remainder of this paper is organized as follows. In Section \ref{Sec_Model}, the system model is introduced. In Section~\ref{Sec_TotalResource}, the total resource consumption of the considered hybrid scheme is computed. The optimization problem is formulated in Section \ref{Sec_Optimizatoin}, while simulation results are presented and discussed in Section \ref{Sec_Result}. Finally, Section \ref{Sec_Conclu} concludes the paper. \textbf{Notations}: In this paper, we use lower-case $a$ for scalars, bold-face lower-case $\textbf{a}$ for vectors and bold-face uppercase $\textbf{A}$ for matrices. Further, $\{a_n\}_1^N$ collects the components of vector $\boldsymbol{a}$ from $n=1$ to $n=N$. We use $\textbf{1}$ and $\textbf{0}$ to denote the vector with all elements equal to one and zero, respectively. We use $\dot{\boldsymbol{a}}(\theta )$ to represent the derivative of $\boldsymbol{a}(\theta)$ with respect to $\theta$. \section{System Model} \label{Sec_Model} We consider a content library containing $N$ different files. The fraction of active UEs requesting file $n$ is $f_n$. We assume that file popularities $\{f_n\}_1^N$ are known to the network. We use the Zipf distribution (see \cite{Breslau1999}) to model popularity; $f_n = n^{-\tau}/\sum_{m=1}^N m^{-\tau}$, with $\tau$ being the skewness of the Zipf distribution. We consider a streaming service and for simplicity, we assume the same streaming rate $R$ for all files which leads to the identical service quality. The study of dynamic rate/quality is left for future work. We consider a two-tier HetNet with BSs and Helper Nodes (HNs). The network applies a hybrid delivery scheme, based on OMPMC and SPUC components to serve UEs. The HNs constitute the multicast component and are equipped with limited-capacity caches which proactively cache files based on a probabilistic approach~\cite{Serbetci2017}. The HNs apply OMPMC to broadcast the cached files through the whole network in file-specific disjoint resources. In the OMPMC layer, there may be co-channel interference arising from far-away HNs. However, with conventional Orthogonal Frequency Division Multiplexing (OFDM) parameterization, such co-channel interference would be negligible~\cite{Ours_2021}. The BSs constitute the unicast component. They are connected to a high-capacity backhaul link which can fetch files from the core-network, and serve these to users using on-demand unicast. The BSs are equipped with $L$ antennas and use multiuser ZFB to serve $u$ users simultaneously in a frequency resource. The network dedicates network-wide disjoint resources for the OMPMC and SPUC delivery components, denoted by $W^{\rm MC}$ and $W^{\rm UC}$, respectively. Each BS uses the full bandwidth $W^{\rm UC}$, i.e., frequency reuse 1 is used in the unicast layer. When served by the unicast layer, a UE is connected to the nearest BS. To support the streaming rate $R$, the BS allocates a sufficient amount of resources to a UE, if it is not greater than a service threshold. We assume that the locations of UEs, BSs and HNs are based on three independent Poisson Point Processes (PPPs), i.e., $\Phi_u$ and $\Phi_b$ and $\Phi_h$, respectively, with intensities $\lambda_u$, $\lambda_b$ and $\lambda_h$. \subsection{Cache Placement and Content Fetching} \label{SubSec_Placement} The HNs are equipped with caches of limited memory capacity so that they can store at most $M$ files. They proactively and independently cache files based on a probabilistic approach \cite{Blaszczyszyn2015} modeled by a common probability distribution. As such, cache weights $\{p_n\}_1^N$ with $0 \leq p_n \leq 1$ and $\sum_{n=1}^N p_n \leq M$ are introduced, and an approach is devised such that each HN can store exactly $M$ files with file $n$ being cached at the HN with probability equal to $p_n$. Note that the files are cached at HNs based on another PPP with intensity $\{ \lambda_u p_n\}_1^N$ , according to the thinning property of $\Phi_u$ \cite{BK1}. The BSs providing on-demand unicast delivery reactively fetch the requested files from the core network if they are requested by UEs. \subsection{Content Delivery}\label{SubSec_Delivery} The network operates in a time-slotted fashion. Within each time-slot, requests arrive at arbitrary times from a spatial realization of UEs based on $\Phi_u$. The network applies a hybrid delivery scheme based on OMPMC and SPUC transmissions to satisfy these requests. Any UE not being satisfied by the multicast component is assigned to the unicast component to be properly served. The multicast component streams cached files through whole network by cooperation of all HNs. It uses file-specific disjoint resources for broadcasting different files bandwidth $w_n^{\rm MC}$ allocated for file $n$. To reduce the latency of streaming in the OMPMC mode, we apply Harmonic Broadcasting (HB) characterized by harmonic number $H_w$~\cite{Juhn1997}, though the analysis is not restricted to any particular streaming scheme. When the consumed bandwidth is increased by a factor of $H_w = \sum_{i=1}^D 1/i$, the average latency of a user requesting the file within the time slot is reduced by a factor of $1/D$. We assume that the average transmission power of all HNs is the same, denoted by $p_{\rm tx}$. With equal power allocation across frequency, the transmitting Signal-to-Noise-Ratio (SNR) of all files in OMPMC are the same, $ \gamma^{\rm MC}_{\rm tx} = \dfrac{p_{\rm tx}}{W^{\rm MC}N_0} $, where $N_0$ is the noise spectral density. Any UE not being satisfied by the multicast component, requests the file from the unicast component. As such, the BSs in the unicast layer, constitute a Poisson-Voronoi tessellation with different cell sizes. The nearest BS to the UE fetches the file from the core network and unicasts it towards the UE. If the Signal-to-Interference-plus-Noise Ratio (SINR) of a user is above a threshold, the responsible BS responds to the UE by allocating the resources it needs to successfully decode its files. In each Voronoi cell, there may be multiple UEs requesting files. We assume that the average transmission power of all BSs is $p_{\rm tx}$, and they are equipped with $L$ antennas and serve $u$ UEs at the same frequency bandwidth using a ZFB transmission. \subsection{Resource Consumption of Multicast Component} \label{SubSec_ResourceMPMC} The multicast component applies network-wide resource allocation with OFDM-based transmission to broadcast the files through the network. The Signal-to-Noise-Ratio (SNR) of UE $k$ requesting file $n$ is expressed as \cite{Ours_2020}: \begin{equation} \label{EQ_SNR_MPMC} \gamma_{k,n}^{\rm MC}= \gamma_{\rm tx}^{\rm MC} \sum_{j\in\Phi_{p,n}}{ |h_{j,k}|^2 \|\boldsymbol{x}_k-\boldsymbol{r}_j \|^{-e}}, \end{equation} where $\Phi_{p,n}$ stands for the set of HNs caching file $n$, $h_{j,k}$ is the channel coefficient between HN $j$ and UE $k$, $\boldsymbol{x}_k$ and $\boldsymbol{r}_j$ are the locations of UE $k$ and HN $j$, respectively, and $e$ is the path-loss exponent. We use a standard distance-dependent to model the path-loss, and assume an Rayleigh distribution for the channel coefficient, i.e., $|h_{j,k}|^2\sim \exp(1)$. The maximum achievable rate for a transmission is obtained from the corresponding Additive-White-Gaussian-Noise channel capacity. If the maximum rate experienced by a UE is less than the streaming rate $R$, the UE is in outage. The outage probability $\mathcal{O}_{n,k}^{\rm MC}$ for UE $k$ requesting file $n$ then is: $$ \mathcal{O}_{n,k}^{\rm MC} = \mathbb{P}\{ w_n^{\rm MC} \log_2(1+\gamma_{k,n}^{\rm MC}) \leq R \}. $$ Defining a spectral efficiency threshold $\alpha_n = R/w_n^{\rm MC}$, the total resource usage of the multicast component is $W^{\rm MC}= \sum_{n=1}^N w_n^{\rm MC} = \sum_{n=1}^N \frac{R}{\alpha_n} $. However, as we apply harmonic broadcast~\cite{Juhn1997}, the effective resource usage will be multiplied by $H_w$, i.e., $$ W_{\rm eff}^{\rm MC}(\boldsymbol{\alpha}) = H_w \sum_{n=1}^N \frac{R}{\alpha_n}. $$ Based on the Slivnyak-Mecke theorem \cite{BK1}, the performance can be computed for a typical UE located at the origin. Hence, we can set $\mathcal{O}_{n,0}^{\rm MC} = \mathcal{O}_{n}^{\rm MC}$. Accordingly, the outage probability of file $n$, served by the multicast component, is \cite{Ours_2020}: \begin{align}\label{EQ_out_MC} \mathcal{O}^{\rm MC}_n\left(p_n,\{\alpha_l\}_l\right) &= \frac{2}{\pi} \int_0^\infty \Bigg\{ \frac{1}{w} \cos\Big(\frac{\pi^2\lambda_h p_n }{e \cos(\pi/e)} \Big(\frac{w}{g_{\boldsymbol{\alpha}}}\Big)^{2/e} \: \Big) \times \notag \\ & \exp\Big(\frac{-\pi^2\lambda_h p_n}{e \sin(\pi/e)} \Big(\frac{w}{g_{\boldsymbol{\alpha}}}\Big)^{2/e} \: \Big) \sin\bigg(\frac{w}{\gamma_R} \bigg) \Bigg\}dw, \end{align} where $g_{\boldsymbol{\alpha}} = \big(2^{\alpha_n}-1\big)\sum_{l=1}^N \alpha_l^{-1}$ and $\gamma_R = \dfrac{p_{\rm tx}}{N_0}\dfrac{1}{R H_w}$. \subsection{Resource Consumption of Unicast Component} \label{SubSec_ResourceSPUC} In each Voronoi cell of the unicast layer, zero-forcing beamforming is utilized to serve $u$ UEs in the same bandwidth. Consequently, for UE $k$ served by the unicast component, the SINR is: \begin{align}\label{EQ_SINR} \gamma_{k}^{\rm UC}=\frac{g_k \|\boldsymbol{x}_k - \boldsymbol{r}_0\|^{-e}}{ {1}/{\gamma_{\rm tx}^{\rm UC}} + \underbrace{\sum_{j\in\Phi_b \backslash \{0\}} g_j^k \|\boldsymbol{x}_k - \boldsymbol{r}_j\|^{-e}}_{I_k}} \end{align} where $\gamma_{\rm tx}^{\rm UC}=p_{\rm tx}/(W^{\rm UC}N_0)$, $g_k$ is the effective channel gain between the nearest BS and UE $k$, constructed from the channel vector and the beamforming vector, and $g_j^k$ is the effective channel gain from BS $j$ to UE $k$. Further, $\boldsymbol{r}_0$ and $\boldsymbol{r}_j$ are the locations of the nearest BS and BS $j$. Consequently, we have $g_k \sim \Gamma(L-u+1,1)$ and $g_j^k \sim \Gamma(u,1)$ \cite{Chen2016}, with $\Gamma(a, b)$ being the gamma distribution with shape $a$ and scale $b$. In each cell, the BS allocates a sufficient amount of resources to the served UEs. However, if the SINR of a user is very small, near infinite bandwidth would be needed to serve the user. To cope with this, we apply a thresholding policy, the bandwidth allocated to serve UE $k$ is: \begin{align}\label{EQ_serviceTh} w_k^{\rm UC} = \begin{cases} {R}/{\log_2(1+\gamma_{k}^{\rm UC})}, & \gamma_{k}^{\rm UC} \geq \gamma_{\rm th}\\ 0, & {\rm otherwise} \end{cases}, \end{align} where $\gamma_{\rm th}$ is the SINR threshold. Hence, no resource is allocated if the UE is in a poor condition. Considering that each BS applies multiuser ZFB towards $u$ users, the resources consumed in each cell is approximately given by the total amount of resources allocated to UEs in that cell divided by $u$. This becomes precise when $\lambda_u/\lambda_b\to\infty$, and is a sufficient approximation when $\lambda_u \gg \lambda_b$. We assume that all BSs are active during unicast service, so the average resource consumption by this component is determined by the average consumption of a typical Voronoi cell $\mathcal{V}_0$: \begin{align}\label{EQ_WUC0} W^{\rm UC}(\cdot) = \mathbb{E} \left\{ \sum_{k\in \mathcal{V}_0} \frac{w_k^{\rm UC}}{u} \right\} \end{align} The expectation is w.r.t. Poisson processes of UEs ($\Phi_u$) and BSs ($\Phi_b$), as well as effective channel gains based on \eqref{EQ_SINR}. \section{Resource Consumption of Hybrid Scheme} \label{Sec_TotalResource} For the resource consumption in the unicast layer we have \begin{thm}\label{Theorem_Wt} Consider an interference-limited frequency reuse 1 cellular network with BSs and UEs coming from PPPs with intensities $\lambda_b$ and $\lambda_u^{\rm eff}$, respectively, where UEs are served by their nearest BS. BSs use ZFB with $L$ antennas towards $u$ simultaneous users, and allocate bandwidth to users using service threshold $\gamma_{\rm th}$ as in (\ref{EQ_serviceTh}). The average amount of resources needed is then: \begin{align}\label{EQ_WUC} \!\!\!\!\! W^{\rm UC}(u,\lambda_u^{\rm eff}) = \frac{\lambda_u^{\rm eff}}{2u\lambda_b } \sum_{l=1}^{L-u+1}f_{l,u} \int_0^{w_{\rm th}} w \frac{d}{dw} C_{l,u}(w) dw, \end{align} where \begin{align*} C_{l,u}(w) = \frac{1}{_2F_1\big(-\frac{2}{e},u,1-\frac{2}{e},-\xi\:l\:\eta(w)\big)}, \end{align*} $w_{\rm th}={R}/{\log_2(1+\gamma_{\rm th})}$, $\eta(w) = 2^{R/w}-1$, $\xi= (L-u+1)!^{\frac{-1}{L-u+1}}$, and $_2F_1(\cdot)$ is the hypergeometric function. The outage probability of a UE is: \begin{align*} \mathcal{O}^{\rm UC}(u,\gamma_{\rm th}) = 1-\sum_{l=1}^{L-u+1} \frac{f_{l,u}}{_2F_1(-\frac{2}{e},u,1-\frac{2}{e},-\xi\, l\, \gamma_{\rm th})}, \end{align*} where $f_{l,u} = (-1)^{l+1}{L-u+1 \choose l}$. \end{thm} \begin{proof} See appendix \ref{App1}. \end{proof} Notice that $W^{\rm UC}(\cdot)$ depends on ${\lambda_u^{\rm eff}}/{\lambda_b}$, not on both $\lambda_b$ and $\lambda_u^{\rm eff}$ separately. By comparing the results of Theorem \ref{Theorem_Wt}, we can relate the total resource $W^{\rm UC}$ to the outage probability $\mathcal{O}^{\rm UC}$: \begin{align} \label{EQ_W_Out} \frac{dW^{\rm UC}(u,\lambda_u^{\rm eff})}{d\gamma_{\rm th}} = -\frac{w_{\rm th} \: \lambda_u^{\rm eff}}{2u \: \lambda_b} \frac{d\mathcal{O}^{\rm UC}(u, \gamma_{\rm th})}{d\gamma_{\rm th}} \end{align} \begin{comment} \begin{align*} & W^{\rm UC}(u,\lambda_u^{\rm eff}) = -\frac{\lambda_u}{2u \lambda_b} \int_0^{w_{\rm th}} w \frac{d}{dw} \mathcal{O}^{\rm UC}(u, \eta(w)) dw \\ &\quad= \frac{\lambda_u}{2u \lambda_b} \Big( -w_{\rm th} \mathcal{O}^{\rm UC}(u,\gamma_{\rm th}) + \int_0^{w_{\rm th}} \mathcal{O}^{\rm UC}(u, \eta(w)) dw \Big) \end{align*} For $\gamma_{\rm th}<1$, we have $ \int_0^{w_{\rm th}} \mathcal{O}^{\rm UC}(u, \eta(w)) dw\gg w_{\rm th} \mathcal{O}^{\rm UC}(u,\gamma_{\rm th})$, which enables us to get the following approximation: \begin{align} \label{EQ_W_Out} W^{\rm UC}(u,\lambda_u^{\rm eff}) \approx \frac{\lambda_u}{2u \lambda_b} \int_0^{w_{\rm th}} \mathcal{O}^{\rm UC}(u, \eta(w)) dw \end{align} \end{comment} Equation \eqref{EQ_W_Out} directly provides a trade-off between the outage probability, and resource consumption of the unicast scheme. Considering that $ \dfrac{d\mathcal{O}^{\rm UC}(u, \gamma_{\rm th})}{d\gamma_{\rm th}} > 0$, increase in $w_{\rm th}$ makes $W^{\rm UC}$ grows monotonically. Not all UEs request from the unicast component; only UEs being dissatisfied by the multicast component do. Based on the thinning property of PPP, $\lambda_{u}^{\rm eff}$ in \eqref{EQ_WUC} depends on the overall outage probability of the multicast component: $ \mathcal{O}^{\rm MC}\left( \boldsymbol{p},\boldsymbol{\alpha} \right)=\sum_{n=1}^N f_n \mathcal{O}_n^{\rm MC}\left( p_n,\{\alpha_l\}_l \right), $ considering that $f_n$ is the popularity of file $n$. Therefore, the average total resource consumption of the whole network is expressed as: \begin{equation} \begin{aligned}\label{EQ_Wtot} W_{\rm tot} = \underbrace{H_w R \sum_{n=1}^N { \alpha_n^{-1}}}_{\text{multicast component}} \,+\, \underbrace{W^{\rm UC}(u,\lambda_u) \mathcal{O}^{\rm MC}\left( \boldsymbol{p},\boldsymbol{\alpha} \right)}_{\text{unicast component}}. \end{aligned} \end{equation} Accordingly, we can obtain the service outage probability, defined as the probability that a typical UE being served by the hybrid scheme is in outage. It depends on the outage of the SPUC and OMPMC components as: $$ \mathcal{O}_{\rm tot} = \mathcal{O}^{\rm UC}(u,\gamma_{\rm th})\, \mathcal{O}^{\rm MC}(\boldsymbol{p},\boldsymbol{\alpha}). $$ \section{Optimal Traffic Offloading for Hybrid Scheme} \label{Sec_Optimizatoin} Aiming to minimize the total resources consumed by the network, the traffic offloading policy is optimized as: \begingroup\makeatletter\def\f@size{9}\check@mathfonts \begin{align} P_1:~ &\min_{\boldsymbol{p},\boldsymbol{\beta},u} ~ H_wR\bsum_{n=1}^N {\beta_n} + {W^{\rm UC}(u,\lambda_u)} \bsum_{n=1}^N f_n \mathcal{O}_n^{\rm MC}\left( p_n,\Big\{\frac{1}{\beta_l}\Big\}_l \right) \nonumber \\ \nonumber &~~\mbox{s.t.} \begin{cases} \beta_n \geq 0, &0\leq p_n\leq 1,\qquad\quad n \in S_N,\\ \bsum_{n=1}^N p_n \leq M, &u \in \{1,\ldots,L\}, \end{cases} \end{align} \endgroup where $\beta_n=\frac{1}{\alpha_n}$ and $S_N = \{1,\ldots,N\}$. Note that $P_1$ is a non-convex mixed-integer optimization problem. The optimization parameters are the cache weights and resource allocations of the multicast component, i.e., $\{(p_n,\beta_n)\}_1^N$, and the multiuser beamforming parameter $u$ of the unicast component . To optimize $P_1$, w.r.t. $u$, we use a simple line search with $u \in \{1,\ldots,L\}$. However, to find the optimum value for $\{(p_n,\beta_n)\}_1^N$, we use a path-following method \cite{Vyacheslav_2014}. As such, we formulate a parametric optimization problem exactly as $P_1$ but with $\theta$-parameterized popularity $b_n(\theta)$ replacing $f_n$. We denote the corresponding parametric optimization problem by $P_1(\theta)$. We parameterize $b_n(\theta)$ such that $\lim_{\theta \rightarrow 0} b_n(\theta) = \frac{1}{N}$ and $\lim_{\theta \rightarrow \tau} b_n(\theta) = f_n$, for $n\in S_N$. As such, the solution of $P_1(\theta)$ can be found by solving ODE \eqref{EQ_ODE}, written at top of next page, where $i,j \in S_N$, $\delta_{ij}$ is the Kronecker delta function, $[a_{ij} ]_{i,j}$ constitutes a matrix whose $i$-th row and $j$-th column is $a_{ij}$ and $[ a_{i} ]_{i} $ is a column vector with i-th component being $a_i$. \begin{figure*}[t] \begingroup\makeatletter\def\f@size{9}\check@mathfonts \begin{equation}\label{EQ_ODE} \begin{aligned} \begin{pmatrix} \dot{\boldsymbol{\beta}}(\theta) \\ \dot{\boldsymbol{p}}(\theta) \\v(\theta) \end{pmatrix} =- \begin{pmatrix} \left[ b_i(\theta) \dfrac{d^2 \mathcal{O}^{\rm MC}_i}{d p_i d\beta_j} \right]_{i,j} & \left[b_i(\theta) \dfrac{d^2 \mathcal{O}^{\rm MC}_i}{d p_i^2}\delta_{ij} \right]_{i,j} & \boldsymbol{1}\vspace{5 pt}\\ \left[ \mathlarger{\sum}_{n=1}^N b_n(\theta) \dfrac{d^2 \mathcal{O}^{\rm MC}_n} {d \beta_i d\beta_j}\right]_{i,j} & \left[ b_j(\theta) \dfrac{d^2 \mathcal{O}^{\rm MC}_j}{d p_j d\beta_i} \right]_{i,j} & \boldsymbol{0}\vspace{5 pt}\\ \boldsymbol{0}^\top & \boldsymbol{1}^\top & 0 \end{pmatrix}^{-1} \begin{pmatrix} \left[ \dot{b}_i(\theta) \dfrac{d \mathcal{O}^{\rm MC}_i}{d p_i}\right]_{i} \vspace{5 pt}\\ \left[ \mathlarger{\sum}_{n=1}^N \dot{b}_n(\theta) \dfrac{d \mathcal{O}^{\rm MC}_n}{d \beta_i} \right]_{i} \vspace{5 pt} \\ 0 \end{pmatrix} \end{aligned} \end{equation} \endgroup \hrule height 0.1pt depth 0pt width 7.15in \relax \end{figure*} We solve ODE \eqref{EQ_ODE} for $\theta \in [0,\tau]$ by the sequential method elaborated in \cite{Ours_2021}. It gives the solution of the sough optimization problem $P_1(\tau)$ of interest, corresponding to the target popularities $\{f_n\}_1^N$. However, an initial point, at $\theta=0$, is needed for solving this ODE. To obtain it, we consider the optimization problem $P_1(0)$ corresponding to the popularity $b_n(0)$ and find its optimal solution. For the parameterization, we set $b_n(\theta) = {n^{-\theta}}/{\sum_{m=1}^N m^{-\theta}}$ for $n\in S_N$ and $\theta \in [0,\tau]$. \section{Simulation Results and Discussion}\label{Sec_Result} We compare the optimal cache delivery solution of the hybrid scheme to conventional multi-antenna SPUC \cite{Chen2016,Wu2017,Liu2017} and OMPMC schemes \cite{Ours_2020} from the literature. We consider the following scenario. The number of files is $N=100$, the popularity skewness is $\theta=0.6$, the cache capacity of BSs is $M=10$, the streaming service rate $R = 1$ Mbps, and having $L=8$ antennas at the BSs and the service threshold $\gamma_{\rm th}=0.1$, unless it is specified. We set the Harmonic number $H_w=6$, which approximately reduces the streaming latency with a factor of 226~\cite{Juhn1997}. The BSs and HNs are deployed based on two independent homogeneous PPP with intensity $\lambda_b = 200$ and $\lambda_h\in [20,200]$, respectively, and UEs are located according to another homogeneous PPP with intensity $\lambda_{u} = 2\times 10^5$. We apply an Urban NLOS scenario from 3GPP \cite{3GPP2017} with carrier frequency 2 GHz, HN transmission power 23 dBm, and path-loss exponent $e=3.76$. The network of BSs is assumed interference-limited. The antenna gain at the UE and HN are 0 dBi and 8 dBi, respectively, the noise-figure of UE is 9 dB, the noise spectrum density is -174 dBm. Note that since the reference distance is 1 km, the UE and BS intensities are in the units of points/km$^2$. Figure \ref{Fig_Resource_Lamp} shows the normalized resource usage for the hybrid scheme, and the SPUC and OMPMC components as a function of HN intensity $\lambda_h$. As $\lambda_h$ increases, the total resource consumption decreases--the OMPMC component consumes more resources, as more files are offloaded to be served in OMPMC. Figure \ref{Fig_Outage_Lamp} illustrates the outage probability as a function of HN intensity $\lambda_h$. Note that the outage probability of the SPUC component is insensitive to $\lambda_h$. As $\lambda_h$ increases, the total outage probability of the hybrid scheme decreases due to the increase in the performance of the OMPMC component. \begin{figure}[t] \begin{center} \includegraphics[width=85 mm]{Resource_Lamp_2.eps} \caption{The normalized resource consumption as a function of HN intensity $\lambda_h$ for $\lambda_b=200$. \label{Fig_Resource_Lamp}} \end{center} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[width=85 mm]{Outage_Lamp_2.eps} \caption{The outage probability as a function of HN intensity $\lambda_h$ for $\lambda_b=200$. \label{Fig_Outage_Lamp}} \end{center} \end{figure} To investigate how the proposed hybrid scheme optimizes the total resource usage of the network, we compare it with OMPMC and SPUC delivery schemes. Figure \ref{Fig_Tradeoff1} portrays the tradeoff between total resource usage and outage probability of the different schemes for $\lambda_b=200$, and a sparse MPMC component with $\lambda_h=50$. To generate the curves of SPUC and hybrid schemes, we change the service threshold in the range $\gamma_{\rm th} \in [0.03,1]$. For the OMPMC scheme, we target a value for the outage probability and determine the corresponding consumed resources. The OMPMC scheme performs worst as compared to the SPUC and the hybrid schemes. The reason for this is that the considered Zipf distribution with $\tau=0.6$ has a fat tail---there is a significant number of request for non-cached files. Despite this, the hybrid scheme is able to considerably outperform the SPUC scheme, offloading the most popular files to the OMPMC component. The same tradeoff for a cellular network, where $\lambda_b=\lambda_h=200$, is depicted in Figure \ref{Fig_Tradeoff2}. In this case, the BS and caching HNs can be considered to be the same. Now, OMPMC generically outperforms SPUC, but the hybrid scheme still provides the best service with a wide margin. \begin{figure}[t] \begin{center} \includegraphics[width=85 mm]{Tradeoff1_2.eps} \caption{Normalized resource consumption versus outage probability for $\lambda_b=200$, $\lambda_h=50$. \label{Fig_Tradeoff1}} \end{center} \end{figure} \begin{figure}[t!] \begin{center} \includegraphics[width=85 mm]{Tradeoff2_2.eps} \caption{The normalized resource versus outage probability for $\lambda_b=\lambda_h=200$. \label{Fig_Tradeoff2}} \end{center} \end{figure} \section{Conclusion}\label{Sec_Conclu} In this paper, we considered hybrid content delivery combining orthogonal multipoint multicast (OMPMC) and single-point unicast (SPUC) transmission schemes. A traffic offloading policy jointly optimizing cache placement and radio resource allocation of OMPMC and multiuser beamforming of SPUC was formulated, based on the derived expression of network-wide consumed resource. The amount of consumed resources depends on the ratio of user intensity to SPUC BS intensity, and not on both separately. Further, a functional relationship between the total resource consumption and the outage probability of unicast service was derived. To find the optimal policy, a parametric optimization problem was formulated and solved using a path-following method. We compared the performance of the hybrid scheme with using only SPUC or OMPMC. Simulation results clearly portray the tradeoff between total resource consumption and service outage probability, and showed that despite a fat tail of popularity distribution, which renders OMPMC ineffective as compared to SPUC, the hybrid scheme outperforms SPUC with a wide margin, in the simulated scenarios up to 50\% of the resources can be saved by using the hybrid scheme instead of SPUC. The proposed hybrid delivery scheme is a promising candidate for optimizing the spectral efficiency and total resource consumption in heterogeneous and cellular networks. \section*{Acknowledgment} This work was funded in part by the Academy of Finland (grant 319058). The work of G. Caire was partially funded by the European Research Council under the ERC Advanced Grant N. 789190, CARENET. \bibliographystyle{IEEEtran}
\section{Introduction} \vspace{-0.2cm} There has been a growing interest in the research community in providing decision support with studies focusing on prescriptive process monitoring and naturally extending predictive process monitoring (PPM). The focus of research in PPM has led to investigating many deep learning approaches having improved accuracy as compared to the classical machine learning algorithms. ~\cite{transformers2020,camargo2020,tax2017,taymouri2020}. However, while PPM is capable of identifying the likelihood that an ongoing case can get delayed, execute a non-conformant event, or may have a long execution trace, it cannot suggest or prescribe the optimal execution of a case that can avoid an undesirable outcome. Consequently, prescriptive process monitoring has addressed some of the problems. One approach is to prescribe an intervention by triggering an alarm when the probability that a case will lead to an undesired outcome is above a threshold~\cite{metzgeralarm2020,tinemaalarm1028}. An alternative approach is to recommend actions~\cite{presconfroti2013,presGroger14}. Nonetheless, there is limited work on recommending actions in the context of business goals ~\cite{adityarl2021,weinzierl2020prescriptive}. Goals are often defined for any real world business process based on Key Performance Indicators (KPI) such as cost, quality, or time. Additionally, these goals can be contradictory. Consider an example of the loan application process - completing the loan sequence with limited actions (corresponding to activities) and approving a loan application within a stipulated time may not meet the quality requirements as the loan may be approved without checking an applicant's credit score. Hence, the goals of completion time and quality are contradictory. Moreover, the sequence of activities recommended must also conform to certain policies or regulations~\cite{conformance2018}. Reinforcement learning (RL) provides a framework to optimize sequences of decisions for long-term outcomes. For example, given an ongoing case, if a decision needs to be made on the next activity, each choice can affect the KPI (such as the completion time) and eventually the goal (i.e., did it complete within a stipulated time). An RL algorithm can choose the next activity (known as action) according to its policy based on the KPI estimation and receive immediate outcome (known as reward). Hence, we propose using RL to recommend goal-oriented next best activity that conform to certain specified constraints. There are various challenges to use RL in the context of a goal-oriented and conformant activity sequence prediction. First, the action space varies as there are constraints on what activities can or cannot occur. Next, the RL model tends to choose a path that satisfies the goal without considering the outcome. It could be possible that, for instance, the model has to choose a path with the least duration and the least duration path is an undesired outcome (e.g., rejecting a loan application). In such scenarios, the model would recommend an undesirable outcome for all cases, i.e., rejecting all the loan applications Therefore, considering the challenges discussed above, in this work, we aim to address the following research question: \textit{Given an ongoing case, can we learn from historical executions to recommend the next best activity (and the sequence) that is goal-oriented and conformant}. Our specific contributions are as follows: \vspace{-0.1cm} \begin{itemize} \item We propose an RL based framework that recommends the next best activity (and remaining sequence of activities known as suffix) given a partially completed case\footnote{The codebase is available at: \url{https://github.com/avani17101/go-nba}}. Our framework supports: (1) Deep learning model to predict the estimated value of KPI that forms the basis of RL exploration. (2) Deep RL on-policy method to recommend next activity that is conformant to the process model. (3) Balancing reward mechanism to mitigate the possible bias of the recommended sequence outcome. \item We demonstrate the effectiveness of our proposed framework by conducting experiments and comparing our work with existing prescriptive process recommendations of activity sequences. \end{itemize} The paper is organized as follows. A brief overview of previous studies on recommending next activity and use of RL in business process monitoring is presented (Section~\ref{sec:relwork}) followed by an introduction to the concepts in Section~\ref{sec:prelim}. The details of our approach to build the RL based framework is presented in Section~\ref{sec:approach}. The evaluation of the approach and the discussions on real-world event logs is presented in Section~\ref{sec:eval}. Finally, we summarise the contributions of our work and outline future work in Section~\ref{sec:conclusion}. \section{Related Work} \label{sec:relwork} \vspace{-0.2cm} We position our work with respect to the existing work, categorized into the following three topics: \vspace{-0.3cm} \paragraph{Predictive process monitoring:} A large body of existing work focuses on predicting the next activity and the most likely remaining sequence of activities (suffix). Most of the recent work here relies on Recurrent architectures such as LSTMs for predicting the next activity and remaining time of cases \cite{camargo2020,mm-pred,tax2017}. Additionally, the use of transformers~\cite{transformers2020} has been explored that is efficient to train and can handle large sequences. Further, a generative adversarial architecture (GAN) has been proposed, where the generator produces sequences from random noise and the discriminator differentiates between real sequences and the ones created by the generator in~\cite{taymouri2021,taymouri2020}. The objective is to predict the sequence of activities at any point in the case and detect the likelihood of an undesired outcome, but they do not provide recommendation that can prevent an undesired outcome. \paragraph{Intervention-based recommendations:}Early work on prescriptive process monitoring proposed a mechanism for generating alarms that could lead to interventions and mitigate or prevent undesired outcomes~\cite{tinemaalarm1028}. In their work, Teinemaa et al. propose an alarm system comprising of two components: 1) a probabilistic classifier that estimates the likelihood of an undesired outcome, and 2) an alarming threshold component that alarms when the likelihood of the undesired outcome is at least a threshold. The optimal alarming threshold is based on the cost of an intervention. Metzger et al.~\cite{triggering-2020} use an RL algorithm to automatically learn when to trigger process adaptations based on the predictions. Recent work proposed a framework that recommends when to apply an intervention (treatment) to an ongoing case to decrease its cycle time by building causal models~\cite{prescriptiveirene21}. Orthogonal random forests trained on historical traces is used to estimate the effect of a treatment (or intervention) on the reduction in cycle time, given the current state of a case. In these approaches, the recommendation of the intervention or treatment is binary and does not recommend an optimal next best activity or suffix. \paragraph{Suffix recommendations:} Recent work on prescriptive process monitoring proposes the next best event recommendation that is optimized for a given KPI~\cite{weinzierl2020prescriptive}. A DL model is trained to predict next activities and the KPI values. For an ongoing case, the suffix and the KPI values are predicted. A set of $k$ nearest neighbors of the predicted suffix is chosen from historical data as candidate suffixes. They are then passed to a business process simulation model to reduce the risk of non-conformant activities and recommend the best suffix. Non-conformant activities are simply discarded in candidate suffixes. But, when all candidate suffixes are non-conformant, the predicted suffix is returned as the best action. In this particular case, the recommendations would be non-conformant. Hence, this work also does not guarantee conformant recommendations. Moreover, a pre-defined $k$ neighbors in the search space is needed to select the suffix meeting the goal. Therefore, we distinguish our approach by its ability to support multiple goals (or KPIs) and explore a search space of optimal paths while providing conformant recommendations using RL. An approach using Memory augmented neural networks (MANN) recommends suffixes by learning from historical data labeled as meeting or deviating from the goal~\cite{adityaMANN2021}. In a later work, Khan et al.~\cite{adityarl2021} use an RL algorithm to recommend suffixes that meet a goal. While the authors use RL to recommend the best actions, they do not consider multiple conflicting goals with the additional constraint of ensuring conformant execution paths. \section{Preliminaries} \label{sec:prelim} \label{preli} In this section, we provide the background notions useful in the rest of the paper. \begin{defn} \textbf{Event log}. An event log is a set of $m$ traces $E = \{\sigma_1,\sigma_2,...,\sigma_m\}$. \end{defn} \begin{defn} \textbf{Trace}. A trace $\sigma = \langle e_1,e_2, \dots, e_n \rangle$ is an ordered sequence of $n > 0$ events. A partial sequence of length $k \leq n$ would consist of the first k elements of the sequence. Each trace have a unique identifier $trace\_{id}$. \end{defn} \begin{defn} \textbf{Event}. An event $e$ is a tuple of trace id $trace\_{id}$, activity $a$ and timestamp $ts$ $$e = (trace\_{id}, a, ts)$$ \end{defn} \begin{defn} \textbf{Key Performance Indicator (KPI)}. The performance of trace $\sigma$ can be measured on multiple dimensions such as time, cost, or quality. The value $v$ obtained for a trace $\sigma$ at an activity $a$ for a performance indicator $pi$ is termed as Key Performance Indicator. $KPI(\sigma,a,pi) = v_a^{pi}$ \end{defn} \begin{defn} \textbf{Goal value and Goal}. A goal value $G$ for an trace $\sigma$ is defined as the cumulative value of a KPI. Hence, $G(\sigma,pi) = \sum_{a \in \sigma} KPI(\sigma,a,pi)$. A Goal is defined as a satisfaction threshold $\omega$ on the goal value that each event sequence is expected to meet. If $G(\sigma) \leq \omega$ (for minimization problem) or $G(\sigma,pi) > \omega$ (for maximization problem), the trace $\sigma$ is said to satisfy the goal (GS) otherwise it is said to violate the goal (GV). \end{defn} \begin{defn} \textbf{Process Outcome}. The outcome of a trace $\sigma$ is defined as the last activity in the sequence i.e., outcome = $Last_a(\sigma)$. The set of all such possible outcomes defines outcome set $O$. \end{defn} \section{Approach} \label{sec:approach} \vspace{-0.2cm} The architecture of our proposed method is shown in Figure \ref{fig:arch-diagram}. First, we take a historical sequence of events as our input event log $E$. Given E, we use the IBM Process Mining tool\footnote{\url{http://ibm.com/cloud/cloud-pak-for-business-automation/process-mining}} to discover a \emph{directly-follows-graph}(DFG) that enables us to verify sequences or paths that are conformant to a reference process model. Next, a deep learning-based model $M$ is trained on activity sequences in $E$ to predict KPI for a goal $G$. The RL agent takes as input the predicted KPI, partially completed activity sequences, the goal $G$, and the discovered DFG to learn only the activity sequences that satisfy the goals while conforming to the DFG. We next describe the technical details of each component in detail. \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth, height=5cm]{architecture_diagram2.png} \caption{Proposed Framework} \label{fig:arch-diagram} \end{figure} \subsection{Business Process Directly-Follows Graph} The event log $E$ contains event sequences generated through the execution of the business process instances (referred to as cases). A directly follows graph (DFG) representing an approximate business process is discovered using the existing \emph{Process discovery} algorithms \cite{leemans2019,dfgsdm2021} (Figure~\ref{fig:arch-diagram}). The primary requirement is to ensure that the predicted activity sequences conform to the discovered business process DFG. The absence of DFG could lead to recommending non-conformant sequences. This is highly undesirable as non-conformance can lead to violation of regulations and legal obligations. Hence, we use the DFG to guide the activity sequence prediction model and learn only the sequences that conform to the business process. \subsection{Key Performance Indicator Prediction Model} Key performance indicators (KPI) such as cost, time, or quality must be measured for each event in a trace. Predicting KPI values after executing each activity of a partial sequence helps in estimating their corresponding goal value and checking whether unfolding the execution of the entire sequence of activities by choosing that specific activity would violate the goal or not. The KPI prediction model is used to explore different activities and choose the ones that will satisfy the goal. We need to consider that the chosen activity may not satisfy the goal at the current point in time but could eventually satisfy it when the case ends. As depicted in Figure~\ref{fig:arch-diagram}, we train the KPI prediction model with the input as: (1) the partially completed activity sequence and (2) the activity chosen by the RL agent (discussed in Section~\ref{rlagent}). The objective is to predict the KPI given the partially completed activity sequence with their KPI values and the next chosen activity. Existing KPI prediction models only consider the partially completed activity sequence as input. As we require to explore all conformant paths, our model considers the partial sequence and the next likely activity. Any sequence prediction deep learning-based model such as LSTM, CNN, Transformers can be used for this purpose. We choose GAN-LSTM \cite{taymouri2020} to build the KPI prediction model as it provides higher accuracy as compared to other models. The input to the model is the partially completed activity sequence $\langle (a_1, v_{a_1}^{pi}), (a_2, v_{a_2}^{pi}), ..., (a_t) \rangle $ where $a_i$ is the activity and $v_{a_i}^{pi}$ is the KPI value at activity $a_i$. The output $v_{a_t}^{pi}$, is the predicted KPI for the activity $a_t$. \subsection{Goal-Oriented Model using Reinforcement Learning} To recommend the next activity that conforms to the business process and is goal-oriented, we use a reinforcement learning based-method to explore all the activities that conform to the DFG and determine which activity(s) would lead the sequence towards the fulfillment of the goal. To achieve this, we have carefully crafted the learning problem specifically for goal-oriented learning using the event log guided by the DFG and KPI prediction model. \vspace{-0.3cm} \subsubsection{Learning Problem}\label{Learning Problem} We formalize the learning problem of next activity recommendation by defining action space $A$, state space $S$, and reward function $r$. Each event in DFG and its corresponding KPI value becomes the state. The action space would vary at every state according to the possible actions obtained from business process DFG. For example: consider a DFG where we are at an activity \textit{P} and there are three parallel paths leading to the next activity \textit{Q, R}, or \textit{S} respectively, then there can be three possible actions in $A$. Whereas after activity \textit{S}, the only possible next activity is \textit{T} and hence the possible action is different. This is not the case in a general RL setting, as the action space remains constant at all states. However, in our learning problem, it will vary at each state. We use the \emph{Masking} technique in RL to deal with this challenge. The details are discussed in Section~\ref{rlagent}. The core part of formalizing the learning problem is to define the reward function $r$. Since our aim is to recommend the next best activity (and sequence) that will satisfy the goal, we predict the KPI value at each state and calculate the goal value $G(\sigma)$ when the end of the trace $\langle EOS \rangle$ is reached. We then provide the reward at $\langle EOS \rangle$ based on the goal value. For all other states, we provide a constant reward that is $0$ for our purpose. The goal value is then checked against the goal satisfaction criteria ($\omega$) to determine a goal violation (GV) or goal satisfaction (GS). The reward function is shown in Table \ref{tab:reward-function}. \begin{table}[t] \centering \caption{Reward function $r$ based on KPI prediction} \begin{tabular}{c|c} \textbf{Goal Satisfaction (GS)}& \textbf{Goal Violation (GV)}\\ \hline \hline \large $\frac{2 * abs(G(\sigma)-\omega)}{\omega}$ & \large $\frac{-2 * abs(G(\sigma)-\omega)}{\omega}$ \end{tabular} \label{tab:reward-function} \end{table} Note that the magnitude of reward is directly proportional to the deviation of $G(\sigma)$ from $\omega$. When its minimization problem, Goal Criteria becomes $GS: G(\sigma) \leq \omega$ (as defined in Section \ref{preli}), reward for GS is $2*\frac{G(\sigma)-\omega}{\omega}$, which ensures more positive reward for smaller $G(\sigma)$. For GV, the reward $- 2*\frac{G(\sigma)-\omega}{\omega}$ ensures more negative reward for larger $G(\sigma)$. The reward function defined above remains same for the maximization problem as well i.e., $GS: G(\sigma) > \omega$. \vspace{-0.2cm} \subsubsection{RL Agent} \label{rlagent} The action space $A$ for the RL agent is the set of available activities derived from DFG. The state space $S$ at time $t$ consists of a tuple of previous predicted activity $a_{t-1}$ and it's corresponding KPI value $v^{pi}_{a_{t-1}}$. As shown in Figure \ref{fig:arch-diagram}, at time $t$, the agent is in state $s_t \in S$ i.e., $(a_{t-1},v^{pi}_{a_{t-1}})$. It samples an action $a_{t} \in A$. Then, given $a_{t}$, the KPI prediction model predicts the corresponding KPI value i.e., $v^{pi}_{a_{t}}$. The RL agent gets reward $r_t$ and moves to the next state $s_{t+1}$. The cumulative reward is calculated when it predicts end of trace $\langle EOS \rangle$. We define the available actions as per DFG as valid and all other actions as invalid. We use the state-of-the-art on-policy Proximal Policy Optimization (PPO) algorithm~\cite{schulman2017proximal} in our method. \textbf{PPO} ~\cite{schulman2017proximal} has been widely used in the RL community due to its ease of implementation, superior performance, and less hyper-parameter tuning requirement. We use the \emph{Advantage Actor-Critic} version of PPO. A policy $\pi: s \rightarrow a $ is estimated based on the interaction of agent with environment. In state $s_t$, the Actor takes the action $a_t$ according to the current policy $\pi_{\theta}(s_t, a_t)$ resulting in a trajectory $T$ and reward $r_t$. $\theta$ represents neural networks parameters. \begin{equation} T = \left(s_{t}, a_{t}, \pi_{\theta}(s_t, a_t), r_{t}\right): 1 \leq t \leq M \label{T_eqn} \end{equation} where, M is the total number of time-steps the model takes. The $r_t$ received is then evaluated by Critic which outputs the value of state $v(s_t)$. The advantage function $A_{t}$ gives information about the extra reward an agent can get by taking the action $a_t$. $A_t$ is calculated as the difference between Q-value $Q^\pi_{\theta}(s_t, a_t)$ and $v(s_t)$. $Q^\pi_{\theta}(s_t, a_t)$ is the sum of current reward and estimated future rewards discounted by $\gamma$ obtained by taking action $a_t$ at time t according to $\pi_{\theta}(s_t, a_t)$. \begin{equation} Q^\pi_{\theta}(s_t, a_t) = r_{t}+\gamma r_{l+1}+\gamma^{2} r_{t+2} \cdots+\gamma^{N} r_{t+N} \end{equation} where, $N$ is number of time-steps for which the future reward is estimated. The loss functions are used in a similar manner as described in \cite{schulman2017proximal}. \textbf{Variable action space} There are two ways to handle variable action space: (1) Giving a large negative reward for invalid actions, (2) \textit{Action masking}: Masking out the actions as valid or invalid in order to sample action only from valid actions. We experiment with both approaches. For Action masking, we experiment with the maskable-PPO technique proposed in \cite{tang2020implementing}. \textbf{Maskable-PPO} Action masking-based PPO~\cite{tang2020implementing} is implemented by modifying the original PPO implementation as follows: (1) Trajectory $T$ (Eq. \ref{T_eqn}) is collected only for valid actions. (2) Only valid actions are used to calculate stochastic descent. Softmax value is used at the end of the output layer. For re-normalization, softmax value is computed only for valid actions. The probability of invalid actions is made zero, and the action probabilities are re-normalized. \textbf{Comparison with other RL algorithms} We compare the on-policy PPO-based proposed method with the state-of-the-art off-policy Deep-Q-Network (DQN) algorithm~\cite{mnih2013playing}. In contrast to on-policy, the agent takes random actions to determine $Q$ values in off-policy (without a policy). To handle variable action space, we experiment with both PPO and DQN by giving a large negative reward for invalid actions. The comparison of the results are discussed in Section~\ref{results}. \vspace{-0.6cm} \subsubsection{Trade-off} The current reward function can become biased towards the activities that consistently satisfy the goals. Consider the example of a loan approval process with two possible process outcomes: \emph{loan approved} and \emph{loan rejected} with the goal of the completion time ($G(\sigma, time) \leq \omega$). It may be possible that the time for processing an application with the outcome as \emph{loan rejected} is less as compared to the outcome \emph{loan approved}. The existing reward function may learn to reject the loan, leading to high goal satisfaction but with a high bias for the outcome of the process, which is undesirable. We address this limitation by considering an additional secondary goal that allows us to match the process outcome of the generated sequences with the ground truth distribution of process outcome. We provide an example of one such secondary goal, but our approach is flexible to accommodate other definitions of secondary goals (e.g., equal distribution of tasks to resources). Hence, an additional balancing reward $\delta r_i$ (Table \ref{tab:reward-function-2}) is used to achieve a trade-off that supports the primary goal based on the KPI and secondary goals. The balancing reward $\delta r_i$ tries to mimic the distribution of different process outcomes using the ground truth traces. For this, we provide a reward at the states which majorly contribute towards the process outcome along with the reward $r$. We hypothesize that the last $k$ activities of a trace can influence the process outcome the most. The value of $k$ could vary with different processes. Therefore, for these $k$ activities, if the action $a$ chosen by the agent is equal to the ground truth event ($gt$), we provide a positive reward of +0.5 else penalize with the reward of -0.5. \vspace{-1cm} \begin{table}[H] \centering \caption{Balancing reward factor $\delta r_i$} \begin{tabular}{c|c} \textbf{a=gt}& \textbf{a!=gt}\\ \hline \hline +0.5 & -0.5 \end{tabular} \label{tab:reward-function-2} \end{table} \vspace{-0.8cm} We denote $\delta r_k$ as cumulative balancing reward for last $k$ activities. \vspace{-0.2cm} $$ \delta r_k = \sum_{i=1}^{k} \delta r_i$$ The final reward $r'$ becomes: $r' = r + \delta r_k$. Hence, there is a trade-off between the percentage of traces that satisfy the primary goal and the secondary goal, mitigating the skewness. \section{Experimental Evaluation} \label{sec:eval} In this section, we describe the datasets used to evaluate our method under different experimental settings along with training details. We also compare our method with next best action recommendation baseline. \subsection{Datasets} We use 4 real-world event datasets popularly used to evaluate activity prediction tasks. The descriptive statistics of these event logs are shown in Table~\ref{tab:datasets}. The \#activity denotes the number of unique activities present in dataset, and $|\sigma|$ is the sequence length. \begin{itemize} \item \textbf{Helpdesk}: An event log of a ticket management system of an Italian software company\footnote{\url{https://data.4tu.nl/articles/dataset/12675977}}. \item \textbf{BPIC12W}: An event log of a loan application process of a Dutch Financial institution\footnote{\url{https://data.4tu.nl/articles/dataset/12689204}}. \item \textbf{Road Traffic Fine Management Process}: An event log of a road traffic fine management system\footnote{\url{https://data.4tu.nl/articles/dataset/12683249}}. \item \textbf{BPIC2019}: An event log of purchase order handling process data from a large multinational company operating from The Netherlands\footnote{\url{https://data.4tu.nl/articles/dataset/12715853}}. \end{itemize} Traffic Fine and BPIC2019 data contains very large number of traces, hence, we randomly sample 10\% of the data for experimentation. \begin{table}[t] \centering \caption{Datasets used in experiments} \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline \textbf{Dataset}&\textbf{\#$\sigma$}& \textbf{\#events} & \textbf{\#activity} & \textbf{Mean $|\sigma|$} & $\mathbf{C\% }$& $\mathbf{dur_{avg}}$\textbf{(days)}&\textbf{$\omega$(days)}\\ \hline \hline Helpdesk & 3804 & 13710 & 10 & 3.60& 81.83 & 8.49 & 13.89\\ BPIC12W & 9658 & 72413 & 7 & 7.50& 68.41 & 15.72 & 24.001\\ Traffic Fine & 15037 & 56388 & 12 & 3.75& 83.60 & 342.41 & 607.04\\ BPIC2019 & 5241&31736& 31& 6.05& 67.16 & 625.50 & 791.23\\ \hline \end{tabular} \label{tab:datasets} \end{table} \subsection{Baselines} To the best of our knowledge, this is the first attempt to learn a goal-oriented activity recommendation model. Hence, there is no goal-oriented learning baseline available for comparison. Therefore, we compare our work with Next best action recommendation (NBA) by Weinzierl et. al \cite{weinzierl2020prescriptive} that reduce the non-conformant predictions using DCR (Dynamic Condition Response) graph. This baseline could be compared only for the helpdesk and BPIC2019 dataset because of the unavailability of the DCR graph for the other two datasets. For this baseline, the end of the trace is marked when the model predicts either $ \langle EOS \rangle$ or when the trace length exceeds the maximum allowed trace length in the dataset. We compare the percentage of recommendations that (1) satisfy the goals and (2) conform to DFG. We also compare the Damerau-Levenshtein (DL) distance between the recommended activity sequence and ground truth. \subsection{Experimental Setup} This section provides details of data pre-processing, KPI prediction model, and the RL agent. \vspace{-0.45cm} \subsubsection{Data Pre-processing} The event log contains traces each having a unique id i.e., $trace\_{id}$. Similar to the GANPred model by Taymouri et al. \cite{taymouri2020}, and Tax et al.\cite{tax2017}, we denote the time to complete an activity, i.e., the activity time, as the time difference between two consecutive activities in a trace in days. Hence, for an activity $a_i$ for an event $e_i$, the activity time $at_i$ is calculated as the difference between timestamp of the previous activity of the event i.e., $t_{i-1}$ and timestamp of the current activity of the event i.e., $t_i$. \vspace{-0.5cm} \subsubsection{KPI prediction model} We encode the activities using one-hot vector encoding. The model predicts the \emph{event time} for activities. We generate partial sequences for each trace in the event log. For example, for a complete sequence consisting of a total of 5 activities $\langle a, b, c, d, e \rangle$, we could consider up to 4 partial sequences i.e., $\langle a \rangle$, $\langle a, b \rangle$, $\langle a, b, c \rangle$, $\langle a, b, c, d \rangle$. We then train a separate model for each sequence length. Hence, an event log containing complete sequences of length $m$ would have $m-1$ models, each catering to a partial sequence of length 1 to $m-1$. A train-test split of 80-20 is used similar to~\cite{taymouri2020}. \vspace{-0.5cm} \subsubsection{For RL agent} The RL agent learns sequences from the input data. We want the RL agent to predict activity sequences that conform to the DFG. We also need to match the outcome of the sequence with the ground truth sequence outcomes in order to mitigate the skewness during learning. The ground truth sequences should also conform to the discovered DFG. But, often, the discovered DFG from the event log is an approximate representation and hence does reflect all the activity sequences~\cite{conformance2018}. Therefore, for fair training and comparison, we filter and use only the sequences that conform to the DFG for training RL agents. We take goal satisfaction threshold ($\omega$) as the third quartile value of case duration in the entire dataset for our experiments. The percentage of sequences in ground truth that conforms to DFG (C\%) along with $\omega$ is shown in Table \ref{tab:datasets}. We split this filtered dataset into train and test set, keeping a ratio of 65:35. We denote the average duration of a sequence by $dur_{avg}$ and report in Table \ref{tab:datasets}. Note that the validation set is not required since the RL agent is trained in an online manner \subsubsection{Experimental Details} We implemented our environment in Open-AI Gym \cite{1606.01540}. The RL agent is given the first activity of each sequence as input. It generates the complete sequence by choosing the next best action from the action space $A$, leading towards the goal satisfaction. First, we train the KPI model. It is then used by the RL agent to obtain the predicted KPI values for each action it chooses. The input to the KPI model is the partial sequence consisting of the first activity and subsequent activities chosen by the RL agent and the current action chosen by the RL agent to explore. The model then predicts the KPI corresponding to the current action chosen. Since the action space, i.e., the set of available actions at each state, varies according to the business process DFG, the exploration is based on the available actions, and the best action is chosen. PPO agent explores by sampling actions according to its stochastic policy, which keeps on changing as it learns. That means that the agent learns on the go and its experience changes the policy and hence the exploration. The next best action is chosen sequentially after each activity is predicted until the RL agent predicts the $\langle EOS \rangle$. Once $\langle EOS \rangle$ is predicted, the end reward is calculated along with the balancing reward (if enabled). We experiment with both scenarios and report the results with different $k$ values. We have considered sequence completion time (cumulative event time) as goal value with event time as KPI in our experiments. We define the goal as to minimize the time taken by each sequence with $\omega$ as GS threshold (see Table \ref{tab:datasets} for $\omega$ values). To accommodate for the errors in the KPI prediction model, we relax the goal satisfaction bound with $\pm$ MAE (mean absolute error) of the KPI prediction model at each sequence length. Since the KPI prediction model is trained for each partial sequence, therefore, MAE for each partial sequence length is available. We relax the bound by the cumulative sum of MAE's until the predicted sequence length. If a sequence $\sigma$ has a predicted partial sequence of length $m$, we compute the MAE as follows: \vspace{-0.3cm} $$ MAE(\sigma) = \sum_{i=1}^{m} MAE_i \\ $$ \vspace{-0.2cm} So our new GS condition becomes, $$ GS: G(\sigma) \pm MAE_{\sigma} \leq \omega $$ The ground truth contains both GS and GV sequences. The aim is to recommend the sequence that leads to goal satisfaction at the end. Therefore, we measure the percentage of GV sequences in ground truth for which the RL agent recommended the sequence that satisfied the goal. It is an important metric to measure the performance of RL agent. The learning rate for critic is taken as 0.001, the learning rate for actor as 0.0003, PPO epsilon clip as 0.2, PPO update frequency as 32000000 time-steps and discount factor ($\gamma$) as 0.99\footnote{\url{https://github.com/nikhilbarhate99/PPO-PyTorch}}. The KPI prediction model is trained over each sequence length for 25 epochs. It is trained on 1-2 CPU's with 2 GB memory each. The RL agent is trained on one 1040 GTX GPU and 10 CPU's each taking a memory of 2GB. RL agent is trained for 300-500 epochs. The RL agent is able to achieve near-optimal performance in 20 epochs. \begin{table*}[t]\small \centering \caption{Results on all Datasets} \begin{tabular}{|p{1.6cm}|p{1.1cm}|p{1.35cm}|p{2.2cm}|p{1.5cm}|p{1.8cm}|c|c|c|} \hline \textbf{Dataset} & \textbf{GS (GT)}\% & $\mathbf{MAE_{KPI}}$ \textbf{(days)} & \textbf{Reward type } & $\mathbf{GS_{pred}}$(\%) & \textbf{GV turned GS}\% & $\mathbf{Acc_{1} \%}$& $\mathbf{Acc_{2} \%}$ & $\mathbf{Acc_{3} \%}$ \\ \hline \multirow{4}{4em}{Helpdesk} & \multirow{4}{4em}{75.95} & \multirow{4}{4em}{0.9716}& $r$ &\textbf{90.87} &\textbf{90.83} & 100 & 60.70 & 46.49 \\ & & & $r'$ with $k=1$ & 88.51 & 90.71 & 100 & 60.56 & 47.07\\ & & & $r'$ with $k=2$ & 90.01 & 90.63 & 100 & \textbf{61.41} & 47.77 \\ & & & $r'$ with $k=3$ & 89.14 & 90.11 & 100 & 61.23 & \textbf{48.05} \\ \hline \multirow{4}{4em}{BPI1C2W} & \multirow{4}{4em}{76.41} & \multirow{4}{4em}{0.3052}& $r$ & \textbf{99.90} & \textbf{99.90} & 36.38 & 30.18 & 27.42 \\ & & & $r'$ with $k=1$ & 99.98 & 99.87 & \textbf{37.90} & 31.80 & 29.43\\ & & & $r'$ with $k=2$ & 99.94 & 99.93 & 36.65 & \textbf{36.04} & 28.54 \\ & & & $r'$ with $k=3$ & 90.87 & 90.86 & 36.46 & 31.43 & \textbf{35.94} \\ \hline \multirow{4}{4em}{$Traffic_{ss}$}& \multirow{4}{4em}{72.67} & \multirow{4}{4em}{39.8247}& $r$ & \textbf{99.99} & \textbf{99.98} & 30.84 & 32.07 & 28.54\\ & & & $r'$ with $k=1$ & 99.97 & 99.97 & \textbf{31.15} & 32.16 & 29.40 \\ & & & $r'$ with $k=2$ & 99.94 & 99.93 & 28.11 & 30.78 & 28.59\\ & & & $r'$ with $k=3$ & 99.12 & 99.11 & 30.92 & \textbf{32.26} & \textbf{29.49}\\ \hline \multirow{4}{4em}{$BPIC2019$}& \multirow{4}{4em}{80.32} & \multirow{4}{4em}{39.8247}& $r$ & \textbf{89.78} & \textbf{89.86} & 35.53 &32.14 & 28.78\\ & & & $r'$ with $k=1$ & 88.52 & 89.23 & \textbf{35.89} & 31.78& 28.38 \\ & & & $r'$ with $k=2$ & 88.21 & 89.23 & 35.19 & \textbf{32.67} & 28.38 \\ & & & $r'$ with $k=3$ & 86.48 & 86.51 & 34.22 & 31.93 & \textbf{30.63} \\ \hline \end{tabular} \label{tab:results} \end{table*} \begin{figure} \centering \includegraphics[scale=0.45]{mae.png} \caption{MAE of KPI prediction model for different sequence lengths. The MAE for $Traffic_{ss}$ and BPIC2019 is factored by 0.01 to fit in the plot} \label{fig:MAE} \end{figure} \vspace{-1cm} \subsection{Results and Discussion} \label{results} The results of our proposed method are shown in Table \ref{tab:results}. The column GS (GT) \% shows the percentage of sequences in the Ground Truth (GT) that satisfy the goal in the test set. We report the average MAE of KPI prediction model (in days) on overall sequence length in column $MAE_{KPI}$. The MAE is high for $Traffic_{ss}$ and BPIC2019 due to high average completion time of sequences in these datasets (see Table \ref{tab:datasets}). The MAE (as shown in Figure \ref{fig:MAE}) for different datasets on various sequence lengths decreases as the sequence length increases. The \textit{Reward type} column denotes the type of the reward being used i.e., $r$ (goal satisfaction) or $r'$ (goal satisfaction with balancing reward). The column \textit{$GS_{pred}$} shows the percentage of sequences recommended by our model that satisfies the goal. The column \textit{GV turned GS} shows the percentage of sequences in GT which were violating the goal (GV) for which our model is able to recommend the sequence that satisfies the goal (GS). We report the Accuracy $Acc_{k}$ for the last $k$ events as well. Computing accuracy on the last $k$ events enables comparison of the process outcome of the recommended sequences with the actual sequences. We report the results for $k = \{1,2,3\}$. All the results are reported as the average over 100 test episodes. As shown in Table \ref{tab:results}, $GS_{pred}$\% is highest with reward type $r$ for each dataset compared to other reward types. This is because of the trade-off between the primary goal and secondary goal, as discussed in Section 4.3. The trade-off is shown in Figure \ref{fig:tradeoff}, where, as the GS, and GV turned GS increases (indicating the primary goal), the $Acc_k$ decreases (representing the secondary goal). As observed, the $GS_{pred}$\% and GV turned GS\% (primary goal) drops slightly for reward types $r'$ but $Acc_k$ increases (secondary goal). Thus, the optimal $k$ value can be chosen depending on this trade-off. The high GV turned GS\% for all datasets demonstrates the efficacy of our proposed approach and modeling of reward function to recommend the sequences that satisfy the goals for a high number of GV sequences. This is because the crux of our proposed method lies in recommending the goal satisfying sequences for GV. The $Acc_{1}$ on the helpdesk always comes out to be 100\% because the BP-DFG graph of helpdesk has just one event before $\langle EOS \rangle$. Table \ref{tab:baselines} shows the comparison of our proposed method with NBA baseline~\cite{weinzierl2020prescriptive}. The conformance percentage $C$ for the baselines is not 100\%, which means that the recommendations by the baseline do not guarantee conformance to the process model. In contrast, our proposed method always recommends sequences that conform to the DFG. The $GS_{pred}$\% for the baseline is less due to the lack of modeling goal information. On the other hand, our proposed method performs lesser than baseline for $Acc_k$. The baseline is trained to select the nearest suffix and hence the activities from the GT, whereas the aim of our approach is to recommend the activity that will eventually satisfy the goal and, therefore, can differ from GT. Further, we also compare the Damerau–Levenshtein (DL) distance between the baseline (for $k$NN value as 15 as required by NBA) with our proposed approach. As shown in Figure \ref{fig:dl-distance}, the DL distance of our proposed approach for both datasets is much lower than the baseline. This shows that the exploration done by our RL agent is not too far from the GT and yet recommends the sequence of activities that satisfy the goals. \begin{table*}[t]\small \centering \caption{Comparison with NBA baseline} \begin{tabular}{|p{1.6cm}|c|c|c|c|c|c|c|} \hline \textbf{Dataset} &\textbf{Method}&$\mathbf{C \%}$ & $\mathbf{GS_{pred} \%}$ & $\mathbf{Acc_{1} \%}$& $\mathbf{Acc_{2} \%}$ & $\mathbf{Acc_{3} \%}$\\ \hline \midrule \multirow{2}{3em}{Helpdesk} & NBA~\cite{weinzierl2020prescriptive} & 84.63 & 82.31 & 70.23 & \textbf{64.71} & \textbf{63.00} \\ & Proposed Approach & \textbf{100} & \textbf{89.14} & \textbf{100} & 61.23 & 48.05\\ \hline \midrule \multirow{2}{3em}{BPIC2019} & NBA~\cite{weinzierl2020prescriptive} & 50.74 & 19.88 & \textbf{57.40} & \textbf{50.99} & \textbf{48.91} \\ & Proposed Approach & \textbf{100} & \textbf{86.48} & 34.22 & 31.93 & 30.63\\ \hline \end{tabular} \label{tab:baselines} \end{table*} \begin{figure} \centering \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=\textwidth]{helpdesk_dl_nbak15.png} \caption{Helpdesk} \label{fig:Helpdeskdl} \end{subfigure} \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=\textwidth]{bpic2019_dl_nbak15.png} \caption{BPIC2019} \label{fig:bpic2019dl} \end{subfigure} \caption{Comparison of DL distance from GT on helpdesk and BPIC2019 datasets} \label{fig:dl-distance} \end{figure} The results show that our proposed algorithm is able to recommend goal satisfying sequences on an average for 93\% of GV sequences. Further, in our experiments, goal satisfaction and balancing outcome were the two conflicting goals that our method is able to handle. To compare how close our method is able to mimic the process outcome distribution of GT and the baseline, we plot the distribution of the last $k$=1 activity of GT, baseline, and our proposed method as shown in Figure \ref{fig:distl}. The distribution is averaged over the number of activities in the test set of the baseline for a fair comparison. \begin{figure}[htb] \centering \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=\textwidth]{tradeoff.png} \caption{Trade-off accuracy between goal satisfaction and process outcome for Helpdesk} \label{fig:tradeoff} \end{subfigure} \begin{subfigure}[b]{0.47\textwidth} \centering \includegraphics[width=\textwidth]{k1_comparison_helpdesk.png} \caption{Comparison of last ($k$=1) recommended activity distribution on Helpdesk} \label{fig:distl} \end{subfigure} \caption{Trade-off accuracy and last $k$ activity distribution on Helpdesk} \end{figure} The baseline recommends just a few activities from GT, whereas our approach not only recommends all activities from GT but also discovers other possible activities. This is achieved with the help of the balancing reward. \begin{table*}[t]\small \centering \caption{Comparison of different RL algorithms for $k=3$ on Helpdesk} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Method} & $\mathbf{C \%}$ & $\mathbf{GS_{pred} \%}$ & $\mathbf{Acc_{1} \%}$& $\mathbf{Acc_{2} \%}$ & $\mathbf{Acc_{3} \%}$\\ \hline \midrule $PPO_{neg}$ & 95.58 & 10.603 & 29.32 & 24.50 & 21.56\\ $DQN_{neg}$ & 82.43 & 4.65 & 3.37 & 3.29 & 3.29\\ Maskable-PPO & \textbf{100} & \textbf{89.14} & \textbf{100} &\textbf{61.23} & \textbf{48.05} \\ \hline \end{tabular} \label{tab:dqn} \end{table*} The comparison between PPO and DQN with large negative reward, i.e., $PPO_{neg}$ and $DQN_{neg}$ along with Maskable-PPO is shown in Table \ref{tab:dqn}. The large negative reward value is set to $-4$ for the experiments. PPO being an on-policy method, performs way better than DQN because of its capability to learn stochastic policies and efficiently handle complex Q-functions. Maskable-PPO outperforms the large negative reward approach because a large negative reward hinders the exploration of the RL agent by shifting the aim to avoid non-conformant paths rather than focusing on choosing goal-satisfying paths. \section{Conclusion and Future Work} \label{sec:conclusion} In this paper, we proposed a reinforcement learning (RL) based method to predict the next best activity (and sequence) that satisfies specific goals and conforms to certain constraints. We motivate the need for such a framework in the application context of real-world business process executions. We further propose a method to handle conflicting goals. Our work is the first to build a goal-oriented next best activity (and sequence) recommendation model to the best of our knowledge. We would extend the current framework to include multiple goals as a part of future work. We also plan to incorporate the effect of data attributes present in the logs on recommendations. Further, we plan to incorporate our work in a decision recommendation platform that recommends next best actions to the knowledge workers based on goal satisfiability. \bibliographystyle{splncs04}
\section{Introduction} Star clusters are an integral building block of galaxies. Most stars form in clustered environments, and many of these stellar groupings disperse into the field of the galaxy over different timescales, ranging from a single crossing time to many Gyr, depending on the initial properties of the cluster. Star cluster formation mechanisms have been explored through a variety of computational simulations, many of which show that star cluster formation takes place through hierachical mergers of smaller subclusters comprised of groups of stars and gas. Simulations of cluster evolution provide insight into the timescales of these mergers as well as their effect on the components of the final star cluster. In most simulations, mergers happen quickly and cause an overall expansion of the resultant cluster's gas component (\citealt{BK2015}, \citealt{sills2018}). They also show us that this merger process takes place along dense gaseous filaments in giant molecular clouds (GMCs) and may eventually lead to the creation of a central massive cluster through multiple subcluster mergers (\citealt{Howard2018}, \citealt{li2019}, \citealt{lahen}). Observations support this formation mechanism as well. For example, a study of radial velocities of different stellar populations in the star cluster Westerlund 2 shows two distinct clumps on route to merging in the near future (\citealt{ziedler2021}). \citet{fujiizwart2012} also showed that the existence of runaway stars around the young cluster R136 could be explained through prompt subcluster mergers in a time frame of $3$ Myr. As a consequence of these mergers, star cluster masses can build to $\gtrsim 10^4$M$_\odot$ in times $\lesssim 4$Myr . The stellar component of such young clusters has not had enough time to expel the gaseous component through stellar feedback and supernovae and should therefore be modelled as a collection of stars and gas (\citealt{pelupessy2013}). GMC simulations, such as those performed by \citet{Howard2018} (hereafter, H18), involve regions with large density contrasts between the ambient GMC and star forming regions. Because subclusters were the most dense regions of their simulations, H18 used the sink particle prescription outlined in \citet{sink} to model them in their GMC. Each sink particle carries with it a set of parameters that describe the stellar cluster that it represents (e.g. position, velocity, total mass, and mass in stars). The sink particle size is dictated by a constant accretion radius proportional to the highest resolution obtainable by the hydrodynamics code being used. Once a merger takes place between two sink particles, the resulting sink particle will inherit the combined mass of its parent sinks; however, its accretion radius will remain unchanged. This sink particle approach to star cluster modelling is used to allow the hydrodynamics simulations to proceed with reasonable resolution over reasonable timescales. However, physical processes that occur on smaller scales such as gas expulsion (e.g \citealt{gb2001}, \citealt{bk2007}, \citealt{pelupessy2013}, \citealt{gasexp}) and mass segregation (\citealt{mass_seg}) cannot be followed. Cluster properties such as size and bound stellar and gas fractions have been found to change with cluster evolution (\citealt{pelupessy2013}). Understanding the internal evolution of the clusters, especially during and after cluster mergers, could have a significant impact on the final properties of the clusters formed in these simulations. In order to explore the detailed evolution of the merger of young star-forming clusters, we model the subcluster mergers seen in the H18 simulations explicitly, including gravitational interactions between the stars and gas in each subcluster. We analyze the resultant clusters and investigate how the distribution of stars and gas have been altered by the merger process. In section \ref{sec:setup} we discuss the initial conditions used to set up our star clusters. In section \ref{sec:rcp} we look at the resultant cluster properties of a sample merger. In section \ref{sec:suite} we generalize our results from section \ref{sec:rcp} for all our simulated mergers. In section \ref{sec:conc} we discuss our results and their implications to the general use of sink particles. \section{Method} \label{sec:setup} In the following sections, we discuss the numerical methods being used in our simulations, outline the process by which we initialize our isolated clusters, and describe the initial set up of our merger simulations. \subsection{Numerical Methods} Our simulations are performed using the Astrophysical Multipurpose Software Environment (AMUSE) (\citealt{zwart2009}, \citealt{pelupessy2013}) which contains many codes that evolve the equations of gravity and hydrodynamics. It also allows for communication between codes, allowing us to simultaneously simulate the dynamics of the stars and hydrodynamics of the gas in the cluster. For our N-body code we use \texttt{hermite0} (\citealt{hermite}) and for our smoothed particle hydrodynamics (SPH) code we use \texttt{GADGET-2} (\citealt{gadget2}). For the communication scheme, we use \texttt{BRIDGE} (\citealt{bridge}) with \texttt{BHTree} (written by Jun Makino based on \citealt{tree}) as the connecting algorithm. This scheme feeds outputs from one of the solvers (i.e. positions, velocities, and masses) to the other so that the stars may react to changes in the gas properties, and the gas may react to changes in the star's properties. This communication procedure happens once every bridge timestep $t_B$, which should be sufficiently small that energy is conserved, while still allowing for resonable simulation times. For our simulations, a choice of $t_B \approx 800$yr is reasonable. \subsection{Isolated Clusters} We set up initial conditions for our individual clusters using parameters taken from the H18 sink particles, specifically, the mass in stars $M_{*}$ and the mass in gas $M_g$. The initial distributions of our N-body and SPH particles follow a Plummer (\citealt{plummer1911}) sphere with a scale radius chosen such that the half mass density of the cluster starts as $\rho_{hm} = 10^3M_\odot/pc^3$. This density choice is consistent with observed densities of young massive clusters (\citealt{zwart}). Given a $\rho_{hm}$, and the total mass of the cluster, we can calculate the half mass radius $r_{hm}$ which we convert to a Plummer scale radius using $a \approx 1.3r_{hm}$. This allows us to simulate a wider range of cluster masses without running into extremely small timesteps which arise from high gas densities (\citealt{courant1928}). We set the gravitational softening of the stars to be $0.001a$ for each simulation. This results in an average softening length of $155$AU throughout our suite. We note that the sink particle accretion radius used in H18 $r_{\rm sink}$ is $\approx 1.7$pc. We do not require that all our stars or gas are contained within this radius in these simulations. The mass of SPH particles in our simulations is $0.06M_\odot$, resulting in a smoothing length $h \approx 0.01$pc initially. Stellar masses are sampled from a Kroupa (\citealt{kroupa2001}) IMF between $0.15M_\odot$ and $100M_\odot$. The gas temperature is chosen to be $10$K, consistent with GMC temperatures from H18. We assign each particle a velocity which we sample using the method outlined in \citet{aarseth}. We calculate the velocity dispersion of our stellar and gas component separately and scale the velocities of each such that both are initially in virial equilibrium ($2K_{s,g}/|P_{s,g}| = \alpha_{s,g} = 1$). \begin{figure} \centering \includegraphics[scale=0.35]{core_rad.png} \caption{Evolution of the core radii of the stars and gas of an isolated cluster during the numerical relaxation phase.} \label{fig:relax} \end{figure} \begin{figure} \centering \includegraphics[scale=0.28]{parameter_space.png} \caption{The parameter space from which our collisions are sampled. Circles represent all mergers seen in the H18 simulation, with red points showing all first mergers, and black points showing second and subsequent mergers or higher. Blue stars show the mergers we model for our simulations, some of which are directly taken from H18 (stars on top of red circles).} \label{fig:parameter_space} \end{figure} Next, we allow our cluster to evolve on its own. We do this so that the stars can have time to react to the new potential introduced by the gas, and vice versa. In order to decide when our clusters are numerically relaxed, we look at the evolution of the core radii for the stars and gas as a function of time, as shown in figure \ref{fig:relax} for a representative cluster. Up until $0.21$Myr, the core radii are decreasing drastically after which both become stable. This effect comes from both stellar and gas components reacting to the potential of the other. In this example we take the snapshot of this cluster after $t = 0.21$Myr as our initial conditions for our merger simulation. This corresponds to roughly 0.01 N-body times. The decrease in the core radius results in $\rho_{hm}$ increasing from the initial $10^3$M$_\odot$pc$^{-3}$. However, the half-mass radius does not change as much as the core radius, and so the value of $\rho_{hm}$ stays below $10^4$M$_\odot$pc$^{-3}$. \subsection{Merger Setup: The Creation of the Resultant Cluster} \label{sec:merger} We select merger pairs from the solar metallicity H18 simulation based on the mass ratio of the pair ($f_M = M_{MM}/M_{LM}$ where $M_{MM}$ and $M_{LM}$ are the total masses of the more and less massive cluster respectively) and the relative velocity of the colliding clusters ($v_{LM}$). A plot of this parameter space from the H18 simulation is shown in figure \ref{fig:parameter_space}. For this paper, we have limited the mass ratio range to be from 0 to 30; there are also 2 mergers that have mass ratios of $\approx 100$ and $\approx 400$. "First contact" mergers, shown as red circles in this figure, are the first merger that occurs for a given star cluster after it has formed. The resultant cluster can then go on to merge with other clusters as the H18 simulation proceeds, and we highlight those mergers as black circles. We simulate 5 of these first contact mergers (labelled run 1-5 in table \ref{tab:collisions} and shown as blue stars on top of red circles in figure \ref{fig:parameter_space}). We choose only first contact mergers for these simulations because we can assume that the star cluster before the merger was a simple system (a Plummer sphere), whereas the resultant cluster after a merger may not be so simple (as we will demonstrate in section \ref{sec:rcp}). These 5 mergers provide us with 10 individual clusters for our initial conditions. We also simulate mergers that were not present in H18 (shown as isolated blue stars in figure \ref{fig:parameter_space}). To do this, we collide two of our clusters, but not with their counterpart from the H18 simulation. For example, we take the less massive cluster from the run3 pair and simulate its merger with the more massive cluster from the run1 pair in table \ref{tab:collisions} and the run is labelled run3to1. We create other initial conditions by modifying the collision velocity $v_{LM}$ while keeping all other parameters the same as an H18 collision. These runs are labelled as run$x$$\_$$y$v where $x$ is the label of the H18 model run whose velocity we are changing, and $y$ is the factor by which we multiply $v_{LM}$ for that run. To set up each collision, we take the relaxed state of the most massive cluster, and place it at $(x,y,z)=(0,0,0)$ with no net velocity. The relaxed state of less massive cluster is placed a distance $x=d$, away from more massive cluster and is given a velocity $v_{LM}$ in the x-direction towards the origin. All of our mergers are head on collisions. We do not include stellar evolution or stellar feedback. Therefore, we should not evolve our simulations past the first expected supernovae as this is the time when most to all of the gas mass has been removed from a star cluster (e.g \citealt{pelupessy2013}, \citealt{chevance}). We run all our simulations for a maximum of $3$Myr. \begin{table*} \centering \begin{tabular}{c|c|c|c|c|c|c} Run number & $M_{MM,s} [10^4M_\odot]$ & $M_{MM,g} [10^4M_\odot]$ & $M_{LM,s} [10^4M_\odot]$ & $M_{LM,g} [10^4M_\odot]$ & $d [pc]$ & $v_{LM} [km s^{-1}]$\\ \hline 1 & 0.3 & 2.1 & 0.2 & 1.2 & 2.7 & 2.3\\ 2 & 0.06 & 0.3 & 0.02 & 0.2 & 2.4 & 2.8\\ 3 & 0.1 & 0.8 & 0.06 & 0.4 & 4.9 & 4.7\\ 4 & 0.4 & 1.6 & 0.1 & 0.3 & 2.9 & 6.5\\ 5 & 0.4 & 0.5 & 0.3 & 0.3 & 3.3 & 10\\ \hline 2to3 & 0.1 & 0.8 & 0.02 & 0.2 & 2.4 & 2.8\\ 2to5 & 0.4 & 0.5 & 0.02 & 0.2 & 2.4 & 3.4\\ 3to1 & 0.3 & 2.1 & 0.06 & 0.4 & 4.9 & 4.7\\ 3to4 & 0.4 & 1.6 & 0.06 & 0.4 & 4.9 & 4.7\\ 2$\_$2v & 0.06 & 0.3 & 0.02 & 0.2 & 2.4 & 5.6\\ 2to1 & 0.3 & 2.1 & 0.02 & 0.2 & 2.4 & 2.8\\ 2to4 & 0.4 & 1.6 & 0.02 & 0.2 & 2.4 & 7.0\\ 2$\_$2.8v & 0.06 & 0.3 & 0.02 & 0.2 & 2.4 & 7.8\\ 3$\_$2v & 0.1 & 0.8 & 0.06 & 0.4 & 4.9 & 9.4\\ 4$\_$2.5v & 0.4 & 1.6 & 0.1 & 0.3 & 2.9 & 16 \end{tabular} \caption{Parameters for our H18 merger runs. Column 1: the name of the run, column 2: the mass of the more massive cluster in stars, column 3: mass of the more massive cluster in gas, column 4: mass of the less massive cluster in stars, column 5: mass of the less massive cluster in gas, column 6: the initial separation along the $x$-axis of the two clusters, column 7: the x-velocity kick given to the less massive cluster towards the origin. The horizontal line splits the models taken directly from H18 sinks and those given some alteration. Runs are ordered by increasing collisional velocity.} \label{tab:collisions} \end{table*} \begin{figure*} \centering \includegraphics[scale=0.24]{gas_dens1.png} \includegraphics[scale=0.24]{gas_dens211.png} \includegraphics[scale=0.24]{gas_dens411.png} \includegraphics[scale=0.24]{gas_dens671.png} \includegraphics[scale=0.24]{gas_dens861.png} \includegraphics[scale=0.24]{gas_dens1001.png} \caption{Snapshots of the stars and gas from merger run3 leading up to the monolithic time. The circles represent the stars from each cluster (orange belong to less massive cluster, blue belong to more massive cluster) and the gas is shown in black with darker regions showing gas with higher density. Size of the filled circles scales with mass of the star. Time is taken with respect to the beginning of the simulation. The left panel on the second row shows the merger at $t = 0.7$Myr $= t_{col}$ (the collision time) and the right panel on the second row shows the merger at $t = 1.1$Myr $= t_{mon}$ (the monolithic time).} \label{fig:model1} \end{figure*} \section{Resultant Cluster Properties} \label{sec:rcp} We begin with a discussion of a typical merger from our sample (run3 in table \ref{tab:collisions}). The total masses of the more and less massive clusters in the merger are 0.9 and 0.5 $\times 10^4$M$_\odot$, mostly consisting of gas for this particular run. This mass ratio of $f_{\rm M} \approx 2$ and a collisional velocity of $v_{LM} = 4.7$kms$^{-1}$ places this merger in the region of parameter space where we find most of the first contact mergers from H18. Most of the mass of both clusters resides within $r_{sink} \approx 1.7$pc (80\% of the more massive cluster mass, 90\% of the less massive cluster's mass). Snapshots of this merger can be seen in figure \ref{fig:model1}. The gas density is shown as the greyscale with a minimum at 1 M$_\odot$pc$^{-3}$ and a maximum of 10$^5$M$_\odot$pc$^{-3}$, while the stars are shown as blue or orange circles. At $t \approx 0.7$Myr, the centres of the gas distributions for the two clusters overlap for the first time. We denote this time as the collision time $t_{col}$. From $t_{col}$ until the end of our simulation, the gas remains as a single entity. However, the stars behave more like a collisionless system, and the lower-mass cluster stars pass through the higher-mass cluster before either being dispersed or returning towards the centre of mass. At about $0.4$Myr after the collision a single monolithic cluster is formed. We denote this time as $t_{mon}$, and calculate it by determining the centre of the inner 5\% of stars (approximately the percentage of stars within the core radius of the original clusters). When the difference between those two centres remains smaller than the original core radius of the most massive cluster, we say that the resultant cluster is monolithic. We can now analyze properties of the stellar and gas components of the resultant cluster after the merger has taken place. \subsection{Bound Fraction} \label{sec:size} \begin{figure} \centering \includegraphics[scale=0.3]{pb_tot.png} \caption{Bound mass percentages of the resultant cluster's stellar (blue) and gas (orange) components after the collision. The black dashed line shows the monolithic time of this simulation.} \label{fig:unbound} \end{figure} \begin{figure*} \centering \includegraphics[scale=0.35]{l_all_with_core_s.png} \includegraphics[scale=0.35]{l_all_with_core_g.png} \caption{$75$\% mass radii (dashed), half mass radii (solid), and core radii (dot-dashed) of bound stellar (left) and gas (right) component for the resultant cluster after the cluster has become monolithic. The green line indicates the sink radius prescribed in the H18 simulations ($r_{sink} \approx 1.7$pc).} \label{fig:bounds} \end{figure*} A property of the sink particle prescription used in H18 is that all mass inside each sink remains in the sink throughout the entire simulation. When two parent sink particles merge, the resultant sink mass will simply be the sum of the masses of each parent. We can test this approximation by looking at the bound percentage of stellar and gas mass in the resultant cluster after the merger takes place. This can be seen in figure \ref{fig:unbound} for run3. We consider a particle bound when its $T + U < 0$ where $T$ is its kinetic energy, and $U$ is the potential of both stars and gas. We see that by the end of this simulation, $\approx 3$\% of stellar mass and $\approx 16$\% of gas mass has become unbound. Therefore, we conclude that for this collision, the assumption of no mass loss in the sink particle prescription is reasonable. Most of the decrease in bound stellar mass happens between $t_{col}$ and $t_{mon}$, as stars that initially belonged to the less massive cluster are flung out of the gravitational pull of the resultant cluster. These results are consistent with simulations done by \citet{BK2015} who see a negligible amount of unbound stellar mass in merger simulations with an analytic gas potential. As well, N-body simulations done by \citet{tvr2} show that $\lessapprox$ 10\% of their stellar mass becomes unbound after the merger of two equal mass Plummer spheres. \subsection{Cluster Size} \label{sec:cluster_size} We can now look at the Lagrangian radii of the resultant cluster. We look at the core, half mass, and 75\% mass radii of the bound mass (stars or gas) in the resultant cluster, and compare them to the H18 sink radius of 1.7 pc in figure \ref{fig:bounds}. We see that the core radius remains stable for the entire simulation after $t_{mon}$ at $r_c \approx 0.2$pc and $r_c \approx 0.1$pc for the stellar and gas components respectively. Similarly, the half-mass radii remain approximately constant as well, and are well below the sink radius of 1.7 pc. However, if we look at the 75\% Lagrangian radius of each component, we see that they are both greater than $r_{sink}$. Therefore, a significant amount of the resultant cluster mass is outside the boundary set in the H18 simulation. To make the comparison with the H18 simulation a little clearer, we show the evolution of the 90\% Lagrangian radius of the entire resultant cluster (bound stars and gas together), normalized by the 90\% Lagrangian radius of the more massive cluster of the collision, in figure \ref{fig:new_sink}. The outermost region of the cluster continues to grow to the end of our simulation. Because the sink particle prescription allows gas accretion to take place if gas is within one $r_{sink}$ and gravitationally bound to the cluster, we conclude that a sink particle prescription which does not allow this growth in radius may be accreting less gas than it should, and may result in a smaller final mass for the clusters formed in H18. The magnitude of this discrepancy is dependant on how prompt the secondary merger process is. If the resultant cluster merges with another cluster quickly after it is formed, the cluster will not have had enough time to significantly grow, meaning that only a small fraction of extra gas would be added to the resultant sink. However, the longer it takes for a resultant cluster to undergo another merger, the larger the cluster grows and the more mass it may accrete. \begin{figure} \centering \includegraphics[scale=0.35]{l90_rc.png} \caption{Time evolution of the 90\% Lagrangian radius for the total (stars + gas) resultant cluster, normalized to that same radius for the most massive parent cluster.} \label{fig:new_sink} \end{figure} \subsection{Best Fit Radial Density Profiles} \label{sec:dens_prof} We now turn our attention to the radial density profiles of the resultant cluster. In this analysis we treat the stars and gas of the resultant cluster separately and include only the bound members of each component. It would be convenient for future simulations if we could identify an analytic or simple density profile for the result of a cluster merger. Therefore, we fit commonly used density profiles to the bound stellar and gas components of the resultant cluster. We consider the Plummer, \citet{eff} (EFF) model, and the \citet{king} models for our fits. Plummer models have been used in a variety of numerical simulations to initialize stars and gas (e.g \citealt{pelupessy2013}, \citealt{BK2015}, \citealt{sills2018}) as have King models (e.g \citealt{gb2001}, \citealt{king_ex1}). The EFF model is given by \begin{equation} \rho(r) = \rho_{0}(1 + \frac{r^2}{a^2})^{-{\frac{\gamma+1}{2}}} \label{eq:eff} \end{equation} The two parameters allowed to vary above are the scale radius $a$, and the slope of the density tail $\gamma$. Note that the Plummer density profile is a special case of \ref{eq:eff} with $\gamma = 4$. The \citet{king} model has two parameters that are allowed to vary: the tidal radius of the cluster $r_t$ and the dimensionless central potential $W_0$. We calculated the King density profile using \texttt{galpy}\footnote{\href{https://github.com/jobovy/galpy}{https://github.com/jobovy/galpy}} (\citealt{galpy}) and to calculate the density profile of our simulated resultant cluster, we use the \texttt{python} package \texttt{Clustertools}\footnote{\href{https://github.com/webbjj/clustertools}{https://github.com/webbjj/clustertools}} which creates radial bins of equal numbers of particles and calculates the density in each bin. Our bins are centered on the density centre (\citealt{zwart})). For both the stellar and gas components, we find that our choice of density centre over centre of mass does not greatly affect our best fit parameters for any of our models. We choose radial bins containing 80 stars or 2000 gas particles. We then use the \texttt{python} function \texttt{curve\_fit} from \texttt{scipy} (\citealt{scipy}) which uses the Levenberg-Marquardt (LM) method (\citealt{LM}) to calculate the best fit parameters for each model. We performed this fit from $t_{mon}$ to the end of the simulation. We show a snapshot of the resultant cluster's density profile overplotted with the three best fit functions at one timestep in figure \ref{fig:dens_sample}. We find that the general shape of the profiles (high density in the centre, low density in the outskirts) matches all of the models. Compared to our initial Plummer profile, we find that the merger process has steepened the surface density in the outskirts of our stellar and gas density profiles (a $\gamma = 4$ profile becomes closer to a $\gamma = 5$ profile). In the inner regions, both the stars and the gas have smaller cores. The $W_0 = 8$ for the stellar King profile and $W_0 = 9$ for the gas King profile are consistent with a more centrally concentrated cluster. However, none of the models ever provide a satisfactory fit to the simulated density profile. We conclude that these three analytical models cannot be used to describe our resultant cluster after the merger process. In order to achieve a good representation of such a cluster, we must continue to use the results of our numerical simulations directly. \begin{figure} \centering \includegraphics[scale=0.35]{run3_denss.png} \includegraphics[scale=0.35]{run3_densg.png} \caption{Stellar and gas radial density profiles plotted with best fit profiles from three theoretical functions: Plummer (dot-dashed), EFF (dotted), and King (dashed). The shaded regions show one standard deviation in the density calculation for a given radial bin.} \label{fig:dens_sample} \end{figure} \subsection{Star Formation Density Thresholds} In the H18 simulations, the sinks form in gas above a density threshold of 10$^4$ cm$^{-3}$ and it is assumed that all the gas inside the sink has that density for the rest of the simulation. Star formation in H18 takes place with a constant efficiency per freefall time assuming that density. Their sinks are sampled every 0.36 Myr to determine how many stars should form. We track the amount of dense gas in our clusters and how that changes throughout the run3 merger. In particular, we look at the gas with densities above 10$^{4}$cm$^{-3}$ and 10$^{5}$cm$^{-3}$ which are commonly quoted density ranges above which dense star-forming cores begin to form (e.g \citealt{evans09}, \citealt{heid10}, \citealt{lada2010}, \citealt{lada2012}). We show the percentage of gas above 10$^4$cm$^{-3}$ in figure \ref{fig:sf_densn}. At the beginning of our simulation, the amount of gas above 10$^4$cm$^{-3}$ is only about 65\%, compared to the 100\% assumed for the H18 sink particles. This percentage increases just after the moment of collision (green vertical line), but does not last for long compared to the timescale at which H18 samples their sinks to form stars (0.36Myr). Shortly after the collision time, only about half of the gas in the cluster has density above 10$^4$cm$^{-3}$. Therefore we see that for run3, the merger process results in a decrease in potentially star forming gas in the resultant cluster. Gas above 10$^5$cm$^{-3}$ shows a very similar trend. This trend of an increase in star forming gas followed by a decline in such gas was also found in the star cluster formation simulations presented in \citet{fujii2021}. \begin{figure} \centering \includegraphics[scale=0.35]{SF_above_e4.png} \caption{Percentage of gas above $10^4$cm$^{-3}$ throughout run3. The green line shows the collision time $t_{col}$ for this merger simulation.} \label{fig:sf_densn} \end{figure} \section{Exploring the Parameter Space} \label{sec:suite} In this section, we present the results of our full suite of simulations. We first show the time needed to form a single monolithic cluster as a function of the collisional velocity in figure \ref{fig:t_mon_par}. We note that three simulations never form a single cluster ($t_{mon}$ exceeds the length of the simulation $t_{sim}$), indicated on the plot with "x" symbols and arrows. We will discuss those in section \ref{sec:non-monolithic}. We find that, as expected, a higher collisional velocity leads to longer time for the two clusters to fully merge. The relationship between $t_{mon} - t_{col}$ and the mass ratio ($f_M$) is less clear, but in general a higher mass ratio results in a longer time for the resultant cluster to become monolithic. We note that in the H18 simulations, the average time between first and subsequent collisions is about 0.4 Myr, and therefore many of our mergers simulated here will not yet have resulted in monolithic clusters before their next encounter occurs. This means it is even more critical that we use detailed simulations of cluster mergers to understand the build-up of massive clusters. \subsection{Monolithic Resultant Clusters} We find that for most of our mergers, $\lesssim 5$\% of the stellar mass becomes unbound from our resultant cluster, as long as the collision creates a single resultant cluster. Mergers with higher collisional velocity and lower mass ratios tend to lose more mass. In our most extreme monolithic simulation, run3\_2v, which has a collisional velocity of $v_{LM} \approx 9.4$kms$^{-1}$ and mass ratio $f_M \approx 2$, we lose $12$\% of the stellar mass. The unbound gas mass percentage behaves in a similar way (strong dependence on $v_{LM}$ and no clear dependence on $f_M$). However, the unbound gas mass percentage never exceeds 20\% of the initial gas mass. \begin{figure} \centering \includegraphics[scale=0.5]{parameter_space_T_com.png} \caption{Time after the collision for the two clsuters to become one monolithic structure, plotted against the collisional velocity of each simulation. The colour bar gives the mass ratio of each merger. We show both the monolithic ($t_{mon} < t_{sim}$) simulations as solid circles and the non-monolithic ($t_{mon} > t_{sim}$) simulations as crosses with arrows. The arrows indicate that this is a lower limit of the monolithic time for the non-monolithic simulations.} \label{fig:t_mon_par} \end{figure} \begin{figure*} \centering \includegraphics[scale=0.45]{STAR_INNER_non_MONO.png} \caption{Inner Lagrangian radii of the stellar component of the resultant cluster, normalized by that radius of the more massive parent cluster, plotted against mass ratio for monolithic and non-monolithic simulations. The colour bar shows the collisional velocity of given merger.} \label{fig:inner} \end{figure*} We show the core radii and half-mass radii of the stars at 1 Myr after the monolithic time, as a function of the mass ratio of the merger and the collisional velocity, in figure \ref{fig:inner}. We find that most of the resultant clusters are larger than their original parent cluster, and there is a strong dependence of this growth on the mass ratio. At low $f_M$, because the masses of both clusters are similar, the core of the resultant cluster has gained a significant amount of new stellar mass. As we get to higher $f_M$ values, we are looking at more minor mergers and the resultant cluster's growth is less affected by the less massive cluster, causing the plateau at $r/r_{MM} \approx 1$ for high $f_M$. We find that the collisional velocity does not have an effect on the growth of the core radius, but does have a small effect on the half mass radius. The gas component of the resultant clusters is also larger than that of the parent clusters, but in this case we find that the growth of the gas component is sensitive to both the collisional velocity and the mass ratio. We show the values of the 90\% Lagrangian radius for the full resultant cluster (stars and gas) for each simulation, normalized by that simulation's $L_{90,MM}$ plotted for all monolithic simulations in figure \ref{fig:L90}. The colour bar shows the collisional velocity of the merger. Most of our monolithic clusters continue to expand for the duration of our simulation, suggesting that a constant sink radius may not be an accurate description of merged clusters. \begin{figure} \centering \includegraphics[scale=0.35]{l_90_vlm.png} \caption{The 90\% Lagrangian radii of the entire bound stellar and gas content of the resultant cluster normalized by that of the entire more massive cluster as a function of time after $t_{mon}$ for every merger whose resultant cluster is one monolithic structure. The colour bar shows the collisional velocity of the merger.} \label{fig:L90} \end{figure} We find that the density profiles of all our monolithic clusters have similar shapes as those shown for run3 in figure \ref{fig:dens_sample} and that all stellar components show a high central concentration (King profile $W_0 \approx 8$). However, as expected, none of the simple density profiles provide good fits to either the stellar or gas density profile. We conclude that any simulations which follow the building of a massive cluster from the merger of subclusters should use computed profiles of merged clusters at the appropriate time, rather than being able to use simpler models for the results of the first merger. \subsection{Non-Monolithic Simulations} \label{sec:non-monolithic} We now briefly discuss the simulations where the two clusters do not form a single entity by the end of our simulation. An example of such a simulation can be seen in figure \ref{fig:non-mono}. \begin{figure*} \centering \includegraphics[scale=0.24]{full_plot1.png} \includegraphics[scale=0.24]{full_plot151.png} \includegraphics[scale=0.24]{full_plot411.png} \includegraphics[scale=0.24]{full_plot671.png} \includegraphics[scale=0.24]{full_plot861.png} \includegraphics[scale=0.24]{full_plot1001.png} \caption{Same as figure \ref{fig:model1} but for run2\_2.8v, one of our non-monolithic simulations. The collision time for this simulation occurs at $t = 0.3$ Myr} \label{fig:non-mono} \end{figure*} The three simulations that satisfy this criteria are run2\_2p8v, run5, and run4\_2p5v (table \ref{tab:collisions}). They all have collisional velocities $\gtrsim$ 10kms$^{-1}$ and have fairly low mass ratios $f_M \lesssim 5$. The simulations have different final properties -- one of them forms a single gas cloud but not a single stellar cluster, and the other two both continue to show two separate gas clouds and two stellar components. We find that these three simulations lose much more bound stellar and gas mass than the monolithic simulations. We find that the change in stellar core and half-mass radii for the non-monolithic simulations does not follow the same trend as the monolithic simulations (see figure \ref{fig:inner}, where the 'x' symbols show the final properties of the individual stellar clusters compared to their initial values). Most importantly, however, is the fact that these collisions do not result in mergers, in contradiction to the assumption in H18. One of these collisions is a first-contact merger from H18 (run5) so the fact that it does not, in fact, result in a single monolithic cluster even after 3 Myr may have significant implications for the build-up of massive clusters. \section{Summary and Discussion} \label{sec:conc} We have taken simulation results from \citet{Howard2018} (H18), who found subcluster formation in the filaments of a GMC, and we have resolved their sink particles into detailed models of stars and gas. We have extracted 10 subclusters from the H18 simulations and created detailed models of their stellar and gaseous distribution. We ran 15 merger simulations using these clusters. We found that all resultant clusters lose a small fraction of their bound stars and gas after the merger, but that this fraction increases significantly when we simulate mergers with collisional velocities $\gtrsim 10$kms$^{-1}$. We find that the outermost regions of most of our clusters grow continuously by the end of our simulations, suggesting that the sink particles may be artificially small. We also found that the merger process decreases the amount of gas above star forming densities in the cluster, suggesting that the sink particle prescription may be over-forming stars. We also found that some of our collisions did not result in monolithic clusters, and that others took a long time to form a single cluster. The sink particle size and its affect on the accretion of surrounding gas onto the sink particle has been studied in larger scale galaxy and GMC simulations. One example is the converging galactic flows simulation performed by \citet{dobbs_pettitt} who find that through increasing their accretion radius by a factor of $\approx 2.5$, the mass attainable by a sink particle can increase by one order of magnitude. It may be necessary for the treatment of merging sink particles to include something like a "radius of influence" that can change with time in the simulation, and more accurately represent the size of the population inside the sink. Our suite of simulations outlines the region of parameter space most occupied by first contact mergers (see figure \ref{fig:parameter_space}). More simulations can help strengthen trends we see in our results. In particular, it would be helpful to model the higher velocity regime where second contact or higher mergers take place. A larger sample size in this regime can help us better understand the conditions for creating a single stellar cluster after a collision. Furthermore, the degree of importance of non-monolithic mergers in GMC simulations may be a byproduct of of the initial conditions of that simulation. For example, \citet{H16} find that velocities of sink particles can be much larger in simulations with lower initial virial parameter (more bound) due to stronger two body interactions. As well, our simulations only involve clusters on the low mass end of those formed in the H18 simulations. The response of higher mass clusters to the merger process is key in understanding the entire formation of the final clusters. We also model all of our subcluster mergers as head on collisions. We know that off-axis collisions can result in significantly different structures of the collision product \citep[e.g.]{Sills2001}. We will address many of these questions in future work. We have treated the initial conditions of the stellar population in a fairly simplistic way -- a Plummer sphere, no stellar evolution, and we do not include binary stars. Binaries have been shown to increase the number of high velocity, unbound stars (runaway stars) around star clusters (\citealt{leanard}) and provide an energy source that can heat clusters. \citet{fujiizwart2012} show that the cluster merger process increases the number of newly formed binaries thus resulting in an increase in runaway stars within 3 Myr. The authors find an average of $\approx$ 5 of the cluster's stars become runaway stars at 3 Myr. The inclusion of a binary star prescription would therefore only slightly increase the unbound stellar mass percentage in our simulations showing that our simulations provide a lower limit to the unbound stellar mass that is the result of mergers. Our simulations of mergers of gas-rich young stellar clusters have shown that they are far from simple. This work provides some hints of the complexity of processes and outcomes that can occur during the build-up of star clusters during their formation. Our future work will investigate these areas further, with the ultimate goal of following cluster merger trees from simulations like H18, and building up young clusters in detail. \section*{Acknowledgements} The authors thank Claude Cournoyer-Cloutier, Michelle Nguyen, Marta Reina-Campos, Veronika Dornan, and Aiyman Mourad for helpful discussions. The authors also thank the anonymous referee for careful reading and constructive comments. AS is supported by the Natural Sciences and Engineering Research Council of Canada. This research was enabled in part by support provided by Compute Ontario (https://www.computeontario.ca) and Compute Canada (http://www.computecanada.ca). \section*{Data Availability} The simulations described in this paper are available upon reasonable request to the corresponding author. \bibliographystyle{mnras}
\section*{Acknowledgments} This work was supported in part by the Mathematical Data Science program of the Office of Naval Research under grant number N00014-18-1-2764 and by the Vannevar Bush Faculty Fellowship program under grant number N00014-21-1-2941. \bibliographystyle{plainnat} \section{Introduction}\label{sec:intro} Let $\mathbb{R}^d$ be a finite-dimensional Euclidean space and let $\mathcal{X} \subseteq \mathbb{R}^d$ be a closed, convex and bounded set with a diameter $D > 0$. Given that $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is a continuous operator, a basic assumption in optimization theory, generalizing convexity, is that $F$ is \textit{monotone}: \begin{equation*} \langle F(x) - F(x'), x- x'\rangle \geq 0, \quad \textnormal{for all } x, x' \in \mathbb{R}^d. \end{equation*} Another useful assumption in many settings is that $F$ is smooth; in particular, that it has with Lipschitz-continuous $(p-1)^{\textnormal{th}}$-order derivative ($p \geq 1$) in the sense that there exists a constant $L > 0$ such that \begin{equation}\label{eq:smooth} \|\nabla^{(p-1)} F(x) - \nabla^{(p-1)} F(x')\| \leq L\|x - x'\|, \quad \textnormal{for all } x, x' \in \mathbb{R}^d. \end{equation} With these assumptions, we can formulate the main problem of interest in this paper---the \textit{Minty variational inequality} problem~\citep{Minty-1962-Monotone}. This consists in finding a point $x^\star \in \mathcal{X}$ such that \begin{equation}\label{prob:Minty} \langle F(x), x- x^\star\rangle \geq 0, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation} The solution to Eq.~\eqref{prob:Minty} is referred to as a \textit{weak} solution to the variational inequality (VI) corresponding to $F$ and $\mathcal{X}$~\citep{Facchinei-2007-Finite}. By way of comparison, the \textit{Stampacchia variational inequality} problem~\citep{Hartman-1966-Some} consists in finding a point $x^\star \in \mathcal{X}$ such that \begin{equation}\label{prob:Stampacchia} \langle F(x^\star), x- x^\star\rangle \geq 0, \quad \textnormal{for all } x \in \mathcal{X}, \end{equation} and the solution to Eq.~\eqref{prob:Stampacchia} is called a \textit{strong} solution to the VI corresponding to $F$ and $\mathcal{X}$. In the setting where $F$ is continuous and monotone, the solution sets of Eq.~\eqref{prob:Minty} and Eq.~\eqref{prob:Stampacchia} are equivalent. However, these two solution sets are different in general and a weak solution needs not exist even when a strong solution exists. In addition, computing an approximate strong solution involves a higher computational burden than finding an approximate weak solution~\citep{Monteiro-2010-Complexity,Monteiro-2011-Complexity,Chen-2017-Accelerated}. VIs capture a wide range of problems in optimization theory and beyond, including saddle-point problems and models of equilibria in game-theoretic settings~\citep{Cottle-1980-Variational,Kinderlehrer-2000-Introduction,Tremolieres-2011-Numerical}. Moreover, the challenge of designing solution methods for the VIs with provable worst-case complexity bounds has been a central topic during several past decades; see~\citet{Harker-1990-Finite} and \citet{Facchinei-2007-Finite} and references therein. These foundations have been inspirational to machine learning researchers in recent years, where general saddle-point problems have found applications, including generative adversarial networks (GANs)~\citep{Goodfellow-2014-Generative} and multi-agent learning in games~\citep{Cesa-2006-Prediction,Mertikopoulos-2019-Learning}. Some applications in ML induce a non-monotone structure, with examples including the training of robust neural networks~\citep{Madry-2018-Towards} or robust classifiers~\citep{Sinha-2018-Certifiable}. Building on seminal work in convex and nonconvex optimization~\citep{Baes-2009-Estimate,Birgin-2017-Worst}, we tackle the challenge of developing $p^{\textnormal{th}}$-order methods for VIs via inexact solutions of regularized subproblems based on a $(p-1)^{\textnormal{th}}$-order Taylor expansion of $F$. Accordingly, we make the following assumptions throughout this paper. \begin{itemize} \item[\textbf{A1}.] $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is smooth with up to $(p-1)^{\textnormal{th}}$-order derivatives available to the algorithm. \item[\textbf{A2}.] The subproblem based on a $(p-1)^{\textnormal{th}}$-order Taylor expansion of $F$ and a convex and bounded set $\mathcal{X}$ can be computed approximately in an efficient manner (see Section~\ref{sec:DE} for details). \end{itemize} For the first-order VI methods ($p=1$),~\citet{Nemirovski-2004-Prox} has shown that the extragradient (EG) method~\citep{Korpelevich-1976-Extragradient,Antipin-1978-Method} will converge to a weak solution with a global rate of $O(\epsilon^{-1})$ if $F$ is monotone and Eq.~\eqref{eq:smooth} holds. There are other methods that achieve the same rate, including the optimistic gradient method~\citep{Popov-1980-Modification,Mokhtari-2020-Convergence,Kotsalis-2020-Simple}, the forward-backward splitting method~\citep{Tseng-2000-Modified} and the dual extrapolation method~\citep{Nesterov-2007-Dual}. All the aforementioned methods match the lower bound of~\citep{Ouyang-2021-Lower} and are thus optimal. Comparing to their first-order counterpart, the investigations of second-order and high-order methods ($p \geq 2$) are relatively rare, as exploiting the high-order derivative information is much more involved for VIs~\citep{Nesterov-2006-Constrained,Monteiro-2012-Iteration}. Aiming to fill this gap, recent work has generalized classical methods from first-order to high-order, including the extragradient method~\citep{Bullins-2020-Higher,Lin-2021-Monotone} and the optimistic gradient method~\citep{Jiang-2022-Generalized}. These generalizations are guaranteed to achieve a global rate of $O(\epsilon^{-2/(p+1)}\log(1/\epsilon))$ but all require a nontrivial binary search procedure at each iteration. This binary search procedure can be computationally expensive from a practical viewpoint. Thus, the problem of finding a simple high-order method with a rate of $O(\epsilon^{-2/(p+1)})$ remains open. Indeed,~\citet[Page 305]{Nesterov-2018-Lectures} noted the difficulty of removing the binary search procedure without sacrificing the rate of convergence and highlighted this as an open and challenging question. We summarize the problem as follows: \begin{center} \textbf{Can we design a simple $p^{\textnormal{th}}$-order method with a global rate of $O(\epsilon^{-2/(p+1)})$?} \end{center} In this paper we present an affirmative answer to this problem by identifying a $p^{\textnormal{th}}$-order method that achieves a global rate of $O(\epsilon^{-2/(p+1)})$ while dispensing entirely with the binary search inner loop. The main idea of the proposed method is to incorporate a simple yet novel adaptive strategy into a high-order extension of the dual extrapolation method. Concurrently appearing on arXiv,~\citet{Adil-2022-Line} established similar global convergence rate for solving smooth and monotone VIs without requiring a binary search procedure. Our results were derived independently from theirs. More concretely, our contribution can be summarized as follows: \begin{enumerate} \item We present a new $p^{\textnormal{th}}$-order method for solving smooth and monotone VIs where $F$ is sufficiently smooth with Lipschitz continuous $(p-1)^{\textnormal{th}}$-order derivative and $\mathcal{X}$ is convex and bounded. We prove that the number of calls of subproblem solvers required by our method to find an $\epsilon$-weak solution is bounded by \begin{equation} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p+1}}\right), \end{equation} which shaves off a factor of $\log(1/\epsilon)$ in the state-of-the-art rates achieved by existing $p^{\textnormal{th}}$-order methods~\citep{Bullins-2020-Higher,Lin-2021-Monotone,Jiang-2022-Generalized}. Moreover, we present a restarted version of our method for solving smooth and strongly monotone VIs, and show that the number of calls of subproblem solvers required to find $\hat{x} \in \mathcal{X}$ satisfying $\|\hat{x} - x^\star\| \leq \epsilon$ is bounded by \begin{equation} O\left((\kappa D^{p-1})^{\frac{2}{p+1}}\log_2\left(\frac{D}{\epsilon}\right)\right), \end{equation} where $\kappa = L/\mu$ refers to the generalized condition number of $F$ (see Section~\ref{sec:prelim}). In addition, the restarted version of our method achieves local superlinear convergence for the case of $p \geq 2$. \item We show how to modify our framework such that it can be used for solving smooth and non-monotone VIs satisfying the Minty condition. Again we note that a binary search procedure is not required. We prove that the number of calls of subproblem solvers to find an $\epsilon$-strong solution is bounded by \begin{equation} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p}}\right). \end{equation} The restarted version is developed for solving smooth and non-monotone VIs satisfying the strong Minty condition and the number of calling subproblem solvers required to find $\hat{x} \in \mathcal{X}$ satisfying $\|\hat{x} - x^\star\| \leq \epsilon$ is bounded by \begin{equation} O\left(\max\{(\kappa_{\textnormal{Minty}} D^{p-1})^{\frac{2}{p}}, (\kappa_{\textnormal{Minty}} D^{p-1})^{\frac{2}{p+1}}\}\log_2\left(\frac{D}{\epsilon}\right)\right), \end{equation} where $\kappa_{\textnormal{Minty}} = L/\mu_{\textnormal{Minty}}$ refers to the Minty condition number of $F$ (see Section~\ref{sec:prelim}). In addition, the restarted version of our method achieves local superlinear convergence for the case of $p \geq 2$. \end{enumerate} \paragraph{Further related work.} In addition to the aforementioned work, we briefly review a line of related research on high-order methods for convex optimization, monotone variational inequalities, and monotone inclusion problems. We focus on the $p^{\textnormal{th}}$-order methods for $p \geq 2$ and leave first-order methods out of our discussion. To the best of our knowledge, the systematic investigation of the global convergence rate of second-order methods originates in work on the cubic regularization of Newton's method (CRN)~\citep{Nesterov-2006-Cubic} and its accelerated counterpart (ACRN)~\citep{Nesterov-2008-Accelerating}. The ACRN method was then extended with a $p^{\textnormal{th}}$-order regularization model, yielding an improved rate of $O(\epsilon^{-1/(p+1)})$~\citep{Baes-2009-Estimate} while an adaptive $p^{\textnormal{th}}$-order method was proposed in~\citet{Jiang-2020-Unified} with the same rate. This extension was recently revisited by~\citet{Nesterov-2021-Implementable} and~\citet{Grapiglia-2022-Adaptive} with a thorough discussion on an efficient implementation of a third-order method. Meanwhile, within the alternative accelerated Newton proximal extragradient (ANPE) framework~\citep{Monteiro-2013-Accelerated}, a $p^{\textnormal{th}}$-order method was proposed by~\citet{Gasnikov-2019-Near} with a global rate of $O(\epsilon^{-2/(3p+1)}\log(1/\epsilon))$ for minimizing a smooth and convex function whose $p^{\textnormal{th}}$-order derivative is Lipschitz continuous. Their methods match a lower bound~\citep{Arjevani-2019-Oracle} up to log factors. Subsequently, the $p^{\textnormal{th}}$-order ANPE framework was extended to minimizing a smooth and strongly convex function~\citep{Marques-2022-Variants} and achieved a global linear rate. Beyond the setting with Lipschitz continuous $p^{\textnormal{th}}$-order derivatives, the aforementioned $p^{\textnormal{th}}$-order methods have been adapted to a more general setting with H\"{o}lder continuous $p^{\textnormal{th}}$-order derivatives~\citep{Grapiglia-2017-Regularized,Grapiglia-2019-Accelerated,Grapiglia-2020-Tensor,Doikov-2021-Local,Song-2021-Unified}. Some other settings include structured nonsmooth minimization~\citep{Bullins-2020-Highly} and nonconvex smooth minimization~\citep{Cartis-2010-Complexity,Cartis-2011-Adaptive-I,Cartis-2011-Adaptive-II,Cartis-2019-Universal,Birgin-2016-Evaluation,Birgin-2017-Worst,Martinez-2017-High}. We also acknowledge the existence of a complementary line of research, due to~\citet{Nesterov-2021-Superfast}, that studies favorable properties of lower-order methods in the setting of higher-order smoothness~\citep{Nesterov-2021-Auxiliary,Nesterov-2021-Inexact,Doikov-2022-Affine}. Finally, we also note the existence of high-order methods obtained via discretization of continuous-time dynamical systems~\citep{Wibisono-2016-Variational,Lin-2021-Control}. In particular,~\citet{Wibisono-2016-Variational} showed that the ACRN method and its $p^{\textnormal{th}}$-order variants can be derived from implicit discretization of an open-loop system without Hessian-driven damping.~\citet{Lin-2021-Control} have provided a control-theoretic perspective on $p$-order ANPE methods by recovering these methods from implicit discretization of a closed-loop system with Hessian-driven damping. Both of these works prove the convergence rate of $p$-order ACRN and ANPE methods via appeal to simple Lyapunov function arguments. \paragraph{Organization.} The remainder of this paper is organized as follows. In Section~\ref{sec:prelim}, we present the basic setup for variational inequality (VI) problems and provide definitions for the class of operators and optimality criteria we consider in this paper. In addition, we review the dual extrapolation method. In Section~\ref{sec:DE}, we present our new method, its restarted version, and our main results on the global and local convergence guarantee for monotone and non-monotone VIs. In Section~\ref{sec:proof}, we provide the proofs for our main results. In Section~\ref{sec:conclu}, we conclude the paper with a discussion on future research directions. \paragraph{Notation.} We use lower-case letters such as $x$ to denote vectors and upper-case letters such as $X$ to denote tensors. Let $\mathbb{R}^d$ be a finite-dimensional Euclidean space (the dimension is $d \in \{1, 2, \ldots\}$), endowed with the scalar product $\langle \cdot, \cdot\rangle$. For $x \in \mathbb{R}^d$, we let $\|x\|$ denote its $\ell_2$-norm. For a tensor $X \in \mathbb{R}^{d_1 \times d_2 \times \ldots \times d_p}$, we define \begin{equation*} X[z^1, \cdots, z^p] = \sum_{1 \leq i_j \leq d_j, 1 \leq j \leq p} (X_{i_1, \cdots, i_p})z_{i_1}^1 \cdots z_{i_p}^p, \end{equation*} and let $\|X\|_\textnormal{op} = \max_{\|z^i\|=1, 1 \leq j \leq p} X[z^1, \cdots, z^p]$. Fixing $k \geq 0$ and letting $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ be a continuous and sufficiently smooth operator, we define $\nabla^{(k)} F(x)$ as the $k^{\textnormal{th}}$-order derivative at a point $x \in \mathbb{R}^d$ and write $\nabla^{(0)} F = F$. To be more precise, letting $z_1, z_2, \ldots, z_k \in \mathbb{R}^d$, we have \begin{equation*} \nabla^{(k)} F(x)[z^1, \cdots, z^k] = \sum_{1 \leq i_1, \ldots, i_k \leq d} \left(\frac{\partial F_{i_1}}{\partial x_{i_2} \cdots \partial x_{i_k}}(x)\right) z_{i_1}^1 \cdots z_{i_k}^k. \end{equation*} For a closed and convex set $\mathcal{X} \subseteq \mathbb{R}^d$, we let $\mathcal{P}_\mathcal{X}$ be the orthogonal projection onto $\mathcal{X}$ and let $\textbf{dist}(x, \mathcal{X}) = \inf_{x' \in \mathcal{X}} \|x' - x\|$ denote the distance between $x$ and $\mathcal{X}$. Finally, $a = O(b(L, \mu, \epsilon))$ stands for an upper bound $a \leq C \cdot b(L, \mu, \epsilon)$, where $C > 0$ is independent of parameters $L, \mu$ and the tolerance $\epsilon \in (0, 1)$, and $a = \tilde{O}(b(L, \mu, \epsilon))$ indicates the same inequality where $C > 0$ depends on logarithmic factors of $1/\epsilon$. \section{A Regularized High-Order Model and Algorithm}\label{sec:DE} In this section, we present our algorithmic derivation of \textsf{Perseus} and provide a theoretical convergence guarantee for the method. We provide intuition into why \textsf{Perseus} and its restarted version yield fast rates of convergence for variational inequality (VI) problems. We present a full theoretical treatment of the global and local convergence of \textsf{Perseus} and its restarted version for both the monotone setting and the non-monotone setting under the Minty condition. \subsection{Algorithmic scheme} We summarize our general $p^{\textnormal{th}}$-order method, which we denote formally as \textsf{Perseus}($p$, $x_0$, $L$, $T$, \textsf{opt}), in Algorithm~\ref{Algorithm:DE} where $p \in \{1, 2, \ldots\}$ is the order, $x_0 \in \mathcal{X}$ is an initial point, $L > 0$ is a Lipschitz constant for the $(p-1)^{\textnormal{th}}$-order smoothness, $T$ is an iteration number and $\textsf{opt} \in \{0, 1, 2\}$ is the type of output. Our new method can be interpreted as a natural generalization of the dual extrapolation method~\citep{Nesterov-2007-Dual} from first-order to general $p^{\textnormal{th}}$-order. The major novelty of our method lies in an adaptive strategy used for updating $\lambda_{k+1}$ (see \textbf{Step 4}). This modification is simple yet important. It serves as the key for obtaining a global rate of $O(\epsilon^{-2/(p+1)})$ (monotone) and $O(\epsilon^{-2/p})$ (non-monotone with the Minty condition) under Assumption~\ref{Assumption:smooth}. Focusing on the case of $p=2$ and the monotone setting, our results improve existing global convergence rates of $O(\epsilon^{-1})$~\citep{Nesterov-2006-Constrained} and $O(\epsilon^{-2/3}\log(1/\epsilon))$~\citep{Monteiro-2012-Iteration} under Assumption~\ref{Assumption:smooth} while not sacrificing the simplicity of the scheme. In addition, our methods allow the subproblem to be solved inexactly and we give options for choosing the type of outputs. \begin{algorithm}[!t] \begin{algorithmic}\caption{\textsf{Perseus}($p$, $x_0$, $L$, $T$, $\textsf{opt}$)}\label{Algorithm:DE} \STATE \textbf{Input:} order $p$, initial point $x_0 \in \mathcal{X}$, parameter $L$, iteration number $T$ and $\textsf{opt} \in \{0, 1, 2\}$. \STATE \textbf{Initialization:} set $s_0 = 0_d \in \mathbb{R}^d$. \FOR{$k = 0, 1, 2, \ldots, T$} \STATE \textbf{STEP 1:} If $x_k \in \mathcal{X}$ is a solution of the VI, then \textbf{stop}. \STATE \textbf{STEP 2:} Compute $v_{k+1} = \mathop{\rm{argmax}}_{v \in \mathcal{X}} \{\langle s_k, v - x_0\rangle - \frac{1}{2}\|v - x_0\|^2\}$. \STATE \textbf{STEP 3:} Compute $x_{k+1} \in \mathcal{X}$ such that Eq.~\eqref{condition:approximation} holds true. \STATE \textbf{STEP 4:} Compute $\lambda_{k+1} > 0$ such that $\frac{1}{20p-8} \leq \tfrac{\lambda_{k+1} L \|x_{k+1} - v_{k+1}\|^{p-1}}{p!} \leq \frac{1}{10p+2}$. \STATE \textbf{STEP 5:} Compute $s_{k+1} = s_k - \lambda_{k+1} F(x_{k+1})$. \ENDFOR \STATE \textbf{Output:} $\hat{x} = \left\{\begin{array}{cl} \tilde{x}_T = \frac{1}{\sum_{k=1}^T \lambda_k}\sum_{k=1}^T \lambda_k x_k, & \textnormal{if } \textsf{opt} = 0, \\ x_{k_T} \textnormal{ for } k_T = \mathop{\rm{argmin}}_{1 \leq k \leq T} \|x_k - v_k\|, & \textnormal{else if } \textsf{opt} = 1, \\ x_T, & \textnormal{otherwise.} \end{array}\right. $ \end{algorithmic} \end{algorithm} \paragraph{Comments on adaptive strategies.} It is worth mentioning that the adaptive strategies for updating $\lambda_{k+1}$ are inspired by revisiting the reason why existing $p^{\textnormal{th}}$-order methods all require a nontrivial binary search procedure. In particular, these existing methods compute a pair, $\lambda_{k+1} > 0, x_{k+1} \in \mathcal{X}$, that (approximately) solve the $x$-subproblem that contains $\lambda$ and the $\lambda$-subproblem that contains $x$. In particular, the conditions can be written as follows, \begin{equation*} \begin{array}{rl} & \alpha_{-} \leq \tfrac{\lambda_{k+1} L \|x_{k+1} - v_{k+1}\|^{p-1}}{p!} \leq \alpha_+ \textnormal{ for proper choices of } \alpha_- \textnormal{ and } \alpha_+, \\ & \langle F_{v_{k+1}}(x_{k+1}) + \lambda_{k+1}\|x_{k+1} - v_{k+1}\|^{p-1}(x_{k+1} - v_{k+1}), x - x_{k+1} \rangle \geq 0 \textnormal{ for all } x \in \mathcal{X}, \end{array} \end{equation*} where \begin{equation}\label{def:approximation} F_v(x) = F(v) + \langle \nabla F(v), x-v\rangle + \ldots + \tfrac{1}{(p-1)!}\nabla^{(p-1)} F(v)[x-v]^{p-1} + \tfrac{L}{(p-1)!}\|x - v\|^{p-1}(x - v), \end{equation} A key observation is that there can be some $x$-subproblems that do not need to refer to $\lambda$; e.g., the one used in Algorithm~\ref{Algorithm:DE}. Indeed, we compute $x_{k+1} \in \mathcal{X}$ that approximately satisfies the following condition: \begin{equation*} \langle F_{v_{k+1}}(x_{k+1}), x - x_{k+1} \rangle \geq 0 \textnormal{ for all } x \in \mathcal{X}. \end{equation*} It suffices to return $x_{k+1} \in \mathcal{X}$ with a good quality that further gives us $\lambda_{k+1} > 0$ using a simple update rule. Intuitively, such an adaptive strategy makes sense since $\lambda_{k+1}$ serves as the stepsize in the dual space and we need to be aggressive when the iterate $x_{k+1}$ approaches the set of optimal solutions to the VI. Meanwhile, the quantity $\|x_{k+1} - v_{k+1}\|$ can be used to measure the distance between $x_{k+1}$ and an optimal solution, and the power $p \in \{1, 2, \ldots\}$ quantifies the relationship between the closeness and the exploitation of high-order derivative information. In summary, $\lambda_{k+1}$ will be larger for a better iterate $x_{k+1} \in \mathcal{X}$ and such a choice leads to a faster global rate of convergence. \paragraph{Comments on inexact subproblem solving.} We remark that \textbf{Step 3} resorts to the computation of an approximate strong solution to the VI in which we define the operator $F_{v_{k+1}}(x)$ as the sum of a high-order polynominal and a regularization term. Indeed, it is a modification of Eq.~\eqref{def:approximation} as follows: \begin{eqnarray*} F_{v_{k+1}}(x) & = & F(v_{k+1}) + \langle \nabla F(v_{k+1}), x-v_{k+1}\rangle + \ldots + \tfrac{1}{(p-1)!}\nabla^{(p-1)} F(v_{k+1})[x-v_{k+1}]^{p-1} \\ & & + \tfrac{5L}{(p-1)!}\|x - v_{k+1}\|^{p-1}(x - v_{k+1}), \end{eqnarray*} where we write the VI of interest in the subproblem as follows: \begin{equation}\label{def:subproblem} \textnormal{Find } x_{k+1} \in \mathcal{X} \textnormal{ such that } \langle F_{v_{k+1}}(x_{k+1}), x - x_{k+1} \rangle \geq 0 \textnormal{ for all } x \in \mathcal{X}. \end{equation} Since $F_{v_{k+1}}$ is continuous and $\mathcal{X}$ is closed, convex and bounded,~\citet[Theorem~3.1]{Harker-1990-Finite} guarantees that a strong solution to the VI in Eq.~\eqref{def:subproblem} exists and the problem of finding an approximate strong solution is well defined. In the monotone setting, we can show that the VI in Eq.~\eqref{def:subproblem} is monotone and thus computationally tractable~\citep{Dang-2015-Convergence}, with the following approximation condition: \begin{equation}\label{condition:approximation} \sup_{x \in \mathcal{X}} \ \langle F_{v_{k+1}}(x_{k+1}), x_{k+1} - x\rangle \leq \tfrac{L}{p!}\|x_{k+1} - v_{k+1}\|^{p+1}. \end{equation} Indeed, if $p=1$, we have that $\nabla F_{v_{k+1}}(x) = L \cdot I_{d \times d}$ that is positive semidefinite for all $x \in \mathbb{R}^d$ where $I_{d \times d} \in \mathbb{R}^{d \times d}$ is an identity matrix. Otherwise, we have \begin{eqnarray*} \lefteqn{\nabla F_{v_{k+1}}(x) = \nabla F(v_{k+1}) + \ldots + \tfrac{1}{(p-2)!}\nabla^{(p-1)} F(v_{k+1})[x-v_{k+1}]^{p-2}} \\ & & + \tfrac{5L}{(p-1)!}\|x - v_{k+1}\|^{p-1}I_{d \times d} + \tfrac{5L}{(p-2)!}\|x - v_{k+1}\|^{p-2}(x - v_{k+1})(x - v_{k+1})^\top. \end{eqnarray*} Under Assumption~\ref{Assumption:smooth}, it is clear that \begin{equation*} \|\nabla F(x) - (\nabla F(v_{k+1}) + \ldots + \tfrac{1}{(p-2)!}\nabla^{(p-1)} F(v_{k+1})[x-v_{k+1}]^{p-2})\| \leq \tfrac{L}{(p-1)!}\|x - v_{k+1}\|^{p-1}. \end{equation*} This implies that \begin{equation*} \nabla F_{v_{k+1}}(x) \succeq \nabla F(x) + \tfrac{4L}{(p-1)!}\|x - v_{k+1}\|^{p-1}I_{d \times d} + \tfrac{L}{(p-2)!}\|x - v_{k+1}\|^{p-2}(x - v_{k+1})(x - v_{k+1})^\top. \end{equation*} Since $F$ is monotone, we have $\nabla F(x)$ is positive semidefinite for all $x \in \mathbb{R}^d$. This yields that $F_{v_{k+1}}$ is monotone and implies the desired result. As a consequence of our analysis, the VI in Eq.~\eqref{def:subproblem} admits relative strong monotonicity with respect to some reference function and we believe it can be solved by a modification of Bregman first-order methods~\citep{Lu-2018-Relatively,Grapiglia-2021-Inexact} with a linear rate of convergence. In the non-monotone setting, the VI in Eq.~\eqref{def:subproblem} is not necessarily monotone and the computation of an approximate strong solution is intractable in general~\citep{Daskalakis-2021-Complexity}. However, we note that $F_{v_{k+1}}$ is the sum of a high-order polynomial and a regularization term; this special structure might lend itself to efficient numerical methods. For example, we consider the setting where $F = \nabla f$ for a nonconvex and smooth function $f: \mathbb{R}^d \mapsto \mathbb{R}$ with a Lipschitz second-order derivative, $\mathcal{X} = \mathbb{R}^d$ and $p = 2$. Solving the VI in Eq.~\eqref{def:subproblem} is equivalent to solving the subproblem of the cubic regularization of Newton's method~\citep{Nesterov-2006-Cubic}: \begin{equation*} x_{k+1} = \mathop{\rm{argmin}}_{x \in \mathbb{R}^d} \ \langle \nabla f(v_{k+1}), x - v_{k+1}\rangle + \tfrac{1}{2}\langle x - v_{k+1}, \nabla^2 f(v_{k+1})(x - v_{k+1})\rangle + \tfrac{L}{3}\|x - v_{k+1}\|^3. \end{equation*} This optimization problem is nonconvex but can be solved approximately in an efficient manner. Examples of cubic solvers include generalized conjugate gradient methods with Lanczos process~\citep{Gould-1999-Solving,Gould-2010-Solving} and a simple variant of gradient descent~\citep{Carmon-2019-Gradient}. Can we generalize these solvers to handle the VI in Eq.~\eqref{def:subproblem}, similar to what has been accomplished in the optimization setting? This topic is beyond the scope of this paper and we leave it to future work. \begin{algorithm}[!t] \begin{algorithmic}\caption{\textsf{Perseus-restart}($p$, $x_0$, $L$, $\sigma$, $D$, $T$, $\textsf{opt}$)}\label{Algorithm:restart} \STATE \textbf{Input:} order $p$, initial point $x_0 \in \mathcal{X}$, parameters $L, \sigma, D$, iteration number $T$ and $\textsf{opt} \in \{0, 1, 2\}$. \STATE \textbf{Initialization:} set $t = \left\{ \begin{array}{cl} \lceil(\tfrac{2^{p+1}(5p-2)}{p!}\tfrac{LD^{p-1}}{\sigma})^{\frac{2}{p+1}}\rceil, & \textnormal{if } \textsf{opt} = 0, \\ \lceil(\tfrac{2^{p+2}(5p+1)}{p!}\tfrac{LD^{p-1}}{\sigma})^{\frac{2}{p}} + \left(\tfrac{2^{p+5}}{p!}\tfrac{LD^{p-1}}{\sigma}\right)^{\frac{2}{p+1}}\rceil, & \textnormal{elseif } \textsf{opt} = 1, \\ 1, & \textnormal{otherwise}. \end{array}\right.$ \FOR{$k = 0, 1, 2, \ldots, T$} \STATE \textbf{STEP 1:} If $x_k \in \mathcal{X}$ is a solution of the VI, then \textbf{stop}. \STATE \textbf{STEP 2:} Compute $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, \textsf{opt})$. \ENDFOR \STATE \textbf{Output:} $x_{T+1}$. \end{algorithmic} \end{algorithm} \paragraph{Restart version of \textsf{Perseus}.} We summarize the restarted version of our $p^{\textnormal{th}}$-order method in Algorithm~\ref{Algorithm:restart}. This method, which we refer to as \textsf{Perseus-restart}($p$, $x_0$, $L$, $\sigma$, $D$, $T$, $\textsf{opt}$), combines Algorithm~\ref{Algorithm:DE} with a restart scheme; see e.g., \citet{Nemirovskii-1985-Optimal,Nesterov-2013-Gradient,Donoghue-2015-Adaptive,Nesterov-2018-Lectures}. Intuitively speaking, the restart scheme stops an algorithm when a criterion is satisfied and then restarts the algorithm with an new input. It has been recognized as an important tool for designing linearly convergent algorithms when the objective function is strongly or uniformly convex~\citep{Nemirovskii-1985-Optimal,Nesterov-2013-Gradient,Ghadimi-2013-Optimal} or has other regularizing structure~\citep{Freund-2018-New,Necoara-2019-Linear,Renegar-2022-Simple}. Note that the strong monotonicity and the strong Minty condition are generalizations of the aforementioned regularity conditions for the VIs. Thus, it is natural to consider a restarted version of our method, hoping to achieve linear convergence. In particular, at each iteration of Algorithm~\ref{Algorithm:restart}, we use $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, \textsf{opt})$ as a subroutine. In other words, we simply restart \textsf{Perseus} every $t \geq 1$ iterations and take advantage of average iterates or best iterates to generate $x_{k+1}$ from $x_k$. In addition, it is worth mentioning that the choice of $t$ can be specialized to different settings and/or different type of convergence guarantees. Indeed, we set $\textsf{opt} = 0$ for the strong monotone setting, $\textsf{opt} = 1$ for the non-monotone setting satisfying the strong Minty condition and $\textsf{opt} = 2$ for a local convergence guarantee. Moreover, several papers focus on the investigation of the adaptive restart schemes that can speed up convergence of first-order methods~\citep{Giselsson-2014-Monotonicity,Donoghue-2015-Adaptive} and provide the theoretical guarantee for a general setting where the objective function is smooth and has H\"{o}lderian growth~\citep{Roulet-2017-Sharpness,Fercoq-2019-Adaptive}. However, most of these schemes are designed for a narrow family of first-order methods, and relies on learning appropriately-accurate approximations of problem parameters. To alleviate this issue,~\citet{Renegar-2022-Simple} propose a simple restart scheme which makes no attempt to learn parameter values and only require the information that would be available in practice. Note that Algorithm~\ref{Algorithm:restart} requires to choose $t \geq 1$ based on problem parameters and is thus not favorable in practice. Can we modify the existing adaptive restart schemes to speed up \textsf{Perseus}, similar to what was accomplished for first-order methods in optimization setting? We leave this topic to future works. \subsection{Main results} We provide our main results on the convergence rate for Algorithm~\ref{Algorithm:DE} and~\ref{Algorithm:restart} in terms of the number of calling the subproblem solvers. Note that Assumption~\ref{Assumption:smooth} will be made throughout and we impose the (strong) Minty condition (see Definition~\ref{def:Minty} and~\ref{def:S-Minty}) for the non-monotone setting. Two of the following theorems give us the global convergence rate of Algorithm~\ref{Algorithm:DE} and~\ref{Algorithm:restart} for the smooth and (strongly) monotone VIs in terms of the number of calling the subproblem solvers. \begin{theorem}\label{Thm:monotone-global} Suppose that Assumption~\ref{Assumption:smooth} holds true and $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is monotone and let $\epsilon \in (0, 1)$. There exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus}(p, x_0, L, T, 0)$ satisfies that $\textsc{gap}(\hat{x}) \leq \epsilon$ (i.e., $\hat{x}$ is an $\epsilon$-weak solution) and the total number of calling the subproblem solvers is bounded by \begin{equation*} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p+1}}\right), \end{equation*} where $p \in \{1, 2, \ldots\}$ is an order, $L > 0$ is a Lipschitz constant for $(p-1)^{\textnormal{th}}$-order smoothness of $F$ and $D > 0$ is the diameter of $\mathcal{X}$. \end{theorem} \begin{theorem}\label{Thm:monotone-restart} Suppose that Assumption~\ref{Assumption:smooth} holds true and $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is $\mu$-strongly monotone and let $\epsilon \in (0, 1)$. There exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus-restart}(p, x_0, L, \mu, D, T, 0)$ satisfies that $\|\hat{x} - x^\star\| \leq \epsilon$ and the total number of calling the subproblem solvers is bounded by \begin{equation*} O\left((\kappa D^{p-1})^{\frac{2}{p+1}}\log_2\left(\frac{D}{\epsilon}\right)\right), \end{equation*} where $p \in \{1, 2, \ldots\}$ is an order, $\kappa = L/\mu > 0$ is the generalized condition number of $F$, $D > 0$ is the diameter of $\mathcal{X}$ and $x^\star \in \mathcal{X}$ is the unique weak solution of the VI. \end{theorem} \begin{remark} For the first-order methods (the case of $p=1$), the convergence guarantee in Theorem~\ref{Thm:monotone-global} recovers a global rate of $O(L/\epsilon)$ achieved by the dual extrapolation method~\citep[Theorem~2]{Nesterov-2007-Dual}. The same rate was derived for other methods~\citep{Nemirovski-2004-Prox,Monteiro-2010-Complexity,Mokhtari-2020-Convergence,Kotsalis-2020-Simple} and was known to match the lower bound~\citep{Ouyang-2021-Lower}. For the second-order and high-order methods (the case of $p \geq 2$), our results improve the state-of-the-art results~\citep{Monteiro-2012-Iteration,Bullins-2020-Higher,Lin-2021-Monotone,Jiang-2022-Generalized} by shaving off the log factors thanks to the simplicity of our methods. \end{remark} \begin{remark} For the first-order methods, the convergence guarantee in Theorem~\ref{Thm:monotone-restart} recovers a global linear convergence rate achieved by the dual extrapolation method and other methods and matches the lower bound~\citep{Zhang-2021-Lower}. For the second-order and high-order methods, our results improve the results in~\citet{Jiang-2022-Generalized} by shaving off the log factors and we believe that these bounds can not be further improved despite the lack of lower bounds. \end{remark} We consider the smooth and non-monotone VIs satisfying the (strong) Minty condition and present the global convergence rate of Algorithm~\ref{Algorithm:DE} and~\ref{Algorithm:restart} in terms of the number of calling the subproblem solvers. \begin{theorem}\label{Thm:nonmonotone-global} Suppose that Assumption~\ref{Assumption:smooth} and the Minty condition hold true and let $\epsilon \in (0, 1)$. There exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus}(p, x_0, L, T, 1)$ satisfies that $\textsc{res}(\hat{x}) \leq \epsilon$ (i.e., $\tilde{x}_T$ is an $\epsilon$-strong solution) and the total number of calling the subproblem solvers is bounded by \begin{equation*} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p}}\right). \end{equation*} where $p \in \{1, 2, \ldots\}$ is an order, $L > 0$ is the Lipschitz constant for $(p-1)^{\textnormal{th}}$-order smoothness of $F$ and $D > 0$ is the diameter of $\mathcal{X}$. \end{theorem} \begin{theorem}\label{Thm:nonmonotone-restart} Suppose that Assumption~\ref{Assumption:smooth} and the $\mu_{\textnormal{Minty}}$-strong Minty condition hold true and let $\epsilon \in (0, 1)$. There exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus-restart}(p, x_0, L, \mu_{\textnormal{Minty}}, D, T, 1)$ satisfies that $\|\hat{x} - x^\star\| \leq \epsilon$ and the total number of calling the subproblem solvers is bounded by \begin{equation*} O\left(\max\{(\kappa_{\textnormal{Minty}} D^{p-1})^{\frac{2}{p}}, (\kappa_{\textnormal{Minty}} D^{p-1})^{\frac{2}{p+1}}\}\log_2\left(\frac{D}{\epsilon}\right)\right), \end{equation*} where $p \in \{1, 2, \ldots\}$ is an order, $\kappa_{\textnormal{Minty}} = L/\mu_{\textnormal{Minty}} > 0$ is the Minty condition number of $F$, $D > 0$ is the diameter of $\mathcal{X}$, and $x^\star \in \mathcal{X}$ is the weak solution of the VI. \end{theorem} \begin{remark} The convergence guarantee in Theorem~\ref{Thm:nonmonotone-global} and~\ref{Thm:nonmonotone-restart} has been derived for other first-order methods~\citep{Dang-2015-Convergence,Song-2020-Optimistic} for the case of $p = 1$ and are new for the case of $p \geq 2$ to our knowledge. In other words, we are the first to present the simple second-order and high-order methods for the smooth and non-monotone VIs satisfying the (strong) Minty condition with solid global convergence rate guarantee in the literature. \end{remark} Finally, we proceed to the local convergence property of our methods for both the strongly monotone VIs and the non-monotone VIs satisfying the strong Minty condition. \begin{theorem}\label{Thm:monotone-local} Suppose that Assumption~\ref{Assumption:smooth} holds true and $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is $\mu$-strongly monotone and let $\{x_k\}_{k \geq 0}$ be generated by $\textsf{Perseus-restart}(p, x_0, L, \mu, D, T, 2)$. Then, the following statement holds true, \begin{equation*} \|x_{k+1} - x^\star\| \leq \sqrt{\tfrac{2^p(5p-2)\kappa}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}}, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T, \end{equation*} where $\kappa = L/\mu > 0$ is the generalized condition number of the VI, $D > 0$ is the diameter of $\mathcal{X}$ and $x^\star$ is the unique weak solution of the VI. As a consequence, if $p \geq 2$ and the following condition holds true, \begin{equation*} \|x_0 - x^\star\| \leq \tfrac{1}{2}\left(\tfrac{p!}{2^p(5p-2)\kappa}\right)^{\frac{1}{p-1}}, \end{equation*} the iterates $\{x_k\}_{k \geq 0}$ will converge to $x^\star \in \mathcal{X}$ in at least a superlinear rate. \end{theorem} \begin{theorem}\label{Thm:nonmonotone-local} Suppose that Assumption~\ref{Assumption:smooth} and the $\mu_{\textnormal{Minty}}$-strong Minty condition hold true and let $\{x_k\}_{k \geq 0}$ be generated by $\textsf{Perseus-restart}(p, x_0, L, \mu_{\textnormal{Minty}}, D, T, 2)$. Then, the following statement holds true, \begin{equation*} \|x_{k+1} - x^\star\| \leq \left(\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)\|x_k - x^\star\|^p +\sqrt{\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}}. \end{equation*} where $\kappa_{\textnormal{Minty}} = L/\mu_{\textnormal{Minty}} > 0$ is the Minty condition number of the VI, $D > 0$ is the diameter of $\mathcal{X}$, and $x^\star$ is the weak solution of the VI. As a consequence, if $p \geq 2$ and the following condition holds true, \begin{equation*} \|x_0 - x^\star\| \leq \tfrac{1}{2}\left(\tfrac{p!}{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}\right)^{\frac{1}{p-1}}, \end{equation*} the iterates $\{x_k\}_{k \geq 0}$ will converge to $x^\star \in \mathcal{X}$ in at least a superlinear rate. \end{theorem} \begin{remark} The local convergence results in Theorem~\ref{Thm:monotone-local} and~\ref{Thm:nonmonotone-local} are derived for the second-order and high-order methods (i.e., the case of $p \geq 2$) and is posted as their advantage over first-order method if we hope to pursue high-accurate solutions. In this context,~\citet{Jiang-2022-Generalized} provided the same local convergence guarantee for the generalized optimistic gradient methods as our results in Theorem~\ref{Thm:monotone-local} but without counting the complexity bound of binary search procedure. The results in Theorem~\ref{Thm:nonmonotone-local} seems new and shed light to the potential of our methods for solving smooth and non-monotone VIs. \end{remark} \section{Convergence Analysis}\label{sec:proof} We present the convergence analysis for our $p^{\textnormal{th}}$-order method (Algorithm~\ref{Algorithm:DE}) and its restarted version (Algorithm~\ref{Algorithm:restart}). In particular, we provide global and local convergence guarantee for the monotone setting (Theorem~\ref{Thm:monotone-global} and~\ref{Thm:monotone-restart}) and the non-monotone setting under the Minty condition (Theorems~\ref{Thm:nonmonotone-global} and~\ref{Thm:nonmonotone-restart}). \subsection{Technical lemmas} We define a Lypanunov function for the iterates $\{x_k\}_{k \geq 0}$ generated by Algorithm~\ref{Algorithm:DE} as follows: \begin{equation}\label{def:Lyapunov-discrete} \mathcal{E}_k = \max_{v \in \mathcal{X}} \ \langle s_k, v - x_0\rangle - \tfrac{1}{2}\|v - x_0\|^2, \end{equation} This function will be used to prove technical results that pertain to the dynamics of Algorithm~\ref{Algorithm:DE}. \begin{lemma}\label{Lemma:DE-descent} Suppose that Assumption~\ref{Assumption:smooth} holds true. For every integer $T \geq 1$, we have \begin{equation*} \sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle \leq \mathcal{E}_0 - \mathcal{E}_T + \langle s_T, x - x_0\rangle -\tfrac{1}{10}\left(\sum_{k=1}^T \|x_k - v_k\|^2\right), \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} \end{lemma} \begin{proof} By combining Eq.~\eqref{def:Lyapunov-discrete} and the definition of $v_{k+1}$, we have \begin{equation*} \mathcal{E}_k = \langle s_k, v_{k+1} - x_0\rangle - \tfrac{1}{2}\|v_{k+1} - x_0\|^2. \end{equation*} Then, we have \begin{eqnarray}\label{inequality:DE-descent-first} \lefteqn{\mathcal{E}_{k+1} - \mathcal{E}_k} \\ & = & \langle s_{k+1}, v_{k+2} - x_0\rangle - \langle s_k, v_{k+1} - x_0\rangle - \tfrac{1}{2}\left(\|v_{k+2} - x_0\|^2 - \|v_{k+1} - x_0\|^2\right) \nonumber \\ & = & \langle s_{k+1} - s_k, v_{k+1} - x_0\rangle + \langle s_{k+1}, v_{k+2} - v_{k+1}\rangle - \tfrac{1}{2}\left(\|v_{k+2} - x_0\|^2 - \|v_{k+1} - x_0\|^2\right) \nonumber \end{eqnarray} By using the update formula for $v_{k+1}$ again, we have \begin{equation*} \langle x - v_{k+1}, s_k - v_{k+1} + x_0\rangle \leq 0, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} Letting $x = v_{k+2}$ in this inequality and using $\langle a, b\rangle = \frac{1}{2}(\|a+b\|^2 - \|a\|^2 - \|b\|^2)$, we have \begin{eqnarray}\label{inequality:DE-descent-second} \lefteqn{\langle s_k, v_{k+2} - v_{k+1}\rangle \leq \langle v_{k+1} - x_0, v_{k+2} - v_{k+1}\rangle} \\ & = & \tfrac{1}{2}\left(\|v_{k+2} - x_0\|^2 - \|v_{k+1} - x_0\|^2 - \|v_{k+2} - v_{k+1}\|^2\right). \nonumber \end{eqnarray} Plugging Eq.~\eqref{inequality:DE-descent-second} into Eq.~\eqref{inequality:DE-descent-first} and recalling the update formula of $s_{k+1}$, we obtain: \begin{eqnarray*} \lefteqn{\mathcal{E}_{k+1} - \mathcal{E}_k} \\ & \overset{\textnormal{Eq.~\eqref{inequality:DE-descent-second}}}{\leq} & \langle s_{k+1} - s_k, v_{k+1} - x_0\rangle + \langle s_{k+1} - s_k, v_{k+2} - v_{k+1}\rangle - \tfrac{1}{2}\|v_{k+2} - v_{k+1}\|^2 \\ & = & \langle s_{k+1} - s_k, v_{k+2} - x_0\rangle - \tfrac{1}{2}\|v_{k+2} - v_{k+1}\|^2 \\ & \leq & \lambda_{k+1}\langle F(x_{k+1}), x_0 - v_{k+2}\rangle - \tfrac{1}{2}\|v_{k+2} - v_{k+1}\|^2 \\ & = & \lambda_{k+1} \langle F(x_{k+1}), x_0 - x\rangle + \lambda_{k+1} \langle F(x_{k+1}), x - x_{k+1}\rangle \\ & & + \lambda_{k+1} \langle F(x_{k+1}), x_{k+1} - v_{k+2}\rangle - \tfrac{1}{2}\|v_{k+2} - v_{k+1}\|^2, \end{eqnarray*} for any $x \in \mathcal{X}$, Summing up this inequality over $k = 0, 1, \ldots, T-1$ and changing the counter $k+1$ to $k$ yields that \begin{eqnarray}\label{inequality:DE-descent-third} \lefteqn{\sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle \leq \mathcal{E}_0 - \mathcal{E}_T + \underbrace{\sum_{k=1}^T \lambda_k \langle F(x_k), x_0 - x\rangle}_{\textbf{I}}} \\ & & + \underbrace{\sum_{k=1}^T \lambda_k \langle F(x_k), x_k - v_{k+1}\rangle - \tfrac{1}{2}\|v_k - v_{k+1}\|^2}_{\textbf{II}}. \nonumber \end{eqnarray} Using the update formula for $s_{k+1}$ and letting $s_0 = 0_d \in \mathbb{R}^d$, we have \begin{equation}\label{inequality:DE-descent-fourth} \textbf{I} = \sum_{k=1}^T \langle \lambda_k F(x_k), x_0 - x\rangle = \sum_{k=1}^T \langle s_{k-1} - s_k, x_0 - x\rangle = \langle s_0 - s_T, x_0 - x\rangle = \langle s_T, x - x_0\rangle. \end{equation} Since $x_{k+1} \in \mathcal{X}$ satisfies Eq.~\eqref{condition:approximation}, we have \begin{equation}\label{opt:DE-main-update} \langle F_{v_k}(x_k), x - x_k\rangle \geq -\tfrac{L}{p!}\|x_k - v_k\|^{p+1}, \quad \textnormal{for all } x \in \mathcal{X}, \end{equation} where $F_v(x): \mathbb{R}^d \rightarrow \mathbb{R}^d$ is defined for any fixed $v \in \mathcal{X}$ as follows: \begin{eqnarray*} F_{v_k}(x) & = & F(v_k) + \langle \nabla F(v_k), x-v_k\rangle + \ldots + \tfrac{1}{(p-1)!}\nabla^{(p-1)} F(v_k)[x-v_k]^{p-1} \\ & & + \tfrac{5L}{(p-1)!}\|x - v_k\|^{p-1}(x - v_k). \end{eqnarray*} Under Assumption~\ref{Assumption:smooth}, we have \begin{equation}\label{opt:DE-main-smooth} \|F(x_k) - F_{v_k}(x_k) + \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1}(x_k - v_k)\| \leq \tfrac{L}{p!}\|x_k - v_k\|^p. \end{equation} Letting $x = v_{k+1}$ in Eq.~\eqref{opt:DE-main-update}, we have \begin{equation}\label{inequality:DE-descent-fifth} \langle F_{v_k}(x_k), x_k - v_{k+1}\rangle \leq \tfrac{L}{p!}\|x_k - v_k\|^{p+1}. \end{equation} Inspired by Eq.~\eqref{opt:DE-main-smooth} and Eq.~\eqref{inequality:DE-descent-fifth}, we perform a decomposition of $\langle F(x_k), x_k - v_{k+1}\rangle$ as follows, \begin{eqnarray*} \lefteqn{\langle F(x_k), x_k - v_{k+1}\rangle} \\ & = & \langle F(x_k) - F_{v_k}(x_k) + \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1}(x_k - v_k), x_k - v_{k+1}\rangle \\ & & + \langle F_{v_k}(x_k), x_k - v_{k+1}\rangle - \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1} \langle x_k - v_k, x_k - v_{k+1}\rangle \\ & \leq & \|F(x_k) - F_{v_k}(x_k) + \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1}(x_k - v_k)\|\|x_k - v_{k+1}\| \\ & & + \langle F_{v_k}(x_k), x_k - v_{k+1}\rangle - \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1} \langle x_k - v_k, x_k - v_{k+1}\rangle \\ & \overset{\textnormal{Eq.~\eqref{opt:DE-main-smooth} and Eq.~\eqref{inequality:DE-descent-fifth}}}{\leq} & \tfrac{L}{p!}\|x_k - v_k\|^p\|\|x_k - v_{k+1}\| + \tfrac{L}{p!}\|x_k - v_k\|^{p+1} \\ & & - \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1} \langle x_k - v_k, x_k - v_{k+1}\rangle \\ & \leq & \tfrac{2L}{p!}\|x_k - v_k\|^{p+1} + \tfrac{L}{p!}\|x_k - v_k\|^p\|\|v_k - v_{k+1}\| \\ & & - \tfrac{5L}{(p-1)!}\|x_k - v_k\|^{p-1} \langle x_k - v_k, x_k - v_{k+1}\rangle. \end{eqnarray*} Note that we have \begin{equation*} \langle x_k - v_k, x_k - v_{k+1}\rangle = \|x_k - v_k\|^2 + \langle x_k - v_k, v_k - v_{k+1}\rangle \geq \|x_k - v_k\|^2 - \|x_k - v_k\|\|v_k - v_{k+1}\|. \end{equation*} Putting these pieces together yields that \begin{equation*} \langle F(x_k), x_k - v_{k+1}\rangle \leq \tfrac{(5p+1)L}{p!}\|x_k - v_k\|^p\|\|v_k - v_{k+1}\| - \tfrac{(5p-2)L}{p!}\|x_k - v_k\|^{p+1}. \end{equation*} Since $\frac{1}{20p-8} \leq \frac{\lambda_k L \|x_k - v_k\|^{p-1}}{p!} \leq \frac{1}{10p+2}$ for all $k \geq 1$, we have \begin{eqnarray}\label{inequality:DE-descent-sixth} \textbf{II} & \leq & \sum_{k=1}^T \left(\tfrac{(5p+1)\lambda_k L}{p!}\|x_k - v_k\|^p\|\|v_k - v_{k+1}\| - \tfrac{1}{2}\|v_k - v_{k+1}\|^2 - \tfrac{(5p-2)\lambda_k L}{p!}\|x_k - v_k\|^{p+1}\right) \nonumber \\ & \leq & \sum_{k=1}^T \left(\tfrac{1}{2}\|x_k - v_k\|\|\|v_k - v_{k+1}\| - \tfrac{1}{2}\|v_k - v_{k+1}\|^2 - \tfrac{1}{4}\|x_k - v_k\|^2\right) \nonumber \\ & \leq & \sum_{k=1}^T \left(\max_{\eta \geq 0}\left\{\tfrac{1}{2}\|x_k - v_k\|\eta - \tfrac{1}{2}\eta^2\right\} - \tfrac{1}{4}\|x_k - v_k\|^2\right) \nonumber \\ & = & - \tfrac{1}{8} \left(\sum_{k=1}^T \|x_k - v_k\|^2 \right). \end{eqnarray} Plugging Eq.~\eqref{inequality:DE-descent-fourth} and Eq.~\eqref{inequality:DE-descent-sixth} into Eq.~\eqref{inequality:DE-descent-third} yields that \begin{equation*} \sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle \leq \mathcal{E}_0 - \mathcal{E}_T + \langle s_T, x - x_0\rangle -\tfrac{1}{8}\left(\sum_{k=1}^T \|x_k - v_k\|^2 \right). \end{equation*} This completes the proof. \end{proof} \begin{lemma}\label{Lemma:DE-error} Suppose that Assumption~\ref{Assumption:smooth} and the Minty condition hold true and let $x \in \mathcal{X}$. For every integer $T \geq 1$, we have \begin{equation*} \sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle \leq \tfrac{1}{2}\|x - x_0\|^2, \qquad \sum_{k=1}^T \|x_k - v_k\|^2 \leq 4\|x^\star - x_0\|^2, \end{equation*} where $x^\star \in \mathcal{X}$ denotes the weak solution to the VI. \end{lemma} \begin{proof} For any $x \in \mathcal{X}$, we have \begin{equation*} \mathcal{E}_0 - \mathcal{E}_T + \langle s_T, x - x_0\rangle = \mathcal{E}_0 - \left(\max_{v \in \mathcal{X}} \ \langle s_T, v - x_0\rangle - \tfrac{1}{2}\|v - x_0\|^2\right) + \langle s_T, x - x_0\rangle. \end{equation*} Since $s_0 = 0_d$, we have $\mathcal{E}_0 = 0$ and \begin{equation*} \mathcal{E}_0 - \mathcal{E}_T + \langle s_T, x - x_0\rangle \leq - \left(\langle s_T, x - x_0\rangle - \tfrac{1}{2}\|x - x_0\|^2\right) + \langle s_T, x - x_0\rangle = \tfrac{1}{2}\|x - x_0\|^2. \end{equation*} This together with Lemma~\ref{Lemma:DE-descent} yields that \begin{equation*} \sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle + \tfrac{1}{8}\left(\sum_{k=1}^T \|x_k - v_k\|^2\right) \leq \tfrac{1}{2}\|x - x_0\|^2, \quad \textnormal{for all } x \in \mathcal{X}, \end{equation*} which implies the first inequality. Since the VI satisfies the Minty condition (see Definition~\ref{def:Minty}), there exists $x^\star \in \mathcal{X}$ such that $\langle F(x_k), x_k - x^\star\rangle \geq 0$ for all $k \geq 1$. Letting $x = x^\star$ in the above inequality yields the second inequality. \end{proof} We provide a technical lemma establishing a lower bound for $\sum_{k=1}^T \lambda_k$. \begin{lemma}\label{Lemma:DE-control} Suppose that Assumption~\ref{Assumption:smooth} and the Minty condition hold true. For every integer $k \geq 1$, we have \begin{equation*} \sum_{k=1}^T \lambda_k \geq \tfrac{p!}{(20p-8)L}\left(\tfrac{1}{4\|x^\star - x_0\|^2}\right)^{\frac{p-1}{2}} T^{\frac{p+1}{2}}, \end{equation*} where $x^\star \in \mathcal{X}$ denotes the weak solution to the VI. \end{lemma} \begin{proof} Without loss of generality, we assume that $x_0 \neq x^\star$. For $p=1$, we have $\lambda_k = \frac{1}{12L}$ for all $k \geq 1$. For $p \geq 2$, we have \begin{eqnarray*} \lefteqn{\sum_{k=1}^T (\lambda_k)^{-\frac{2}{p-1}}(\tfrac{p!}{(20p-8)L})^{\frac{2}{p-1}}} \\ & \leq & \sum_{k=1}^T (\lambda_k)^{-\frac{2}{p-1}}(\lambda_k\|x_k - v_k\|^{p-1})^{\frac{2}{p-1}} = \sum_{k=1}^T \|x_k - v_k\|^2 \overset{\text{Lemma}~\ref{Lemma:DE-error}}{\leq} 4\|x^\star - x_0\|^2. \end{eqnarray*} By the H\"{o}lder inequality, we have \begin{equation*} \sum_{k=1}^T 1 = \sum_{k=1}^T \left((\lambda_k)^{-\frac{2}{p-1}}\right)^{\frac{p-1}{p+1}} (\lambda_k)^{\frac{2}{p+1}} \leq \left(\sum_{k=1}^T (\lambda_k)^{-\frac{2}{p-1}}\right)^{\frac{p-1}{p+1}}\left(\sum_{k=1}^T \lambda_k\right)^{\frac{2}{p+1}}. \end{equation*} Putting these pieces together yields that \begin{equation*} T \leq (4\|x^\star - x_0\|^2)^{\frac{p-1}{p+1}}\left(\tfrac{(20p-8)L}{p!}\right)^{\frac{2}{p+1}}\left(\sum_{k=1}^T \lambda_k\right)^{\frac{2}{p+1}}, \end{equation*} Plugging this into the above inequality yields that \begin{equation*} \sum_{k=1}^T \lambda_k \geq \tfrac{p!}{(20p-8)L}\left(\tfrac{1}{4\|x^\star - x_0\|^2}\right)^{\frac{p-1}{2}} T^{\frac{p+1}{2}}. \end{equation*} This completes the proof. \end{proof} \subsection{Proof of Theorem~\ref{Thm:monotone-global}} We see from~\citet[Theorem~3.1]{Harker-1990-Finite} that at least one strong solution to the VI exists since $F$ is continuous and $\mathcal{X}$ is convex, closed and bounded. Since any strong solution is a weak solution if $F$ is further assumed to be monotone, we obtain that the VI satisfies the Minty condition. Letting $x \in \mathcal{X}$, we derive from the monotonicity of $F$ and the definition of $\tilde{x}_T$ (Option I) that \begin{equation*} \langle F(x), \tilde{x}_T - x\rangle = \tfrac{1}{\sum_{k=1}^T \lambda_k}\left(\sum_{k=1}^T \lambda_k \langle F(x), x_k - x\rangle\right) \leq \tfrac{1}{\sum_{k=1}^T \lambda_k}\left(\sum_{k=1}^T \lambda_k \langle F(x_k), x_k - x\rangle\right). \end{equation*} Combining this inequality with the first inequality in Lemma~\ref{Lemma:DE-error} yields that \begin{equation*} \langle F(x), \tilde{x}_T - x\rangle \leq \tfrac{\|x - x_0\|^2}{2(\sum_{k=1}^T \lambda_k)}, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} Since $x_0 \in \mathcal{X}$, we have $\|x - x_0\| \leq D$ and hence \begin{equation*} \langle F(x), \tilde{x}_T - x\rangle \leq \tfrac{D^2}{2(\sum_{k=1}^T \lambda_k)}, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} Then, we combine Lemma~\ref{Lemma:DE-control} and the fact that $\|x^\star - x_0\| \leq D$ to obtain that \begin{equation*} \langle F(x), \tilde{x}_T - x\rangle \leq \tfrac{2^p(5p-2)}{p!}LD^{p+1} T^{-\frac{p+1}{2}}, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} By the definition of a gap function (see Eq.~\eqref{eq:cc-gap}), we have \begin{equation}\label{inequality:monotone-global-main} \textsc{gap}(\tilde{x}_T) = \sup_{x \in \mathcal{X}} \ \langle F(x), \tilde{x}_T - x\rangle \leq \tfrac{2^p(5p-2)}{p!}LD^{p+1} T^{-\frac{p+1}{2}}. \end{equation} Therefore, we conclude from Eq.~\eqref{inequality:monotone-global-main} that there exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus}(p, x_0, L, T, 0)$ satisfies that $\textsc{gap}(\hat{x}) \leq \epsilon$ and the total number of calls of the subproblem solvers is bounded by \begin{equation*} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p+1}}\right). \end{equation*} This completes the proof. \subsection{Proof of Theorem~\ref{Thm:monotone-restart}} In the strongly monotone setting with a convex, closed and bounded set, the solution $x^\star \in \mathcal{X}$ to the VI exists and is unique~\citep{Facchinei-2007-Finite} and the VI satisfies the Minty condition. We first consider the relationship between $\|\hat{x} - x^\star\|$ and $\|x_0 - x^\star\|$ where $\hat{x} = \textsf{Perseus}(p, x_0, L, t, 0)$. We derive from Jensen's inequality and the definition of $\tilde{x}_t$ that \begin{equation*} \|\tilde{x}_t - x^\star\|^2 = \left\|\tfrac{1}{\sum_{k=1}^t \lambda_k}\left(\sum_{k=1}^t \lambda_k x_k\right) - x^\star\right\|^2 \leq \tfrac{1}{\sum_{k=1}^t \lambda_k}\left(\sum_{k=1}^t \lambda_k\|x_k - x^\star\|^2\right). \end{equation*} Since $F$ is $\mu$-strongly monotone, we have \begin{equation*} \|x_k - x^\star\|^2 \leq \tfrac{1}{\mu}\langle F(x_k) - F(x^\star), x_k - x^\star\rangle \leq \tfrac{1}{\mu}\langle F(x_k), x_k - x^\star\rangle. \end{equation*} Putting these pieces together yields that \begin{equation}\label{inequality:monotone-restart-first} \|\tilde{x}_t - x^\star\|^2 \leq \tfrac{1}{\mu(\sum_{k=1}^t \lambda_k)}\left(\sum_{k=1}^t \lambda_k\langle F(x_k), x_k - x^\star\rangle\right). \end{equation} Combining the first inequality in Lemma~\ref{Lemma:DE-error} with Eq.~\eqref{inequality:monotone-restart-first} yields that \begin{equation*} \|\tilde{x}_t - x^\star\|^2 \leq \tfrac{1}{2\mu(\sum_{k=1}^t \lambda_k)}\|x_0 - x^\star\|^2. \end{equation*} This together with Lemma~\ref{Lemma:DE-control} and the fact that $\hat{x} = \tilde{x}_t$ yields that \begin{eqnarray}\label{inequality:monotone-restart-second} \|\hat{x} - x^\star\|^2 & \leq & \left((4\|x_0 - x^\star\|^2)^{\frac{p-1}{2}}\tfrac{10p-4}{p!}\tfrac{L}{\mu}t^{-\frac{p+1}{2}}\right)\|x_0 - x^\star\|^2 \\ & = & \left(\tfrac{2^p(5p-2)}{p!}\tfrac{L}{\mu}t^{-\frac{p+1}{2}}\right)\|x_0 - x^\star\|^{p+1}. \nonumber \end{eqnarray} Recalling that we have $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, 0)$ in the scheme of Algorithm~\ref{Algorithm:restart} and \begin{equation}\label{inequality:monotone-restart-third} t = \left\lceil \left(\tfrac{2^{p+1}(5p-2)}{p!}\tfrac{LD^{p-1}}{\mu}\right)^{\frac{2}{p+1}}\right\rceil, \end{equation} we have \begin{equation}\label{inequality:monotone-restart-fourth} \|x_{k+1} - x^\star\|^2 \leq \tfrac{1}{2}\|x_k - x^\star\|^2, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T. \end{equation} Therefore, we conclude from Eq.~\eqref{inequality:monotone-restart-third} and Eq.~\eqref{inequality:monotone-restart-fourth} that there exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus-restart}(p, x_0, L, \mu, T, 0)$ satisfies that $\|\hat{x} - x^\star\| \leq \epsilon$ and the total number of calls of the subproblem solvers is bounded by \begin{equation*} O\left(\left(\frac{LD^{p-1}}{\mu}\right)^{\frac{2}{p+1}}\log_2\left(\frac{D}{\epsilon}\right)\right). \end{equation*} This completes the proof. \subsection{Proof of Theorem~\ref{Thm:nonmonotone-global}} We see from the second inequality in Lemma~\ref{Lemma:DE-error} that \begin{equation*} \min_{1 \leq k \leq T} \|x_k - v_k\|^2 \leq \tfrac{1}{T}\sum_{k=1}^T \|x_k - v_k\|^2 \leq \tfrac{4\|x^\star - x_0\|^2}{T}. \end{equation*} By the definition of $x_{k_T}$, we have \begin{equation}\label{inequality:nonmonotone-global-first} \|x_{k_T} - v_{k_T}\|^2 \leq \tfrac{4\|x^\star - x_0\|^2}{T}. \end{equation} Recalling that $x_{k+1} \in \mathcal{X}$ satisfies Eq.~\eqref{condition:approximation}, we have \begin{equation*} \langle F_{v_k}(x_k), x - x_k\rangle \geq -\tfrac{L}{p!}\|x_k - v_k\|^{p+1},\quad \textnormal{for all } x \in \mathcal{X}, \end{equation*} where $F_v(x): \mathbb{R}^d \rightarrow \mathbb{R}^d$ is defined for any fixed $v \in \mathcal{X}$ as follows: \begin{eqnarray*} F_{v_k}(x) & = & F(v_k) + \langle \nabla F(v_k), x-v_k\rangle + \ldots + \tfrac{1}{(p-1)!}\nabla^{(p-1)} F(v_k)[x-v_k]^{p-1} \\ & & + \tfrac{5L}{(p-1)!}\|x - v_k\|^{p-1}(x - v_k). \end{eqnarray*} Under Assumption~\ref{Assumption:smooth}, we have Eq.~\eqref{opt:DE-main-smooth} which further leads to \begin{equation*} \|F(x_k) - F_{v_k}(x_k)\| \leq \tfrac{(5p+1)L}{p!}\|x_k - v_k\|^p. \end{equation*} Putting these pieces together yields that \begin{eqnarray*} \lefteqn{\langle F(x_k), x_k - x\rangle = \langle F(x_k) - F_{v_k}(x_k), x_k - x\rangle + \langle F_{v_k}(x_k), x_k - x\rangle} \\ & \leq & \|F(x_k) - F_{v_k}(x_k)\|\|x_k - x\| + \tfrac{L}{p!}\|x_k - v_k\|^{p+1} \\ & \leq & \tfrac{L}{p!}\|x_k - v_k\|^p\left((5p+1)\|x_k - x\| + \|x_k - v_k\|\right),\quad \textnormal{for all } x \in \mathcal{X}. \end{eqnarray*} This implies that \begin{equation}\label{inequality:nonmonotone-global-second} \langle F(x_k), x_k - x\rangle \leq \tfrac{(5p+1)L}{p!}\|x_k - v_k\|^p\|x_k - x\| + \tfrac{L}{p!}\|x_k - v_k\|^{p+1}, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation} Then, we derive from the fact that $\|x_k - x\| \leq D$ and $\|x_k - v_k\| \leq D$ that \begin{equation*} \langle F(x_k), x_k - x\rangle \leq \tfrac{(5p+2)LD}{p!}\|x_k - v_k\|^p, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} By the definition of a residue function (see Eq.~\eqref{eq:cc-residue}), we have \begin{eqnarray*} \textsc{res}(x_{k_T}) & = & \sup_{x \in \mathcal{X}} \ \langle F(x_{k_T}), x_{k_T} - x\rangle \leq \tfrac{(5p+2)LD}{p!}\|x_{k_T} - v_{k_T}\|^p \\ & \overset{\textnormal{Eq}.~\eqref{inequality:nonmonotone-global-first}}{\leq} & \tfrac{(5p+2)LD}{p!}\left(\tfrac{4\|x^\star - x_0\|^2}{T}\right)^{\frac{p}{2}}. \end{eqnarray*} Since $x_0, x^\star \in \mathcal{X}$, we have $\|x^\star - x_0\| \leq D$ and hence \begin{equation}\label{inequality:nonmonotone-global-third} \textsc{res}(x_{k_T}) \leq \tfrac{2^p(5p+2)}{p!}LD^{p+1}T^{-\frac{p}{2}}. \end{equation} Therefore, we conclude from Eq.~\eqref{inequality:nonmonotone-global-third} that there exists $T > 0$ such that the output $\hat{x} = \textsf{Perseus}(p, x_0, L, T, 1)$ satisfies that $\textsc{res}(\hat{x}) \leq \epsilon$ and the total number of calls of the subproblem solvers is bounded by \begin{equation*} O\left(\left(\frac{LD^{p+1}}{\epsilon}\right)^{\frac{2}{p}}\right). \end{equation*} This completes the proof. \subsection{Proof of Theorem~\ref{Thm:nonmonotone-restart}} We first consider the relationship between $\|\hat{x} - x^\star\|$ and $\|x_0 - x^\star\|$ where $\hat{x} = \textsf{Perseus}(p, x_0, L, t, 1)$. By the same argument as used in Theorem~\ref{Thm:nonmonotone-global}, we have (see Eq.~\eqref{inequality:nonmonotone-global-first}): \begin{equation*} \langle F(x_k), x_k - x\rangle \leq \tfrac{(5p+1)L}{p!}\|x_k - v_k\|^p\|x_k - x\| + \tfrac{L}{p!}\|x_k - v_k\|^{p+1}, \quad \textnormal{for all } x \in \mathcal{X}. \end{equation*} Suppose that $x = x^\star \in \mathcal{X}$ is a weak solution (the existence is guaranteed by the Minty condition). Since the VI satisfies the $\mu_{\textnormal{Minty}}$-strong Minty condition, we have \begin{equation*} \|x_k - x^\star\|^2 \leq \tfrac{1}{\mu_{\textnormal{Minty}}}\langle F(x_k), x_k - x^\star\rangle. \end{equation*} Putting these pieces together yields that \begin{equation*} \|x_k - x^\star\|^2 \leq \tfrac{L}{\mu_{\textnormal{Minty}}}\left(\tfrac{5p+1}{p!}\|x_k - v_k\|^p\|x_k - x^\star\| + \tfrac{1}{p!}\|x_k - v_k\|^{p+1}\right), \end{equation*} which implies that \begin{equation*} \|x_k - x^\star\| \leq \tfrac{5p+1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}\|x_k - v_k\|^p + \sqrt{\tfrac{1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}}\|x_k - v_k\|^{\frac{p+1}{2}}, \end{equation*} By the definition of $x_{k_t}$, we have \begin{equation*} \|x_{k_t} - x^\star\| \leq \tfrac{5p+1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}\left(\tfrac{\sum_{k=1}^t \|x_k - v_k\|^2}{t}\right)^{\frac{p}{2}} + \sqrt{\tfrac{1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}}\left(\tfrac{\sum_{k=1}^t \|x_k - v_k\|^2}{t}\right)^{\frac{p+1}{4}}, \end{equation*} This together with the second inequality in Lemma~\ref{Lemma:DE-error} yields that \begin{equation*} \|x_{k_t} - x^\star\| \leq \tfrac{5p+1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}\left(\tfrac{4\|x^\star - x_0\|^2}{t}\right)^{\frac{p}{2}} + \sqrt{\tfrac{1}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}}\left(\tfrac{4\|x^\star - x_0\|^2}{t}\right)^{\frac{p+1}{4}}, \end{equation*} which implies that \begin{equation}\label{inequality:nonmonotone-restart-first} \|x_{k_t} - x^\star\| \leq \left(\tfrac{2^p(5p+1)}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}t^{-\frac{p}{2}}\right)\|x_0 - x^\star\|^p +\sqrt{\tfrac{2^{p+1}}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}t^{-\frac{p+1}{2}}}\|x_0 - x^\star\|^{\frac{p+1}{2}}. \end{equation} Recalling that we have $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, 1)$ in the scheme of Algorithm~\ref{Algorithm:restart} and \begin{equation}\label{inequality:nonmonotone-restart-second} t = \left\lceil \left(\tfrac{2^{p+2}(5p+1)}{p!}\tfrac{LD^{p-1}}{\mu_{\textnormal{Minty}}}\right)^{\frac{2}{p}} + \left(\tfrac{2^{p+5}}{p!}\tfrac{LD^{p-1}}{\mu_{\textnormal{Minty}}}\right)^{\frac{2}{p+1}}\right\rceil, \end{equation} we have \begin{equation}\label{inequality:nonmonotone-restart-third} \|x_{k+1} - x^\star\|^2 \leq \tfrac{1}{2}\|x_k - x^\star\|^2, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T. \end{equation} Therefore, we conclude from Eq.~\eqref{inequality:nonmonotone-restart-second} and Eq.~\eqref{inequality:nonmonotone-restart-third} that there exists some $T > 0$ such that the output $\hat{x} = \textsf{Perseus-restart}(p, x_0, L, \mu_{\textnormal{Minty}}, T, 1)$ satisfies that $\|\hat{x} - x^\star\| \leq \epsilon$ and the total number of calls of the subproblem solvers is bounded by \begin{equation*} O\left(\max\left\{\left(\frac{LD^{p-1}}{\mu_{\textnormal{Minty}}}\right)^{\frac{2}{p}}, \left(\frac{LD^{p-1}}{\mu_{\textnormal{Minty}}}\right)^{\frac{2}{p+1}}\right\}\log_2\left(\frac{D}{\epsilon}\right)\right). \end{equation*} This completes the proof. \subsection{Proof of Theorem~\ref{Thm:monotone-local}} We first consider the relationship between $\|\hat{x} - x^\star\|$ and $\|x_0 - x^\star\|$ where $\hat{x} = \textsf{Perseus}(p, x_0, L, t, 2)$. By the same argument as used in Theorem~\ref{Thm:monotone-restart}, we have (see Eq.~\eqref{inequality:monotone-restart-second}) \begin{equation*} \|\hat{x} - x^\star\|^2 \leq \left(\tfrac{2^p(5p-2)}{p!}\tfrac{L}{\mu}t^{-\frac{p+1}{2}}\right)\|x_0 - x^\star\|^{p+1}. \end{equation*} Recalling that we have $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, 2)$ in the scheme of Algorithm~\ref{Algorithm:restart} and $t = 1$, we have \begin{equation*} \|x_{k+1} - x^\star\|^2 \leq \left(\tfrac{2^p(5p-2)\kappa}{p!}\right)\|x_k - x^\star\|^{p+1}, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T, \end{equation*} which implies that \begin{equation*} \|x_{k+1} - x^\star\| \leq \sqrt{\tfrac{2^p(5p-2)\kappa}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}}, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T. \end{equation*} For the case of $p \geq 2$, we have $\frac{p+1}{2} \geq \frac{3}{2}$ and $p-1 \geq 1$. If the following condition holds true, \begin{equation*} \|x_0 - x^\star\| \leq \tfrac{1}{2}\left(\tfrac{p!}{2^p(5p-2)\kappa}\right)^{\frac{1}{p-1}}, \end{equation*} we have \begin{eqnarray*} \lefteqn{\left(\tfrac{2^p(5p-2)\kappa}{p!}\right)^{\frac{1}{p-1}}\|x_{k+1} - x^\star\| \leq \left(\tfrac{2^p(5p-2)\kappa}{p!}\right)^{\frac{p+1}{2(p-1)}}\|x_k - x^\star\|^{\frac{p+1}{2}}} \\ & = & \left(\left(\tfrac{2^p(5p-2)\kappa}{p!}\right)^{\frac{1}{p-1}}\|x_k - x^\star\|\right)^{\frac{p+1}{2}} \leq \left(\left(\tfrac{2^p(5p-2)\kappa}{p!}\right)^{\frac{1}{p-1}}\|x_0 - x^\star\|\right)^{(\frac{p+1}{2})^{k+1}} \\ & \leq & (\tfrac{1}{2})^{(\frac{p+1}{2})^{k+1}}. \end{eqnarray*} This completes the proof. \subsection{Proof of Theorem~\ref{Thm:nonmonotone-local}} We first consider the relationship between $\|\hat{x} - x^\star\|$ and $\|x_0 - x^\star\|$ where $\hat{x} = \textsf{Perseus}(p, x_0, L, t, 2)$. By the same argument as used in Theorem~\ref{Thm:nonmonotone-restart}, we have (see Eq.~\eqref{inequality:nonmonotone-restart-first}) \begin{equation*} \|x_{k_t} - x^\star\| \leq \left(\tfrac{2^p(5p+1)}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}t^{-\frac{p}{2}}\right)\|x_0 - x^\star\|^p +\sqrt{\tfrac{2^{p+1}}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}t^{-\frac{p+1}{2}}}\|x_0 - x^\star\|^{\frac{p+1}{2}}. \end{equation*} Recalling that we have $x_{k+1} = \textsf{Perseus}(p, x_k, L, t, 2)$ in the scheme of Algorithm~\ref{Algorithm:restart} and $t = 1$, we have \begin{equation*} \|x_{k+1} - x^\star\| \leq \left(\tfrac{2^p(5p+1)}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}\right)\|x_k - x^\star\|^p +\sqrt{\tfrac{2^{p+1}}{p!}\tfrac{L}{\mu_{\textnormal{Minty}}}}\|x_k - x^\star\|^{\frac{p+1}{2}}, \end{equation*} for all $k = 0, 1, 2, \ldots, T$, which implies that \begin{equation*} \|x_{k+1} - x^\star\| \leq \left(\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)\|x_k - x^\star\|^p +\sqrt{\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}}, \end{equation*} for all $k = 0, 1, 2, \ldots, T$. For the case of $p \geq 2$, we have $\frac{p+1}{2} \geq \frac{3}{2}$ and $p-1 \geq 1$. If the following condition holds true: \begin{equation*} \|x_0 - x^\star\| \leq \tfrac{1}{2}\left(\tfrac{p!}{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}\right)^{\frac{1}{p-1}}, \end{equation*} we claim that the following statement holds true, \begin{equation*} \|x_k - x^\star\| \leq \tfrac{1}{2}\left(\tfrac{p!}{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}\right)^{\frac{1}{p-1}}, \quad \textnormal{for all } k = 0, 1, 2, \ldots, T+1. \end{equation*} Indeed, the case of $k = 0$ holds true. Assuming that the case of $k \geq 1$ holds true, we have \begin{eqnarray*} \|x_{k+1} - x^\star\| & \leq & \left(\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)\|x_k - x^\star\|^p +\sqrt{\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}} \\ & \leq & \left((\tfrac{1}{2})^{p+1} + (\tfrac{1}{2})^{\frac{p+1}{2}}\right)\|x_k - x^\star\|. \end{eqnarray*} Since $p \geq 2$, we have $\|x_{k+1} - x^\star\| \leq \|x_k - x^\star\|$ for all $k = 0, 1, 2, \ldots, T$. By induction, we get the desired result. Then, we have \begin{equation*} \|x_{k+1} - x^\star\| \leq 2\sqrt{\tfrac{2^p(5p+1)\kappa_{\textnormal{Minty}}}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}} = \sqrt{\tfrac{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}{p!}}\|x_k - x^\star\|^{\frac{p+1}{2}}, \end{equation*} and \begin{eqnarray*} \lefteqn{\left(\tfrac{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)^{\frac{1}{p-1}}\|x_{k+1} - x^\star\| \leq \left(\tfrac{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)^{\frac{p+1}{2(p-1)}}\|x_k - x^\star\|^{\frac{p+1}{2}}} \\ & = & \left(\left(\tfrac{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)^{\frac{1}{p-1}}\|x_k - x^\star\|\right)^{\frac{p+1}{2}} \leq \left(\left(\tfrac{2^{p+2}(5p+1)\kappa_{\textnormal{Minty}}}{p!}\right)^{\frac{1}{p-1}}\|x_0 - x^\star\|\right)^{(\frac{p+1}{2})^{k+1}} \\ & \leq & (\tfrac{1}{2})^{(\frac{p+1}{2})^{k+1}}. \end{eqnarray*} This completes the proof. \section{Preliminaries and Technical Background}\label{sec:prelim} In this section, we present the basic formalism of variational inequality (VI) problems and provide definitions for the class of operators and optimality criteria considered in this paper. We further give a brief overview of Nesterov's dual extrapolation method from which our new method originates. \subsection{Variational inequality problem} The regularity conditions that we consider for an operator $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ are as follows. \begin{definition}\label{def:smooth} An operator $F$ is $k^{\textnormal{th}}$-order smooth if $\|\nabla^{(k)} F(x) - \nabla^{(k)} F(x')\| \leq L\|x - x'\|$ for all $x, x'$. \end{definition} \begin{definition}\label{def:monotone} An operator $F$ is $\mu$-strongly-monotone if $\langle F(x) - F(x'), x - x'\rangle \geq \mu \|x - x'\|^2$ for all $x, x'$. If $\mu = 0$, we recover the definition of monotonicity for a continuous operator. \end{definition} With these definitions in mind, we formally state the assumptions that impose in addition to \textbf{A1} and \textbf{A2} in order to define assumption smooth variational inequality (VI) problems. \begin{assumption}\label{Assumption:smooth} The following statements hold true: \begin{enumerate} \item $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ is $(p-1)^{\textnormal{th}}$-order smooth with a Lipschitz constant $L > 0$. \item $\mathcal{X}$ is closed, convex and bounded with a diameter $D > 0$. \end{enumerate} \end{assumption} The convergence of derivative-based optimization methods to a weak solution $x^\star \in \mathcal{X}$ depends on the property of $F$ near this point; thus, some form of smoothness condition is needed. As for the boundedness condition for $\mathcal{X}$, it is standard in the VI literature~\citep{Facchinei-2007-Finite}. This condition not only guarantees the validity of the most natural optimality criterion in the monotone setting---the gap function~\citep{Nemirovski-2004-Prox,Nesterov-2007-Dual}---but additionally it is satisfied in a wide range of real-world applications~\citep{Facchinei-2007-Finite}. On the other hand, there is a line of works focusing on relaxing the boundedness condition via appeal to other notions of approximate solutions~\citep{Monteiro-2010-Complexity,Monteiro-2011-Complexity,Monteiro-2012-Iteration,Chen-2017-Accelerated}. For simplicity, we retain the boundedness condition and leave the analysis for the cases with unbounded constraint sets to future work. \paragraph{Monotone setting.} For some of our results we focus on operators $F$ that are monotone in addition to Assumption~\ref{Assumption:smooth}. Under monotonicity, it is well known that any $\epsilon$-approximate strong solution is an $\epsilon$-approximate weak solution but the reverse does not hold in general. Accordingly, we define the approximate versions of the Minty VI in Eq.~\eqref{prob:Minty} and the Stampacchia VI in Eq.~\eqref{prob:Stampacchia} as follows: \begin{equation*} \begin{array}{cll} \textbf{(Approximate weak solution)} & \langle F(x), \hat{x} - x\rangle \leq \epsilon, & \textnormal{for all } x \in \mathcal{X}, \\ \textbf{(Approximate strong solution)} & \langle F(\hat{x}), \hat{x} - x\rangle \leq \epsilon, & \textnormal{for all } x \in \mathcal{X}, \end{array} \end{equation*} These definitions motivate the use of a gap function, $\textsc{gap}(\cdot): \mathcal{X} \mapsto \mathbb{R}_+$, defined by \begin{equation}\label{eq:cc-gap} \textsc{gap}(\hat{x}) = \sup_{x \in \mathcal{X}} \ \langle F(x), \hat{x} - x\rangle, \end{equation} with which we measure the optimality of a point $\hat{x} \in \mathcal{X}$ output by various iterative solution methods; see, e.g.,~\cite{Tseng-2000-Modified,Nemirovski-2004-Prox,Nesterov-2007-Dual,Mokhtari-2020-Convergence}. Note that the boundedness of $\mathcal{X}$ and the existence of a strong solution guarantees that the gap function is well defined. Formally, we have \begin{definition}\label{def:cc-gap} We say a point $\hat{\mathbf x} \in \mathcal{X}$ is an \emph{$\epsilon$-weak solution to the monotone VI corresponding to $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ and $\mathcal{X} \subseteq \mathbb{R}^d$} if we have $\textsc{gap}(\hat{x}) \leq \epsilon$. If $\epsilon = 0$, then $\hat{x} \in \mathcal{X}$ is a \emph{weak solution}. \end{definition} In the strongly monotone setting, we let $\mu > 0$ denote the modulus of strong monotonicity for $F$. Under Assumption~\ref{Assumption:smooth}, we define $\kappa := L/\mu$ as the \textit{generalized condition number} of $F$. It is worth mentioning that the condition number quantifies the difficulty of solving the optimization problem~\citep{Nesterov-2018-Lectures} and appears in the iteration complexity bound of derivative-based methods for optimizing a smooth and strongly convex function. Accordingly, the VI corresponding to $F$ and $\mathcal{X}$ is more and more computationally challenging as $\kappa > 0$ increases. \paragraph{Structured non-monotone setting.} We also study the case in which $F$ is non-monotone but satisfies the (strong) Minty condition. Imposing the (strong) Minty condition is important since the smoothness of $F$ is not sufficient to guarantee that the problem is computationally tractable. This has been shown by~\citet{Daskalakis-2021-Complexity} who establish that even deciding whether an approximate min-max solution exists is NP-hard in smooth and nonconvex-nonconcave min-max optimization (which is a special instance of non-monotone VIs). Recent work~\citep{Solodov-1999-New,Dang-2015-Convergence,Iusem-2017-Extragradient,Kannan-2019-Optimal,Song-2020-Optimistic,Liu-2021-First,Diakonikolas-2021-Efficient} has shown that the non-monotone VI problem is computational tractable under the Minty condition. We thus make the following formal definition. \begin{definition}\label{def:Minty} We say the VI corresponding to $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ and $\mathcal{X} \subseteq \mathbb{R}^d$ satisfies the Minty condition if there exists $x^\star \in \mathcal{X}$ such that $\langle F(x), x- x^\star\rangle \geq 0$ for all $x \in \mathcal{X}$. \end{definition} We make some comments on the Minty condition. First, we note that it assumes the existence of at least one weak solution. Second, we see from~\citet[Theorem~3.1]{Harker-1990-Finite} that at least one strong solution to the VI since $F$ is continuous and $\mathcal{X}$ is closed and bounded. However, the set of weak solutions is only a subset of the set of strong solutions if $F$ is not necessarily monotone and the weak solution may not exist. From this perspective, the Minty condition gives a favorable structure. Finally, the Minty condition is a mild condition which makes the computation of an $\epsilon$-strong solution of non-monotone VIs tractable; indeed, it is weaker than generalized monotone assumptions (e.g., pseudo-monotonicity or quasi-monotonicity)~\citep{Dang-2015-Convergence,Iusem-2017-Extragradient,Kannan-2019-Optimal}. Accordingly, we define the residue function $\textsc{res}(\cdot): \mathcal{X} \mapsto \mathbb{R}_+$ given by \begin{equation}\label{eq:cc-residue} \textsc{res}(\hat{x}) = \sup_{x \in \mathcal{X}} \ \langle F(\hat{x}), \hat{x} - x\rangle, \end{equation} which measures the optimality of a point $\hat{x} \in \mathcal{X}$ achieved by iterative solution methods; see, e.g.,~\citet{Dang-2015-Convergence,Iusem-2017-Extragradient,Kannan-2019-Optimal,Song-2020-Optimistic}. Note that the boundedness of $\mathcal{X}$ and the Minty condition guarantee that the residue function is well defined. Formally, we have \begin{definition}\label{def:cc-res} We say a point $\hat{\mathbf x} \in \mathcal{X}$ is an $\epsilon$-strong solution to the non-monotone VI corresponding to $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ and $\mathcal{X} \subseteq \mathbb{R}^d$ if we have $\textsc{res}(\hat{x}) \leq \epsilon$. If $\epsilon = 0$, then $\hat{x} \in \mathcal{X}$ is a strong solution. \end{definition} Proceeding a step further, we define the strong Minty condition and define $\kappa_{\textnormal{Minty}} := L/\mu_{\textnormal{Minty}}$ to be the \textit{Minty condition number} of $F$ if the VI satisfies the $\mu_{\textnormal{Minty}}$-strong Minty condition. \begin{definition}\label{def:S-Minty} We say the VI corresponding to $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ and $\mathcal{X} \subseteq \mathbb{R}^d$ satisfies the $\mu_{\textnormal{Minty}}$-strong Minty condition if there exists $x^\star \in \mathcal{X}$ such that $\langle F(x), x- x^\star\rangle \geq \mu_{\textnormal{Minty}}\|x - x^\star\|^2$ for all $x \in \mathcal{X}$. \end{definition} There are many application problems that can be formulated as non-monotone VIs satisfying the (strong) Minty condition, including product pricing~\citep{Choi-1990-Product,Gallego-2014-Dynamic,Ewerhart-2014-Cournot} and competitive exchange economies~\citep{Brighi-2002-Characterizations}. A similar assumption (the Minty condition restricted to nonconvex optimization) has been adopted for analyzing the convergence of stochastic gradient descent for deep learning~\citep{Li-2017-Convergence} and it has found real-world applications~\citep{Kleinberg-2018-Alternative}. \subsection{Nesterov's dual extrapolation method} Nesterov’s dual extrapolation method~\citep{Nesterov-2007-Dual} has been shown to be optimal among all the first-order methods for computing the weak solution of the VI when $F$ is zeroth-order smooth (see Definition~\ref{def:smooth}) and monotone (see Definition~\ref{def:monotone})~\citep{Ouyang-2021-Lower}. We recall the basic formulation in the setting of a VI defined via an operator $F: \mathbb{R}^d \mapsto \mathbb{R}^d$ and a closed, convex and bounded set $\mathcal{X} \subseteq \mathbb{R}^d$. Starting with the initial points $x_0 \in \mathcal{X}$ and $s_0 = 0 \in \mathbb{R}^d$, the $k^{\textnormal{th}}$ iteration of the scheme is given by \begin{equation*} \begin{array}{rl} & \textnormal{Find } v_{k+1} \in \mathcal{X} \textnormal{ s.t. } v_{k+1} = \mathop{\rm{argmax}}_{v \in \mathcal{X}} \ \langle s_k, v - x_0\rangle - \tfrac{\beta}{2}\|v - x_0\|^2, \\ & \textnormal{Find } x_{k+1} \in \mathcal{X} \textnormal{ s.t. } \langle F(v_{k+1}) + \beta(x_{k+1} - v_{k+1}), x - x_{k+1}\rangle \geq 0 \textnormal{ for all } x \in \mathcal{X}, \\ & s_{k+1} = s_k - \lambda F(x_{k+1}). \end{array} \end{equation*} Intuitively, the dual extrapolation method can be interpreted as an instance of the extragradient method in the dual space (we refer to $s \in \mathbb{R}^d$ to as the dual variable). In particular, the rule which transforms a point $s_k$ into the next point $s_{k+1}$ at the $k^{\textnormal{th}}$ iteration is called the dual extrapolation step. It has also been proven in~\citet[Theorem~2]{Nesterov-2007-Dual} that the dual extrapolation scheme, with $\beta = L$ and $\lambda = 1$, generates a sequence $\{x_k\}_{k \geq 0} \subseteq \mathcal{X}$ satisfying the condition that the average iterate $\tilde{x}_k = \frac{1}{k+1}\sum_{i=0}^k x_i$ is an $\epsilon$-weak solution (see Definition~\ref{def:cc-gap}) after at most $O(\epsilon^{-1})$ iterations. Here $L > 0$ is the Lipschitz constant of $F$; cf.\ Definition~\ref{def:smooth}. In this context,~\citet{Nesterov-2006-Constrained} also considered the setting where $F$ is monotone and first-order smooth with a Lipschitz constant $L > 0$ and proposed a second-order dual extrapolation method for computing the weak solution of the VI. Starting with the initial points $x_0 \in \mathcal{X}$ and $s_0 = 0 \in \mathbb{R}^d$, the $k^{\textnormal{th}}$ iteration of the scheme is given by \begin{equation*} \begin{array}{rl} & \textnormal{Find } v_{k+1} \in \mathcal{X} \textnormal{ s.t. } v_{k+1} = \mathop{\rm{argmax}}_{v \in \mathcal{X}} \ \langle s_k, v - x_0\rangle - \tfrac{\beta}{3}\|v - x_0\|^3, \\ & \textnormal{Find } x_{k+1} \in \mathcal{X} \textnormal{ s.t. } \langle F_{v_{k+1}}^1(x_{k+1}) + \tfrac{M}{2}\|x_{k+1} - v_{k+1}\|(x_{k+1} - v_{k+1}), x - x_{k+1}\rangle \geq 0 \\ & \textnormal{for all } x \in \mathcal{X}, \\ & s_{k+1} = s_k - \lambda F(x_{k+1}), \end{array} \end{equation*} where $F^1_v(\cdot): \mathbb{R}^d \mapsto \mathbb{R}^d$ is defined as first-order Taylor expansion of $F$ at a point $v \in \mathcal{X}$: \begin{equation*} F^1_v(x) = F(v) + \nabla F(v)(x - v). \end{equation*} This schemed is based on the dual extrapolation step but with a different regularization and with a first-order Taylor expansion of $F$. This makes sense since we have zeroth-order and first-order derivative information available and hope to use both of them to accelerate convergence. Similar ideas have been adopted for convex optimization~\citep{Nesterov-2006-Cubic}, leading to a simple second-order method with faster global rate of convergence~\citep{Nesterov-2008-Accelerating} than optimal first-order method~\citep{Nesterov-1983-Method}. Unfortunately, the above second-order dual extrapolation method with $\beta = 6L$, $M = 5L$ and $\lambda = 1$ is only guaranteed to achieve an iteration complexity of $O(\epsilon^{-1})$~\citep[Theorem~4]{Nesterov-2006-Constrained}. \section{Conclusions}\label{sec:conclu} We have proposed and analyzed a new $p^{\textnormal{th}}$-order method---\textsf{Perseus}---for finding a weak solution of smooth and monotone variational inequalities when $F$ is smooth with up to $(p-1)^{\textnormal{th}}$-order derivatives. Our results are based on the assumption that the subproblem arising from a $(p-1)^{\textnormal{th}}$-order Taylor expansion of $F$ can be computed approximately in an efficient way. For the case of $p \geq 2$, the best existing $p^{\textnormal{th}}$-order methods can achieve a global rate of $O(\epsilon^{-2/(p+1)}\log(1/\epsilon))$~\citep{Bullins-2020-Higher,Lin-2021-Monotone,Jiang-2022-Generalized} but require a nontrivial binary search procedure at each iteration. The open question has been whether it is possible to obtain a simple high-order regularization method which can achieve a global rate of $O(\epsilon^{-2/(p+1)})$ while dispensing with binary search. Our results settle this open problem. Our method converges to a weak solution with a global rate of $O(\epsilon^{-2/(p+1)})$ and the restarted version can attain global linear and local superlinear convergence for smooth and strongly monotone VIs. Our method also achieves a global rate of $O(\epsilon^{-2/p})$ for solving a class of smooth and non-monotone VIs satisfying the Minty condition and its restarted version attains global linear and local superlinear convergence if the strong Minty condition holds true. Future research directions include the investigation of lower bounds for any $p^{\textnormal{th}}$-order method in the case of $p \geq 2$ and the comparative study of lower-order methods in VI problems where higher-order smoothness is assumed; see~\citet{Nesterov-2021-Auxiliary,Nesterov-2021-Inexact,Nesterov-2021-Superfast,Doikov-2022-Affine}.
\section{Introduction} Quality-Diversity (QD) \cite{cully2017quality} algorithms have become the subject of increasing interest in the research community, mainly due to their reported success in many areas ranging from Reinforcement Learning (RL) and Control \cite{pierrot2020diversity, kim2021exploration, cully2015robots} to vehicle conception \cite{gaier2018data} and game level design \cite{charity2020baba}. As QD has arguably grown into a distinct branch of stochastic optimization \cite{chatzilygeroudis2021quality}, a few problems, such as locomotion \cite{cully2015robots, mouret2020quality} or navigation tasks \cite{sfikas2021monte, vassiliades2017comparison, gravina2016surprise} (and sometimes combinations of the two \cite{paolo2021sparse, colas2020scaling}) have repeatedly been used, becoming \textit{de facto} benchmarks. To what extent are these evaluation environments sufficient, or even relevant? Are they really representative of the general challenges that QD methods might face? Do they have much predictive power in terms of generalization to other environments? At the very least, they are not standardized, and none of them can be seen as \texttt{MNIST} or \texttt{CIFAR-10} equivalents for QD. Common benchmarks are important tools for structuring scientific communities and helps them make faster progress \citep{sim2003using}. It is a sign of maturity that allows to enter into Kuhn's \textit{normal science} \citep{kuhn1970ttie}. Motivated by the above, we draw inspiration from \texttt{bsuite} \cite{osband2019behaviour} which proposes a set of benchmarks for RL. Of particular interest to us are the desiderata identified by the authors, according to which a benchmark should be: \begin{enumerate} \item \textbf{Targeted:} it should correspond to a key problem faced by the community. \item \textbf{Simple:} it should strip away confounding/confusing factors in research. \item \textbf{Challenging:} the problem must encourage the development of methods that expand the current boundaries. \item \textbf{Fast:} Execution should be possible on standard hardware and allow quick iterations (ideally, multiple iterations through a day, from launch to results). \item \textbf{Scalable:} the benchmark should provide insight on scalability, not performance on one environment. \end{enumerate} It should be noted that QD algorithms \textemdash aside from having applications outside of RL \textemdash are fundamentally different from most forms of policy search as their main goal is to generate sets of solutions that cover a behavior space. This frees QD algorithms from some of the typical optimization problems such as premature convergence to local minima. Furthermore, as we will discuss throughout the paper, QD algorithms face challenges of their own. Therefore, while existing RL environments are indeed valuable tools for evaluating QD algorithms, they should not be the only ones. Our aim in this paper is to encourage the development of a \texttt{QD-suite}: a benchmark tailored to the specificities of QD, that would embody the five properties enumerated above. As an initial effort in this direction, we report three challenges that we have identified in sparse/non-existent reward settings, and for each case, propose simple environments that isolate those problems: \begin{itemize} \item \textbf{The behavior metric bias}. Situations in which the distance function does not capture the structure of the reachable behavior space can lead to selection pressures that prevent the population from reaching certain parts of the search space. The benchmark that we present to highlight that problem (\S\ref{sec_spiral}) shows that without the use of the proper geodesic distance and compensating for bias inducing mutation schemes, QD algorithms, even with unreasonably large archives, can struggle to cover the entire search space. \item \textbf{Behavioral plateaus.} The ability of QD algorithms in "escaping" areas of the genotype space over which the behavior function is constant (or where evolvability is very low) is dependent on their underlying mutation and selection schemes. The benchmark problem that we present is composed of various such plateaus, and suggests that QD algorithms should adapt themselves to the structure of the behavior space. \item \textbf{Evolvability Traps.} The third challenge that we have identified is related to areas of the behavior space in which small variations in genotype create large changes in behavior. QD methods can be lured by these areas at the expense of subspaces that would have been more promising in the longer term. \end{itemize} This list of is clearly not exhaustive, and is expected to grow as new challenges are identified in the future. The environments that we propose are simple, and each of them focuses on a different problem with which QD methods struggle. They are suitable for rapid experimentation without requiring powerful clusters, as they do not require costly simulations. Additionally, the difficulties that they highlight can occur in more complex problems at larger scales. They are thus well aligned with the qualities that we listed. In the next section, the notations that will be used throughout the paper, as well as the reference methods on which the benchmarks have been tested will be introduced. The following three sections (\S\ref{sec_spiral}, \S\ref{section_ssf} and \S\ref{section_deceptive_evo}) introduce benchmarks associated to the three proposed challenges. \section{Notations and Reference methods} Throughout the paper, genotype spaces will be noted $\mathcal{G}$. The behavior descriptor space and the behavior function will respectively be noted $\mathfrak{B}$ and $\phi:\mathcal{G} \rightarrow \mathfrak{B}$. When necessary, various superscripts and subscripts will be introduced in order to differentiate between different parametrizations of genotypes, behaviors and behavior mappings. The population at generation $g$ will be noted $\mathcal{P}^g$, and we will write $\mathcal{G}_{max}$ the maximum number of generations. \textbf{Reference methods.} For the first benchmark, experiments were based on the Novelty Search algorithm \cite{lehman2011abandoning} with both \textit{unstructured} and \textit{structured} archives. In the latter case, we also experimented with resampling in the archive, making the method a hybrid between NS and MAP-elites \cite{mouret2015illuminating}. For the second and third benchmarks, we report results from evaluating both NS with an unstructured archive and MAP-elites using a vanilla grid-based archive. In the case of unstructured archives with bounded sizes, individuals added/removed to/from the archive are selected randomly. \section{Behavior distance bias: Archimedean-Spiral-v0} \label{sec_spiral} The aim of the toy environments that we develop in this section is to show that the non-linearity of the behavior function $\phi$ as well as the use of inadequate distance metrics \footnote{In general, QD algorithms \textemdash whether they belong the NS or MAP-elites family \textemdash use the Euclidean distance by default. Some exceptions exist, such as in robotic manipulation where distances are measured in the tangent plane of $SE(N)$ \cite{salehi2021few}. However, those also do not correspond to the true structure of the reachable behavior space, which is defined by the scene and the limits of the actuators.} results in biased exploration, which can be difficult to overcome by common QD algorithms. Let us assume a reachable behavior space $\mathfrak{B}_{spiral}$ given by an archimedean spiral (figure \ref{fig_spiral_setup}) embedded in $\mathbb{R}^2$ whose equation in Cartesian coordinates is given by (for $t \in \mathbb{R}^{+}$) \begin{equation} \gamma(t)=(at\cos(t), at\sin(t)) \end{equation} and for which the geodesic distance naturally coincides with its arc-length, given by \begin{equation} S(t_1,t_2)=\frac{a}{2}(t\sqrt{t^2+1} + \log(t+\sqrt{t^2+1}))\rvert_{t_1}^{t_2}. \end{equation} In general, the geodesic distance is unknown to the QD algorithm. Instead, the Euclidean metric from the $\mathbb{R}^N$ space in which the behavior space is embedded is used. Let us now define the two distinct bounded genotype spaces \begin{equation} \begin{cases} \mathcal{G}_b\triangleq [0,\alpha\pi]\\ \mathcal{G}_u\triangleq \{S(0,l) \rvert l \in [0, \alpha\pi]\} \end{cases} \end{equation} for some positive real $\alpha$. Indeed, $\mathcal{G}_b$ corresponds to the angle parametrization of the curve, and $\mathcal{G}_u$ is the set of possible arc-lengths. Let us use an isotropic Gaussian mutation operator, and finally, let us define two mappings from those genotypes to $\mathbb{R}^2$: \begin{equation} \begin{cases} \phi_b(g_b)\triangleq \gamma(g_b) & \forall g_b \in \mathcal{G}_b \\ \phi_u(g_u)\triangleq \gamma(S^{-1}(g_u)) & \forall g_u \in \mathcal{G}_u \end{cases} \end{equation}. The motivation behind this choices for $\phi_b$ and $\phi_u$, which both have $\mathfrak{B}_{spiral}$ as their image, is that they behave differently under Gaussian mutations: it can easily be verified that an isotropic Gaussian distribution in $\mathcal{G}_b$ will be mapped by $\phi_b$ to a distribution that is skewed towards the exterior of the spiral, while an isotropic Gaussian distribution in $\mathcal{G}_u$ will be mapped by $\phi_u$ to an isotropic Gaussian on $\gamma$. Note that the mapping $S^{-1}$ can not be expressed in closed form. As a result, whenever necessary, we approximate its values by solving the corresponding ordinary differential equation. All experiments in that section were based on NS and NS/MAP-elites hybrids resulting from pairing NS with a structured archive and/or allowing resampling in the archive instead of in the active population. We set $\alpha=30$, with population and offspring sizes of $M=N=30$, mutations sampled from $\mathcal{N}(0,0.3)$ and considered $k=10$ nearest neighbors to compute the NS objective. In all of the experiments, the number of generations was set to $G_{max}=1000$, and all individuals were initialized with a value of $s$ (the red dot in figure \ref{fig_spiral_setup}). Consider the four possible problems defined by pairing a distance function with a parametrization. It can be empirically verified (figure \ref{spiral_metrics}) that without the use of an archive, NS is unlikely to cover the search space unless both the correct geodesic distance is used in conjunction with the unbiased parametrization $\phi_u$. As knowing/learning the correct geodesic distance and the availability of mutation operators that do not induce local bias are impractical in more complex problems, we focus from now on on the case were the Euclidean metric is used with the bias-inducing parametrization $\mathcal{G}_b$. Interestingly, in that situation, NS still struggles when endowed with archives of considerable size (relative to problem dimensionality and the size of the behavior space). Figure \ref{spiral_metrics_archive} shows the cumulative results (across runs) of NS experiments with both unstructured and structured archives, when the Euclidean metric is used with the bias-inducing parametrization $\mathcal{G}_b$. As figures \ref{spiral_metrics_archive} (a, b) demonstrate, even unreasonably large archive sizes \footnote{Recall that the time complexity of NS is $O(N\log N)$ with $N$ the archive size\cite{mouret2015illuminating}. Thus, in practical applications, it is desirable to bound the archive. The inability of a method to solve a simple low-dimensional problem using a small archive might hint at scalability issues.} do not lead to complete behavior space coverage. We found that in order to ensure full coverage consistently, the archive needed to grow very large (>$1000$ individuals, see figure \ref{spiral_metrics_archive}(c)). Note that sampling from the archive instead of only from the active population (figure \ref{spiral_metrics_archive} (e)) did not result in significant improvements. Structured archives (in the spirit of vanilla MAP-elites \cite{mouret2015illuminating}) which also require some effort in order to tune their resolution to the behavior space, did not lead to success either \ref{spiral_metrics_archive} (d, f). The main reason for that outcome is that once the exterior of the spiral has been covered, the discovery of the parts towards the center depends on the selection of a single particular cell, which can not be done in a reasonable time without biasing the selection. As discussed in \cite{salehi2021few}, a potential solution to that problem is the use of complementary selection pressures: in particular, a promising solution could result from combining NS with selection pressures that are \textit{absolute} (as opposed to relative to an ever-moving archive), such as the occupancy information that is made available from the use of a structured archive. \begin{figure}[ht!] \includegraphics[width=50mm,clip]{ims/problem_setting_pts.png}\\ \caption{An Archimedean spiral with parameter $a=0.01$ and $t \in [0, 30\pi]$ embedded in $\mathbb{R}^2$. It is clear that using the Euclidean distance and $k=1$, points $A$ and $B$ will have higher Novelty scores than $C$ and $D$. In contrast, using the geodesic distance, $C$ and $D$ would have much higher Novelty than $A$ and $B$. In this figure, the red dot indicates the starting point of the agents in our experiments.} \label{fig_spiral_setup} \end{figure} \begin{figure}[ht!] \centering \captionsetup[subfigure]{justification=centering} \subfloat[Euclidean distance, $\phi_b$ parametrization.][Euclidean distance,\\ $\phi_b$ (angle) parametrization.]{ \includegraphics[width=42mm,trim={1cm 0 1cm 1.4cm},clip]{ims/euclidean_cumulated_agent_parametrisation_angle.png}} \subfloat[Euclidean distance, $\phi_u$ parametrization.][Euclidean distance,\\ $\phi_u$ (arc-length) parametrization.]{ \includegraphics[width=42mm,trim={1cm 0 1cm 1.4cm},clip]{ims/euclidean_cumulated_agent_parametrisation_arclen.png}}\\ \subfloat[Geodesic distance, $\phi_b$ (angle) parametrization.][Geodesic distance,\\ $\phi_b$ (angle) parametrization.]{ \includegraphics[width=42mm,trim={1cm 0 1cm 1.4cm},clip]{ims/geodesic_cumulated_agent_parametrisation_angle.png}} \subfloat[Geodesic distance, $\phi_u$ (arc length) parametrization.][Geodesic distance,\\ $\phi_u$ (arc length) parametrization.]{ \includegraphics[width=42mm,trim={1cm 0 1cm 1.4cm},clip]{ims/geodesic_cumulated_agent_parametrisation_arclen.png}}\\ \caption{The cumulative results of $20$ Archive-less Novelty search experiments in the four problem settings. Note that in (a) and (c), a Gaussian distribution centered at $g_b \in \mathcal{G}_b$ is mapped to a distribution with mean $\phi_u(g_b)$ but that is skewed towards the exterior of the spiral. In (a) and (b), the use of the Euclidean metric results in lower Novelty scores towards the interior of the spiral.} \label{spiral_metrics} \end{figure} \begin{figure}[ht!] \centering \captionsetup[subfigure]{justification=centering} \subfloat[Unstructured archive, maximum size of $100$][Unstructured archive,\\ maximum size of $100$]{ \includegraphics[width=40mm,trim={0.6cm 0 1.0cm 1.4cm},clip]{ims/finite_archive_bad_metrics_100.png}} \subfloat[Unstructured archive, maximum size of 200][Unstructured archive,\\ maximum size of 200]{ \includegraphics[width=40mm,trim={1cm 0 1cm 1.4cm},clip]{ims/finite_archive_bad_metrics.png} \subfloat[Unstructured archive, maximum size of 3000][Unstructured archive,\\ maximum size of 3000]{ \includegraphics[width=40mm,trim={1cm 0 1cm 1.4cm},clip]{ims/finite_archive_bad_metrics_3000.png}} \subfloat[Structured archive,no resampling in the archive][Structured archive,\\ no resampling in the archive]{ \includegraphics[width=40mm,trim={1cm 0 1cm 0},clip]{ims/structured_archive_bad_metrics.png}} \subfloat[Unstructured archive, maximum size of 200 and resampling in the archive][Unstructured archive,\\ maximum size of 200 and\\ random resampling in the archive]{ \includegraphics[width=40mm,trim={1cm 0 1cm 1.4cm},clip]{ims/finite_archive_bad_metrics_200_resampling_elitist.png}} \subfloat[Structured archive,random resampling in the archive][Structured archive,\\ random resampling in the archive]{ \includegraphics[width=40mm,trim={1cm 0 1cm 0},clip]{ims/structured_archive_bad_metrics_random_resampling.png}} \caption{Cumulated results of experiments (with $G_{max}=1000$) obtained with different archive configurations when the Euclidean metric and the $\phi_b$ parametrization were used.} \label{spiral_metrics_archive} \end{figure} \section{Behavioral plateaus: SSF-v0} \label{section_ssf} The benchmark set that we propose in this subsection demonstrates that in the absence of rewards, QD algorithms can get trapped in some areas of the search space, unless they have the capacity to adapt themselves (\textit{e.g.} their mutations) to the surface's structure. The benchmark, that we have dubbed SSF-v0 for \textbf{S}elf-\textbf{S}imilar \textbf{F}unction \textbf{V}ersion 0, is a set of environments, each of which can be instantiated via a choice of genotype dimensionality. We will call an SSF-v0 problem with genotype dimensionality $N$ an \textit{SSF-V0 problem of order N}. The corresponding behavior mapping will be written $\phi_{ssf}^N$. Before presenting formal definitions, let us briefly explain the intuition behind the benchmark's design using the SSF-V0 of order 1, shown in figure \ref{fig_self_similar_1} (top). The behavior mapping function $\phi_{ssf}^1$ results from replicating and scaling the same linear and constant parts an infinite number of times. Let us denote by $l_0, l_1, ...$ the series of intervals over which the function is constant (sorted by increasing interval length)\footnote{Since $l_0$ is fixed, the function's graph is not a fractal as it does not cover arbitrarily small scales}. Assume that the population is initialized at the origin. Suppose a QD algorithm has reached an interval $l_i$ at some generation $g$, \textit{i.e.} that the population $\mathcal{P}^g$ contains a number of individuals $x_1,...,x_l$ that fall in $l_i$. Then, it will only be able to escape that plateau if the mutations that it applies to the $x_i$ are large enough for an offspring at some future generation $\mathcal{P}^{g+t}$ to fall with non-zero probability inside the linear regime that follows $l_i$. This is illustrated in figure \ref{fig_bench2_a}. The top and bottom plots respectively correspond to NS runs with Gaussian mutations of standard deviation $\sigma=20$ and $\sigma=50$. Both cases show the results after $1000$ generations, and in both situations, the exploration has been blocked at a plateau for more than $500$ generations. This indicates that fixed mutations can only prevent standard QD algorithms from being trapped in areas of constant behavior $l_i$ as long as the length of that interval stays below a certain threshold. Concretely, we define an environment from that benchmark as follows. \begin{definition} {SSF-v0 of order $N$.} Given a choice of dimensionality $N$, let the genotype \begin{equation} \mathcal{G}_{ssf}^N\triangleq \mathbb{R}^N \end{equation} and define the sequence $\{R_i\}_i$ as \begin{equation} \begin{cases} R_0=0 \\ R_i=R_{i-1}+2(\floor{\frac{i}{2}})^3 +1 & i=2k+1 \\ R_i=R_{i-1}+2(\floor{\frac{i}{2}}-1)^3 +1 & i=2k. \end{cases} \end{equation} \noindent Then, the behavior mapping will be given by \begin{equation} \begin{cases} \phi_{ssf}^N(g)=g & R_{2k}\leq ||g||_2<R_{2k+1}\\ \phi_{ssf}^N(g)=R_{2k+1} & R_{2k+1}\leq ||g||_2<R_{2(k+1)}. \end{cases} \end{equation} \end{definition} \noindent An example of SSF-v0 or order 2 is given in figure \ref{fig_self_similar_1} (bottom). While it is mathematically clear \footnote{Let us assume that a QD algorithms reaches a given plateau $l_i$, \textit{i.e.} that at least one individual $x$ in its current population is in that interval. In that situation, without any selection mechanism, a purely Gaussian random walk with std $\sigma$ starting at $x$ will result in a distribution $\mathcal{N}(x,\sqrt{n\sigma})$ after $n$ steps. The behavior-based selection pressure applied by the QD algorithm will further skew that distribution towards the linear regime between $l_{i-1}$ and $l_i$. This reduces the likelihood that an individual will reach $l_{i+1}$. Furthermore, the choice of $i$ was arbitrary, and the $l_j$ will grow continuously in length for $j>i$. } that fixed standard mutations with selection based on behavioral novelty eventually lead to being blocked at one of the plateaus, we ran both NS and MAP-elites experiments with $\sigma=20, 50$ for additional verification. We ran each experiment $20$ times. As expected, none of the instances were able to make any progress beyond the points that we reported previously in figure \ref{fig_bench2_a}. A potential solution to the problem that this benchmark highlights is to use adaptive mutations. While such mutations are standard in fitness-driven optimization (\textit{e.g.} CMA-ES\cite{hansen2016cma}), their use in the QD literature remains relatively rare \cite{fontaine2020covariance, paolo2021sparse}, and even then, mutations are only tailored according to reward/fitness, without consideration for behavioral plateaus. Usually, the standard deviation of the mutations is considered as a hyperparameter that is fixed by the practitioner, sometimes via a trial and error process. \begin{figure}[ht!] \includegraphics[width=75mm,trim={2.1cm 0.5cm 1.9cm 0.5},clip]{ims_benchmark_2/func_order_1.png}\\ \includegraphics[width=69mm,trim={2.0cm 0.5cm 1.9cm 1.0},clip]{ims_benchmark_2/func_order_2.png}\\ \caption{\textbf{(Top)} SSF-v0 of order 1. The horizontal axis is the one-dimensional genotype, and the horizontal axis is the behavior space. As highlighted by the zooming window in the figure, the mapping $\phi_{ssf}^1$ results from replicating and rescaling the same linear and constant segments. The function is designed to illustrate that the sequence $l_0, l_1, ...$ of intervals of increasing length over which $\phi_{ssf}^1$ is constant can act as a series of barriers that can not be overcome without adapting the mutation/selection process to the surface's structure. Indeed, taking $l_i$ and $l_j$ with $i<<j$, the \textit{minimum mutation standard deviation} that allows a divergent search algorithm to "escape" from $l_i$ is much smaller than the minimum standard deviation that would allow it to bypass $l_j$. \textbf{(Bottom)} SSF-v0 of order 2.} \label{fig_self_similar_1} \end{figure} \begin{figure}[ht!] \subfloat[Gaussian mutations with std $\sigma=20$.][Gaussian mutations with std $\sigma=20$.]{ \includegraphics[width=75mm,trim={0cm 0 0cm 0cm},clip]{ims_benchmark_2/mut_a_gen_999.png}}\\ \subfloat[Gaussian mutations with std $\sigma=50$.][Gaussian mutations with std $\sigma=50$.]{ \includegraphics[width=75mm,trim={0cm 0 0cm 0cm},clip]{ims_benchmark_2/mut_b_gen_999.png}} \caption{The results of NS runs with different Gaussian mutation standard deviations. Both cases show the results after $1000$ generations as exploration has been unable to progress past one of the plateaus for about $500$ generations. As the difference between the two plots show, setting $\sigma=50$ only enables the algorithm to escape a single additional plateau compared to the case in which $\sigma=20$.} \label{fig_bench2_a} \end{figure} \section{Evolvability trap: Deceptive-Evolvability-v0} \label{section_deceptive_evo} Current state of the art QD algorithms do not take into account the fact that the mapping $\phi$ from genotypes to behaviors is many to one, and as a result do not discriminate between different solutions that produce similar behaviors. Indeed, two solutions $x_1, x_2 \in \mathcal{G}$ for which $\phi(x_1)=\phi(x_2)$ can exhibit different properties that might make one solution preferable to the other. One possible aspect to consider when choosing between the two is the brittleness of the solution: even in situations where $x_1$ and $x_2$ have the same evolvability, mutating $x_1$ could result in individuals that exhibit novel behaviors but still solve the task at hand, but mutating $x_2$ can result in novel behaviors that are of no interest at all. A more critical problem arises when $x_1$ and $x_2$ differ in terms of evolvability. In that situation, a QD algorithm is likely to focus on the offsprings of the most evolvable one, therefore abandoning areas of the genotype space that could have been more promising in the long term. We conjecture that the second situation mentioned above is responsible for poor behavior space coverage in at a number of practical applications \footnote{An example that has motivated this benchmark is robot navigation in complex environments, where two neural network controllers that are both capable of solving the same task $\mathcal{T}_1$, but whose weights lie in different areas of genotype space, exhibit different evolvabilities and thus, do not have the same potential for discovering solutions to tasks $\mathcal{T}_2, ..., \mathcal{T}_n$ that are follow-ups to $\mathcal{T}_1$.}, and propose a simple benchmark problem that models that situation. Let us define the genotype space as $\mathcal{G}_{de}\triangleq [0, L]\times[0,L]$ with $L \in \mathbb{R}^{+}$, and let us define the behavior function as an unnormalized Gaussian Mixture with two isotropic components: \begin{equation} \phi_{de}(x)=\mathcal{N}(x|\mu_1, \sigma_1I_2) + \beta\mathcal{N}(x|\mu_2, \sigma_2I_2) \end{equation} such that $\sigma_1 < \sigma_2$ and $\beta\in \mathbb{R}^{+}$ is sufficiently large to ensure that \begin{equation} \argmax_x \phi_{de}(x)=\mu_2. \end{equation} Of particular interest to us are configurations that are similar to the one shown in figure \ref{fig_bench3_a}, where $\sigma_1$ is significantly smaller than $\sigma_2$ and $\beta$ is a relatively large scalar. Let us use the saddle point $x_{saddle}$ (defined by null gradients and a negative Hessian, marked with a red dot in figures \ref{fig_bench3_a} top and bottom left) to initialize the population of the QD algorithm that we want to benchmark, \textit{i.e.} $\mathcal{P}^0 \sim \mathcal{N}(x_{saddle},\sigma)$ where $\sigma$ is the standard deviation of the mutation operator. Gaussian mutations are used in what follows, but extending the discussion to variants of the bounded polynomial operator \cite{deb2002fast} is straight-forward. Noting $M_1\triangleq \mathcal{N}(\mu_1|\mu_1,\sigma_1I_2)$ and $M_2\triangleq \mathcal{N}(\mu_2|\mu_2,\sigma_2I_2)$, the reachable behavior space can be written \begin{equation} [0,M_2]=[0,M_1]\cup[M_1,M_2]. \end{equation} While $[0,M_1]$ can be covered by the QD algorithm by "climbing" towards the mode that results from the Gaussian with smaller variance $\sigma_1$, covering the interval $[M_1,M_2]$ requires the exploration to move towards the other mode. Note that in the example of figure \ref{fig_bench3_a}, $[M_1, M_2]$ corresponds to about one third of the reachable behavior space. \begin{figure}[h!] \includegraphics[width=75mm,clip]{ims_benchmark_3/fig_a.png}\\ \caption{(top) 3d view of the proposed benchmark problem, in which $\sigma_1^2=70$ and $\sigma_2^2=1e4$, and $\beta=20$. The red dot indicates the saddle point at which the population is initialized. As explained in the text, individuals falling in the area in which the dominant component of the GMM is the one that has smaller standard deviation $\sigma_1$ will have higher evolvability and thus be more likely to be selected by the QD algorithm. (bottom left) For better visibility, a heatmap view of the problem is provided, with the initialization point also marked as a red dot. (bottom right) Most likely outcome of QD exploration after $100$ generations. Blue dots are archive individuals, and red dots indicate the active population.} \label{fig_bench3_a} \end{figure} \begin{figure}[h!] \centering \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0) { \includegraphics[width=75mm,clip]{ims_benchmark_3/m.png}}; \begin{scope}[x={(image.south east)},y={(image.north west)}] \node (A) at (0.875, -0.2) {$M_1$}; \node (B) at (0.875, 0.096) {}; \draw[red, thick, ->] (A) edge (B); \node (C) at (0.966, -0.2) {$M_2$}; \node (D) at (0.966, 0.096) {}; \draw[red, very thick, ->] (C) edge (D); \end{scope} \end{tikzpicture} \caption{Results of NS experiments on the deceptive evolvability problem, for different mutation standard deviations, averaged over $40$ runs for each case. (Left) Evolution of behavior space coverage (mean and std). (Right) Histogram of reached behaviors in the $[0,M_2]$ interval. Due to differences in evolvability, the population that is initialized at the saddle point will most likely converge to the mode that corresponds to the GM component with smaller standard deviation, and therefore, NS runs that discover the $[M_1, M_2]$ behavior interval are rare.} \label{fig_bench3_b} \end{figure} \begin{figure}[h!] \centering \begin{tikzpicture} \node[anchor=south west,inner sep=0] (image) at (0,0) { \includegraphics[width=75mm,clip]{ims_benchmark_3/m2.png}}; \begin{scope}[x={(image.south east)},y={(image.north west)}] \node (A) at (0.888, -0.2) {$M_1$}; \node (B) at (0.888, 0.096) {}; \draw[red, thick, ->] (A) edge (B); \node (C) at (0.972, -0.2) {$M_2$}; \node (D) at (0.972, 0.096) {}; \draw[red, very thick, ->] (C) edge (D); \end{scope} \end{tikzpicture} \caption{Results of MAP-elites experiments for different mutation standard deviations, averaged over $40$ runs for each case. Due to its uniform sampling in the entire archive, MAP-elites converges much more slowly than NS (see figure \ref{fig_bench3_a}). For this reason, we have not included map-elites with $\sigma=3\%\sigma_2$ in that figure. (Left) Evolution of behavior space coverage (mean and std). (Right) Histogram of reached behaviors in the $[0,M_2]$ interval. As in the case of NS, the population that is initialized at the saddle point will most likely converge to the mode that corresponds to the GM component with smaller standard deviation, and therefore, MAP-elites also fails to discover the $[M_1, M_2]$ behavior interval (which corresponds to about one third of the reachable behavior space).} \label{fig_bench3_c} \end{figure} Since $\phi_{de}$ is smooth and the Gaussians are isotropic, evolvability in that situation reduces to gradient: indeed, the behavior space that is reachable by applying Gaussian mutations $\delta x \sim \mathcal{N}(0, \sigma)$ to an individual $x$ is determined by the gradient of $\phi_{de}$ at $x$. Furthermore, since $\phi_{de}$ is injective in sufficiently small neighborhoods of $x$ there is no difference in uniformity statistics between individuals. In the configuration given in figure \ref{fig_bench3_a}, the gradient is higher around the mode that corresponds to the first component of the mixture, which has a smaller standard deviation $\sigma_1I$. Therefore, offsprings produced by individuals that fall inside that area of genotype space are more likely to be considered novel by the QD algorithm. As a result of those differences in evolvability, QD algorithms are likely to be lured and get trapped in the area that corresponds to the Gaussian with small standard deviation in the particular problem setting shown in figure \ref{fig_bench3_a}. Figure \ref{fig_bench3_a} (bottom right) shows the most likely outcome that we encountered after $100$ generations of Novelty Search, initialized at the saddle point. In that figure, red points are population individuals, and blue points correspond to the individuals that are stored in Novelty Search's archive (with a maximum size of $200$, and random addition/removal). We report quantitative results for both Novelty Search and MAP-elites in (respectively) figures \ref{fig_bench3_b} and \ref{fig_bench3_c}. We experimented with mutation standard deviations that were fixed w.r.t the standard deviation of the larger component in the GM. More precisely, we considered $\sigma$ values equivalent to $\{3\%, 5\%, 10\%\}$ of $\sigma_2$ for NS-based experiments. Because of the considerably slower convergence of vanilla MAP-elites, which is due to its random sampling from the entire archive, we only report its performance for $\sigma \in \{5\%\sigma_2, 10\%\sigma_2\}$ and omit the smaller $\sigma=3\%\sigma_2$ value. The results were averaged over $40$ run for each case, in each of which, the population was initialized at the saddle point, as previously detailed. As the histogram in figure \ref{fig_bench3_b} (right) as well as the one in \ref{fig_bench3_c} (right) show, QD instances that are able to reach the behavior interval $[M_1,M_2]$ are rare, as the majority of the runs get trapped in the deceptive Novelty optimum. This is also confirmed by the mean and standard deviation of the evolution of archive coverage (figure \ref{fig_bench3_b} (left) and figure \ref{fig_bench3_c} (left)). \section{Conclusion} \label{section_conclusion} In this paper, we presented our initial suggestions and efforts towards developing a standard set of benchmark problems for QD methods. Inspired by \texttt{b-suite}\cite{osband2019behaviour}, we required that those benchmarks should be targeted, simple, fast, challenging and scalable. We identified three challenges in sparse reward settings: \textit{distance metric bias}, \textit{behavioral plateaus} and \textit{evolvability traps}. Our experiments showed that those environments where challenging for both Novelty Search and MAP-elites variants. The list of challenges that we emphasized is far from being exhaustive, and other challenges will naturally need to be identified as the field progresses. \section*{ACKNOWLEDGMENT} This work was supported by the European Union's H2020-EU.1.2.2 Research and Innovation Program through FET Project VeriDream under Grant Agreement Number 951992. \bibliographystyle{ACM-Reference-Format}
\section{Introduction} Kleene algebra with tests \cite{Kozen1997}, KAT, is a simple algebraic framework for verifying properties of propositional while programs. KAT subsumes propositional Hoare logic \cite{Kozen2000} and it has been applied in a number of verification tasks. KAT has computationally attractive fragments \cite{SmolkaEtAl2020} and its extensions have been applied beyond while programs, for instance in network programming languages \cite{AndersonEtAl2014}. KAT is two-sorted, featuring a Boolean algebra of tests embedded into a Kleene algebra of programs. For various reasons, a one-sorted alternative to KAT may be desirable. One such alternative is Kleene algebra with domain, KAD, in its ``internal'' formulation \cite{DesharnaisStruth2011}. The idea of KAD is to expand Kleene algebra with a domain operator $d$ such that the set of images of elements of the algebra under $d$ forms a Boolean algebra. Hence, one obtains a Boolean algebra of tests in a one-sorted setting. Consequently, the equational theory of KAT embeds into the equational theory of KAD. However, the properties of the domain operator in KAD lead to some curious features of the framework. For instance, the algebra of tests is always the maximal Boolean subalgebra of the negative cone in the underlying Kleene algebra. In a sense, then, every ``proposition'' is considered a test, contrary to some of the intuitions expressed in \cite{Kozen1997}. Moreover, not each Kleene algebra can be expanded with a domain operator, not even every finite one. This is in contrast with the fact that each KA is expands to a KAT. In this paper we generalize KAD to a framework we call \emph{one-sorted Kleene algebra with tests}, KAt. Our framework has the desired features of KAD: every KAt contains a Boolean subalgebra of tests and the equational theory of KAT embeds into the equational theory of KAt. In addition, every Kleene algebra expands into a KAt, and the subalgebra of tests in KAt is not necessarily the maximal Boolean subalgebra of the negative cone. We also consider various extensions of KAt with axioms known from KAD to show which properties of the domain operator are still consistent with the desired features of KAt. In addition, we consider a variant of the KAt framework where test complementation is defined using a residual of Kleene algebra multiplication. It can be shown that algebras in this framework form a variety. The paper is organized as follows. In Sections \ref{sec:KAT} and \ref{sec:KAD} we recall Kleene algebra with tests and Kleene algebra with domain, respectively. In Section \ref{sec:KAt} we introduce one-sorted Kleene algebra with domain. We show that every Kleene algebra with domain is a one-sorted Kleene algebra with tests, that the test algebra in every one-sorted KAT is a Boolean algebra, and that every Kleene algebra expands into a one-sorted Kleene algebra with tests. In Section \ref{sec:ext} we consider some extensions of one-sorted KAT that retain the good properties. In Section \ref{sec:embedding} we show that the equational theory of KAT embeds into the equational theory of one-sorted KAT and a number of its extensions. Section \ref{sec:residual} briefly considers a residuated variant of one-sorted KAT that forms a variety. \section{Kleene algebra with tests}\label{sec:KAT} We assume that the reader is familiar with the notion of an \emph{idempotent semiring}. The definition of Kleene algebra is taken from \cite{Kozen1994}. The reader is referred to \cite{Kozen1997} for more details on Kleene algebra with tests. \begin{definition} A \emph{Kleene algebra} is an idempotent semiring $(K, \cdot, +, 1, 0)$ expanded with an operation $^{*} : K \to K$ such that \begin{gather*} 1 + x x^{*} \leq x^{*}\\ 1 + x^{*}x \leq x^{*}\\ y + xz \leq z \implies x^{*}y \leq z\\ y + zx \leq z \implies y x^{*} \leq z \end{gather*} A \emph{Kleene algebra with tests} is $(K, B, \cdot, +, ^{*}, 1, 0, \, \bar{ } \, )$ such that \begin{itemize} \item $(K, \cdot, +, ^{*}, 1, 0)$ is a Kleene algebra, \item $B \subseteq K$, and \item $(B, \cdot, +, \, \bar{ }\, , 1, 0) $ is a Boolean algebra. \end{itemize} \end{definition} A standard example of a Kleene algebra is a relational Kleene algebra where $K$ is a set of binary relations over some set $S$, $\cdot$ is relational composition, $+$ is set union, $^{*}$ is reflexive transitive closure, $1$ is identity on $S$ and $0$ is the empty set; another standard example is the Kleene algebra of regular languages over some finite alphabet. Every KA is a KAT; take $B = \{ 0, 1 \}$ and define $\bar{0} = 1$, $\bar{1} = 0$ and $\bar{x} = x$ for $x \notin \{ 1, 0 \}$. The class of Kleene algebra with tests is denoted as $\mathbf{KAT}$. A standard example of a KAT is a relational KA expanded with a Boolean subalgebra of the \emph{negative cone}, i.e.~the elements $x \leq 1$, which in the relational case are subsets of the identity relation. The class of relational Kleene algebras with tests will be denoted as $\mathbf{rKAT}$. The equational theory of $\mathbf{KAT}$ is defined in terms of a two-sorted language. Let $\mathsf{B} = \{ \mathsf{b}_n \mid n \in \omega \}$ and $\mathsf{P} = \{ \mathsf{p}_{n} \mid n \in \omega \}$ be two disjoint sets of \emph{test variables} and \emph{program variables}, respectively. The set of \emph{KAT terms} is two sorted: \begin{itemize} \item tests: \qquad\quad $b, c := \mathsf{b}_n \mid \mathsf{0} \mid \mathsf{1} \mid \bar{b} \mid b \cdot c \mid b + c $ \item programs: \quad $p,q := \mathsf{p}_n \mid b \mid p + q \mid p \cdot q \mid p^{*}$ \end{itemize} Note that each test is a program, and so we may use program variables to range over arbitrary KAT terms. The set of KAT terms is denoted as $\mathscr{T}_{\text{KAT}}$. If $\mathscr{B}$ is a KAT, then a \emph{$\mathscr{B}$-valuation} is any function $h$ from $\mathscr{T}_{\text{KAT}}$ to $\mathscr{B}$ such that \begin{itemize} \item $h(\mathsf{b}_n) \in B$ \item $h(\mathsf{0}) = 0$ and $h(\mathsf{1}) = 1$, and \item $h$ commutes with $\star \in \{ \cdot, +, ^{*}, \, \bar{ } \, \}$. \end{itemize} A \emph{KAT equation} is an ordered pair of KAT terms, denoted in general as $p \approx q$. An equation $p \approx q$ \emph{holds} is a $\mathscr{B}$-valuation $h$ iff $h(p) = h(q)$. The \emph{equational theory of $\mathbf{KAT}$} is the set of KAT equations that holds in all $\mathscr{B}$-valuations where $\g{B} \in \mathbf{KAT}$. The equational theory of $\mathbf{KAT}$ ($\mathbf{rKAT}$) is denoted as $\mathsf{KAT}$ ($\mathsf{rKAT}$). Propositional Hoare logic embeds into $\mathsf{KAT}$ \cite{Kozen2000}, $\mathsf{KAT}$ is PSPACE-complete \cite{CohenEtAl1996}, and $\mathsf{KAT} = \mathsf{rKAT}$ \cite{KozenSmith1997}. \section{Kleene algebra with domain}\label{sec:KAD} KAT is a two-sorted framework, and for various reasons it may be desirable to look for a one-sorted alternative. For instance, ``one-sorted domain semirings are easier to formalise in interactive proof assistants and apply in program verification and correctness.'' \cite[p.~576]{FahrenbergEtAl2022}. A one-sorted alternative called Kleene algebra with domain was introduced in \cite{DesharnaisStruth2011}, following earlier work on a related two-sorted framework \cite{DesharnaisEtAl2006}. The idea is to expand a Kleene algebra with an operation $d$ that transforms elements $x \in K$ into \emph{test-like} elements $d(x)$, and to show that the set of images of $x \in K$ under $d$, $d(K)$, forms a Boolean algebra. In other words, instead of assuming the existence of a Boolean subalgebra, such a subalgebra arises from images under a new operation $d$. The desired properties of $d$ are inspired by relational KAT, where tests are subsets of the identity relation. One obvious choice of a $d$ such that $d(R)$ is a subset of the identity relation is the \emph{relational domain} operation \begin{equation*} d(R) := \{ (s, s) \mid \exists u. (s, u) \in R \} \end{equation*} Informally, $d(R)$ represents the set of states in which the program associated with $R$ has a terminating computation. The main question shaping the definition of KAD is the following: \emph{which properties of relational domain should be adopted on the abstract algebraic level in order to yield a Boolean subalgebra?} \begin{definition} A \emph{predomain} operation on a Kleene algebra is any $d : K \to K$ such that \begin{gather} x \leq d(x)x\label{left_preserver}\\ d(xy) \leq d(xd(y))\label{sublocality}\\ d(x) \leq 1\\ d(0) = 0\\ d(x + y) = d(x) + d(y) \end{gather} A \emph{domain} operation on a Kleene algebra is any predomain operation that satisfies \begin{equation}\label{locality} d(xy) = d(xd(y)) \end{equation} \end{definition} It is easily checked that the relational domain operation is a domain operation on relational Kleene algebras. \begin{proposition}[\cite{DesharnaisStruth2011}]\label{prop:dKA} Let $\mathscr{K}$ be a Kleene algebra and let $d$ be a domain operation on $\mathscr{K}$. Let $d(K) := \{ y \mid \exists x. y = d(x) \}$. Then: \begin{enumerate} \item $d(K)$ contains $1$ and $0$, and it is closed under $\cdot$ and $+$; \item $d(\g{K}) = (d(K), \cdot, +, 1, 0)$ is a bounded distributive lattice. \end{enumerate} \end{proposition} In order to obtain a Boolean algebra from the distributive lattice $d(\mathscr{K})$, one has to make sure that each test $d(x)$ is complemented in $d(K)$, that is, for each $d(x)$ there is $y \in d(K)$ such that $d(x)y = 0$ and $d(x) + y = 1$. An elegant solution to this problem presented in \cite{DesharnaisStruth2011} consists in expanding Kleene algebras with a single unary operation $a$ (\emph{antidomain}) that allows to define a domain operation $d$ and has properties entailing that $a(x)$ is a complement of $d(x)$. \begin{definition} A \emph{Kleene algebra with domain} is a Kleene algebra expanded with an operation $a : K \to K$ such that \begin{gather} a(x)x = 0\\ a(xy) \leq a(x\, a(a(y)) \label{antidomain:DNI}\\ a(x) + a(a(x)) = 1 \end{gather} We define $d(x) := a(a(x))$. \end{definition} \begin{lemma}[\cite{DesharnaisStruth2011}] In each KAD, $d$ is a domain operation and $a(x)$ is a complement of $d(x)$. \end{lemma} \begin{theorem}[\cite{DesharnaisStruth2011}] In each KAD, $d(\g{K}) = (d(K), \cdot, +, 1, 0)$ is a Boolean algebra. \end{theorem} It has been shown that, at least in the semiring signature extended with $d$, the domain axioms capture the essential properties of relational domain \cite{McLean2020}. However, $d$ has some peculiar features when it comes to general Kleene algebra and KAT. First, $d(\mathscr{K})$ is necessarily the maximal Boolean subalgebra of the negative cone of $\mathscr{K}$; see Thm.~8.5 in \cite{DesharnaisStruth2011}. In a sense, then, every ``proposition'' is considered a test, contrary to some of the intuitions expressed in \cite{Kozen1997}. These intuitions also collide with the approach of taking KAT as KA with a Boolean negative cone \cite{FahrenbergEtAl2022,Jipsen2004}. Second, not every Kleene algebra expands to a KAD, not even every finite one; see Prop.~5.3 in \cite{DesharnaisStruth2011}; see the first counterexample in the appendix. This is in contrast to the fact that every Kleene algebra expands to a KAT. This feature is caused by \eqref{locality} and the authors of \cite{DesharnaisStruth2011} express interest in variants of $d$ not satisfying \eqref{locality}.\footnote{The immediate candidate is predomain, but it can be shown that if $d$ is a predomain operation then $d(K)$ is not necessarily closed under $\cdot$, and that $d(x) = d(x)d(x)$ may fail (see $\mathbf{A}_4$ in the appendix). } Hence, it is interesting to ask if there is a suitable one-sorted alternative to KAT, in the sense of satisfying the following properties: \begin{itemize} \item \textbf{(P0)} The algebras in the given class $\mathbf{ALT}$ expand Kleene algebras by additional operations $t$ and $t'$. \item \textbf{(P1)} The test algebra $t(\mathscr{A})$ for each $\mathscr{A} \in \mathbf{ALT}$ is a Boolean algebra. \item \textbf{(P2)} Every Kleene algebra expands to an $\mathscr{A} \in \mathbf{ALT}$. \item \textbf{(P3)} The test algebra $t(\mathscr{A})$ is not necessarily the maximal Boolean subalgebra of the negative cone of $\mathscr{A}$. \item \textbf{(P4)} The equational theory of $\mathbf{KAT}$ embeds into the equational theory of $\mathbf{ALT}$. \end{itemize} Condition (P2) would ensure that $\mathbf{ALT}$ is a \emph{conservative expansion} of Kleene algebras, i.e., $\mathbf{ALT}$ satisfies exactly the same $(\cdot, +, ^*, 1, 0)$-equations as Kleene algebras. \section{One-sorted KAT}\label{sec:KAt} In the present section, we define a class of algebras satisfying (P0--3). The algebras in the class will be called simply \emph{one-sorted Kleene algebras with tests}, KAt. Property (P4) is established in Section \ref{sec:embedding}. \begin{definition} A \emph{one-sorted Kleene algebra with tests} is a Kleene algebra expanded by two unary operations $t$ and $t'$ such that \begin{gather} t(0) = 0\label{t:0}\\ t(1) = 1\label{t:1}\\ t(t(x) + t(y)) = t(x) + t(y)\label{t:weakly_additive}\\ t(t(x) t(y)) = t(x)\, t(y)\label{t:multi}\\ t(x)t(x) = t(x)\label{t:idem}\\ t(x) \leq 1\label{t:negcone}\\ 1 \leq t'(t(x)) + t(x)\label{t:lem}\\ t'(t(x))\, t(x) \leq 0\label{t:ecq}\\ t'(t(x)) = t(t'(t(x)))\label{t:cc} \end{gather} \end{definition} \begin{example} Relational KA with $t(R) = \{ (w, w) \mid \exists v. \, (w, v) \in R) \}$ and $t'(R) = \{ (w, w) \mid \neg \exists v. \, (w, v) \in R) \}$. \end{example} Every KAD $\mathscr{D} = (K, \cdot, +, \,^{*}, 1, 0, a)$ can be seen as an algebra of the type of KAt, namely, by adding $d$ explicitly to the signature. It can then be shown that KAt generalizes KAD. \begin{proposition} Every KAD is a KAt. \end{proposition} \begin{proof} It needs to be checked that the KAt axioms are satisfied by any KAD where $d$ is seen as $t$ and $a$ is seen as $t'$. This is mostly a matter of easy calculation using known KAD properties. \end{proof} Let $\mathscr{K} = (K, \cdot, +, ^{*}, 1, 0, t, t')$ be a KAt. Let $t(K) = \{ x \mid \exists y. x = t(y) \}$. \begin{lemma}\label{lem:tK-welldef} For all KAt, $d(K)$ is closed under the semiring operations and $t'$. \end{lemma} \begin{proof} The set $d(K)$ contains constants $1, 0$ by (\ref{t:0}--\ref{t:1}), and it is closed under $+$ and $\cdot$ by (\ref{t:weakly_additive}--\ref{t:multi}). $d(K)$ is closed under $t'$ by \eqref{t:cc}. \end{proof} For each KAt $\mathscr{K}$, let $t(\mathscr{K}) = (t(K), \cdot, +, 1, 0, t')$. This is a well defined subalgebra of $\mathscr{K}$ by Lemma \ref{lem:tK-welldef}. \begin{theorem}\label{thm:tK-BA} Each $t(\mathscr{K})$ is a Boolean algebra. \end{theorem} \begin{proof} Each $t(\mathscr{K})$ is a bounded distributive lattice by (\ref{t:idem}--\ref{t:negcone}) and properties of semirings. By (\ref{t:lem}--\ref{t:ecq}), $t'(x)$ is a complement of $x$ for all $x \in t(K)$. Since $t(\mathscr{K})$ is a bounded distributive lattice, it is uniquely complemented, and so it is a Boolean algebra. \end{proof} \begin{theorem}\label{thm:KAexpands_toKAt} Each Kleene algebra expands to a KAt. \end{theorem} \begin{proof} The proof is similar as in the case of KAT. For any Kleene algebra $(K, \cdot, +, ^{*}, 1, 0)$, define: \begin{center} $t(x) = \begin{cases} 0 & \text{if } x = 0\\ 1 & \text{otherwise.} \end{cases}$ \qquad $t'(x) = \begin{cases} 0 & \text{if } x = 1\\ 1 & \text{if } x = 0\\ x & \text{otherwise.} \end{cases}$ \end{center} The rest is checked by easy calculation. \end{proof} Theorem \ref{thm:KAexpands_toKAt} shows that, unlike KAD and like KAT, KAt is a proper generalization of Kleene algebra. The proof of the theorem also shows that $t(\mathscr{K})$ need not be the maximal Boolean subalgebra of the negative cone. On the other hand, one may say that $t(x)$ lacks any intuitive relation to $x$, unlike the domain operator in KAD. For instance, it holds in KAD that $d(x)$ is a left preserver of $x$, that is, $x \leq d(x)x$. This lack of connection between $x$ and $t(x)$ can be seen as the reason why (P0--3) are satisfied. However, the following section shows that this is only partially so. \section{An extension of KAt}\label{sec:ext} In this section we consider a particular extension of KAt with a number of axioms known from KAD. We show that the extension still has properties (P0--3). \begin{definition} A \emph{strong KAt}, sKAt, is a KAt satisfying the following axioms: \begin{gather} t(x +y) = t(x) + t(y) \label{t:additivity}\\ x \leq t(x) x \label{t:left_preserver}\\ t (t(x)y) \leq t(x) \label{t:least_left_preserver}\\ t(xy) \leq t(xt(y)) \label{t:sublocality} \end{gather} \end{definition} \eqref{t:additivity} entails that $t$ is monotonic; \eqref{t:left_preserver} says that $t(x)$ is a left preserver of $x$; \eqref{t:least_left_preserver} entails \begin{equation} x \leq t(y) x \implies t(x) \leq t(y) \, , \end{equation} saying that $t(x)$ is the \emph{least} left preserver among tests; and \eqref{t:sublocality} is the sublocality property of predomain operators. In fact, $t$ is a predomain operator in each sKAt. The algebra from Prop.~5.3 in \cite{DesharnaisStruth2011} shows that $t$ need not be a domain operation; see the first example in the appendix. It is clear that sKAt satisfies (P0) and (P1). It can also be shown, by revisiting the construction in the proof of Theorem \ref{thm:KAexpands_toKAt} that (P2) and (P3) are satisfied as well. However, as shown already in \cite{DesharnaisStruth2011}, adding locality $t(xt(y)) \leq t(xy)$ destroys (P2) and (P3). \section{Embedding KAT}\label{sec:embedding} In this section we show that KAt has property (P4) as well. The result actually applies to a larger class of cases. We say that a KAT $\mathscr{K} = (K, B, \cdot, +, ^{*}, 1, 0, \, \bar{ } \, )$ \emph{expands} into a KAt $\mathscr{A} = (K, \cdot, +, \,^{*}, 1, 0, t, t')$ iff \begin{itemize} \item $B = t(K)$. \end{itemize} Note that if $\mathscr{K}$ expands to $\mathscr{A}$, then $\bar{b} = t'(b)$, since $\bar{b} = \overline{t(y)} = t't(x) = t'(b)$. The second to last equation holds since $t't(x)$ is the complement of $t(x)$ in $t(K) = B$. \begin{definition} A class of KAt $\mathbf{A}$ is \emph{KAT-like} iff it satisfies properties (P0), (P1) and \begin{itemize} \item {\normalfont \textbf{(P2a)}} Every KAT expands to a $\mathscr{A} \in \mathbf{A}$. \end{itemize} \end{definition} \begin{theorem} If $\mathbf{A}$ is KAT-like, then $\mathbf{A}$ satisfies (P4). \end{theorem} In the proof of the theorem, we will use the following translation from $\mathscr{T}_{\text{KAT}}$ to $\mathscr{T}_{\text{KAt}}$: \begin{itemize} \item $\tra (\at{p}_n) = \at{x}_{2n}$ \item $\tra (\at{b}_n) = t( \at{x}_{2n +1} )$ \item $\tra (\mathsf{0}) = t(\mathsf{0})$ \item $\tra (\mathsf{1}) = t(\mathsf{1})$ \item $\tra (p + q) = \tra (p) + \tra (q)$ \item $\tra (p \cdot q) = \tra (p) \cdot \tra (q)$ \item $\tra (p^{*}) = \tra (p)^{*}$ \item $\tra (\bar{b}) = t' (\tra (b))$ \end{itemize} \begin{proof} We show that, for all KAT equations $p \approx q$, there is KAT $\mathscr{K} \not\models p \approx q$ iff there is $\mathscr{A} \not\models \tra (p) \approx \tra(q)$ such that $\mathscr{A} \in \mathbf{A}$. First, if $\mathscr{K} \not \models p \approx q$, then there is a $\mathscr{K}$-valuation $\val{\,}$ such that $\val{p} \neq \val{q}$. By (P2a), $\mathscr{K}$ expands to $\mathscr{A} \in \mathbf{A}$. We define an $\mathscr{A}$-valuation $\vval{\,}$ as the unique homomorphism such that \begin{itemize} \item $\vval{\mathsf{x}_{2n}} = \val{\mathsf{p}_n}$, \item $\vval{\mathsf{x}_{2n+1}} = \val{\mathsf{b}_n}$. \end{itemize} We prove by induction on KAT terms $r$ that \begin{equation}\label{val-equivalence} \val{r} = \vval{\tra (r)} \end{equation} Before the main inductive proof, we prove that \eqref{val-equivalence} holds for all tests $b$; the proof is by induction on tests. The base case is established as follows: $\vval{\tra (\mathsf{b}_{n}) } = \vval{t (\mathsf{x}_{2n+1})} = t \vval{ \mathsf{x}_{2n+1}} = t \val{\mathsf{b}_{n}} = \val{\mathsf{b}_{n}}$. The last equation holds by definition of expansion (we know that $\val{\mathsf{b}_{n}} \in B = t(K)$ and that $tt(x) = t(x)$). The cases of the induction step for $+$ and $\cdot$ are trivial. The case for $\, \bar{ } \, $ is established as follows: $\vval{\tra (bar{b})} = \vval{ t' \tra (b)} = t' \vval{\tra(b)} = t' \val{b} = \val{ t'(b) } = \val{ \bar{b}}$ by the definition of expansion (see the note after the definition). This concludes the proof for tests. The main inductive proof for KAT terms is now trivial. The converse claim is established as follows. Assume that there is $\mathscr{A} \in \mathbf{A}$ such that $\mathscr{A} \not\models \tra (p) \approx \tra (q)$. Hence, there is an $\mathscr{A}$-valuation $\vval{ \,}$ such that $\vval{\tra (p)} \neq \vval{\tra (q)}$. It follows from (P1) that $t(\mathscr{A})$ is a Boolean algebra, and so $\mathscr{K} = (K, t(\mathscr{A}), \cdot, +, \, ^{*}, 1, 0, t')$ is a KAT. We define a $\mathscr{K}$-valuation $\val{\,}$ as the unique KAT-homomorphism such that \begin{itemize} \item $\val{\mathsf{p}_{n}} = \vval{\mathsf{x}_{2n}}$ \item $\val{\mathsf{b}_{n}} = \vval{ t (\mathsf{x}_{2n+1})}$ \end{itemize} As before, it is sufficient to prove that \eqref{val-equivalence} holds in this setting for all KAT terms $r$. The proof is again by induction and the only interesting case is $\bar{b}$ (the case for $\mathsf{b}_n$ holds by definition). We reason as follows: $\vval{\tra (\bar{b})} = \vval{ t' \tra(b)} = t' \val{b} = \val{ t' (b) } = \val{\bar{b}}$. \end{proof} \begin{theorem} $\mathbf{KAt}$ is KAT-like. \end{theorem} \begin{proof} Take an arbitrary KAT $\mathscr{K} = (K, B, \cdot, +, \,^{*}, 1, 0, \, \bar{ }\, )$ and define $\mathscr{A} = (K, \cdot, +, \,^{*}, 1, 0, t, t')$ where: \begin{center} $t(x) = \begin{cases} x & \text{if } x \in B\\ 1 & \text{otherwise.} \end{cases}$ \qquad $t'(x) = \begin{cases} \bar{x} & \text{if } x \in B\\ x & \text{otherwise.} \end{cases}$ \end{center} It can be easily checked that $\mathscr{A}$ is a KAt. \end{proof} It is a matter of easy calculation that $\mathscr{A}$ in the proof of the above theorem satisfies \eqref{t:left_preserver} and \eqref{t:least_left_preserver}. For \eqref{t:additivity} and \eqref{t:sublocality}, a different approach is needed. It is known that the equational theory of KAT is identical to the equational theory of relational KAT \cite{KozenSmith1997}. Hence, one could work with a modification of the notion of a KAT-like class of algebras. \begin{definition} A class of KAt $\mathbf{A}$ is \emph{rKAT-like} iff it satisfies properties (P0), (P1) and \begin{itemize} \item {\normalfont \textbf{(P2b)}} Every relational KAT expands to a $\mathscr{A} \in \mathbf{A}$. \end{itemize} \end{definition} \begin{theorem}\label{thm:embedding} If $\mathbf{A}$ is rKAT-like, then $\mathbf{A}$ satisfies (P4). \end{theorem} \begin{proof} The fact that \eqref{val-equivalence} holds in both directions of the proof is established as before. \end{proof} \begin{theorem} $\mathbf{sKAt}$ and $\mathbf{KAD}$ are rKAT-like. \end{theorem} \begin{proof} Take any relational KAT, and define \begin{itemize} \item $t(R) = \{ (s,s) \mid \exists u. (s, u) \in R \}$; \item $t'(R) = \{ (s,s) \mid \neg \exists u. (s, u) \in R \}$. \end{itemize} It is easily checked that we obtain a sKAt. \end{proof} Since it is known that Propositional Hoare Logic embeds into KAT \cite{Kozen2000}, we obtain the result that KAt, sKAt and KAD subsume PHL as well (the latter case is known). \section{Residual}\label{sec:residual} In this section we focus on a particular version of KAt where $t'$ is not a primitive operator, but it is defined using the residual of Kleene algebra multiplication. It is known Kleene algebras with residuals form a variety \cite{Pratt1991}. Consequently, one-sorted residuated Kleene algebras and their equational extensions form varieties as well. \begin{definition} A \emph{residuated Kleene algebra} is a Kleene algebra expanded with a binary operation $\to$ such that \begin{equation} xy \leq z \iff x \leq y \to z \end{equation} \end{definition} \begin{definition} A \emph{residuated one-sorted Kleene algebra with tests} is a residuated Kleene algebra expanded with a unary operation $t$ satisfying (\ref{t:0}--\ref{t:negcone}) and \begin{gather} 1 \leq t(t(x) \to 0) + t(x)\label{r:lem}\\ t(t(x) \to 0) \, t(x) \leq 0\label{r:ecq} \end{gather} We define $t'(x) = t(t(x) \to 0)$. \end{definition} It is an easy consequence of the definition that the class of residuated KAt forms a (finitely based) variety. We denote it as $\mathbf{KA}\vec{\mathbf{t}}$. \begin{proposition} Each residuated KAt is a KAt. \end{proposition} \begin{proof} It is easy to check that $t'$ as defined in terms of $t$ and $\to$ satisfies (\ref{t:lem}--\ref{t:ecq}). It follows from \eqref{t:1} and \eqref{t:multi} that $t(t(x)) = t(x)$. Hence, \eqref{t:cc} holds as well. \end{proof} \begin{theorem}\label{thm:KAexpands_toResKAt} Each join-complete Kleene algebra expands to a residuated KAt. \end{theorem} \begin{proof} Each join-complete KA is residuated since we can define $$ x \to y := \sum \{ z \mid zx \leq y \} \, .$$ Define $t(x)$ as in the proof of Theorem \ref{thm:KAexpands_toKAt}. We prove by cases that (\ref{r:lem}--\ref{r:ecq}) hold. \begin{itemize} \item If $x = 0$: $t(t(x) \to 0) + t(x) = t(0 \to 0) + 0 = t(1) + 0 = 1$ and $t(t(x) \to 0) \, t(x) = 10 = 0$; \item If $x \neq 0$: $t(t(x) \to 0) + t(x) = t( 1 \to 0) + 1 = t(0) + 1 = 1$ and $t(t(x) \to 0) \, t(x) = 01 = 0$.\qedhere \end{itemize} \end{proof} Not every KA expands to a residuated KA \cite{Kozen1994a}, so not every KA expands to a residuated KAt. \section{Conclusion} In this paper we studied a one-sorted variant of Kleene algebra with tests, KAt. We have shown that KAt generalizes Kleene algebra with domain, KAD, and that it retains the good properties of KAD, namely (P1) the test algebra of any KAt is a Boolean algebra and (P4) the equational theory of KAT embeds into the equational theory of KAt. Moreover, KAt avoids the bad properties of KAD: unlike KAD, every Kleene algebra expands to a KAt (P2), and the test algebra in KAt is not necessarily the maximal Boolean subalgebra of the negative cone (P3). We have shown that adding several axioms familiar from KAD to KAt does in fact not injure (P2) and (P3). We believe that this leads to a better general view of the landscape of one-sorted program algebras.
\section{Introduction} The metallic edge or surface states are a defining feature of the topologically nontrivial phase of topological quantum materials, and often times what make them practically useful~\cite{Zhou08,Lu10,Hasan10,Qi11,Shen12,Bernevig13}. The pristine edge or surface states, hereafter collectively referred to as edge states, are responsible for a number of fascinating phenomena in these materials, such as the quantum spin Hall effect (QSHE)~\cite{Kane05,Kane05_2,Bernevig06,Bernevig06_2,Fu07} and Majorana fermions~\cite{Kitaev01,Oreg10,Lutchyn10}, among many others. A common strategy to access and probe edge states is to attach a thin metallic layer to a topological material such that the edge states percolate into the normal metal (NM). One then may be able to use these edge states to manipulate the metallic material. For instance, in 3D topological insulators (TIs), it has been demonstrated that a thin ferromagnetic metal (FMM) deposited on top of a TI exhibits very prominent current-induced spin torque~\cite{Mellnik14,Wang15_spin_torque_TI,Mahendra18}. This phenomenon has triggered significant theoretical interest in investigating the underlying mechanism and the role played by the edge states~\cite{Garate10,Yokoyama10,Mahfouzi12,Lu13,Sakai14,Fischer16,Mahfouzi16,Ho17,Ndiaye17,Okuma17_2,Ghosh18, Laref20,Zegarra20_percolated_QSHE,Chen20_3DTIFMM}. In these kinds of junctions, specifically topological insulator/normal metal (TI/NM) or topological superconductor/normal metal (TSC/NM), with a finite size NM, the nature of the NM quantum-well states can elicit interesting issues. In particular, since the topological edge state can percolate into the NM, it is natural to speculate that the NM quantum-well states can similarly percolate into the TI layer. The question is then whether one can {\it unambiguously} distinguish these percolated NM quantum-well states from the true topological edge states by merely analyzing the profile of the wave function, which is often how one tries to image topological edge states by using some real space probe such as a scanning tunneling microscope (STM)~\cite{NadjPerge14,Feldman17,Kim18,PalacioMorales19,Liu20,Manna20}. In this work, we show that should one follow the above route, i.e., to try to identify non-trivial edge states in topological junctions by probing (i) the edge-state wave function profiles, e.g., whether it decays and only localizes in one sublattice (SSH model) or (ii) their corresponding zero-energy spectral features, e.g., via conductance measurements, then caution must be taken if the topological material is attached to or grown on a metallic material. We show that in both TI/NM and TSC/NM junctions, it is possible to fine-tune the NM chemical potential such that a quantum well state has zero energy and a wave function profile that is indistinguishable from the true topological edge state. We investigate in detail the wave function profile of such a fine-tuned zero-energy quantum well state in several models of one- (1D) and two-dimensional (2D) TIs and TSCs, including the Su-Schrieffer-Heeger (SSH) model~\cite{Su79}, the Kitaev chain~\cite{Kitaev01}, and the Chern insulator, in both topologically trivial and nontrivial phases, with several different models for the adjacent NM. We organize the paper as follows. In Sec.~II A we start from the simplest 1D chiral-symmetric TI, namely the SSH model. We show that if chiral symmetry is locally preserved when a NM layer is attached to the SSH system, a zero-energy quantum well state emerges and its wave function profile is indistinguishable from a true topological edge state. We then investigate a Majorana chain/NM junction in Sec.~II B. Here, particle-hole symmetry ensures that the zero-energy states must appear in pairs. By fine-tuning the NM chemical potential $\mu_N$, we show that the wave functions of these pairwise states are, to some extent, indistinguishable from true Majorana fermions even when the system is topologically trivial. In Sec.~II C we study a 2D Chern insulator/NM junction. Our results indicate whether the zero-energy states at zero momentum display the same symmetry eigenvalue as the true topological chiral edge states depends on the orbital kinetics of the NM. Section III summarizes our results. \section{Transient zero energy states in 1D and 2D} \subsection{Chiral symmetry: SSH/NM junction \label{sec:SSHNM}} We start by investigating 1D systems. We first consider an SSH/NM junction. The spinless SSH layer of length $N_{TI}$ is described by the lattice Hamiltonian~\cite{Su79} \begin{eqnarray} H_{SSH}&=&\sum_{i<N_{TI},i\in{\rm odd}}\left(t+\delta t\right)\left(c_{i}^{\dag}c_{i+1}+c_{i+1}^{\dag}c_{i}\right) \nonumber \\ &+&\sum_{i<N_{TI},i\in{\rm even}}\left(t-\delta t\right)\left(c_{i}^{\dag}c_{i+1}+c_{i+1}^{\dag}c_{i}\right), \label{HSSH} \end{eqnarray} where $c_{i}$ ($c^\dagger_i)$ is the spinless fermion annihilation (creation) operator at site $i$, and $t\pm\delta t$ are the alternating hopping amplitudes. For periodic boundary conditions and after performing a Fourier transform, the SSH Bloch Hamiltonian $H_{SSH}({\bf k})$ itself possesses time-reversal (TR), particle-hole (PH), and chiral symmetries. Denoting by $K$ the complex conjugate operator and $\hat {\sigma}=(\sigma_x,\sigma_y,\sigma_z)$ the Pauli-matrix vector, we can implement the symmetry operators for PH, TR and chiral symmetries by $T=K$, $C=\sigma_{z}K$, and $S=\sigma_{z}$, respectively, thus realizing a 1D class BDI model~\cite{Schnyder08,Kitaev09}. For the SSH model, chiral symmetry is often termed sublattice symmetry. The NM layer of length $N_{NM}$ is modeled by the tight-binding Hamiltonian \begin{eqnarray} &&H_{NM}=\sum_{i>N_{TI}}\mu_{N}\,c_{i}^{\dag}c_{i} \nonumber \\ &&+\sum_{N_{TI}<i<N_{TI}+N_{NM}}t_{N}\left(c_{i}^{\dag}c_{i+1}+c_{i+1}^{\dag}c_{i}\right), \label{HNM} \end{eqnarray} with $t_{N}$ and $\mu_{N}$ the hopping parameter and chemical potential in the NM, respectively, as depicted in Fig.~\ref{fig:SSH_NM_junction} (a). Note that as long as $\mu_N$ is nonzero, the Bloch Hamiltonian $H_{NM}({\bf k})$ breaks PH and chiral symmetries. Therefore, $\mu_{N}$ serves as a parameter to control the symmetries of the NM. The two systems are coupled by a tunneling term given by $H_T = t'\left(c_{i}^\dag c_{i+1} + c_{i+1}^\dag c_{i} \right)$, where $t'$ is the hopping parameter between the last site on the SSH chain and the first site on the NM [see Fig.~\ref{fig:SSH_NM_junction} (a)]. For open boundary conditions, an SSH chain in the topologically nontrivial phase ($\delta t<0$) is known to host two zero-energy edge states that are eigenstates of the chiral symmetry operator $\sigma_{z}$~\cite{Shen12,Bernevig13}. This translates into edge states localizing on odd and even sites near the left ($i\approx 1$) and right ($i\approx N_{TI}$) ends of the chain, respectively. When the NM layer is attached to the right end of the chain, the first question one can ask is how to unambiguously distinguish the percolated topological edge state from other eigenstates of the SSH/NM junction. To answer this question, we numerically diagonalize the SSH/NM junction to obtain its eigensolutions. We will discuss the results for the topologically nontrivial and trivial cases separately in the following sections. \begin{figure}[ht] \begin{center} \includegraphics[clip=true,width=0.95\columnwidth]{SSH_NM_junction_nontrivial} \caption{(a) The 1D SSH/NM junction consists of an SSH chain of length $N_{TI}$ and kinetic hoppings $t\pm\delta t$, coupled to an NM layer of length $N_{NM}$, with chemical potential $\mu_N$ and hopping $t_{N}$, via an interface hopping $t'$. (b) Evolution of the eigenenergies $E_n$ (measured in units of $t$) in the topologically nontrivial phase of the SSH chain as the chiral-symmetry-breaking chemical potential $\mu_{N}$ is increased. (c) to (f) wave function profiles of several eigenenergies in (b) (following the same color code): (c) $\mu_N=0$ (blue solid circle), (d) $\mu_N= 0.2844t$ (green solid circle), (e) $\mu_N=0.6281t$ (purple solid circle), and (f) $\mu_N=0.3656t$ (orange solid circle). We have used the following parameters: $N_{TI}=40$, $N_{NM}=10$, ${\delta t}=-0.2 t$, $t'= t$, and $t_N = -0.6t$. } \label{fig:SSH_NM_junction} \end{center} \end{figure} \subsubsection{Results: SSH/NM junction in the nontrivial phase ($\delta t<0$)} Figure~\ref{fig:SSH_NM_junction} summarizes our results for the topological regime of the SSH chain. In Fig.~\ref{fig:SSH_NM_junction}(b) we show the discrete eigenenergies $E_n$ of the system as a function of the chiral-symmetry-breaking NM chemical potential $\mu_{N}$. When $\mu_{N}=0$, the state at zero energy can be identified as a true edge state (see solid blue circle in Fig.~\ref{fig:SSH_NM_junction}(b)) because its wave function percolates into the NM layer and retains the SSH sublattice symmetry, i.e., it only localizes on the even sites, see Fig.~\ref{fig:SSH_NM_junction}(c). As we gradually turn on $\mu_{N}$, the energy of this edge state increases, thus allowing us to track its evolution. The wave function at finite $\mu_{N}$ no longer entirely localizes on the even sites; it continuously evolves into a sublattice symmetry-breaking profile, see Fig.~\ref{fig:SSH_NM_junction}(d), corresponding to the green solid circle in Fig.~\ref{fig:SSH_NM_junction} (b). At an even larger $\mu_{N}$, such that the tracked edge-state energy merges into the bulk (see purple solid circle), its identification becomes rather ambiguous, see Fig.~\ref{fig:SSH_NM_junction}(e). \begin{figure}[ht] \begin{center} \includegraphics[clip=true,width=0.95\columnwidth]{SSH_NM_junction_trivial} \caption{(a) Eigenenergy $E_n$ as a function of $\mu_{N}$ in the topologically trivial phase of the SSH chain ($\delta t>0$). (b) The corresponding wave function of the fine-tuned zero-energy state for $\mu_N=0.1704t$ that only localizes on the even sites within the SSH layer and whose profile is indistinguishable from the true topological edge state. We have used the following parameters: $N_{TI}=40$, $N_{NM}=10$, ${\delta t}=0.2 t$, $t'= t$, $t_N = -0.6t$, and $\mu=0.4t$.} \label{fig:SSH_NM_junction-trivial} \end{center} \end{figure} Figure \ref{fig:SSH_NM_junction}(b) also reveals that tailor-made zero-energy states appear as we vary $\mu_{N}$. This occurs because some negative energy NM states at $\mu_N=0$ gradually move up as we increase $\mu_N$, eventually crossing zero energy, e.g., the orange solid circle. The wave function of this kind of state inherits both the edge state character (localization on even sites within the SSH layer), and features of the NM quantum well-like states (standing waves within the NM layer), as shown in Fig.~\ref{fig:SSH_NM_junction}(f). Thus, if a local measurement, like STM, is performed in the SSH/NM interface, it would not be possible to distinguish these {\it fine-tuned} zero-energy states~\ref{fig:SSH_NM_junction}(f) from the true topological edge states~\ref{fig:SSH_NM_junction}(c). \subsubsection{Results: SSH/NM junction in the trivial phase ($\delta t>0$)} When the SSH model is in the topologically trivial phase, which has no topological zero-energy edge states, one can still fine-tune the metal chemical potential such that the NM quantum well states have zero energy, see Fig~\ref{fig:SSH_NM_junction-trivial}(a). Their wave functions, shown in Fig.~\ref{fig:SSH_NM_junction-trivial}(b) still localize only on the even sites, meaning that these states are indistinguishable from the true topological edge states. Our result suggests that if one solely relies on the existence of the edge state to judge whether the system is in a topologically nontrivial phase, then caution must be taken in these kinds of SSH/NM junctions. \subsection{PH symmetry: Kitaev/NM junction} \label{Kitaev/NM} We now consider the spinless Kitaev $p$-wave superconducting chain interfaced with an NM layer. Similarly to the SSH model, the finite Kitaev model hosts topologically zero-energy end modes known as Majorana bound states~\cite{Kitaev01}.Note that a similar interface problem of a Majorana fermion leaking into an adjacent quantum dot has been investigated previously from the transport point of view~\cite{Vernek14,RuizTijerina15,Hoffman17,Schuray17}. In contrast, here we focus on the symmetry perspective of a Majorana end mode leaking into a metal of finite length. The lattice Hamiltonian of this Kitaev/NM junction is given by \begin{eqnarray} H&=&\sum_{i\in N_{p}}t\left(c_{i}^{\dag}c_{i+1}+c_{i+1}^{\dag}c_{i}\right)-\mu \sum_{i\in N_{p}}c_{i}^{\dag}c_{i} \nonumber \\ &+&\sum_{\left\{i,i+1\right\}\in N_{p}}\Delta \left(c_{i}c_{i+1}+c_{i+1}^{\dag}c_{i}^{\dag}\right) \nonumber \\ &+&\sum_{i \in N_{NM}}t_{N}\left(c_{i}^{\dag}c_{i+1}+c_{i+1}^{\dag}c_{i}\right)-\mu_{N}\sum_{i\in N_{NM}}c_{i}^{\dag}c_{i} \nonumber \\ &+& t'\left( c_{N_p}^\dag c_{N_p+1} + c_{N_p+1}^\dag c_{N_p}\right), \label{MajoranaNM_junction_lattice_model} \end{eqnarray} where $c_{i}$ ($c_i^\dag$) is the spinless fermion annihilation (creation) operator at site $i$ and $N_{p}$ ($N_{NM}$) denotes the Majorana chain (NM region). The parameters $t$, $\mu$, and $\Delta$ correspond to the hopping, chemical potential, and superconducting pairing in the Kitaev model, respectively. The last term in Eq.~\eqref{MajoranaNM_junction_lattice_model} corresponds to the coupling between the Kitaev and NM chains. The site indices $N_p$ and $N_{p}+1$ denote, respectively, the end of the Kitaev chain and the beginning of the NM layer, i.e., their interface. \begin{figure}[htb!] \begin{center} \includegraphics[clip=true,width=0.99\columnwidth]{Kitaev_NM_junction} \caption{ (a) Energy spectrum $E_n$ of a Kitaev/NM junction in the topologically nontrivial phase as a function of the NM chemical potential $\mu_{N}$. Here $N_{TI}=40$, $N_{NM}=10$, $\mu=0.5$, $t=0.4$, $\Delta=0.6$, and $t'= t_N=0.3$. Inset: wave function profiles of the two zero-energy states, indicating that one of them has a Majorana wave function $\psi_{e}=-\psi_{h}$ at the left end, and the another has a Majorana wave function $\psi_{e}=\psi_{h}$ at the right end that percolates into the NM. (b) Energy spectrum of the junction in the topologically trivial phase, $\mu=1$. The four panels show the wave function of the two quantum well states that cross zero energy upon tuning $\mu_{N}$. One state has only an electron-like component while the other has only a hole-like component, and hence, the two of them together may be misidentified as one Majorana fermion.} \label{fig:Kitaev_NM_junction} \end{center} \end{figure} \subsubsection{Results: Kitaev/NM junction in the nontrivial phase ($|\mu|<2t$) \label{Kitaev:nontrivial}} The Bloch Hamiltonian of the Majorana chain, written in the basis $(c(k),c^{\dag}(-k))^{T}$, is given by \begin{eqnarray} H_{p}(k)=\left(\begin{array}{cc} \frac{1}{2}\left(2t\cos k-\mu_{p}\right) & i\Delta\sin k \\ -i\Delta\sin k & -\frac{1}{2}\left(2t\cos k-\mu_{p}\right) \end{array}\right),\;\;\; \label{Kitaev_Hp_k} \end{eqnarray} which satisfies PH symmetry implemented by $C=\sigma_{x}K$. The NM chain alone expressed in the same basis is essentially the diagonal part of Eq.~(\ref{Kitaev_Hp_k}), which also satisfies PH symmetry. As a result, the edge state of the Kitaev/NM junction still remains an eigenstate of the PH-symmetry operator $C$ and therefore contains equal weights of the electron and hole channels. This means that the edge state can percolate into the NM layer and remain a Majorana fermion, as can be seen in Fig.~\ref{fig:Kitaev_NM_junction} (a). One may consider this result as an artifact stemming from the Hamiltonian being expressed in the basis $(c(k),c^{\dag}(-k))^{T}$, so the PH symmetry by construction cannot be broken even when the system is attached to an NM layer. In addition, the energy spectrum shown in Fig.~\ref{fig:Kitaev_NM_junction} (a) indicates that even by fine-tuning the NM chemical potential $\mu_{N}$, NM-layer states never reach zero energy, so it is not possible to fabricate a zero-energy state in the topologically nontrivial phase other than the true Majorana edge state itself. This follows from our spinless system being one-dimensional and having PH symmetry. Therefore, it allows for at most two solutions per energy. \footnote{\label{footnote1} One observes that in the SSH/NM junction, chiral symmetry is broken by the presence of the NM layer when $\mu_N \neq 0$, and this allows the zero-modes to move away from zero energy. As it turns out, the state localized on the left edge (odd sites), far away from the interface, remains at zero energy since it is only weakly coupled to the NM. The state close to the interface, on the other hand, is shifted away from zero, which opens up the possibility of additional crossings at zero energy (at most two per energy), as shown in Fig.~\ref{fig:SSH_NM_junction} (b). In contrast, in the Kitaev/NM junction PH symmetry is not broken by the NM layer. Hence, in the topological regime, no states are allowed to cross at zero energy. Here the only two possible solutions are the true topological Majorana zero modes. } \subsubsection{Results: Kitaev/NM junction in the trivial phase ($\mu<-2t$ or $\mu>2t$) \label{Kitaev:trivial}} In the topologically trivial phase (here we only consider $\mu>2t$), in which no Majorana edge states occur, the situation is different. In contrast to the topological case in Sec.~\ref{Kitaev:nontrivial}, here, the NM quantum well states can be made to cross at zero energy by fine-tuning $\mu_N$, as shown in Fig.~\ref{fig:Kitaev_NM_junction}(b). This is possible because there are no topological zero-energy solutions. Since the spectrum is PH symmetric, the states always come in pairs with one electron-like and the other hole-like. In the wave-function panels of Fig.~\ref{fig:Kitaev_NM_junction} (b), we show the wave-function profile before ($\mu_{N}=0.5672$) and after ($\mu_{N}=0.5922$) the crossing. Note that the inversion of the electron-like to hole-like at the crossing is clearly visible. As pointed out in a different context by recent theoretical and experimental works~\cite{Liu2017, Moore2018,Avila2019,Woods2019,Vuik2019,Chen2019,Pan2020,Valentini2021,Hess2021}, this feature raises concerns that either of these two zero-energy states (trivial and nontrivial) may be mistakenly identified as a Majorana mode. \subsection{Symmetry induced by edge direction: Chern insulator/NM junction} The Chern insulator belongs to class A in the Altland$-$Zirnbauer symmetry classification~\cite{Schnyder08}, which has no nonspatial symmetries. Despite the absence of nonspatial symmetries, the edge state self-generates a symmetry eigenvalue according to the direction of the edge, as we shall see below. The bulk Chern insulator is described by the Bloch Hamiltonian\cite{Qi11,Bernevig13} \begin{eqnarray} H_{CI}({\bf k})&=&A\sin k_{x}\sigma^{x}+A\sin k_{y}\sigma^{y} \nonumber \\ &+&\left(M+4B-2B\cos k_{x}-2B\cos k_{y}\right)\sigma^{z}, \label{HCh_kspace} \end{eqnarray} written in the spinless basis $\psi=\left(c_{{\bf k},s},\;c_{{\bf k},p}\right)^{T}$, where $c^\dagger_{{\bf k},s(p)} = \sum_ie^{-i{\bf k}\cdot{\bf r}} c^\dagger_{i,s(p)}$, and $c^\dagger_{i,s(p)}$ is the creation operator of an $s(p)$-orbital electron at site $i$. Recall that in~\eqref{HCh_kspace} the Pauli matrix vector $\hat{\sigma}=(\sigma_x,\sigma_y,\sigma_z)$ denotes a pseudospin degree of freedom. The corresponding 2D lattice model~\cite{Chen20_absence_edge_current} reads \begin{eqnarray} &&H=\sum_{i\in CI}t\left\{-ic_{i,s}^{\dag}c_{i+a,p} +ic_{i+a,s}^{\dag}c_{i,p}+h.c.\right\} \nonumber \\ &&+\sum_{i\in CI}\left\{-c_{i,s}^{\dag}c_{i+b,p}+c_{i+b,s}^{\dag}c_{i,p}+h.c.\right\} \nonumber \\ &&+\sum_{i\in CI,\delta}t'\left\{-c_{i,s}^{\dag}c_{i+\delta s}+c_{i,p}^{\dag}c_{i+\delta, p}+h.c.\right\} \nonumber \\ &&+\sum_{i\in CI}\left(M+4t'\right)\left\{c_{i,s}^{\dag}c_{i,s} -c_{i,p}^{\dag}c_{i,p}\right\},\;\;\;\; \label{Hamiltonian_2DclassA} \end{eqnarray} with $CI$ denoting the Chern insulator sites, $t=A/2$, $t'=B$, $s$ and $p$ the orbital degrees of freedom, and $\delta=a, b$ the lattice constants for the ${\hat{\bf x}}$ and ${\hat{\bf y}}$ directions, respectively. Periodic boundary conditions along ${\hat{\bf x}}$ and open boundary conditions in the ${\hat{\bf y}}$ direction are imposed in our calculations. We focus on the critical region near $M=0$ where the bulk gap closes at wave vector ${\bf k}=(0,0)$. The corresponding Schrödinger equation can be solved by expanding the Hamiltonian in Eq.~\eqref{HCh_kspace} near ${\bf k}=(0,0)$ and then replacing $k_{i}\rightarrow-i\partial_{i}$. Considering an edge state whose energy dispersion is linear, i.e., $E(k_{x})=Ak_{x}$, we have \begin{eqnarray} \left\{-iA\sigma_{x}\partial_{x}-iA\sigma_{y}\partial_{y}+\left[M-B\partial_{x}^{2}-B\partial_{y}^{2}\right]\sigma_z\right\}\psi =Ak_{x}\psi. \nonumber \\ \end{eqnarray} Using the ansatz $\psi=\psi_{x}\psi_{y}\propto e^{ik_{x}x}e^{-\lambda y}\chi_{\eta}$, with $\chi_{\eta}$ a spinor of eigenvalue $\eta$, the equation becomes \begin{eqnarray} \left\{Ak_{x}\sigma_{x}+iA\sigma_{y}\lambda+\left[M+Bk_{x}^{2}-B\lambda^{2}\right]\sigma_z\right\}\chi_{\eta} =Ak_{x}\chi_{\eta}. \nonumber \\ \label{eq:edge} \end{eqnarray} From the equation above, we see that when the edge state is an eigenstate of $\sigma_{x}\chi_{\eta}=\eta\chi_{\eta}=$ with eigenvalue $\eta=\pm 1$, the $Ak_{x}$ terms on the left and right hand sides cancel out. The remaining equation $A\lambda+\left(M+Bk_{x}^{2}-B\lambda^{2}\right)=0$, straightforwardly yields the edge state decay length $1/\lambda$. Note that the edge state is an eigenstate of $\sigma_{x}$ because we choose the boundary to be extending along the ${\hat{\bf x}}$ direction. We also remark that the topological state of the Chern insulator is protected by the approximate chiral symmetry of the corresponding nodal semimetal, which has a nonzero winding number, as discussed in detail in Ref.~[\onlinecite{Candido218}]. The continuum limit solution above being an eigenstate of $\sigma_x$ implies that in the lattice model the edge state at any site $i$ has equal weights of the two orbitals $\left\{s,p\right\}$ (pseudospin degrees of freedom). Note, however, that in this simple calculation we suppose a perfect linear dispersion $E(k_{x})=Ak_{x}$, which is not true for the edge states at large momenta $k_{x}\apprge M/A$. This means in reality that only the edge state at zero momentum $k_{x}=0$ is a perfect eigenstate of $\sigma_{x}$. In what follows, we examine two different models for the NM layer to highlight the influence of the orbital kinetics of the NM on the fine-tuned zero-energy states, and whether they are distinguishable from the true edge states at zero momentum $k_{x}=0$. \subsubsection{Results: Chern insulator/NM junction with identical orbital kinetics in the NM} We first consider an NM tight-binding model that has identical kinetic hopping terms for the $s$ and $p$ orbitals, i.e., \begin{eqnarray} H_{NM}^{\sigma_{0}}&=&\sum_{i\in NM,\delta}t_{N}\left(c_{i,s}^{\dag}c_{i+\delta, s}+c_{i,p}^{\dag}c_{i+\delta, p}\right)+h.c. \nonumber \\ &&-\sum_{i\in NM}\mu_{N}\,\left(c_{i,s}^{\dag}c_{i,s}+c_{i,p}^{\dag}c_{i,p}\right), \label{HNM_sigma0} \end{eqnarray} with $t_N$ and $\mu_{N}$ the hopping and chemical potential, respectively. The coupling Hamiltonian reads \begin{eqnarray} H_{BD}^{\sigma_{0}}&=&\sum_{i\in BD}t_{B}\left(c_{i,s}^{\dag}c_{i+b,s}+c_{i,p}^{\dag}c_{i+b,p}\right)+h.c., \label{HBD_sigma0} \end{eqnarray} where $t_{B}$ is the interface hopping parameter and $i\in$BD denotes the boundary sites at the interface. We use the superscript $\sigma_{0}$ in $H^{\sigma_{0}}$ to denote that when the Fourier transform of such a Hamiltonian is written in the basis $(c_{{\bf k},s},c_{{\bf k},p})^{T}$, it is proportional to the identity matrix. \begin{figure}[ht] \begin{center} \includegraphics[clip=true,width=0.99\columnwidth]{Chern_NM_junction_sigma0} \caption{Chern insulator/NM junction with periodic boundary conditions in ${\hat{\bf x}}$ and open boundary conditions in ${\hat{\bf y}}$. Here, the NM and interface Hamiltonians have {\it identical} kinetics between the two orbitals. Panel (a) shows the wave functions $|\psi_{s}(y)|^{2}$ and $|\psi_{p}(y)|^{2}$ for the zero-energy state in the topologically (a) nontrivial ($M=-1$) and (b) trivial ($M=1$) cases. The insets show the eigenenergies $E_n$ at $k_{x}=0$ as functions of $\mu_N$, and the black dots indicate the zero-energy states, whose wave functions are shown. We have used the parameters $t = t'= t_N = t_B = 1$.} \label{fig:Chern_NM_junction} \end{center} \end{figure} \textit{Nontrivial phase ($M<0$).} In the inset of Fig. \ref{fig:Chern_NM_junction} (a) we show the eigenenergies $E_n$ at $k_{x}=0$ versus $\mu_N$. Note that in addition to the topological edge state, pinned at zero energy, there are several trivial NM states within the Chern insulator bulk gap that eventually cross zero. This is similar to what happens in the SSH/NM system in Sec.~\ref{sec:SSHNM}. As an example, we show in Fig.~\ref{fig:Chern_NM_junction} (a) the wave function of the fine-tuned zero-energy state at $k_{x}=0$ for $\mu_N=-0.6906t$ (black dot in the inset). We note that, similarly to the true topological edge state, the state here also has equal $s$- and $p$- orbital components ($|\psi_s|^2 = |\psi_p|^2$) in both the Chern insulator and NM regions. This indicates that it mimics the true topological edge state. \textit{Trivial phase ($M>0)$.} In Fig.~\ref{fig:Chern_NM_junction} (b) we plot $E_n$ versus $\mu_N$ (inset) and show the wave function of one of the fine-tuned zero-energy states $\mu_N=-0.6485t$ ( black dot in the energy spectrum.) In this case, the wave function no longer has the same weights on both orbitals ($|\psi_s|^2 \approx 0$, for this particular example), and hence in principle should be distinguishable from the true topological edge state. \subsubsection{Results: Chern insulator/NM junction with opposite orbital kinetics in the NM} The second NM model we analyze has kinetic hopping terms of opposite signs for the $s$ and $p$ orbitals, i.e., \begin{eqnarray} H_{NM}^{\sigma_{z}}&=&\sum_{i\in NM,\delta}t_{N}\left(c_{i,s}^{\dag}c_{i+\delta, s}-c_{i,p}^{\dag}c_{i+\delta, p}\right)+h.c. \nonumber \\ &&-\sum_{i\in NM}\mu_{N}\,\left(c_{i,s}^{\dag}c_{i,s}-c_{i,p}^{\dag}c_{i,p}\right). \label{HNM_sigmaz} \end{eqnarray} For the interface, the Hamiltonian is given by \begin{eqnarray} H_{BD}^{\sigma_{z}}&=&\sum_{i\in BD}t_{B}\left(c_{i,s}^{\dag}c_{i+b, s}-c_{i,p}^{\dag}c_{i+b, p}\right)+h.c. \label{HBD_sigmaz} \end{eqnarray} Here, the superscript $\sigma_{z}$ means that a Bloch Hamiltonian $H^{\sigma_z}(\mathbf{k})$, written in the basis $(c_{{\bf k},s},c_{{\bf k},p})^{T}$, is proportional to $\sigma_{z}$. \begin{figure}[htb!] \begin{center} \includegraphics[clip=true,width=0.99\columnwidth]{Chern_NM_junction_sigmaz} \caption{Chern insulator/NM junction with periodic boundary conditions in ${\hat{\bf x}}$ and open boundary conditions in ${\hat{\bf y}}$. Here the NM and interface Hamiltonians have opposite kinetics between the two orbitals. The wave functions $|\psi_{s}(y)|^{2}$ and $|\psi_{p}(y)|^{2}$ for the zero-energy state are shown for the (a) nontrivial ($M=-1$) and (b) trivial ($M=1$) cases. In the trivial case the solutions come in pairs. The inset shows the eigenenergies $E_{n}$ as functions of $\mu_{N}$, with the parameters $t = t'= t_N = t_B = 1$.} \label{fig:Chern_NM_junction2} \end{center} \end{figure} \textit{Nontrivial phase ($M<0$).} In Fig.~\ref{fig:Chern_NM_junction2}(a) we show that as we vary $\mu_N$, it is not possible to generate an additional zero-energy state. As a result, the true topological edge states can be unambiguously identified. This is so because there are already two solutions (true topological edge states) at $E=0$. \textit{Trivial phase ($M>0$).} In this case, as shown in Fig.~\ref{fig:Chern_NM_junction2}(b), it is always possible to create zero-energy states that come in pairs. In a way similar to the Majorana chain/NM juncton discussed in Sec.~\ref{Kitaev:trivial}, one of the two zero-energy states is purely an $s$-like wave function and the other is a purely $p$-like, making two of them together indistinguishable from the true topological edge state that has equal $s$ and $p$ orbital wave functions. \section{Conclusions} In summary, we show that when an NM is attached to a topological material, it is possible to fine tune the chemical potential of the metallic layer so as to create a zero-energy state that is indistinguishable from the true topological edge state. The results for the three examples we have examined are summarized below. For the SSH/NM junction, we find that such a zero-energy state can be created by fine-tuning the chiral-symmetry breaking chemical potential of the NM. Moreover, these states can be created in both the topologically trivial and nontrivial phases. The wave function profile of this zero-energy state in the SSH region is only localized on one sublattice, just like the true topological edge state, making it indistinguishable from the true topological edge state as far as the wave function profile is concerned. For the Kitaev/NM junction in the topologically nontrivial phase, we find that such a zero-energy state cannot occur alongside the true Majorana edge states. On the other hand, in the trivial phase, the fine-tuded zero energy states can occur, and they must appear in pairs due to PH symmetry. Because one of them has an electron-like wave function and the other a hole-like, it is highly possible to mistaken the two zero-energy states together as one single Majorana fermion. In the 2D Chern insulator, the true topological edge state self-generates a symmetry eigenvalue due to the direction of the edge. As a result, its wave function has the same weight on the two orbitals. In the 2D Chern insulator/NM junction, we show that for an NM model that has the same kinetic hopping terms for the two orbital degrees of freedom, a zero-energy state can be created in the topologically nontrivial phase. The wave function, here, has the same weights on the two orbitals, thus mimicking the true topological edge state. On the other hand, if the kinetic hopping terms of the two orbitals in the NM have opposite signs, then the zero-energy state appear in pairs and can only be created in the topologically trivial phase. Moreover, one of the zero-energy states has an $s$-like wave function and the other a $p$-like, meaning that the two states together may be wrongly identified as one single edge state. These results indicate that should a metallic layer be attached to a topological material, caution must be taken if one intends to identify the true topological edge state merely from the zero-energy modes and their wave function profiles, since such fine-tuned zero-energy states may occur and obscure the identification. \begin{acknowledgments} P.H.P acknowledges support of the PNPD program by Coordena\c c\~ao de Aperfei\c coamento de Pessoal de N\'{i}vel Superior (CAPES) –- Finance Code 001. J.C.E. acknowledges support from the S\~ao Paulo Research Foundation (FAPESP) Grants No. 2016/08468-0 and No. 2020/00841-9, and from Conselho Nacional de Pesquisas (CNPq), Grant No. 306122/2018-9. \end{acknowledgments}
\section{Introduction} \label{sec:intro} Omega-automata \cite{Thomas90b,Perrin04} have found renewed interest---often as the result of translating a formula in LTL~\cite{Pnueli77}---as specifications of qualitative objectives in reinforcement learning (RL)~ \cite{Sutton18}. The acceptance condition of an $\omega$-automaton determines the reward whose cumulative return the learning agent strives to maximise. The relation between the automaton and the reward signal should ensure that a strategy that maximises the expected return also maximises the probability to realise the objective. This so-called \emph{faithfulness} requirement~\cite{Hahn20c} restricts the type of $\omega$-automaton that can be used to represent the objective, and this paper concerns how to find the right type of $\omega$-automata. Deterministic automata with various types of acceptance conditions have been used in model checking and strategy synthesis \cite{Baier08}; notably, B\"uchi, parity, Rabin, and Streett. While deterministic B\"uchi automata---including generalised deterministic B\"uchi automata---do not accept all $\omega$-regular languages, deterministic parity, Rabin, and Streett automata do; therefore, they are employed in the formulation of general solutions to synthesis problems. In addition, maximising the chance of meeting a parity and Rabin winning conditions in a game can be obtained using positional strategies, while Streett winning conditions require finite additional memory. This means that a positional strategy for a Markov decision process (MDP) or a Markov game endowed with a parity or Rabin objective can be turned into a strategy to control the environment, such that strategy only uses the state of the $\omega$-automaton for the objective as memory. Strategy computation methods for both Rabin and Streett automata have been studied extensively \cite{Buhrke96,deAlfa98,Piterm06c}. These methods, however, are not applicable in RL. In order to apply RL to the computation of optimal strategies for $\omega$-regular objectives, we have to devise a scheme for doling out rewards that, for generality, depend on the given $\omega$-automaton, and perhaps on some hyperparameters of the learning algorithm, but not on the MDP---or the Markov game---for which a control strategy is sought. Two features of RL algorithms significantly affect the choice of translation from acceptance condition to rewards: 1) they require positional optimal strategies after the translation to rewards, as they learn values of states and transitions, and 2) the same transitions will always be optimal once a property is translated into scalar rewards. This appears to effectively exclude using Streett conditions, as optimal control requires memory for Streett objectives. This is regrettable, as Streett objectives do occur in practice. GR(1) \cite{BloemJPPS12} conditions, for example, translate smoothly into Streett objectives (in the pure original form, to one pair Streett objectives), such that a conjunction of GR(1) objectives will always have a natural representation as a deterministic Streett automaton. Likewise, each strong fairness requirement produces a Streett pair. Moreover, minimising the chance of satisfying a Rabin condition given as a deterministic Rabin automaton (DRA) is also equivalent to maximising the chance of satisfying the Streett condition given by its dual. A natural way to move to simpler acceptance conditions requires some form of nondeterminism. Full recourse to nondeterminism, however, is not compatible with the computation of optimal strategies for MDPs or Markov games. If we want to move away from using deterministic automata to describe the objective, we therefore need to impose restrictions on the automaton's nondeterminism. The precise nature of these restrictions depends on the type of environment interacting with the agent, whose control strategy we want to build. If the environment is a Markov decision process \cite{Put94}, the automaton needs to be Good-for-MDPs (GFM) \cite{Hahn20,Vardi85,Courco95}, while, for Markov games, with two strategic players, the stronger requirements of Good-for-Games automata \cite{Henzin06} must be satisfied. GFM automata have the advantage that they can use simpler acceptance mechanisms. In particular, the GFM automata developed so far are nondeterministic B\"uchi automata, and being able to use a simple acceptance mechanism like B\"uchi is quite beneficial for RL \cite{Hahn19,Hahn20}---though it is possible to use parity automata, using them comes at a cost \cite{Hahn20b}. When starting with a deterministic Streett automaton (DSA), a translation to a nondeterministic B\"uchi automaton (NBA) \cite{SV89}, or even to a nondeterministic Rabin automaton \cite{SV89}, comes at the cost of an exponential blow-up, even without the restriction to GFM automata. This raises the question of whether or not there is a different way to efficiently translate the DSA into a suitable automaton. Our main result is that \textbf{alternating GFM automata can be exponentially more succinct than general nondeterministic B\"uchi automata}. Intuitively, this should not be possible: the reason for the exponential blow-up from DSAs to NBAs (and even NRAs) is that one will either need some form of memory, such as a latest appearance record (LAR), or a nondeterministic guess as to which way each Streett pair is satisfied in. Recall that a Streett pair consists of a green and a red set of states or transitions, and it is satisfied if no entry of the red set \emph{or} some entry of the green set occurs infinitely often; a nondeterministic automaton can guess, for each pair, to validate either of these conditions. The intuitive effect of this blow-up would be that starting with DSAs is something that efficient RL approaches will struggle with. The key message of this paper is that one can trade-off \emph{alternation} for memory in computing an optimal strategy by moving to \emph{alternating} GFM automata instead of traditional nondeterministic ones. Here is the interesting bit: while we do, unsurprisingly, need a latest appearance record (LAR \cite{Gurevi82,Dziemb97}) in the control strategy we develop, the blow-up due to the LAR is not necessary while learning the optimal strategy! \section{Preliminaries} A \emph{probability distribution} over a finite set $S$ is a function $d \colon S {\to} [0, 1]$ such that $\sum_{s \in S} d(s) = 1$. Let ${\mathcal D}(S)$ denote the set of all discrete distributions over $S$. We say a distribution ${d \in {\mathcal D}(S)}$ is a \emph{point distribution} if $d(s) {=} 1$ for some $s \in S$. For $d \in {\mathcal D}(S)$ we write $\supp(d)$ for $\set{s \in S \colon d(s) > 0}$. \subsection{Stochastic Game Arenas and Markov Decision Processes} \label{sec:MDPs} A \emph{stochastic game arena} $\mathcal{G}$ is a tuple $(S, s_0, A, T, S_\mathrm{Max}, S_\mathrm{Min}, AP, L)$, where $S$ is a finite set of states, $s_0 \in S$ is the initial state, $A$ is a finite set of {\it actions}, $T : S \times A \xrightharpoondown{} {\mathcal D}(S)$ is the \emph{probabilistic transition (partial) function}, $\{S_\mathrm{Max}, S_\mathrm{Min}\}$ is a partition of the set of states $S$, $AP$ is the set of {\it atomic propositions}, and $L : S \to 2^{AP}$ is the {\it labeling function}. For $s \in S$, $A(s)$ denotes the set of actions enabled in $s$. For states $s, s' \in S$ and $a \in A(s)$ we write $p(s' | s, a)$ for $T(s, a)(s')$. A {\it run} of $\mathcal{G}$ is an $\omega$-word $\seq{s_0, a_1, s_1, \ldots} \in S \times (A \times S)^\omega$ such that $p(s_{i+1} | s_{i}, a_{i+1}) > 0$ for all $i \geq 0$. A finite run is a finite such sequence, that is, a word in $ S \times (A \times S)^*$. For a {\it run} $r = \seq{s_0, a_1, s_1, \ldots}$ we define the corresponding labeled run as $L(r) = \seq{L(s_0), L(s_1), \ldots} \in (2^{AP})^\omega$. We write $\mathit{Runs}^\mathcal{G} (\mathit{FRuns}^\mathcal{G})$ for the set of runs (finite runs) of the SGA $\mathcal{G}$ and $\mathit{Runs}{}^\mathcal{G}(s) (\mathit{FRuns}{}^\mathcal{G}(s))$ for the set of runs (finite runs) of the SGA $\mathcal{G}$ starting from state $s$. We write $\last(r)$ for the last state of a finite run $r$. A game on an SGA $\mathcal{G}$ is played between two players, Max and Min, by moving a token through the states of the arena. The game begins with a token in an {\em initial state} $s_0$; players $\mathrm{Max}$ and $\mathrm{Min}$ construct an infinite run by taking turns to choose enabled actions when the token is in a state controlled by them, and then moving the token to a successor state sampled from the selected distribution. A strategy of player $\mathrm{Min}$ in $\mathcal{G}$ is a partial function $\pi \colon \mathit{FRuns} \xrightharpoondown{} {\mathcal D}(A)$, defined for $r \in \mathit{FRuns}$ if and only if $\last(r) \in S_\mathrm{Min}$, such that $\supp(\sigma(r)) \subseteq A(\last(r))$. A strategy $\sigma$ of player Max is defined analogously. We drop the subscript $\mathcal{G}$ when the arena is clear from the context. Let $\Sigma_\mathcal{G}$ and $\Pi_\mathcal{G}$ be the sets of all strategies of player Max and player Min, respectively. A memory skeleton for $\mathcal{G}$ is a tuple $\mathbf{M} = (M, m_0, \alpha_u)$ where $M$ is a finite set of memory states, $m_0 \in M$ is the initial state, and $\alpha_u: M {\times} 2^{AP} \to M$ is the memory update function. The extended memory update $\hat{\alpha}_u \colon M {\times} (2^{AP})^* \to M$ can be defined in the usual manner. A finite memory strategy of player $\mathrm{Max}$ in $\mathcal{G}$ over a memory skeleton $\mathbf{M}$ is a Mealy machine $(\mathbf{M}, \alpha_x)$ where $\alpha_x: S_\mathrm{Max} {\times} M \to {\mathcal D}(A)$ is the {\it next action function} that suggests the next action based on the SGA and the memory state. The semantics of a finite memory strategy $(\mathbf{M}, \alpha_x)$ is given as a strategy $\sigma \in \Sigma_\mathcal{G}$ such that for every $r \in \mathit{FRuns}$ with $\last(r) \in S_\mathrm{Max}$, we have that $\sigma(r) = \alpha_x(\last(r), \hat{\alpha}_u(m_0, L(r)))$. A strategy $\sigma$ is {\it pure} if $\sigma(r)$ is a point distribution wherever it is defined; otherwise, $\sigma$ is \emph{mixed}. We say that $\sigma$ is {\it stationary} if $\last(r) = \last(r')$ implies $\sigma(r) = \sigma(r')$ wherever $\sigma$ is defined. A strategy is \emph{positional} if it is both pure and stationary. We write $\overline{\Sigma}_\mathcal{G}$ and $\overline{\Pi}_\mathcal{G}$ for the sets of all \emph{positional} strategies of player Max and player Min, respectively. Let $\mathit{Runs}^\mathcal{G}_{\sigma,\pi}(s)$ denote the subset of runs $\mathit{Runs}^\mathcal{G}(s)$ starting from state $s$ that are consistent with player Max and player Min following strategies $\sigma$ and $\pi$, respectively. The behavior of an SGA $\mathcal{G}$ under a strategy pair $(\sigma, \pi) \in \Sigma_\mathcal{G} \times \Pi_\mathcal{G}$ is defined on the probability space $(\mathit{Runs}^\mathcal{G}_{\sigma, \pi}(s), \mathcal{F}_{\mathit{Runs}^\mathcal{G}_{\sigma, \pi}(s)}, \Pr^\mathcal{G}_{\sigma, \pi}(s))$ over the set of infinite runs $\mathit{Runs}^\mathcal{G}_{\sigma,\pi}(s)$, where $\mathcal{F}_{\mathit{Runs}^\mathcal{G}_{\sigma, \pi}(s)}$ is the standard $\sigma$-algebra over them. Given a random variable $f \colon \mathit{Runs}^\mathcal{G} \to \mathbb R$ over the infinite runs of $\mathcal{G}$, we denote by $\mathbb E^\mathcal{G}_{\sigma, \pi}(s) \set{f}$ the expectation of $f$ over the runs in the probability space $(\mathit{Runs}^\mathcal{G}_{\sigma, \pi}(s), \mathcal{F}_{\mathit{Runs}^\mathcal{G}_{\sigma, \pi}(s)}, \Pr^\mathcal{G}_{\sigma, \pi}(s))$. We say that a SGA is a Markov decision process if $A(s)$ is a singleton for every $s \in S_\mathrm{Min}$ and is a Markov chain if $A(s)$ is singleton for every $s \in S$. To distinguish an MDP from an SGA, we denote an MDP by $\mathcal{M}$ and write its signature $\mathcal{M} = (S, s_0, A, T, AP, L)$ by assigning the (choiceless) states of player Min to player Max. The notions defined for SGAs naturally carry over to MDPs. \subsection{Omega-Automata} \label{sec:omega-automata} An alphabet is a finite set of letters. We write $\mathbb{B}$ for the binary alphabet $\set{0, 1}$. A finite word over an alphabet $\Sigma$ is a finite concatenation of symbols from $\Sigma$. Similarly, an $\omega$-word $w$ over $\Sigma$ is a function $w : \omega \to \Sigma$ from the natural numbers to $\Sigma$. We write $\Sigma^*$ and $\Sigma^\omega$ for the set of finite and $\omega$-strings over $\Sigma$. An $\omega$-automaton $\mathcal{A} = \tuple{\Sigma,Q,q_0,\delta,\alpha}$ consists of a finite alphabet $\Sigma$, a finite set of states $Q$, an initial state $q_0 \in Q$, a transition function $\delta : Q \times \Sigma \to 2^Q$, and an acceptance condition $\alpha: Q^\omega \to \mathbb{B}$. A \emph{deterministic} automaton is such that $\delta(q,\sigma)$ is a singleton for every state $q$ and alphabet letter $\sigma$. For deterministic automata, we write $\delta(q,\sigma) = q'$ instead of $\delta(q,\sigma) = \{q'\}$. A \emph{run} of an automaton $\mathcal{A} = \tuple{\Sigma,Q,q_0,\delta,\alpha}$ on word $w \in \Sigma^\omega$ is a function $\rho : \omega \to Q$ such that $\rho(0) = q_0$ and $\rho(i+1) \in \delta(\rho(i), w(i))$. A run $\rho$ is \emph{accepting} if $\alpha(\rho) = 1$. A word $w$ is accepted by $\mathcal{A}$ if there exists an accepting run of $\mathcal{A}$ on $w$. The language of $\mathcal{A}$, written $\mathcal{L}(\mathcal{A})$, is the set of words accepted by $\mathcal{A}$. The set of states that appear infinitely often in $\rho$ is written $\infi(\rho)$. A deterministic automaton $\mathcal{D}$ has exactly one run for each word in $\Sigma^\omega$. We write $\infi^{\mathcal{D}}(w)$ for the set of states that appear infinitely often in the unique run of $\mathcal{D}$ on $w$; when clear from the context, we drop the superscript and simply write $\infi(w)$. Several ways to give finite presentations of the acceptance conditions are in use. The ones relevant to this paper are listed below. \begin{itemize} \item A \emph{B\"uchi} acceptance condition is specified by a set of states $F \subseteq Q$ such that \[ \alpha(\rho) = [\,\infi(\rho) \cap F \neq \emptyset\,]. \] \item A \emph{Rabin} acceptance condition of index $k$ is specified by $k$ pairs of sets of states, $\{\tuple{R_i,G_i}\}_{1 \leq i \leq k}$, and intuitively a run should visit at least one set of Red (ruinous) states finitely often and its corresponding Green (good) set of states infinitely often. Formally, \[ \alpha(\rho) = [\,\exists\, 1 \leq i \leq k \scope \infi(\rho) \cap R_i = \emptyset \text{ and } \infi(\rho) \cap G_i \neq \emptyset\,]. \] \item A \emph{Streett} acceptance condition of index $k$ is specified by $k$ pairs of sets of states, $\{\tuple{G_i,R_i}\}_{1 \leq i \leq k}$, and intuitively a run should visit each Red set of states finitely often or its corresponding Green set of states infinitely often. Formally, \[ \alpha(\rho) = [\,\forall\, 1 \leq i \leq k \scope \infi(\rho) \cap R_i = \emptyset \text{ or } \infi(\rho) \cap G_i \neq \emptyset\,]. \] \end{itemize} We also allow for moving the acceptance condition from states to transitions. For a B\"uchi acceptance condition, this means defining a set $F \subseteq Q\times \Sigma \times Q$ of final transitions, where the $i^{th}$ transition for a run $\rho$ of a word $w$ is $t(i) = \big(\rho(i),w(i),\rho(i+1)\big)$, $\inf_t(\rho,w)$ is the set of transitions that occur infinitely often, and a run $\rho$ is accepting for $w$ if $\inf_t(\rho,w)\cap F \neq \emptyset$. \subsection{Semantic Satisfaction: Optimal Strategies Against $\omega$-Automata} \label{ssec:semanticProb} Given an MDP $\mathcal{M} = (S, s_0, A, T, AP, L)$ and an $\omega$-automaton $\mathcal{A} = \tuple{2^{AP},Q,q_0,\delta,\alpha}$, we are interested in strategies that maximise the probability that the labels of a run of $\mathcal{M}$ form an $\omega$-word in the language of $\mathcal{A}$. A strategy $\sigma \in \Sigma_\mathcal{M}$ and initial state $s \in S$ determine a sequence $X_i$ of random variables denoting the $i^{th}$ state of the MDP, where $X_0 = s$. We define the optimal satisfaction probability $\PSemSat^\mathcal{M}_{\mathcal{A}}(s)$ as \[ \PSemSat^\mathcal{M}_{\mathcal{A}}(s) = \sup_{\sigma \in \Sigma_{\mathcal{M}}} \Pr{}^\mathcal{M}_{\sigma}(s) \set{ \seq{L(X_0), L(X_1), \ldots } \in \mathcal{L}(\mathcal{A})} . \] We say that a strategy $\sigma \in \Sigma_\mathcal{M}$ is optimal for $\mathcal{A}$ if \[ \Pr{}^\mathcal{M}_{\sigma}(s) \set{ \seq{L(X_0), L(X_1), \ldots } \in \mathcal{L}(\mathcal{A})} = \PSemSat^\mathcal{M}_{\mathcal{A}}(s) \] for all $s \in S$. \subsection{Good-for-MDPs Automata} \label{ssec:product} \begin{figure}[t] \centering \begin{tikzpicture}[scale=0.9,transform shape, every state/.append style={fill=yellow!10},semithick, el/.style = {inner sep=2pt, align=left, sloped}] \begin{scope} \node[state, initial above] (q0) {$q_0$}; \node[state] (q1) [left=1.75cm of q0] {$q_1$}; \node [left=1cm of q1] {$\mathcal{A}_\varphi:$}; \node[state] (q2) [right=1.75cm of q0] {$q_2$}; \path[->] (q0) edge [bend right] node[above] {$g, b$} (q1) (q1) edge [double,bend right] node[label={below:$g$}] {} (q0) (q0) edge [bend left] node[above] {$g,b$} (q2) (q2) edge [double,bend left] node[label={below:$b$}] {} (q0); \end{scope} \begin{scope}[yshift=-2cm,xshift=1cm] \node[box state,initial above, fill=goodcellcolor,label=right:$g$] (S0) {$s_0$}; \node[prob state,fill=safecellcolor] (Prob) [below=1.5cm of S0] {}; \node[box state,fill=badcellcolor,label=left:$b$] (S1) [left=2.5cm of Prob] {$s_1$}; \node[prob state,fill=safecellcolor] (Prob2) [above=1.5cm of S1] {}; \node [left=1cm of Prob2] {$\mathcal{M}:$}; \path[-] (S0) edge[swap] node[label={left:$ $}] {} (Prob); \path[->] (Prob) edge[swap] node {$\frac{1}{2}$} (S1) edge[bend right] node[label={right:$\frac{1}{2}$}]{} (S0); \path[-] (S1) edge[swap] node[label={left:$ $}] {} (Prob2); \path[->] (Prob2) edge[swap] node {$\frac{1}{2}$} (S0) edge[bend right] node[label={left:$\frac{1}{2}$}]{} (S1); \end{scope} \begin{scope}[xshift=6cm] \node[box state,initial above, fill=goodcellcolor,label=right:$ $] (S0){$s_0, q_0$}; \node[box state,fill=badcellcolor] (S1)[below=3cm of S0] {$s_1, q_0$}; \node[box state,fill=goodcellcolor] (S2)[left=3cm of S0] {$s_0, q_1$}; \node[box state,fill=badcellcolor] (S3)[below=3cm of S2] {$s_1, q_1$}; \node[box state,fill=goodcellcolor] (S4)[right=3cm of S0] {$s_0, q_2$}; \node[box state,fill=badcellcolor] (S5)[below=3cm of S4] {$s_1, q_2$}; \node [below=1cm of S1] {$\mathcal{M}\times\mathcal{A}_\varphi$}; \node[prob state,fill=safecellcolor] (Prob1) [left=1.5cm of S0] {}; \node[prob state,fill=safecellcolor] (Prob2) [left=1.5cm of S1] {}; \node[prob state,fill=safecellcolor] (Prob3) [right=1.5cm of S0] {}; \node[prob state,fill=safecellcolor] (Prob4) [right=1.5cm of S1] {}; \node[prob state,fill=safecellcolor] (Prob5) [below=1.5cm of Prob1] {}; \node[prob state,fill=safecellcolor] (Prob6) [below=1.5cm of Prob3] {}; \path[-] (S0) edge[swap] node[label={left:$ $}] {} (Prob1) (S0) edge[swap] node[label={left:$ $}] {} (Prob3) (S1) edge[swap] node[label={left:$ $}] {} (Prob2) (S1) edge[swap] node[label={left:$ $}] {} (Prob4) (S2) edge[double,swap] node[label={left:$ $}] {} (Prob5) (S5) edge[double,swap] node[label={left:$ $}] {} (Prob6); \path[->] (Prob1) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S2) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S3); \path[->] (Prob2) edge[swap] node[el,below,pos=0.75] {$\frac{1}{2}$} (S2) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$}(S3); \path[->] (Prob3) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S4) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S5); \path[->] (Prob4) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S4) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S5); \path[->] (Prob5) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S0) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S1); \path[->] (Prob6) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S0) edge[swap] node[el,above,pos=0.75] {$\frac{1}{2}$} (S1); \end{scope} \end{tikzpicture} \caption{\small {\bf Syntactic and Semantic Probabilities Differ. } A nondeterministic B\"uchi automaton $\mathcal{A}_\varphi$ (top left) that recognises the language of infinitely many $g$'s or infinitely many $b$'s (which accepts all $\omega$-words) and a Markov decision process $\mathcal{M}$, whose set of actions is a singleton (a Markov chain). Note that double edges mark accepting transitions. Notice that the MDP $\mathcal{M}$ satisfies the property with probability $1$. Their product is shown on the right side, where there is no accepting end-component. Hence, the probability of reaching the accepting end-component (under any strategy) is $0$.} \label{fig:NBW} \end{figure} Given an MDP $\mathcal{M} = (S, s_0, A, T, AP, L)$ and automaton $\mathcal{A} = \tuple{2^{AP},Q,q_0,\delta,\alpha}$, the \emph{probabilistic model checking} problem is to find the optimal value $\PSemSat^\mathcal{M}_{\mathcal{A}}(s)$ and an optimal strategy in $\Sigma_\mathcal{M}$. An intuitive way to compute $\PSemSat^\mathcal{M}_{\mathcal{A}}(s)$ is to build the synchronous product $\mathcal{M}{\times}\mathcal{A}$ of $\mathcal{M}$ and $\mathcal{A}$ and compute the optimal probability $\PSat^\mathcal{M}_{\mathcal{A}}(s)$ and a strategy that maximizes the probability of satisfying the acceptance condition. If these values $\PSemSat^\mathcal{M}_{\mathcal{A}}(s)$ and $\PSat^\mathcal{M}_{\mathcal{A}}(s)$ coincide for all possible $\mathcal{M}$, then the automaton is said to be \emph{good-for-MDPs} \cite{Hahn20}. The synchronous product is an MDP $\mathcal{M} \times \mathcal{A} = \tuple{S\times Q, (s_0, q_0), A\times Q, T^\times, AP, L}$, where $$T^\times((s,q),(a,q'))(s',q'') = \begin{cases} T(s,a)(s') & \text{if } q' \in \delta(q, L(s)) \text{ and } q'' = q' \\ 0 & \text{if } q' \in \delta(q, L(s)) \text{ and } q'' \neq q' \\ \text{undefined} & \text{otherwise .} \end{cases}$$ A strategy $\sigma \in \Sigma_{\mathcal{M}\times \mathcal{A}}$ and initial state $s \in S$ determine a sequence $(X_i, Q_i)$ of random variables denoting the $i^{th}$ state of the product MDP, where $X_0 = s$ and $Q_0 = q_0$. The syntactic probability is defined to be \[ \PSat^\mathcal{M}_{\mathcal{A}}(s) = \sup_{\sigma \in \Sigma_{\mathcal{M}\times \mathcal{A}}} \mathbb E^{\mathcal{M}\times \mathcal{A}}_{\sigma}(s) \set{ \alpha( \seq{Q_0, Q_1, \ldots })}. \] An automaton is good-for-MDPs if $\PSemSat^\mathcal{M}_{\mathcal{A}}(s) = \PSat^\mathcal{M}_{\mathcal{A}}(s)$ for all MDPs $\mathcal{M}$ and states $s \in S$. Figure~\ref{fig:NBW} shows an example of an $\omega$-automaton with B\"uchi acceptance condition that is not GFM, while Figure~\ref{fig:DBW} shows an automaton that is a GFM (since every deterministic $\omega$-automaton is GFM.). \begin{figure}[t] \centering \begin{tikzpicture}[scale=0.9,transform shape, every state/.append style={fill=yellow!10},semithick] \begin{scope} \node[state, initial above] (q0) {$q_0$}; \node [below=1cm of q0] {$\mathcal{A}_\varphi$}; \path[->] (q0) edge [double,loop right] node[label={right:$b$}] {} () (q0) edge [double,loop left] node[label={left:$g$}] {} (); \end{scope} \begin{scope}[xshift=5cm,yshift=1cm] \node[box state,initial above, fill=goodcellcolor,label=right:$g$] (S0) {$s_0$}; \node[prob state,fill=safecellcolor] (Prob) [below=1.5cm of S0] {}; \node[box state,fill=badcellcolor,label=left:$b$] (S1) [left=2.5cm of Prob] {$s_1$}; \node[prob state,fill=safecellcolor] (Prob2) [above=1.5cm of S1] {}; \node [below=0.5cm of Prob] {$\mathcal{M}$}; \path[-] (S0) edge[swap] node[label={left:$ $}] {} (Prob); \path[->] (Prob) edge[swap] node {$\frac{1}{2}$} (S1) edge[bend right] node[label={right:$\frac{1}{2}$}]{} (S0); \path[-] (S1) edge[swap] node[label={left:$ $}] {} (Prob2); \path[->] (Prob2) edge[swap] node {$\frac{1}{2}$} (S0) edge[bend right] node[label={left:$\frac{1}{2}$}]{} (S1); \end{scope} \begin{scope}[xshift=10cm,yshift=1cm] \node[box state,initial above, fill=goodcellcolor,label=right:$g$] (S0) {$s_0, q_0$}; \node[prob state,fill=safecellcolor] (Prob) [below=1.5cm of S0] {}; \node[box state,fill=badcellcolor,label=left:$b$] (S1) [left=2.5cm of Prob] {$s_1, q_0$}; \node[prob state,fill=safecellcolor] (Prob2) [above=1.5cm of S1] {}; \node [below=0.5cm of Prob] {$\mathcal{M} \times \mathcal{A}_\varphi$}; \path[-] (S0) edge[double,swap] node[label={left:$ $}] {} (Prob); \path[->] (Prob) edge[swap] node {$\frac{1}{2}$} (S1) edge[bend right] node[label={right:$\frac{1}{2}$}]{} (S0); \path[-] (S1) edge[double,swap] node[label={left:$ $}] {} (Prob2); \path[->] (Prob2) edge[swap] node {$\frac{1}{2}$} (S0) edge[bend right] node[label={left:$\frac{1}{2}$}]{} (S1); \end{scope} \end{tikzpicture} \caption{\small {\bf Syntactic and Semantic Probabilities Agree. } A deterministic B\"uchi automaton $\mathcal{A}_\varphi$ (left) that recognises the language of infinitely many $g$'s or infinitely many $b$'s (accepts all $\omega$-words) and an MDP $\mathcal{M}$ (center), whose set of actions is singleton (a Markov chain). Again double edges mark accepting transitions. Notice that the MDP $\mathcal{M}$ satisfies the property with probability $1$. Their product is shown on the right side where the whole MDP is one accepting end-component. Hence, the probability of reaching the end-component (under any strategy) is $1$.} \label{fig:DBW} \end{figure} \subsection{GFM B\"uchi Automata and Reinforcement Learning} \label{sec:rl} The limit reachability technique~\cite{Hahn19} reduces the model checking problem for given MDP and GFM B\"uchi automaton to a reachability problem by slightly changing the structure of the product: One adds a target state $t$ that can be reached with a given probability $1 - \zeta$ whenever visiting an accepting transition of the original product MDP. This reduction avoids the identification of accepting end-components and thus allows a natural integration to a wide range of model-free RL approaches. Thus, while the proofs do lean on standard model checking properties that are based on identifying winning end-components, they serve as a justification not to consider them when running the learning algorithm. For any $\zeta \in (0,1)$, the \emph{augmented MDP} $\mathcal{M}^\zeta$ is an MDP obtained from $\mathcal{M}\!\times\!\mathcal{A}$ by adding a sink state $t$ with a self-loop to the set of states of $\mathcal{M}\!\times\!\mathcal{A}$, and by making $t$ a destination of each accepting transition $\tau$ of $\mathcal{M}\!\times\!\mathcal{A}$ with probability $1-\zeta$. The original probabilities of all other destinations of an accepting transition $\tau$ are multiplied by $\zeta$. An example of an augmented MDP is shown in Figure~\ref{fig:add-sink}. With a slight abuse of notation, if $\sigma$ is a strategy on the augmented MDP $\mathcal{M}^\zeta$, we denote by $\sigma$ also the strategy on $\mathcal{M} \!\times\!\mathcal{A}$ obtained by removing $t$ from the domain of $\sigma$. The following result shows the correctness of the construction. \begin{theorem}[Limit Reachability Theorem~\cite{Hahn19}] \label{thm:limit-reach} There exists a threshold $\zeta' \in (0,1)$ such that, for all $\zeta > \zeta'$ and every state $s$, any strategy $\sigma$ that maximizes the probability of reaching the sink in $\mathcal{M}^\zeta$ is (1) an optimal strategy in $\mathcal{M}\times\mathcal{A}$ from $s$ and (2) induces an optimal strategy for the original MDP $\mathcal{M}$ from $s$ with the objective to produce a run in the language of $\mathcal A$. Moreover, $\mathcal{M}$ produces such a run almost surely if, and only if, the sink is almost surely reachable in $\mathcal{M}^\zeta$ for all $0 < \zeta < 1$. \end{theorem} \noindent Theorem~\ref{thm:limit-reach} leads to a very simple model-free RL algorithm for GFM B\"uchi automata. The augmented product is not built by the RL algorithm, which does not know the transition structure of the environment MDP. Instead, the observations are used to drive the objective automaton. When the automaton reports an accepting transition, the interpreter tosses a biased coin to give the learner a reward with probability $1-\zeta$. The interpreter also extracts the set of actions for the learner to choose from. If the automaton is not deterministic and it has not taken the one nondeterministic transition it needs to take yet, the set of actions the interpreter provides to the learner includes the choice of special ``jump'' actions that instruct the automaton to move to a chosen accepting component. When the automaton reports an accepting transition, the interpreter gives the learner a positive reward with probability $1-\zeta$. When the learner actually receives a reward, the training episode terminates. Any RL algorithm that maximizes this probabilistic reward is guaranteed to converge to a policy that maximizes the probability of satisfaction of the objective. \begin{figure}[t] \centering \begin{tikzpicture}[scale=0.85,transform shape] \colorlet{darkgreen}{green!40!black} \begin{scope} \node[box state,fill=safecellcolor] (S0) {$0$}; \node[prob state,fill=safecellcolor] (Prob) [below=1.5cm of S0] {}; \node[box state,fill=safecellcolor] (S1) [left=2.5cm of Prob] {$1$}; \node[box state,fill=safecellcolor] (S2) [right=2.5cm of Prob] {$2$}; \path[->] (S2) edge[bend right=30, swap] node {$\tau_2$} (S0); \path[-] (S0) edge[double,swap] node[label={left:$\tau_0$}] {} (Prob); \path[->] (Prob) edge[swap] node {$p$} (S1) edge node {$1-p$} (S2) (S1) edge[double,bend left=30] node[label={$\tau_1$}] {} (S0); \end{scope} \node[single arrow, fill=black!55] at (3.75cm,-1.5cm) {\phantom{m}}; \begin{scope}[xshift=8.5cm] \node[box state,fill=safecellcolor] (S0) {$0$}; \node[prob state,fill=safecellcolor] (Prob) [below=1.5cm of S0] {}; \node[box state,fill=safecellcolor] (S1) [left=2.5cm of Prob] {$1$}; \node[box state,fill=safecellcolor] (S2) [right=2.5cm of Prob] {$2$}; \path[->] (S2) edge[bend right=30, swap] node {$\tau_2$} (S0); \node[prob state,fill=safecellcolor] (Tau1) [left=1.2cm of S1] {}; \node[box state, darkgreen, thick, fill=goodcellcolor] (Sink) [below=1.5cm of Prob] {$t$}; \path[-] (S0) edge[swap] node {$\tau_0$} (Prob); \path[->] (Prob) edge[swap] node {$p\zeta$} (S1) edge node {$(1-p)\zeta$} (S2) edge[darkgreen] node[black] {$1-\zeta$} (Sink) (Tau1) edge[out=90,in=180] node {$\zeta$} (S0) edge[out=270,in=180,swap,darkgreen] node[black] {$1-\zeta$} (Sink); \path[-] (S1) edge[swap] node {$\tau_1$} (Tau1); \end{scope} \end{tikzpicture} \caption{\small Adding transitions to the target in the augmented product MDP.} \label{fig:add-sink} \end{figure} \section{Alternating GFM Automata} \label{sec:outline} Before giving a translation from Deterministic Streett automaton (DSA) to a good-for-MDP (GFM) alternating B\"uchi automaton (ABA), let us see how simple the translation is for its dual, a Deterministic Rabin Automaton (DRA). When we start with a DRA $\mathcal R$, the translation to a GFM Nondeterministic B\"uchi Automaton (NBA) \cite{Hahn20} is straightforward as shown next. \begin{definition}[DRA to GFM NBA] For a given deterministic Rabin automaton $\mathcal{R} = \tuple{\Sigma,Q,q_0,\delta,\{\langle R_i,G_i\rangle \mid i\in \{1,\ldots,k\}}$, we construct a nondeterministic GFM automaton $\mathcal{B} = \tuple{\Sigma,Q \times\{0,\ldots,k\}\cup \{ \bot\},(q_0,0),\delta',F}$ where: \[ \delta'(\hat{q}, a) = \begin{cases} \{\delta(q,a)\} \times \{0,\ldots,k\} & \text{ if $\hat{q} = (q, 0)$} \\ \{(\delta(q,a),i)\} & \text{ if $\hat{q} = (q, i)$, $i \not = 0$, and $q \notin R_i$} \\ \bot & \text{otherwise.} \end{cases} \] and $F= \{(q,i) \mid i \in \{1,\ldots,k\} \mbox{ and } q \in G_i\}$. \end{definition} The resulting NBA makes only a single guess: it guesses when an accepting end-component is reached in the product MDP $\mathcal M \times \mathcal R$ (noting that the $0$-copy is congruent to the original automaton), and then moves to a copy $i$, whose pair makes this end-component accepting. It is easy to see that this automaton is language equivalent to $\mathcal R$ and good-for-MDPs (e.g., it satisfies the simulation condition from \cite{Hahn20}). For $k$ pairs, this creates only $k{+}1$ copies, and thus a small overhead; and it allows one to then use standard reward translation techniques for B\"uchi acceptance conditions \cite{Hahn19} in RL. The question of how to maximise the probability to satisfy a Streett condition (or, likewise, how to minimise the probability to satisfy a Rabin condition) is more challenging. Broadly speaking, the translation of a Rabin acceptance condition is simplified by the fact that the nondeterministic choices of an NBA can easily handle the resolution of the disjunction of the acceptance condition on pairs, and resolving nondeterminism is something that always needs to be done when analysing an MDP. However, it is harder to accommodate for a conjunction of the acceptance condition on pairs, as in a Streett acceptance condition. As a consequence, the translation of a deterministic Streett automaton to a nondeterministic Rabin automaton (without a restriction to GFM) leads to a blow-up that results in $2^{\theta(n)}$ states \cite{SV89}, while a translation to an NBA requires $n2^{\theta(k)}$ states \cite{SV89}, even without the restriction to GFM. \emph{Surprisingly, there is a way to exploit \emph{alternating} good-for-MDP automata with a small blow-up of $k{+}2$ for $k$ pairs.} As B\"uchi games can be handled with similar techniques as for B\"uchi MDPs (Section~\ref{sec:rl}) in model-free reinforcement learning (cf.~\cite{Hahn20b}), the alternation itself does not create problems during learning; still, it is quite surprising that such a method works. This is partly because of the exponential memory requirement for Streett conditions, and partly because the acceptance player for the MDP would not have access to decisions the rejection player has made in the resulting game. However, while the automaton is small, the memory we infer from the winning strategy of this small automaton can be exponentially larger. An optimal strategy in the resulting game does not in itself constitute a strategy for controlling the MDP for a given DSA. This is because different strategic choices of the antagonistic rejection player will lead to different positions in the game, and there is no guarantee that a consistent positional strategy for all of these positions exists. Moreover, the strategic choices of an antagonistic rejection player have no direct relation to the observable history. We show, however, that the history can be used to identify a state in the game, whose decisions the acceptance player should follow. The need for memory is, therefore, not gone. Instead, the control strategy we construct in the correctness proof for the resulting alternating GFM B\"uchi automaton is only one part of the control strategy used for the MDP. The other is a latest appearance record (LAR), which is kept in addition to the constructed game. The LAR will determine the state, from a family of equivalent states, whose strategy will be followed. \subsection{Alternating GFM Automata} \label{sec:agfm} There is a number of mildly different definitions of alternating automata, and we can use the simplest one, where the states are partitioned into nondeterministic and universal states. \begin{definition} An alternating $\omega$-automaton $\mathcal{A} = \tuple{\Sigma,Q_n,Q_u,q_0,\delta,\alpha}$, with $Q=Q_n\cup Q_u$, is an automaton such that $\tuple{\Sigma,Q,q_0,\delta,\alpha}$ is a nondeterministic automaton, and $Q_n$ and $Q_u$ are disjoint sets of nondeterministic and universal states, respectively. \end{definition} A \emph{run tree} of an alternating automaton $\mathcal{A} = \tuple{\Sigma,Q_n,Q_u,q_0,\delta,\alpha}$ on word $w \in \Sigma^\omega$ is a family of functions $\{\rho_j : \omega \to Q \mid j \in J\}$ for some non-empty index set $J$ such that \begin{itemize} \item $\rho_j$ is a run for all $j \in J$, and \item if $\rho_j$ has a universal state $q'$ at a position $i \in \omega$ ($\rho_j(i) = q' {\in} Q_u$), then, for all $q \in \delta\big(q',w(i)\big)$, there is a $j_q \in J$ such that $\rho_{j_q}(k)=\rho_{j}(k)$ for all $k \leq i$, and $\rho_{j_q}(i+1)=q$. \end{itemize} A run tree is accepting if all of the runs of $\{\rho_j : \omega \to Q \mid j \in J\}$ are accepting. A minimal such family of runs can be viewed as a tree, where nondeterministc states have one successor, while universal states have many, namely all those defined by the local successor function. Alternatively, a family of runs can be viewed as a game, where an angelic acceptance player chooses the successor for a nondeterministic state, while an antagonistic rejection player selects the successor for a universal state. This way, they successively construct a run, and acceptance is decided by whether or not this run accepts. We extend the product construction from Section \ref{ssec:product} to produce a B\"uchi game from the product $\mathcal{M} {\times} \mathcal{A}$ of an MDP $\mathcal{M}$ with an alternating B\"uchi automaton $\mathcal{A}$, where the decisions of the rejection player are simply the decision to resolve the nondeterminism from the universal states, while resolving the nondeterminism from the MDP \emph{and} resolving the nondeterminism from the nondeterministic automata states are left to the acceptance player. Both players have positional optimal strategies (where, for the rejection player, positionality in\-cludes the state and the choice made by the acceptance player) in this game~\cite{mciver2002games}. We refer to the probability, with which the acceptance player can win this product game from a product state $(s,q)$ as \begin{align*} \PSat^\mathcal{M}_{\mathcal{A}}(s,q) &= \sup_{\sigma \in \Sigma_{\mathcal{M} \times \mathcal{A}}} \inf_{\pi \in \Pi_{\mathcal{M} \times \mathcal{A}}} \mathbb E^{\mathcal{M}\times\mathcal{A}}_{\sigma,\pi}(s,q) \set{ \alpha(\seq{X_0, X_1, \ldots}) } \; , \end{align*} where $\alpha$ is the B\"uchi condition and $X_i$ is the random variable corresponding to the state of the automaton at the $i$-th step. \begin{definition}[Alternating GFM Automata] \label{def:gfm} An alternating automaton $\mathcal{A}$ is \emph{good for MDPs} if, for all MDPs $\mathcal{M}$, $\PSat^\mathcal{M}_{\mathcal{A}}(s_0,q_0) = \PSemSat^\mathcal{M}_{\mathcal A}(s_0)$ holds, where $s_0$ is the initial state of $\mathcal{M}$. \end{definition} \subsection{Construction of the Alternating B\"uchi Automaton} \label{ssec:construction} The motivation for the translation of a deterministic Streett automaton to a GFM automaton is similar to that for Rabin: when having nondeterministic power, we can use it to guess when we have reached an accepting end-component that we plan to cover completely (i.e., we will almost surely visit every state and every transition in the end-component infinitely often). While covering an accepting end-component may require memory (or randomisation), its properties with respect to the Streett condition are straightforward: for every Streett pair $\langle G,R \rangle$, if the end-component contains a red state $q \in R$ then it must also contain a green state $q' \in G$ from the same pair, which should (almost surely) be visited after every visit of $q$. \begin{definition}[DSA to Alternating GFM B\"uchi] For a given deterministic Streett automaton $\mathcal{S} = \tuple{\Sigma,Q,q_0,\delta,\{\langle G_i,R_i\rangle \mid i\in \{1,\ldots,k\}}$, where we assume without loss of generality that $G_i\cap R_i = \emptyset$ for all $i=1,\ldots,k$, we construct an alternating B\"uchi automaton $\mathcal{A} = \tuple{\Sigma,Q,Q\times\{0,\ldots,k\},q_0,\delta',F}$ where: \begin{itemize} \item First, for every state $q \in Q$, we let $I_q = \{0\} \cup \{i \mid q \in R_i\}$. \item We now define, for every state $q \in Q$ and letter $a \in \Sigma$, where $q' = \delta(q,a)$: \begin{itemize} \item $\delta'(q,a)= \{q',(q',0)\}$ and, \item for all $i = 0,\ldots,k$, $\delta'((q,i),a) = \{q'\}\times (I_{q'}\smallsetminus \{i\})$ if $q' \in G_i$ and \\ $\delta'((q,i),a) = \{q'\}\times I_{q'}$ if $q' \notin G_i$. \end{itemize} \item Finally, we set the set of final transitions to $F = \{(q,i),a,(q',j) \mid i\neq j \mbox{ or } i=j=0\}$. \end{itemize} \end{definition} Note that the projection on the state of $\mathcal S$ is not affected by this translation. The intuition for this translation is that the acceptance game starts in the original copy of the states---the nondeterministic states $Q$. From there, the acceptance player can \emph{declare} when he has reached an accepting end-component, moving from the original copy to the $0$-copy of the game. The rejection player can henceforth, whenever a state from the $i^{th}$ red set $R_i$ is seen, move from a $j$-copy to the $i$-copy, which can be viewed as a claim that the requirement on the $i^{th}$ Streett pair is not fulfilled (finitely many $R_i$ or infinitely many $G_i$ states). She therefore \emph{challenges} the acceptance player to visit a state from the $i^{th}$ green set $G_i$ (an $i$-challenge for short). When the game is in the $j$-copy, the game moves back to the $0$-copy when no new challenge is made and a state in $G_j$ is visited. Otherwise, the game stays in the $j$-copy. The acceptance player wins if the rejection player makes infinitely many challenges (the $i \neq j$ part of the final transitions) or if the game stays infinitely often in the $0$-copy (the $i=j=0$ part of the final states). The rejection player wins if the acceptance player never declares, or if she makes only finitely many challenges, and her last challenge is never met. To keep the definition simple, we have allowed the rejection player to always withdraw a challenge by moving back to the $0$ copy without reason. This is never an attractive move for her (so long as she has other options), and can therefore be omitted in an implementation. \begin{figure}[t] \centering \begin{tikzpicture}[ every text node part/.style={align=center}, every state/.style={fill=safecellcolor}] \node[state,initial] (q0) at (0,0) {$q_0$}; \node[state] (q1) at (2,0) {$q_1$}; \draw[->] (q0) edge[loop above] node[above] {$a$} (); \draw[->] (q0) edge[bend left=20] node[above] {$b$} (q1); \draw[->] (q1) edge[loop above] node[above] {$b$} (); \draw[->] (q1) edge[bend left=20] node[below] {$a$} (q0); \node at (5,0.25) {$G_1 = \{q_0\}, R_1 = \{q_1\}$\\[1mm]{}$G_2 = \{q_1\}, R_2 = \{q_0\}$}; \end{tikzpicture} \caption{Streett automaton on the alphabet $\Sigma = \{a,b\}$.} \label{fig:streett} \end{figure} \begin{figure}[t] \centering \begin{tikzpicture}[ every text node part/.style={align=center}, every state/.style={fill=safecellcolor}] \useasboundingbox (-5,-6.6) rectangle (7,6.6); \node[state,initial] (q0) at (0,0) {$q_0$}; \node[state] (q1) at (2,0) {$q_1$}; \node[state,rectangle] (q00) at (1, 5) {$(q_0,0)$}; \node[state,rectangle] (q10) at (1,-5) {$(q_1,0)$}; \node[state,rectangle] (q01) at (-2, 0) {$(q_0,2)$}; \node[state,rectangle] (q12) at (4, 0) {$(q_1,1)$}; \draw[->,every loop/.style={looseness=3}] (q0) edge[in=135,out=90,loop] node[above] {$a$} (); \draw[->] (q0) edge[bend left=10] node[above] {$b$} (q1); \draw[->] (q1) edge[bend left=10] node[below] {$a$} (q0); \draw[->,every loop/.style={looseness=3}] (q1) edge[in=45,out=90,loop] node[above] {$b$} (); \draw[->] (q0) -- node[left] {$a$} (q00); \draw[->] (q0) -- node[left] {$b$} (q10); \draw[->] (q1) -- node[right] {$a$} (q00); \draw[->] (q1) -- node[right] {$b$} (q10); \draw[->,double] (q00) -- node[left] {$a$} (q01); \draw[->] (q00) edge[loop above,double] node[above] {$a$} (); \draw[->,double] (q00) .. controls +(7,1) and +(7,-1) .. node[right] {$b$} (q10); \draw[->] (q00) edge[bend right=10,double] node[left] {$b$} (q12); \draw[->,double] (q10) edge[loop below,double] node[below] {$b$} (); \draw[->,double] (q10) .. controls +(-7,-1) and +(-7,1) .. node[left] {$a$} (q00); \draw[->] (q01) edge[loop left] node[left] {$a$} (); \draw[->] (q01) edge[bend left=10,double] node[right] {$b$} (q10); \draw[->] (q01) edge[bend left=41,double] node[above] {$b$} (q12); \draw[->] (q12) edge[bend left=41,double] node[below] {$a$} (q01); \draw[->] (q10) edge[bend left=10,double] node[left] {$a$} (q01); \draw[->,double] (q10) -- node[right] {$b$} (q12); \draw[->] (q12) edge[loop right] node[right] {$b$} (); \draw[->] (q12) edge[bend right=10,double] node[right] {$a$} (q00); \end{tikzpicture} \caption{Alternating GFM corresponding to the deterministic Streett automaton shown in Figure~\ref{fig:streett}. Here double edges depict accepting transitions. The states controlled by the acceptance player are shown as circles, while the states controlled by the rejection player are shown as boxes.} \label{fig:streett-to-gfm} \end{figure} \begin{example} Consider the deterministic Streett automaton sketched in Figure \ref{fig:streett}. The language of this automaton is $((a|b)^*ab)^\omega$ (seeing infinitely many $a$-s and infinitely many $b$-s): because of its acceptance condition, from $(G_1,R_1)$, we must infinitely often see $q_0$ or only finitely see $q_1$ and at the same time from $(G_2,R_2)$ we must infinitely often see $q_1$ or only finitely see $q_0$. It is easy to see that this condition is equivalent to requiring that we infinitely often see both $q_0$ and $q_1$. Therefore, we require to see infinitely many $a$-s and infinitely many $b$-s. In Figure~\ref{fig:streett-to-gfm}, we provide a translation to an alternating GFM B\"uchi automaton, where double arrows indicate accepting transitions. The resulting GFM automaton contains the original Streett automaton, i.e., $q_0$, $q_1$, and the transitions between them. They are the states referred to as ``the original copy,'' and the only nondeterministic states (states where the acceptance player chooses---depicted as circles). None of the transitions from the original copy are accepting. At some point, the acceptance player can make the decision to move to the final part of the automaton, consisting of states of the form $(q,i)$ (which is referred to as the acceptance player declaring). All of these states are universal: only the rejection player makes choices. Universal states are depicted as squares. In this part of the automaton, all transitions except the loops on $(q_0,2)$ and $(q_1,1)$ are accepting. Because of this, if the last character read is an $a$, the rejection player can move to $(q_0,2)$ and stay in the non-accepting loop until a $b$ is read. Similarly, if the last letter read is an $a$, the rejection player can move to $(q_0,2)$ and stay in the non-accepting loop until a $b$ is read. Likewise, when the last letter read is a $b$, the rejection player can move to $(q_1,1)$ and stay in the non-accepting loop until a $b$ is read. Thus, the alternating B\"uchi automaton recognises the same language as the original deterministic Streett automaton. As we have remarked in the construction, voluntary moves of the rejection player to the $0$-copy (intuitively: withdrawing her latest challenge) were allowed only to simplify the definition and can be omitted in an implementation. They are not included in the drawing to avoid clutter. \end{example} \section{Correctness of the Construction} \label{sec:correct} In order to prove that the alternating B\"uchi automaton is good-for-MDPs, we first show that using this automaton provides at least the same syntactic probability to win as using the deterministic Streett automaton $\mathcal S$. \begin{lemma} \label{lem:atMostSame} Let $\mathcal S$ be a deterministic Streett automaton and $\mathcal A$ the alternating automaton from above constructed from $\mathcal S$. Then, for every MDP $\mathcal M$, $\mathcal M \times \mathcal A$ has at least the same winning probability as $\mathcal M \times \mathcal S$. \end{lemma} \begin{proof} We first observe that the acceptance player (as the Streett player in a finite state Streett game) has an optimal pure finite state strategy $\sigma$ for $\mathcal M \times \mathcal S$. Let $(\mathcal M \times \mathcal S)_\sigma$ be the Markov chain obtained by using this optimal control. In $(\mathcal M \times \mathcal S)_\sigma$, we will almost surely reach a leaf component, and the chance of winning is the chance of reaching an accepting leaf component (i.e., a leaf component where the Streett condition is almost surely satisfied). For $\mathcal M \times \mathcal A$, we now define a pure finite state strategy $\tau$ for the acceptance player from $\sigma$ and $(\mathcal M \times \mathcal S)_\sigma$ as follows. Outside the accepting leaf components, we follow $\sigma$ and stay in the original copy. When entering an accepting leaf component, we move to the $0$-copy, but otherwise make the same decision as for $\sigma$. Henceforth, we make the same decision that $\sigma$ would make on the history obtained by ignoring in which $i$-copy we are. (Note that the decision on making an $i$-challenge, and hence on which $i$-copy should be visited, rests with the rejection player.) As this was an accepting leaf component in $(\mathcal M \times \mathcal S)_\sigma$, if there is, for any pair $\langle G_i,R_i \rangle$, a (red) state in $R_i$ in the leaf component, there is also a (green) state in $G_i$, and this state is almost surely visited infinitely often. Consequently, every challenge will, almost surely, eventually be met, and the acceptance player will win almost surely from these positions, regardless of how the rejection player plays. Thus, $\tau$ provides (at least) the same probability to win in $\mathcal M \times \mathcal A$ as $\sigma$ provides for $\mathcal M \times \mathcal S$. \qed \end{proof} Different to the case of nondeterministic good-for-MDP automata originally suggested in \cite{Hahn20}, we also have to show that the probability of winning for $\mathcal A$ cannot exceed that for $\mathcal S$. \begin{lemma} \label{lem:streett-at-least-same-prob} Let $\mathcal S$ be a deterministic Streett automaton and $\mathcal A$ the alternating automaton from above constructed from $\mathcal S$. Then, for every MDP $\mathcal M$, $\mathcal M \times \mathcal S$ has at least the same winning probability as $\mathcal M \times \mathcal A$. \end{lemma} Before starting the proof, we define useful terminology, and make the assumption, for simplicity, that a positional optimal strategy $\sigma$ for the acceptance player on $\mathcal M \times \mathcal A$ has been fixed. We call two states of $\mathcal M \times \mathcal A$ \emph{related}, if they refer to the same vertex of $\mathcal M$ and $\mathcal S$, but possibly to different copies of this state in $\mathcal A$. For such related states, it is obviously the case that the probability to win from the $0$-copy is at least as high as the probability to win from any other $i$-copy, as the acceptance player can just play as if he started in that $i$-copy until the time where the first challenge is made. (The only difference with respect to acceptance from the $i$-copy is then that paths where no challenge is made become winning, such that the probability to win can only go up.) We further observe that the probability to win from the original copy is always at least as high as the probability to win from the $0$-copy, as the acceptance player can always declare. We therefore coin the term ``good copy'' of a state: a copy of a state is \emph{good} if, and only if, the probability of winning from this copy is as high as the probability of winning from the original copy. A good copy is called \emph{reachable} if it is reachable in $(\mathcal M \times \mathcal A)_\sigma$. The \emph{oldest} reachable good copy of a state is the good copy $i$, for which the last visit to $G_i$ is longest ago, where the higher number is given preference as a tie breaker. In particular, the $0$-copy is only the oldest reachable copy, when it is the only reachable good copy different to the original copy. If no other reachable copy is good, the original copy is the oldest reachable good copy. Naturally, all $\sigma$-successors of a reachable good copy are reachable good copies. Note that the property of being the oldest reachable good copy is relative to the history; a latest appearance record (also known as index appearance record) \cite{Gurevi82,DBLP:conf/stoc/Safra92,DBLP:journals/siamcomp/Safra06,thomas03} is a standard memory structure of size $k!$ for keeping track of all information required for determining the oldest copy for a given history. Let $M_{\mathcal S}$ be such a memory structure. \begin{proof} Let $\sigma$ be an optimal positional strategy of the acceptance player in the B\"uchi game $\mathcal M \times \mathcal A$, and let $\mathcal S' = \mathcal S \times M_{\mathcal S}$ be $\mathcal S$ equipped with a latest appearance record with $>$ as a tie breaker. We use this to construct the positional strategy $\tau$ for $\mathcal M \times \mathcal S'$ as the strategy that makes the same choice $\sigma$ makes for the oldest reachable good copy of that state in the $\mathcal S$ projection of $\mathcal S'$. It now suffices to show that the rejecting leaf components of $(\mathcal M \times \mathcal S')_\tau$ refer to states of $\mathcal M \times \mathcal A$, whose good copies have a winning probability of $0$. We first assume that there is a reachable leaf component that contains a state, where the oldest reachable good copy is the original copy. Note that this implies that the original copy is the only reachable good copy of that state. Naturally, the successor of a reachable good copy under $\sigma$ is a reachable good copy, so every predecessor of the original copy, and by induction the complete leaf component, consists of states, where the original copy is the only good reachable copy. Thus, this leaf component in $(\mathcal M \times \mathcal S)_\tau$ projects into an end-component in $(\mathcal M \times \mathcal A)_\sigma$, where the rejection player has no decisions, and where no final transition occurs. The winning probability of all states in this end-component is $0$. We now assume that the rejecting leaf component contains only states with the same oldest reachable copy $i \geq 1$. Then the leaf component follows the positional strategy for the $i$-copy in $(\mathcal M \times \mathcal A)_\sigma$; note that this entails that it does not contain a state in $G_i$. Therefore the rejection player surely wins in the $i$-copy of this end-component in $(\mathcal M \times \mathcal A)_\sigma$ by never changing her challenge. Let us finally turn to the case where a leaf component in $(\mathcal M \times \mathcal S)_\tau$ contains only states, where all oldest reachable good copies are not the original copy, and that these copies are different, or all $0$. We assume for contradiction that the leaf component is rejecting. Then there must be an index $i$ such that there is a (red) state from $R_i$ in the leaf component, but not a (green) state from $G_i$. Moreover, there must be an $i^*$ with this property where, in the given history, the last occurrence of $G_{i^*}$ is longest ago, using $>$ as tie breaker. Further, let us consider a path through this leaf component that visits states from all (green) sets $G_{i'}$ represented in this leaf component. Let us now consider a (red) state in $R_{i^*}$ in the leaf component. If the $j$-copy is not the $i^*$ copy, then, as the rejection player can make an $i^*$ challenge, the $i^*$ copy (as a viable successor under the optimal strategy) must be a reachable good copy of the state, too, and therefore, by our assumption, the oldest reachable good state. Thus, we move on to the $i^*$ copy, and henceforth never leave it, contradicting the assumption that we are in a leaf component that contains different copies, or only the $0$-copy, as oldest reachable states. We have shown that we almost surely reach a leaf component, where the probability of winning all related states is $0$ in $\mathcal M {\times} \mathcal A$, or where the chance of winning is $1$. Together with the local consistency of the probabilities, we get the claim. \qed \end{proof} The two lemmas from this section imply that the syntactic and semantic probability to win are the same for all MDPs---in short, that $\mathcal A$ is good-for-MDPs. This in particular implies language equivalence on ultimately periodic words (which are a special case of Markov chains, where every state has only one successor), and therefore on all words, as two $\omega$-automata that accept the same ultimately periodic words recognise the same language. Moreover, we have provided a translation of an optimal strategy obtained for $\mathcal M \times \mathcal A$ into a strategy for $\mathcal M \times \mathcal S$ with (at least, and then with Lemma \ref{lem:atMostSame} precisely) the same optimal probability to win in the proof of Lemma \ref{lem:streett-at-least-same-prob}. \begin{corollary} \label{cor:correct} The alternating B\"uchi automaton $\mathcal A$ that results from the construction of Section \ref{ssec:construction} from a DSA $\mathcal S$ is a good-for-MDPs automaton that recognises the same language as $\mathcal S$. Moreover, we can infer an optimal control strategy for the acceptance player for $\mathcal M \times \mathcal S$ from an optimal strategy of the acceptance player in $\mathcal M \times \mathcal A$. \qed \end{corollary} \begin{figure}[t] \centering \begin{tikzpicture}[ every text node part/.style={align=center}, every state/.style={fill=safecellcolor}] \node[state,initial,inner sep=1pt] (q0) at (0,0) {$q_0,(1,2)$}; \node[state,inner sep=1pt] (q1) at (3.5,0) {$q_1,(2,1)$}; \draw[->] (q0) edge[loop above] node[above] {$a$} (); \draw[->] (q0) edge[bend left=20] node[above] {$b$} (q1); \draw[->] (q1) edge[loop above] node[above] {$b$} (); \draw[->] (q1) edge[bend left=20] node[below] {$a$} (q0); \node at (7,0.25) {$G_1 = \{q_0\}, R_1 = \{q_1\}$\\[1mm]{}$G_2 = \{q_1\}, R_2 = \{q_0\}$}; \end{tikzpicture} \caption{Streett automaton of Fig.~\ref{fig:streett} extended with latest appearance record as memory.} \label{fig:streett-memory} \end{figure} \paragraph{\bf Example.} In Figure~\ref{fig:streett-memory}, we have extended the Streett automaton of Figure~\ref{fig:streett} with latest appearance record memory~\cite{DBLP:conf/stoc/Safra92,DBLP:journals/siamcomp/Safra06,thomas03} as discussed in Lemma~\ref{lem:streett-at-least-same-prob}. The memory is added by extending the states with a vector of a permutation of the indices, such that the first entry corresponds to the index $i$ for which $G_i$ was most recently visited, the next one corresponds to the one before, etc., until the last ($k^{th}$) one, which corresponds to the oldest $G_i$ visited. Note that, although the number of states stays the same, there are $k!$ permutations, and they could all be reachable. This can lead---though not in this example---to a significant increase in the number of states needed to store the strategy explicitly. \bigskip We note that the memory we actually need is often smaller than the LAR we have mentioned, as the order can be mangled finitely often. That would, for example, allow us to only keep the order in some SCCs, namely those where we might get stuck in (with probability $\neq 0$)---and, of course, only for those indices that occur in states within these SCCs. Note that the definition relative to reachability under $\sigma$ is not required for correctness, but it provides the required connection to learning: when learning an optimal strategy in the game, the bit that is reachable under the optimal strategy we have learned is enough for constructing a pure finite state strategy. \subsection{Succinctness} Corollary \ref{sec:correct} shows that the alternating B\"uchi automaton $\mathcal A$ that results from the construction of Section \ref{ssec:construction} from a DSA $\mathcal S$ is a good-for-MDPs automaton that recognises the same language as $\mathcal S$, and the number of states of $\mathcal A$ is merely $O(kn)$, where $n$ and $k$ are the number of states and Streett pairs of $\mathcal S$. At the same time, the translation of a deterministic Streett automaton to a nondeterministic Rabin automaton (without a restriction to GFM) leads to a blow-up that results in $2^{\theta(n)}$ states \cite{SV89}, while a translation to an NBA requires $n2^{\theta(k)}$ states \cite{SV89}, even without the restriction to GFM. This immediately provides the following theorem. \begin{theorem} Alternating GFM B\"uchi automata can be exponentially more succinct than (general) nondeterministic B\"uchi and Rabin automata. \qed \end{theorem} \subsection{$\mathcal A$ is not Good-for-Games} \label{app:not4games} We have shown that the alternating B\"uchi automaton $\mathcal A$ we have constructed from a deterministic Streett automaton $\mathcal S$ in Section \ref{ssec:construction} is good-for-MDPs. To outline the difference, we now discuss why $\mathcal A$ is not, in general, good-for-games \cite{Henzin06} on the example of a deterministic Streett automaton $\mathcal S$ with two states, $a$ and $b$, and one Streett pair $\langle G_1,R_1 \rangle = \langle \emptyset,\{a\}\rangle$. The automaton is in state $a$ after reading an $a$, and in state $b$ otherwise. It recognises the language of all words that contain only finitely many $a$-s. A counter-example, which shows that the alternating B\"uchi automaton $\mathcal A$ that results from the construction in Section \ref{ssec:construction} is not good for games \cite{Henzin06}, must have choice for the rejection player, as it is otherwise representable as an MDP. Consider the one player game with two states, where the rejection player can choose in the initial state to play a $b$ and stay, or to play an $a$ and move on to the second state. From this second state, the only available action is to stay and play a $b$. In this one-player game, the rejection player can play only a single $a$. Therefore, whatever she does, the word she constructs is in the language of the automaton. She can, however, win the acceptance game played on the product of this two-state game and $\mathcal A$ by staying in the initial state until the acceptance player declares, and then moving on to the second state. Following this approach, she moves to the $1$-copy for $\mathcal A$, creating an obligation to see a state from $G_1$ (which is empty) when the acceptance player declares. She wins this game, irrespective of whether the acceptance player eventually declares (in which case the obligation she creates is never met), or never declares (as the original copy does not contain final states / transitions). The difference is that, as the rejection player can move in the game, the acceptance player cannot reach an end-component that he can almost surely cover. \section{Discussion} \label{sec:conclude} When $\omega$-regular objectives were first used in model checking MDPs, deterministic Rabin automata were used to represent the objectives. The same has been attempted by the reinforcement learning community: when they first turned to $\omega$-regular objectives, they tried the tested route through deterministic Rabin automata \cite{Sadigh14}, but that translation fails as shown in \cite{Hahn19}. Of course, with the current state of knowledge of good-for-MDPs automata, it is not hard to translate deterministic Rabin automata to nondeterministic B\"uchi automata that are good-for-MDPs, and then to analyse the product of such a B\"uchi automaton and the MDP in question. While MDPs with B\"uchi conditions are a (relatively) easy target for RL methods (like $Q$-learning \cite{Hahn19,Hahn20}), a similar translation of Streett automata (or for minimising the chance of meeting a Rabin objective) appears prohibitive. This is because \emph{every} translation from DSAs to nondeterministic B\"uchi (or even to Rabin) automata incurs an exponential blow-up in the worst case. Surprisingly, we found a way to allow even this accepting condition to be efficiently used in reinforcement learning by generalising the property of being good-for-MDPs to alternating automata, and by constructing an equivalent good-for-MDPs alternating B\"uchi automaton with linear overhead.
\section{Introduction}\label{introduction} Let $\Omega\subseteq\R^n$ be an open bounded set with smooth boundary, let $f\in L^2(\Omega)$ be a positive function and let $\beta,\, C_0$ be positive constants. We consider the following energy functional \begin{equation}\label{eq: fun 1}\mathcal{F}(A,v)=\int_A \abs{\nabla v}^2\,d\Ln +\beta\int_{\partial A } v^2\,d\Hn -2\int_\Omega fv\,d\Ln+C_0\Ln(A\setminus\Omega),\end{equation} and the variational problem \begin{equation \label{problema} \inf \Set{\mathcal{F}(A,v) | \begin{aligned} &A\supseteq \Omega \text{ open, bounded and Lipschitz} \\ &v\in W^{1,2}(A), \: v\ge 0\,\text{in } A \end{aligned}}. \end{equation} This problem is related to the following thermal insulation problem: for a given heat source $f$ distributed in a conductor $\Omega$, find the best possible configuration of insulating material surrounding $\Omega$. A similar problem has been studied in \cite{symbreak} and \cite{robinins} for a thin insulating layer, and in \cite{CK}, \cite{BucLuc12} and \cite{nahon} for a prescribed temperature in $\Omega$. For a fixed open set $A$ with Lipschitz boundary, we have, via the direct methods of the calculus of variations, that there exists $u_A\in W^{1,2}(A)$ such that \[\mathcal{F}(A,u_A)\leq \mathcal{F}(A,v),\] for all $v\in W^{1,2}(A)$, with $v\ge0$ in $A$. Furthermore $u_A$ solves the following stationary problem, with Robin boundary condition on $\partial A . Precisely \[\begin{cases}-\Delta u_A= f & \text{in }\Omega,\\[3 pt] \dfrac{\partial u_A^+}{\partial \nu\hphantom{\scriptstyle{+}}}=\dfrac{\partial u_A^-}{\partial \nu\hphantom{\scriptstyle{+}}} & \text{on }\partial\Omega, \\[6 pt] \Delta u_A=0 & \text{in } A\setminus\Omega, \\[3 pt] \dfrac{\partial u}{\partial \nu} +\beta u=0 & \text{on } \partial A, \end{cases}\] where $u_A^-$ and $u_A^+$ denote the traces of $u_A$ on $\partial\Omega$ in $\Omega$ and in $A\setminus\Omega$ respectively. That is \begin{equation}\label{eq: el}\int_A \nabla u_A\cdot \nabla\varphi\,d\Ln+\beta\int_{\partial A} u_A\varphi\,\Hn=\int_\Omega f\varphi\,d\Ln,\end{equation} for all $\varphi\in W^{1,2}(A)$. The Robin boundary condition represents the case when the heat transfer with the environment is conveyed by convection. If for any couple $(A,v)$ with $A$ an open bounded set with Lipschitz boundary containing $\Omega$ and $v\in W^{1,2}(A)$, $v\geq0$ in $A$, we identify $v$ with $v\chi_A$, where $\chi_A$ is the characteristic function of $A$, and the set $A$ with the support of $v$, then the energy functional~\eqref{eq: fun 1} becomes \begin{equation}\label{eq: fun 2}\mathcal{F}(v)=\int_{\R^n} \abs{\nabla v}^2\,d\Ln+\beta\int_{J_v}\left( \overline{v}^2+\underline{v}^2\right)\,d\Hn-2\int_\Omega fu\,d\Ln+C_0\Ln(\set{v>0}\setminus\Omega),\end{equation} and the minimization problem~\eqref{problema} becomes \begin{equation} \label{problemar} \inf \Set{\mathcal{F}(v) | v\in \sbv^{\frac{1}{2}}(\R^n)\cap W^{1,2}(\Omega) }, \end{equation} where $\overline{v}$ and $\underline{v}$ are respectively the approximate upper and lower limits of $v$, $J_v$ is the jump set and $\nabla v$ is the absolutely continuous part of the derivative of $v$. See \autoref{notations} for the definitions. We state the main results of this paper in the two following theorems. \begin{teor} \label{teor: mainth1} Let $n\ge 2$, let $\Omega\subset\R^n$ be an open bounded set with $C^{1,1}$ boundary, let $f\in L^2(\Omega)$, with $f>0$ almost everywhere in $\Omega$. Assume in addition that, if $n=2$, \begin{equation}\label{eq:cond n=2}\norma{f}_{2,\Omega}^2<C_0\lambda_\beta(B)\mathcal{L}^2(\Omega),\end{equation} where $B$ is a ball having the same measure of $\Omega$. Then problem~\eqref{problemar} admits a solution. Moreover, if $p>n$ and $f\in L^p(\Omega)$, then there exists a positive constant $C=C(\Omega,f,p,\beta,C_0)$ such that if $u$ is a minimizer to problem~\eqref{problemar} then \[ \norma{u}_\infty\le C. \] \end{teor} \begin{teor} \label{teor: mainth2} Let $n\ge 2$, let $\Omega\subset\R^n$ be an open bounded set with $C^{1,1}$ boundary, let $p>n$ and let $f\in L^p(\Omega)$, with $f>0$ almost everywhere in $\Omega$. Assume in addition that, if $n=2$ condition~\eqref{eq:cond n=2} holds true. Then there exist positive constants $\delta_0=\delta_0(\Omega,f,p,\beta,C_0)$, $c=c(\Omega,f,p,\beta,C_0)$, $C=C(\Omega,f,p,\beta,C_0)$ such that if $u$ is a minimizer to problem \eqref{problemar} then \[ u\ge\delta_0 \qquad \text{$\Ln$-a.e. in }\set{u>0}, \] and the jump set $J_u$ satisfies the density estimates \[cr^{n-1}\leq\Hn(J_u\cap B_r(x))\leq C r^{n-1},\] with $x\in\overline{J_u}$, and $0<r<d(x,\partial\Omega)$. In particular, we have \[ \Hn(\overline{J_u}\setminus J_u)=0. \] \end{teor} We refer to \autoref{notations} for the definitions of $\lambda_\beta(B)$ in \eqref{eq:cond n=2}, and the distance $d(x,\partial\Omega)$ in \autoref{teor: mainth2}. \autoref{existence} is devoted to the proof \autoref{teor: mainth1}, while \autoref{estimates} is devoted to the proof \autoref{teor: mainth2}. We notice that the assumptions on the function $f$ do not seem to be sharp. Indeed, it is well known that (see for instance \cite[Theorem 8.15]{trudinger}), in the more regular case, the assumption $f\in L^p(\Omega)$ with $p>n/2$ ensures the boundedness of solutions to equation~\eqref{eq: el} \section{Notation and tools}\label{notations} In this section we recall some definitions and proprieties of the space $\sbvv$. We refer to \cite{bv}, \cite{robin-bg}, \cite{evans} for a deep study of the properties of these functions. In the following, given $A\subseteq\R^n$ and $1\le p\le\infty$, we will denote the $L^p(A)$ norm of a function $v\in L^p(A)$ as $\norma{v}_{p,A}$, in particular when $A=\R^n$ we will simply write $\norma{v}_{p}=\norma{v}_{p,\R^n}$. \begin{defi}[$\bv$] Let $u\in L^1(\R^n)$. We say that $u$ is a function of \emph{bounded variation} in $\R^n$ and we write $u\in\bv(\R^n)$ if its distributional derivative is a Radon measure, namely \[ \int_{\Omega}u\,\frac{\partial\varphi}{\partial x_i}=\int_{\Omega}\varphi\, d D_i u\qquad \forall \varphi\in C^\infty_c(\R^n), \] with $Du$ a $\R^n$-valued measure in $\R^n$. We denote with $\abs{Du}$ the total variation of the measure $Du$. The space $\bv(\R^n)$ is a Banach space equipped with the norm \[ \norma{u}_{\bv(\R^n)}=\norma{u}_{1}+\abs{Du}(\R^n). \] \end{defi} \begin{defi} Let $E\subseteq\R^n$ be a measurable set. We define the \emph{set of points of density 1 for $E$} as \[ E^{(1)}=\Set{x\in\R^n | \lim_{r\to0^+}\dfrac{\Ln(B_r(x)\cap E)}{\Ln(B_r(x))}=1}, \] and the \emph{set of points of density 0 for $E$} as \[ E^{(0)}=\Set{x\in\R^n | \lim_{r\to0^+}\dfrac{\Ln(B_r(x)\cap E)}{\Ln(B_r(x))}=0}. \] Moreover, we define the \emph{essential boundary} of $E$ as \[ \partial^*E=\R^n \setminus(E^{(0)}\cup E^{(1)}). \] \end{defi} \begin{defi}[Approximate upper and lower limits] Let $u\colon\R^n\to\R$ be a measurable function. We define the \emph{approximate upper and lower limits} of $u$, respectively, as \[\overline{u}(x)=\inf\Set{t\in\R|\limsup_{r\to0^+}\dfrac{\Ln(B_r(x)\cap\set{u>t})}{\Ln(B_r(x))}=0},\] and \[\underline{u}(x)=\sup\Set{t\in\R|\limsup_{r\to0^+}\dfrac{\Ln(B_r(x)\cap\set{u<t})}{\Ln(B_r(x))}=0}.\] We define the \emph{jump set} of $u$ as \[J_u=\Set{x\in\R^n|\underline{u}(x)<\overline{u}(x)}.\] We denote by $K_u$ the closure of $J_u$. \end{defi} If $\overline{u}(x)=\underline{u}(x)=l$, we say that $l$ is the approximate limit of $u$ as $y$ tends to $x$, and we have that, for any $\eps>0$, \[\limsup_{r\to0^+}\dfrac{\Ln(B_r(x)\cap\set{\abs{u-l}\geq\eps)}}{\Ln(B_r(x))}=0.\] If $u\in\bv(\R^n)$, the jump set $J_u$ is a $(n-1)$-rectifiable set, i.e. ${J_u\subseteq\bigcup_{i\in\mathbb{N}}M_i}$, up to a $\Hn$-negligible set, with $M_i$ a $C^1$-hypersurface in $\R^n$ for every $i$. We can then define $\Hn$-almost everywhere on $J_u$ a normal $\nu_u$ coinciding with the normal to the hypersurfaces $M_i$. Futhermore, the direction of $\nu_u(x)$ is chosen in such a way that the approximate upper and lower limits of $u$ coincide with the approximate limit of $u$ on the half-planes \[H^+_{\nu_u}=\set{y\in\R^n|\nu_u(x)\cdot(y-x)\geq0}\] and \[H^-_{\nu_u}=\set{y\in\R^n|\nu_u(x)\cdot(y-x)\leq0}\] respectively. \begin{defi} Let $E,\Omega\subseteq\R^n$ be measurable sets. We define the \emph{relative perimeter} of $E$ inside $\Omega$ as \[ P(E;\Omega)=\inf\Set{\int_E \divv\varphi\,d\Ln | \begin{aligned} \varphi\in &\:C^1_c(\Omega,\R^n) \\ &\abs{\varphi}\le 1 \end{aligned}}. \] If $P(E;\R^n)<+\infty$ we say that $E$ is a \emph{set of finite perimeter}. \end{defi} \begin{teor}[Relative Isoperimetric Inequality] \label{teor: relisop} Let $\Omega$ be an open, bounded, connected set with Lipschitz boundary. Then there exists a positive constants $C=C(\Omega)$ such that \[ \min\Set{\Ln(\Omega\cap E),\Ln(\Omega\setminus E)}^\frac{n-1}{n}\le C P(E;\Omega), \] for every set $E$ of finite perimeter. \end{teor} See for instance \cite{mazya} for the proof of this theorem. \begin{teor} \label{teor: isopint} Let $\Omega$ be an open, bounded, connected set with Lipschitz boundary. Then there exists a constant $C=C(\Omega)>0$ such that \[ \Hn (\partial^*E\cap \partial\Omega )\le C \Hn(\partial^* E\cap \Omega) \] for every set of finite perimeter $E\subset\Omega$ with $0<\Ln(E)\le \Ln(\Omega)/2$. \end{teor} We refer to \cite[Theorem 2.3]{cianchi2016poincare} for the proof of this theorem, observing that if $\Omega$ is a Lipschitz set, then it is an admissible set in the sense defined in \cite{cianchi2016poincare}(see \cite[Remark 5.10.2]{ziemer}). \begin{teor}[Decomposition of $\bv$ functions] Let $u\in\bv(\R^n)$. Then we have \[ dDu=\nabla u\,d\Ln+\abs{\overline{u}-\underline{u}}\nu_u\,d\Hn\lfloor_{{\Huge J_u}}+ dD^c u, \] where $\nabla u$ is the density of $Du$ with respect to the Lebesgue measure, $\nu_u$ is the normal to the jump set $J_u$ and $D^c u$ is the \emph{Cantor part} of the measure $Du$. The measure $D^c u$ is singular with respect to the Lebesgue measure and concentrated out of $J_u$. \end{teor} \begin{defi} Let $v\in\bv(\R^n)$, let $\Gamma\subseteq\R^n$ be a $\Hn$-rectificable set and let $\nu(x)$ be the generalized normal to $\Gamma$ defined for $\Hn$-a.e. $x\in\Gamma$. For $\Hn$-a.e. $x\in \Gamma$ we define the traces $\gamma_\Gamma^{\pm}(v)(x)$ of $v$ on $\Gamma$ by the following Lebesgue-type limit quotient relation \[ \lim_{r\to 0}\frac{1}{r^n}\int_{B_r^{\pm}(x)}\abs{v(y)-\gamma_\Gamma^{\pm}(v)(x)}\,d\Ln(y)=0, \] where \[ B_{r}^{+}(x)=\set{y\in B_r(x) | \nu(x)\cdot(y-x)>0}, \] \[ B_{r}^{-}(x)=\set{y\in B_r(x) | \nu(x)\cdot(y-x)<0}. \]\end{defi} \begin{oss} Notice that, by~\cite[Remark 3.79]{bv}, for $\Hn$-a.e. $x\in\Gamma$, $(\gamma_\Gamma^{+}(v)(x),\gamma_\Gamma^-(v)(x))$ coincides with either $(\overline{v}(x),\underline{v}(x))$ or $(\underline{v}(x),\overline{v}(x))$, while, for $\Hn$-a.e. $x\in \Gamma\setminus J_v$, we have that $\gamma_\Gamma^+(v)(x)=\gamma_\Gamma^-(v)(x)$ and they coincide with the approximate limit of $v$ in $x$. In particular, if $\Gamma=J_v$, we have \[ \gamma_{J_v}^+(v)(x)=\overline{v}(x) \qquad \gamma_{J_v}^-(v)(x)=\underline{v}(x) \] for $\Hn$-a.e. $x\in J_v$. \end{oss} We now focus our attention on the $\bv$ functions whose Cantor parts vanish. \begin{defi}[$\sbv$] Let $u\in\bv(\R^n)$. We say that $u$ is a \emph{special function of bounded variation} and we write $u\in\sbv(\R^n)$ if $D^c u=0$. \end{defi} For $\sbv$ functions we have the following. \begin{teor}[Chain rule]\label{teor: chain} Let $g\colon\R\to\R$ be a differentiable function. Then if $u\in\sbv(\R^n)$, we have \[\nabla g(u)=g'(u)\nabla u.\] Furthermore, if $g$ is increasing, \[\overline{g(u)}=g(\overline{u}),\quad \underline{g(u)}=g(\underline{u})\] while, if $g$ is decreasing, \[\overline{g(u)}=g(\underline{u}),\quad \underline{g(u)}=g(\overline{u}).\] \end{teor} We now give the definition of the following class of functions. \begin{defi}[$\sbv^{1/2}$] Let $u\in L^2(\R^n)$ be a non-negative function. We say that $u\in\sbvv$ if $u^2\in \sbv(\R^n)$. In addition, we define \begin{gather*} J_u:=J_{u^2} \qquad\quad \overline{u}:=\sqrt{\,\overline{u^2}\,}\qquad\quad \underline{u}:=\sqrt{\,\underline{u^2}\,} \\[5 pt] \nabla u:=\frac{1}{2u}\nabla(u^2)\chi_{\set{u>0}} \end{gather*} \end{defi} Notice that this definition extends the validity of the Chain Rule to the functions in $\sbvv$. We refer to \cite[Lemma 3.2]{robin-bg} for the coherence of this definition. \begin{teor}[Compactness in $\sbv^{1/2}$] \label{teor: sbv} Let $u_k$ be a sequence in $\sbvv$ and let $C>0$ be such that for every $k\in \N$ \[ \int_{\R^n}\abs{\nabla u_k}^2\, d\Ln+\int_{J_{u_{k}}}\left(\overline u_k^2+\underline u_{k}^2\right)\,d\Hn +\int_{\R^n}u_k^2\, d\Ln < C \] Then there exists $u\in\sbvv$ and a subsequence $u_{k_j}$ such that \begin{itemize} \item \emph{Compactness:} \[ u_{k_j}\xrightarrow{L^2_{\loc}(\R^n)} u \] \item \emph{Lower semicontinuity:} for every open set $A$ we have \[ \int_A \abs{\nabla u}^2\, d\Ln \le \liminf_{j\to+\infty}\int_A \abs{\nabla u_{k_j}}^2\,d\Ln \] and \[ \int_{J_u\cap A}\left( \overline u^2+\underline u^2\right)\, d\Hn \le \liminf_{j\to+\infty}\int_{J_{u_{k_j}}\cap A}\left( \overline u_{k_j}^2+\underline u_{k_j}^2\right)\, d\Hn \] \end{itemize} \end{teor} \begin{defi}[Robin Eigenvalue] \label{def: robineigen} Let $A\subseteq\R^n$ be an open bounded set with Lipschitz boundary, let $\beta>0$. We define $\lambda_{\beta}(A)$ as \begin{equation}\label{eq:Robin 2,q}\lambda_{\beta}(A)=\inf\Set{ \dfrac{\displaystyle\int_A \abs{\nabla v}^2\,d\Ln+\beta\int_{\partial A} v^2\,d\Hn}{\displaystyle\int_A v^2\,d\Ln}| v\in W^{1,2}(A)\setminus\set{0}}.\end{equation} \end{defi} \begin{oss} Standard tools of calculus of variation ensures that the infimum in~\eqref{eq:Robin 2,q} is achieved, see for instance. \end{oss} \begin{lemma} \label{lemma: stimaautovalori} For every $0<r<R$, the following inequality holds \[ \lambda_{\beta}(B_r)\le \left(\dfrac{ \Ln(B_R)}{\Ln(B_r)}\right)^{\frac{2}{n}}\lambda_{\beta}(B_R), \] where $B_R$ and $B_r$ are balls with radii $R$ and $r$ respectively. \begin{proof} Let $\varphi$ be a minimum of~\eqref{eq:Robin 2,q} for $A=B_R$ and with $\norma{\varphi}_{2,B_R}=1$. We define \[ w(x)=\varphi\left(\frac{R}{r}x\right) \qquad \forall x\in B_r. \] Therefore, \[ \begin{split} \lambda_{\beta}(B_r &\le \dfrac{\displaystyle \int_{B_r}\abs{\nabla w(x)}^2\,d\Ln(x) + \int_{\partial B_r}w(x)^2\, d\Hn(x)}{\displaystyle \int_{B_r}w(x)^2\, d\Ln(x)}\\[7 pt &= \dfrac{\displaystyle \left(\frac{r}{R}\right)^{n-2}\int_{B_R}\abs{\nabla \varphi(y)}^2\,d\Ln(y) + \left(\frac{r}{R}\right)^{n-1}\int_{\partial B_R}\varphi(y)^2\, d\Hn(y)}{\left(\dfrac{r}{R}\right)^{n}}. \end{split} \] Since $r/R<1$, by minimality of $\varphi$, we get \[ \lambda_{\beta}(B_r)\le \dfrac{\displaystyle\left(\frac{r}{R}\right)^{n-2}}{\displaystyle\left(\dfrac{r}{R}\right)^{{n}\hphantom{\!2}}}\lambda_{\beta}(B_R)=\left(\dfrac{\Ln(B_r)}{\Ln(B_R)}\right)^{-\frac{2}{n}}\lambda_{\beta}(B_R). \] \end{proof} \end{lemma} Let $\beta,m>0$, and let us denote by \[ \Lambda_{\beta,m}=\inf\Set{\dfrac{\displaystyle \int_{\R^n}\!\abs{\nabla v}^2\, d\Ln+\beta \int_{J_v}\!\!\left(\underline{v}^2+\overline{v}^2\right)\,d\Hn}{\displaystyle \int_{\R^n}v^2\, d\Ln} | \begin{aligned} &v\in\sbvv\setminus{\{0\}} \\ &\Ln\left(\set{v>0}\right)\le m \end{aligned}}. \] Here we state a theorem, referring to \cite[Theorem 5]{robin-bg} for the proof. \begin{teor \label{teor: faberkrahn} Let $B\subseteq\R^n$ be a ball of volume $m$. Then \[ \Lambda_{\beta,m}= \lambda_{\beta}(B). \] \end{teor} We will denote by $d(x,\partial\Omega)$ the distance between $x\in\R^n$ and the boundary $\partial\Omega$, and for every $\eps>0$ we define \[ \Omega_\eps=\Set{x\in\Omega | d(x,\partial\Omega)>\varepsilon}. \] We will use the following result. \begin{prop} \label{teor: volumedistanza} Let $\Omega$ be an open bounded set with $C^{1,1}$ boundary, then there exist a constant $C=C(\Omega)>0$ and a $\eps_0=\eps_0(\Omega)>0$ such that \[ \Ln(\Omega\setminus\Omega_\eps)\le C\varepsilon \qquad \qquad \forall \eps<\eps_0. \] \end{prop} \begin{proof} It is well known (see for instance \cite[Theorem 17.5]{maggi}) that there exist a constant $C=C(\Omega)$ and $\eps_0=\eps_0(\Omega)>0$ such that \[P(\Omega_\eps)= P(\Omega)+C(\Omega)\,\eps+O(\eps^2),\] for every $0<\eps<\eps_0$. Let $r(x)=d(x,\partial\Omega)$ be the distance from the boundary of $\Omega$. By coarea formula we have \[\Ln(\Omega\setminus\Omega_\eps)=\int_{\set{0<r<\eps}} \,d\Ln=\int_0^\eps P(\Omega_t)\,dt\le C(\Omega)\eps.\] \end{proof} \section{Existence of minimizers}\label{existence} In this section we prove \autoref{teor: mainth1}: in \autoref{teor: existence} we prove the existence of a minimizer to problem \eqref{problemar}; in \autoref{teor: linftybound} we prove the $L^\infty$ estimate for a minimizer. In this section we will assume that $\Omega\subseteq\R^n$ is an open bounded set with $C^{1,1}$ boundary, that $f\in L^2(\Omega)$ is a positive function and that $\beta, C_0$ are positive constants. We consider the energy functional $\mathcal{F}$ defined in \eqref{eq: fun 2} \begin{lemma} \label{lemma: stimel2} Let $n\ge2$ and assume that, if $n=2$, condition \eqref{eq:cond n=2} holds true. Then there exist two positive constants $c=c(\Omega,f,\beta,C_0)$ and $C=C(\Omega,f,\beta,C_0)$ such that if $v\in\sbv^{\frac{1}{2}}(\R^n)\cap W^{1,2}(\Omega)$, with $\mathcal{F}(v)\le 0$ and $\Omega\subseteq\set{v>0}$, then \begin{equation}\label{eq:stimasupporto} \Ln(\Set{v>0})\le c,\end{equation} \begin{equation}\label{eq:stimanormal2} \norma{v}_2\le C. \end{equation} \end{lemma} \begin{proof} Let $B'$ be a ball with the same measure as $\Set{v>0}$. By \autoref{teor: faberkrahn} \[ \begin{split} 0\ge\mathcal{F}(v)&\ge\,\lambda_\beta\left(B'\right)\int_{\R^n}v^2\,d\Ln-2\int_{\Omega}fv\, d\Ln\\ &\hphantom{\ge}+C_0\Ln\left(\set{v>0}\setminus\Omega\right). \end{split} \] By \autoref{lemma: stimaautovalori} and Hölder inequality \begin{equation} \label{eq: quadratic} \begin{split} 0\ge& \lambda_\beta(B)\left(\frac{\Ln(\Omega)}{\Ln(\Set{v>0})}\right)^{\frac{2}{n}}\norma{v}_2^2 -2\norma{f}_{2,\Omega}\norma{v}_2\\[3 pt] &+C_0\Ln\left(\set{v>0}\setminus\Omega\right) \end{split} \end{equation} where $B$ is a ball with the same measure as $\Omega$. Obviously~\eqref{eq: quadratic} implies that \[ \norma{f}_{2,\Omega}^2-\lambda_\beta(B)\left(\frac{\Ln(\Omega)}{\Ln(\Set{v>0})}\right)^{\frac{2}{n}}C_0\Ln\left(\set{v>0}\setminus\Omega\right)\ge 0. \] Let $M=\Ln(\set{v>0})$, and notice that, since $\Omega\subseteq\set{v>0}$, \[ \Ln\left(\set{v>0}\setminus\Omega\right)= M-\Ln(\Omega), \] therefore \[ \norma{f}_{2,\Omega}^2\ge C_0 \lambda_\beta(B)\left(\Ln(\Omega)\right)^{\frac{2}{n}}\left(M^{1-\frac{2}{n}}-M^{-\frac{2}{n}}\Ln(\Omega)\right). \] This implies (taking into account~\eqref{eq:cond n=2} if $n=2$) that there exists $c=c(\Omega,f,\beta,C_0)>0$ such that \[ \Ln(\set{v>0})<c. \] Finally observe that by~\eqref{eq: quadratic} it follows \begin{equation} \label{eq: norma2} \norma{v}_2\le C(M), \end{equation} where \[\begin{split}C(M)&=\frac{M^{\frac{2}{n}}\left(\norma{f}_{2,\Omega}+\sqrt{\norma{f}_{2,\Omega}^2- C_0 \lambda_\beta(B)\left(\dfrac{\Ln(\Omega)}{M}\right)^{\frac{2}{n}}\left(M-\Ln(\Omega)\right)}\right)}{\vphantom{\big(}\lambda_\beta(B)\Ln(\Omega)}\\[5 pt] &\le \frac{2 c^\frac{2}{n} \norma{f}_{2,\Omega}}{\lambda_\beta(B)\Ln(\Omega)}\end{split}\] \end{proof} \begin{oss} \label{oss: ominsupp} Let $v\in\sbvv\cap W^{1,2}(\Omega)$, it is always possible to choose a function $v_0$ such that $v_0=v$ in $\R^n\setminus\Omega$, $\mathcal{F}(v_0)\leq\mathcal{F}(v)$, and $\Omega\subseteq\set{v_0>0}$. Indeed the function $v_0\in W^{1,2}(\Omega)$, weak solution to the following boundary value problem \begin{equation}\label{eq: remark dir}\begin{cases} -\Delta v_0= f &\text{in }\Omega,\\ v_0 = v &\text{on }\partial\Omega,\end{cases} \end{equation} satisfies \[\int_\Omega\nabla v_0\cdot\nabla \varphi\,d\Ln=\int_\Omega f\varphi\,d\Ln\] for every $\varphi\in W^{1,2}_0(\Omega)$ and $v_0=v$ on $\partial\Omega$ in the sense of the trace. Then, extending $v_0$ to be equal to $v$ outside of $\Omega$, we have that $\Omega\subset\Set{v_0>0}$ and $\mathcal{F}(v_0)\leq\mathcal{F}(v)$ \end{oss} \begin{prop}[Existence] \label{teor: existence} Let $n\ge2$ and, if $n=2$, assume that condition~\eqref{eq:cond n=2} holds true. Then there exists a solution to problem~\eqref{problemar}. \end{prop} \begin{proof} Let $\{u_k\}$ be a minimizing sequence for problem~\eqref{problemar}. Without loss of generality we may always assume that, for all $k\in\N$, $\mathcal{F}(u_k)\leq\mathcal{F}(0)=0$, and, by \autoref{oss: ominsupp}, $\Omega\subseteq\set{u_k>0}$. Therefore we have \[\begin{split}0\geq\mathcal{F}(u_k)&\geq \int_{\R^n} \abs{\nabla u_k}^2\,d\Ln+\beta\int_{J_{u_k}}\left( \overline{u_k}^2+\underline{u_k}^2\right)\,d\Hn-2\int_\Omega fv\,d\Ln\\ &\geq\int_{\R^n} \abs{\nabla u_k}^2\,d\Ln+\beta\int_{J_{u_k}}\left( \overline{u_k}^2+\underline{u_k}^2\right)\,d\Hn-2\norma{f}_{2,\Omega}\norma{u_k}_{2,\Omega}\,, \end{split}\] and by~\eqref{eq:stimanormal2} \begin{equation*} \int_{\R^n} \abs{\nabla u_k}^2\,d\Ln+\beta\int_{J_{u_k}}\left( \overline{u_k}^2+\underline{u_k}^2\right)\,d\Hn\leq C\norma{f}_{2,\Omega}\,.\end{equation*} Then we have that there exists a positive constant still denoted by $C$, independent on the sequence $\{u_k\}$, such that \begin{equation}\label{eq: variazione u} \int_{\R^n}\abs{\nabla u_k}^2\, d\Ln+\int_{J_{u_{k}}}\left(\overline u_k^2+\underline u_k^2\right)\,d\Hn +\int_{\R^n}u_k^2\, d\Ln < C. \end{equation} The compactness theorem in $\sbvv$ (\autoref{teor: sbv}), ensures that there exists a subsequence $\{u_{k_j}\}$ and a function $u\in\sbvv\cap W^{1,2}(\Omega)$, such that $u_{k_j}$ converges to $u$ strongly in $L^2_{\loc} (\R^n)$, weakly in $W^{1,2}(\Omega)$, almost everywhere in $\R^n$ and \[\begin{split} \int_{\R^n}\abs{\nabla u}^2\, d\Ln \le& \liminf_{j\to+\infty}\int_{\R^n} \abs{\nabla u_{k_j}}^2\,d\Ln,\\[5 pt] \int_{J_u}\left( \overline u^2+\underline u^2\right)\, d\Hn \le& \liminf_{j\to+\infty}\int_{J_{u_{k_j}}} \left(\overline u_{k_j}^2+\underline u_{k_j}^2\right)\, d\Hn,\\[5 pt] \Ln(\set{u>0}\setminus\Omega)\le&\liminf_{j\to+\infty}\Ln(\set{u_{k_j}>0}\setminus\Omega).\end{split}\] Finally we have \[\mathcal{F}(u)\leq\liminf_{j\to+\infty}\mathcal{F}(u_{k_j})=\inf\Set{\mathcal{F}(v)|v\in\sbvv\cap W^{1,2}(\Omega)},\] Therefore $u$ is a minimizer to problem~\eqref{problemar}.\qedhere \end{proof} \begin{teor}[Euler-Lagrange equation] \label{teor: euler-lagrange} Let $u$ be a minimizer to problem \eqref{problemar}, and let $v\in \sbv^{1/2}(\R^n)$ such that $J_v\subseteq J_u$. Assume that there exists $t>0$ such that $\set{v>0}\subseteq \set{u>t}$ $\Ln$-a.e., and that \[ \int_{J_u\setminus J_v}v^2\, d\Hn<+\infty. \] Then \begin{equation} \label{eq: wel} \int_{\R^n}\nabla u\cdot\nabla v\, d\Ln+\beta\int_{J_u}\left(\overline{u}\gamma^+(v)+\underline{u}\gamma^-(v)\right)\, d\Hn=\int_\Omega fv\,d\Ln, \end{equation} where $\gamma^{\pm}=\gamma_{J_u}^\pm$. \end{teor} \begin{proof} Notice that since $v\in\sbvv$ with $J_v\subseteq J_u$ we have that $v\in\sbvv\cap W^{1,2}(\Omega)$. Assume $v\in \sbv^{1/2}(\R^n)\cap L^\infty(\R^n)$. If $s\in\R$, recalling that $\set{v>0}\subseteq \set{u>t}$ $\Ln$-a.e., \[ u(x)+sv(x)=u(x)\ge 0 \qquad \text{$\Ln$-a.e.}\:\forall x\in \set{u\le t}, \] while, for $\abs{s}$ small enough, \[ u(x)+s v(x)\ge t-\abs{s}\,\norma{v}_\infty>0 \qquad \forall x\in\set{u>t}. \] Therefore we still have \[ u+sv\in\sbv^{\frac{1}{2}}(\R^n,\R^+). \] Moreover by minimality of $u$ we have, for every $\abs{s}\le s_0$ \[\begin{split} \mathcal{F}(u)\le&\mathcal{F}(u+sv)\\[3 pt] =&\int_{\R^n}\abs{\nabla u+s\nabla v}^2\,d\Ln+\\[3 pt] &+\int_{J_{u+sv}}\left[\left(\gamma^+(u)+s\gamma^+(v)\right)^2+\left(\gamma^-(u)+s\gamma^-(v)\right)^2\right]\,d\Hn+ \\[3 pt] &-2\int_{\R^n}f(u+sv)\,d\Ln+C_0\Ln(\set{u>0}). \end{split} \] \marcomm{\textbf{Claim:}}The set \[S:=\Set{s\in[-s_0,s_0] | \, \Hn(J_{u}\setminus J_{u+sv})\ne 0}\] is at most countable. \vspace{5 pt} \noindent Let us define \begin{gather*} D_0=\Set{x\in J_u | \gamma^+(u)(x)\ne \gamma^-(u)(x)},\\[5 pt] D_s=\Set{x\in J_u | \gamma^+(u+sv)(x)\ne\gamma^-(u+sv)(x)}, \end{gather*} and notice that \[ \Hn(J_u\setminus D_0)=0, \qquad \Hn(J_{u+sv}\setminus D_s)=0. \] Then we have to prove that \[\Set{s\in[-s_0,s_0] | \, \Hn(D_0\setminus D_s)\ne 0}\] is at most countable. Observe that if $t\ne s$, \[ (D\setminus D_t)\cap(D\setminus D_s)=\emptyset. \] Indeed if $x\in D\setminus D_s$ \begin{gather*} \gamma^+(u)(x)\ne \gamma^-(u)(x),\\[5 pt] \gamma^+(u)+s\gamma^+(v)(x)=\gamma^-(u)+s\gamma^-(v)(x), \end{gather*} then \[ \gamma^+(v)(x)\ne \gamma^-(v)(x), \] and so \[ s=\frac{\gamma^-(u)(x)- \gamma^+(u)(x)}{\gamma^+(v)(x)- \gamma^-(v)(x)}. \] If $\mathcal{H}^0$ denotes the counting measure in $\R$, we can write \[ \int_{-s_0}^{s_0}\Hn(D_0\setminus D_s)\,d\mathcal{H}^0= \Hn\Bigg(\bigcup_{\scalebox{0.6}{$(-s_0,s_0)$}}\!D_0\setminus D_s\Bigg)\le\Hn(J_u)<+\infty, \] then the claim is proved. We are now able to differentiate in $s=0$ the function $\mathcal{F}(u+sv)$, and observing that $0\notin S$ is a minimum for $\mathcal{F}(u+sv)$, we get \[ \frac{1}{2}\delta\mathcal{F}(u,v)=\int_{\R^n}\nabla u\cdot\nabla v\, d\Ln+\beta\int_{J_u}\left[\overline{u}\gamma^+(v)+\underline{u}\gamma^-(v)\right]\, d\Hn-\int_\Omega fv\,d\Ln=0. \] If $v\notin L^\infty(\R^n)$, we consider $v_h=\min\set{v,h}$. Then \[ \delta\mathcal{F}(u,v_h)=0 \qquad \forall h>0. \] Observe that, since $\gamma^\pm(v_h)=\min\set{\gamma^\pm(v),h}$, \[ \gamma^\pm(v_h)\to\gamma^\pm(v) \qquad \Hn\text{-a.e. in }J_u. \] Therefore, passing to limit for $h\to+\infty$, by dominated convergence on the term \[ \int_{\R^n}\nabla u\cdot\nabla v_h\, d\Ln, \] and by monotone convergence on the terms \[ \beta\int_{J_u}\left[\overline{u}\gamma^+(v_h)+\underline{u}\gamma^-(v_h)\right]\, d\Hn, \qquad\int_\Omega fv_h\,d\Ln, \] we get \[ 0=\lim_h\delta \mathcal{F}(u,v_h)=\delta\mathcal{F}(u,v). \] \end{proof} We now want to use the Euler-Lagrange equation~\eqref{eq: wel} to prove that if $f$ belongs to $L^p(\Omega)$ with $p>n$, and if $u$ is a minimizer to problem~\eqref{problemar} then $u$ belongs to $L^{\infty}(\R^n)$. In order to prove this we need the following \begin{lemma} \label{lemma: poincare} Let $m$ be a positive real number. There exists a positive constant $C=C(m,\beta,n)$ such that, for every function $v\in\sbvv$ with $\Ln(\set{v>0})\leq m$, \[\left(\int_{\R^n} v^{2\cdot1^*}\,d\Ln\right)^\frac{1}{1^*}\leq C\left[\int_{\R^n} \abs{\nabla v}^2\,d\Ln+\beta\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right],\] where $1^*=\dfrac{n}{n-1}$ is the Sobolev conjugate of $1$. \end{lemma} \begin{proof} Classical Embedding of $BV(\R^n)$ in $L^{1^*}(\R^n)$ ensures that \[\begin{split}\left(\int_{\R^n} v^{2\cdot1^*}\,d\Ln\right)^\frac{1}{1^*}\leq& C(n) \abs*{D v^2}(\R^n)\\[5 pt] =&C(n)\left[\int_{\R^n}2v\abs{\nabla v}\,d\Ln+\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right].\end{split}\] For every $\eps>0$, using Young's and Hölder's inequalities, we have \[\begin{split}\left(\int_{\R^n} v^{2\cdot1^*}\,d\Ln\right)^\frac{1}{1^*}\leq& \frac{C(n)}{\eps}\int_{\R^n}v^2\,d\Ln+\\[3 pt] &+C(n)\left[\eps\int_{\R^n}\abs{\nabla v}^2\,d\Ln+\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right]\\[5 pt] \leq& \frac{C(n)\,m^{\frac{1}{n}}}{\eps}\left(\int_{\R^n} v^{2\cdot1^*}\,d\Ln\right)^\frac{1}{1^*}+\\[3 pt] &+C(n)\left[\eps\int_{\R^n}\abs{\nabla v}^2\,d\Ln+\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right]. \end{split}\] Setting $\eps=2C(n)m^{\frac{1}{n}}$, we can find two constants $C(m,n),C(m,\beta,n)>0$ such that \[\begin{split}\left(\int_{\R^n} v^{2\cdot1^*}\,d\Ln\right)^\frac{1}{1^*}&\leq C(m,n)\left[\int_{\R^n} \abs{\nabla v}^2\,d\Ln+\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right]\\[5 pt] &\leq C(m,\beta,n)\left[\int_{\R^n} \abs{\nabla v}^2\,d\Ln+\beta\int_{J_v}\left(\overline{v}^2+\underline{v}^2\right)\,d\Hn\right].\end{split}\] \end{proof} We refer to \cite{stampacchia} for the following lemma. \begin{lemma}\label{lemma: stampacchia} Let $g: [0,+\infty) \to [0,+\infty)$ be a decreasing function and assume that there exist $C,\alpha >0$ and $\theta>1$ constants such that for every $h>k\ge 0$, \[ g(h)\le C(h-k)^{-\alpha}g(k)^\theta . \] Then there exists a constant $h_0>0$ such that \[ g(h)=0 \qquad \forall h\ge h_0. \] In particular we have \[ h_0=C^{\frac{1}{\alpha}}g(0)^{\frac{\theta -1}{\alpha}}2^{\theta(\theta-1)}. \] \end{lemma} \begin{prop}[$L^\infty$ bound] \label{teor: linftybound} Let $n\ge2$ and assume that, if $n=2$, condition~\eqref{eq:cond n=2} holds true. Let $f\in L^p(\Omega)$, with $p>n$. Then there exists a constant $C=C(\Omega,f,p,\beta,C_0)>0$ such that if $u$ is a minimizer to problem \eqref{problemar}, then \[ \norma{u}_{\infty}\le C. \] \end{prop} \begin{proof} Let $\gamma^{\pm}=\gamma_{J_u}^\pm$. For every $\varphi,\psi\in\sbvv$ satisfying $J_\varphi,J_\psi\subseteq J_u$, define \[ a(\varphi, \psi)=\int_{\R^n}\nabla \varphi\cdot\nabla\psi\, d\Ln+\beta\int_{J_u}\left[\gamma^+(\varphi)\gamma^+(\psi)+\gamma^-(\varphi)\gamma^-(\psi)\right]\, d\Hn. \] For every $v$ satisfying the assumptions of \autoref{teor: euler-lagrange}, it holds that \[ a(u,v)=\int_{\Omega}fv\,d\Ln. \] In particular, let us fix $k\in \R^+$ and define \[ \varphi_k(x)=\begin{cases} u(x)-k &\text{ if }u(x)\ge k,\\ 0 &\text{ if }u(x)<k, \end{cases} \] then \[ \gamma^+(\varphi_k)(x)=\begin{cases} \overline u(x)-k &\text{ if }\overline u(x)\ge k,\\ 0 &\text{ if }\overline u(x)<k, \end{cases} \] and analogously for $\gamma^-(\varphi_k)$. Furthermore, let us define \[ \mu(k)=\Ln(\set{u>k}). \] We want to prove that $\mu(k)=0$ for sufficiently large $k$. From \autoref{teor: euler-lagrange}, we have \begin{equation} \label{eq: ela} a(u,\varphi_k)=\int_{\Omega}f\varphi_k\,d\Ln, \end{equation} and we can observe that \[\begin{split} a(u,\varphi_k)&=\int_{\set{u>k}}\abs{\nabla u}^2\,d\Ln+\beta\int_{J_u\cap\set{u>k}}\left[\overline{u}(\overline{u}-k)+\underline{u}(\underline{u}-k)\right]\,d\Hn \\ &\geq\int_{\set{u>k}}\abs{\nabla u}^2\,d\Ln+\beta\int_{J_u\cap\set{u>k}}\left[(\overline{u}-k)^2+(\underline{u}-k)^2\right]\,d\Hn\\[5 pt]&=a(\varphi_k,\varphi_k). \end{split}\] Moreover, by minimality, $\mathcal{F}(u)\le \mathcal{F}(0)=0$ and by \autoref{oss: ominsupp}, $\Omega\subseteq\set{u>0}$. Therefore, \eqref{eq:stimasupporto} holds true and we can apply \autoref{lemma: poincare}, having that there exists $C=C(\Omega,f,\beta,C_0)>0$ such that \begin{equation} \label{eq: bounda} \int_{\Omega} f\varphi_k\,d\Ln =a(u,\varphi_k)\geq a(\varphi_k,\varphi_k)\geq C\norma{\varphi_k}_{2\cdot 1^*}^2. \end{equation} On the other hand \begin{equation}\label{eq: fbound} \begin{split} \int_\Omega f\varphi_k\,d\Ln=\int_{\Omega\cap\set{u>k}}f(u-k)\,d\Ln&\leq\left(\int_{\Omega\cap\set{u>k}}f^{\frac{2n}{n+1}}\right)^{\frac{n+1}{2n}}\norma{\varphi_k}_{2\cdot 1^*}\\[5 pt ] &\leq\norma{f}_{p,\Omega}\,\norma{\varphi_k}_{2\cdot 1^*}\:\mu(k)^\frac{n+1}{2n\sigma'}, \end{split} \end{equation} where \[ \sigma=\frac{p(n+1)}{2n}>1, \] since $p>n$. Joining~\eqref{eq: bounda} and~\eqref{eq: fbound}, we have \begin{equation}\label{eq: prebound}\norma{\varphi_k}_{2\cdot 1^*}\leq C\norma{f}_{p,\Omega}\:\mu(k)^\frac{n+1}{2n\sigma'}.\end{equation} Let $h>k$, then \[\begin{split}(h-k)^{2\cdot 1^*}\mu(h)=&\int_{\set{u>h}}(h-k)^{2\cdot 1^*}\,d\Ln\\ \leq&\int_{\set{u>h}}(u-k)^{2\cdot 1^*}\,d\Ln\\ \leq&\int_{\set{u>k}}(u-k)^{2\cdot 1^*}\,d\Ln=\norma{\varphi_k}_{2\cdot 1^*}^{2\cdot 1^*}.\end{split}\] Using~\eqref{eq: prebound} and the previous inequality, we have \[\mu(h)\leq C (h-k)^{-2\cdot 1^*}\mu(k)^\frac{n+1}{(n-1)\sigma'}.\] Since $p>n$, then $\sigma'<(n+1)/(n-1)$. By \autoref{lemma: stampacchia}, we have that $\mu(h)=0$ for all $h\geq h_0$ with $h_0=h_0(\Omega, f,\beta,C_0)>0$, which implies \[\norma{u}_{\infty}\leq h_0.\] \end{proof} \begin{proof}[Proof of \autoref{teor: mainth1}] The result is obtained by joining \autoref{teor: existence} and \autoref{teor: linftybound}. \end{proof} \section{Density estimates for the jump set}\label{estimates} In this section we prove \autoref{teor: mainth2}: in \autoref{teor: lowerbound} we prove the lower bound for minimizers to problem \eqref{problemar}; in \autoref{teor: density1} and \autoref{teor: density2} we prove the density estimates for the jump set of a minimizer to problem \eqref{problemar}. In this section we will assume that $\Omega\subseteq\R^n$ is an open bounded set with $C^{1,1}$ boundary, that $f\in L^p(\Omega)$, with $p>n$, is a positive function, and that $\beta, C_0$ are positive constants. We consider the energy functional $\mathcal{F}$ defined in \eqref{eq: fun 2}. In order to show that if $u$ is a minimizer to problem~\eqref{problemar} then $u$ is bounded away from 0, we will first prove that there exists a positive constant $\delta$ such that $u>\delta$ almost everywhere in $\Omega$, and then we will show that this implies the existence of a positive constant $\delta_0$ such that $u>\delta_0$ almost everywhere in the set $\set{u>0}$. In the following we will denote by $U_t:=\Set{u<t}\cap\Omega$. \begin{oss} Let $u$ be a minimizer to~\eqref{problemar}, by \autoref{oss: ominsupp}, $u$ is a solution to \[\begin{cases} -\Delta u=f & \text{in }\Omega,\\ u\ge0 & \text{on }\partial\Omega \end{cases}\] Let $u_0\in W^{1,2}_0(\Omega)$ be the solution to the following boundary value problem \begin{equation}\begin{cases} \label{eq: elomega} -\Delta u_0=f & \text{in }\Omega,\\ u_0=0 & \text{on }\partial\Omega. \end{cases}\end{equation} Then, by maximum principle, \[ u\geq u_0\quad\text{in $\Omega\subseteq\set{u>0}$}\quad\text{and}\quad \set{u<t}\cap\Omega=U_t\subseteq\set{u_0<t}\cap\Omega. \] \end{oss} \begin{lemma} \label{lemma: stimasottolivelli} There exist two positive constants $t_0=t_0(\Omega,f)$ and $C=C(\Omega, f)$ such that if $u$ is a minimizer to~\eqref{problemar} then for every $t\in[0,t_0]$ it results \begin{equation} \label{eq: stimasottolivelli} \Ln(U_t)\le C\, t. \end{equation} \begin{proof} Let $u_0$ be the solution to \eqref{eq: elomega}, fix $\varepsilon>0$ such that the set \[ \Omega_\eps=\Set{x\in\Omega | d(x,\partial\Omega)>\varepsilon} \] is not empty. Since $u_0$ is superharmonic and non-negative in $\Omega$, by maximum principle we have that \[\alpha=\inf_{\Omega_\eps}u_0>0.\] then $u_0$ solves \[ \begin{cases} -\Delta u_0=f &\text{in } \Omega,\\ u_0 = 0 &\text{on } \partial\Omega, \\ u_0 \ge \alpha &\text{on } \partial\Omega_\eps. \end{cases} \] Therefore, if we consider the solution $v$ to the following boundary value problem \[ \begin{cases} -\Delta v=0 &\text{in } \Omega,\\ v = 0 &\text{on } \partial\Omega, \\ v = \alpha &\text{on } \partial\Omega_\eps, \end{cases} \] we have that $u\ge u_0\ge v$ almost everywhere in $\Omega$ and \[ \Set{u<t}\cap\Omega=U_t \subseteq\Set{u_0<t}\cap\Omega\subseteq\Set{v<t}\cap\Omega. \] Hopf Lemma implies that there exists a constant $\tau=\tau(\Omega)>0$ such that \[ \frac{\partial v}{\partial \nu}<-\tau\qquad \text{on }\partial\Omega. \] Let $x\in\bar\Omega$, and let $x_0$ be a projection of $x$ onto the boundary $\partial\Omega$, then \[ \abs{x-x_0}=d(x,\partial\Omega), \qquad \qquad \frac{x-x_0}{\abs{x-x_0}}=-\nu_\Omega(x_0), \] where $\nu_\Omega$ denotes the exterior normal to $\partial\Omega$. We can write \begin{equation}\label{eq: lowboundboundary}\begin{split} v(x)&=\underbrace{v(x_0)}_{=0}+\nabla v(x_0)\cdot(x-x_0)+o\left(\abs{x-x_0}\right)\\[7 pt] &=-\frac{\partial v}{\partial\nu}(x_0)\abs{x-x_0}+o\left(\abs{x-x_0}\right) \\[5 pt] &\ge \tau\abs{x-x_0}+o\left(\abs{x-x_0}\right)\\[5 pt] &> \frac{\tau}{2}\abs{x-x_0}=\frac{\tau}{2} d(x,\partial\Omega) \end{split}\end{equation} for every $x$ such that $d(x,\partial\Omega)<\sigma_0$ for a suitable $\sigma_0=\sigma_0(\Omega,f)>0$. Notice that if $\bar{x}\in\overline{\Omega}$ and $\lim_{x\to \bar{x}}v(x)=0$ then necessarily $\bar{x}\in\partial\Omega$. Therefore, there exists a $t_0=t_0(\Omega,f)>0$ such that $v(x)<t_0$ implies $d(x,\partial\Omega)<\sigma_0$. Consequently, if $t<t_0$, we have that \[ \set{v<t}\subseteq\set{d(x,\partial\Omega)<\sigma_0}, \] and by \eqref{eq: lowboundboundary}, we get \[ \Ln\left(U_t\right)\le \Ln\left(\Set{v<t}\right)\le \Ln\left(\Set{x\in\Omega | d(x,\partial\Omega)\le \frac{2}{\tau }\, t}\right). \] Since $\Omega$ is $C^{1,1}$, by \autoref{teor: volumedistanza}, we conclude the proof. \end{proof} \end{lemma} \begin{lemma}\label{lemma: diffineq} Let $g: [0,t_1] \to [0,+\infty)$ be an increasing, absolutely continuous function such that \begin{equation} \label{eq: diffineq} g(t)\le C t^\alpha \left(g'(t)\right)^\sigma \qquad \forall t\in[0,t_1], \end{equation} with $C>0$ and $\alpha>\sigma>1$. Then there exists $t_0>0$ such that \[ g(t)=0 \qquad \forall t\le t_0. \] Precisely, \[ t_0=\left(\frac{C(\alpha-\sigma)}{\sigma-1}g(t_1)^{\frac{\sigma-1}{\sigma}}+t_1^{\frac{\sigma-\alpha}{\sigma}}\right)^{\frac{\sigma}{\sigma-\alpha}}. \] \end{lemma} \begin{proof} Assume by contradiction that $g(t)>0$ for every $t>0$. Inequality \eqref{eq: diffineq} implies \[ \frac{g'}{g^{\frac{1}{\sigma}}}\ge \frac{1}{C}t^{-\frac{\alpha}{\sigma}}. \] Integrating between $t_0$ and $t_1$, we have \[ \frac{\sigma}{\sigma-1}\left(g(t_1)^{\frac{\sigma-1}{\sigma}}-g(t_0)^{\frac{\sigma-1}{\sigma}}\right)\ge \frac{1}{C}\frac{\sigma}{\sigma-\alpha}\left(t_1^{\frac{\sigma-\alpha}{\sigma}}-t_0^{\frac{\sigma-\alpha}{\sigma}}\right). \] Since $\alpha>\sigma>1$, we have \[ 0\le g(t_0)^{\frac{\sigma-1}{\sigma}}\le \frac{\sigma-1}{C\left(\alpha-\sigma\right)}\left(t_1^{\frac{\sigma-\alpha}{\sigma}}-t_0^{\frac{\sigma-\alpha}{\sigma}}\right)+g(t_1)^{\frac{\sigma-1}{\sigma}}, \] which is a contradiction if \[ t_0\le \left(\frac{C(\alpha-\sigma)}{\sigma-1}g(t_1)^{\frac{\sigma-1}{\sigma}}+t_1^{\frac{\sigma-\alpha}{\sigma}}\right)^{\frac{\sigma}{\sigma-\alpha}}. \] \end{proof} \begin{oss}\label{oss:deltanou} Let $g$ be as in \autoref{lemma: diffineq} and assume that $g(t_1)\le K$, then $g(t)=0$ for all $0<t<\tilde{t}$ where \[\tilde{t}=\left(\frac{C(\alpha-\sigma)}{\sigma-1}K^{\frac{\sigma-1}{\sigma}}+t_1^{\frac{\sigma-\alpha}{\sigma}}\right)^{\frac{\sigma}{\sigma-\alpha}}. \] \end{oss} We now have the tools to prove the lower bound inside $\Omega$. \begin{prop}\label{teor: bound Omega}Let $n\ge2$ and assume that, if $n=2$, condition~\eqref{eq:cond n=2} holds true. Then there exists a positive constant $\delta=\delta(\Omega, f,p,\beta,C_0)>0$ such that if $u$ is a minimizer to problem \eqref{problemar} then \[ u\ge\delta\] almost everywhere in $\Omega$. \end{prop} \begin{proof} Assume that $\Omega$ is connected and define the function \[ u_t(x)=\begin{cases} \max\set{u,t} &\text{in }\Omega, \\ u &\text{in }\R^n\setminus\Omega \end{cases} \] Recalling that $U_t=\set{u<t}\cap\Omega$, we have \[ J_{u_t}\setminus\partial^*U_t = J_u\setminus\partial^*U_t, \] and on this set $\underline{u_t}=\underline{u}$ and $\overline{u_t}=\overline{u}$. Then we get by minimality of $u$, and using the fact that $J_{u_t}\cap\partial^* U_t\subseteq\partial\Omega$ \[ \begin{split} 0&\ge \mathcal{F}(u)-\mathcal{F}(u_t)\\[7 pt] &=\int_{U_t}\abs{\nabla u}^2\, d\Ln -2\int_{U_t}f(u-t)\,d\Ln+\beta\int_{\partial^*U_t\cap J_u}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn +\\[5 pt] &\hphantom{=}-\beta\int_ J_{u_t}\cap\partial^* U_t\cap J_u}\left[t^2+(\gamma_{\partial\Omega}^+(u))^2\right]\,d\H -\beta\int_{\left(J_{u_t}\cap\partial^*U_t\right)\setminus J_u} \left(t^2+u^2\right)\,d\Hn \\[7 pt] &\ge \int_{U_t}\abs{\nabla u}^2\, d\Ln-2\beta t^2 \Hn\left(\partial^*U_t\cap\partial\Omega\right \end{split} \] where we ignored all the non-negative terms except the integral of $\abs{\nabla u}^2$, and we used that $u\le t$ in $\partial^* U_t\setminus J_u$. By \autoref{lemma: stimasottolivelli}, we can choose $t$ small enough to have $\Ln(U_t)\le \Ln(\Omega)/2$, then applying the isoperimetric inequality in \autoref{teor: isopint} to the set $E U_t$, we get \begin{equation} \label{eq: stimagrad} \int_{U_t}\abs{\nabla u}^2\, d\Ln\le 2\beta \,C\, t^2 \, P(U_t;\Omega). \end{equation} Let us define \[ p(t)=P(U_t;\Omega), \] and consider the absolutely continuous function \[ g(t)=\int_{U_t}u\,\abs{\nabla u}\, d\Ln=\int_0^t sp(s)\, ds. \] By minimality of $u$ we can apply the a priori estimates \eqref{eq: variazione u} to prove the equiboundedness of $g$, i.e. there exists $K=K(\Omega,f,\beta,C_0)>0$ such that $g(t)\le K$ for all $t>0$. Using the Hölder inequality and the estimate \eqref{eq: stimagrad} we have \[ g(t)\le\left(\int_{U_t}u^2\, d\Ln\right)^\frac{1}{2}\left(\int_{U_t}\abs{\nabla u}^2\, d\Ln\right)^\frac{1}{2}\le \sqrt{2\beta C}\, t\,\Ln(U_t)^\frac{1}{2}(t^2p(t))^\frac{1}{2}. \] Fix $1>\varepsilon>0$. Then we can write $\Ln(U_t)=\Ln(U_t)^{\varepsilon}\,\Ln(U_t)^{1-\varepsilon}$, and by \autoref{lemma: stimasottolivelli} there exists a constant $C=C(\Omega, f,\beta)>0$ such that \[ g(t)\le C\, t^{2+\frac{1-\varepsilon}{2}}\,\Ln(U_t)^{\frac{\varepsilon}{2}}\, p(t)^\frac{1}{2}. \] By the relative isoperimetric inequality in \autoref{teor: relisop}, we can estimate \[ \Ln(U_t)^\frac{\eps}{2}\le C(\Omega, n) p(t)^{\frac{\varepsilon n}{2(n-1)}}, \] and, noticing that $p(t)=g'(t)/t$, we get \[ g(t)\le C t^\alpha (g'(t))^\sigma, \] where \[ \alpha=2-\frac{\varepsilon}{2}\left(1+\frac{n}{n-1}\right), \qquad \qquad \sigma=\frac{1}{2}+\frac{\varepsilon}{2}\frac{n}{n-1}. \] In particular, if we choose \[ \varepsilon\in\left(\frac{n-1}{n},\frac{3n-3}{3n-1}\right), \] we have that $\alpha>\sigma>1$, and then, using \autoref{lemma: diffineq} and \autoref{oss:deltanou}, there exists a $\delta=\delta(\Omega, f,p,\beta,C_0)>0$ such that $g(t)=0$ for every $t<\delta$. Then $\Ln(\set{u<t}\cap\Omega)=0$ for every $t<\delta$, hence \[u\ge\delta\] almost everywhere in $\Omega$. When $\Omega$ is not connected, then \[ \Omega=\Omega_1\cup\dots\cup\Omega_N, \] with $\Omega_i$ pairwise disjoint connected open sets. Using $u_t$ as the function $u$ truncated inside a single $\Omega_i$, we find constants $\delta_i>0$ such that \[ u(x)\ge \delta_i \] almost everywhere in $\Omega_i$. Therefore choosing $ \delta=\min\set{\delta_1,\dots,\delta_N}$ we have $ u(x)>\delta$ almost everywhere in $\Omega$. \end{proof} Finally, following the approach in \cite{CK}, we have \begin{prop}[Lower Bound] \label{teor: lowerbound} Let $n\ge2$ and assume that, if $n=2$, condition~\eqref{eq:cond n=2} holds true. Then there exists a positive constant $\delta_0=\delta_0(\Omega,f,p,\beta,C_0)$ such that if $u$ is a minimizer to problem~\eqref{problemar} then \[u\ge\delta_0\] almost everywhere in $\Set{u>0}$. \end{prop} \begin{proof} Let $\delta$ be the constant in \autoref{teor: bound Omega}. For every $0<t\le\delta$ let us define the absolutely continuous function \[h(t)=\int_{\set{u\leq t}\setminus J_u}u\abs{\nabla u}\,\Ln=\int_0^t s P(\set{u>s};\R^n\setminus J_u)\,ds.\] By minimality of $u$ we can apply the a priori estimates \eqref{eq: variazione u} to prove the equiboundedness of $h$, i.e. there exists $K=K(\Omega,f,\beta,C_0)>0$ such that $h(t)\le K$ for all $t>0$. We will show that $h$ satisfies a differential inequality. For any $0<t<\delta$, let us consider $u^t=u\chi_{\set{u>t}}$, where $\chi_{\set{u>t}}$ is the characteristic funtion of the set $\set{u>t}$, as a competitor for $u$. We observe that, by \autoref{teor: bound Omega}, $\Omega\subseteq\set{u>t}$, so we have that \[\begin{split} 0 \ge& \mathcal{F}(u)-\mathcal{F}(u^t)\\[5 pt] =&\int_{\set{u\le t}\setminus J_u} \abs{\nabla u}^2\,\Ln+\beta\int_{J_u\cap\set{u>t}^{(0)}}\left( \underline{u}^2+\overline{u}^2\right)\,d\Hn +\\[5 pt] &+\beta\int_{J_u\cap\partial^*\set{u>t}} \underline{u}^2\,d\Hn -\beta\int_{\partial^*\set{u>t}\setminus J_u}{u}^2\,d\Hn +\\[5 pt] &+C_0\Ln\left(\Set{0<u\le t}\right).\end{split}\] Rearranging the terms, \begin{equation} \label{eq: gest0} \begin{split} &\int_{\set{u\le t}\setminus J_u} \abs{\nabla u}^2\,\Ln+\beta\int_{J_u\cap\set{u>t}^{(0)}} \left(\underline{u}^2+\overline{u}^2\right)\,d\Hn +\\[5 pt] &+\beta\int_{J_u\cap\partial^*\set{u>t}} \underline{u}^2\,d\Hn +C_0\Ln\left(\Set{0<u\le t}\right)\\[ 5 pt] &\le \beta t^2 P(\set{u>t};\R^n\setminus J_u)=\beta t h'(t). \end{split} \end{equation} On the other hand using Hölder's inequality, we have \begin{equation} \label{eq: gest1} h(t)\le \left(\int_{\set{u\le t}} \abs{\nabla u}^2\,\Ln\right)^{\frac{1}{2}}\Ln\left(\Set{0<u\le t}\right)^{\frac{1}{2n}}\left(\int_{\set{u\le t}} u^{2\cdot 1^*}\,\Ln\right)^{\frac{1}{2\cdot 1^*} }. \end{equation} Classical Embedding of $\bv$ in $L^{1^*}$ applied to $u^2\chi_{\set{u\leq t}}$, ensures \[\left(\int_{\set{u\le t}} u^{2\cdot 1^*}\,\Ln\right)^{\frac{1}{1^*} }\le C(n) \abs*{D \big(u^2\chi_{\set{u\le t}}\big)}(\R^n),\] and, using \eqref{eq: gest0}, \begin{equation} \label{eq: gest2} \begin{split}\abs*{D \big(u^2\chi_{\set{u\le t}}\big)}(\R^n) =&2\int_{\set{u\le t}} u\abs{\nabla u}\,\Ln+\int_{J_u\cap\set{u>t}^{(0)}}\left( \underline{u}^2+\overline{u}^2\right)\,d\Hn +\\[5 pt]& + \int_{J_u\cap\partial^*\set{u>t}} \underline{u}^2\,d\Hn +\int_{\partial^*\set{u>t}\setminus J_u}{u}^2\,d\Hn\\[5 pt] \le& 2t\left(\Ln\left(\Set{0<u\le t}\right)\int_{\set{u\le t}\setminus J_u} \abs{\nabla u}^2\,\Ln\right)^{\frac{1}{2}}+3t h'(t) \\[5 pt] \le& \left(2\frac{\delta\beta}{\sqrt{C_0}}+3\right)th'(t). \end{split} \end{equation} Therefore, joining \eqref{eq: gest1}, \eqref{eq: gest0}, and \eqref{eq: gest2}, we have \begin{equation}\label{eq: gdiff}h(t)\le C_3\left(t h'(t)\right)^{1+\frac{1}{2n}},\end{equation} where \[C_3=\beta^\frac{1}{2}\left(\frac{\beta}{C_0}\right)^\frac{1}{2n}C(n)^\frac{1}{2}\left(2\frac{\delta\beta}{\sqrt{C_0}}+3\right)^\frac{1}{2}.\] By~\eqref{eq: gdiff} we now want to show that there exists $\delta_0=\delta_0(\Omega,f,p,\beta,C_0)>0$ such that $h(t)=0$ for every $0\le t<\delta_0$. Indeed assume by contradiction that $h(t)>0$ for every $0<t\le \delta$. We have \[\frac{h'(t)}{h(t)^{\frac{2n}{2n+1}}}\ge \frac{C_3^{-\frac{2n}{2n+1}}}{t}.\] Integrating from $t_0>0$ to $\delta$, we get \[\left(h(\delta)^{\frac{1}{2n+1}}-h(t_0)^{\frac{1}{2n+1}}\right)\ge C_4 \log\left(\frac{\delta}{t_0}\right),\] where \[C_4=\dfrac{C_3^{-\frac{2n}{2n+1}}}{2n+1}.\] Then \[h(t_0)^{\frac{1}{2n+1}}\le h(\delta)^{\frac{1}{2n+1}} + C_4\log\left(\frac{t_0}{\delta}\right).\] Finally, for any \[ 0<t_0\le \tilde{\delta}=\delta\exp\left(-h(\delta)^{\frac{1}{2n+1}}/C_4\right), \] we have $h(t_0)<0$, which is a contradiction. Then, setting $\delta_0=\delta\exp\left(-K^{\frac{1}{2n+1}}/C_4\right)\le\tilde{\delta}$, we conclude that $h(t)=0$ for any $0<t<\delta_0$, from which we have \[u\ge \delta_0\] almost everywhere in $\set{u>0}$. \end{proof} \begin{oss} From \autoref{teor: lowerbound}, if $u$ is a minimizer to problem~\eqref{problemar}, we have that \begin{equation}\label{eq: incljump}\partial^*\set{u>0}\subseteq J_u\subseteq K_u.\end{equation} Indeed, on $\partial^*\set{u>0}$ we have that, by definition, $\underline{u}=0$ and that, since $u\ge\delta_0$ $\Ln$-a.e. in $\set{u>0}$, $\overline{u}\ge\delta_0$. \end{oss} \begin{prop}[Upper Density Estimate] \label{teor: density1} Let $n\ge2$ and assume that, if $n=2$, condition~\eqref{eq:cond n=2} holds true. Then there exist positive constants $C=C(\Omega,f,p,\beta, C_0)$, ${c=c(\Omega,f,p,\beta,C_0)}$ and $\delta_1=\delta_1(\Omega,f,p,\beta,C_0)$ such that if $u$ is a minimizer to problem \eqref{problemar} then for every $B_r(x)$ such that $B_r(x)\cap\Omega=\emptyset$, we have \begin{enumerate}[label= (\alph*)] \item For every $x\in\R^n\setminus\Omega$, \begin{equation} \label{eq: updensity} \Hn(J_u\cap B_r(x))\le Cr^{n-1}; \end{equation} \item For every $x\in K_u$, \begin{equation} \label{eq: lowNdensity} \Ln(B_r(x)\cap\set{u>0})\ge cr^{n}; \end{equation} \item The function $u$ has bounded support, namely \[ \set{u>0}\subseteq B_{1/\delta_1}. \] \end{enumerate} \end{prop} \begin{proof} This theorem is a consequence of \autoref{teor: lowerbound}, since we immediately have\marcomm{\phantom{-}\\ \it (a)} \[ \int_{J_u\cap B_r(x)}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn\ge\delta_0^2\Hn(J_u\cap B_r(x)), \] and by minimality of $u$ we have \[ \begin{split} 0&\ge\mathcal{F}(u)-\mathcal{F}(u\chi_{\R^n\setminus B_r(x)})\\ &\ge\int_{J_u\cap B_r(x)}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn-\int_{\partial B_r(x)\setminus J_u}{u}^2\,d\Hn\\ &\ge\int_{J_u\cap B_r(x)}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn-\int_{\partial B_r(x)\cap\set{u>0}^{(1)}}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn \\ &\ge\int_{J_u\cap B_r(x)}\left(\underline{u}^2+\overline{u}^2\right)\,d\Hn-2\norma{u}_\infty^2\Hn\left(\partial B_r(x)\cap\set{u>0}^{(1)}\right), \end{split} \] where, in the second inequality, we have used~\eqref{eq: incljump}. Thus we have \begin{equation} \label{eq: updensity1} \Hn\left(J_u\cap B_r(x)\right)\le\frac{2\norma{u}_\infty^2}{\delta_0^2}\Hn(\partial B_r(x)\cap\set{u>0}^{(1)})\le C r^{n-1}, \end{equation} where $C=C(\Omega,f,p,\beta,C_0)>0$. We now\marcomm{\it (b)} want to use the estimate \eqref{eq: updensity} together with the relative isoperimetric inequality in order to get a differential inequality for the volume of $B_r(x)\cap\set{u>0}^{(1)}$. Let $x\in K_u$, then for almost every $r$ we hav \[ \begin{split} 0<V(r):=\Ln(B_r(x)\cap\set{u>0}^{(1)})&\le k\,P(B_r(x)\cap\set{u>0}^{(1)})^{\frac{n}{n-1}}\\ &\le k\, P(B_r(x);\set{u>0}^{(1)})^{\frac{n}{n-1}}, \end{split} \] where $k=k(\Omega,f,p,\beta,C_0)>0$, and in the last inequality we used that \eqref{eq: incljump} and \eqref{eq: updensity1} imply \[ \begin{split} P\left(B_r(x)\cap\set{u>0}^{(1)}\right)&\le \Hn\left(\partial B_r(x)\cap\set{u>0}^{(1)}\right)+\Hn\left(J_u\cap B_r(x)\right) \\ &\le \left(1+\frac{2\norma{u}_\infty^2}{\delta_0^2}\right) P(B_r(x);\set{u>0}^{(1)}). \end{split} \] Then we have \[ \frac{V'(r)}{V(r)^{\frac{n-1}{n}}}\ge \frac{1}{k}, \] which implies \[ \Ln(B_r(x)\cap\set{u>0}^{(1)})\ge c\,r^{n}. \] Finally, let\marcomm{\it (c)} $x\in K_u$ such that $d(x,\partial\Omega)\ge1/\delta_1$. From \eqref{eq: lowNdensity}, noticing that $\mathcal{F}(u)\le\mathcal{F}(0)=0$, we have that \[ c\,\delta_1^{-n}\le\Ln(\set{u>0}\setminus\Omega)\le\frac{2\norma{u}_\infty}{C_0}\int_\Omega f\,d\Ln, \ which is a contradiction if $\delta_1$ is sufficiently small. Then the thesis is given by \eqref{eq: incljump}. \end{proof} Finally, we have \begin{prop}[Lower Density Estimate] \label{teor: density2}Let $n\ge2$ and assume that, if $n=2$, condition~\eqref{eq:cond n=2} holds true. Then there exists a positive constant $c=c(\Omega,f,p,\beta,C_0)$ such that if $u$ is a minimizer to problem~\eqref{problemar} then \begin{enumerate} \item For any $x\in K_u$ and $B_r(x)\subseteq\R^n\setminus\Omega$, \[ \Hn(J_u\cap B_r(x))\ge c r^{n-1}; \] \item $J_u$ is essentially closed, namely \[ \Hn(K_u\setminus J_u)=0; \] \end{enumerate} \end{prop} The proof of \autoref{teor: density2} relies on classical techniques used in \cite{Giorgi} to prove density estimates for the jump set of almost-quasi minimizers of the Mumford-Shah functional. We refer to \cite[Theorem 5.1]{CK} and \cite[Corollary 5.4]{CK} for the details of the proof. \begin{proof}[Proof of \autoref{teor: mainth2}] The result is obtained by joining \autoref{teor: lowerbound}, \autoref{teor: density1}, and \autoref{teor: density2}. \end{proof} \begin{oss} Let $u$ be a minimizer to~\eqref{problemar} and let $A=\set{\overline{u}>0}\setminus K_u$, then the boundary of $A$ is equal to $K_u$: in first place, assume by contradiction that there exists an $x\in (\partial A)\setminus K_u$, then $u$ is harmonic in a small ball centered in $x$ with radius $r$. Therefore, being \[ \set{u>0}\cap B_r(x)\ne \emptyset, \] it is necessary that $u>0$ in the entire ball, and then $x\notin \partial A$, which is a contradiction. In other words, \[ \partial A\subseteq K_u \] By the same argument we also have that $A$ is open, and moreover $J_u\subseteq \partial A$, then \[ K_u\subseteq \partial A. \] In particular, the pair $(A,u)$ is a minimizer for the functional \[ \mathcal{F}(E,v)=\int_E\abs{\nabla v}^2\,d\Ln-2\int_{\Omega}fv\,d\Ln+\int_{\partial E}\left(\underline{v}^2+\overline{v}^2\right)\,d\Hn+C_0\Ln(E\setminus\Omega) \] over all pairs $(E,v)$ with $E$ open set of finite perimeter containing $\Omega$ and $v\in W^{1,2}(E)$. \end{oss} \newpage \printbibliography[heading=bibintoc] \newpage \Addresses \end{document}
\section{Introduction} \IEEEPARstart{T}{he next-generation} wireless technologies must provide high energy and spectral efficiency to support massive connectivity \cite{9040264}. In this regard, reflecting intelligent surfaces (RIS) \cite{9122596} and non-orthogonal multiple access (NOMA) \cite{9468352} are promising technologies. RIS can smartly reconfigure the wireless signal between transmitter and receiver using the passive elements. According to its working principle, RIS modifies the amplitude and phase of the reflective signal. By using this amazing feature, RIS can significantly enhance the performance of wireless communication in terms of coverage extension, user fairness, and channel secrecy \cite{khan2022opportunities}. On the other hand, NOMA has proved to be one of the key air interface techniques for high spectral efficiency and massive connectivity in next-generation wireless networks. This is because NOMA can support multiple users over the single spectrum resource simultaneously, whereas orthogonal multiple access can accommodate only one user over one spectrum resource \cite{8357810}. This important feature can be achieved through superposition coding and successive interference cancellation (SIC) decoding techniques. Researchers have recently studied the integration of NOMA with RIS in multi-cell wireless networks. For example, Ni {\em et al.} \cite{9353406} have proposed an efficient resource allocation scheme to maximize the achievable sum rate of the multi-cell RIS-NOMA network. In another study, Elhattab {\em et al.} \cite{9681835} have investigated a sum rate maximization problem in a two-cell RIS NOMA network. Moreover, Rezaei {\em et al.} \cite{9739782} have provided an energy efficiency optimization scheme for the RIS-NOMA network based on successive convex approximation. Based on the existing literature, several issues in multi-cell RIS-NOMA networks still need to be addressed. First, the authors in the above studies consider simple scenarios. For instance, the work in \cite{9353406} considers three-cell while the works \cite{9681835,9739782} consider only two-cell system models. Second, they consider only one RIS supporting all cells, which looks impractical. Third, they assume perfect SIC decoding which is challenging to obtain in such scenarios. This letter considers a more realistic scenario to maximize the spectral efficiency of the system under imperfect SIC decoding errors. In particular, our model consists of multi-cell ($>3$ cells) multi-IRS, which has not been investigated to the best of our knowledge. We simultaneously optimize the transmit power of the base station (BS) and reflection matrix of RIS in each cell while guaranteeing the minimum rate of each user. We exploit Karush-Kuhn-Tucker (KKT) conditions to calculate the to calculate the close-form expression of total transmit power at BS and power allocation coefficient of users while successive convex approximation and Difference of Convex functions (DC) programming for the design of reflection matrix in each cell. Numerical results are presented to validate our proposed optimization framework. The remainder of this work is organized as follow. Section II explains system model and states channel models. Section III formulates the spectral efficiency maximization problem and provides our proposed solution. Section IV presents and discuss the numerical results while Section V concludes this letter. \vspace{-0.2cm} \section{System and Channel Models} \begin{figure}[!t] \centering \includegraphics [width=0.40\textwidth]{SM.PDF} \caption{System model of multi-cell RIS-NOMA network.} \label{SM} \end{figure} As shown in Fig. 1, a multi-cell RIS-NOMA network is considered, where a BS in each cell serves two downlink users. The set of BSs can be denoted as $N$ while both users and BSs are using single antenna scenario. To enhance the wireless services and system performance, we consider a RIS in each cell which consists of $K$ passive elements. We denote the diagonal reflection matrix of RIS as ${\bf\Theta}_n=\text{diag}\{\delta_{1,n}e^{j\theta_{1,n}}, \delta_{2,n}e^{j\theta_{2,n}}, \dots, \delta_{K,n}e^{j\theta_{K,n}}\}$, where $\delta_{k,n}\in[0,1]$ is the reflection amplitude and $\theta_{k,n}\in[0,2\pi]$ denotes the phase shift of element $k$. The users serve by BS $n$ are denoted as $i$ and $j$. Without loss of generality, we assume that user $i$ is receiving signal from BS through direct link and RIS assisted link. However, user $j$ only receive signal through RIS assisted link due to large fading, i.e., large distance and obstacles. If $x_n$ is the superimposed signal, then the transmit signal of BS $n$ can be represented as $x_n=\sqrt{P_n\alpha_{i,n}}x_{i,n}+\sqrt{P_n\alpha_{j,n}}x_{j,n}$, where $P_n$ denotes the transmit power of BS $n$, $\alpha_{i,n}$ and $\alpha_{j,n}$ are the power allocation coefficients while $x_{i,n}$ and $x_{j,n}$ represent the unit power signals, respectively. The received signal that user $i$ receives from BS $n$ through both direct and RIS assisted link can be written as: \begin{align} y_{i,n}&=\underbrace{(g_{i,n}+\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n})x_{n}}_{\text{desired superimposed signal}}\nonumber\\ &+\underbrace{\sum\limits_{n'=1,n'\neq n}^N(g_{i,n'}+\textbf{h}_{k,n'}{\bf\Theta}_n\textbf{f}^H_{i,k,n'})\sqrt{P_n'\alpha_{i,n'}}x_{i,n'}}_{\text{co-channel interference from neighboring cell}} \end{align} where $g_{i,n}=\bar{g}_{i,n}D^{-\eta/2}_{i,n}$ denotes the channel gain of direct link between BS $n$ and user $i$ such that $\bar{g}_{i,n}~\mathcal{CN}(0,1)$ is the Rayleigh fading coefficient and $D_{i,n}$ shows the distance between user and BS while $\eta$ is the path-loss exponent\footnote{Other channels in the system are modeled similarly but the details are omitted here for simplicity.}. Moreover, $\textbf{h}_{k,n}\in{K\times1}$ denotes Rician fading channels from BS $n$ to RIS while $\textbf{f}_{i,k,n}\in K\times 1$ represents Rayleigh fading channels from RIS to user $i$. Accordingly, the received signal that user $j$ receives through RIS assisted link cab be expressed as: \begin{align} y_{j,n}&=\underbrace{\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}x_{n}}_{\text{desired superimposed signal}}\nonumber\\ &+\underbrace{\sum\limits_{n'=1,n'\neq n}^N(g_{j,n'}+\textbf{h}_{k,n'}{\bf\Theta}_n\textbf{f}^H_{j,k,n'}\sqrt{P_n'\alpha_{j,n'}}x_{j,n'}}_{\text{co-channel interference from neighboring cell}} \end{align} where $\textbf{h}_{k,n}\in{K\times1}$ denotes Rician fading channels from BS $n$ to RIS $m$ while $\textbf{f}_{j,k,n}\in K\times 1$ represents Rayleigh fading channels from RIS to user $j$, respectively. Following the NOMA protocol, we assume that the user with strong channel conditions is capable of applying SIC to subtract the signal of WU before decoding its own signal. Based on the above observations, the signal to interference plus noise ratio (SINR) of user $i$ and user $j$ can be computed as: \begin{align} \gamma_{i,n}&=\frac{P_n\alpha_{i,n}(|g_{i,n}|^2+|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2)}{P_n\varphi_{j,n}(|g_{i,n}|^2+|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2)\beta+I_{i,n'}+\sigma^2} \\ \gamma_{j,n}&=\frac{P_n\alpha_{n,j}|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}|^2}{P_n\alpha_{i,n}|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}|^2+I_{j,n'}+\sigma^2}, \end{align} where $I_{i,n'}=\sum\limits_{n'=1,n'\neq n}^N(|g_{i,n'}|^2+|\textbf{h}_{k,n'}{\bf\Theta}\textbf{f}^H_{i,k,n'}|^2)P_n'\alpha_{i,n'}$ is the co-channel interference and $\beta$ denotes the parameter of SIC decoding error, respectively. \vspace{-0.2cm} \section{Problem Formulation and Proposed Solution} This work seeks to maximize the spectral efficiency of multi-cell RIS-NOMA network by optimizing the transmit power of BS and reflection matrix of RIS in each cell. The optimization problem can be formulated as: \begin{alignat}{2} \underset{{\boldsymbol{\alpha}_n, P_n, {\bf \Theta}_n}}{\text{max}} & \sum\limits_{n=1}^N\{\log_2(1+\gamma_{i,n})+\log_2(1+\gamma_{j,n})\}\label{5}\\ s.t.\ T_1:\ & \log_2(1+\gamma_{i,n})\geq R_{min},\forall n, \nonumber\\ T_2:\ &\log_2(1+\gamma_{j,n})\geq R_{min},\forall n, \nonumber \\ T_3:\ & 0\leq P_n\leq P_{tot}, \forall n, \nonumber\\ T_4:\ & \theta_{k,n}\in[0,2\pi], |\delta_{k,n}|=1, \forall k, n ,\nonumber\\ T_5:\ &0\leq \alpha_{i,n}\leq 1,0\leq \alpha_{j,n}\leq 1, \forall n ,\nonumber\\ T_6:\ &\alpha_{i,n}+\alpha_{j,n}=1, \nonumber \end{alignat} where $\boldsymbol{\alpha_n}=\{\alpha_{i,n},\alpha_{j,n}\}$. The constraints $T_1$ and $T_2$ ensure the minimum data rate of user $i$ and user $j$. Constraint $T_3$ controls the transmit power of BS in each cell. Constraints $T_4$ is invoked for phase shift and reflection coefficient at RIS. Constraints $T_5$ and $T_6$ are the power distribution restrictions of the NOMA systems. Form the constraint $T_6$ we have ($a_{j,n}=1-a_{i,n}$). Substituting ($a_{j,n}=1-a_{i,n}$) in the the problem removes the need for $T_6$ and also makes the problem more tractable. After the substitution, the Lagrangian of the problem is given as: \begin{alignat}{2} L=&-\!\sum\limits_{n=1}^N(\log_2(1\!+\!\gamma_{i,n})\!+\!\log_2(1\!+\!\gamma_{j,n}))\!+\!\sum\limits_{n=1}^N \tau_{i,n}(R_{min}\nonumber\\&- \log_2(1+\gamma_{i,n}))+\sum\limits_{n=1}^N \tau_{j,n}(R_{min}-\log_2(1+\gamma_{j,n}))+\nonumber \\&\sum\limits_{n=1}^N \lambda_{n} (P_n- P_{tot})+\sum\limits_{k=1}^K\sum\limits_{n=1}^N\mu_{k,n}(\theta_{k,n}-2\pi)+\sum\limits_{n=1}^N\nonumber\\& \eta_{i,n}(\alpha_{i,n}\!-\!1), \end{alignat} \noindent By adapting KKT conditions and differentiating the Lagrangian with respect to $\alpha_{i,n}$ we get: \begin{align} &\alpha_{i,n}^6((\beta-1)^2 \beta^2 \eta_{i,n} \varepsilon_i^4 \varepsilon_j^2 P_n^6)+\alpha_{i,n}^5 \Gamma_5+\alpha_{i,n}^4 \Gamma_4+\alpha_{i,n}^3 \Gamma_3\nonumber\\&+\alpha_{i,n}^2 \Gamma_2+\alpha_{i,n} \Gamma_1+\Gamma_0=0\label{alphasol}, \end{align} with the values of $\varepsilon_i$ and $\varepsilon_j$ can be expressed as: \begin{align} &\varepsilon_i=|g_{i,n}|^2+|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2\\ &\varepsilon_j=|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}|^2 \end{align} and the values of $\Gamma_0$, $\Gamma_1$, $\Gamma_2$, $\Gamma_3$, $\Gamma_4$ and $\Gamma_5$ are given in Appendix A. The equation (\ref{alphasol}) is a polynomial of order 6 and can be easily solved by using mathematical solvers. The value of $\alpha_{j,n}$ can be computed as $\alpha_{j,n}=1-\alpha_{i,n}$. Then differentiating with respect to $P_n$ we get a polynomial of order 4, given as: \begin{align} &P_{n}^4((\alpha_{i,n}-1)\alpha_{i,n}(\alpha_{i,n}(\beta-1)-\beta)\beta\varepsilon_i^2\varepsilon_j^2\lambda_n)+P_{n}^3\Lambda_3+\nonumber\\&P_{n}^2\Lambda_2+P_{n}\Lambda_1+\Lambda_0, \end{align} where $\Lambda_0$, $\Lambda_1$, $\Lambda_2$, and $\Lambda_3$ are given in Appendix B. In each iteration the Lagrangian variables associated with $\alpha_{i,n}$ and $P_{n}$ are updated by using the sub-gradient method as: \begin{align} &\tau_{j,n}=\Bigg[\tau_{j,n}+\varpi(R_{min}-\log_2(1+\gamma_{j,n}))\Bigg]^+,\\ &\lambda_{n}=\Bigg[\lambda_{n}+\varpi(P_n- P_{tot})\Bigg]^+,\\ &\eta_{i,n}=\Bigg[\eta_{i,n}+\varpi(\alpha_{i,n} - 1)\Bigg]^+, \end{align} where $\varpi$ is the step size and $[x]^+=\max{x,0}$. For finding the solution of ${\bf \Theta}_n$, we first adopt successive convex approximation \cite{5165179}. With successive convex approximation the rates of strong and WU are given as $\zeta_{i,n}\log_2(\gamma_{i,n})+\Omega_{i,n}$ and $\zeta_{j,n}\log_2(\gamma_{j,n})+\Omega_{j,n}$, respectively. When $\zeta_{e,n}=\dfrac{\gamma_{e,n}}{1+\gamma_{e,n}}, \forall e=\{i,j\},$ and $\Omega_{e,n}=\log_{2}(1+\gamma_{e,n})-\dfrac{\gamma_{e,n}}{1+\gamma_{e,n}}\log_{2}(\gamma_{e,n}),\forall e=\{i,j\}$. Then the rates can be written as $R_{i,n}=\zeta_{i,n}(\log_2(P_n\alpha_{i,n}(|g_{i,n}|^2+|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2))-\log_2(P_n\alpha_{j,n}(|g_{i,n}|^2+|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2)\beta+I_{i,n'}+\sigma^2))+\Omega_{i,n}$ and $R_{j,n}=\zeta_{j,n}(\log_2(P_n\alpha_{n,j}|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}|^2)-\log_2(P_n\alpha_{i,n}|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{j,k,n}|^2+I_{j,n'}+\sigma^2)+\Omega_{j,n}$. Let $A={\bf\Theta}_n {\bf\Theta}_n^H$, where $A\geq 0$ and rank$(B)=1$. Let $W_{i,k,n}=|\textbf{h}_{k,n}\textbf{f}^H_{j,k,n}|^2$, where $W_{i,k,n}\geq 0$ and rank($W_{i,k,n}$)=1. Then, for $f_{i,1}(A)=\log_2(P_n\alpha_{i,n}(|g_{i,n}|^2+A W_{i,k,n}))$, $f_{i,2}(A)=\log_2(P_n\alpha_{j,n}(|g_{i,n}|^2+A W_{i,k,n}\beta)+I_{i,n'}+\sigma^2)$, $f_{j,1}(A)=\log_2(P_n\alpha_{j,n}(A W_{j,k,n})=$, $f_{j,2}(A)=\log_2(P_n\alpha_{j,n}(|g_{j,n}|^2+A W_{j,k,n}\beta+I_{j,n'}+\sigma^2)$, we have: \begin{align} &\overline{R_{i,n}^*}=\zeta_{i,n}[f_{i,1}(A)-f_{i,2}(A)]+\Omega_{i,n}\\ &\overline{R_{j,n}^*}=\zeta_{j,n}[f_{j,1}(A)-f_{j,2}(A)]+\Omega_{j,n} \end{align} Then employing DC programming we replace $f_{i,2}$ and $f_{j,2}$ with their first order linear approximation as: $f_{2}(A)\leq f_{2}(A^{(i)})+tr((f'_{2}(A^{(i)}))^{H}(A-A^{(i)} ))=\overline{f_{2}(A)}$. The optimization problem can be written as: \begin{alignat}{2} &\max_{A} \sum\limits_{n=1}^N (\overline{R_{i,n}^*}+\overline{R_{j,n}^*})\\ & s.t. A\geq 0, diag(A)\leq 1, rank(A)=tr(A)-||A||_2=1, \\ & P_n\alpha_{i,n}(|g_{i,n}|^2+A W_{i,k,n})\geq \Xi (P_n\alpha_{j,n}(|g_{i,n}|^2+A W_{i,k,n}\beta)\nonumber\\&\qquad\qquad\qquad\qquad\qquad+I_{i,n'}+\sigma^2), \forall n,\\ & P_n\alpha_{j,n}A W_{j,k,n}\!\geq\! \Xi (P_n\alpha_{i,n}A W_{j,k,n}\beta\!+\!I_{i,n'}\!+\!\sigma^2), \forall n, \end{alignat} $||A||_2$ is the spectral norm of $A$ and $tr(A)\sum_{n=1}^N \nu_n$ where $\nu_n$ represents the $n$th largest singular value of $A$, and $\Xi=2^{R_{min}}-1$. Then we add the rank constraint as a penalty to the objective, with this, the optimization problem becomes: \begin{alignat}{2} &\max_{A} \sum\limits_{n=1}^N (\overline{R_{i,n}^*}\!+\!\overline{R_{j,n}^*})\!+\!\xi_1 (tr(A)\!-\!\overline{||A||_2})\!+\!\xi_1 (tr(A)\!-\!\overline{||A||_2})\\ & s.t. A\geq 0, diag(A)\leq 1, \\ & P_n\alpha_{i,n}(|g_{i,n}|^2+A W_{i,k,n})\geq \Xi (P_n\alpha_{j,n}(|g_{i,n}|^2+A W_{i,k,n}\beta)\nonumber\\&\qquad\qquad\qquad\qquad\qquad+I_{i,n'}+\sigma^2), \forall n,\\ & P_n\alpha_{j,n}A W_{j,k,n}\!\geq\! \Xi (P_n\alpha_{i,n}A W_{j,k,n}\beta\!+\!I_{i,n'}\!+\!\sigma^2), \forall n, \end{alignat} where $\overline{||A||_2}= ||A^{(i)}||_2 tr(x_{max}^{(i)} (A-A^{(i)}))$, where $x_{max}^{(i)}$ is the eigenvector corresponding to the largest singular value of matrix A in the i$th$ iteration. The above problem is in the form of standard semi-definite programming and is solved using MOSEK toolbox of MATLAB \cite{Jzhou}. It is important to discuss the mathematical complexity of the proposed multi-cell RIS-NOMA optimization scheme. The complexity of the proposed scheme in any given iteration can be expressed as $O\{2N\}$. Now we assume that the total number iterations required for convergence are $T$, then the overall complexity of the proposed scheme becomes $O\{T2N\}$. \begin{algorithm}[t] {\bf Initialization:} Define all parameters of the system {\bf Step 1:} Compute $\alpha_{i,n}$, $\alpha_{j,n}$, and $P_n$ for the given ${\bf \Theta}^*_n$ \While{not converge}{\For{$n=1:N$}{Compute $\alpha_{i,n}$ using (7)\\ Compute $\alpha_{j,n}$ as $\alpha_{j,n}=1-\alpha_{i,n}$\\ Compute $P_n$ using Equation (10)\\ Update the dual variables in (11)--(13) }} {\bf Step 2:} Now with $\alpha^*_{i,n},\alpha^*_{j,n},P^*_n$, we compute ${\bf \Theta}_n$ \For{$n=1:N$}{Find ${\bf \Theta}^*_n$ by solving the standard semi-definite programming in (20)--(23) using MOSEK toolbox of MATLAB. } Return $\alpha^*_{i,n}$, $\alpha^*_{j,n}$, $P^*_n$, ${\bf \Theta}^*_n$ \caption{Proposed optimization Framework} \end{algorithm} \vspace{-0.2cm} \section{Numerical Results} Here we present the numerical results of the proposed optimization scheme. Unless mentioned otherwise, the simulation parameters are set as follows: the average channels are obtained from 10000 realizations, the power budget of each BS is 20 dBm, the number of passive elements on each RIS is 50, reuse the same carrier for all BSs, the number of users associated with each BS is 2, the path loss is 3, imperfect SIC parameter $\beta=0.1$, and the variance of AWGN is set as $\sigma^2=0.1$, respectively. \begin{figure}[!t] \centering \includegraphics[width=65mm,height=50mm,trim= 100mm 0 100mm 0, clip=true]{Changebeta2.pdf} \caption{The impact of imperfect SIC parameter on the Spectral efficiency of the system.} \label{convergence} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=65mm,height=50mm,trim= 100mm 0 100mm 0, clip=true]{ChangePow1.pdf} \caption{The effect of increasing BS power on the system spectral efficiency with different cells and $R_{min}$.} \label{iSICvsSEvsJ} \end{figure} To check the effect of imperfect SIC detection on the system performance, Fig. \ref{convergence} plots the system spectral efficiency against the increasing values of $\beta$ where the number of cells is set as $J=5$ and $J=10$ while the values of $R_{min}$ is 0.5 bps/Hz and 1 bps/Hz. We can see that for all considered cases, when the value of $\beta$ increases, the system's spectral efficiency reduces. This is because the high values of $\beta$ increase the interference of NOMA users due to the poor signal decoding capability. Another point worth mentioning here is the decreasing spectral efficiency gap of all the cases when $\beta$ increases. It is because with increasing $\beta$, more power is required by all users to meet the minimum rate requirements. Thus, the power allocation becomes less flexible. In practical systems achieving perfect SIC is a difficult task. However, for ease of solution most of the works in literature consider perfect SIC. Considering perfect SIC provides an over-optimistic performance evaluation as is shown in Fig. \ref{convergence}. \begin{figure}[!t] \centering \includegraphics[width=65mm,height=50mm,trim= 100mm 0 100mm 0, clip=true]{ChangeRIS1Comparison.pdf} \caption{This figure shows the effect of increasing RIS elements on the System Spectral Efficiency.} \label{PvsSEvsRmin} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=65mm,height=50mm,trim= 100mm 0 100mm 0, clip=true]{Convergence2.pdf} \caption{Convergence of System Spectral Efficiency.} \label{con} \end{figure} \vspace{-0.2cm} Next, it is important to show the impact of allocating power on the system's performance. Fig. \ref{iSICvsSEvsJ} shows the increasing values of $P_{tot}$ versus spectral efficiency of the system. The spectral efficiency increases with increasing the allocated transmit power of BS. Further, the gap in the spectral efficiency offered by all the cases also increases with $P_{tot}$, because more available transmit power at BS becomes available for optimization. Hence, the cases with less restrictions (smaller $R_{min}$ requirements) perform better than other cases with higher rate requirements. Besides that, we can see that the system spectral efficiency similarly increases as the number of cells increases from 5 to 10. It shows the effectiveness of the proposed scheme for a large RIS-NOMA network. Fig. \ref{PvsSEvsRmin} shows the impact of increasing number of RIS elements on the spectral efficiency of the system. We have compared the performance of the considered system model with a scenario where the RIS forwards the signal of only WU in each cell. Whereas, the strong user (SU) only receives its signal directly from the BS. As expected, increasing RIS elements increases the spectral efficiency of the system for any number of cells for both cases. Further, it can be seen that we get much better performance when the RIS forwards the data of both SU and WU in the cell. All the results in this section showed that the systems with more number of cells provide better spectral efficiency of the system. This shows the importance of the proposed scheme in the large-scale multi-cell RIS-NOMA networks. Fig. \ref{con} show the convergence behavior of the proposed framework. It can be seen from the figure that the system convergences within reasonable number of iterations, and that increasing the number of interfering cells has little impact on the convergence time. \section{Conclusions} The integration of NOMA with RIS has the potential to extend wireless communication and connect massive devices in next-generation networks. This letter has proposed a new optimization scheme for a multi-cell RIS-NOMA network to maximize the system's spectral efficiency. Specifically, our framework simultaneously optimizes the transmit power of BS and the reflection matrix of RIS in each cell under SIC decoding errors. The total transmit power of BS and power allocation coefficients of users have been calculated using KKT conditions, while the efficient reflection matrix of RIS has been designed by successive convex approximation and DC programming. Simulation results have confirmed the benefits of the proposed optimization scheme. \vspace{-0.2cm} \section*{Appendix A: Values of $\Gamma_0$, $\Gamma_1$, $\Gamma_2$, $\Gamma_3$, $\Gamma_4$ and $\Gamma_5$} \begin{align} \Gamma_0= & (I_{j,n'}\!+\!\sigma^2)(I_{i,n'}\!+\!\beta\varepsilon_i P_n\!+\!\sigma^2)^3(\eta_{i,n}(I_{j,n'}\!+\!\sigma^2)\nonumber\\&(I_{i,n'}\!+\!\beta\varepsilon_i P_n\!+\!\sigma^2)\!+\!P_n(\!-\!\varepsilon_i(I_{j,n'}\!+\!\sigma^2)(1\!+\!\tau_{i,n})\!\nonumber\\&+\!\varepsilon_i(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)(1\!+\!\tau_{j,n})))\nonumber \end{align} \begin{align} \Gamma_1=& P_n( I_{i,n'}\!+\!\beta (\varepsilon_i) P_n\!+\!\sigma^2)^2 (2 \eta_{i,n}(I_{j,n'}\!+\!\sigma^2)(I_{i,n'}\!+\!\beta\nonumber\\& (\varepsilon_i) P_n\!+\!\sigma^2)(\!-\!(2\beta\!-\!1)(\varepsilon_i)(I_{j,n'}\!+\!\sigma^2)\!+\!\varepsilon_j)(I_{i,n'}\!+\!\beta\nonumber\\&(\varepsilon_i) P_n\!+\!\sigma^2))\!+\!P_n((2\beta\!-\!1)(\varepsilon_i)^2(I_{j,n'}\!+\!\sigma^2)^2 (1\!+\!\tau_{i,n})\!\nonumber\\&+\!(\varepsilon_j)^2 (I_{i,n'}\!+\!\beta(\varepsilon_i) P_n\!+\!\sigma^2)^2 (1\!+\!\tau_{j,n})\!-\!2(\varepsilon_i) \varepsilon_j(I_{j,n'}\!\nonumber\\& +\!\sigma^2)(I_{i,n'}\!+\!\beta (\varepsilon_i) P_n\!+\!\sigma^2)(\tau_{i,n}\!-\!\tau_{j,n}\!+\!2\beta(1\!+\!\tau_{j,n}))))\nonumber \end{align} \begin{align} \Gamma_2=& P_n^2(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)(\eta_{i,n}(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)((1\!\nonumber\\&+\!6(\beta\!-\!1)\beta)\varepsilon_i^2(I_{j,n'}\!+\!\sigma^2)^2\!-\!4(2\beta\!-\!1)\varepsilon_i \varepsilon_j (I_{j,n'}\!+\!\sigma^2)\nonumber\\&(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)\!+\!\varepsilon_j^2(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)^2)\!-\!\varepsilon_i P_n\nonumber\\&((\beta\!-\!1)\beta \varepsilon_i^2(I_{j,n'}\!+\!\sigma^2)^2(1\!+\!\tau_{i,n})\!+\!\varepsilon_j^2(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!\nonumber\\&+\!\sigma^2)^2(\tau_{i,n}\!-\!1\!-\!2\tau_{j,n}\!+\!4\beta(1\!+\!\tau_{j,n}))\!-\!\varepsilon_i \varepsilon_j (I_{j,n'}\!+\!\sigma^2)\nonumber\\&(I_{i,n'}\!+\!\beta \varepsilon_i P_n+\!\sigma^2)(\!-\!1\!-\!2\tau_{i,n}\!+\!\tau_{j,n}\!+\!2\beta(3\beta\!-\!1\!\nonumber\\&+\!2\tau_{i,n}\!+\!3(\beta\!-\!1)\tau_{j,n}))))\label{gamma2}\nonumber \end{align} \begin{align} \Gamma_3=&-\!\varepsilon_i P_n^3(I_{i,n'}\!+\!\beta \varepsilon_i P_n\!+\!\sigma^2)(2\eta_{i,n}((\beta\!-\!1)\beta(2\beta\!-\!1)\nonumber\\&\varepsilon_i^2(I_{j,n'}\!+\!\sigma^2)^2\!-\!(1\!+\!6(\beta\!-\!1)\beta \varepsilon_i \varepsilon_j (I_{j,n'}\!+\!\sigma^2)(I_{i,n'}\!\nonumber\\&+\!\beta \varepsilon_i P_n\!+\!\sigma^2)\!+\!(2\beta\!-\!1)\varepsilon_j^2(I_{i,n'}\!+\!\beta\varepsilon_i P_n+\!\sigma^2)^2)\!\nonumber\\&-\!\varepsilon_i \varepsilon_j P_n(\!-\!2 \beta^3 \varepsilon_i (2 I_{j,n'}\!-\!3\varepsilon_j P_n\!+\!2\sigma^2) (1\!+\!\tau_{j,n})\!\nonumber\\&+\!\varepsilon_j (I_{i,n'}\!+\!\sigma^2)(\tau_{j,n}\!-\!\tau_{i,n})\!+\!\varepsilon_j(2 I_{i,n'}(\tau_{i,n}\!-\!2\!-\!3\tau_{j,n})\nonumber\\&+\!2\sigma^2 (\tau_{i,n}\!-\!2\!-\!3\tau_{j,n})\!\varepsilon_i P_n (\tau_{j,n}\!-\!\tau_{i,n})))\!+\!2\beta^2+\nonumber\\&(\!-\!\varepsilon_i(I_{j,n'}\!+\!\sigma^2)(\tau_{i,n}\!-\!2\!-\!3\tau_{j,n})\!+\!\varepsilon_j(3\sigma^2\!+\!\varepsilon_i P_n+\nonumber\\&(\tau_{i,n}\!-\!2)\!+\!3(I_{i,n'}\!+\!(I_{i,n'}\!-\!\varepsilon_i P_n\!+\!\sigma^2)\tau_{j,n})))))\nonumber \end{align} \begin{align} \Gamma_4=&\varepsilon_i^2 P_n^4(\eta_{i,n}((\beta\!-\!1)^2\beta^2\varepsilon_i^2(I_{j,n'}\!+\!\sigma^2)^2\!-\!4(\beta\!-\!1)\beta\nonumber\\&(2\beta\!-\!1)\varepsilon_i \varepsilon_j (I_{j,n'}\!+\!\sigma^2)(I_{i,n'}\!+\!\beta \varepsilon_i P_n+\sigma^2)+(1+6\nonumber\\&(\beta-1)\beta)\varepsilon_j^2(I_{i,n'}+\beta \varepsilon_i P_n+\sigma^2)^2)-(\beta-1)\beta \varepsilon_i \varepsilon_j P_n \nonumber\\&(-1(\beta-1)\beta \varepsilon_i(I_{j,n'}+\sigma^2)(1+\tau_{j,n})+\varepsilon_j (I_{i,n'}\nonumber\\&+\beta \varepsilon_i P_n+\sigma^2)(\tau_{i,n}-1-2\tau_{j,n}+4\beta(1+\tau_{j,n}))))\nonumber \end{align} \begin{align} \Gamma_5=&(\beta-1)\beta \varepsilon_i^3 \varepsilon_j P_n^5 (2\eta_{i,n}(-(\beta-1)\beta\varepsilon_i (I_{j,n'}+\sigma^2)\nonumber\\&+(2\beta-1)\varepsilon_j(I_{i,n'}+\beta \varepsilon_i P_n+\sigma^2))\nonumber\\&+(\beta-1)\beta\varepsilon_i \varepsilon_j P_n (1+\tau_{j,n}))\nonumber \end{align} \vspace{-0.2cm} \section*{Appendix B: Values of $\Lambda_0$, $\Lambda_1$, $\Lambda_2$ and $\Lambda_3$} \begin{align} \Lambda_0=&(I_{i,n'}\!+\!\sigma^2)(I_{j,n'}\!+\!\sigma^2)(\!-\!(I_{j,n'}\!+\!\sigma^2)(\!-\!\lambda_n(I_{i,n'}\!+\!\sigma^2)\!\nonumber\\&+\!\alpha_{i,n}\varepsilon_i(1\!+\!\tau_{i,n}))\!+\!(\alpha_{i,n}\!-\!1) \varepsilon_j(I_{i,n'}\!+\!\sigma^2)(1\!+\!\tau_{j,n}))\nonumber \end{align} \begin{align} \Lambda_1=& (I_{i,n'}\!+\!\sigma^2)(I_{j,n'}\!+\!\sigma^2)(\varepsilon_j\lambda_n(I_{i,n'}\!+\!\sigma^2)\!-\!\alpha_{i,n}^2\varepsilon_i \varepsilon_j\nonumber\\&(\tau_{i,n}\!-\!\tau_{j,n}\!+\!2\beta(1\!+\!\tau_{j,n}))\!-\!2\beta\varepsilon_i(\!-\!\lambda_{n}(I_{j,n'}\!+\!\sigma^2)\!\nonumber\\&+\!\varepsilon_j(1\!+\!\tau_{j,n}))\!+\!\alpha_{i,n}(\varepsilon_j\lambda_{n}(I_{i,n'}\!+\!\sigma^2)+\!|g_{i,n}|^2(\!-\!(2\beta\!\nonumber\\&-\!1)\lambda_n(\varepsilon_j\!+\!\sigma^2)\!-\!\varepsilon_j(2\!+\!\tau_{i,n}\!+\!\tau_{j,n}\!-\!4\beta(1\!+\!\tau_{j,n})))\!\nonumber\\&+\!|\textbf{h}_{k,n}{\bf\Theta}_n\textbf{f}^H_{i,k,n}|^2(\!-\!(2\beta\!-\!1)\lambda_n(I_{j,n'}\!+\!\sigma^2)\!\nonumber\\&-\!\varepsilon_j(2\!+\!\tau_{i,n}\!+\!\tau_{j,n}\!-\!4\beta(1\!+\!\tau_{j,n})))))\nonumber \end{align} \begin{align} \Lambda_2=&\alpha_{i,n}^3 (\beta\!-\!1)\beta\varepsilon_i^2\varepsilon_j(I_{j,n'}\!+\!\sigma^2)(1\!+\!\tau_{j,n})\!+\!\beta\varepsilon_i(I_{j,n'}\!+\!\sigma^2)\nonumber\\&(2\varepsilon_j \lambda_n(I_{i,n'}\!+\!\sigma^2)\!-\!\beta\varepsilon_j (\lambda_n(\varepsilon_j\!+\!\sigma^2)\!+\!\varepsilon_j(1\!+\!\tau_{j,n})))\!\nonumber\\&+\!\alpha_{i,n}(\varepsilon_j\lambda_n(I_{i,n'}\!+\!\sigma^2)(\varepsilon_j(I_{i,n'}+\sigma^2)\!+\!\varepsilon_i(I_{j,n'}\!+\!\sigma^2)\!\nonumber\\&+\!\beta\varepsilon_i^2(I_{j,n'}\!+\!\sigma^2)(\lambda_n(I_{j,n'}\!+\!\sigma^2)\!-\!\varepsilon_j(1\!+\!\tau_{j,n}))\!+\!\beta^2\varepsilon_i^2\nonumber\\&(I_{j,n'}\!+\!\sigma^2)(\!-\!2\lambda_n(I_{j,n'}\!+\!\sigma^2)\!+\!3\varepsilon_j(1\!+\!\tau_{j,n})))\!-\!\alpha_{i,n}^2\varepsilon_i\nonumber\\&(\!-\!(\beta\!-\!1)\beta\varepsilon_i\lambda_n(\varepsilon_j\!+\!\sigma^2)^2\!+\!\varepsilon_j^2(I_{i,n'}\!+\!\sigma^2)(1\!+\!\tau_{i,n})\!+\!\varepsilon_j\nonumber\\&(I_{j,n'}\!+\!\sigma^2)(1\!+\!\tau_{i,n})\!+\!\varepsilon_j(I_{j,n'}\!+\!\sigma^2)(\!-\!\lambda_n(I_{i,n'}\!+\!\sigma^2)\nonumber\\&\!+\!3\beta^3\varepsilon_i(1\!+\!\tau_{j,n})\!-\!2\beta(\varepsilon_i\!-\!\lambda_n(I_{i,n'}\!+\!\sigma^2)+\!\varepsilon_i\tau_{j,n})))\nonumber \end{align} \begin{align} \Lambda_3=&\varepsilon_i\varepsilon_j\lambda_n(a_{i,n}^3(\beta\!-\!1)\beta\varepsilon_i(I_{j,n'}\!+\!\sigma^2)\!+\!\beta^2\varepsilon_i(I_{j,n'}+\sigma^2)\!\nonumber\\&+\!\alpha_{i,n}\beta(2\varepsilon_j(I_{i,n'}\!+\!\sigma^2)\!-\!(\beta\!-\!1)\varepsilon_i(I_{j,n'}\!+\!\sigma^2))\!\nonumber\\&-\!\alpha_{i,n}^2((2\beta\!-\!1)\varepsilon_j(I_{i,n'}\!+\!\sigma^2)\!+\!\beta^2\varepsilon_i(I_{j,n'}\!+\!\sigma^2)))\nonumber \end{align} \vspace{-0.2cm} \bibliographystyle{IEEEtran}
\section{Introduction} This paper discusses a distributed-memory library for the iterative solution of systems of linear algebraic equations of the form \begin{equation} Ax=b, \label{eq:Ax=b} \end{equation} where the matrix $A\in \mathbb{C}^{n\times n}$ is large, sparse, and (non-)Hermitian. Problems of this form typically originate from the discretization of a Partial Differential Equation in 2D or 3D domains. Iterative methods solve \eqref{eq:Ax=b} by a preconditioned Krylov subspace iterative methods \cite{saad_iterative_2003,van2003iterative}, e.g., preconditioned Conjugate Gradient \cite{saad_iterative_2003}, if $A$ is Hermitian and positive-definite, or GMRES \cite{saad_gmres_1986} if $A$ is non-Hermitian. The role of the preconditioner is to cluster the eigenvalues in an effort to accelerate the convergence of Krylov subspace method. For example, an efficient right preconditioner $M$ transforms \eqref{eq:Ax=b} into the preconditioned system $AM^{-1}(Mx)=b$, where $M^{-1}$ can be applied inexpensively. An additional requirement is that the setup and application of the operator $M^{-1}$ should be easily parallelizable. Similarly to Krylov subspace methods, algebraic multigrid (AMG) methods are another widely-used class of iterative solvers \cite{ruge_algebraic_1987}. AMG uses the ideas of interpolation and restriction to build multilevel preconditioners that eliminate the smooth error components. AMG is provably optimal for Poisson-like problems on regular meshes where the number of iterations to achieve convergence almost stays constant as the problem size increases. This property leads to appealing weak scaling results of AMG in distributed-memory computing environments \cite{henson_boomeramg_2002,cleary2000robustness,bell2012exposing}. However, AMG can fail when applied either to indefinite problems or irregular meshes. It is worth mentioning that AMG can also be used as a preconditioner in the context of Krylov subspace methods. For general sparse linear systems, a well-known class of general-purpose preconditioners is that of Incomplete LU (ILU) factorization preconditioners \cite{saad_ilut:_1994,chow1997experimental,saad_iterative_2003}. Here, the matrix $A$ is approximately factored as $A\approx LU$ where $L$ is lower triangular and $U$ is upper triangular, and the preconditioner is defined as $M=LU$. Applying $M^{-1}$ then consists of two triangular substitutions. ILU preconditioners can be applied to a greater selection of problems than AMG, including indefinite problems such as discretized Helmholtz equations \cite{ernst_why_2012,helmhotz}, and their robustness can be improved by modified/shifted ILU strategies \cite{magolu_preconditioning_2000,erlangga_comparison_2006,osei-kuffuor_preconditioning_2010}. On the other hand, the scalability of ILU preconditioned Krylov subspace methods is typically inferior compared to AMG. In particular, even for Poisson-like problems, the number of iterations to achieve convergence by ILU preconditioned Krylov subspace methods increases with respect to the matrix size. Moreover, the sequential nature of triangular substitutions limit the parallel efficiency of ILU preconditioners implemented on distributed-memory systems, and recent efforts have been focusing on improving their scalability, e.g., see \cite{anzt2018parilut,anzt2019parilut,chow_fine-grained_2015}. The parallel efficiency of ILU preconditioners can be enhanced by domain decomposition (DD), where the original problem is decomposed into several subdomains which correspond to different blocks of rows of the coefficient matrix $A$. The simplest DD-based ILU approach is the block-Jacobi ILU preconditioner, where a local ILU is performed on each local submatrix. Since this method ignores all of the off-diagonal matrices corresponding to inter-domain couplings, its convergence rate tends to become slower as the number of subdomains increases, and several strategies have been proposed to handle the inter-domain couplings in order to improve the convergence rate. Restricted Additive Schwarz (RAS) methods expand the local matrix by a certain level to gain a faster convergence rate at the cost of losing some memory scalability \cite{cai_restricted_1999}. Global factorization ILU methods factorize local rows corresponding to interior unknowns first, after which a global factorization of the couplings matrix is applied based on some graph algorithms \cite{hysom_efficient_1999,karypis_parallel_1997}. These methods use partial ILU techniques with dropping \cite{saad_bilutm_1999,li_parms:_2003}, incomplete triangular solve \cite{nievinski_parallel_2018}, and low-rank approximation \cite{dillon_hierarchical_2018} to form the Schur complement system and can be generalized into multilevel ILU approaches \cite{saad_bilutm_1999,li_parms:_2003,dillon_hierarchical_2018}. When the Finite Element method is used and the elements are known, two-level DD methods including BDDC \cite{mandel2003convergence} and FETI-DP \cite{farhat2001feti,heinlein2021combining}, as well as the GenEO preconditioner \cite{spillane2014abstract} are also have been shown to be effective approaches. We note that an additional strategy is to combine approximate direct factorization techniques with low-rank representation of matrix blocks \cite{amestoy2000mumps}, PasTix \cite{henon2002pastix}, and DDLR \cite{li_low-rank_2017}. When the matrix $A$ is SPD, it is possible to reduce the size of the Schur complement matrix without introducing any fill-in, e.g., see SpaND \cite{boman2020preconditioner}. Other preconditioning strategies that can be implemented on distributed-memory environments include the (factorized) sparse approximate inverse preconditioners \cite{benzi_sparse_1998,chow_approximate_1998,janna_block_2010,anzt2018incomplete,grote1997parallel}, polynomial preconditioners \cite{ye_preconditioning_2019}, and rank-structured preconditioners \cite{cai_smash_2018,hackbusch_sparse_1999,hackbusch_sparse_2000,xi_superfast_2014}; see also \cite{chen2018distributed} for a distributed-memory hierarchical solver. Some of the these techniques can be further compounded with AMG, as “smoothers", or ILU-based preconditioners. For example, a combination of SLR \cite{li_schur_2016} and polynomial preconditioning is discussed in \cite{ye_preconditioning_2019}. \subsection{Contributions of this paper} This paper discusses the implementation of a distributed-memory library, termed\footnote{The abbreviation of the library is derived by the complete name “parallel Generalized multilevel Schur complement Low-Rank preconditioner"} \texttt{parGeMSLR}, for the iterative solution of sparse systems of linear algebraic equations in large-scale distributed-memory computing environments. \texttt{parGeMSLR}\footnote{The source code can be found in \href{https://github.com/Hitenze/pargemslr}{https://github.com/Hitenze/pargemslr}} is written in C++, and communication among different processor groups is achieved by means of the Message Passing Interface standard (MPI). The \texttt{parGeMSLR} library is based on the Generalized Multilevel Schur complement Low-Rank (GeMSLR) algorithm described in \cite{dillon_hierarchical_2018}. GeMSLR applies a multilevel partitioning of the algebraic domain, and the variables associated with each level are divided into either interior or interface variables. The multilevel structure is built by applying a $p$-way graph partitioner to partition the induced subgraph associated with the interface variables of the preceding level. Once the multilevel partitioning is completed, GeMSLR creates a separate Schur complement approximate inverse at each level. Each approximate inverse is the sum of two terms, with the first term being an approximate inverse of the interface coupling matrix, and the second term being a low-rank correction which aims at bridging the gap between the first term and the actual Schur complement matrix inverse associated with that level. Below, we summarize the main features of the \texttt{parGeMSLR} library: \begin{enumerate} \item \textbf{Scalability}. \texttt{parGeMSLR} extends the capabilities of low-rank-based preconditioners, such as GeMSLR, by recursively partitioning the algebraic domain into levels which have the same number of partitions. In turn, this leads to enhanced scalability when running on distributed-memory environments. \item \textbf{Robustness and complex arithmetic}. In contrast to ILU preconditioners, the numerical method implemented in \texttt{parGeMSLR} is less sensitive to indefiniteness and can be updated on-the-fly without discarding previous computational efforts. Additionally, \texttt{parGeMSLR} supports complex arithmetic and thus can be utilized to solve complex linear systems such as those originating from the discretization of Helmholtz equations. \item \textbf{Hybrid hardware acceleration}. GPU acceleration is supported in several iterative solver libraries aiming to speed-up the application of preconditioners such as AMG or ILU, e.g., \texttt{hypre} \cite{falgout_hypre_2002}, \texttt{PARALUTION} \cite{paralution}, \texttt{ViennaCL} \cite{rupp2016viennacl}, \texttt{HIFLOW} \cite{hiflow3}, \texttt{PETSc} \cite{balay2001petsc}, and \texttt{Trilinos} \cite{trilinos-website}. A number of direct solver libraries including \texttt{STRUMPACK} \cite{ghysels2017robust,ghysels2016efficient,rouet2016distributed} and SuperLU \_DIST \cite{lidemmel03} also provide GPU support. Similarly, \texttt{parGeMSLR} can exploit one or more GPUs by offloading any computation for which the user provides a CUDA interface. \end{enumerate} This paper is organized as follows. Section~\ref{sec:alg} discusses low-rank correction preconditioners and provides an algorithmic description of \texttt{parGeMSLR}. Section~\ref{sec:dist} provides details on the multilevel reordering used by \texttt{parGeMSLR}. Section~\ref{sec:imp} presents in-depth discussion and details related to the implementation and parallel performance aspects of \texttt{parGeMSLR}. Section~\ref{sec:tests} demonstrates the performance of \texttt{parGeMSLR} on distributed-memory environments. Finally, our concluding remarks are presented in Section~\ref{sec:conclusion}. \section{Schur complement approximate inverse preconditioners via low-rank corrections}\label{sec:alg} This section discussed the main idea behind (multilevel) Schur complement preconditioners enhanced by low-rank corrections, e.g., see \cite{grigori:hal-01017448,li_schur_2016,dillon_hierarchical_2018,xi_algebraic_2016}. \subsection{The Schur complement viewpoint} Let the linear system $Ax=b$ be permuted as \begin{equation} \label{eq:A0} A_0x=P^TAP(P^Tx)=P^Tb, \end{equation} where $P$ is an $n\times n$ permutation matrix such that \begin{equation*} A_0= \begin{bmatrix} B & F \\ E & C \\ \end{bmatrix} = \begin{bmatrix} B^{(1)} & & & & F^{(1)} \\ & B^{(2)} & & & F^{(2)} \\ & & \ddots & & \vdots \\ & & & B^{(p)} & F^{(p)} \\ E^{(1)} & E^{(2)} &\cdots & E^{(p)} & C \\ \end{bmatrix}, \end{equation*} and the matrices $B^{(i)},\ F^{(i)}$, and $E^{(i)}$ are of size $d_i\times d_i,\ d_i \times s$, and $s\times d_i$, respectively. The matrix $C$ is of size $s\times s$, and the matrix partitioning satisfies $d+s=\sum\limits_{j=1}^{j=p}d_j+s_j=n$. Such matrix permutations can be computed by partitioning the adjacency graph of the matrix $|A|+\left|A^T\right|$ into $p\in \mathbb{N}$ non-overlapping partitions and reordering the unknowns/equations such that the variables associated with the $d$ interior nodes across all partitions are ordered before the variables associated with the $s$ interface nodes. Following the above notation, the linear system in (\ref{eq:A0}) can be written in a block form \begin{equation} \begin{bmatrix} B & F \\ E & C \\ \end{bmatrix} \begin{bmatrix} u \\ v \\ \end{bmatrix} = \begin{bmatrix} f \\ g \\ \end{bmatrix}, \label{eq:blockAx=b} \end{equation} where $u,f\in \mathbb{R}^d$ and $v,g\in \mathbb{R}^s$. Once the solution in (\ref{eq:blockAx=b}) is computed, the solution $x$ of the original, non-permuted system of linear algebraic equations $Ax=b$ can be obtained by the inverse permutation $x = P\begin{bmatrix} u \\ v \\ \end{bmatrix}$. Throughout the rest of this section we focus on the solution of the system in (\ref{eq:blockAx=b}). Following a block-LDU factorization of the matrix $A_0$, the permuted linear system in (\ref{eq:A0}) can be written as \begin{equation} \begin{bmatrix} I & \\ EB^{-1} & I \\ \end{bmatrix} \begin{bmatrix} B & \\ & S \\ \end{bmatrix} \begin{bmatrix} I & B^{-1} F \\ & I \end{bmatrix} \begin{bmatrix} u \\ v \\ \end{bmatrix} = \begin{bmatrix} f \\ g \\ \end{bmatrix}, \label{eq:blockldu_sec2} \end{equation} where $S=C-EB^{-1}F$ denotes the \emph{Schur complement matrix}. The solution of (\ref{eq:blockAx=b}) is then equal to \begin{equation*} \begin{bmatrix} u \\ v \\ \end{bmatrix} = \begin{bmatrix} I & -B^{-1}F \\ & I \\ \end{bmatrix} \begin{bmatrix} B^{-1} & \\ & S^{-1} \\ \end{bmatrix} \begin{bmatrix} I & \\ -EB^{-1} & I \\ \end{bmatrix}\begin{bmatrix} f \\ g \\ \end{bmatrix}, \label{eq:blockldusolve_sec2} \end{equation*} which requires: $a$) the solution of two linear systems with the block-diagonal matrix $B$, and $b$) the solution of one linear system with the the Schur complement matrix $S$. Note that since the matrix $B$ is block-diagonal, the associated linear systems are decoupled into $p$ independent systems of linear algebraic equations. Assuming a distributed-memory computing environment with $p$ separate processor groups, each system of linear algebraic equations can be solved in parallel by means of applying a direct solver locally in each separate process. In several real-world applications, e.g., those involving the discretization of PDEs on three-dimensional domains, solving the systems of linear algebraic equations with matrices $B$ and $S$ through a direct solver is generally impractical, primarily due to the large computational and memory cost associated with forming and factorizing the Schur complement matrix. An alternative then is to solve the linear systems with matrices $B$ and $S$ inexactly. For example, the solution of linear systems with matrix $B$ can be computed approximately by replacing its exact LU factorization with an incomplete threshold LU (ILUT) \cite{saad_ilut:_1994}. Likewise, the exact Schur complement can be sparsified by discarding entries below a certain threshold value or located outside a pre-determined pattern \cite{li_parms:_2003,rajamanickam2012shylu} The approximate factorizations of the matrices $B$ and $S$ can be combined to form an approximate LDU factorization of (\ref{eq:blockldu_sec2}) which can be then used as a preconditioner in a Krylov subspace iterative solver such as GMRES. \subsection{Schur complements and low-rank corrections} One of the main drawbacks associated with incomplete factorizations is that they can not be easily updated if one needs a more accurate preconditioner {unless the iterative ParILUT \cite{anzt2018parilut,anzt2019parilut} works for the problem and is used}. Moreover, their robustness can be limited when the matrix $A$ is indefinite. For such scenarios, it has been advocated to add a \emph{low-rank correction term} to enhance the efficiency of the Schur complement preconditioner, without discarding the previously computed incomplete factorizations. The low-rank enhancement implemented in \texttt{parGeMSLR} follows the GeMSLR multilevel preconditioner \cite{dillon_hierarchical_2018}, a non-Hermitian extension of \cite{li_schur_2016,xi_algebraic_2016}. Other approaches based on low-rank corrections can be found in \cite{grigori:hal-01017448,daas2021two}. The GeMSLR preconditioner expresses the Schur complement matrix as \begin{equation} \label{eq:gemslr1} S = (I-EB^{-1}FC^{-1})C = (I-G)C, \end{equation} where $G=EB^{-1}FC^{-1}$. Consider now the complex Schur decomposition $G = WRW^H$, where the $s\times s$ matrix $W$ is unitary and the $s\times s$ matrix $R$ is upper-triangular such that its diagonal entries contain the eigenvalues of matrix $G$. Plugging the latter in (\ref{eq:gemslr1}) results to \begin{equation*}\label{eq:gemslr3} S = (I-WRW^H)C = W(I-R)W^HC, \end{equation*} from which we can write the inverse of the Schur complement matrix as (Sherman-Morrison-Woodbury formula): \begin{equation}\label{eq:gemslr4} S^{-1} = C^{-1}+C^{-1}W[(I-R)^{-1}-I]W^H. \end{equation} Following (\ref{eq:gemslr4}), a system of linear equations with the Schur complement matrix requires the solution of a system of linear equations with matrix $C$, as well as matrix-vector multiplications and triangular matrix inversions with matrices $W$/$W^H$ and $(I-R)^{-1}$, respectively. The product of matrices $W[(I-R)^{-1}-I]W^H$ is a Schur decomposition by itself, with corresponding eigenvalues $\gamma_i/(1-\gamma_i),\ i=1,\ldots,s$, where $\gamma_i$ denotes the $i$-th eigenvalue of the matrix $G$. Therefore, as long as the eigenvalues of the latter matrix are not located close to one, the matrix $C(S^{-1}-C^{-1})=W[(I-R)^{-1}-I]W^H$ can be approximated by a low-rank matrix, i.e., $S^{-1}$ is approximately equal to $C^{-1}$ plus some low-rank correction. The expression in (\ref{eq:gemslr4}) can be transformed into a practical preconditioner if the matrix $W[(I-R)^{-1}-I]W^H$ is replaced by a rank-$k$ approximation, where $k\in \mathbb{N}$ is generally a user-given parameter. More specifically, let $W_k$ denote the $s\times k$ matrix which holds the leading $k$ Schur vectors of matrix $G$, and let $R_k$ denote the $k\times k$ leading principal submatrix of matrix $R$. Then, the GeMSLR approximate inverse preconditioner is equal to \begin{equation}\label{eq:gemslr6} M^{-1} = C^{-1}+C^{-1}W_k[(I-R_k)^{-1}-I]W_k^H \approx S^{-1}. \end{equation} \subsection{Computations with an incomplete factorization of $B$} For large-scale problems, computing an exact factorization of the block-diagonal matrix $B$ can be quite expensive. Instead, what is typically available is an ILUT factorization $LU\approx B$. Therefore, instead of computing a rank-$k$ Schur decomposition of matrix $G$, in practice we approximate a truncated Schur decomposition of the matrix $\widehat{G}=E(U^{-1}L^{-1})FC^{-1}$. Let then \begin{equation*} \widehat{G} \widehat{V}_{m} = \widehat{V}_{m}\widehat{H}_{m} + \beta_m \widehat{v}_{m+1}e_m^H, \end{equation*} denote an $m$-length Arnoldi relation obtained with matrix $\widehat{G}$, where $[\widehat{V}_{m},\widehat{v}_{m+1}]^H[\widehat{V}_m,\widehat{v}_{m+1}]=I$, and $\widehat{H}_{m}$ is upper-Hessenberg. Moreover, let $\widehat{H}_m=QTQ^H$ denote the complex Schur decomposition of matrix $\widehat{H}_m$. The low-rank correction term used in GeMSLR is of the form $\widehat{W}_k[(I-\widehat{R}_k)^{-1}-I]\widehat{W}_k^H$, where $T_k\in \mathbb{R}^{k\times k}$ denotes the $k\times k$ leading principal submatrix of matrix $T$, and $\widehat{W}_k=\widehat{V}_mQ_k$, where $Q_k \in \mathbb{R}^{s\times k}$ denotes the matrix holding the $k$ leading Schur vectors of matrix $\widehat{H}_m$. \subsection{Multilevel extensions} For large-scale, high-dimensional problems, the application of the matrix $C^{-1}$ by means of an LU factorization of matrix $C$ can still be expensive; especially when the value of $p$ is too large, leading to large vertex separators. The idea suggested in \cite{xi_algebraic_2016,li_low-rank_2017}, and employed by GeMSLR, is to take advantage of the purely algebraic formulation developed in the previous section and apply $C^{-1}$ inexactly by using the Schur complement low-rank preconditioner described in the previous section. In fact, this approach can be repeated more than once, leading to a multilevel preconditioner. More specifically, let $l_{ev}\in \mathbb{N}$ denote the number of levels, and define the sequence of matrices \begin{equation} A_l=P_{l-1} C_{l-1} P_{l-1} = \begin{bmatrix} B_l & F_l\\ E_l & C_l\\ \end{bmatrix},\ \ \ \ C_{-1}=A,\ \ \ \ l=0,1,\ldots,l_{ev}-1, \end{equation} where the matrix $B_l$ is block-diagonal with $p$ on-diagonal matrix blocks. The $2\times 2$ block matrix partition of each matrix $A_l$ is obtained by partitioning the adjacency graph of the matrix $|C_{l-1}|+ |C_{l-1}^T|$ into $p$ non-overlapping partitions and reordering the unknowns/equations such that the variables associated with the interior nodes across all partitions are ordered before the variables associated with the interface nodes of the adjacency graph. The matrix $C_{l-1}$ is then permuted in-place through the $s_{l-1}\times s_{l-1}$ permutation matrix $P_{l-1}$, where $s_{l-1}$ denotes the size of the matrix $C_{l-1}$. The solution of a system of linear algebraic equations with matrix $A_l$ as the coefficient matrix and $\begin{bmatrix} f_l^T & g_l^T \end{bmatrix}^T$ as the right-hand side, can be computed as \begin{equation*} \begin{bmatrix} u_l \\ v_l \\ \end{bmatrix} = \begin{bmatrix} I & -B_{l}^{-1}F_{l} \\ & I \\ \end{bmatrix} \begin{bmatrix} B_{l}^{-1} & \\ & S_{l}^{-1} \\ \end{bmatrix} \begin{bmatrix} I & \\ -E_{l}B_{l}^{-1} & I \\ \end{bmatrix} \begin{bmatrix} f_l \\ g_l \\ \end{bmatrix}, \label{eq:blockldusolve_sec22} \end{equation*} where $S_l = C_l-E_lB_l^{-1}F_l$ denotes the $s_l\times s_l$ Schur complement matrix associated with the $l$-th level, where $s_l\in \mathbb{N}$ denotes the size of the matrix $C_l$. Instead of computing the exact LU factorizations of matrices $B_l$ and $S_l$, the preconditioner implemented in the \texttt{parGeMSLR} library substitutes $B_l^{-1}\approx (L_lU_l)^{-1}$, where $L_lU_l$ denotes an ILUT factorization of matrix $B_l$, and \begin{equation}\label{eq:gemslr5} S_l^{-1} \approx C_l^{-1}+C_l^{-1}W_{l,k}[(I-R_{l,k})^{-1}-I]W_{l,k}^H, \end{equation} where $\widehat{W}_{l,k}$ denotes the matrix which holds the approximate leading $k$ Schur vectors of the matrix $\widehat{G}_l=E^T_lU_l^{-1}L_l^{-1}F_lC_l^{-1}$, and $\widehat{R}_{l,k}$ denotes the approximation of the $k\times k$ leading principal submatrix of the matrix $\widehat{R}_l$ that satisfis the Schur decomposition $\widehat{G}_l=\widehat{W}_l\widehat{R}_l\widehat{W}_l^H$. Algorithm~\ref{alg:gemslrsetup} summarizes the above discussion (“setup phase") in the form of an algorithm. Notice that the recursion stops at level $l_{ev}-1$, and an ILUT of the matrix $C_{l_{ev}-1}$ is computed explicitly. \begin{algorithm} \caption{Parallel GeMSLR Setup}\label{alg:gemslrsetup} \begin{algorithmic}[1] \Procedure{pGeMSLRSetup}{$A,l_{ev}$} \State Generate $l_{ev}$-level structure by Algorithm \ref{alg:gemslrreorder}. \For {$l$ from 0 to $l_{ev}-1$} \State Compute ILU factorization $L_{l}U_{l}\approx B_{l}$. \State Compute matrices $\widehat{W}_{l,k}$ and $\widehat{R}_{l,k}$. \State If $l=l_{ev}-1$, compute an ILUT factorization $L_{l_{ev}-1}U_{l_{ev}-1}\approx C_{l_{ev}-1}$; exit. \EndFor \EndProcedure \end{algorithmic} \end{algorithm} Algorithm~\ref{alg:gemslrsolve} outlines the procedure associated with the application of the GeMSLR preconditioner (“solve phase"). At each level, the preconditioning step consists of a forward and backward substitution with the ILUT triangular factors of $B_l$, followed by the application of the rank-$k$ correction term. When $l=l_{ev}-1$, there is no low-rank correction term applied, since this is the last level. Moreover, when $l=0$ (root level), it is possible to enhance the GeMSLR preconditioner by applying a few steps of right preconditioned GMRES. Note though that these iterations are performed with the inexact Schur complement $\widehat{S}_l=C_l-E_l(U^{-1}L^{-1})F_l$. \begin{algorithm} \caption{Standard Parallel GeMSLR Solve}\label{alg:gemslrsolve} \begin{algorithmic}[1] \Procedure{pGeMSLRSolve}{$b,l$} \State Apply reordering $\begin{bmatrix}b_1\\b_2\\\end{bmatrix}=P_{l-1}b$. \State Solve $z_1 = U_l^{-1}L_l^{-1}b_1$. \State Compute $z_2 = b_2 - E_lz_1$. \If {$l=0$} \State Solve $\widehat{S}_ly_2=z_2$ by right preconditioned GMRES. \Else \State Compute $u_2 = \widehat{W}_{l,k}[(I-\widehat{R}_{l,k})^{-1}-I]\widehat{W}_{l,k}^Hz_2$ \State Call $y_2$ = pGeMSLRSolve($u_2+z_2, l+1$). \EndIf \State Compute $y_1 = z_1 - U_l^{-1}L_l^{-1}F_ly_2$. \State Apply reordering $q=P_{l-1}\begin{bmatrix}y_1\\y_2\\\end{bmatrix}$. \State \Return $x$ \EndProcedure \end{algorithmic} \end{algorithm} \section{Multilevel reordering}\label{sec:dist} This section outlines the multilevel reordering approach implemented in the \texttt{parGeMSLR} library. For simplicity, we focus on symmetric reorderings obtained by applying a $p$-way vertex separator to the adjacency graph associated with the matrices $|C_{l-1}|+|C_{l-1}^T|,\ l=0,\ldots,l_{ev}-1,\ C_{-1}=A$, \cite{karypis_fast_1998,catalyurek_hypergraph-partitioning-based_1999,CHACO,SCOTCH}. In particular, given a graph $G=(V,E)$, a $p$-way vertex separator computes a separator ${\cal S}\subset V$ and $p$ non-overlapping (disjoint) sets $V_1,\ldots,V_p \subset V$ such that $V_1\cup\ldots \cup V_p \cup {\cal S}=V$ and there are no edges connecting the sets $V_i$ and $V_j$ when $i\neq j$. \begin{algorithm} \caption{Parallel GeMSLR Reordering}\label{alg:gemslrreorder} \begin{algorithmic}[1] \Procedure{pGeMSLRReordering}{$A,l_{ev}$} \State Set $C_{-1}\equiv A$. \For {$l$ from $0$ to $l_{ev}-1$} \State Apply $p$-way partitioning to the graph associated with the matrix $|C_{l-1}|+|C_{l-1}^T|$. \State Set $A_{l}=P_{l-1}C_{l-1}P_{l-1}=\begin{bmatrix}B_l & F_l \\ E_l & C_l\\\end{bmatrix}$. \EndFor \State \Return \EndProcedure \end{algorithmic} \end{algorithm} \subsection{Hierarchical Interface Decomposition} The GeMSLR preconditioner relies on a Hierarchical Interface Decomposition (HID) \cite{henon2006parallel} to reduce the setup cost of the ILU and low-rank correction parts associated with the setup phase of the preconditioner. The main idea behind HID is to partition the adjacency graph of $|A|+|A^T|$ into $2^{l_{ev}}$ partitions via nested dissection with a recursion depth of $l_{ev}$. The vertex separators at level $l$ are disjoint with each other since they are divided by vertex separators from higher levels. When ordered by levels, the global permutation of matrix $A$ will have a block-diagonal structure with $2^{l_{ev}-l}$ blocks at level $0\leq l \leq l_{ev}-1$, i.e., the number of diagonal blocks at each level reduce by a factor of two. \subsection{Multilevel partitioning through $p$-way vertex separators} In contrast to low-rank correction preconditioners such as MSLR and GeMSLR \cite{xi_algebraic_2016,dillon_hierarchical_2018}, the main goal of \texttt{parGeMSLR} is to sustain good parallel efficiency, and thus HID is not appropriate.\footnote{Nonetheless, HID is offered in \texttt{parGeMSLR}.} Instead, the default approach in \texttt{parGeMSLR} is to partition the adjacency graph by a multi-level partitioner where each level consists of $p$ partitions and a vertex separator. The latter choice results to a \emph{fixed number of $p$ partitions at each level}, and thus load balancing is generally much better than that obtained using HID. \begin{figure*}[!htb] \centering \includegraphics[width=.3\linewidth]{3ddomain1_3.pdf} \includegraphics[width=.3\linewidth]{3ddomain2_3.pdf} \includegraphics[width=.3\linewidth]{3ddomain3_new.pdf} \caption{Left: a three-dimensional domain partitioned into $p=4$ subdomains. The vertex separator consists of four faces, with each face located between neighboring subdomains. Center: partitioning of the root-level separator into $p=4$ subdomains. Right: partitioning of the vertex separator at the second level.} \label{fig:separator} \end{figure*} A high-level description can be found in Algorithm~\ref{alg:gemslrreorder}. At the root level ($l=0$), the graph associated with the matrix $|A|+|A^T|$, is partitioned into $p$ subdomains with a $p$-way vertex separator, resulting to $p$ non-overlapping connected components and their associated vertex separator. The multilevel partitioner then proceeds to the next level, $l=1$, and applies the $p$-way vertex partitioner to the induced subgraph associated with the vertex separator at level $l=0$. This leads to a second set of $p$ non-overlapping connected components and a new, albeit smaller vertex separator. The $p$-way vertex partitioner is then applied again to the induced subgraph associated with the vertex separator obtained at level $l=1$, etc. The procedure continues until either level $l_{ev}-1$ is reached, or the vertex separator at the current level $l$ has so few vertices that it can not be further partitioned into $p$ non-overlapping partitions. An illustration of a three-level, four-way partitioner applied to a three-dimensional algebraic domain (a unit cube) is shown in Figure \ref{fig:separator}. The leftmost subfigure shows the $p=4$ separate partitions obtained by the application of the four-way vertex partitioner as well as the vertex separator itself (shown in white color) at level $l=0$. This vertex separator, which consists of four two-dimensional faces, forms the algebraic object to be partitioned at level $l=1$, and the partitioning is shown in the middle subfigure, where this time the vertex separator is a one-dimensional object. Finally, at level $l=2$, the most recent vertex separator is further partitioned into four independent partitions, leading to a new vertex separator which consists of only three vertices; see the rightmost subfigure. In addition to the above illustration, Figure \ref{fig:reordering} plots the sparsity pattern of a Finite Difference discretization of the Laplace operator on a three-dimensional domain, after reordering its rows and columns according to a $p$-way, multilevel reordering with $l_{ev}=4$ and $p=4$ (left). A zoom-in of the submatrix associated with the permutation of the vertex separators is also shown (right). Note that in this particular example, the last level has already too few variables to be partitioned any further. In addition to the global, multilevel permutation, each matrix $B_l$ can be further permuted locally by a reordering scheme such as reverse Cuthill-Mckee (RCM) algorithm or approximate minimal degree algorithm (AMD) \cite{amestoy_approximate_1996,george_computer_1981} to reduce the fill-ins. \begin{figure*} \centering \includegraphics[width=.45\linewidth]{reordering1.pdf} \includegraphics[width=.45\linewidth]{reordering2.pdf} \caption{Left: global permutation of matrix $A$ following a multilevel partitioning with $l_{ev}=4$ and $p=4$. Right: zoom-in at the submatrix associated with the permutation of the vertex separators (right-bottom submatrix of the left subfigure).} \label{fig:reordering} \end{figure*} \section{Implementation details of \texttt{parGeMSLR}}\label{sec:imp} The \texttt{parGeMSLR} library consists of three main modules: $a)$ a distributed-memory reordering scheme, $b)$ a Krylov subspace iterative accelerator, and $c)$ the setup and application of the GeMSLR preconditioner. The first module was described in greater detail in Section \ref{sec:dist}, and is implemented through a distributed-memory partitioner such as ParMETIS. Additional point-to-point communication between neighboring partitions, as well as a single All-to-All message are required (to find the new neighbors of each partition post-partitioning). Next, we focus on the implementation of the other two modules in a distributed-memory environment where different processor groups communicate via MPI. \subsection{Distributed-memory operations in Krylov accelerators} Standard, non-preconditioned Krylov iterative methods are built on top of simple linear algebraic operations such as matrix-vector multiplication, vector scaling and additions, and DOT products. Iterative solvers such as GMRES or FGMRES also require the solution of small-scale ordinary linear-least squares problems which are typically solved redundantly in each MPI process. Assuming that the data associated with the system of linear algebraic equations we wish to solve is already distributed across the different MPI process via 1D row distribution, AXPY operations can be executed locally and involve no communication overhead. On the other hand, sparse matrix-vector multiplications and DOT products involve either point-to-point or collective communication. In particular, assume $n_p \in \mathbb{N}$ MPI processes. A DOT product then requires a collective operation, i.e., {\tt MPI\_Allreduce}, to sum the $n_p$ local DOT products. The cost of this operation is roughly $O(log(n_p)\alpha)$, where $\alpha \in \mathbb{R}$ denotes the maximum latency between two MPI process. On the other hand, a matrix-vector multiplication with the coefficient matrix of the linear system requires point-to-point communication, where the local matrix-vector product in each MPI process consists of operations using local data, as well as data associated with MPI processes which are assigned to neighboring subdomains, e.g., see \cite{bienz2019node} for additional details and recent advances. \subsection{Preconditioner setup and application} The main module of \texttt{parGeMSLR} is the setup of the GeMSLR preconditioner, followed by the application of the latter at each iteration of the Krylov subspace iterative solver of choice. Following a multilevel partition into $l_{ev}$ levels (see Section \ref{sec:dist}), the setup phase of the GeMSLR preconditioner associated with each level $l=0,1,\ldots,l_{ev}-1$, is further divided into two separate submodules: $a)$ computation of an ILUT factorization $B_l\approx L_lU_l$, and $b)$ computation of an approximate rank-$k$ Schur decomposition of the matrix $\widehat{G}_l=E_l^TU_l^{-1}L_l^{-1}F_lC_l^{-1}$. Let us consider each one of the above two tasks separately. Recall that the data matrix at each level $0\leq l \leq l_{ev}-1$ has the following pattern \begin{equation*} A_l=P_lC_{l-1}P_l= \begin{bmatrix} B_l & F_l \\ E_l & C_l \\ \end{bmatrix} = \begin{bmatrix} B_l^{(1)} & & & & F_l^{(1)} \\ & B_l^{(2)} & & & F_l^{(2)} \\ & & \ddots & & \vdots \\ & & & B_l^{(p)} & F_l^{(p)} \\ E_l^{(1)} & E_l^{(2)} &\cdots & E_l^{(p)} & C_l \\ \end{bmatrix}. \end{equation*} Now, without loss of generality, assume that each partition is assigned to a separate MPI process. Figure \ref{fig:lwrank1} (left) plots a graphical illustration of the data layout of matrix $A_l$ obtained by a permutation using $p=4$, across four different MPI processes. Data associated with separate MPI processes are presented with a different color. Notice that the right-bottom submatrix denotes the matrix $C_l$ representing the coupling between variables of the vertex separator at level $l$. Computing an ILUT factorization of the matrix $B_l$ decouples into $p$ independent ILUT subproblems $B_l^{(j)}\approx L_l^{(j)}U_l^{(j)},\ j=1,\ldots,p$, and thus no communication overhead is enabled. On the other hand, the computation of the low-rank correction term requires the application of several steps of the Arnoldi iteration, and requires communication overhead. \begin{figure*}[htbp] \centering \includegraphics[width=0.47\linewidth]{lowrank1.pdf} \includegraphics[width=0.47\linewidth]{lowrank2.pdf} \caption{Left: layout of the matrix correction term across four MPI processes (same for any level $0\leq l \leq l_{ev}-1$). Right: layout of a rank-$k$ correction term across four MPI processes (same for any level $0\leq l <l_{ev}-1$).} \label{fig:lwrank1} \end{figure*} More specifically, the Arnoldi iteration requires communication among the various MPI processes to compute matrix-vector multiplications with the iteration matrix $\widehat{G}_l$, as well as to maintain orthogonality of the Krylov basis. When the latter is achieved by means of standard Gram-Schmidt, Arnoldi requires one {\tt MPI\_Allreduce} operation at each iteration. Similarly, the matrix-vector multiplication between $\widehat{G}_l$ and a vector $z$ is equal to \begin{equation*} \begin{bmatrix}E_l^{(1)} &\cdots & E_l^{(p)}\end{bmatrix} \begin{bmatrix} L_l^{(1)}U_l^{(1)} & & \\ & \ddots & \\ & & L_l^{(p)}U_l^{(p)} \\ \end{bmatrix}^{-1} \begin{bmatrix} F_l^{(1)} \\ \vdots \\ F_l^{(p)} \\ \end{bmatrix} C_l^{-1}z. \end{equation*} The computation of the product $C_l^{-1}z$ requires access to the incomplete ILUT factorizations and rank-$k$ correction terms associated with all levels $l<\widehat{l}\leq l_{ev}-1$. Therefore, the rank-$k$ correction terms are built in a bottom-up fashion, from $l=l_{ev}-1$ to $l=0$, so that level $l$ has immediate access to the data associated with all levels $\widehat{l}>l$. Once the matrix-vector multiplication $C_l^{-1}z$ is computed, the matrix-vector multiplication with matrix $F_l$ is computed with trivial parallelism among the MPI processes, and the same holds for the linear system solutions with matrices $L_l^{(j)},\ U_l^{(j)},\ j=1,\ldots,p$. Finally, the matrix-vector multiplication with matrix $E_l$ requires an {\tt MPI\_Allreduce} operation. Note though that if we were to replace vertex separators with edge separators (this option is included in \texttt{parGeMSLR}) then the latter multiplication would also be communication-free. Finally, applying the preconditioner requires embarrassingly parallel triangular substitutions with the ILUT factorizations of the block-diagonal matrices $B_l$ as well as dense matrix-vector multiplications with matrices $\widehat{W}_{l,k},\ \widehat{W}_{l,k}^H$, and $(I-\widehat{R}_{l,k})^{-1}$. A matrix-vector multiplication with the matrix $\widehat{W}_{l,k}$ requires no communication among the MPI processes, while a matrix-vector multiplication with the matrix $\widehat{W}_{l,k}^H$ requires an {\tt MPI\_Allreduce} operation at level $l$. Finally, the matrix-vector multiplication with the $k\times k$ matrix $(I-\widehat{R}_{l,k})^{-1}$ is performed redundantly in each MPI process since $k$ is typically pretty small. \subsubsection{Communication overhead analysis} In this section we focus on the communication overhead associated with setting up and applying the preconditioner implemented in \texttt{parGeMSLR}. For simplicity, we assume that the number of MPI processes $n_p$ is equal to the number of partitions $p$ at each level. The main parameters of the preconditioner are the number of levels $l_{ev}$ and the value of rank $k$. Let us first consider the application of $m$ Arnoldi iterations to compute the matrices $\widehat{W}_{l,k}$ and $(I-\widehat{R}_{l,k})^{-1}$ for some $0\leq l \leq l_{ev}-1$. As was discussed in the previous section, computing matrix-vector products with the matrix $\widehat{G}_l$ requires communication only during the application of the matrices $E_l$ and $C_l^{-1}$. In turn, the latter requires computations with the distributed matrices $C_{l+1}^{-1},\ W_{l+1,k}^H,\ C_{l+2}^{-1},\ W_{l+2,k}^H$, and so on, until we reach level $l_{ev}-1$ where an ILUT of the matrix $C_{l_{ev}-1}$ is computed explicitly. Thus, a matrix-vector multiplication with the matrix $\widehat{G}_l$ requires $l_{ev}-(l+1)$ (low-rank correction term) and $l_{ev}-l$ ($C_{l}^{-1}$ recursion) {\tt MPI\_Allreduce} operations. In summary, an $m$-length Arnoldi cycle with standard Gram-Schmidt orthonormalization requires $(2l_{ev}-2l+1)m$ {\tt MPI\_Allreduce} operations, where we also accounted for the two {\tt MPI\_Allreduce} operations stemming by Gram-Schmidt and vector normalization at each iteration. This communication overhead is inversely proportional to the level index $l$. Accounting for all $l_{ev}-1$ levels, the total communication overhead associated with the setup phase of the preconditioner amounts is bounded by $\delta(k) \sum_{l=0}^{l=l_{ev}-1}(2l_{ev}-2l+1)m$ {\tt MPI\_Allreduce} operations, where $\delta(k)\in \mathbb{N}$ denotes the maximum number of cycles performed by Arnoldi at any level. In \texttt{parGeMSLR}, the default cycle length is $m=2k$ iterations. Finally, after the set up phase, one full application of the preconditioner implemented in the \texttt{parGeMSLR} library requires $2(l_{ev}-l)+1$ {\tt MPI\_Allreduce} operations. The analysis presented in this section demonstrates that the communication overhead associated with the construction of the GeMSLR preconditioner is directly proportional to an increase in the value of $l_{ev}$. On the other hand, increasing the value of $l_{ev}$ can reduce the computational complexity associated with setting up the GeMSLR preconditioner in lower levels. Nonetheless, the value of $l_{ev}$ can not be too large, especially when the value of $p$ is large, since the size of the vertex separator reduces dramatically between successive levels (as is demonstrated in Figure \ref{fig:separator}). \subsection{Applying $C_{l_{ev}-1}^{-1}$} Due to partitioning with a multilevel vertex separator, the matrix $C_{l_{ev}-1}$ forms a separate partition which is replicated among all MPI processes. Therefore, the simplest approach to apply $C_{l_{ev}-1}^{-1}$ is to do so approximately, through computing an ILUT redundantly in each MPI process. However, for large problems, this approach can quickly become impractical, even if a shared-memory variant of ILUT is considered \cite{anzt2018parilut}. On the other hand, applying a distributed-memory approach that requires communication among the MPI processes can lead to high communication overhead since the application of $C_{l_{ev}-1}^{-1}$ is the most common operation during the setup phase of the preconditioner. \texttt{parGeMSLR} includes several\footnote{See section 2.1 in \url{https://github.com/Hitenze/pargemslr/blob/main/ParGeMSLR/DOCS/Documentation.pdf}} options to apply an approximation of $C_{l_{ev}-1}^{-1}$. The default option considered throughout our experiments is to apply $C_{l_{ev}-1}^{-1}$ approximately through a block-Jacobi approach where $C_{l_{ev}-1}$ is first permuted by reverse RCM and then replaced by its on-diagonal block submatrices while the rest of the entries are discarded. Generally speaking, dropping these entries of $C_{l_{ev}-1}^{-1}$ has minor effects since $C_{l_{ev}-1}$ is already close to being block-diagonal for modest values of $l_{ev}$ (e.g., three or four) as was already demonstrated in Figure \ref{fig:separator}. By default, the number of retained on-diagonal blocks of matrix $C_{l_{ev}-1}$ is set equal to $p$. The approximate application of $C_{l_{ev}-1}^{-1}$ is then trivially parallel among the MPI processes, and each one of the retained on-diagonal blocks is applied through ILUT. \section{Numerical Experiments}\label{sec:tests} In this section we demonstrate the parallel performance of \texttt{parGeMSLR}. We run our experiments on the \textsc{Quartz} cluster of Lawrence Livermore National Laboratory. Each node of \textsc{Quartz} has 128 GB memory and consists of 2 Intel Xeon E5-2695 CPUs with 36 cores in total. We use MVAPICH2 2.2.3, to compile \texttt{parGeMSLR} is compiled with MVAPICH2 2.2.3, following rank-to-core binding. By default, all of the experiments presented below are executed in double-precision.\footnote{We note though that \texttt{parGeMSLR} supports both real and complex arithmetic, as well as both single and double precision.} On top of distributed-memory parallelism, \texttt{parGeMSLR} can take advantage of shared memory parallelism using either OpenMP or CUDA. The current version of \texttt{parGeMSLR} uses LAPACK for sequential matrix decompositions and ParMETIS for distributed graph partitioning \cite{karypis_fast_1998}. A detailed documentation of \texttt{parGeMSLR} can be found in the “DOCS" directory of \url{https://github.com/Hitenze/pargemslr}. This documentation provides detailed information on how to compile and run \texttt{parGeMSLR}, and includes a detailed description of all command-line parameters as well as visualization of the source code hierarchy. Several test drivers, and a sample input file, are also included. Throughout the rest of this section, we choose Flexible GMRES (FGMRES) with a fixed restart size of fifty as the outer iterative solver. The motivation for using FGMRES instead of GMRES is that the application of the preconditioner is subject to variations due to the application of the inner solver in step 9 of Algorithm~\ref{alg:gemslrsolve}. The stopping tolerance for the relative residual norm in FGMRES is set equal to $1.0{\tt e}-6$. Unless mentioned otherwise, the solution of the linear system $Ax=b$ will be equal to the vector of all ones with an initial approximation equal to zero. The low-rank correction term at each level consists of approximate Schur vectors such that the corresponding approximate eigenvalues are accurate to two digits of accuracy, and the restart cycle of thick-restart Arnoldi is equal to $2k$. Our distributed-memory experiments focus on the parallel efficiency of \texttt{parGeMSLR} both when the problem size remains fixed and $n_p$ increases (strong scaling) and the problem size increases at the same rate with $n_p$. In the case of weak scaling, the parallel efficiency is equal to $\frac{T_1}{T_{n_p}}$, where $T_1$ and $T_{n_p}$ denote the wall-clock time achieved by the sequential and distributed-memory version (using $n_p$ MPI processes) of \texttt{parGeMSLR}, respectively. Likewise, in the case of strong scaling, the parallel efficiency is equal to $\frac{T_1}{n_pT_{n_p}}$. In addition, we also compare \texttt{parGeMSLR} against: $a$) the BoomerAMG parallel implementation of the algebraic multigrid method in \texttt{hypre}, and $b$) the two-level SchurILU approach in \cite{li_parms:_2003}. The latter preconditioner uses partial ILU to form an approximation of the Schur complement matrix. The preconditioning step is then performed by applying GMRES with block-Jacobi preconditioning to solve the linear system associated with the sparsified Schur complement. The block-Jacobi preconditioner is applied through one step of ILUT, and our implementation of SchurILU is based on the parallel ILU(T) in hypre. Throughout the rest of this section, we adopt the following notation: \begin{itemize} \itemsep-0.2em \item $\mathbf{n_p}\in \mathbb{N}$: total number of MPI processes. \item $\mathbf{fill}\in \mathbb{R}$: ratio between the number of non-zero entries of the preconditioner and that of matrix $A$. \item {\bf p-t} $\in \mathbb{R}$: preconditioner setup time. This includes the time required to compute the ILUT factorizations and low-rank correction terms in \texttt{parGeMSLR}. \item {\bf i-t} $\in \mathbb{R}$: iteration time of FGMRES. \item $\mathbf{its}\in \mathbb{N}$: total number of FGMRES iterations. \item $\mathbf{k}\in \mathbb{N}$: number of low-rank correction terms at each level. \item $\mathbf{F}$: flag signaling that FGMRES failed to converge within 1000 iterations. \end{itemize} \subsection{A Model Problem}\label{sec:p1} This section considers a Finite Difference discretization of the model problem \begin{eqnarray} \label{eq:test_problem_1} -\Delta u - cu &=& f \ \ \text{in} \ \Omega, \nonumber \\ u &=& 0 \ \ \text{on} \ \partial \Omega. \end{eqnarray} We consider a 7-pt stencil and set $\Omega = (0,1)^3$. \subsubsection{Weak scaling} Our first set of experiments studies the weak scaling efficiency of \texttt{parGeMSLR}. Since varying the values of $l_{ev}$ and $k$ lead to different convergence rates, we first consider the case where the number of FGMRES iterations is set equal to thirty, regardless of whether convergence was achieved or not. The problem size on each MPI process is fixed to $50^3$, while the number of subdomains at each level is set equal to $8\times n_p$. Moreover, the number of levels is varied as $l_{ev}\in \{2,3\}$ while the rank of the low-rank correction terms is varied as $k\in \{0,100,200\}$. \begin{figure}[ht] \centering \begin{subfigure}[b]{0.95\linewidth} \centering \includegraphics[width=1.\linewidth]{WS1_Lap_Schur_reordering.pdf} \end{subfigure} \begin{subfigure}[b]{0.95\linewidth} \centering \includegraphics[width=1.\linewidth]{WS1_Lap_Schur_setup.pdf} \end{subfigure} \begin{subfigure}[b]{0.95\linewidth} \centering \includegraphics[width=1.\linewidth]{WS1_Lap_Schur_solve.pdf} \end{subfigure} \caption{Weak scaling of \texttt{parGeMSLR} for the Poisson problem when the number of iterations performed by FGMRES is fixed to thirty, and the number of levels is set to $l_{ev}=2$ and $l_{ev}=3$. The number of unknowns on each MPI process is $125,000$, for a maximum problem size $n=800\times400\times400$.} \label{fig:ws_pi} \end{figure} Figure~\ref{fig:ws_pi} plots the weak scaling efficiency of \texttt{parGeMSLR} on up to $n_p=1,024$ MPI processes. The achieved efficiency is similar for both options of $l_{ev}$ with a slightly higher efficiency observed for the case $l_{ev}=3$. As expected, the highest efficiency achieved during the preconditioner setup phase was for the case $k=0$, since there is no communication overhead stemming from the low-rank correction terms. Nonetheless, even in this case there is some loss in efficiency due to load imbalancing introduced by the ILUT factorizations at different levels. Regardless of the value of $k$, the efficiency of \texttt{parGeMSLR} drops the most when the number of MPI processes is small, regardless of the value of $l_{ev}$. This reduction is owed to the relatively large increase on the size of the local Schur complement versus when a larger number of MPI processes is utilized. Note though, although not reported in our experiments, that the weak scaling efficiency is typically much higher when each MPI process handles exactly one subdomain. Finally, the efficiency of the reordering phase is rather limited, since the wall-clock time requires to partition the graph associated with the matrix $|A|+|A^T|$ and permute the distributed matrix $A$ increases as the problem size grows. \begin{figure*} \centering \includegraphics[width=.95\linewidth]{WS1_Lap_small3.pdf} \caption{Weak scaling of \texttt{parGeMSLR} and SchurILU on Poisson problems. The number of unknowns on each MPI process is $125,000$, for a maximum problem size $n=800\times400\times400$.} \label{fig:ws_1} \end{figure*} Figure~\ref{fig:ws_1} plots the weak scalability of \texttt{parGeMSLR} and two-level SchurILU, where this time we allow enough iterations in FGMRES until convergence. As previously, we use eight subdomains per MPI process, but this time we fix $l_{ev}=3$ and $k=10$. In summary, \texttt{parGeMSLR} is both faster and more scalable than SchurILU during the solve phase. Moreover, \texttt{parGeMSLR} also converges much faster than SchurILU, and the number of total FGMRES iterations increases only marginally with the problem size. On the other hand, the weak scaling of the preconditioner setup phase of \texttt{parGeMSLR} is impacted negatively as the problem size increases due to the need to perform more Arnoldi iterations to compute the low-rank correction terms. \subsubsection{Strong scaling} We now present strong scaling results obtained by solving \eqref{eq:test_problem_1} with \texttt{parGeMSLR} on a regular mesh of fixed size as the numbers of MPI processes varies. More specifically, the size of the problem is fixed to $n=320^3$ while the number of MPI processes varies up to $n_p=1,024$. The values of $l_{ev}$ and $k$ are varied as previously. \begin{figure}[!htb] \centering \begin{subfigure}[b]{0.95\linewidth} \centering \includegraphics[width=1.\linewidth]{SS1_Lap320_Schur_setup.pdf} \end{subfigure} \begin{subfigure}[b]{0.95\linewidth} \centering \includegraphics[width=1.\linewidth]{SS1_Lap320_Schur_precond.pdf} \end{subfigure} \caption{Strong scaling results for Poisson problems of size $n=320^3$. The number of subdomains is set equal to 2048 in all levels.} \label{fig:ss_pi_large} \end{figure} Figure~\ref{fig:ss_pi_large} plots the strong scaling of \texttt{parGeMSLR}. In contrast to the weak scaling case, setting $l_{ev}=2$ leads to higher efficiency during both the setup and application phases of the preconditioner. The reason for this behavior is twofold. First, increasing the value of $l_{ev}$ generally deteriorates the effectiveness of the preconditioner unless $k$ is large and the threshold used in the local ILUT factorizations is small. Second, decreasing the value of $l_{ev}$ enhances strong scalability since it leads to smaller communication overheads (i.e., recall the discussion in Section \ref{sec:imp}). As a general remark, we note that the setup phase of \texttt{parGeMSLR} generally becomes more expensive in terms of floating-point arithmetic operations as $l_{ev}$ decreases, thus although scalability deteriorates as $l_{ev}$ increases, the actual wall-clock time might actually decrease if the number of MPI processes used is small. \subsection{General Problems}\label{sec:p2} This section discusses the performance of \texttt{parGeMSLR} on a variety of problems in engineering. \subsubsection{Unstructured Poisson problem on a crooked pipe} We consider the numerical solution of \eqref{eq:test_problem_1} where $f=1$ and $c=0$ on a 3D crooked pipe mesh. The problem is discretized by second-order Finite Elements using the MFEM library \cite{mfem,mfem-web} with local uniform and parallel mesh refinement. The initial approximation of the solution is set equal to zero. We visualize the (inhomogeneous) mesh using the package GLVis \cite{glvis-tool} in Figure~\ref{fig:mesh_problem_1}. \begin{figure}[htbp] \centering \includegraphics[width=.45\linewidth]{P2_GLVis_s01.png} \includegraphics[width=.45\linewidth]{P2_GLVis_s02.png} \caption{Left: Poisson problem on a crooked pipe mesh. Right: zoom-in of the center part of the mesh.} \label{fig:mesh_problem_1} \end{figure} Our experiments consider different refinement levels to generate problems of different sizes. Moreover, the maximum number of inner iterations in step 9 of Algorithm~\ref{alg:gemslrsolve} is varied between three and five. We compare \texttt{parGeMSLR} against BoomerAMG with Hybrid Modified Independent Set (HMIS) coarsening, where we consider both Gauss-Seidel and $l_1$ Jacobi smoother \cite{baker_multigrid_2011}, and report the corresponding results in Table~\ref{tab:test1_crooked_pipe}. \texttt{parGeMSLR} is able to outperform Schur ILU, especially for larger problems. Moreover, the iteration time of \texttt{parGeMSLR} is similar to that of BoomerAMG with Gauss-Seidel smoother, but much lower than that of BoomerAMG with $l_1$ Jacobi smoother. \begin{table}[htbp] \centering \caption{Solving (\ref{eq:test_problem_1}) on a crooked pipe mesh.} \label{tab:test1_crooked_pipe} \begin{tabular}{c|cc|ccccc} \hline prec & size & $n_p$ & k & fill & p-t & i-t & its \\ \hline \multirow{3}{*}{\shortstack{Boomer\\AMG\\GS}} & 126,805 & 16 & - & 1.71 & 0.17 & 0.69 & 106 \\ & 966,609 & 32 & - & 1.79 & 0.79 & 5.7 & 198 \\ & 7,544,257 & 64 & - & 1.81 & 3.36 & 45.12 & 250 \\ \hline \multirow{3}{*}{\shortstack{Boomer\\AMG\\Jacobi}} & 126,805 & 16 & - & 1.71 & 0.18 & 1.29 & 226 \\ & 966,609 & 32 & - & 1.79 & 0.8 & 10.95 & 431 \\ & 7,544,257 & 64 & - & 1.81 & 3.39 & 72.1 & 568 \\ \hline \multirow{3}{*}{\shortstack{Schur\\ILU}} & 126,805 & 16 & - & 1.53 & 0.22 & 0.51 & 65 \\ & 966,609 & 32 & - & 1.86 & 1.2 & 12.46 & 383 \\ & 7,544,257 & 64 & - & 1.94 & 5.51 & - & F \\ \hline \multirow{3}{*}{\shortstack{par\\GeMSLR}} & 126,805 & 16 & 10 & 1.05 & 0.54 & 0.46 & 25 \\ & 966,609 & 32 & 10 & 1.18 & 3.59 & 4.70 & 53 \\ & 7,544,257 & 64 & 10 & 1.32 & 11.76 & 48.35 & 128 \\ \hline \end{tabular} \end{table} \subsubsection{Linear elasticity equation} In the section we consider the solution of the following linear elasticity equation: \begin{eqnarray} \label{eq:test_problem_2} \mu\Delta u + (\lambda + \mu)\nabla(\nabla\cdot u) &=& f \ \ \text{in} \ \Omega, \end{eqnarray} where $\Omega$ is a 3D cantilever beam as shown in Figure~\ref{fig:mesh_problem_2}. \begin{figure}[ht] \centering \includegraphics[width=.75\linewidth]{P2_GLVis_s04_new.png} \caption{Linear elasticity problem on a 3D beam.} \label{fig:mesh_problem_2} \end{figure} The left end of the beam is fixed, while a constant force (represented by $f$) pulls down the beam from the right end. Herein, $u$ is the displacement, while $\lambda$ and $\mu$ are the material's Lam\.e constants. The initial approximation is again set equal to zero in order to satisfy the boundary condition. Tables \ref{tab:test2_beam_10} and \ref{tab:test2_beam_80} show a comparison between \texttt{parGeMSLR} and SchurILU for different uniform mesh refinements obtained using first-order Finite Element. For each mesh, the problem becomes more ill-conditioned as the ratio $\frac{\lambda}{\mu}$ grows larger. For this reason, we fix $\mu=1$ and vary $\lambda=10$ and $\lambda=80$. Note that standard AMG converge slowly for this problem since it is almost singular. Concisely, \texttt{parGeMSLR} leads to considerable wall-clock time savings compared to SchurILU, even when the latter is allowed a higher level of fill-in. \begin{table} \centering \caption{Comparison between two-level ILU and the GeMSLR for 3D Linear elasticity problem. $\mu=1$ and $\lambda=10$, Poisson ratio is $\frac{5}{11}\approx 0.455$.} \label{tab:test2_beam_10} \begin{tabular}{c|cc|ccccc} \hline prec & size & $n_p$ & k & fill & p-t & i-t & its \\ \hline \multirow{4}{*}{\shortstack{Schur-\\ILU}} & 2,475 & 4 & - & 2.62 & 0.03 & 0.06 & 49 \\ & 15,795 & 8 & - & 3.78 & 0.32 & 0.60 & 238 \\ & 111,843 & 16 & - & 7.81 & 4.80 & 19.05 & 751 \\ & 839,619 & 64 & - & 11.82 & 19.67 & - & F \\ \hline \multirow{4}{*}{\shortstack{par\\GeMSLR}} & 2,475 & 4 & 20 & 1.94 & 0.12 & 0.01 & 18 \\ & 15,795 & 8 & 40 & 3.58 & 0.92 & 0.04 & 23 \\ & 111,843 & 16 & 40 & 7.86 & 10.06 & 0.64 & 41 \\ & 839,619 & 64 & 80 & 10.05 & 63.25 & 3.13 & 65 \\ \hline \end{tabular} \end{table} \begin{table} \centering \caption{Comparison between two-level ILU and the GeMSLR for 3D Linear elasticity problem. $\mu=1$ and $\lambda=80$, Poisson ratio is $\frac{40}{81}\approx 0.494$.} \label{tab:test2_beam_80} \begin{tabular}{c|cc|ccccc} \hline prec & size & $n_p$ & k & fill & p-t & i-t & its \\ \hline \multirow{4}{*}{\shortstack{Schur-\\ILU}} & 2,475 & 4 & - & 2.21 & 0.03 & 0.26 & 336 \\ & 15,795 & 8 & - & 4.03 & 0.35 & 1.48 & 549 \\ & 111,843 & 16 & - & 8.94 & 6.45 & - & F \\ & 839,619 & 64 & - & 14.75 & 32.17 & - & F \\ \hline \multirow{4}{*}{\shortstack{par\\GeMSLR}} & 2,475 & 4 & 20 & 1.91 & 0.15 & 0.01 & 41 \\ & 15,795 & 8 & 40 & 3.58 & 1.09 & 0.15 & 75 \\ & 111,843 & 16 & 80 & 6.48 & 16.16 & 1.49 & 93 \\ & 839,619 & 64 & 120 & 10.31 & 133.2 & 6.15 & 128 \\ \hline \end{tabular} \end{table} \subsubsection{Helmholtz equation} In this section we consider the complex version of \texttt{parGeMSLR} and apply it to solve the Helmholtz problem \begin{equation} -(\Delta + \omega^2) u = f \ \ \text{in} \ \Omega=[0,1]^3, \end{equation} where we use the Perfectly Matched Layer (PML) boundary condition \cite{liu2018solving} and set the number of points per wavelength equal to eight. We used random initial guesses. Our first set of experiments focuses on the performance of \texttt{parGeMSLR} where the number of low-rank terms is varied as $k=\{10,20,\ldots,100\}$, and the number of levels is set equal to $l_{ev}=3$. The size of the Helmholtz problem is set equal to $n=50^3$. The maximum fill-in attributed to the low-rank correction term was roughly equal to three. Figure~\ref{fig:hel_50} plots the parallel wall-clock time as a function of the number of low-rank terms $k$ while the number of MPI processes is fixed equal to sixteen. Overall, larger values of $k$ lead to lower total and iteration times up to the point where the time increase associated with constructing the \texttt{parGeMSLR} preconditioner outweighs the gains from improving the convergence rate during the iterative solution by FGMRES. \begin{figure}[htbp] \centering \includegraphics[width=0.95\linewidth]{P3_hel50.pdf} \caption{Total and iteration wall-clock times of the 3-level parallel GeMSLR to solve the Helmholtz equation of size $n=50^3$ using 16 MPI processes.} \label{fig:hel_50} \end{figure} Next, we consider the same problem but this time we add a complex shift equal to $0.05i*\sum_i|A_{ii}|/n_A$ during the the ILU factorization of the on-diagonal blocks. The same idea was already considered in \cite{erlangga2004class,dillon_hierarchical_2018,osei-kuffuor_preconditioning_2010} but this time we apply it in the context of distributed-memory computing and make it available in \texttt{parGeMSLR}. Similarly to the previous references, adding a shift helps creating a more stable ILU for indefinite problems, i.e., see Table~\ref{tab:hel}. \begin{table} \centering \caption{\texttt{parGeMSLR} with/without complex shifts for. The problem size is equal to $n=(4\omega/\pi)^3$. } \label{tab:hel} \begin{tabular}{c|ccccccc|ccc} \hline & \multicolumn{7}{|c|}{with shift} & \multicolumn{3}{c}{without shift} \\ \hline $\omega$ & $n_p$ & k & fill & r-t & p-t & i-t & its & fill & time & its \\ \hline $5\pi$ & 1 & 0 & 3.40 & 0.04 & 0.02 & 0.05 & 9 & 3.80 & 0.12 & 9 \\ $7.5\pi$ & 1 & 0 & 3.81 & 0.17 & 0.10 & 0.40 & 20 & 4.76 & 6.47 & 241 \\ $10\pi$ & 2 & 5 & 3.52 & 0.43 & 0.41 & 1.03 & 36 & 4.11 & 15.48 & 449 \\ $12.5\pi$ & 4 & 5 & 3.79 & 0.70 & 0.58 & 1.50 & 42 & 4.79 & - & F \\ $15\pi$ & 8 & 10 & 4.16 & 1.25 & 1.20 & 2.33 & 55 & 4.63 & - & F \\ $20\pi$ & 16 & 10 & 4.40 & 1.51 & 1.29 & 3.51 & 57 & 4.77 & - & F \\ $40\pi$ & 64 & 20 & 5.49 & 4.87 & 7.84 & 14.43 & 92 & 5.73 & - & F \\ \hline \end{tabular} \end{table} \subsection{GPU acceleration of the solution phase}\label{sec:pgpu} The \texttt{parGeMSLR} library can also take advantage of specialized hardware such as GPUs to speed-up numerical kernels. The current release of \texttt{parGeMSLR} does not support GPU computing during the setup phase of the GeMSLR preconditioner, but allows the use of GPUs during the application of the GeMSLR preconditioner, i.e., triangular substitutions and dense, rectangular matrix-vector multiplications. Nonetheless, accelerating the solution phase might still lead to significant reductions in the overall wall-clock time, e.g., when we need to solve for multiple right-hand sides. To demonstrate these benefits, we consider a $n=128^3$ discretization of the model problem (\ref{eq:test_problem_1}) and focus on the speedup achieved during the solution phase if GPUs are enabled. We set the number of levels equal to $l_{ev}=2$ and $l_{ev}=3$, and vary the low-rank correction terms as $k\in \{0,100,200,300,400,500\}$. At each level, we apply a 4-way partition and assign each partition to a separate MPI process binded to a V100 NVIDIA GPU. Figure \ref{fig:gpu} plots the speedups achieved by the hybrid CPU+GPU version of \texttt{parGeMSLR} during its solve phase. As expected, the peak speedup is obtained for the case $k=500$, since the cost to apply the low-rank correction term increases linearly with the value of $k$. \begin{figure}[htbp] \centering \includegraphics[width=0.95\linewidth]{GPU_Speedup.pdf} \caption{ Speedup of the solution phase} of \texttt{parGeMSLR} if GPU acceleration is enabled when $l_{ev}=\{2,3\}$, and $k\in \{0,100,200,300,400,500\}$. The problem size is equal to $n=128^3$. \label{fig:gpu} \end{figure} \section{Concluding remarks and future work}\label{sec:conclusion} In this paper we presented \texttt{parGeMSLR}, a C++ parallel software library for the iterative solution of general sparse systems distributed among several processor groups communicating via MPI. environments \cite{dillon_hierarchical_2018}. \texttt{parGeMSLR} is based on the GeMSLR preconditioner and can be applied to both real and complex systems of linear algebraic equations. The performance of \texttt{parGeMSLR} on distributed-memory computing environments was demonstrated on both model and real-world problems, verifying the efficiency of the library as a general-purpose solver. As future work we plan to replace standard Arnoldi by either its block variant or randomized subspace iteration. This should improve performance by reducing latency during the preconditioner setup phase. Moreover, the cost of the setup phase can be amortized over the solution of linear systems with multiple right-hand sides, e.g., see \cite{simoncini1995iterative,hussamenlarged,kalantzis2013accelerating,kalantzis2018scalable}, and we plan to apply \texttt{parGeMSLR} to this type of problems. In this context, we also plan to apply \texttt{parGeMSLR} to the solution of sparse linear systems appearing in eigenvalue solvers based on rational filtering \cite{doi:10.1137/20M1349217,xi_computing_2016}, and domain decomposition \cite{doi:10.1137/17M1154527,kalantzis2020domain}. \bibliographystyle{elsarticle-num} \section{Operations} \begin{itemize} \item Point to point communication: $t_s+mt_w$. \item Scatter/Gather: $\log p t_s+m(p-1)t_w$. \item All-reduce: $\log p(t_s+mt_w)$. \end{itemize} \section{Data Structures} \subsection{Parallel Vectors} Parallel vectors are distributed to all MPI processes. \subsubsection{Memory} Each MPI process holds $\frac{n}{p}$ data, and $O(1)$ local start/end information, could be considered memory scalable (at most $O(n)$ memory). \subsubsection{Operations} \begin{itemize} \item Axpy: parallel without communication. $\frac{n}{p}$ flops. \item Dot: All-reduce required. $2t_c\frac{n}{p}+\log p(t_s+t_w)$. \end{itemize} \subsection{Parallel CSR Matrices} Parallel CSR matrices are distributed row-wise to all MPI processes. We split the matrix into diagonal part and off-diagonal part. \begin{itemize} \item Diagonal: local rows and local columns. \item Off-diagonal: local rows and exterior columns. \end{itemize} The following equation gives an example of a distributed CSR matrix on 3 MPI processes: \begin{equation} \begin{pmatrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \\ \end{pmatrix}. \label{eq:dist_mat} \end{equation} Here, $A_{ii}$s are square matrix that are local. \subsubsection{Memory} Each MPI process holds $\frac{nnz}{p}$ data, $\frac{nnz}{p}$ column information, and use array of length $\frac{n}{p}+1$ to hold the row map. $O(1)$ local start/end information is also required. This could be considered memory scalable (at most $O(nnz)$ memory). \subsubsection{Operations} \begin{itemize} \item SpMV: When computing the SpMV, MPI rank $i$ needs to compute $A_{ii}x_i+\sum_{j\neq i}A_{ij}x_j$. Note that $\sum_{j\neq i}A_{ij}x_j$ are off-diagonal and requires communication. We only need to gather those nonzero columns of $A_{ij}$. The amount of communication heavily depends on the quality of the domain decomposition. However, in the extreme case where we have $n$ MPI processes, each MPI process need to communicate with on average $\frac{nnz}{n}-1$ MPI processes. In this situation the cost is $2\frac{nnz}{n}t_c+$ . \end{itemize} \section{Algorithm} \end{document} \section{Introduction} Sparse linear system arises in many fields like Computer Science, Electrical Engineering, and Mechanical Engineering. In this paper, we focus on the sparse linear system \eq{eq:1-1} Ax=b \end{equation} with preconditioned Krylov subspace methods. A proper preconditioner could significant increase the speed and stability of those methods. For example, if we have $M\approx A$, we could solve $M^{-1}Ax=M^{-1}b$ instead of (\ref{eq:1-1}), which is known as left preconditioning. Ideally, $M^{-1}$ should be easy to solve. Also, $M$ should be close enough to the original matrix $A$, and thus the eigenvalues of a good $M^{-1}A$ should cluster at 1.0. The Incomplete LU (ILU) factorization is a famliy of widly used preconditioners since they are usually efficient and stable. The basic idea of them is to compute $M=LU\approx A$. They could also achieve further robustness and/or good parallel performance through multilevel ILU frameworks \cite{bank1999multilevel, botta1999matrix, li2003parms, dillon2018hierarchical}, iterative ILU \cite{chow2015fine}, or factorized sparse approximate inverse \cite{janna2011adaptive}. However, equation (\ref{eq:1-1}) is usually hard to solve with ILU when the spectrum of $A$ is included in a disk $D(c,\rho)$ where the origin is contained in this disk. Those problems arises from many applications including interial eigenvalue problems and Helmholtz equations. ILU preconditioners is likely to fail due to smal pivots and unstable triangular solves \cite{chow1997experimental}. In order to overcome this challange, the idea of complex shift was introduced \cite{magolu2000preconditioning, erlangga2006comparison, ?, ?}. Instead of compute $LU\approx A$, ILU factorization is applied to obtain the factorization of a new matrix \eq{eq:1-2} B = A - \sigma I \qquad \mbox{with} \qquad \sigma = i \eps . \end{equation} Complex shift is very useful when solving non-standard linear systems. The factorization $LU\approx B$ tends to be more stable as $|\sigma|$ increases and less likely to fail. However, the larger we pick $|\sigma|$, the futher the preconditioner matrix from $A$. As a result we would have to choose a very large $|\sigma|$ when preconditioning very highly indefinite linear systems with ILU due to stablity consideration. The result preconditioner is very likely to be poor since it is far away from $A$. One possible solution to this problem is to combine multiple shifts $\sigma_j$ to increase accuracy while keeping relatively large shifts for stability. This idea has been promoted in \cite{xi2017rational} and has been extended into a preconditioner designed specifically for solving the Helmholtz equations~\cite{liu2018solving}. These preconditioners invoke the Cauchy integral formula to separate the preconditioner in two parts: the first acts on eigenvalues located inside a circle that includes the origin and the other acts on eigenvalues outside the circle. When the circle has a radius that is not small, then the shifts $\sigma_j$ are far from the origin and so the ILU factorizations of the matrices $B_j = A -\sigma_j I$ tend to be inexpensive to compute. Herein lies one of the main attractions of these methods. In this note we keep exploring the idea of multiple complex shifts, and answer the following questions: 1. Given multiple complex shifts, what is the optimal way of using them? 2. Given a number of complex shifts and the precoditioning method, what is the optimal choice of those shift values $\sigma_j$? The following sections of this note are organized as follow. In section 2 we proposed our approach. In section 3 we provide xxx. In section 4 we provide several numerical results. And in section 5 we make a conclusion. \section{Optimal multiple complex shifts} In this section, we discuss our approaches to find the optimal usage of multiple complex shifts. Throughout this note we will assume that the factorizations and solves are exact. This assumption will help us to analyze. We begin this section by exam the performance of single comple shift preconditioner $B=A - \sigma I$. Let $A$ be a shifted Laplacean of size 600 ($30\times 20$ grid) with a shift value of 1.0. The spectrum of the matrix $A$ is nearly evenly distributed in the interval [-1,7]. Without preconditioning, this spectrum would lead to very slow convergence. Meanwhile, ILU preconditioners are not stable with thie matrix. If we apply a preconditioner $B$ with shift value $\sigma = 0.4i$, the spectrum of the preconditioned matrix $B^{-1}A$ is the one shown in Figure~\ref{fig:SingleShift} left. \begin{figure}[htb] \begin{center} \includegraphics[width=0.482\textwidth]{s2_0_eigfd2d3020_cs} \includegraphics[width=0.482\textwidth]{s2_0_eigfd2d3020_cs_ilu} \end{center} \caption{Left: Spectrum of preconditioned matrix with one shift located at $\sigma = 0.4 i$ (shown as a bullet). Right: The same case except ILU with a drop tolerance of 0.01 is applied instead of exact solve. \label{fig:SingleShift}} \end{figure} This figure helps understand why the use of complex shifts is beneficial and so popular. The complex shift ILU preconditioner is much more stable than ILU, while doing a good job make eigenvalues cluster at 1.0. The right side of the same figure shows what happens when solves with $B$ are not exact: we replace $B$ by its ILU facrtorization with a drop tolerance of 0.01. We can see a similar performance. As we can see from the figure, there are still some eigenvalues that are close to zero. One straightforward thought would be, can we use multiple shifts to achieve a more accurate preconditioner. \subsection{Optimal combination of multiple complex shifts} Assume that we are given $k$ complex shifts located for example on a circle of radius $r$ (as in the case of the Cauchy integral), i.e., \eq{eq:complexshift} \sigma_j = e^{j \times(2 i \pi/k) } \quad \mbox{for} \quad j=1, \cdots, k, \end{equation} where $k$ is even\footnote{This is simply to avoid having poles on the real axis.}, and thus we have $B_j=A-\sigma_jI$. We hope to find an optimal way of combining them. In this section, we assume that the locations for the poles are given and we are not optimizing them. This is a more complicated question. One possible way would be combine the preconditoners into a linear combination of the $B_j$: \eq{eq:lineB} M\inv = \sum_{j=1}^k \alpha_j B_j\inv = \sum_{j=1}^k \alpha_j (A - \sigma_j I)\inv \end{equation} The coefficients will be sought so as to get an optimum preconditioner in some sense. The eigenvalues of the residual matrix $I -M\inv A$ are: \[ \rho(\lambda) = 1 - \lambda \times \sum_{j=1}^k \frac{\alpha_j}{ \lambda - \sigma_j} = \left(1 - \sum_{j=1}^k \alpha_j\right) - \sum_{j=1}^k \frac{\alpha_j \sigma_j }{ \lambda - \sigma_j} \] The second equality follows from the relation $\lambda/ (\lambda -\sigma_j) = 1 + \sigma_j/(\lambda - \sigma_j)$. Since we hope the eigenvalues of We can now state specifically our goal. We can scale the $\alpha_j$'s in such a way that $1 - \sum \alpha_j=0$. Note that $\rho (0) = 1$ as expected. We would like $\rho (\lambda)$ to be small for when $\lambda \neq 0$. Clearly, for a large $\lambda$, this goal will be easily achieved as can be seen from the expression. It is the eigenvalues near the origin that need attention. We would like to make $\rho(\lambda)$ as close as possible to zero for these but because $\rho(0) = 1$, the task is not simple. There are two possible options. One is to draw a small circle containing the origin, with radius (much) smaller than that of the circle that defines the poles, and to minimize some $L_2$ norm of $\rho$ inside, or on, the circle. The second option is to simply select an interval containing the origin and to, again, mininimze some $L_2$ norm of $\rho$ on this interval. While both approaches are valid, we will only illustrate the second one. Let $[a, \ b] $ be the interval and select a weight $w(t)$ in this interval. The weight function is selected to emphasize some area around the origin and de-emphasize eigenvalues that are away from 0. We would like to find the funcion that minimize the value of $||p||^2_w$, that leads us to the following constrained least-squares problem: \begin{eqnarray} & \min_{ \{ \alpha_j \} } & \int_a^b \rho(t)\overline{\rho(t)} w(t) dt \label{eq:MainLS} \\ & \mbox{Subject to} \quad & \sum_{j=1}^k \alpha_j = 1 \nonumber \end{eqnarray} The above problem can be easily solved by taking the basis of rational functions $\phi_j(z) = \frac{\sigma_j}{z - \sigma_j}$ and computing the related Grammian matrix $G$. If call $a$ the vector of the $\alpha_j$'s and $e$ the vector of all ones, we will end with a standard least-squares problem of having to minimize $a ^T G a$ under the constraint $e^T a = 1$. This is a simple quadratic programming programming program. By using the Lagrange multiplier we could find the following necessary condition of $a$ minimize $a^TGa$. \eq{eq:QP} \left[ \begin{array}{cc}{G} & {e} \\ {e^T} & {0}\end{array}\right] \left[ \begin{array}{l}{a} \\ {\lambda}\end{array}\right]=\left[ \begin{array}{c}{\mathbf{0}} \\ {1}\end{array}\right] \end{equation} As an example we took the same uniform eigenvalue distribution in $[0.08 \ 16]$ as before and $k=4$ with a circle of radius $0.8$. This gives the 4 poles: \[ 0.8 * \left[\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}i; \quad -\frac{\sqrt{2}}{2} + \frac{\sqrt{2}}{2}i; \quad -\frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}i ; \quad \frac{\sqrt{2}}{2} - \frac{\sqrt{2}}{2}i \right] . \] The interval was $[a, \ b] = [-2 \ \ 2.0]$ but we selected a weight function that is concentrated to the right of zero: \eq{eq:wt} w(t) = \left\{ \begin{array}{rll} 50 & \mbox{if} & 0 \le t \le 0.15 \\ 1 & \mbox{else} \end{array} \right. \end{equation} \begin{figure}[htb] \begin{center} \includegraphics[width=0.482\textwidth]{compnd} \includegraphics[width=0.482\textwidth]{ls4} \end{center} \caption{Left: Spectrum of preconditioned matrix for a compound preconditioner. Right: Spectrum of preconditioned matrix for an optimal sum of the form \nref{eq:prec} shift located at $\sigma = 0.4 i$ (shown as a bullet). Right: A case with ILU applied to a shifted Laplacean with a similar shift and a drop tolerance of $0.01$. There are 4 poles indicated by the 4 red bullets. \label{fig:precB}} \end{figure} The resulting spectrum of $M\inv A$ is shown on the right side of Figure~\ref{fig:precB}. As a comparison the same spectrum is shown for the compound preconditioner on the left side of the figure. Though not obvious from the figure the compound preconditioned matrix has a few very small eigenvalues near zero (the smallest of these is close to $10^{-4}$.) The effect of the optimization has been to push the eigenvalues away from the origin as desired. The resulting separation near 0 is astounding. This is a preconditioner that will do quite well (assuming it is applied exactly). Note that this was achieved by using shift that is not small. \subsection{Finding optimal complex shifts} \textsc{ \begin{algorithm}[tb!] \caption{Richardson iteration with $B$-preconditioning} \label{alg:algo1} \begin{algorithmic}[1] \State {\bfseries Input:} An $n\times n$ matrix $A$, preconditioners $B_1, \cdots, B_k$, right-hand side $r$, initial guess $x_0$. \State {\bfseries Output:} Compound Preconditioner applied to $r$ \State {Set $r_0=r-Ax_0$} \For{$j=0:k-1$} \State Compute $\delta = B_j\inv r_j$ \State $x_{j+1} = x_j + \delta$ \State $r_{j+1} = r_j - A \delta$ \EndFor \end{algorithmic} \end{algorithm} } The easiest strategy for using a set of shifts is to compound the preconditioner in a Richardson type iteration as shown in Algorithm~\ref{alg:algo1} where we use a The residual vector at step $j+1$ satisfies the relation $r_{j+1} = (I - A B_j\inv) r_j$ at each iteration. Note that \[ (I - A B_j\inv) = I - A (A-\sigma_j I)\inv = -\sigma_j (A-\sigma_j I)\inv . \] The result is that $r_{j+1}$ can be expressed as $r_{k} = \rho_{k} (A) r_0 $, where $\rho_{k} $ is the rational function \eq{eq:rich} \rho_k (z) = \frac{-\sigma_1}{z-\sigma_1} \times \frac{-\sigma_2}{z-\sigma_2} \times \cdots \frac{-\sigma_k}{z-\sigma_k} \ . \end{equation} Note since $\rho_k(0) = 1$ this is of the form $\rho_k(z) = 1 - z s_k(z) $ for some rational function $s_k$. Clearly, the resulting preconditioner is $C=s_k(A)$. Note also that if we apply Algorithm~\ref{alg:algo1} as is, the compound preconditioner would normally require 4 system solves, namely one for each of the 4 poles in sequence. In contrast, the LS approach will require 2 solves when $A$ is real. Indeed, because the poles form two conjugate pairs, we need to compute solutions only for the systems associated with the poles with positive imaginary pairs, as the solutions with the other poles are their conjugate. However, as it turns out whenever we have a pair of conjugate pairs $\sigma_1, \sigma_2,$ with $\sigma_2 = \bar \sigma_1$ then applying the Richardson scheme in sequence for $\sigma_1$ followed by $\sigma_2$ can be implemented with one system solve instead of two when $A$ is real. The next proposition explains why. \begin{proposition} Consider the case where $A, b$ are real and $x_0$ is real. Let Algorithm~\ref{alg:algo1} be applied with $k=2$ and $B_1 = A -\sigma I$, $B_2 = A - \bar \sigma I$. Define $\sigma \equiv \rho + i\theta$ and $v \equiv (A -\sigma I)\inv r_0$. Then the vectors $x_1, x_2$ generated by Algorithm~\ref{alg:algo1} satisfy: $x_1 = x_0 + v$, and \[x_2 = x_0 + \Re e (v) - \frac{\rho}{\theta} \ \Im m (v) . \] \end{proposition} \begin{proof} \ In the following we set $\sigma_1 = \sigma $, $\sigma_2 = \bar \sigma$ and make use of the identity: $A (A-t I)\inv = I + t(A-t I)\inv$. Clearly, $x_1 = x_0 + (A-\sigma_1 I)\inv r_0 = x_0 + v$. Then: \begin{eqnarray*} r_1 & = & b - A x_1 = r_0 - A(A-\sigma_1 I)\inv r_0 = r_0 - (I +\sigma_1 (A-\sigma_1 I)\inv) r_0 \\ &=& - \sigma_1 (A-\sigma_1 I)\inv r_0 \end{eqnarray*} Next we calculate \begin{eqnarray*} x_2 & = & x_1 + (A-\sigma_2 I)\inv r_1 \\ &=& x_0 + (A-\sigma_1 I)\inv r_0 - \sigma_1 (A-\sigma_2 I)\inv (A-\sigma_1 I)\inv r_0 . \end{eqnarray*} We now make us use of the second resolvant inequality: \eq{eq:res} (A-\sigma_2 I)\inv (A-\sigma_1 I) = \frac{1}{\sigma_2 - \sigma_1} \left[ (A-\sigma_2 I)\inv - (A-\sigma_1 I)\inv \right] , \end{equation} to obtain: \begin{eqnarray*} x_2 &=& x_0 + (A-\sigma_1 I)\inv r_0 - \frac{\sigma_1}{\sigma_2 - \sigma_1 } \left[ (A-\sigma_2 I)\inv - (A-\sigma_1 I)\inv \right] r_0 \\ &=& x_0 + \frac{\sigma_2}{\sigma_2 - \sigma_1 } (A-\sigma_1 I)\inv r_0 - \frac{\sigma_1}{\sigma_2 - \sigma_1 } (A-\sigma_2 I)\inv r_0 \\ &=& x_0 + \frac{\bar \sigma}{\bar \sigma - \sigma } (A-\sigma I)\inv r_0 - \frac{\sigma}{\bar \sigma - \sigma } (A-\bar \sigma I)\inv r_0 \end{eqnarray*} if $\sigma = \rho + i \theta $ and if $(A-\sigma I)\inv r_0 = x+i y $ then a little calculation yields: \[ x_2 = x_0 + x - \frac{\rho }{\theta} y \] Hence the result. \end{proof} In particular when $\sigma$ is purely imaginary, a common choice in practice, then $x_2 = x_0 + \Re e( v)$. The main consequence of the proposition is that we only need to solve one complex system (the one corresponding to the pole with positive imaginary part) instead of two (one for each pole). \iffalse & = & x_0 + (A-i \theta I)\inv r_0 + \frac{1 }{2} \left[ \overline{ (A - i \theta I)\inv r_0} - (A-i \theta I)\inv r_0 \right]\\ & = & x_0 + \frac{1 }{2} \left[ (A-i \theta I)\inv r_0 + \overline{ (A - i \theta I)\inv r_0} \right]\\ &=& x_0 + \Re e \left( (A - i \theta I)\inv r_0\right) \end{eqnarray*} \fi Going back to the example seen earlier (using 4 poles but involving 2 solves) another alternative that would also involve two solutions is to apply twice the standard shift at $i \theta $ where $ \theta $ is the same as the radius $r$ of 0.8. Let us examine this. Consider Algorithm \ref{alg:algo1} in which $B_1 = (A-\theta I)$ and $B_2 = \bar B_1 = (A+\theta I)$. Then from the above we get $x_2 = \Re e (x_1)$. The eigenvalues of the preconditioned matrix obtained in this way (applying the poles $i \theta, -i \theta $ twice at the cost of 2 solves in the real case) are shown in Figure \ref{fig:PrecC}. \begin{figure}[htb] \begin{center} \includegraphics[width=0.482\textwidth]{Cauch2} \end{center} \caption{Spectrum of preconditioned matrix for a compound standard purely imaginary shifted preconditioner. \label{fig:precC}} \end{figure} The smallest eigenvalue of the preconditioned matrix is now 0.0197. ----------------------------------------------------------------------- Consider \ref{eq:rich}. We hope to minimize the $L_2$ norm of it in a certain region. Instead of working on $\rho_k(\lambda)$, we work on \[ \rho(\lambda)=\frac{1}{\rho_k(\lambda)} \] which is a poly of order $k$. \bibliographystyle{siam}
\section{Introduction} A subset of core-collapse supernovae (SNe) across nearly all spectroscopic classes exhibit signatures of early interaction with circumstellar material (CSM). In such SNe, the CSM interaction is observed through fast-rising, bright early-time light curves; featureless, blue early spectra that signify a shock-heated envelope or CSM; or narrow emission lines in early spectra that appear when nearby CSM is flash-ionized by the SN breakout. A few recent examples of SNe that demonstrate evidence for early interaction with CSM include the type II events SN2018zd \citep{ZhangJ2020}, SN2013fs \citep{Yaron2017}, and several type II events detected by ZTF \citep{bruch2021}, as well as the type I events LSQ13ddu \citep{Clark2020}, SN2018gep \citep{Ho2019}, SN2019dge \citep{Yao2020}, SN2019uo \citep{Gangopadhyay2020}, and SN2019yvr \citep{Kilpatrick2021}. The CSM observed in these events is usually attributed to elevated mass loss from the progenitor stars that precedes the SN. For type II SNe with early peaks in the light curve, the CSM signatures may also be explained by roughly one solar mass of material in an optically thin stellar chromosphere or corona \citep{Dessart2017,Hillier2019}. Other events present late-time interaction and narrow emission lines, indicating mass loss occurring decades before the SN. Some recent examples include SN2017dio \citep{Kuncarayakti2018}, SN2017ens \citep{Chen2018}, SN2013L \citep{Taddia2020}, iPTF16eh \citep{Lunnan2018}, and SN2004dk \citep{Mauerhan2018,Pooley2019}. Many other events with both early- and late-time interaction are listed in \citet{Wu2021}, \citet{fuller2018}, and \citet{fuller2017}. While pre-SN outbursts have been observed directly in several SN progenitors \citep{Ofek2014}, the majority of SN progenitors may not experience pre-SN outbursts or amplified variability at all. \citet{Kochanek2016} found that progenitor constraints on nearby, well-studied SNe do not support evidence for outbursts, and \citet{Samson2017} found no significant variability in the progenitor for type Ic SN2012fh. \citet{Johnson2018} constrained variability amplitudes to less than~$\sim 10\%$ in four type II-P progenitors. As a result, the mechanisms behind pre-SN mass loss must operate such that they manifest a range in behavior, from elevated mass loss and bright pre-SN outbursts to no unusual variations at all. One promising explanation for pre-SN outbursts is the wave heating model proposed by \citet{Quataert2012}. Internal gravity waves (IGW) are excited as a routine consequence of convection, and the vigorous convection that occurs during late burning stages in massive stars may generate waves carrying more than~$10^7\, L_{\odot}$ of power. These IGW couple with acoustic waves to deposit some of their power in the outer layers of the star, which may be able eject mass or drive outbursts. \citet{Shiode2014} found that more massive stars produced larger wave heating rates, but ensuing outbursts occurred closer to core-collapse. Modeling the wave heating in a~$15\, M_{\odot}$ red supergiant, \citet{fuller2017} found that waves could inflate the envelope and drive a mild outburst, potentially causing mass loss through a secondary shock. \citet{fuller2018} examined hydrogen-poor stars in which they found that wave heating could launch a dense, super-Eddington wind of~$\dot{M} \sim 10^{-2}\, M_{\odot}/\text{yr}$. These studies also predicted large variations in luminosity and temperature as a result of wave heating. In \citet{Wu2021}, we updated the physical model used for wave generation and propagation in \citet{fuller2017} and \citet{fuller2018} to include non-linear wave breaking effects and to more realistically model the wave spectrum excited by convection. By simultaneously accounting for these effects throughout the evolution of core convective shells in a suite of stars with~$M_{\rm ZAMS} = 11 \text{--} 50\, M_{\odot}$, \citet{Wu2021} found that wave heating rates were an order of magnitude lower than adopted in prior work. While most models were unlikely to produce observable pre-SN outbursts, the lowest- and highest-mass stars experienced the highest levels of wave heating and were favored to drive outbursts. \citet{leung2021} surveyed the upper end of this mass range with the updated physics, extending up to~$M_{\rm ZAMS} = 70\, M_{\odot}$ and including hydrogen-poor stars, and likewise predicted less energy deposited in the envelope and less mass loss than prior work. Their hydrodynamical simulations of the most energetic high-mass model ejected at most~$0.01\, M_{\odot}$ of material close to core collapse, forming quite confined CSM. In this paper, we study the low-mass end of models in \citet{Wu2021}, where outbursts are promising due to semi-degenerate central neon ignition, and we now deposit the wave heat in our models as they evolve. We extend our scope down to~$M = 10\, M_{\odot}$ stars to capture the physics of waves generated by semi-degenerate, off-center neon ignition. Additionally, we apply the same wave heating physics to hydrogen-poor models for stripped progenitors. In all our models, we add the wave heat and explore their hydrodynamical response. We find that our updated wave heating rates are not able to drive significant mass loss in either supergiant or stripped-star models and that wave heating only causes small-amplitude surface variability in our supergiant models. However, in our stripped star models we predict large outbursts in luminosity as well as large changes in the photospheric radius and surface temperature, which may be detectable in progenitors of type Ib SNe. \section{Implementation of Wave Physics in Stellar Models} \label{sec:physics} \subsection{Wave Generation and Propagation} \label{sec:equations1} To implement wave energy transport, we follow the procedure of \citet{Wu2021}. We summarize the physics of wave generation and propagation here and refer the reader to Section 2 of \citet{Wu2021} for more details. Gravity waves are excited at the interface between convective and radiative zones and carry a fraction of the kinetic energy of turbulent convection. While our understanding of this process remains incomplete, the power put into waves,~$L_{\rm wave}$, is at least \citep{Lecoanet2013} \begin{equation} \label{eq:lwave} L_{\rm wave} = \mathcal{M}_{\rm con} L_{\rm con} \end{equation} where~$\mathcal{M}_{\rm con}$ is the MLT convective Mach number and~$L_{\rm con}$ is the convective luminosity \citep{Goldreich1990}. We define the convective velocity ~$v_{\rm con}$ as \begin{equation} \label{eq:Lcon} v_{\rm con} = \left(\frac{ L_{\rm con}}{4\pi\rho r^2}\right)^{1/3} \, , \end{equation} and we define the associated MLT convective turnover frequency as \begin{equation} \label{eq:omega} \omega_{\rm con} = 2\pi \frac{v_{\rm con}}{2 \alpha_{\rm MLT} H}, \end{equation} where~$\alpha_{\rm MLT} H$ is the mixing length and~$H$ is the scale height. As in \citet{Wu2021}, we use the power spectrum of waves over angular wavenumber~$\ell$ from \citet{Goldreich1990} and \citet{Shiode2013} to calculate the proportion of wave energy generation per~$\ell$ value,~$\dot{E}_\ell/L_{\rm wave}$: \begin{align} \label{eq:ellpowerspectrum} \frac{d\dot{E}_g}{d \ln \omega d \ln \ell} &\sim L_{\rm wave} \left( \frac{\omega}{\omega_{\rm{con}}}\right)^{\!-a} \left( \frac{\ell}{\ell_{\rm con}} \right)^{\!b+1} \left(1+\frac{\ell}{\ell_{\rm con}}\right) \nonumber \\ & \times \exp \left[-\left(\frac{\ell}{\ell_{\rm con}}\right)^{\!2} \left(\frac{\omega}{\omega_{\rm con}}\right)^{\!-3} \right] \, . \end{align} Here,~$\ell_{\rm con} = r/\min(H,\Delta r)$ is evaluated at the edge of the convective zone and the predicted exponents are $a=13/2$ and $b=2$. This spectrum peaks near the value of~$\ell_{\rm con}$ (see Figure 1 in \citealt{Wu2021}). As Equation \ref{eq:ellpowerspectrum} shows, the wave power drops off steeply for~$\omega>\omega_{\rm con}$, and we do not expect low-frequency waves with $\omega<\omega_{\rm con}$ to contribute much wave power due to tunneling and damping effects described below. We therefore simplify the calculation by setting~$\omega = \omega_{\rm con}$ for all~$\ell$ values, and we normalize the power spectrum to~$L_{\rm wave}$ so that~$\sum \dot{E}_\ell = L_{\rm wave}$. In the WKB limit, linear waves have the dispersion relation \begin{equation} \label{eq:dispersion} k_r^2=\frac{(N^2-\omega^2)(L_{\ell}^2-\omega^2)}{\omega^2 c_s^2}, \end{equation} where~$N^2$ is the squared Brunt-V\"ais\"al\"a frequency,~$k_r$ is the radial wavenumber, and~$L_{\ell}^2 = {\ell}({\ell}+1)c_s^2/r^2$ is the Lamb frequency squared. In the limit that~$\omega \ll N, L_{\ell}$, this reduces to the gravity wave dispersion relation \begin{equation} \label{eq:gravitykr} k_r^2=\frac{\ell(\ell+1)N^2}{\omega^2 r^2} \end{equation} with group velocity \begin{equation} \label{eq:gravityvg} v_g=\omega^2 r/\sqrt{\ell(\ell+1)N^2}. \end{equation} The limit~$\omega \gg N, L_{\ell}$ gives acoustic waves, with dispersion relation \begin{equation} k_r^2=\frac{\omega^2}{c_s^2} \end{equation} and group velocity~$v_g=c_s$. In either of these limits, linear waves propagate freely and approximately conserve their luminosity, apart from damping effects discussed below. If~$\omega > N$ and~$\omega < L_{\ell}$ or vice versa, then the radial wavenumber is imaginary and waves are evanescent. The probability of tunneling through this evanescent zone, or the fraction of transmitted wave energy, is approximately given by the transmission coefficient \begin{equation} \label{eq:transmissioncoeff} T^2 = \exp\left(-2 \int_{r_0}^{r_1} \lvert k_r \rvert dr \right), \end{equation} where the integral is taken over the evanescent zone. As the thickest evanescent zone dominates the wave reflection (see Appendix B2 of \citealt{fuller2017}), we take the minimum value of~$T^2$ out of all evanescent zones,~$T_{\rm min}^2$, to calculate the wave flux tunneling into the envelope. The remaining fraction~$1-T_{\rm min}^2$ of wave energy that encounters the evanescent region is reflected from the boundary of the evanescent zone. In addition, after traveling to the upper edge of the core and back, a wave's energy is attenuated by the factor \begin{equation} \label{eq:fnu} f_{\nu} = \exp\left[2\int_{r_{-}}^{r_{+}} \frac{\gamma_{\nu} + \gamma_{\rm rad}}{v_g} dr\right] \end{equation} where~$\gamma_\nu$ and~$\gamma_{\rm rad}$ are the neutrino and thermal wave energy damping rates respectively,~$v_g$ is the gravity wave group velocity (Equation~\ref{eq:gravityvg}), and the integral is taken over the upper and lower boundaries of the gravity wave cavity. \textbf{Note that the definition of $f_\nu$ assumes the weak damping limit, where the majority of wave energy escapes only after traversing the core multiple times; in the limit of strong damping, where most of the wave energy escapes after traveling to the upper edge of the core once, it is appropriate to use $\sqrt{f_\nu}$ instead. We find that our models are almost always in the weak damping limit, especially when significant wave heating occurs, justifying our approximation for $f_\nu$.} The fraction of wave energy that escapes the core,~$f_{\rm{esc}, \ell}$, is then determined by the transmission coefficient (Equation~\ref{eq:transmissioncoeff}) and energy losses within the core, \begin{equation} \label{eq:heatfrac} f_{\rm esc, \ell} = \left(1+\frac{f_{\nu}-1}{T_{\rm min}^2} \right)^{-1}. \end{equation} Given the escape fraction, the~$\ell$-dependent power that escapes to heat the envelope is \begin{equation} \label{eq:lheatell} L_{\rm heat, \ell} = f_{\rm esc, \ell} \dot{E}_\ell. \end{equation} Equation~\ref{eq:lheatell} holds for waves that remain linear, but waves that experience non-linear wave breaking will experience another source of energy loss before escaping to heat the envelope. A measure of the gravity wave non-linearity as a function of~$\ell$ is \begin{equation} \label{eq:nonlinearity} \left|k_r \xi_r\right| = \left[\frac{2}{T_{\rm min}^2}\frac{f_{\rm esc, \ell} \dot{E}_\ell N [\ell (\ell+1)]^{3/2}}{4\pi\rho r^5\omega^4} \right]^{1/2}. \end{equation} Where~$\left|k_r \xi_r\right| \geq 1$, waves are non-linear, whereas linear waves have~$\left|k_r \xi_r\right| \leq 1$. Such non-linear waves will break and experience an energy cascade to small scales, where their energy dissipates \citep{Barker2010}. This effectively caps the wave amplitude~$\xi_r$ so that~$|k_r\xi_r| \lesssim 1$, therefore reducing the wave power by a factor~$|k_r\xi_r|^2$ when~$|k_r\xi_r| \geq 1$. Thus for non-linear waves, the power that escapes to heat the envelope is effectively \begin{align} \label{eq:lheatellnl} L_{\rm heat, \ell} &= f_{\rm esc, \ell} \dot{E}_\ell/|k_r\xi_r|^2 \nonumber \\ &= \frac{T_{\rm min}^2}{2} \frac{4\pi\rho r^5\omega^4}{N [\ell (\ell+1)]^{3/2}} \, . \end{align} We use the maximum value of~$|k_r\xi_r|$ (i.e., the minimum value of the second line in equation \ref{eq:lheatellnl}) in the g-mode cavity to compute the above reduction of wave power due to non-linear damping. \subsection{Wave dissipation} \label{sec:equations2} To model the wave damping and energy deposition in the envelope, we follow the methods of \citet{fuller2018}, accounting for background flows as explained in their Section 3.4. We summarize the approach here. Wave dissipation in the envelope can be understood by considering the damping mass, which is the mass through which a wave must pass to dissipate all its energy, given by \begin{equation} M_{\rm damp} = L_{\rm{ac}} \left( \frac{d L_{\rm{heat,co}}}{dm}\right)^{-1}. \end{equation} in the presence of flows. Here~$d L_{\rm{heat,co}}/dm$ is the wave heating rate per unit mass and $L_{\rm{heat,co}}$ is the wave energy flux measured in the comoving frame. The conserved quantity (in the absence of damping) in the inertial frame is the wave action $L_{\rm ac} = 2\pi r^2 \rho c_s u^2 (1+v_r/c_s)$, where~$u$ is the radial velocity amplitude of the wave. \citet{fuller2018} find that the damping mass due to radiative diffusion is \begin{equation} M_{\rm damp, rad} = \frac{2L_{\rm max}}{\omega^2 K} \left(1+\frac{v_r}{c_s}\right)^2 \label{eq:Mdamprad} \end{equation} where the maximum possible wave flux in the linear regime is~$L_{\rm max} = 2\pi r^2 \rho c_s^3$. \citet{fuller2018} find that the damping mass due to weak shock dissipation is \begin{equation} \begin{split} \label{eq:Mdampshock} M_{\rm damp, shock} & = \frac{3\pi}{\gamma + 1}\frac{L_{\rm max}}{\omega c_s^2} \\ & \times \left(\frac{L_{\rm max}\left(1 + v_r/c_s\right)^5}{L_{\rm ac}}\right)^{1/2}. \end{split} \end{equation} Thus the effective damping mass is \begin{equation} M_{\rm damp} = \left[ M_{\rm damp,shock}^{-1} + M_{\rm damp, rad}^{-1} \right]^{-1}, \label{eq:Mdamp} \end{equation} so that the energy deposited per unit time per unit mass in our models is \begin{equation} \label{eq:dLdm} \epsilon_{\rm wave} = \frac{d L_{\rm{heat,co}}}{dm} = \frac{L_{\rm ac}}{M_{\rm damp}}. \end{equation} Since $L_{\rm ac}$ is the quantity conserved in the absence of damping, we compute the energy deposited from escaping waves (with initial $L_{\rm ac} = L_{\rm{heat},\ell}$) as \begin{equation} \label{eq:dLdmactual} \epsilon_{\rm wave}=L_{\rm{heat},\ell}/M_{\rm damp}. \end{equation} \begin{figure} \centering \includegraphics[width=\columnwidth]{10_11M_ellcon2.pdf} \caption{The value of~$\ell_{\rm con} = r/\min(H,\Delta r)$ as a function of radius for the Ne burning convective region in the~$10\, M_{\odot}$ (blue) and~$11\, M_{\odot}$ (orange) supergiant models. The radial extent of the~$10\, M_{\odot}$ burning shell is indicated by the blue shaded vertically hatched region, and the radial extent of the~$11\, M_{\odot}$ core burning is shaded in orange with diagonal hatching. The radius of the top of the burning region, where~$\ell_{\rm con}$ is evaluated, is marked with a circle for each model. Since the~$10\, M_{\odot}$ model burns Ne off-center, the top of its Ne burning shell occurs at larger radius, increasing its~$\ell_{\rm con}$ value. This also applies to the stripped star models.} \label{fig:10v11lcon} \end{figure} \begin{figure*} \centering \includegraphics[width=\textwidth]{10ellheatingONe.pdf} \caption{Fraction of envelope wave heating caused by each angular number~$\ell$ (top), and the wave escape probability for each~$\ell$ (bottom), as a function of time since Ne ignition in the~$M_{\rm ZAMS} = 10\, M_{\odot}$ models. The left figure shows the supergiant model and the right figure shows the stripped star model. Results are only shown for waves where~$L_{\rm heat,\ell} > 10^3\, L_{\odot}$. } \label{fig:10fesc} \end{figure*} \begin{figure} \includegraphics[width=\columnwidth]{10Mpropdiag.pdf} \includegraphics[width=\columnwidth]{10Mpropdiag_stripped.pdf} \caption{Propagation diagrams for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ supergiant model (top) and stripped star model (bottom), each during Ne burning. Shown are the Brunt-V\"ais\"al\"a frequency N (blue) and the Lamb frequency~$L_{\ell}$ for~$\ell = 1,3$ (shades of red). Waves propagate through the gravity wave cavity (blue region) and into the envelope as acoustic waves (red region, shaded for~$\ell = 1$), tunneling through evanescent zones (gray region) along the way. Off-center Ne ignition in the core excites waves with~$\omega \sim \! 10^{-2}$ rad/s (dotted line) at the top of the convective zone (star). The stripped star model has higher~$\omega$, which allows the waves to tunnel through a thinner evanescent zone and causes the escape fraction to be higher for waves of all~$\ell$ (Figure~\ref{fig:10fesc}.) } \label{fig:10Mprop} \end{figure} \begin{figure*} \centering \includegraphics[width=0.494\textwidth]{11Mprofile_normalLheat2.pdf} \includegraphics[width=0.4935\textwidth]{11Mprofile_normalLheat_mext_v2_stripped.pdf} \caption{Left panel: Wave heating diagnostics for an~$11\, M_{\odot}$ red supergiant model during Ne burning as a function of mass coordinate. Top: Binding energy integrated inward from the surface of the model and the star's density profile, before and after wave heating due to Ne burning. Middle: Wave energy deposition rate per unit mass and the damping mass (i.e., $4 \pi \rho r^2$ times the damping length, Equation~\ref{eq:Mdamp}). Bottom: Wave heating timescale ($t_{\rm heat}$), local thermal timescale ($t_{\rm therm}$), and local dynamical timescale ($t_{\rm dyn}$). Right panel: Same as left for the ~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star during Ne burning, but as a function of exterior mass coordinate. } \label{fig:11Ebind} \end{figure*} \subsection{Methods} \label{sec:methods} We run a suite of MESA simulations \citep{mesa2011,mesa2013,mesa2015,mesa2018,mesa2019} for zero-age main sequence (ZAMS) masses 10, 10.5, 11, 12, and 13~$M_{\odot}$ and evolve the stars from the main sequence to at least five years after neon (Ne) ignition. For the~$11\text{--}13\, M_{\odot}$ models, we evolve the stars until core collapse; however, the~$10$ and~$10.5\, M_{\odot}$ models experience off-center Ne burning that makes these stars prohibitively computationally expensive to run until core collapse, so we simulate these models through Ne ignition and at least five years of Ne burning flame propagation. In addition, we create hydrogen-poor (H-poor) stellar models following the methods of \citet{fuller2018}, Appendix A\footnote{Model parameters are available at https://zenodo.org/communities/mesa.}. Starting with models of the same initial masses ($M_{\rm ZAMS}$) as the aforementioned hydrogen-rich (H-rich) supergiant models, we remove the hydrogen envelope after core helium (He) burning so that the resulting H-poor, stripped star models have nearly the same He core masses as the H-rich models. Accordingly, the stripped star models with initial mass~$10$ and~$10.5\, M_{\odot}$ experience the same off-center Ne ignition as their supergiant counterparts, while all other stripped star models are evolved until core collapse. Beginning at core carbon burning, we capture the wave-driven mass loss as in \citet{fuller2018} by setting the outer boundary at an optical depth of~$\tau = 10^{-2}$. Material that flows past this outer boundary is removed from the grid, and we define mass loss rates in the paper as the mass flux through this outer boundary. At each timestep, we perform the same calculations described in Section 2.2 of \citet{Wu2021} and above for the convective burning regions in each model. This gives us the amount of wave heat transmitted, including possible non-linear effects. We then add the wave heat in each cell of the model using Equation~\ref{eq:dLdm}. \section{Results} \label{sec:results} \subsection{Wave Heating Rates} \label{sec:results1} In all our models, the most important contribution to wave heating occurs during Ne burning roughly $5-20$ years before core collapse. The next major contribution to wave heating from Si burning is energetic, but occurs too near core collapse for waves excited by Si burning to reach the surface of our supergiant progenitors. We do not simulate Si burning in our~$M < 11\, M_{\odot}$ models. The~$M < 11\, M_{\odot}$ models in this work extend our wave heating study down to lower-mass stars in which Ne ignites off-center. This difference greatly affects the amount of wave power produced by the~$10 \text{--} 10.5\, M_{\odot}$ supergiant models, bringing the wave energy deposition rate down by~$1\text{--}2$ orders of magnitude compared to the less degenerate and centrally burning~$11\, M_{\odot}$ model (see Figure~\ref{fig:10to13surf}, top left panel). The main reduction in wave heating arises from lower wave escape fractions from the core occurs because the excited wave spectrum peaks at higher angular wavenumber than the central burning models. As described in Section~\ref{sec:equations1} and in more detail in \citet{Wu2021}, the peak of the wave spectrum in angular wavenumber~$\ell$ occurs for~$\ell \gtrsim \ell_{\rm con} = r/\min(H,\Delta r)$, which is evaluated at the top of the burning shell. Figure~\ref{fig:10v11lcon} shows how the decrease in scale height~$H$ with radius causes the value of~$\ell_{\rm con}$ to increase rapidly as a function of radius in both a centrally-burning ($11\, M_{\odot}$) and off-center burning ($10\, M_{\odot}$) model. Since the off-center burning shell extends to larger radii than a core burning region, waves excited due to Ne burning in a~$10\, M_{\odot}$ model peak at higher~$\ell$. For the snapshot shown,~$\ell_{\rm con} \sim 3~$ for the~$10\, M_{\odot}$ model so its wave spectrum typically peaks at around~$\ell \sim 4$, while~$\ell_{\rm con} \sim 1.5$ for the~$11\, M_{\odot}$ model so its wave spectrum typically peaks around~$\ell \sim 2\text{--}3$. The bottom left panel of Figure~\ref{fig:10fesc} demonstrates that the escape fraction is many orders of magnitude smaller for high-$\ell$ waves, shown here for a~$10\, M_{\odot}$ supergiant model but also generally true in all our models. Hence, when the wave spectrum peaks at higher~$\ell$, more of the initial wave power~$L_{\rm wave}$ is distributed to waves that can only escape with a tiny fraction of their original power. The ultimate heating rate~$L_{\rm heat,\ell}$ is dominated by low~$\ell$ waves which only carry~$\dot{E}_{\ell} \lesssim 0.1\, L_{\rm wave}$ (top left panel of Figure~\ref{fig:10fesc}). Since off-center burning excites a wave spectrum that peaks at higher~$\ell$, wave heating is thus strongly reduced. For the most part, convective excitation of waves in the stripped star models matches that of the supergiant stars, as expected given their nearly equal He core masses. Nevertheless, subtle structural differences in the stripped star models can modify their wave heating rates. In our stripped star models, Ne ignites at a different temperature~$T_{\rm burn, Ne}$ than in the supergiant models. Though both the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star and supergiant models ignite off-center at similar radii, the stripped star model is a little denser and hotter at the center compared to the supergiant when Ne burning begins. Given slightly higher~$T_{\rm burn, Ne}$, convection in the temperature-sensitive Ne burning shell is more energetic, which raises~$L_{\rm con}$,~$\mathcal{M}_{\rm con}$ and consequently~$L_{\rm wave}$ by a factor of a few in the stripped star. More vigorous core convection also produces higher~$\omega$, which affects the escape fraction of the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star. Comparing the left and right panels of Figure~\ref{fig:10fesc}, we see that~$f_{\rm esc,\ell}$ is generally higher during Ne burning for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star. Figure~\ref{fig:10Mprop} shows propagation diagrams for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ supergiant and stripped star models during Ne burning for typical wave frequencies. The stripped star model tends to excite higher~$\omega$ by a factor of two, and as demonstrated in the figure, these waves encounter smaller evanescent zones. Thus waves have a larger transmission coefficient $T_{\rm min}^2$ and a larger escape fraction in the stripped star. The combination of increasing both~$f_{\rm esc,\ell}$ and~$L_{\rm wave}$ accordingly raises the wave energy deposited in the envelope by an order of magnitude in the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star (see Figure~\ref{fig:10to13surf}) relative to the H-rich model. For other masses, the difference in wave heating rates between H-rich and H-poor models is much smaller and stems mainly from slight differences in the core structure that affect $T_{\rm burn, Ne}$ and consequently $L_{\rm wave}$ as discussed above. As discussed in \citet{Wu2021}, our updated implementation of wave physics tends to reduce our wave heating rates by an order of magnitude compared to earlier results such as \citet{fuller2017} and \citet{fuller2018}. Prior work did not model non-linear wave dissipation and assumed that wave power was mainly excited in~$\ell=1$ waves. In particular, the wave heating history of our models is now dominated by a brief burst of very high~$L_{\rm heat,\ell}$ waves excited during Ne burning. We do not produce high wave power sustained for longer periods, such as that during core O burning sustained for~$\sim \! 1$ yr in \citet{fuller2017} and \citet{fuller2018}. \subsection{Wave Dissipation} Both the lower energy scale and sudden, short-duration nature of wave heating influence the hydrodynamical response of our models' interior structures. In the left column of Figure~\ref{fig:11Ebind}, the density and exterior binding energy of the~$11\, M_{\odot}$ supergiant star are plotted as a function of mass coordinate for a model during Ne burning where the instantaneous wave power is~$\sim \! 10^{9}\, L_{\odot}$. The density and effective~$M_{\rm damp}$ (middle panel) drop at the core-envelope transition in the star, so that most of the waves damp their energy at the base of the supergiant envelope at around~$M \sim 3.4 M_{\odot}$. Wave energy is therefore deposited where the binding energy of overlying material is still high,~$E_{\rm bind} \sim 10^{48}\, \mathrm{erg} > E_{\rm waves}$ (see Figure~\ref{fig:10to13surf}, top panel for~$E_{\rm waves}$). The density profile of the supergiant star experiences only minuscule changes due to wave heating, and the deposited wave energy is unable to unbind the overlying envelope mass. Waves in the other supergiant models, which carry much less energy into the envelope than the~$11\, M_{\odot}$ model, likewise deposit their energy without unbinding any material or greatly affecting the density profile of the star. Our stripped star models lack an overlying hydrogen envelope, so the binding energy is smaller at the edge of the core, as shown in the right panel of Figure~\ref{fig:11Ebind}. Waves again damp most of their energy where the damping mass drops outside the core, which for a stripped star is very close to the surface with only~$M_{\rm ext} \sim 10^{-2}\, M_{\odot}$ of overlying mass. For the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model shown in Figure~\ref{fig:11Ebind}, waves with a typical heating rate of $L_{\rm heat, \ell} \gtrsim 10^9\, L_{\odot}$ still damp out where~$E_{\rm bind} \sim 10^{48}$ erg~$> E_{\rm waves}$ since~$M_{\rm damp}$ is smaller for such large $L_{\rm heat, \ell} = L_{\rm ac}$ (Equation \ref{eq:Mdampshock}). Thus the waves excited by Ne burning are not able to unbind the~$M_{\rm ext} \sim 10^{-3} \text{--} 10^{-2}\, M_{\odot}$ of exterior material. Unlike the supergiant models, however, the envelope of this stripped star model inflates above the heating region, flattening the density profile. In the other stripped star models, where the wave energy deposited is at least a few times lower (Figure~\ref{fig:10to13surf}), smaller $L_{\rm heat,\ell}$ leads to larger $M_{\rm damp}$, so waves damp further out where~$E_{\rm bind} \sim 10^{47}$ erg. Again,~$E_{\rm wave} \lesssim E_{\rm bind}$ where the waves damp, so waves are also not able to unbind the overlying envelope in the other stripped star models. The bottom panels of Figure~\ref{fig:11Ebind} show the following timescales for the~$M_{\rm ZAMS} = 11\, M_{\odot}$ supergiant (left) and stripped star (right): the local wave heating timescale, \begin{equation} t_{\rm heat} = \frac{c_s^2}{\epsilon_{\rm wave}} \end{equation} where~$\epsilon_{\rm wave}$ is defined in Equation~\ref{eq:dLdm}; the thermal cooling timescale, \begin{equation} t_{\rm therm} = \frac{4\pi\rho r^2 H c_s^2}{L} \end{equation} where~$L$ is the local luminosity; and the local dynamical timescale, \begin{equation} t_{\rm dyn} = \frac{H}{c_s}. \end{equation} Both the supergiant and stripped star models lie in the moderate heating regime where~$t_{\rm dyn} < t_{\rm heat} < t_{\rm therm}$. Wave heat is not transported outward thermally, but the local pressure will gradually increase and the star will expand quasi-hydrostatically in response. This result differs from \citet{fuller2017}, which also treated wave heating in a supergiant model. \citet{fuller2017} found~$t_{\rm heat}$ could become shorter than both~$t_{\rm therm}$ and~$t_{\rm dyn}$ during Ne burning, so that wave heating entered a dynamical regime and launched a pressure wave propagating at the sound speed. The difference arises because \citet{fuller2017} do not include the weak shock dissipation introduced in \citet{fuller2018}. For our supergiant models with weak shock dissipation, this reduces the effective~$M_{\rm damp}$ of our models compared to \citet{fuller2017} and causes the waves to damp at smaller mass coordinates with smaller values of $t_{\rm dyn}$. As a result, the supergiant models now lie in the moderate heating regime. Our stripped star models remain consistent with \citet{fuller2018}, who also find that~$t_{\rm dyn}<t_{\rm heat} < t_{\rm therm}$ in the wave heating region. \begin{figure*} \centering \includegraphics[width=\textwidth]{velocitygrid.pdf} \caption{Velocity pulse propagation due to first wave heating phase from Ne ignition in the following models, clockwise from top left:~$M_{\rm ZAMS}=11\, M_{\odot}$ supergiant model,~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model, ~$M_{\rm ZAMS}=12\, M_{\odot}$ stripped star model, $M_{\rm ZAMS}=12\, M_{\odot}$ supergiant model. Shading corresponds to the time since Ne ignition. } \label{fig:vgrid} \end{figure*} \begin{figure*} \includegraphics[width=0.515\textwidth]{10to13surfprops_sinceNe_lin.pdf} \includegraphics[width=0.485\textwidth]{10to13surfprops_sinceNe_lin_stripped.pdf} \caption{Left: Integrated wave energy deposited, surface luminosity, effective temperature, star radius, and surface velocity as a function of time since Ne ignition for the supergiant models shown in the legend. Right: Same as left panel for the stripped star models with initial masses as shown in the legend. For models that reach core collapse, indicated by the star symbol at the end of each curve, the evolution is shown until 3 days before core collapse. } \label{fig:10to13surf} \end{figure*} \subsection{Pre-supernova evolution} \label{sec:results2} Once wave heat is deposited in our supergiant models, a small fraction of the energy is put into the kinetic energy of a velocity pulse (i.e., a pressure wave) that travels across the envelope of the star. The left column of Figure~\ref{fig:vgrid} shows the propagation of the velocity pulse due to wave heating from Ne burning in the~$11\, M_{\odot}$ and~$12\, M_{\odot}$ supergiant models. The pulse does not exceed~$v/c_s \sim 0.1$ in either model until it steepens at the surface of the supergiants to~$v/c_s \sim 0.2$. The stars otherwise expand quasi-hydrostatically in response to this velocity pulse. As the surface velocities are quite small, with~$v < v_{\rm esc}$ in all the supergiant models, the surfaces of these stars expand slightly but remain bound. Note that in our supergiant models, although more wave heat is deposited in the envelope of the~$11\ M_{\odot}$ model and its pressure pulse initially has more kinetic energy, peaking at~$v/c_s \sim 0.1$, the kinetic energy in the pulse decreases greatly as it propagates so that the surface velocity of the~$11\, M_{\odot}$ model is smaller than that of the~$12\, M_{\odot}$ model. In contrast, the pulse in the~$12\, M_{\odot}$ supergiant model begins with a lower peak value because a few times less wave energy was deposited, but it only experiences a very shallow decline before it steepens at the surface. We attribute this counter-intuitive result to the different profiles of~$t_{\rm therm}$ in the models. As seen in the bottom panel of Figure~\ref{fig:11Ebind},~$t_{\rm therm}$ decreases by a few orders of magnitude at~$m \sim 3.5\, M_{\odot}$, just above the wave heating region at the base of the convective envelope. This dip occurs where the convective flux increases in response to the extra deposited energy (see Section~\ref{sec:TDC} for a discussion of this phenomenon). In the~$11\, M_{\odot}$ model, the small~$t_{\rm therm}$ in this location may allow the convective flux to carry away some energy from the pulse, causing the velocity to decline as in Figure~\ref{fig:vgrid}. The value of~$t_{\rm therm}$ drops less steeply in the~$12\, M_{\odot}$ model, so the local luminosity is not as efficient in carrying energy away from the pressure pulse. As the other models all deposit less wave energy, their velocity pulses emulate the~$12\, M_{\odot}$ model in this respect. In the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model shown in the top right of Figure~\ref{fig:vgrid}, the heating generates a rapid expansion with Mach number~$\mathcal{M} \sim 50$ near the surface of the star. The response of convection to wave-heating as described above for the supergiants does not apply for the stripped stars, since they lack a convective hydrogen envelope. In the~$M_{\rm ZAMS} = 12\, M_{\odot}$ model (shown in the bottom right of Figure~\ref{fig:vgrid}), less wave heat is deposited and the velocity pulse accelerates to lower values of~$\mathcal{M} \sim 2$. This is representative of the other stripped star models, which deposit comparable amounts of wave energy. Each pressure wave breakout corresponds to spikes in luminosity and effective temperature and initiates rapid envelope expansion of the stripped stars. However, only the expansion driven by the most energetic~$M_{\rm ZAMS} = 11\, M_{\odot}$ model directly after Ne ignition accelerates any stellar material to~$v_{\rm esc} \sim 400$ km/s, and only a very small amount of mass ($M\sim 10^{-6} M_{\odot}$) achieves that velocity. The other stripped star models expand without ejecting any mass. Figure~\ref{fig:10to13surf} shows the evolution of the surface properties of our models, in parallel with the integrated wave energy deposition as a function of time since Ne ignition. In the supergiant models, the surface luminosity~$L$, effective temperature~$T_{\rm eff}$, radius~$R$, and surface velocity oscillate from Ne ignition onward. Wave heating from Ne ignition initiates these oscillations, which persist until core collapse for the~$11\text{--}13\, M_{\odot}$ models. The amplitude of these fluctuations is small, ranging from almost no variation in the~$10\, M_{\odot}$ model where $E_{\rm wave} \sim 10^{45}$ erg to oscillation amplitudes of a few percent in the~$10.5\text{--}13\, M_{\odot}$ models with $10\text{--}100$ times more wave heating. Though our stripped star models mostly deposit comparable amounts of energy in the envelope, the surface properties of these models behave extremely differently from their supergiant counterparts. The initial pressure pulse breakout originating from wave heating due to Ne ignition generates upward spikes in~$L$ by a factor of a few for most models, although the luminosity of the most energetic~$M_{\rm ZAMS} = 11\, M_{\odot}$ model temporarily jumps by over an order of magnitude. The luminosity in each model also tends to spike downward briefly before becoming brighter than before wave heating began. Overall, the stripped star models exhibit significant photospheric cooling and expansion, where~$T_{\rm eff}$ drops by up to a factor of a few and the radius of the star rapidly increases by up to an order of magnitude. The properties of the lowest-mass~$M_{\rm ZAMS} = 10\text{--}10.5\, M_{\odot}$ models change less dramatically; for instance, these models expand only by a factor of $2\text{--}3$. After Ne ignition, a second step-like increase in~$E_{\rm waves}$ occurs for the~$M_{\rm ZAMS} = 11\text{--}13\, M_{\odot}$ models at a few years after Ne ignition. This is due to a second surge of wave heating from core Ne burning, since the burning fuel is replenished when some Ne is mixed downward into the core. This tends to initiate another cooling and expansion phase in the stripped stars, so that over the period between Ne ignition and core collapse, the models exhibit two bumps in radius and dips in~$T_{\rm eff}$. In the~$M_{\rm ZAMS} = 12\text{--}13\, M_{\odot}$ models, the first cool, expanded phase lasts~$\sim 1\text{--}2$ years before returning to near pre-wave heating values; meanwhile, the second Ne burning phase causes the stars to expand less dramatically for a brief period of months. However, these phases last for~$\sim \! 5$ years each in the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model, attaining a similar peak radius and $T_{\rm eff}$ each time. Note that this second burning phase also causes spikes in~$L$ and~$T_{\rm eff}$ for the~$M_{\rm ZAMS} = 12\text{--}13\, M_{\odot}$ stripped star models at around 5 and 3 years since Ne ignition respectively. The models oscillate in~$L$ and~$T_{\rm eff}$ because the Ne abundance in the core is fluctuating. This drives oscillations in the burning rate and~$L_{\rm con}$, which in turn causes the wave heating rate and surface properties to fluctuate. Increasing the resolution of our models did not consistently remove this effect, so it is unclear whether this effect is physical or numerical in nature. Different treatments of convective overshoot could affect the core Ne abundance as well. Although we predict little hydrodynamically-driven mass loss, the large changes in surface luminosity exhibited by the stripped star models affects the wind mass loss rates of these stars. Using the following wind mass loss rate from \citet{Nugis2000}, \begin{equation} \label{eq:Mdotwind} \begin{split} \log \dot{M}_{\rm wind} = & -11 + 1.29\log L \\ & + 1.73 \log Y + 0.47 \log Z, \end{split} \end{equation} we calculate the expected mass loss rate from winds in each of the stripped star models due to their elevated luminosity after Ne burning. We find that the increased mass loss from winds is an order of magnitude larger than directly ejected material, but still very small. The wind mass loss rates in our models peak at~$\dot{M} \sim 10^{-5}\, M_{\odot}\text{/yr}$, and the models lose a few$\times 10^{-5}\, M_{\odot}$ between Ne ignition and core collapse. \section{Discussion} \label{sec:discussion} \subsection{Parameter testing} \label{sec:paramtest} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{paramtest_ener.pdf} \caption{Integrated wave energy deposited as a function of time since neon ignition for supergiant (left column) and stripped star (right column) models with the initial masses shown in each panel. Each panel shows the variation in wave energy deposition for each model as either the wave frequency (Equation~\ref{eq:omega}) or the power put into waves (Equation~\ref{eq:lwave}) is increased and decreased by a factor of 3. As in Figure \ref{fig:10to13surf}, models that reach core collapse are indicated by the star symbol at the end of each curve. } \label{fig:Ewavesparam} \end{figure} To investigate how our results may vary if our assumptions about wave power and frequency do not accurately represent the true values, we ran simulations with different values for~$L_{\rm wave}$ (Equation~\ref{eq:lwave}) and~$\omega$ (Equation~\ref{eq:omega}). For each model in Figure~\ref{fig:10to13surf}, we repeated the methods of Section~\ref{sec:methods}, each time making one of the four following changes: \begin{enumerate}[noitemsep] \item~$\omega = 3\omega_{\rm con}$ \item~$\omega = 0.3 \omega_{\rm con}$ \item~$L_{\rm wave} = 3 \mathcal{M}_{\rm con} L_{\rm con}$ \item~$L_{\rm wave} = 0.3 \mathcal{M}_{\rm con} L_{\rm con}$. \end{enumerate} These variations allow us to test how our results would change if our initial assumptions for the power and frequency of the excited waves either overestimate or underestimate reality. With these simulations along with our original models, we span an order of magnitude of uncertainty in these initial assumptions. Note that we do not change our assumed wave spectrum for these tests, so changes in~$\omega$ only affect the dispersion relation and related quantities outlined in Section~\ref{sec:physics}. \begin{figure*} \centering \includegraphics[width=0.51\textwidth]{11Mparamtest.pdf} \includegraphics[width=0.47\textwidth]{11Mparamtest_stripped.pdf} \caption{Left panel: Same quantities as in Figure~\ref{fig:10to13surf} are shown for an~$11\, M_{\odot}$ supergiant model. As in Figure~\ref{fig:Ewavesparam}, each panel plots the different evolution of each model as either the wave frequency or power is varied (see Section~\ref{sec:paramtest} for details). Right panel: Same as left for the~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model. As in Figure \ref{fig:10to13surf}, models that reach core collapse are indicated by the star symbol at the end of each curve. } \label{fig:11surfparam} \end{figure*} Figure~\ref{fig:Ewavesparam} shows how the wave energy that escapes to heat the envelope changes as we vary these parameters in each model. We omit~$M_{\rm ZAMS} = 10.5\, M_{\odot}$ as its evolution due to off-center Ne ignition proceeds similarly to~$M_{\rm ZAMS} =10\, M_{\odot}$. For all models, the wave heating history remains the same -- jumps in~$E_{\rm waves}$ occur at the same times, as changing~$L_{\rm wave}$ or~$\omega$ has no bearing on when the model develops convective regions. As noted in \citet{Wu2021}, wave energy transmission in the mass range~$11\text{--}15\, M_{\odot}$ is not significantly altered by non-linear effects, so for these models the wave energy escape generally increases (decreases) by a factor of~3 as we increase (decrease)~$L_{\rm wave}$ by a factor of~3. However, the~$3 L_{\rm wave}$ variations upon each of the~$M_{\rm ZAMS} = 10\, M_{\odot}$ models and the~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model do not show as large of an increase in wave energy; in fact, slightly less wave energy escapes for the~$M_{\rm ZAMS} =10\, M_{\odot}$,~$3 L_{\rm wave}$ variation than the original run. This is due to non-linear effects in these models -- increasing~$L_{\rm wave}$ also increases the wave non-linearity~$|k_r\xi_r|^2$ by the same factor, which for non-linear waves effectively reduces the wave power back to that of the original run. Changing~$\omega$ affects the escape fraction and wave non-linearity. In the core, higher frequency waves will experience less attenuation due to neutrino and thermal losses in the g-mode cavity, and they have larger escape fractions. The non-linearity factor goes as~$|k_r\xi_r|^2 \propto \omega^{-4}$, so higher frequency waves are much less non-linear. Thus, we ultimately find that increasing (decreasing) wave frequency increases (decreases) the wave energy escape, in some models more drastically than others depending on the magnitude of the change in~$f_{\rm esc,\ell}$ and whether non-linear effects are important for those waves. The variation in surface properties as we vary~$\omega$ and~$L_{\rm wave}$ is shown for an~$11\, M_{\odot}$ supergiant model in the left panel of Figure~\ref{fig:11surfparam}. All the models exhibit oscillations of varying amplitude which persist until core collapse, with larger jumps occurring soon after wave heating episodes. The amplitude of the oscillation tends to be larger for variations with more wave heating such as~$3 L_{\rm wave}$ and~$3 \omega$ and much smaller for less energetic models like~$0.3 L_{\rm wave}$ and~$0.3 \omega$. Moreover, the more energetic runs tend towards larger~$L$ and~$R$ and smaller~$T_{\rm eff}$ than the original run, whereas the surface properties of the less energetic variations deviate less from the quiescent values than the original run. In contrast, the stripped star with~$M_{\rm ZAMS}=11 M_{\odot}$ exhibits much larger changes in its surface properties due to the variations in $\omega$ and $L_{\rm wave}$ (Figure~\ref{fig:11surfparam}, right panel). The luminosity may vary by a factor of~$\sim$2 in either direction compared to the original run, but more energetic models (larger~$L_{\rm wave}$ or~$\omega$) are generally brighter, with larger photospheric radii and lower temperatures. The~$3 L_{\rm wave}$ run cools and expands more than the original run right after Ne ignition, remaining larger and cooler than all other runs until core collapse. In the least energetic~$0.3 L_{\rm wave}$ and~$0.3 \omega$ runs, wave heating causes the star to initially cool by a factor of~$\sim 2\text{--}2.5$ and expand to tens of~$R_{\odot}$ before returning to radii and temperatures near that of quiescence after about a year. The behavior of the~$11 \, M_\odot$ models shown in Figure~\ref{fig:11surfparam} qualitatively represents that of the other masses, though variations in the~$10 \, M_\odot$,~$10.5 \, M_\odot$,~$12 \, M_\odot$, and~$13 \, M_\odot$ models are on somewhat smaller scales since less wave heat is deposited in the envelopes of those models. \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HR.pdf} \caption{Evolution on the Hertzsprung-Russell diagram for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model (green) and a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$ (cyan) from just before Ne ignition (cross) until core collapse (star). Each dot is separated by an interval of 1 hour. } \label{fig:11MHR} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HSTabsmag_wnoheat.pdf} \caption{Top: Evolution of absolute magnitude (AB mag) in four HST bandpasses as a function of time since Ne ignition for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model. The absolute magnitudes of the same model with no wave heating are plotted in grey, with line styles corresponding to the same line styles of each bandpass in the legend. Bottom: Same for a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. } \label{fig:11Mmag} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HSTcolors_wnoheat.pdf} \caption{Top: Evolution of several color indices (AB mag) as a function of time since Ne ignition for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model. The colors of the same model with no wave heating are plotted in grey, with line styles corresponding to the same line styles of each bandpass in the legend. Bottom: Same for a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. } \label{fig:11Mcolor} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_sinceNe_lin_stripped.pdf} \caption{Same quantities as in Figure~\ref{fig:10to13surf} are shown for the H-poor~$M_{\rm ZAMS} =11\, M_{\odot}$ model and a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. The star symbol at the end of each curve indicates that both models reach core collapse. } \label{fig:11moreHsurfparam} \end{figure} \subsection{Comparison with Progenitor Observations} Since the changes in the surface properties of our supergiant models are quite small, we do not expect a large observational signature of wave heating in these stars. However, our stripped star models start out as hot, compact He stars, but expand greatly and become cooler for years due to wave heating. Figure \ref{fig:11MHR} shows the evolution of the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model on the HR diagram from just before Ne ignition until core collapse. A model without wave heat would remain at the point labeled ``Pre-Ne Ignition'' on the green curve in Figure \ref{fig:11MHR} until core collapse. In contrast, the star initially moves to large~$L$ and~$T_{\rm eff}$, then to small~$L$ and~$T_{\rm eff}$, over a few hours when the shock launched by wave heating breaks out. It then spends months moving to a more luminous but cooler state. The star remains in that region of the HR diagram for years, with some continued variability due to fluctuating amounts of wave heat emerging from the core. The top panel of Figure \ref{fig:11Mmag} shows lightcurves in four \textit{Hubble Space Telescope} WFC3/UVIS bands as a function of time since Ne ignition for this model. Each absolute magnitude was calculated by integrating over a blackbody at~$T_{\rm eff}$ convolved with the transmission function for each bandpass filter and is reported in AB magnitudes. The brightness in all bands jumps once wave heating begins at Ne ignition. Note that the bolometric absolute magnitude will only decrease by~$\sim$1, but the visual band magnitudes decrease by~$\sim$3 magnitudes. This is a consequence of the star cooling from~$\approx$40,000 K to~$\approx$15,000 K, causing a much larger fraction of its flux to be emitted in optical bands rather than the UV. Like its brightness, the color of our~$M_{\rm ZAMS}=11 \, M_\odot$ H-poor model varies over the last few years of its lifetime. The top panel of Figure \ref{fig:11Mcolor} shows the evolution of some color indices for this star, again in AB mags. Before Ne ignition the star is brightest in UV, but due to wave heating the star reddens (but remains fairly blue) with F438W$-$F555W rising to near zero. A few potential Type Ib/c supernova progenitors have been observed and are indeed bluer than type II SN progenitors, but in some cases they are cooler or more extended than a typical massive helium star \citep{Cao2013,Xiang2019,Kilpatrick2021}. Among our stripped-star models, which represent type Ib SN progenitors, certain periods of evolution could reproduce these characteristics. For example, \citet{Eldridge2015} find that the progenitor candidate of iPTF13bvn has brightness between $\mathrm{M}_{\rm F435W} = -6.15$ to $-6.67$ mag, $\mathrm{M}_{\rm F555W} = -6.1$ to $-6.49$ mag, and $\mathrm{M}_{\rm F814W} = -5.95$ to $-6.13$ mag. Our~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model can match these ranges at around 6 months--5 years after Ne ignition. The same~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model can match the brightness of $\mathrm{M}_{\rm F555W} \gtrsim -5.5$ mag observed by \citet{Kilpatrick2021} for the progenitor of SN2019yvr during most of the 10 years after Ne ignition. However, \cite{Kilpatrick2021} finds the potential progenitor to be much cooler than what our hydrogen-poor models reach, deriving~$T_{\rm eff} = 6800^{+400}_{-200}$ K from models which account for both host and Milky Way extinction. They also report observations of $\mathrm{M}_{\rm F555W}-\mathrm{M}_{\rm F814W} = 1.065\pm0.045$ mag, but this accounts only for Milky Way extinction and not yet host extinction. Nevertheless, based on these values, our ~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model would not be able to explain the SN2019yvr progenitor, as it only attains $\mathrm{M}_{\rm F555W}-\mathrm{M}_{\rm F814W} \sim -0.5$ mag. \citet{Sun2021} find that if the source in \citet{Kilpatrick2021} is a binary system, then the progenitor of SN2019yvr could have~$\log( T_{\rm eff}/K) = 4.03$ and~$R/R_{\odot} = 57$ with likely initial mass~$\sim \! 11\, M_{\odot}$. Our~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model matches these observational constraints fairly well for the last 10 years of its life. Yet in both cases, the small amount of progenitor variability over~$\sim$100 days of HST observations \citep{Kilpatrick2021} may disfavor the wave-heated progenitor interpretation. A stripped star model with a very small amount of hydrogen remaining in the envelope might explain cooler progenitors, as even a hundredth of a solar mass of hydrogen in the envelope causes the star to expand more and reach lower temperatures \citep{Laplace2020}. In our fiducial stripped star models, we strip the star of its envelope so that a negligible amount of hydrogen remains in the envelope ($M_H \lesssim 10^{-3}\, M_{\odot}$) from carbon burning onward. In Figure \ref{fig:11moreHsurfparam}, we compare our fiducial~$M_{\rm ZAMS} = 11\, M_{\odot}$ H-poor model with an~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$ of hydrogen in the envelope from carbon burning onward, evolving the hydrodynamic response to wave heating as in the rest of our models. Even before wave heating begins, the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star with~$M_H = 10^{-2}\, M_{\odot}$ expands to~$\sim 80\, R_{\odot}$ just before Ne burning. However, its luminosity just before Ne burning matches that of the H-poor model, and accordingly is a factor of~$4$ times cooler before Ne burning. This star would also remain at the point labeled ``Pre-Ne Ignition'' on the cyan curve in Figure \ref{fig:11MHR} until core collapse in the absence of wave heating. The wave heating history of the two models, shown in the top panel of Figure \ref{fig:11moreHsurfparam}, is similar, but the model with~$M_H = 10^{-2}\, M_{\odot}$ cools and expands in response to wave heating from Ne burning so that it is slightly less luminous than the H-poor model until core collapse (Figure \ref{fig:11MHR}). Since the~$M_H = 10^{-2}\, M_{\odot}$ model expands to more than~$100 \, R_\odot$, its photospheric cools to the range~$T_{\rm eff} = 6800^{+400}_{-200}$~K derived by \citet{Kilpatrick2021} for the progenitor of SN2019yvr. Consequently, the model with~$M_H = 10^{-2}\, M_{\odot}$ is redder than the fiducial model (Figures \ref{fig:11Mmag} and \ref{fig:11Mcolor}), though it can also explain the color of iPTF13bvn's progenitor estimated in \citet{Eldridge2015}. The model with more hydrogen exemplifies the varied evolution that can ensue depending on the residual hydrogen content of the stripped progenitor, which depends sensitively on the binary and wind mass loss that created the SN progenitor. \subsection{Related Mass Loss Mechanisms} \label{sec:massloss} An interesting aspect of the stripped star models is their expansion from a few~$R_{\odot}$ to tens of~$R_{\odot}$. As stripped stars are likely to be in a binary system, this substantial, fast expansion may instigate binary mass transfer. The resulting rapid mass transfer could drive more mass loss from the system, or it could lead to unstable mass transfer that results in a common envelope event or stellar merger (see also \citealt{Mcley2014}). Since the mass loss is triggered in the final years before core-collapse, the ejected mass would still be near the progenitor at the time of core-collapse. Hence, this wave-induced binary interaction is a potential channel for generating larger CSM masses that should be explored in future work. In our~$10$ and~$10.5\, M_{\odot}$ models, we investigated only the initial Ne ignition and the progress of the ensuing off-center flame for~$6\text{--}8$ years after Ne ignition, which encapsulated the majority of wave heating due to Ne burning. Yet this mass range may exhibit interesting behavior beyond this period of its evolution, as degenerate silicon ignition is highly energetic. On the one hand, this silicon burning could excite waves with very high wave power which have greater potential to eject mass. On the other hand, \citet{Woosley2015} have found that silicon deflagration can occur in stars of this mass range, in which the silicon flash is violent enough to drive a shock and eject mass. Though it is computationally expensive to simulate late-stage nuclear burning this mass range, the period of Si burning should be studied in more detail as a possible mechanism for driving mass loss in these stars. \subsection{Time Dependent Convection} \label{sec:TDC} In our supergiant models, the internal luminosity can suddenly spike by a few orders of magnitude at the base of the convective envelope due to wave heating in this region. This manifests in the bottom panel of Figure~\ref{fig:11Ebind}, where~$t_{\rm therm}$ dips at a mass coordinate of~$3.5\, M_{\odot}$ -- which is due to an associated jump in the luminosity of the model at that location. This is caused by a sudden increase in the convective luminosity on a time scale comparable to the convective turnover time scale, which may not be physical, and calls for a time-dependent treatment of convection. In the results presented in this work, we have tried to partially mitigate unphysically large convective accelerations by using the MESA option \texttt{mlt\_accel\_g\_theta = 1} in our supergiant models, which limits convective acceleration to the local gravitational acceleration. However, a more rigorous treatment of time-dependent convection (TDC) could further limit convective acceleration. This will affect whether wave heat is transported outward by convection, or whether it can be used to hydrodynamically drive a pressure pulse through the star. To try to understand the range of possibilities, we investigated the efficacy of more sophisticated schemes to limit convective acceleration and deceleration. Following \citet{Renzo2020}, we tried limiting convective acceleration based on the methods of \citet{Wood1974}. This method failed to create a physical model as spurious drops in luminosity at the surface of the convective envelope occurred. We also attempted the second treatment of TDC in \citet{Renzo2020}, in which they use MESA v11123 to solve for convective velocity using their Equation 2 instead of using MLT. Unfortunately, a model using this method was unable to evolve through the extremely energetic degenerate Ne ignition. Finally, we tested the response of a supergiant star's convective envelope to added heat at the base of the envelope using an implementation of TDC that is available in a recent development version of MESA. A model using this TDC treatment exhibits almost identical behavior in the convective envelope to that of the models presented here, but with more numerical difficulties that make it difficult to apply to many models or to run them until core-collapse. Consequently, we choose to present our models that limit convective acceleration by \texttt{mlt\_accel\_g\_theta = 1} and successfully run to core collapse, with the understanding that the convective behavior appears similar with more sophisticated convective acceleration schemes. However, from preliminary tests, the surface properties of the TDC model differed slightly from the results presented here. Moreover, it is possible that TDC could affect the progression of core convection at Ne ignition, which has implications for the wave heating results. We therefore emphasize the need for further work on how TDC affects the evolution of massive stars. \section{Conclusion} We have modeled the effect of wave heating in red supergiant and stripped-star SN progenitors with ZAMS masses between~$10\text{--}13\, M_{\odot}$ using one-dimensional hydrodynamical simulations in MESA. In our models, we implement the improved wave heating physics of \citet{Wu2021} as we evolve to core collapse for~$M_{\rm ZAMS} > 11\, M_{\odot}$, replicating the wave energy results of that work. We additionally study models with~$M_{\rm ZAMS} \lesssim 10.5\, M_{\odot}$ which experience off-center ignition of Ne burning and are evolved to a few years after Ne ignition. These transmit much less wave heat than the centrally burning models because the wave power is carried primarily by~$\ell \gtrsim 3$ waves that are mostly damped in the core. The most energetic model in this study is the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model, which transmits~$\sim \! 10^{47}~$erg of wave energy to its envelope around~$10$ years before core collapse in a burst of vigorous wave heating during central Ne burning. In our other models, waves are able to carry much less energy to the envelope. The wave energy in all of our supergiant and stripped star models is deposited just outside the core where the binding energy of overlying material is still high, and no mass loss is hydrodynamically driven by wave heating in any model. As a result, we do not predict that any of our models can produce significant CSM masses through wave heating alone. As wave heat is deposited at the base of the hydrogen envelope in our supergiant models, their photospheric properties respond to wave heating with only small oscillations in the final years before core-collapse. In our stripped star models, where wave heat is deposited much closer to the surface of the star, wave heating causes significant photospheric cooling and radial expansion in which~$T_{\rm eff}$ decreases by a factor of a few and~$R$ increases by up to a factor of~$10$. Wave heating causes the brightness of the hydrogen-poor SN progenitors to increase by up to 3 mags in visual bands in the final ten years of evolution. Furthermore, these Ib/c progenitors appear redder in visual bands than predicted by models without wave heating. Our hydrogen-poor wave heated models are approximately consistent with the colors and absolute magnitudes of the progenitors of type Ib SNe iPTF13bvn and SN2019yvr, but low-mass models with a small amount of hydrogen ($\sim \! 10^{-2} \, M_\odot$, with or without wave heating) could also be consistent with those progenitor observations. The large expansion of our hydrogen-poor models could also initiate interaction with a close binary companion, which could drive intense pre-supernova mass loss. Future work should study whether this channel is promising for producing more massive CSM. In addition, subsequent work should simulate the mass range~$\sim \! 8\text{--}10\, M_{\odot}$ beyond the propagation of the off-center Ne burning flame and through degenerate silicon ignition, which should be energetic enough to either directly drive a shock \citep{Woosley2015} or excite intense wave heating. Future investigations that are able to model this late-stage nuclear burning will be able to predict whether these stars can eject mass is the final months of their lives. \section*{Acknowledgments} We thank Adam Jermyn for supplying the time-dependent convection modules from a MESA development version, and Charlie Kilpatrick for help with HST filter functions. This work was partially supported by NASA grants HSTAR-15021.001-A and 80NSSC18K1017. J.F. acknowledges support from an Innovator Grant from The Rose Hills Foundation, and the Sloan Foundation through grant FG2018-10515. This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE‐1745301. \section{Introduction} A subset of core-collapse supernovae (SNe) across nearly all spectroscopic classes exhibit signatures of early interaction with circumstellar material (CSM). In such SNe, the CSM interaction is observed through fast-rising, bright early-time light curves; featureless, blue early spectra that signify a shock-heated envelope or CSM; or narrow emission lines in early spectra that appear when nearby CSM is flash-ionized by the SN breakout. A few recent examples of SNe that demonstrate evidence for early interaction with CSM include the type II events SN2018zd \citep{ZhangJ2020}, SN2013fs \citep{Yaron2017}, and several type II events detected by ZTF \citep{bruch2021}, as well as the type I events LSQ13ddu \citep{Clark2020}, SN2018gep \citep{Ho2019}, SN2019dge \citep{Yao2020}, SN2019uo \citep{Gangopadhyay2020}, and SN2019yvr \citep{Kilpatrick2021}. The CSM observed in these events is usually attributed to elevated mass loss from the progenitor stars that precedes the SN. For type II SNe with early peaks in the light curve, the CSM signatures may also be explained by roughly one solar mass of material in an optically thin stellar chromosphere or corona \citep{Dessart2017,Hillier2019}. Other events present late-time interaction and narrow emission lines, indicating mass loss occurring decades before the SN. Some recent examples include SN2017dio \citep{Kuncarayakti2018}, SN2017ens \citep{Chen2018}, SN2013L \citep{Taddia2020}, iPTF16eh \citep{Lunnan2018}, and SN2004dk \citep{Mauerhan2018,Pooley2019}. Many other events with both early- and late-time interaction are listed in \citet{Wu2021}, \citet{fuller2018}, and \citet{fuller2017}. While pre-SN outbursts have been observed directly in several SN progenitors \citep{Ofek2014}, the majority of SN progenitors may not experience pre-SN outbursts or amplified variability at all. \citet{Kochanek2016} found that progenitor constraints on nearby, well-studied SNe do not support evidence for outbursts, and \citet{Samson2017} found no significant variability in the progenitor for type Ic SN2012fh. \citet{Johnson2018} constrained variability amplitudes to less than~$\sim 10\%$ in four type II-P progenitors. As a result, the mechanisms behind pre-SN mass loss must operate such that they manifest a range in behavior, from elevated mass loss and bright pre-SN outbursts to no unusual variations at all. One promising explanation for pre-SN outbursts is the wave heating model proposed by \citet{Quataert2012}. Internal gravity waves (IGW) are excited as a routine consequence of convection, and the vigorous convection that occurs during late burning stages in massive stars may generate waves carrying more than~$10^7\, L_{\odot}$ of power. These IGW couple with acoustic waves to deposit some of their power in the outer layers of the star, which may be able eject mass or drive outbursts. \citet{Shiode2014} found that more massive stars produced larger wave heating rates, but ensuing outbursts occurred closer to core-collapse. Modeling the wave heating in a~$15\, M_{\odot}$ red supergiant, \citet{fuller2017} found that waves could inflate the envelope and drive a mild outburst, potentially causing mass loss through a secondary shock. \citet{fuller2018} examined hydrogen-poor stars in which they found that wave heating could launch a dense, super-Eddington wind of~$\dot{M} \sim 10^{-2}\, M_{\odot}/\text{yr}$. These studies also predicted large variations in luminosity and temperature as a result of wave heating. In \citet{Wu2021}, we updated the physical model used for wave generation and propagation in \citet{fuller2017} and \citet{fuller2018} to include non-linear wave breaking effects and to more realistically model the wave spectrum excited by convection. By simultaneously accounting for these effects throughout the evolution of core convective shells in a suite of stars with~$M_{\rm ZAMS} = 11 \text{--} 50\, M_{\odot}$, \citet{Wu2021} found that wave heating rates were an order of magnitude lower than adopted in prior work. While most models were unlikely to produce observable pre-SN outbursts, the lowest- and highest-mass stars experienced the highest levels of wave heating and were favored to drive outbursts. \citet{leung2021} surveyed the upper end of this mass range with the updated physics, extending up to~$M_{\rm ZAMS} = 70\, M_{\odot}$ and including hydrogen-poor stars, and likewise predicted less energy deposited in the envelope and less mass loss than prior work. Their hydrodynamical simulations of the most energetic high-mass model ejected at most~$0.01\, M_{\odot}$ of material close to core collapse, forming quite confined CSM. In this paper, we study the low-mass end of models in \citet{Wu2021}, where outbursts are promising due to semi-degenerate central neon ignition, and we now deposit the wave heat in our models as they evolve. We extend our scope down to~$M = 10\, M_{\odot}$ stars to capture the physics of waves generated by semi-degenerate, off-center neon ignition. Additionally, we apply the same wave heating physics to hydrogen-poor models for stripped progenitors. In all our models, we add the wave heat and explore their hydrodynamical response. We find that our updated wave heating rates are not able to drive significant mass loss in either supergiant or stripped-star models and that wave heating only causes small-amplitude surface variability in our supergiant models. However, in our stripped star models we predict large outbursts in luminosity as well as large changes in the photospheric radius and surface temperature, which may be detectable in progenitors of type Ib SNe. \section{Implementation of Wave Physics in Stellar Models} \label{sec:physics} \subsection{Wave Generation and Propagation} \label{sec:equations1} To implement wave energy transport, we follow the procedure of \citet{Wu2021}. We summarize the physics of wave generation and propagation here and refer the reader to Section 2 of \citet{Wu2021} for more details. Gravity waves are excited at the interface between convective and radiative zones and carry a fraction of the kinetic energy of turbulent convection. While our understanding of this process remains incomplete, the power put into waves,~$L_{\rm wave}$, is at least \citep{Lecoanet2013} \begin{equation} \label{eq:lwave} L_{\rm wave} = \mathcal{M}_{\rm con} L_{\rm con} \end{equation} where~$\mathcal{M}_{\rm con}$ is the MLT convective Mach number and~$L_{\rm con}$ is the convective luminosity \citep{Goldreich1990}. We define the convective velocity ~$v_{\rm con}$ as \begin{equation} \label{eq:Lcon} v_{\rm con} = \left(\frac{ L_{\rm con}}{4\pi\rho r^2}\right)^{1/3} \, , \end{equation} and we define the associated MLT convective turnover frequency as \begin{equation} \label{eq:omega} \omega_{\rm con} = 2\pi \frac{v_{\rm con}}{2 \alpha_{\rm MLT} H}, \end{equation} where~$\alpha_{\rm MLT} H$ is the mixing length and~$H$ is the scale height. As in \citet{Wu2021}, we use the power spectrum of waves over angular wavenumber~$\ell$ from \citet{Goldreich1990} and \citet{Shiode2013} to calculate the proportion of wave energy generation per~$\ell$ value,~$\dot{E}_\ell/L_{\rm wave}$: \begin{align} \label{eq:ellpowerspectrum} \frac{d\dot{E}_g}{d \ln \omega d \ln \ell} &\sim L_{\rm wave} \left( \frac{\omega}{\omega_{\rm{con}}}\right)^{\!-a} \left( \frac{\ell}{\ell_{\rm con}} \right)^{\!b+1} \left(1+\frac{\ell}{\ell_{\rm con}}\right) \nonumber \\ & \times \exp \left[-\left(\frac{\ell}{\ell_{\rm con}}\right)^{\!2} \left(\frac{\omega}{\omega_{\rm con}}\right)^{\!-3} \right] \, . \end{align} Here,~$\ell_{\rm con} = r/\min(H,\Delta r)$ is evaluated at the edge of the convective zone and the predicted exponents are $a=13/2$ and $b=2$. This spectrum peaks near the value of~$\ell_{\rm con}$ (see Figure 1 in \citealt{Wu2021}). As Equation \ref{eq:ellpowerspectrum} shows, the wave power drops off steeply for~$\omega>\omega_{\rm con}$, and we do not expect low-frequency waves with $\omega<\omega_{\rm con}$ to contribute much wave power due to tunneling and damping effects described below. We therefore simplify the calculation by setting~$\omega = \omega_{\rm con}$ for all~$\ell$ values, and we normalize the power spectrum to~$L_{\rm wave}$ so that~$\sum \dot{E}_\ell = L_{\rm wave}$. In the WKB limit, linear waves have the dispersion relation \begin{equation} \label{eq:dispersion} k_r^2=\frac{(N^2-\omega^2)(L_{\ell}^2-\omega^2)}{\omega^2 c_s^2}, \end{equation} where~$N^2$ is the squared Brunt-V\"ais\"al\"a frequency,~$k_r$ is the radial wavenumber, and~$L_{\ell}^2 = {\ell}({\ell}+1)c_s^2/r^2$ is the Lamb frequency squared. In the limit that~$\omega \ll N, L_{\ell}$, this reduces to the gravity wave dispersion relation \begin{equation} \label{eq:gravitykr} k_r^2=\frac{\ell(\ell+1)N^2}{\omega^2 r^2} \end{equation} with group velocity \begin{equation} \label{eq:gravityvg} v_g=\omega^2 r/\sqrt{\ell(\ell+1)N^2}. \end{equation} The limit~$\omega \gg N, L_{\ell}$ gives acoustic waves, with dispersion relation \begin{equation} k_r^2=\frac{\omega^2}{c_s^2} \end{equation} and group velocity~$v_g=c_s$. In either of these limits, linear waves propagate freely and approximately conserve their luminosity, apart from damping effects discussed below. If~$\omega > N$ and~$\omega < L_{\ell}$ or vice versa, then the radial wavenumber is imaginary and waves are evanescent. The probability of tunneling through this evanescent zone, or the fraction of transmitted wave energy, is approximately given by the transmission coefficient \begin{equation} \label{eq:transmissioncoeff} T^2 = \exp\left(-2 \int_{r_0}^{r_1} \lvert k_r \rvert dr \right), \end{equation} where the integral is taken over the evanescent zone. As the thickest evanescent zone dominates the wave reflection (see Appendix B2 of \citealt{fuller2017}), we take the minimum value of~$T^2$ out of all evanescent zones,~$T_{\rm min}^2$, to calculate the wave flux tunneling into the envelope. The remaining fraction~$1-T_{\rm min}^2$ of wave energy that encounters the evanescent region is reflected from the boundary of the evanescent zone. In addition, after traveling to the upper edge of the core and back, a wave's energy is attenuated by the factor \begin{equation} \label{eq:fnu} f_{\nu} = \exp\left[2\int_{r_{-}}^{r_{+}} \frac{\gamma_{\nu} + \gamma_{\rm rad}}{v_g} dr\right] \end{equation} where~$\gamma_\nu$ and~$\gamma_{\rm rad}$ are the neutrino and thermal wave energy damping rates respectively,~$v_g$ is the gravity wave group velocity (Equation~\ref{eq:gravityvg}), and the integral is taken over the upper and lower boundaries of the gravity wave cavity. \textbf{Note that the definition of $f_\nu$ assumes the weak damping limit, where the majority of wave energy escapes only after traversing the core multiple times; in the limit of strong damping, where most of the wave energy escapes after traveling to the upper edge of the core once, it is appropriate to use $\sqrt{f_\nu}$ instead. We find that our models are almost always in the weak damping limit, especially when significant wave heating occurs, justifying our approximation for $f_\nu$.} The fraction of wave energy that escapes the core,~$f_{\rm{esc}, \ell}$, is then determined by the transmission coefficient (Equation~\ref{eq:transmissioncoeff}) and energy losses within the core, \begin{equation} \label{eq:heatfrac} f_{\rm esc, \ell} = \left(1+\frac{f_{\nu}-1}{T_{\rm min}^2} \right)^{-1}. \end{equation} Given the escape fraction, the~$\ell$-dependent power that escapes to heat the envelope is \begin{equation} \label{eq:lheatell} L_{\rm heat, \ell} = f_{\rm esc, \ell} \dot{E}_\ell. \end{equation} Equation~\ref{eq:lheatell} holds for waves that remain linear, but waves that experience non-linear wave breaking will experience another source of energy loss before escaping to heat the envelope. A measure of the gravity wave non-linearity as a function of~$\ell$ is \begin{equation} \label{eq:nonlinearity} \left|k_r \xi_r\right| = \left[\frac{2}{T_{\rm min}^2}\frac{f_{\rm esc, \ell} \dot{E}_\ell N [\ell (\ell+1)]^{3/2}}{4\pi\rho r^5\omega^4} \right]^{1/2}. \end{equation} Where~$\left|k_r \xi_r\right| \geq 1$, waves are non-linear, whereas linear waves have~$\left|k_r \xi_r\right| \leq 1$. Such non-linear waves will break and experience an energy cascade to small scales, where their energy dissipates \citep{Barker2010}. This effectively caps the wave amplitude~$\xi_r$ so that~$|k_r\xi_r| \lesssim 1$, therefore reducing the wave power by a factor~$|k_r\xi_r|^2$ when~$|k_r\xi_r| \geq 1$. Thus for non-linear waves, the power that escapes to heat the envelope is effectively \begin{align} \label{eq:lheatellnl} L_{\rm heat, \ell} &= f_{\rm esc, \ell} \dot{E}_\ell/|k_r\xi_r|^2 \nonumber \\ &= \frac{T_{\rm min}^2}{2} \frac{4\pi\rho r^5\omega^4}{N [\ell (\ell+1)]^{3/2}} \, . \end{align} We use the maximum value of~$|k_r\xi_r|$ (i.e., the minimum value of the second line in equation \ref{eq:lheatellnl}) in the g-mode cavity to compute the above reduction of wave power due to non-linear damping. \subsection{Wave dissipation} \label{sec:equations2} To model the wave damping and energy deposition in the envelope, we follow the methods of \citet{fuller2018}, accounting for background flows as explained in their Section 3.4. We summarize the approach here. Wave dissipation in the envelope can be understood by considering the damping mass, which is the mass through which a wave must pass to dissipate all its energy, given by \begin{equation} M_{\rm damp} = L_{\rm{ac}} \left( \frac{d L_{\rm{heat,co}}}{dm}\right)^{-1}. \end{equation} in the presence of flows. Here~$d L_{\rm{heat,co}}/dm$ is the wave heating rate per unit mass and $L_{\rm{heat,co}}$ is the wave energy flux measured in the comoving frame. The conserved quantity (in the absence of damping) in the inertial frame is the wave action $L_{\rm ac} = 2\pi r^2 \rho c_s u^2 (1+v_r/c_s)$, where~$u$ is the radial velocity amplitude of the wave. \citet{fuller2018} find that the damping mass due to radiative diffusion is \begin{equation} M_{\rm damp, rad} = \frac{2L_{\rm max}}{\omega^2 K} \left(1+\frac{v_r}{c_s}\right)^2 \label{eq:Mdamprad} \end{equation} where the maximum possible wave flux in the linear regime is~$L_{\rm max} = 2\pi r^2 \rho c_s^3$. \citet{fuller2018} find that the damping mass due to weak shock dissipation is \begin{equation} \begin{split} \label{eq:Mdampshock} M_{\rm damp, shock} & = \frac{3\pi}{\gamma + 1}\frac{L_{\rm max}}{\omega c_s^2} \\ & \times \left(\frac{L_{\rm max}\left(1 + v_r/c_s\right)^5}{L_{\rm ac}}\right)^{1/2}. \end{split} \end{equation} Thus the effective damping mass is \begin{equation} M_{\rm damp} = \left[ M_{\rm damp,shock}^{-1} + M_{\rm damp, rad}^{-1} \right]^{-1}, \label{eq:Mdamp} \end{equation} so that the energy deposited per unit time per unit mass in our models is \begin{equation} \label{eq:dLdm} \epsilon_{\rm wave} = \frac{d L_{\rm{heat,co}}}{dm} = \frac{L_{\rm ac}}{M_{\rm damp}}. \end{equation} Since $L_{\rm ac}$ is the quantity conserved in the absence of damping, we compute the energy deposited from escaping waves (with initial $L_{\rm ac} = L_{\rm{heat},\ell}$) as \begin{equation} \label{eq:dLdmactual} \epsilon_{\rm wave}=L_{\rm{heat},\ell}/M_{\rm damp}. \end{equation} \begin{figure} \centering \includegraphics[width=\columnwidth]{10_11M_ellcon2.pdf} \caption{The value of~$\ell_{\rm con} = r/\min(H,\Delta r)$ as a function of radius for the Ne burning convective region in the~$10\, M_{\odot}$ (blue) and~$11\, M_{\odot}$ (orange) supergiant models. The radial extent of the~$10\, M_{\odot}$ burning shell is indicated by the blue shaded vertically hatched region, and the radial extent of the~$11\, M_{\odot}$ core burning is shaded in orange with diagonal hatching. The radius of the top of the burning region, where~$\ell_{\rm con}$ is evaluated, is marked with a circle for each model. Since the~$10\, M_{\odot}$ model burns Ne off-center, the top of its Ne burning shell occurs at larger radius, increasing its~$\ell_{\rm con}$ value. This also applies to the stripped star models.} \label{fig:10v11lcon} \end{figure} \begin{figure*} \centering \includegraphics[width=\textwidth]{10ellheatingONe.pdf} \caption{Fraction of envelope wave heating caused by each angular number~$\ell$ (top), and the wave escape probability for each~$\ell$ (bottom), as a function of time since Ne ignition in the~$M_{\rm ZAMS} = 10\, M_{\odot}$ models. The left figure shows the supergiant model and the right figure shows the stripped star model. Results are only shown for waves where~$L_{\rm heat,\ell} > 10^3\, L_{\odot}$. } \label{fig:10fesc} \end{figure*} \begin{figure} \includegraphics[width=\columnwidth]{10Mpropdiag.pdf} \includegraphics[width=\columnwidth]{10Mpropdiag_stripped.pdf} \caption{Propagation diagrams for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ supergiant model (top) and stripped star model (bottom), each during Ne burning. Shown are the Brunt-V\"ais\"al\"a frequency N (blue) and the Lamb frequency~$L_{\ell}$ for~$\ell = 1,3$ (shades of red). Waves propagate through the gravity wave cavity (blue region) and into the envelope as acoustic waves (red region, shaded for~$\ell = 1$), tunneling through evanescent zones (gray region) along the way. Off-center Ne ignition in the core excites waves with~$\omega \sim \! 10^{-2}$ rad/s (dotted line) at the top of the convective zone (star). The stripped star model has higher~$\omega$, which allows the waves to tunnel through a thinner evanescent zone and causes the escape fraction to be higher for waves of all~$\ell$ (Figure~\ref{fig:10fesc}.) } \label{fig:10Mprop} \end{figure} \begin{figure*} \centering \includegraphics[width=0.494\textwidth]{11Mprofile_normalLheat2.pdf} \includegraphics[width=0.4935\textwidth]{11Mprofile_normalLheat_mext_v2_stripped.pdf} \caption{Left panel: Wave heating diagnostics for an~$11\, M_{\odot}$ red supergiant model during Ne burning as a function of mass coordinate. Top: Binding energy integrated inward from the surface of the model and the star's density profile, before and after wave heating due to Ne burning. Middle: Wave energy deposition rate per unit mass and the damping mass (i.e., $4 \pi \rho r^2$ times the damping length, Equation~\ref{eq:Mdamp}). Bottom: Wave heating timescale ($t_{\rm heat}$), local thermal timescale ($t_{\rm therm}$), and local dynamical timescale ($t_{\rm dyn}$). Right panel: Same as left for the ~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star during Ne burning, but as a function of exterior mass coordinate. } \label{fig:11Ebind} \end{figure*} \subsection{Methods} \label{sec:methods} We run a suite of MESA simulations \citep{mesa2011,mesa2013,mesa2015,mesa2018,mesa2019} for zero-age main sequence (ZAMS) masses 10, 10.5, 11, 12, and 13~$M_{\odot}$ and evolve the stars from the main sequence to at least five years after neon (Ne) ignition. For the~$11\text{--}13\, M_{\odot}$ models, we evolve the stars until core collapse; however, the~$10$ and~$10.5\, M_{\odot}$ models experience off-center Ne burning that makes these stars prohibitively computationally expensive to run until core collapse, so we simulate these models through Ne ignition and at least five years of Ne burning flame propagation. In addition, we create hydrogen-poor (H-poor) stellar models following the methods of \citet{fuller2018}, Appendix A\footnote{Model parameters are available at https://zenodo.org/communities/mesa.}. Starting with models of the same initial masses ($M_{\rm ZAMS}$) as the aforementioned hydrogen-rich (H-rich) supergiant models, we remove the hydrogen envelope after core helium (He) burning so that the resulting H-poor, stripped star models have nearly the same He core masses as the H-rich models. Accordingly, the stripped star models with initial mass~$10$ and~$10.5\, M_{\odot}$ experience the same off-center Ne ignition as their supergiant counterparts, while all other stripped star models are evolved until core collapse. Beginning at core carbon burning, we capture the wave-driven mass loss as in \citet{fuller2018} by setting the outer boundary at an optical depth of~$\tau = 10^{-2}$. Material that flows past this outer boundary is removed from the grid, and we define mass loss rates in the paper as the mass flux through this outer boundary. At each timestep, we perform the same calculations described in Section 2.2 of \citet{Wu2021} and above for the convective burning regions in each model. This gives us the amount of wave heat transmitted, including possible non-linear effects. We then add the wave heat in each cell of the model using Equation~\ref{eq:dLdm}. \section{Results} \label{sec:results} \subsection{Wave Heating Rates} \label{sec:results1} In all our models, the most important contribution to wave heating occurs during Ne burning roughly $5-20$ years before core collapse. The next major contribution to wave heating from Si burning is energetic, but occurs too near core collapse for waves excited by Si burning to reach the surface of our supergiant progenitors. We do not simulate Si burning in our~$M < 11\, M_{\odot}$ models. The~$M < 11\, M_{\odot}$ models in this work extend our wave heating study down to lower-mass stars in which Ne ignites off-center. This difference greatly affects the amount of wave power produced by the~$10 \text{--} 10.5\, M_{\odot}$ supergiant models, bringing the wave energy deposition rate down by~$1\text{--}2$ orders of magnitude compared to the less degenerate and centrally burning~$11\, M_{\odot}$ model (see Figure~\ref{fig:10to13surf}, top left panel). The main reduction in wave heating arises from lower wave escape fractions from the core occurs because the excited wave spectrum peaks at higher angular wavenumber than the central burning models. As described in Section~\ref{sec:equations1} and in more detail in \citet{Wu2021}, the peak of the wave spectrum in angular wavenumber~$\ell$ occurs for~$\ell \gtrsim \ell_{\rm con} = r/\min(H,\Delta r)$, which is evaluated at the top of the burning shell. Figure~\ref{fig:10v11lcon} shows how the decrease in scale height~$H$ with radius causes the value of~$\ell_{\rm con}$ to increase rapidly as a function of radius in both a centrally-burning ($11\, M_{\odot}$) and off-center burning ($10\, M_{\odot}$) model. Since the off-center burning shell extends to larger radii than a core burning region, waves excited due to Ne burning in a~$10\, M_{\odot}$ model peak at higher~$\ell$. For the snapshot shown,~$\ell_{\rm con} \sim 3~$ for the~$10\, M_{\odot}$ model so its wave spectrum typically peaks at around~$\ell \sim 4$, while~$\ell_{\rm con} \sim 1.5$ for the~$11\, M_{\odot}$ model so its wave spectrum typically peaks around~$\ell \sim 2\text{--}3$. The bottom left panel of Figure~\ref{fig:10fesc} demonstrates that the escape fraction is many orders of magnitude smaller for high-$\ell$ waves, shown here for a~$10\, M_{\odot}$ supergiant model but also generally true in all our models. Hence, when the wave spectrum peaks at higher~$\ell$, more of the initial wave power~$L_{\rm wave}$ is distributed to waves that can only escape with a tiny fraction of their original power. The ultimate heating rate~$L_{\rm heat,\ell}$ is dominated by low~$\ell$ waves which only carry~$\dot{E}_{\ell} \lesssim 0.1\, L_{\rm wave}$ (top left panel of Figure~\ref{fig:10fesc}). Since off-center burning excites a wave spectrum that peaks at higher~$\ell$, wave heating is thus strongly reduced. For the most part, convective excitation of waves in the stripped star models matches that of the supergiant stars, as expected given their nearly equal He core masses. Nevertheless, subtle structural differences in the stripped star models can modify their wave heating rates. In our stripped star models, Ne ignites at a different temperature~$T_{\rm burn, Ne}$ than in the supergiant models. Though both the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star and supergiant models ignite off-center at similar radii, the stripped star model is a little denser and hotter at the center compared to the supergiant when Ne burning begins. Given slightly higher~$T_{\rm burn, Ne}$, convection in the temperature-sensitive Ne burning shell is more energetic, which raises~$L_{\rm con}$,~$\mathcal{M}_{\rm con}$ and consequently~$L_{\rm wave}$ by a factor of a few in the stripped star. More vigorous core convection also produces higher~$\omega$, which affects the escape fraction of the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star. Comparing the left and right panels of Figure~\ref{fig:10fesc}, we see that~$f_{\rm esc,\ell}$ is generally higher during Ne burning for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star. Figure~\ref{fig:10Mprop} shows propagation diagrams for the~$M_{\rm ZAMS} = 10\, M_{\odot}$ supergiant and stripped star models during Ne burning for typical wave frequencies. The stripped star model tends to excite higher~$\omega$ by a factor of two, and as demonstrated in the figure, these waves encounter smaller evanescent zones. Thus waves have a larger transmission coefficient $T_{\rm min}^2$ and a larger escape fraction in the stripped star. The combination of increasing both~$f_{\rm esc,\ell}$ and~$L_{\rm wave}$ accordingly raises the wave energy deposited in the envelope by an order of magnitude in the~$M_{\rm ZAMS} = 10\, M_{\odot}$ stripped star (see Figure~\ref{fig:10to13surf}) relative to the H-rich model. For other masses, the difference in wave heating rates between H-rich and H-poor models is much smaller and stems mainly from slight differences in the core structure that affect $T_{\rm burn, Ne}$ and consequently $L_{\rm wave}$ as discussed above. As discussed in \citet{Wu2021}, our updated implementation of wave physics tends to reduce our wave heating rates by an order of magnitude compared to earlier results such as \citet{fuller2017} and \citet{fuller2018}. Prior work did not model non-linear wave dissipation and assumed that wave power was mainly excited in~$\ell=1$ waves. In particular, the wave heating history of our models is now dominated by a brief burst of very high~$L_{\rm heat,\ell}$ waves excited during Ne burning. We do not produce high wave power sustained for longer periods, such as that during core O burning sustained for~$\sim \! 1$ yr in \citet{fuller2017} and \citet{fuller2018}. \subsection{Wave Dissipation} Both the lower energy scale and sudden, short-duration nature of wave heating influence the hydrodynamical response of our models' interior structures. In the left column of Figure~\ref{fig:11Ebind}, the density and exterior binding energy of the~$11\, M_{\odot}$ supergiant star are plotted as a function of mass coordinate for a model during Ne burning where the instantaneous wave power is~$\sim \! 10^{9}\, L_{\odot}$. The density and effective~$M_{\rm damp}$ (middle panel) drop at the core-envelope transition in the star, so that most of the waves damp their energy at the base of the supergiant envelope at around~$M \sim 3.4 M_{\odot}$. Wave energy is therefore deposited where the binding energy of overlying material is still high,~$E_{\rm bind} \sim 10^{48}\, \mathrm{erg} > E_{\rm waves}$ (see Figure~\ref{fig:10to13surf}, top panel for~$E_{\rm waves}$). The density profile of the supergiant star experiences only minuscule changes due to wave heating, and the deposited wave energy is unable to unbind the overlying envelope mass. Waves in the other supergiant models, which carry much less energy into the envelope than the~$11\, M_{\odot}$ model, likewise deposit their energy without unbinding any material or greatly affecting the density profile of the star. Our stripped star models lack an overlying hydrogen envelope, so the binding energy is smaller at the edge of the core, as shown in the right panel of Figure~\ref{fig:11Ebind}. Waves again damp most of their energy where the damping mass drops outside the core, which for a stripped star is very close to the surface with only~$M_{\rm ext} \sim 10^{-2}\, M_{\odot}$ of overlying mass. For the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model shown in Figure~\ref{fig:11Ebind}, waves with a typical heating rate of $L_{\rm heat, \ell} \gtrsim 10^9\, L_{\odot}$ still damp out where~$E_{\rm bind} \sim 10^{48}$ erg~$> E_{\rm waves}$ since~$M_{\rm damp}$ is smaller for such large $L_{\rm heat, \ell} = L_{\rm ac}$ (Equation \ref{eq:Mdampshock}). Thus the waves excited by Ne burning are not able to unbind the~$M_{\rm ext} \sim 10^{-3} \text{--} 10^{-2}\, M_{\odot}$ of exterior material. Unlike the supergiant models, however, the envelope of this stripped star model inflates above the heating region, flattening the density profile. In the other stripped star models, where the wave energy deposited is at least a few times lower (Figure~\ref{fig:10to13surf}), smaller $L_{\rm heat,\ell}$ leads to larger $M_{\rm damp}$, so waves damp further out where~$E_{\rm bind} \sim 10^{47}$ erg. Again,~$E_{\rm wave} \lesssim E_{\rm bind}$ where the waves damp, so waves are also not able to unbind the overlying envelope in the other stripped star models. The bottom panels of Figure~\ref{fig:11Ebind} show the following timescales for the~$M_{\rm ZAMS} = 11\, M_{\odot}$ supergiant (left) and stripped star (right): the local wave heating timescale, \begin{equation} t_{\rm heat} = \frac{c_s^2}{\epsilon_{\rm wave}} \end{equation} where~$\epsilon_{\rm wave}$ is defined in Equation~\ref{eq:dLdm}; the thermal cooling timescale, \begin{equation} t_{\rm therm} = \frac{4\pi\rho r^2 H c_s^2}{L} \end{equation} where~$L$ is the local luminosity; and the local dynamical timescale, \begin{equation} t_{\rm dyn} = \frac{H}{c_s}. \end{equation} Both the supergiant and stripped star models lie in the moderate heating regime where~$t_{\rm dyn} < t_{\rm heat} < t_{\rm therm}$. Wave heat is not transported outward thermally, but the local pressure will gradually increase and the star will expand quasi-hydrostatically in response. This result differs from \citet{fuller2017}, which also treated wave heating in a supergiant model. \citet{fuller2017} found~$t_{\rm heat}$ could become shorter than both~$t_{\rm therm}$ and~$t_{\rm dyn}$ during Ne burning, so that wave heating entered a dynamical regime and launched a pressure wave propagating at the sound speed. The difference arises because \citet{fuller2017} do not include the weak shock dissipation introduced in \citet{fuller2018}. For our supergiant models with weak shock dissipation, this reduces the effective~$M_{\rm damp}$ of our models compared to \citet{fuller2017} and causes the waves to damp at smaller mass coordinates with smaller values of $t_{\rm dyn}$. As a result, the supergiant models now lie in the moderate heating regime. Our stripped star models remain consistent with \citet{fuller2018}, who also find that~$t_{\rm dyn}<t_{\rm heat} < t_{\rm therm}$ in the wave heating region. \begin{figure*} \centering \includegraphics[width=\textwidth]{velocitygrid.pdf} \caption{Velocity pulse propagation due to first wave heating phase from Ne ignition in the following models, clockwise from top left:~$M_{\rm ZAMS}=11\, M_{\odot}$ supergiant model,~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model, ~$M_{\rm ZAMS}=12\, M_{\odot}$ stripped star model, $M_{\rm ZAMS}=12\, M_{\odot}$ supergiant model. Shading corresponds to the time since Ne ignition. } \label{fig:vgrid} \end{figure*} \begin{figure*} \includegraphics[width=0.515\textwidth]{10to13surfprops_sinceNe_lin.pdf} \includegraphics[width=0.485\textwidth]{10to13surfprops_sinceNe_lin_stripped.pdf} \caption{Left: Integrated wave energy deposited, surface luminosity, effective temperature, star radius, and surface velocity as a function of time since Ne ignition for the supergiant models shown in the legend. Right: Same as left panel for the stripped star models with initial masses as shown in the legend. For models that reach core collapse, indicated by the star symbol at the end of each curve, the evolution is shown until 3 days before core collapse. } \label{fig:10to13surf} \end{figure*} \subsection{Pre-supernova evolution} \label{sec:results2} Once wave heat is deposited in our supergiant models, a small fraction of the energy is put into the kinetic energy of a velocity pulse (i.e., a pressure wave) that travels across the envelope of the star. The left column of Figure~\ref{fig:vgrid} shows the propagation of the velocity pulse due to wave heating from Ne burning in the~$11\, M_{\odot}$ and~$12\, M_{\odot}$ supergiant models. The pulse does not exceed~$v/c_s \sim 0.1$ in either model until it steepens at the surface of the supergiants to~$v/c_s \sim 0.2$. The stars otherwise expand quasi-hydrostatically in response to this velocity pulse. As the surface velocities are quite small, with~$v < v_{\rm esc}$ in all the supergiant models, the surfaces of these stars expand slightly but remain bound. Note that in our supergiant models, although more wave heat is deposited in the envelope of the~$11\ M_{\odot}$ model and its pressure pulse initially has more kinetic energy, peaking at~$v/c_s \sim 0.1$, the kinetic energy in the pulse decreases greatly as it propagates so that the surface velocity of the~$11\, M_{\odot}$ model is smaller than that of the~$12\, M_{\odot}$ model. In contrast, the pulse in the~$12\, M_{\odot}$ supergiant model begins with a lower peak value because a few times less wave energy was deposited, but it only experiences a very shallow decline before it steepens at the surface. We attribute this counter-intuitive result to the different profiles of~$t_{\rm therm}$ in the models. As seen in the bottom panel of Figure~\ref{fig:11Ebind},~$t_{\rm therm}$ decreases by a few orders of magnitude at~$m \sim 3.5\, M_{\odot}$, just above the wave heating region at the base of the convective envelope. This dip occurs where the convective flux increases in response to the extra deposited energy (see Section~\ref{sec:TDC} for a discussion of this phenomenon). In the~$11\, M_{\odot}$ model, the small~$t_{\rm therm}$ in this location may allow the convective flux to carry away some energy from the pulse, causing the velocity to decline as in Figure~\ref{fig:vgrid}. The value of~$t_{\rm therm}$ drops less steeply in the~$12\, M_{\odot}$ model, so the local luminosity is not as efficient in carrying energy away from the pressure pulse. As the other models all deposit less wave energy, their velocity pulses emulate the~$12\, M_{\odot}$ model in this respect. In the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model shown in the top right of Figure~\ref{fig:vgrid}, the heating generates a rapid expansion with Mach number~$\mathcal{M} \sim 50$ near the surface of the star. The response of convection to wave-heating as described above for the supergiants does not apply for the stripped stars, since they lack a convective hydrogen envelope. In the~$M_{\rm ZAMS} = 12\, M_{\odot}$ model (shown in the bottom right of Figure~\ref{fig:vgrid}), less wave heat is deposited and the velocity pulse accelerates to lower values of~$\mathcal{M} \sim 2$. This is representative of the other stripped star models, which deposit comparable amounts of wave energy. Each pressure wave breakout corresponds to spikes in luminosity and effective temperature and initiates rapid envelope expansion of the stripped stars. However, only the expansion driven by the most energetic~$M_{\rm ZAMS} = 11\, M_{\odot}$ model directly after Ne ignition accelerates any stellar material to~$v_{\rm esc} \sim 400$ km/s, and only a very small amount of mass ($M\sim 10^{-6} M_{\odot}$) achieves that velocity. The other stripped star models expand without ejecting any mass. Figure~\ref{fig:10to13surf} shows the evolution of the surface properties of our models, in parallel with the integrated wave energy deposition as a function of time since Ne ignition. In the supergiant models, the surface luminosity~$L$, effective temperature~$T_{\rm eff}$, radius~$R$, and surface velocity oscillate from Ne ignition onward. Wave heating from Ne ignition initiates these oscillations, which persist until core collapse for the~$11\text{--}13\, M_{\odot}$ models. The amplitude of these fluctuations is small, ranging from almost no variation in the~$10\, M_{\odot}$ model where $E_{\rm wave} \sim 10^{45}$ erg to oscillation amplitudes of a few percent in the~$10.5\text{--}13\, M_{\odot}$ models with $10\text{--}100$ times more wave heating. Though our stripped star models mostly deposit comparable amounts of energy in the envelope, the surface properties of these models behave extremely differently from their supergiant counterparts. The initial pressure pulse breakout originating from wave heating due to Ne ignition generates upward spikes in~$L$ by a factor of a few for most models, although the luminosity of the most energetic~$M_{\rm ZAMS} = 11\, M_{\odot}$ model temporarily jumps by over an order of magnitude. The luminosity in each model also tends to spike downward briefly before becoming brighter than before wave heating began. Overall, the stripped star models exhibit significant photospheric cooling and expansion, where~$T_{\rm eff}$ drops by up to a factor of a few and the radius of the star rapidly increases by up to an order of magnitude. The properties of the lowest-mass~$M_{\rm ZAMS} = 10\text{--}10.5\, M_{\odot}$ models change less dramatically; for instance, these models expand only by a factor of $2\text{--}3$. After Ne ignition, a second step-like increase in~$E_{\rm waves}$ occurs for the~$M_{\rm ZAMS} = 11\text{--}13\, M_{\odot}$ models at a few years after Ne ignition. This is due to a second surge of wave heating from core Ne burning, since the burning fuel is replenished when some Ne is mixed downward into the core. This tends to initiate another cooling and expansion phase in the stripped stars, so that over the period between Ne ignition and core collapse, the models exhibit two bumps in radius and dips in~$T_{\rm eff}$. In the~$M_{\rm ZAMS} = 12\text{--}13\, M_{\odot}$ models, the first cool, expanded phase lasts~$\sim 1\text{--}2$ years before returning to near pre-wave heating values; meanwhile, the second Ne burning phase causes the stars to expand less dramatically for a brief period of months. However, these phases last for~$\sim \! 5$ years each in the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model, attaining a similar peak radius and $T_{\rm eff}$ each time. Note that this second burning phase also causes spikes in~$L$ and~$T_{\rm eff}$ for the~$M_{\rm ZAMS} = 12\text{--}13\, M_{\odot}$ stripped star models at around 5 and 3 years since Ne ignition respectively. The models oscillate in~$L$ and~$T_{\rm eff}$ because the Ne abundance in the core is fluctuating. This drives oscillations in the burning rate and~$L_{\rm con}$, which in turn causes the wave heating rate and surface properties to fluctuate. Increasing the resolution of our models did not consistently remove this effect, so it is unclear whether this effect is physical or numerical in nature. Different treatments of convective overshoot could affect the core Ne abundance as well. Although we predict little hydrodynamically-driven mass loss, the large changes in surface luminosity exhibited by the stripped star models affects the wind mass loss rates of these stars. Using the following wind mass loss rate from \citet{Nugis2000}, \begin{equation} \label{eq:Mdotwind} \begin{split} \log \dot{M}_{\rm wind} = & -11 + 1.29\log L \\ & + 1.73 \log Y + 0.47 \log Z, \end{split} \end{equation} we calculate the expected mass loss rate from winds in each of the stripped star models due to their elevated luminosity after Ne burning. We find that the increased mass loss from winds is an order of magnitude larger than directly ejected material, but still very small. The wind mass loss rates in our models peak at~$\dot{M} \sim 10^{-5}\, M_{\odot}\text{/yr}$, and the models lose a few$\times 10^{-5}\, M_{\odot}$ between Ne ignition and core collapse. \section{Discussion} \label{sec:discussion} \subsection{Parameter testing} \label{sec:paramtest} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{paramtest_ener.pdf} \caption{Integrated wave energy deposited as a function of time since neon ignition for supergiant (left column) and stripped star (right column) models with the initial masses shown in each panel. Each panel shows the variation in wave energy deposition for each model as either the wave frequency (Equation~\ref{eq:omega}) or the power put into waves (Equation~\ref{eq:lwave}) is increased and decreased by a factor of 3. As in Figure \ref{fig:10to13surf}, models that reach core collapse are indicated by the star symbol at the end of each curve. } \label{fig:Ewavesparam} \end{figure} To investigate how our results may vary if our assumptions about wave power and frequency do not accurately represent the true values, we ran simulations with different values for~$L_{\rm wave}$ (Equation~\ref{eq:lwave}) and~$\omega$ (Equation~\ref{eq:omega}). For each model in Figure~\ref{fig:10to13surf}, we repeated the methods of Section~\ref{sec:methods}, each time making one of the four following changes: \begin{enumerate}[noitemsep] \item~$\omega = 3\omega_{\rm con}$ \item~$\omega = 0.3 \omega_{\rm con}$ \item~$L_{\rm wave} = 3 \mathcal{M}_{\rm con} L_{\rm con}$ \item~$L_{\rm wave} = 0.3 \mathcal{M}_{\rm con} L_{\rm con}$. \end{enumerate} These variations allow us to test how our results would change if our initial assumptions for the power and frequency of the excited waves either overestimate or underestimate reality. With these simulations along with our original models, we span an order of magnitude of uncertainty in these initial assumptions. Note that we do not change our assumed wave spectrum for these tests, so changes in~$\omega$ only affect the dispersion relation and related quantities outlined in Section~\ref{sec:physics}. \begin{figure*} \centering \includegraphics[width=0.51\textwidth]{11Mparamtest.pdf} \includegraphics[width=0.47\textwidth]{11Mparamtest_stripped.pdf} \caption{Left panel: Same quantities as in Figure~\ref{fig:10to13surf} are shown for an~$11\, M_{\odot}$ supergiant model. As in Figure~\ref{fig:Ewavesparam}, each panel plots the different evolution of each model as either the wave frequency or power is varied (see Section~\ref{sec:paramtest} for details). Right panel: Same as left for the~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model. As in Figure \ref{fig:10to13surf}, models that reach core collapse are indicated by the star symbol at the end of each curve. } \label{fig:11surfparam} \end{figure*} Figure~\ref{fig:Ewavesparam} shows how the wave energy that escapes to heat the envelope changes as we vary these parameters in each model. We omit~$M_{\rm ZAMS} = 10.5\, M_{\odot}$ as its evolution due to off-center Ne ignition proceeds similarly to~$M_{\rm ZAMS} =10\, M_{\odot}$. For all models, the wave heating history remains the same -- jumps in~$E_{\rm waves}$ occur at the same times, as changing~$L_{\rm wave}$ or~$\omega$ has no bearing on when the model develops convective regions. As noted in \citet{Wu2021}, wave energy transmission in the mass range~$11\text{--}15\, M_{\odot}$ is not significantly altered by non-linear effects, so for these models the wave energy escape generally increases (decreases) by a factor of~3 as we increase (decrease)~$L_{\rm wave}$ by a factor of~3. However, the~$3 L_{\rm wave}$ variations upon each of the~$M_{\rm ZAMS} = 10\, M_{\odot}$ models and the~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model do not show as large of an increase in wave energy; in fact, slightly less wave energy escapes for the~$M_{\rm ZAMS} =10\, M_{\odot}$,~$3 L_{\rm wave}$ variation than the original run. This is due to non-linear effects in these models -- increasing~$L_{\rm wave}$ also increases the wave non-linearity~$|k_r\xi_r|^2$ by the same factor, which for non-linear waves effectively reduces the wave power back to that of the original run. Changing~$\omega$ affects the escape fraction and wave non-linearity. In the core, higher frequency waves will experience less attenuation due to neutrino and thermal losses in the g-mode cavity, and they have larger escape fractions. The non-linearity factor goes as~$|k_r\xi_r|^2 \propto \omega^{-4}$, so higher frequency waves are much less non-linear. Thus, we ultimately find that increasing (decreasing) wave frequency increases (decreases) the wave energy escape, in some models more drastically than others depending on the magnitude of the change in~$f_{\rm esc,\ell}$ and whether non-linear effects are important for those waves. The variation in surface properties as we vary~$\omega$ and~$L_{\rm wave}$ is shown for an~$11\, M_{\odot}$ supergiant model in the left panel of Figure~\ref{fig:11surfparam}. All the models exhibit oscillations of varying amplitude which persist until core collapse, with larger jumps occurring soon after wave heating episodes. The amplitude of the oscillation tends to be larger for variations with more wave heating such as~$3 L_{\rm wave}$ and~$3 \omega$ and much smaller for less energetic models like~$0.3 L_{\rm wave}$ and~$0.3 \omega$. Moreover, the more energetic runs tend towards larger~$L$ and~$R$ and smaller~$T_{\rm eff}$ than the original run, whereas the surface properties of the less energetic variations deviate less from the quiescent values than the original run. In contrast, the stripped star with~$M_{\rm ZAMS}=11 M_{\odot}$ exhibits much larger changes in its surface properties due to the variations in $\omega$ and $L_{\rm wave}$ (Figure~\ref{fig:11surfparam}, right panel). The luminosity may vary by a factor of~$\sim$2 in either direction compared to the original run, but more energetic models (larger~$L_{\rm wave}$ or~$\omega$) are generally brighter, with larger photospheric radii and lower temperatures. The~$3 L_{\rm wave}$ run cools and expands more than the original run right after Ne ignition, remaining larger and cooler than all other runs until core collapse. In the least energetic~$0.3 L_{\rm wave}$ and~$0.3 \omega$ runs, wave heating causes the star to initially cool by a factor of~$\sim 2\text{--}2.5$ and expand to tens of~$R_{\odot}$ before returning to radii and temperatures near that of quiescence after about a year. The behavior of the~$11 \, M_\odot$ models shown in Figure~\ref{fig:11surfparam} qualitatively represents that of the other masses, though variations in the~$10 \, M_\odot$,~$10.5 \, M_\odot$,~$12 \, M_\odot$, and~$13 \, M_\odot$ models are on somewhat smaller scales since less wave heat is deposited in the envelopes of those models. \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HR.pdf} \caption{Evolution on the Hertzsprung-Russell diagram for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model (green) and a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$ (cyan) from just before Ne ignition (cross) until core collapse (star). Each dot is separated by an interval of 1 hour. } \label{fig:11MHR} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HSTabsmag_wnoheat.pdf} \caption{Top: Evolution of absolute magnitude (AB mag) in four HST bandpasses as a function of time since Ne ignition for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model. The absolute magnitudes of the same model with no wave heating are plotted in grey, with line styles corresponding to the same line styles of each bandpass in the legend. Bottom: Same for a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. } \label{fig:11Mmag} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_HSTcolors_wnoheat.pdf} \caption{Top: Evolution of several color indices (AB mag) as a function of time since Ne ignition for the H-poor~$M_{\rm ZAMS} = 11\, M_{\odot}$ model. The colors of the same model with no wave heating are plotted in grey, with line styles corresponding to the same line styles of each bandpass in the legend. Bottom: Same for a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. } \label{fig:11Mcolor} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{11_moreH_sinceNe_lin_stripped.pdf} \caption{Same quantities as in Figure~\ref{fig:10to13surf} are shown for the H-poor~$M_{\rm ZAMS} =11\, M_{\odot}$ model and a~$M_{\rm ZAMS} =11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$. The star symbol at the end of each curve indicates that both models reach core collapse. } \label{fig:11moreHsurfparam} \end{figure} \subsection{Comparison with Progenitor Observations} Since the changes in the surface properties of our supergiant models are quite small, we do not expect a large observational signature of wave heating in these stars. However, our stripped star models start out as hot, compact He stars, but expand greatly and become cooler for years due to wave heating. Figure \ref{fig:11MHR} shows the evolution of the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model on the HR diagram from just before Ne ignition until core collapse. A model without wave heat would remain at the point labeled ``Pre-Ne Ignition'' on the green curve in Figure \ref{fig:11MHR} until core collapse. In contrast, the star initially moves to large~$L$ and~$T_{\rm eff}$, then to small~$L$ and~$T_{\rm eff}$, over a few hours when the shock launched by wave heating breaks out. It then spends months moving to a more luminous but cooler state. The star remains in that region of the HR diagram for years, with some continued variability due to fluctuating amounts of wave heat emerging from the core. The top panel of Figure \ref{fig:11Mmag} shows lightcurves in four \textit{Hubble Space Telescope} WFC3/UVIS bands as a function of time since Ne ignition for this model. Each absolute magnitude was calculated by integrating over a blackbody at~$T_{\rm eff}$ convolved with the transmission function for each bandpass filter and is reported in AB magnitudes. The brightness in all bands jumps once wave heating begins at Ne ignition. Note that the bolometric absolute magnitude will only decrease by~$\sim$1, but the visual band magnitudes decrease by~$\sim$3 magnitudes. This is a consequence of the star cooling from~$\approx$40,000 K to~$\approx$15,000 K, causing a much larger fraction of its flux to be emitted in optical bands rather than the UV. Like its brightness, the color of our~$M_{\rm ZAMS}=11 \, M_\odot$ H-poor model varies over the last few years of its lifetime. The top panel of Figure \ref{fig:11Mcolor} shows the evolution of some color indices for this star, again in AB mags. Before Ne ignition the star is brightest in UV, but due to wave heating the star reddens (but remains fairly blue) with F438W$-$F555W rising to near zero. A few potential Type Ib/c supernova progenitors have been observed and are indeed bluer than type II SN progenitors, but in some cases they are cooler or more extended than a typical massive helium star \citep{Cao2013,Xiang2019,Kilpatrick2021}. Among our stripped-star models, which represent type Ib SN progenitors, certain periods of evolution could reproduce these characteristics. For example, \citet{Eldridge2015} find that the progenitor candidate of iPTF13bvn has brightness between $\mathrm{M}_{\rm F435W} = -6.15$ to $-6.67$ mag, $\mathrm{M}_{\rm F555W} = -6.1$ to $-6.49$ mag, and $\mathrm{M}_{\rm F814W} = -5.95$ to $-6.13$ mag. Our~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model can match these ranges at around 6 months--5 years after Ne ignition. The same~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model can match the brightness of $\mathrm{M}_{\rm F555W} \gtrsim -5.5$ mag observed by \citet{Kilpatrick2021} for the progenitor of SN2019yvr during most of the 10 years after Ne ignition. However, \cite{Kilpatrick2021} finds the potential progenitor to be much cooler than what our hydrogen-poor models reach, deriving~$T_{\rm eff} = 6800^{+400}_{-200}$ K from models which account for both host and Milky Way extinction. They also report observations of $\mathrm{M}_{\rm F555W}-\mathrm{M}_{\rm F814W} = 1.065\pm0.045$ mag, but this accounts only for Milky Way extinction and not yet host extinction. Nevertheless, based on these values, our ~$M_{\rm ZAMS}=11\, M_{\odot}$ H-poor model would not be able to explain the SN2019yvr progenitor, as it only attains $\mathrm{M}_{\rm F555W}-\mathrm{M}_{\rm F814W} \sim -0.5$ mag. \citet{Sun2021} find that if the source in \citet{Kilpatrick2021} is a binary system, then the progenitor of SN2019yvr could have~$\log( T_{\rm eff}/K) = 4.03$ and~$R/R_{\odot} = 57$ with likely initial mass~$\sim \! 11\, M_{\odot}$. Our~$M_{\rm ZAMS}=11\, M_{\odot}$ stripped star model matches these observational constraints fairly well for the last 10 years of its life. Yet in both cases, the small amount of progenitor variability over~$\sim$100 days of HST observations \citep{Kilpatrick2021} may disfavor the wave-heated progenitor interpretation. A stripped star model with a very small amount of hydrogen remaining in the envelope might explain cooler progenitors, as even a hundredth of a solar mass of hydrogen in the envelope causes the star to expand more and reach lower temperatures \citep{Laplace2020}. In our fiducial stripped star models, we strip the star of its envelope so that a negligible amount of hydrogen remains in the envelope ($M_H \lesssim 10^{-3}\, M_{\odot}$) from carbon burning onward. In Figure \ref{fig:11moreHsurfparam}, we compare our fiducial~$M_{\rm ZAMS} = 11\, M_{\odot}$ H-poor model with an~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star model with~$M_H = 10^{-2}\, M_{\odot}$ of hydrogen in the envelope from carbon burning onward, evolving the hydrodynamic response to wave heating as in the rest of our models. Even before wave heating begins, the~$M_{\rm ZAMS} = 11\, M_{\odot}$ stripped star with~$M_H = 10^{-2}\, M_{\odot}$ expands to~$\sim 80\, R_{\odot}$ just before Ne burning. However, its luminosity just before Ne burning matches that of the H-poor model, and accordingly is a factor of~$4$ times cooler before Ne burning. This star would also remain at the point labeled ``Pre-Ne Ignition'' on the cyan curve in Figure \ref{fig:11MHR} until core collapse in the absence of wave heating. The wave heating history of the two models, shown in the top panel of Figure \ref{fig:11moreHsurfparam}, is similar, but the model with~$M_H = 10^{-2}\, M_{\odot}$ cools and expands in response to wave heating from Ne burning so that it is slightly less luminous than the H-poor model until core collapse (Figure \ref{fig:11MHR}). Since the~$M_H = 10^{-2}\, M_{\odot}$ model expands to more than~$100 \, R_\odot$, its photospheric cools to the range~$T_{\rm eff} = 6800^{+400}_{-200}$~K derived by \citet{Kilpatrick2021} for the progenitor of SN2019yvr. Consequently, the model with~$M_H = 10^{-2}\, M_{\odot}$ is redder than the fiducial model (Figures \ref{fig:11Mmag} and \ref{fig:11Mcolor}), though it can also explain the color of iPTF13bvn's progenitor estimated in \citet{Eldridge2015}. The model with more hydrogen exemplifies the varied evolution that can ensue depending on the residual hydrogen content of the stripped progenitor, which depends sensitively on the binary and wind mass loss that created the SN progenitor. \subsection{Related Mass Loss Mechanisms} \label{sec:massloss} An interesting aspect of the stripped star models is their expansion from a few~$R_{\odot}$ to tens of~$R_{\odot}$. As stripped stars are likely to be in a binary system, this substantial, fast expansion may instigate binary mass transfer. The resulting rapid mass transfer could drive more mass loss from the system, or it could lead to unstable mass transfer that results in a common envelope event or stellar merger (see also \citealt{Mcley2014}). Since the mass loss is triggered in the final years before core-collapse, the ejected mass would still be near the progenitor at the time of core-collapse. Hence, this wave-induced binary interaction is a potential channel for generating larger CSM masses that should be explored in future work. In our~$10$ and~$10.5\, M_{\odot}$ models, we investigated only the initial Ne ignition and the progress of the ensuing off-center flame for~$6\text{--}8$ years after Ne ignition, which encapsulated the majority of wave heating due to Ne burning. Yet this mass range may exhibit interesting behavior beyond this period of its evolution, as degenerate silicon ignition is highly energetic. On the one hand, this silicon burning could excite waves with very high wave power which have greater potential to eject mass. On the other hand, \citet{Woosley2015} have found that silicon deflagration can occur in stars of this mass range, in which the silicon flash is violent enough to drive a shock and eject mass. Though it is computationally expensive to simulate late-stage nuclear burning this mass range, the period of Si burning should be studied in more detail as a possible mechanism for driving mass loss in these stars. \subsection{Time Dependent Convection} \label{sec:TDC} In our supergiant models, the internal luminosity can suddenly spike by a few orders of magnitude at the base of the convective envelope due to wave heating in this region. This manifests in the bottom panel of Figure~\ref{fig:11Ebind}, where~$t_{\rm therm}$ dips at a mass coordinate of~$3.5\, M_{\odot}$ -- which is due to an associated jump in the luminosity of the model at that location. This is caused by a sudden increase in the convective luminosity on a time scale comparable to the convective turnover time scale, which may not be physical, and calls for a time-dependent treatment of convection. In the results presented in this work, we have tried to partially mitigate unphysically large convective accelerations by using the MESA option \texttt{mlt\_accel\_g\_theta = 1} in our supergiant models, which limits convective acceleration to the local gravitational acceleration. However, a more rigorous treatment of time-dependent convection (TDC) could further limit convective acceleration. This will affect whether wave heat is transported outward by convection, or whether it can be used to hydrodynamically drive a pressure pulse through the star. To try to understand the range of possibilities, we investigated the efficacy of more sophisticated schemes to limit convective acceleration and deceleration. Following \citet{Renzo2020}, we tried limiting convective acceleration based on the methods of \citet{Wood1974}. This method failed to create a physical model as spurious drops in luminosity at the surface of the convective envelope occurred. We also attempted the second treatment of TDC in \citet{Renzo2020}, in which they use MESA v11123 to solve for convective velocity using their Equation 2 instead of using MLT. Unfortunately, a model using this method was unable to evolve through the extremely energetic degenerate Ne ignition. Finally, we tested the response of a supergiant star's convective envelope to added heat at the base of the envelope using an implementation of TDC that is available in a recent development version of MESA. A model using this TDC treatment exhibits almost identical behavior in the convective envelope to that of the models presented here, but with more numerical difficulties that make it difficult to apply to many models or to run them until core-collapse. Consequently, we choose to present our models that limit convective acceleration by \texttt{mlt\_accel\_g\_theta = 1} and successfully run to core collapse, with the understanding that the convective behavior appears similar with more sophisticated convective acceleration schemes. However, from preliminary tests, the surface properties of the TDC model differed slightly from the results presented here. Moreover, it is possible that TDC could affect the progression of core convection at Ne ignition, which has implications for the wave heating results. We therefore emphasize the need for further work on how TDC affects the evolution of massive stars. \section{Conclusion} We have modeled the effect of wave heating in red supergiant and stripped-star SN progenitors with ZAMS masses between~$10\text{--}13\, M_{\odot}$ using one-dimensional hydrodynamical simulations in MESA. In our models, we implement the improved wave heating physics of \citet{Wu2021} as we evolve to core collapse for~$M_{\rm ZAMS} > 11\, M_{\odot}$, replicating the wave energy results of that work. We additionally study models with~$M_{\rm ZAMS} \lesssim 10.5\, M_{\odot}$ which experience off-center ignition of Ne burning and are evolved to a few years after Ne ignition. These transmit much less wave heat than the centrally burning models because the wave power is carried primarily by~$\ell \gtrsim 3$ waves that are mostly damped in the core. The most energetic model in this study is the~$M_{\rm ZAMS} = 11\, M_{\odot}$ model, which transmits~$\sim \! 10^{47}~$erg of wave energy to its envelope around~$10$ years before core collapse in a burst of vigorous wave heating during central Ne burning. In our other models, waves are able to carry much less energy to the envelope. The wave energy in all of our supergiant and stripped star models is deposited just outside the core where the binding energy of overlying material is still high, and no mass loss is hydrodynamically driven by wave heating in any model. As a result, we do not predict that any of our models can produce significant CSM masses through wave heating alone. As wave heat is deposited at the base of the hydrogen envelope in our supergiant models, their photospheric properties respond to wave heating with only small oscillations in the final years before core-collapse. In our stripped star models, where wave heat is deposited much closer to the surface of the star, wave heating causes significant photospheric cooling and radial expansion in which~$T_{\rm eff}$ decreases by a factor of a few and~$R$ increases by up to a factor of~$10$. Wave heating causes the brightness of the hydrogen-poor SN progenitors to increase by up to 3 mags in visual bands in the final ten years of evolution. Furthermore, these Ib/c progenitors appear redder in visual bands than predicted by models without wave heating. Our hydrogen-poor wave heated models are approximately consistent with the colors and absolute magnitudes of the progenitors of type Ib SNe iPTF13bvn and SN2019yvr, but low-mass models with a small amount of hydrogen ($\sim \! 10^{-2} \, M_\odot$, with or without wave heating) could also be consistent with those progenitor observations. The large expansion of our hydrogen-poor models could also initiate interaction with a close binary companion, which could drive intense pre-supernova mass loss. Future work should study whether this channel is promising for producing more massive CSM. In addition, subsequent work should simulate the mass range~$\sim \! 8\text{--}10\, M_{\odot}$ beyond the propagation of the off-center Ne burning flame and through degenerate silicon ignition, which should be energetic enough to either directly drive a shock \citep{Woosley2015} or excite intense wave heating. Future investigations that are able to model this late-stage nuclear burning will be able to predict whether these stars can eject mass is the final months of their lives. \section*{Acknowledgments} We thank Adam Jermyn for supplying the time-dependent convection modules from a MESA development version, and Charlie Kilpatrick for help with HST filter functions. This work was partially supported by NASA grants HSTAR-15021.001-A and 80NSSC18K1017. J.F. acknowledges support from an Innovator Grant from The Rose Hills Foundation, and the Sloan Foundation through grant FG2018-10515. This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE‐1745301.
\section{Introduction} \label{sec:introduction} Facilitated by recent developments in pre-trained language models (PLM) such as BERT~\cite{devlin-etal-2019-bert}, neural ranking models have seen significant improvements in effectiveness~\cite{yates2021pretrained}. Neural ranking models can be categorized into two major groups: Cross-encoders and bi-encoders, which jointly or separately encode a query $q$ and a passage $p$, respectively. While the former shows stronger performance, the latter makes the passage representations indexable and thus enables efficient retrieval supported by approximated nearest neighbor (ANN) search, e.g., FAISS~\cite{johnson2019billion}. In this work, targeting web-scale retrieval, we follow the bi-encoder design and adopt the state-of-the-art bi-encoder, ColBERT~\cite{khattab2020colbert} as our target retriever. While label supervision has a critical role in training bi-encoders, only \textbf{incomplete labels} are available in benchmark training datasets due to the prohibitive cost of exhaustive human annotation of large-scale passage corpora. As a prominent example, in MSMARCO~\cite{nguyen2016ms} training dataset, the number of labeled relevant passages per query averages only 1.1, among 8.8M passages. In contrast, in TREC-DL 2019~\cite{craswell2020overview} which provides complete annotations for a select number of queries on the same passage collection, the same value is 58.2, indicating that significant amounts of relevant passages can remain unlabeled in MSMARCO. Meanwhile, we stress that the problem of incomplete labels observed from benchmark datasets gets worse in real-life retrieval tasks, where new relevant documents are constantly added without annotation. \begin{table}[t] \centering \resizebox{\columnwidth}{!}{ \begin{tabular}{l|lc} \toprule Training strategy & KD capacity & Efficiency \\ \midrule Standard KD & \cmark (cross-encoder) & \xmark \\ Self-KD & \xmark (bi-encoder) & \cmark \\ \midrule Ours && \\ \quad\textbf{Collective Self-KD} & \cmark (collective bi-enc)& \CheckmarkBold \\ \bottomrule \end{tabular} } \caption{Comparison of existing KD approaches with ours. Teacher for each method denoted in parentheses.} \label{tab:informed_labeling} \end{table} Existing work addressing incomplete labels can be categorized into uninformed smoothing and informed labeling. \textbf{Uninformed smoothing} redistributes the observed probability mass uniformly over the unobserved, and has been shown to improve model calibration and prediction~\cite{szegedy_label_smoothing,muller_label_smoothing}. However, given diverse topics in the passage corpora, uniform smoothing does not accurately reflect the true distribution. Alternatively, \textbf{informed labeling} distills knowledge from a trained model, evaluating the relevance of a $q$-$p$ pair, to assign a higher probability to an unlabeled pair with a higher estimated relevance, also known as knowledge distillation (KD)~\cite{hinton2015distilling}. Table~\ref{tab:informed_labeling} contrasts two existing KD strategies with different teachers -- cross- and bi-encoders -- and positions our proposed KD approach. Standard KD approaches adopt a high-capacity teacher, e.g., cross-encoder, to teach a bi-encoder student, e.g., ColBERT~\cite{hofstatter2020improving}. However, the cross-encoder teacher sacrifices efficiency, requiring BERT encodings to be recomputed for each possible $q$-$p$ pair. Alternatively, student and teacher can have equal capacity~\cite{furlanello2018born}, by adopting a bi-encoder teacher, i.e., in a self-knowledge distillation setting (self-KD). However, while increasing efficiency due to independent encoding of $q$ and $p$, the bi-encoder teacher provides little additional knowledge to the student. Our contribution is devising a more informed bi-encoder teacher achieving both high capacity and efficiency. \begin{table}[t!] \centering \resizebox{\columnwidth}{!}{ \begin{tabular}{l|l} \toprule $q$ & Is \textbf{caffeine} a \textbf{narcotic}? \\ \toprule $p_1$ & An opioid is sometimes called a \\ (relevant) & \textbf{narcotic}. The \textit{combination} of aspirin, \\ & \textit{butalbital}, \textbf{caffeine}, and codeine is \\ & used to \textit{treat tension headaches}. ...\\ \midrule $p_2$ & The \textit{combination} of acetaminophen, \\ (relevant) & \textit{butalbital}, and \textbf{caffeine} is used to \\ & \textit{treat tension headaches} ...\\ \midrule $p_3$ & ... \textbf{Caffeine} is a considered a safe \\ (non-relevant) & ingredient. It is stimulant that excites \\ & the nerve cells of the brain ... \\ \bottomrule $\tilde{q}$ (collective & \textit{treat tension headaches} \\ ~~~~~knowledge) & | \textit{combination} | \textit{butalbital} \\ \bottomrule \end{tabular} } \caption{A query $q$ with top-3 passages $p_{[1/2/3]}$ ranked by ColBERT. Key query terms are denoted in bold, and collective centroids $\tilde{q}$ of $p_{[1/2/3]}$ are italicized.} \label{tab:example} \end{table} To augment capacity without sacrificing efficiency, our distinction is utilizing a set of relevant passages from the bi-encoder teacher as \textbf{collective knowledge}. To illustrate, in Table~\ref{tab:example}, we show a query $q$, along with a set of three passages $\mathcal{F}_q=\{p_1, p_2, p_3 \}$, labeled as relevant by ColBERT. Considered individually, each passage may be mistakenly judged as relevant to the query, e.g., $p_3$. Instead, we consider $\mathcal{F}_q$ collectively, identifying their \textit{representative semantics}, or collective centroid $\tilde{q}$. Next, we treat $q\cup \tilde{q}$ as if it were a query, and \textit{redistribute} relevance labels based on the similarity to $q\cup \tilde{q}$, such that relevant passages (e.g., $\{p_1,p_2\}$) and non-relevant passages (e.g., $\{p_3\}$) can be discriminated. We henceforth denote our ColBERT teacher leveraging collective knowledge as \textbf{collective bi-encoder}. We validate the effectiveness of our proposed collective bi-encoder for KD, comparing retrieval efficacy with existing models on the TREC and MSMARCO datasets. While achieving the state-of-the-art performance, we train up to $\times8$ times faster than existing KD that uses cross-encoder teachers. \section{Approach}\label{sec:approach} Taking the state-of-the-art bi-encoder ColBERT as our target retriever (\S\ref{sec:colbert}), our goal is to tackle the problem of incomplete labels during training (\S\ref{sec:training}). To do so, we devise a stronger ColBERT teacher that leverages collective knowledge to refine relevance labels that are transferred to the ColBERT student via KD (\S\ref{sec:teacher}). \subsection{Baseline: ColBERT}\label{sec:colbert} While following a bi-encoder design to enable $p$ to be indexed offline, ColBERT additionally models term-level interactions between separately encoded $q$, $p$ term representations (called \textbf{late-interaction}) to leverage exact-match signals as in cross-encoder. Specifically, terms in $q$, $p$ are first encoded using BERT, as contextualized representations $\mathbf{q}, \mathbf{p}\in\mathbb{R}^{768}$, then $q$-$p$ relevance $\phi_q(p)$ is computed by aggregating similarity between the terms in $q$, $p$: \begin{align} \phi_q(p)&= \sum_{i\in [1,|q|]} \max_{j\in [1,|p|]} { (\mathbf{W}\mathbf{q}_{i})^\top (\mathbf{W}\mathbf{p}_{j}) } \label{eq:maxsim}, \end{align} where $|q|$, $|p|$ denote the number of tokens in $q$, $p$ respectively, and $\mathbf{W}\in\mathbb{R}^{128\times 768}$ compresses features for efficient inner-product computation. Our goal is to improve training by addressing the challenge of incomplete labels, which we discuss in the following subsection. \subsection{Challenge: Incomplete Labels}\label{sec:training} We formally revisit the challenge of incomplete labels in IR. Given complete labels on true relevance, $\phi_q^*$, the correlation between $\phi_q$ and $\phi_q^*$ can be increased via an objective $\mathcal{L}$ using KL-divergence. \begin{align} \mathcal{R}_q(p)&=\text{softmax}(\phi_q(p))\\ \mathcal{L}&=-\sum_{p'\in\mathcal{P}}\mathcal{R}^*_q(p')\log\dfrac{\mathcal{R}_q(p')}{\mathcal{R}^*_q(p')}, \end{align} where $\mathcal{R}_q^*$ denotes a probability distribution obtained by normalizing $\phi_q^*$. Let us now consider the scenario of incomplete label supervision: The standard training approach would approximate $\mathcal{R}_q^*$ as $\mathcal{R}^*_q(p^+)$ = $1$ for a labeled positive $p^+$, and $\mathcal{R}^*_q(p^-)$ = $0$ for the others by assuming them to be negatives $\{p^-\}$: \begin{align} \mathcal{L}&=-\log \mathcal{R}_q(p^+)\\ &=-\log \dfrac{e^{\phi_q(p^+)}}{e^{\phi_q(p^+)}+\sum_{p^-}e^{\phi_q(p^-)}}\label{eq:hard_loss}, \end{align} where, in the official train samples of MSMARCO, $p^-$ is randomly sampled from the top-1000 ranked passages by BM25 given $q$ as a query. Our claim is that, in the case of \textit{incomplete} labels, where the number of unlabeled $p^+$ becomes larger, this assumption causes $\mathcal{R}_q^*$ to be poorly approximated. \subsection{Proposed: Collective Self-KD}\label{sec:teacher} To better estimate $\mathcal{R}_q^*(p)$, we utilize collective knowledge, introduced in Section~\S\ref{sec:introduction}. Collective knowledge makes it possible to distill residual relevance knowledge between teacher and student, leading to a high degree of efficiency. As illustrated in Table~\ref{tab:example}, our collective bi-encoder teacher first obtains the collective centroid $\tilde{q}$ from top-ranked passages to expand $q$ to $q\cup \tilde{q}$. Given $q\cup \tilde{q}$, the collective knowledge of the teacher is reflected in the updated $\mathcal{R}_q^*(p)$, which is now approximated as $\mathcal{R}_{q\cup \tilde{q}}(p)$, the similarity between $p$ and $q\cup \tilde{q}$. In practice, we implement our teacher using the recently proposed ColBERT-PRF~\cite{10.1145/3471158.3472250}, which uses \textbf{PRF for \textit{query expansion}} (at test time) by using top-ranked passages from ColBERT as pseudo-relevance feedback (PRF). Our distinction is leveraging \textbf{PRF for \textit{labeling}} (at train time) to augment the capacity of bi-encoder teacher. This is an important distinction, as it provides substantial benefits as follows: (1) Train-time PRF is more reliable than test-time PRF, since at test time, the initial ranking is less accurate for novel queries that have not been observed during training. (2) Train-time PRF additionally provides hard negatives~\cite{xiong2021approximate} (e.g., $p_3$ in Table~\ref{tab:example}), as by-products of the initial ranking from ColBERT, producing better $\{p^-\}$ for training. With the goal of distilling collective knowledge while preserving test time efficiency, we now describe in detail the operation of our collective bi-encoder teacher, and $\mathcal{R}_q^*(p)$ estimation process. \subsubsection{Collective Knowledge Extraction} As a preliminary, we pre-train a ColBERT model using Eq (\ref{eq:hard_loss}) and use it to rank passages in the collection for each $q$, producing a ranking $\Pi_q=\{p^l\}_{l=1}^{|\mathcal{P}|}$ where $l$ and $|\mathcal{P}|$ denotes the rank of each passage and the size of the passage collection, respectively. From these, we obtain the top-$f_p$ ranked passages, as feedback passages $\Pi_q^{l\le f_p}=\{p^l\}_{l=1}^{f_p}$. To extract collective knowledge present in $\Pi_q^{l\le f_p}$, we apply k-means clustering on the token embeddings in $\Pi_q^{l\le f_p}$, i.e., $\{\mathbf{W}\mathbf{p}^l_i\}_{\forall l\in\{1,f_p\}, \forall i\in\{1, |p^l|\}}$, producing $f_c$ centroid embeddings $\mathcal{C}_{q}=\{\mathbf{c}_{q,m}\}_{m=1}^{f_c}$. Then, in order to sift out trivial knowledge, discriminative embeddings among $\mathcal{C}_{q}$ are further filtered. More precisely, we sort the centroids in $\mathcal{C}_{q}$, by the IDF score of the token that is the nearest neighbor, among the entire passage collection, to each $\mathbf{c}_{q,m}$. According to these IDF scores, we select the top-$f_e$ embeddings among $\mathcal{C}_{q}$ as the final collective centroid embeddings, i.e., vector representations for $\tilde{q}$, denoted by $\mathcal{E}_q=\{\mathbf{e}_{q,n}\}_{n=1}^{f_e}\subset \mathcal{C}_{q} $. Finally, to obtain the improved approximation of $\mathcal{R}_q^*$ via $\mathcal{R}_{q\cup \tilde{q}}(p)$, the similarity between $\mathcal{E}_q$ and $p$ is added to $\phi_q(p)$ in Eq (\ref{eq:maxsim}): \begin{align} \begin{split} \mathcal{R}^*_q(p)&\approx\text{softmax}( \phi_q(p) \\ &+\beta \sum_{n\in[1,f_e]}\sigma_{q,n}\max_{j\in [1,|p|]}{\mathbf{e}_{q,n}^\top (\mathbf{W}\mathbf{p}_{j}})), \end{split} \label{eq:teacher_score} \end{align} where $\sigma_{q,n}$ is the IDF of the nearest neighbor token of $\mathbf{e}_{q,n}$, weighing the contribution of each $\mathbf{e}_{q,n}$ in terms of discriminability, and $\beta$ is a hyper-parameter controlling overall contribution. Note that, we can reuse the collective centroids for estimating the $\mathcal{R}_q^*(p)$ of any $p$, avoiding redundant BERT encoding. \subsubsection{Collective Knowledge Distillation} We now propose efficient distillation strategies for teaching $\mathcal{R}_q^*$ to the student, where we leverage the fact that the student and the teacher share the identical architecture design. For efficient KD, we let our student inherit most of the knowledge through the parameters of the teacher, by initializing the student's parameters with those of the pre-trained ColBERT, denoted by $\theta$. Since $\theta$ already captures $\mathcal{R}_q$, the knowledge distillation of $\mathcal{R}_{q\cup \tilde{q}}$ can be simplified as distilling residual relevance, i.e., $\mathcal{R}_{\tilde{q}}$, to the student. Meanwhile, when using $\theta$ for initialization, $p^-$ sampled by BM25 now becomes a trivial negative that can be easily discriminated by $\theta$. To learn additional knowledge, we introduce hard negatives, by utilizing the initial ranking $\Pi_q$ from the pre-trained ColBERT. Specifically, we replace the pool of $p^-$ with top-100 ranked passages $\Pi_q^{l\le 100}$, so as to improve top-ranking performance of the student. \begin{table*}[ht] \centering \resizebox{\textwidth}{!}{ \begin{tabular}{l|cc|cc|cc|c} \toprule \multirow{2}{*}{Retriever} & \multicolumn{2}{c|}{MSMARCO Dev} & \multicolumn{2}{c|}{TREC Passages 2019} & \multicolumn{2}{c|}{TREC Passages 2020} & MRT \\ \cline{2-7} & MRR@10 & Recall@1k & NDCG@10 & Recall@1k & NDCG@10 & Recall@1k & (ms) \\ \midrule ColBERT-PRF Ranker ($\beta=0.5$) & 0.334 & 0.974 & 0.776 & 0.899 & 0.732 & 0.910 & \multirow{2}{*}{3035} \\ ColBERT-PRF Ranker ($\beta=1.0$) & 0.317 & 0.965 & 0.766 & 0.885 & 0.704 & 0.900 & \\ \midrule ColBERT (a) & 0.367 & 0.967 & 0.700 & 0.837 & 0.675 & 0.854 & \multirow{7}{*}{1299} \\ ColBERT-HN (b) & 0.374 & 0.969 & 0.741 & 0.838 & 0.700 & 0.867 & \\ Self-KD (c) & 0.367 & 0.968 & 0.705 & 0.833 & 0.704 & 0.839 & \\ Standard KD; CE (d) & 0.373 & 0.967 & 0.715 & 0.791 & 0.696 & 0.829 & \\ Standard KD; CE-3 (e) & 0.378 & 0.963 & 0.717 & 0.793 & 0.684 & 0.824 & \\ \cline{1-7} (ours) Collective Self-KD ($\beta=0.5$) & \textbf{0.386}$^{a,b,c,d}$ & \underline{0.972}$^{a,b,c,d,e}$ & \underline{0.744} & \underline{0.843} & \textbf{0.724} & \underline{0.874}$^{e}$ & \\ (ours) Collective Self-KD ($\beta=1.0$) & \underline{0.384}$^{a,c,d}$ & \textbf{0.974}$^{a,b,c,d,e}$ & \textbf{0.751} & \textbf{0.868} & \underline{0.721} & \textbf{0.883}$^{e}$ & \\ \bottomrule \end{tabular} } \caption{ ``CE'' and ``CE-3'' denote a single and an ensemble of three cross-encoder teachers, respectively. MRT denotes Mean Response Time (ms) per query. Those outperforming all baselines except ColBERT-PRF are \underline{underlined}, and the best shown in \textbf{bold}. Superscripts denote statistical significance with paired t-test over the indicated baselines ($p<0.05$). } \label{tab:student_ranking} \end{table*} \section{Experiments} \subsection{Experimental Settings}\label{sec:exp_setup} We conduct our experiments by trainining retrievers using the MSMARCO training dataset, and evaluating on the MSMARCO Dev and TREC-DL 2019/2020 datasets, which provide binary and graded relevance labels, respectively. For TREC-DL datasets, we adopt grade 2 as the binary cut-off. For evaluation metrics, we report MRR@10 for MSMARCO and NDCG@10 for TREC-DL, and Recall@1000 for both. We also report the per query mean response time (MRT) of retrievers. The results are from a single run. \subsection{Dataset Details} \label{sec:data_details} MSMARCO~\cite{nguyen2016ms}\footnote{MSMARCO is intended for non-commercial research purposes. Refer to https://microsoft.github.io/msmarco for further details.} is a passage ranking dataset initially introduced for reading comprehension and subsequently adopted for retrieval. The collection consists of 8.8M passages, obtained from the top-10 search results retrieved by the Bing search engine, in response to 1M real-world queries. The training and evaluation sets contain approximately 500,000 queries and 6,980 queries, respectively, with roughly one relevant positive passage label per query, with binary relevance labels. TREC-DL 2019/2020~\cite{craswell2020overview,craswell2021overview} datasets are provided by the passage ranking task of the 2019 and 2020 TREC Deep Learning tracks, providing densely-judged annotations of 43 and 54 queries, respectively. They share the same passage pool as MSMARCO, and there are 215/211 human relevance annotations per query. The relevance judgments are graded on a four-point scale: Irrelevant, Related, Highly Relevant, and Perfectly Relevant. \subsection{Results}\label{exp:contribution_kd} In this section, we validate the effectiveness of our collective self-KD with ColBERT as our target retriever. The results of ranking experiments are reported in Table~\ref{tab:student_ranking}. \paragraph{Baselines} We compare several different training strategies: training using incomplete labels (i.e., by Eq (\ref{eq:hard_loss})) or using better approximation of $\mathcal{R}^*$ from a teacher. For the former, we report results from different $\{p^-\}$: ColBERT trained using top-1000 ranked passages by BM25 (\textbf{ColBERT}) and ColBERT further fine-tuned using $\Pi_{q}^{l\le 100}$ (\textbf{ColBERT-HN}). For the latter, we compare different teachers: (1) an identically parameterized teacher (\textbf{Self-KD}), (2) a cross-encoder adopting BERT-Base encoder (\textbf{Standard KD; CE}), (3) an ensemble of three cross-encoders with different PLMs, i.e., BERT-Base, BERT-Large, and ALBERT-Large~\cite{albert}, (\textbf{Standard KD; CE-3}), and finally (4) our collective bi-encoder teacher (\textbf{Collective Self-KD}). For relevance labels from cross-encoder teachers, we used open-sourced data by \cite{hofstatter2020improving}\footnote{\url{https://zenodo.org/record/4068216}}. Analysis on estimated $\mathcal{R}^*$ from different teachers can be found in Appendix~\ref{sec:appendix_approx}. For values of ($f_p$, $f_c$, $f_e$, $\beta$), we set ($f_p$=3, $f_c$=24, $f_e$=10) and ran experiments with $\beta=0.5$ and $\beta=1.0$, by referring to the reported results in \citet{10.1145/3471158.3472250}. For further analysis on ($f_p$, $f_c$, $f_e$, $\beta$), see Appendix~\ref{sec:prf_configuration}. In addition, we also compare ColBERT-PRF Ranker with $\beta=0.5$ and $\beta=1.0$. \paragraph{Ranking Performance} By leveraging PRF to augment query contexts, ColBERT-PRF shows strong performance, outperforming the others on TREC-DL datasets. Meanwhile, on MSMARCO Dev queries, ColBERT-PRF shows comparable or higher recall but lower MRR@10, compared to ColBERT. This is a well-known limitation of PRF for sparse query datasets, such as MSMARCO evaluation dataset with a few relevant documents (1.1 per query)~\cite{amati2004query}. Among ColBERT retrievers, as expected, basic self-KD fails to improve performance. For ColBERT students distilled from cross-encoder teachers, Recall@1k shows marginal difference on MSMARCO Dev, and decreases on the TREC-DL datasets. Our teacher is the most effective for KD, where our student outperforms the others on all metrics. As a result, our student shows closest performance to ColBERT-PRF. This indicates collective knowledge from PRF helps to better labeling relevance and our collective self-KD effectively transfers collective knowledge to our student. Importantly, our method produces a much more efficient student than ColBERT-PRF, by distilling collective knowledge into the parameters of the student, resulting in a 3-fold reduction of MRT. More specifically, recall that ColBERT-PRF performs PRF at \textit{evaluation time}, and thus performs two rounds of retrieval (one using $q$ and the other using $q\cup \tilde{q}$), increasing latency approximately two fold. Furthermore, obtaining $\tilde{q}$ from PRF requires additional online computation at evaluation time. In contrast, we transfer such computations to training time for relevance labeling, eliminating all overheads at evaluation time. \paragraph{Training Efficiency}\label{sec:efficient_kd} We compare training efficiency between our collective self-KD and standard KD using cross-encoder teachers. On the same device\footnote{We used a single GeForce RTX 3090 GPU with 24 GiBs of memory, on a server which has 187 GiBs of RAM, and two Intel Xeon Gold 6254 CPUs, each with 18 physical cores.}, we measured elapsed times for the annotation phase of relevance labels via teacher, and student training phase using the labels. In annotation phase, for a single cross-encoder teacher using a BERT-Base encoder, obtaining $\mathcal{R}^*$ takes roughly 40 hours. For a teacher using a BERT-Large encoder, this time increases to 90 hours, and for ALBERT-Large encoder, to 110 hours. When ensembling cross-encoder teachers, the cost is compounded. In contrast, our teacher takes only 15 hours for obtaining collective knowledge, i.e., $\mathcal{E}_q$ along with $\sigma_n$ in Eq~\ref{eq:teacher_score}, indicating a speedup between $\times2.67\sim\times16$. Such efficiency gain comes from the difference in the encoding phase. More precisely, given $|Q|$ queries and $|D|$ documents, cross-encoder spends quadratic complexity for encoding, e.g., $|Q|\times |D|$ BERT encoding, while our teacher adopting bi-encoder design only spends linear complexity, e.g., $|Q|+|D|$ BERT encoding. As a result, cross-encoder teachers do not scale to real-world retrieval tasks, for labeling large numbers of queries/documents. For training student, we enable efficient training via informed initialization. As a result, time consumed for training student only takes 20 hours, whereas the same value was around 50 hours in standard KD, indicating an overall speedup of $\times2.5$. In total, our collective self-KD is at least $\times 2.5$ faster and up to $\times 8$ faster than standard KD approaches. \section{Conclusion and Future Work} We study collective relevance labeling to overcome incomplete labels in passage retrieval. Our approach bypasses the computational overhead associated with PRF, leading to a state-of-the-art student retriever without sacrificing efficiency. We validate the effectiveness of our method over existing approaches on the MSMARCO and TREC-DL Passage Ranking datasets. As future work, we consider zero-shot transfer. While our collective self-KD effectively distills knowledge, one requirement we have is to bootstrap the collective knowledge with a good initial ranking model. As it usually requires some form of label supervision to train such a model, the case where no initial supervision is available, may be considered a limitation of our method. We believe bootstrapping an effective self-KD without any supervision is a promising direction. \section*{Acknowledgements} This work was supported by Microsoft Research Asia and IITP [(2022-00155958, High Potential Individuals Global Training Program) and (NO.2021-0-01343, Artificial Intelligence Graduate School Program (Seoul National University)].
\section{Introduction} \label{sec:intro} Machine learning is advancing at a fast pace with the current state-of-the-art research. While the majority of solutions focus on obtaining as high accurate models as possible without evaluating the energy impact, during the past years some research lines have emerged that focus on developing low power models~\cite{gauen2017low,rodrigues2018synergy,strubell2019energy}. Data stream mining is an area in data mining where the inference and training of the algorithm are performed in real-time (or pseudo-real-time), building and updating the models incrementally. One of the key requirements is that only the statistics of the data are stored in the model. These models usually incur low computational and power demands, since their goal to run at the edge and on embedded devices. The Hoeffding Tree (HT) algorithm~\cite{domingos2000mining} is a pioneering algorithm for building decision trees for data streams with theoretical guarantees. Current research suggests that still the main focus of Hoeffding Tree extensions is to obtain a higher predictive accuracy compared to their predecessor~\cite{gomes2017survey}. This is the case of ensembles of Hoeffding trees~\cite{oza2005online,oza2001experimental,Oza01onlinebagging} and the Extremely Fast Decision Tree (EFDT)~\cite{Manapragada:2018:EFD:3219819.3220005}. These algorithms build more accurate trees, but at a high energy cost. This paper presents the Green Accelerated Hoeffding Tree, an energy-efficient extension of the EFDT algorithm. GAHT sets individual splitting criteria for every leaf so that the algorithm can grow more organically depending on the distribution of the number of instances over the leaves of the tree. Distributing the growth of the tree between the different nodes allows for the algorithm to spend more energy on the part of the tree that needs to grow faster (increasing accuracy), and save energy on the other branches. GAHT has been empirically evaluated in terms of accuracy (percentage of correctly classified instances) and energy consumption against four baseline algorithms: HT~\cite{domingos2000mining}, EFDT~\cite{Manapragada:2018:EFD:3219819.3220005}, OzaBag~\cite{oza2005online} (Online Bagging), and OzaBoost (Online Boosting)~\cite{oza2005online}. While HT consumes less energy than the rest of the algorithms, it also performs poorly in terms of accuracy---ranking as the worst algorithm in terms of accuracy for the majority of datasets. GAHT achieves better accuracy than EFDT and OzaBag. Although OzaBoost achieves 1\% higher accuracy than GAHT on average, a statistical test on the ranks of the algorithms shows that there is no statistical difference in accuracy between such algorithms. However, the statistical test on the ranks between the energy consumption of the algorithms shows that GAHT consumes significantly less energy than EFDT, OzaBag, and OzaBoost. On the other hand, the difference in ranks in energy consumption between GAHT and HT is not statistically significant. On average GAHT consumes 27\% less energy than EFDT, 67\% less energy than OzaBag, and 72\% less energy than OzaBoost. Finally, we have evaluated the memory used by the models. GAHT outputs smaller trees than EFDT and the ensembles in the majority of the cases, outputting lower energy even for those cases when GAHT trees are bigger. These trees take up between 1MB to 30MB, which is in the range of the mobile nets, convolutional neural networks highly optimized for embedded devices~\cite{howard2017mobilenets}. The rest of the paper is organized as follows. Background explanations on HT, EFDT, OzaBag, and OzaBoost are given in Section~\ref{sec:background}. Related works to our are presented in Section~\ref{sec:rel_work}. The details behind GAHT, together with converge and energy complexity analyses are presented in Section~\ref{sec:GAHT}. Experiments and results are presented in Sections~\ref{sec:exp_design} and~\ref{sec:emp_eval} respectively. Finally, conclusions and future lines of work are presented in Section~\ref{sec:conclusions}. \section{Preliminaries} \label{sec:background} This section explains in detail the Hoeffding Tree, EFDT, Online Bagging (OzaBag in the experiments), and Online Boosting (OzaBoost in the experiments) while GAHT is explained in Section~\ref{sec:GAHT}. \subsection{Hoeffding Tree} The Hoeffding algorithm (HT), proposed by~\cite{domingos2000mining}, was the first algorithm that was able to mine from infinite streams of data, requiring low computational power. The algorithm creates a decision tree in real-time obtaining similar performance as offline decision trees, with theoretical guarantees. This is achieved by saving the necessary information (statistics) from the different instances observed at each node. Once $nmin$ instances are observed at a leaf, the algorithm calculates the information gain (entropy) for each attribute, using the aforementioned statistics. If $\Delta \overline{G} > \epsilon$, i.e. the difference between the information gain from the best and the second-best attribute ($\Delta \overline{G}$) is higher than the Hoeffding Bound~\cite{hoeffding1963probability}($\epsilon$), then a split occurs, and the leaf substituted by the node with the best attribute. The Hoeffding bound($\epsilon$) is defined as: \begin{equation} \label{eq:hoeff} \epsilon = \sqrt{ \frac{ R^2 \ln (1/\delta)}{ 2n}} \end{equation} and it states that the split on the best attribute having observed $n$ number of examples, will be the same as if the algorithm had observed an infinite number of examples, with probability $1-\delta$. On the other hand, if $\Delta \overline{G} < \epsilon < \tau$, a tie occurs. This happens when the two top attributes are equally good, thus the tree splits on any of those. \subsection{Extremely Fast Decision Tree} \label{sec:EFDT} The EFDT is the implementation of the Hoeffding Anytime Tree, which was recently published at KDD~\cite{Manapragada:2018:EFD:3219819.3220005}. The EFDT is able to create a Hoeffding tree with higher predictive performance than the Hoeffding Tree. This is achieved by having a less restrictive split criterion, allowing the tree to grow faster; and by reevaluating the already split nodes to try to resemble more the asymptotic batch decision tree. EFDT evaluates if the information gain of the best attribute is higher, by a difference of $\epsilon$, than the information gain of not splitting on the leaf. If that occurs, there is a split on the best attribute. While the EFDT can output significantly higher accuracy than standard Hoeffding trees, it does this at a higher cost of energy consumption. \subsection{Online Bagging} \label{sec:ozabag} Bagging consists of creating $M$ different models that are trained on different samples of the data. Each sample is chosen randomly with replacement, i.e. the same sample can potentially be used to train more than one of the $M$ models. The final model makes a prediction by taking the majority voted class between the $M$ models. Online Bagging~\cite{oza2001experimental,oza2005online} is the extension of the bagging technique for online and streaming scenarios. The main challenge is that is not possible to draw examples randomly with replacement since the examples are only read once. To address that challenge, this algorithm reads each instance assigning it a specific weight following a Poisson distribution with $\lambda=1$, for each model. After each instance is read, each model will be trained on the new instance $k$ times, where $k=Poisson(1)$. The rationale behind using a Poisson distribution lies in the property that a \textit{bootstrap sampling can be simulated by creating $K$ copies of each instance following a binomial distribution}~\cite{MOA-Book-2018}. When the number of instances is large, the binomial distribution tends to a Poisson distribution with $\lambda=1$. \subsection{Online Boosting} \label{sec:ozaboost} Boosting is a technique that combines multiple models sequentially instead of in parallel. The main idea is that the new model is built based on the performance of the previous model, setting a higher weight to the examples that are misclassified by the previous models~\cite{freund1997decision}. This achieves a better performance more generally throughout the data. Boosting was later extended for streaming and online scenarios~\cite{oza2001experimental,oza2005online}. Similar to Online Bagging but where $\lambda$ of the Poisson distribution will be updated based on the correctly or incorrectly classification of the previous classifier in the ensemble. After an instance is read, the first model is trained on that instance $k$ times, where $k=Poisson(\lambda=1)$. If the model classifies correctly that instance, the weight of that instance gets updated to a lower value. That instance is then observed by the next model, with the $\lambda$ updated to the new weighted value. If the instance is misclassified, the weight of that instance increases, so that the next model is trained more times on that instance. \section{Related Work} \label{sec:rel_work} Energy efficiency has been studied in computer architecture for several decades, with a focus on designing processors that can perform more operations under the same power budget~\cite{koomey2009assessing}. In the field of machine learning, there is a current trend that focuses on reducing the energy consumption of both training and inference, to be able to run models on the edge~\cite{kalchbrenner2018efficient}. This is the case for deep learning~\cite{rodrigues2017fine,rodrigues2018synergy,han2015deep,chen2017eyeriss}, an area where they have also created \textit{The Low Power Image Recognition Challenge} (LPIRC)~\cite{gauen2017low}, a competition where they present the best technologies that can detect objects with high precision and low energy consumption. Data stream mining algorithms started to gain importance in the year 2000, with the publication of the Hoeffding Tree~\cite{domingos2000mining} algorithm. This algorithm was the first that could analyze an infinite stream of data in constant time per example. The Hoeffding Tree was then extended to handle concept drift~\cite{hulten2001mining,bifet2009adaptive}, that is, changes in the data source. Ensembles of Hoeffding trees were introduced to be able to achieve higher predictive accuracy. Models such as Online Bagging~\cite{oza2005online}, Leveraging Bagging~\cite{bifet2010leveraging}, Online Boosting~\cite{oza2005online}, Online Coordinate Boosting~\cite{pelossof2009online}, and the novel Adaptive Random Forest~\cite{gomes2017adaptive}, that can also handle concept drift. This paper focuses on the original OzaBag and OzaBoost to do a fair comparison of algorithms that were not designed to handle concept drift. While Leveraging Bagging and Adaptive Random Forest can output competitive accuracy results both in static and dynamic scenarios (with concept drift), they incur significantly higher energy requirements. The reason behind this is that more computations and memory accesses are required to be able to handle concept drift. Thus, we believe it is unfair to compare algorithms meant for concept drift scenarios with simpler algorithms under datasets without concept drift. Leveraging Bagging and Adaptive Random Forest output significantly higher energy consumption, but a significantly higher accuracy is not observed due to the nature of the datasets. The latest Hoeffding Tree algorithm is the already mentioned Extremely Fast Decision Tree (EFDT) (Section~\ref{sec:EFDT}), which obtains higher accuracy compared to the original Hoeffding Tree while taking longer to run~\cite{Manapragada:2018:EFD:3219819.3220005}. Concerning energy efficiency, the Vertical Hoeffding Tree (VHT)~\cite{kourtellis2016vht} algorithm was introduced as a parallel version of the Hoeffding Tree. The authors of~\cite{marron2017low} proposed a parallel version of random forests of Hoeffding trees with specific hardware configurations. GAHT, our proposed algorithm, is a hybrid between HT and EFDT, resulting in a more energy-efficient extension of EFDT and an ensemble of Hoeffding trees. This is achieved by applying the less-restrictive splitting criteria of EFDT only on a set of selected nodes and deactivating another set of less-visited nodes. More details are given in Section~\ref{sec:GAHT}. \section{Green Accelerated Hoeffding Tree} \label{sec:GAHT} \subsection{Basic Idea} This section presents the Green Accelerated Hoeffding Tree algorithm (GAHT), the main contribution of the paper. GAHT, presented in Alg.~\ref{alg:GAHT}, follows a per-node splitting criterion that varies depending on the distribution of the observed data. The goal of GAHT is to present an approach that can obtain competitive accuracy results, while still staying within a constrained energy budget. In particular, our goal is to achieve the same accuracy as the EFDT and ensemble of Hoeffding trees, but at a lower energy cost. For that, we follow similar reasoning as the authors of the \textit{nmin adaptation} method~\cite{garcia2018hoeffding}. The idea is to have dynamic hyperparameters at the nodes rather than traditional static hyperparameters. This allows the tree to split in a more personalized manner since different nodes have observed different samples of the incoming data. This approach is also useful for concept drift scenarios since it is very probable that the initial parameter setup is not valid anymore when the data has drifted. Looking at Alg.~\ref{alg:GAHT}, GAHT reads an instance, traverses the tree, and for each instance it calculates the fraction of instances seen at that leaf (considering the amount of instances observed since that leaf was created, and the number of leaves); as follows: \begin{equation} \label{eq:fraction} fraction = \dfrac{n_l}{n_{since\_creation}/{n_{leaves}}} \end{equation} Where $n_l$ refers to the number of instances observed at that particular leaf, $n_{since\_creation}$ refers to the number of instances observed in the tree since that leaf was created, and $n_{leaves}$ refers to the number of leaves in the tree. If $fraction$ is lower than the $deactivateThreshold$, that leaf is deactivated. When a leaf is deactivated the statistics are still stored, but the leaf is not allowed to grow. On the other hand, if $fraction$ is higher than the $growFastThreshold$, then that leaf is set to the EFDT splitting criteria, making faster splits on that branch. That is, instead of comparing the information gain of the two best attributes, the algorithm compares the information gain of the best attribute against the null split. The null split stands for the information gain without creating a split. The idea behind Equation~\ref{eq:fraction} is that assuming new instances arrive uniformly distributed over the leaves of the tree, the expected value of $fraction$ is one. Hence, a value of less than one means that we have observed less than the expected amount of instances at that leaf. We have implemented GAHT so that the user can choose the values of parameters $deactivateThreshold$ and $growFastThreshold$. For these experiments we set \texttt{deactivateThreshold = 0.01} and \texttt{growFastThreshold = 2}, to deactivate leaves observed less than 1 percent of the expected amount, and grow faster the leaves observed twice the expected amount. In the case where there are restrictions on energy consumption, the user can increase the value of $deactivateThreshold$, since deactivating more nodes will reduce energy consumption. \begin{algorithm}[tbh] \caption{Green Accelerated Hoeffding Tree. \textbf{Symbols:}$HT$: Initial tree; $X$: attributes; $G(\cdot)$: split evaluation function; \textbf{Hyperparameters:} $\tau$: tie threshold; $nmin$: batch size, $deactivateThreshold$: threshold to deactivate a leaf; $growFastThreshold$: threshold to set the node to follow the EFDT splitting criteria}\label{alg:GAHT} \begin{algorithmic}[1] \setlength{\lineskip}{3pt} \WHILE {stream is not empty} \STATE Read instance \STATE Traverse the tree using $HT$ \STATE Update statistics at leaf $l$ \COMMENT{Attributes} \STATE Increment $n_l$: instances seen at $l$ \STATE $fraction = \dfrac{n_l}{{n_{since\_creation}}/{n_{leaves}}}$ \IF {$fraction <$ deactivateThreshold} \STATE DeactivateLeaf \ELSIF {$fraction >$ growFastThreshold} \STATE growFast $\gets$ True \COMMENT{EFDT criteria on $l$} \ENDIF \IF {$nmin$ $\leq$ $n_l$} \STATE Compute $\overline{G_l}(X_i)$ for each attribute $X_i$ \IF {growFast == True} \STATE $X_b$ = null split \ELSE \STATE $X_b$ = second best attribute \ENDIF \STATE $\Delta \overline{G} = \overline{G}_l(X_a) -\overline{G}_l(X_b)$ \IF {($\Delta \overline{G} > \epsilon$) or ($\Delta \overline{G} < \epsilon < \tau$)} \STATE CreateChildren($l$)\COMMENT{New leaf $l_m$} \ELSE \STATE Disable att $\{X_{p} | (\overline{G}_l(X_p) -\overline{G}_l(X_a)) > \epsilon \}$ \ENDIF \ENDIF \ENDWHILE \end{algorithmic} \end{algorithm} \subsection{Convergence} At any time, a leaf node in a GAHT tree exists in one of three states: \begin{enumerate} \item If $fraction < deactivateThreshold$, the node is deactivated, meaning no further splitting is done. \item If the leaf node is active, and $fraction \leq growFastThreshold$, splitting of the leaf node is performed identically to a HT. \item If the leaf node is active, and $fraction > growFastThreshold$, splitting of the leaf node is performed identically to an EFDT. \end{enumerate} Considering only cases (1) and (2), it is clear that the resulting tree would converge to a structure identical to that of an ordinary HT since any splitting of a leaf node is performed according to the same criteria. For case (3), proofs are provided in \cite{manapragada2018extremely}, showing that the structure of an EFDT probabilistically converges to that of a HT and, by extension, to that of an ordinary decision tree. We note that, in an EFDT, sub-trees with internal root nodes are continuously revised using the ReEvaluateBestSplit method \cite{manapragada2018extremely}, which is not the case for a GAHT tree. This particular functionality of the EFDT algorithm exists to ensure that sub-optimal splits, resulting from eager splitting on skew attributes, are not retained within the tree structure. In GAHT, such unfortunate splits are instead pre-empted through leveraging the $nmin$ parameter---since no split is performed within a leaf before $nmin$ instances have been observed, the attribute skewness has a minimal effect on the tree structure (assuming that the $nmin$ parameter is set to a sufficiently large value). \subsection{Energy complexity} \label{sec:energy_complexity} In \cite{garcia2018hoeffding} the concept of energy complexity is introduced concerning Hoeffding trees. The authors conclude that the most energy-consuming part of the algorithm is related to computing the best attributes and traversing the tree. The main differences between this and the standard Hoeffding tree lie in the splitting frequency and traversing the tree. Since the main contributor of energy consumption in a tree learning algorithm is the computation of the best splitting attributes, the energy cost of GAHT can be approximated by \begin{equation} E(GAHT) = \alpha E(S_{inactive}) + \beta E(S_{HT}) + \gamma E(S_{EFDT}) , \end{equation} where $E$ denotes energy cost, $S$ denotes a splitting function, and $\alpha$, $\beta$ and $\gamma$ respectively denote the proportion of leaves that exists in the deactivated state, or is being split by the HT or EFDT criteria. If $\beta=1$, or $\gamma=1$, the energy cost of GAHT is approximately equal to that of a HT or an EFDT, respectively. Since the deactivated leaf node state carries the least energy cost (as no splitting, and hence no computation of best splitting criteria, is performed), it is apparent that the energy cost of GAHT is upper bounded by that of HT and EFDT in the sense that \begin{equation} E(GAHT) \in O\left[sup\left\{E\left(S_{HT}\right), E\left(S_{EFDT}\right)\right\} \right] \, . \end{equation} Similarly, we can define a lower bound of the energy cost of GAHT as \begin{equation} E(GAHT) \in \Omega \left[ E\left(S_{inactive} \right)\right] \, . \end{equation} \subsection{Time and Space Complexity} \label{sec:time_complexity} The space and time complexity of GAHT are upper-bounded by the time and space complexity of EFDT and HT and lower bounded by deactivating leaves. The same as for energy complexity. Regarding time complexity, following the reasoning of EFDT~\cite{Manapragada:2018:EFD:3219819.3220005}, we can divide the operations in the tree into two main ones: updating the statistics at the leaf, and evaluating the possible splits. In the case of EFDT, they re-evaluate splits, while in our case we have a simpler solution where the splits are never re-evaluated. Instead, we deactivate less promising leaves, which is more energy-efficient than re-evaluating splits. To evaluate for possible splits, $d$ splits will be evaluated, where $d$ is the number of attributes. For each $d$ split, $v$ computations of information gains are required. Finally, each information gain requires $\mathcal{O}(c)$ operations. Thus, split evaluations require $\mathcal{O}(dvc)$ operations, at every leaf, every $nmin$ instances. This is the case for nominal attributes; numerical attributes lead to more operations since the possible spitting candidates for each attribute need to be computed. More in-depth analysis of numerical attributes can be found in the work by~\cite{garcia2018hoeffding}. Updating the statistics require to traverse the tree until the leaf, and update the table with the counts of the observed (attribute value, class) pairs. This requires $\mathcal{O}(dvc)$, same as for HT since only the information at the leaf needs to be updated. This contrasts with the update criteria in EFDT, where the complexity is $\mathcal{O}(hdvc)$ because more leaves are updated during the traverse process. $h$ referring to the height of the tree. Finally, regarding space complexity, the complexity will vary depending on the input dataset and the amount of nominal and numerical attributes. For nominal attributes, a table of size $\mathcal{O}(dvc)$ is required. Where $d$ refers to the number of attributes, $v$ the values per attribute, and $c$ the number of classes. For numerical attributes, it will depend on the method to store the statistics of each attribute. Empirical results of space complexity in the form of the size of the tree are described in Section~\ref{sec:res_size}. \section{Experimental Design} \label{sec:exp_design} \subsection{Datasets} The algorithms have been tested on a total of 11 datasets, six synthetically generated and five real world datasets, described in Table~\ref{tab:datasets}. The synthetic datasets are generated with MOA~\cite{bifet2010moa}, with the default settings. The CICIDS dataset is a cybersecurity dataset from 2017 where the task is to detect intrusions~\cite{sharafaldin2018toward}. The details of the rest of the real world datasets can be found at \url{https://moa.cms.waikato.ac.nz/datasets/}. The details of the synthetic datasets can be found at the MOA official book~\cite{MOA-Book-2018} and in papers such as~\cite{bifet2017extremely}. We omit these details due to space constraints. \begin{table}[!ht] \renewcommand{\arraystretch}{1.5} \setlength{\tabcolsep}{4.5pt} \centering \scriptsize \caption{ Synthetic and real world datasets. $A_{i}$ and $A_{f}$ are the number of nominal and numerical attributes, respectively. Abbrv. is the abbreviation used for Table~\ref{tab:results}} \label{tab:datasets} \begin{tabular}{l r l r r r } \toprule Dataset & Instances & Abbrv. & $A_{i}$& $A_{f}$ & Classes \\ \midrule \textbf{Synthetic} & & & & & \\ \vspace{0.2em} RandomTree & 1,000,000 & RTRee & 5 & 5 & 2 \\ Waveform & 1,000,000 & Wave & 0 & 21 & 3 \\ RandomRBF & 1,000,000 & RBF & 0 & 10 & 2 \\ LED & 1,000,000 & LED & 24 & 0 & 10\\ Hyperplane & 1,000,000 & Hyper & 0 & 10 & 2 \\ Agrawal & 1,000,000 & Agrawal & 3 & 6 & 2 \\ \midrule \vspace{0.2em} \textbf{Real World} & & & & & \\ Airline & 539,383 & Airline & 4 & 3 & 2 \\ Poker & 829,201 & Poker & 5 & 5 & 10 \\ CICIDS & 461,802 & CICIDS & 78 & 5 & 6 \\ Forest & 581,012 & Forest & 40 & 10 & 7 \\ Electricity & 45,312 & Elec & 1 & 6 & 2 \\ \bottomrule \multicolumn{5}{l}{} \end{tabular} \end{table} \subsection{Baselines} The goal of the experiment is to show the comparison between GAHT to the standard Hoeffding Tree algorithm; to the latest and most accurate (in regards to single online decision trees) extension of the Hoeffding Tree, i.e. EFDT; and to online decision tree ensembles. The reasoning behind comparing against an ensemble of decision trees is because we wanted to evaluate if we are able to achieve as high accuracy as for an ensemble of online decision trees, but with a single online tree, which will result in significant energy savings. The ensembles of Hoeffding trees that are evaluated are OzaBag~\cite{oza2005online} (Online Bagging) and OzaBoost~\cite{oza2005online} (Online Boosting), to have a fair comparison with algorithms that are not designed specifically for concept drift, such as HT, GAHT, and EFDT. \subsection{Environment--Setup} All algorithms are run in MOA. For the EFDT, we have used the implementation in MOA provided by the original authors\footnote{\url{https://github.com/chaitanya-m/kdd2018}}. Our algorithm, GAHT, has been coded and tested in MOA (Section~\ref{sec:repr}). We set \texttt{deactivateThreshold=0.01} and \texttt{growFastThreshold=2} for GAHT, after having tested different parameter setups. Thus, we deactivate all leaves that have been observed less than 1 percent of the expected observations; splitting faster on the leaves that observed at least twice as many instances as the expected amount. The accuracy was evaluated using a \textit{test-then-train} approach, where each instance is first used for testing and then for training. The performance is calculated every 100k instances for all datasets, except every 4k for the \textit{Electricity} dataset. \subsection{Metrics} The following metrics are evaluated: accuracy, total energy consumption, and size of the tree. The accuracy is measured as the percentage of correctly classified instances. The total energy is measured in joules, as the energy consumed by the processor plus the energy consumed by the DRAM while executing the algorithm. The energy is measured using Intel's RAPL interface~\cite{david2010rapl} which is integrated into Intel Power Gadget\footnote{\url{https://software.intel.com/en-us/articles/intel-power-gadget-20}}, a tool developed by Intel that outputs power and energy real-time measurements. This interface accesses specific hardware counters available in the processor, which saves energy-related measurements of the processor and the DRAM. Since Intel Power Gadget does not isolate the energy consumption of a specific program, we have ensured that only our MOA experiments were running on the machine at the time of the measurements. All experiments were run five times and averaged the results. All the experiments are run on a machine with a 3.5 GHz Intel Core i7, with 16GB of RAM, running macOS. \subsection{Reproducibility} \label{sec:repr} Aiming for reproducibility, the code of GAHT (as a part of MOA) is available in the following link: \url{https://www.dropbox.com/sh/a5rozyjvbizsctu/AAC1pISlO3aD7F9HoRyKCK4ba?dl=0}. It will be publicly available in GitHub once the paper has been reviewed, but we only share the Dropbox link in this manuscript to comply with the double-blind review policy. \section{Empirical Evaluation} \label{sec:emp_eval} Table~\ref{tab:results} shows the accuracy, energy consumption, and size of the tree results of running GAHT, EFDT, HT, OzaBag, and OzaBoost on the 11 different datasets. The average results comparing GAHT against the other algorithms in terms of energy consumption and accuracy are presented in Table~\ref{tab:delta}. We detail the results about each specific metric on the following sections (Sections~\ref{sec:res_acc},\ref{sec:res_energy}, and~\ref{sec:res_size}). \begin{table}[htb] \centering \renewcommand*{\arraystretch}{1.5} \setlength{\tabcolsep}{1.6pt} \scriptsize \caption{Difference in accuracy ($\Delta$A) and energy consumption ($\Delta$E). The difference is measured as the percentage reduction between the algorithms. A positive value in accuracy means that GAHT (our proposed solution) achieves higher accuracy than the compared algorithm. A negative value in energy means that GAHT was able to reduce the energy consumption by that percent.} \label{tab:delta} \input{tables/results_delta.tex} \end{table} \begin{table*}[bth] \centering \renewcommand*{\arraystretch}{1.5} \setlength{\tabcolsep}{1.6pt} \footnotesize \caption{Accuracy, energy consumption and tree size results between the GAHT, EFDT, HT, OzaBag(OBag), and OzaBoost(OBoost). Number of inactive leaves (In.Leaves) and number of fast nodes (F.Nodes) are presented for GAHT. Fast nodes are GAHT nodes with the EFDT splitting criteria } \label{tab:results} \input{tables/results_tex.tex} \end{table*} \subsection{Accuracy} \label{sec:res_acc} \begin{figure*}[htb] \centering \vspace*{0.5cm} \includegraphics[width=0.89\textwidth]{figures/acc_barplot.pdf} \caption{Accuracy comparison between GAHT, EFDT, HT, OzaBag, and OzaBoost, measured as the percentage of correctly classified instances} \label{fig:acc_barplot} \end{figure*} Figure~\ref{fig:acc_barplot} shows a comparison between the accuracy consumed by the different algorithms on the different datasets. We can observe how GAHT outputs higher accuracy than HT, EFDT, and OzaBag on the majority of datasets. On average, GAHT achieves 0.16\% more accuracy than EFDT, 0.38\% more than OzaBag, 2\% more than HT, and 1.16\% less than OzaBoost (Table~\ref{tab:delta}). Table~\ref{tab:acc_energy_rank} ranks the algorithms based on their accuracy and energy consumption. We observe that GAHT obtains an average rank of 2.91, compared to 2.27 from OzaBoost, the one with the highest score. The other algorithms have either lower rank (EFDT and HT) or the same rank (OzaBag). A Friedman test \cite{friedman1940comparison} does not indicate any significant differences in accuracy between the algorithms ($\alpha=0.05$), suggesting that GAHT achieves an average accuracy comparable to that of each of the other algorithms tested. \subsection{Energy Consumption} \label{sec:res_energy} The comparison of energy consumption between the different algorithms is shown in Figure~\ref{fig:energy}. We can observe how GAHT is consuming less energy than all algorithms except for HT, matching with the theoretical assumptions from Section~\ref{sec:energy_complexity}, where we stated that the energy consumption of GAHT is upper bounded by the energy consumption of HT and EFDT. From Table~\ref{tab:delta} we observe that, on average, GHAT consumes 67\% less energy than OzaBag, 27\% less energy than EFDT, and 71\% less energy than OzaBoost, while still attaining comparable or better accuracy on average. \begin{figure*}[htb] \centering \vspace*{0.5cm} \includegraphics[width=0.90\textwidth]{figures/energy.pdf} \caption{Energy consumption increase with the number of instances. The figure shows how single online decision trees (GAHT, HT, EFDT) are able to scale better than ensembles of trees (OzaBag and OzaBoost) when increasing the number of instances} \label{fig:energy} \end{figure*} Figure~\ref{fig:energy} shows how well the algorithms scale with the number of instances. While the single decision trees (GAHT, HT, EFDT) are able to scale well with the number of instances, the ensemble models (OzaBag, OzaBoost) produce a significantly steeper curve. The energy rankings (Table~\ref{tab:acc_energy_rank}) are more uniform compared to the accuracy rankings. We can see, e.g., that GAHT is always ranking second (except for one dataset). A Friedman test \cite{friedman1940comparison} followed by a Bonferroni-Dunn post-hoc test \cite{dunn1958estimation,dunn1961multiple} indicates significant differences ($\alpha=0.05$) between all pairs of algorithms with respect to energy consumption, except for GAHT vs. HT. That is, GAHT consumes significantly less energy than all other tested algorithms except for HT---the algorithm with the worst average rank with respect to accuracy. OzaBoost is consistently ranked last, consuming significantly more energy than all other tested algorithms, showcasing the dilemma of how to choose the most appropriate solution. The ideal scenario is to choose an algorithm that has a lower energy rank and a lower accuracy rank. This relationship between accuracy and energy is portrayed in Figure~\ref{fig:scatter_rank}. While HT is ranked first in energy consumption, it is also ranked last in terms of accuracy. The opposite occurs for OzaBoost, which is ranked first in accuracy and last in energy consumption. GAHT, on the other hand, is second in accuracy and second in energy consumption, which seems the most balanced option of all. \subsection{Memory Footprint} \label{sec:res_size} GAHT is able to create smaller trees than the other algorithms (except for HT) in the majority of datasets. There are some datasets (e.g. poker dataset) where GAHT is creating a higher number of trees, due to the characteristics of the data. However, even though GAHT is outputting bigger trees for this particular dataset, it is still able to achieve between 65\% and 70\% less energy than the ensemble algorithms. The reason is that not as many trees need to be traversed, and fewer memory accesses need to be carried out. These models were still in the range from 1MB to 30MB, so fairly small compared to deep learning algorithms, which can take more than 1GB of space~\cite{devlin2018bert}. \begin{table}[htb] \centering \renewcommand*{\arraystretch}{1.5} \setlength{\tabcolsep}{1.6pt} \scriptsize \caption{Algorithm ranking between energy consumption and accuracy. The rank is measured as the algorithm that scored the highest accuracy or the lowest energy. The lower the better.} \label{tab:acc_energy_rank} \input{tables/acc_energy_rank.tex} \end{table} \begin{figure}[htb] \centering \includegraphics[width=0.35\textwidth]{figures/acc_energy_rank.pdf} \caption{Relationship between the energy ranks ($y$ axis) and accuracy ranks($x$ axis). A low rank in energy and a low rank in accuracy is ideal, which would mean that the lowest energy consuming algorithm is also the most accurate} \label{fig:scatter_rank} \end{figure} \section{Conclusions} \label{sec:conclusions} This paper introduces the Green Accelerated Hoeffding Tree algorithm (GAHT), an approach to induce energy-efficient Hoeffding trees while achieving comparable or better accuracy than EFDT, OzaBag, and OzaBoost. GAHT sets an individual splitting criteria for every leaf, depending on the distribution of the number of instances observed at that leaf. This allows for GAHT to spend more energy on the most visited nodes while saving energy on other nodes by deactivating them. We have evaluated the performance in terms of energy consumption and accuracy between GAHT, EFDT, HT, OzaBag, and OzaBoost on 11 datasets. The results show that GAHT consumes significantly less energy than EFDT (27\% on average), OzaBag (67\% on average), and OzaBoost (72\% on average) while still attaining comparable or better accuracy on average. GAHT consumes more energy than HT---the algorithm with the worst average rank with respect to accuracy. In terms of the memory footprint, GAHT outputs smaller models than EFDT, OzaBag, and OzaBoost for the majority of datasets. Even bigger GAHT trees would output lower energy consumption than a smaller ensemble of HT trees. Our models take between 1MB to 30MB of space, which is a fairly small amount compared to many deep learning solutions. The results of this paper show that it is possible to create more energy-efficient data stream mining algorithms while maintaining accuracy levels of ensembles of Hoeffding trees. This contributes to moving stream mining algorithms to the edge, by smartly using the energy only on the necessary parts of the algorithm. \bibliographystyle{ACM-Reference-Format} \section{Introduction} ACM's consolidated article template, introduced in 2017, provides a consistent \LaTeX\ style for use across ACM publications, and incorporates accessibility and metadata-extraction functionality necessary for future Digital Library endeavors. Numerous ACM and SIG-specific \LaTeX\ templates have been examined, and their unique features incorporated into this single new template. If you are new to publishing with ACM, this document is a valuable guide to the process of preparing your work for publication. If you have published with ACM before, this document provides insight and instruction into more recent changes to the article template. The ``\verb|acmart|'' document class can be used to prepare articles for any ACM publication --- conference or journal, and for any stage of publication, from review to final ``camera-ready'' copy, to the author's own version, with {\itshape very} few changes to the source. \section{Template Overview} As noted in the introduction, the ``\verb|acmart|'' document class can be used to prepare many different kinds of documentation --- a double-blind initial submission of a full-length technical paper, a two-page SIGGRAPH Emerging Technologies abstract, a ``camera-ready'' journal article, a SIGCHI Extended Abstract, and more --- all by selecting the appropriate {\itshape template style} and {\itshape template parameters}. This document will explain the major features of the document class. For further information, the {\itshape \LaTeX\ User's Guide} is available from \url{https://www.acm.org/publications/proceedings-template}. \subsection{Template Styles} The primary parameter given to the ``\verb|acmart|'' document class is the {\itshape template style} which corresponds to the kind of publication or SIG publishing the work. This parameter is enclosed in square brackets and is a part of the {\verb|documentclass|} command: \begin{verbatim} \documentclass[STYLE]{acmart} \end{verbatim} Journals use one of three template styles. All but three ACM journals use the {\verb|acmsmall|} template style: \begin{itemize} \item {\verb|acmsmall|}: The default journal template style. \item {\verb|acmlarge|}: Used by JOCCH and TAP. \item {\verb|acmtog|}: Used by TOG. \end{itemize} The majority of conference proceedings documentation will use the {\verb|acmconf|} template style. \begin{itemize} \item {\verb|acmconf|}: The default proceedings template style. \item{\verb|sigchi|}: Used for SIGCHI conference articles. \item{\verb|sigchi-a|}: Used for SIGCHI ``Extended Abstract'' articles. \item{\verb|sigplan|}: Used for SIGPLAN conference articles. \end{itemize} \subsection{Template Parameters} In addition to specifying the {\itshape template style} to be used in formatting your work, there are a number of {\itshape template parameters} which modify some part of the applied template style. A complete list of these parameters can be found in the {\itshape \LaTeX\ User's Guide.} Frequently-used parameters, or combinations of parameters, include: \begin{itemize} \item {\verb|anonymous,review|}: Suitable for a ``double-blind'' conference submission. Anonymizes the work and includes line numbers. Use with the \verb|\acmSubmissionID| command to print the submission's unique ID on each page of the work. \item{\verb|authorversion|}: Produces a version of the work suitable for posting by the author. \item{\verb|screen|}: Produces colored hyperlinks. \end{itemize} This document uses the following string as the first command in the source file: \begin{verbatim} \documentclass[sigconf]{acmart} \end{verbatim} \section{Modifications} Modifying the template --- including but not limited to: adjusting margins, typeface sizes, line spacing, paragraph and list definitions, and the use of the \verb|\vspace| command to manually adjust the vertical spacing between elements of your work --- is not allowed. {\bfseries Your document will be returned to you for revision if modifications are discovered.} \section{Typefaces} The ``\verb|acmart|'' document class requires the use of the ``Libertine'' typeface family. Your \TeX\ installation should include this set of packages. Please do not substitute other typefaces. The ``\verb|lmodern|'' and ``\verb|ltimes|'' packages should not be used, as they will override the built-in typeface families. \section{Title Information} The title of your work should use capital letters appropriately - \url{https://capitalizemytitle.com/} has useful rules for capitalization. Use the {\verb|title|} command to define the title of your work. If your work has a subtitle, define it with the {\verb|subtitle|} command. Do not insert line breaks in your title. If your title is lengthy, you must define a short version to be used in the page headers, to prevent overlapping text. The \verb|title| command has a ``short title'' parameter: \begin{verbatim} \title[short title]{full title} \end{verbatim} \section{Authors and Affiliations} Each author must be defined separately for accurate metadata identification. Multiple authors may share one affiliation. Authors' names should not be abbreviated; use full first names wherever possible. Include authors' e-mail addresses whenever possible. Grouping authors' names or e-mail addresses, or providing an ``e-mail alias,'' as shown below, is not acceptable: \begin{verbatim} \author{Brooke Aster, David Mehldau} \email{dave,judy,<EMAIL>} \email{<EMAIL>} \end{verbatim} The \verb|authornote| and \verb|authornotemark| commands allow a note to apply to multiple authors --- for example, if the first two authors of an article contributed equally to the work. If your author list is lengthy, you must define a shortened version of the list of authors to be used in the page headers, to prevent overlapping text. The following command should be placed just after the last \verb|\author{}| definition: \begin{verbatim} \renewcommand{\shortauthors}{McCartney, et al.} \end{verbatim} Omitting this command will force the use of a concatenated list of all of the authors' names, which may result in overlapping text in the page headers. The article template's documentation, available at \url{https://www.acm.org/publications/proceedings-template}, has a complete explanation of these commands and tips for their effective use. Note that authors' addresses are mandatory for journal articles. \section{Rights Information} Authors of any work published by ACM will need to complete a rights form. Depending on the kind of work, and the rights management choice made by the author, this may be copyright transfer, permission, license, or an OA (open access) agreement. Regardless of the rights management choice, the author will receive a copy of the completed rights form once it has been submitted. This form contains \LaTeX\ commands that must be copied into the source document. When the document source is compiled, these commands and their parameters add formatted text to several areas of the final document: \begin{itemize} \item the ``ACM Reference Format'' text on the first page. \item the ``rights management'' text on the first page. \item the conference information in the page header(s). \end{itemize} Rights information is unique to the work; if you are preparing several works for an event, make sure to use the correct set of commands with each of the works. The ACM Reference Format text is required for all articles over one page in length, and is optional for one-page articles (abstracts). \section{CCS Concepts and User-Defined Keywords} Two elements of the ``acmart'' document class provide powerful taxonomic tools for you to help readers find your work in an online search. The ACM Computing Classification System --- \url{https://www.acm.org/publications/class-2012} --- is a set of classifiers and concepts that describe the computing discipline. Authors can select entries from this classification system, via \url{https://dl.acm.org/ccs/ccs.cfm}, and generate the commands to be included in the \LaTeX\ source. User-defined keywords are a comma-separated list of words and phrases of the authors' choosing, providing a more flexible way of describing the research being presented. CCS concepts and user-defined keywords are required for for all articles over two pages in length, and are optional for one- and two-page articles (or abstracts). \section{Sectioning Commands} Your work should use standard \LaTeX\ sectioning commands: \verb|section|, \verb|subsection|, \verb|subsubsection|, and \verb|paragraph|. They should be numbered; do not remove the numbering from the commands. Simulating a sectioning command by setting the first word or words of a paragraph in boldface or italicized text is {\bfseries not allowed.} \section{Tables} The ``\verb|acmart|'' document class includes the ``\verb|booktabs|'' package --- \url{https://ctan.org/pkg/booktabs} --- for preparing high-quality tables. Table captions are placed {\itshape above} the table. Because tables cannot be split across pages, the best placement for them is typically the top of the page nearest their initial cite. To ensure this proper ``floating'' placement of tables, use the environment \textbf{table} to enclose the table's contents and the table caption. The contents of the table itself must go in the \textbf{tabular} environment, to be aligned properly in rows and columns, with the desired horizontal and vertical rules. Again, detailed instructions on \textbf{tabular} material are found in the \textit{\LaTeX\ User's Guide}. Immediately following this sentence is the point at which Table~\ref{tab:freq} is included in the input file; compare the placement of the table here with the table in the printed output of this document. \begin{table} \caption{Frequency of Special Characters} \label{tab:freq} \begin{tabular}{ccl} \toprule Non-English or Math&Frequency&Comments\\ \midrule \O & 1 in 1,000& For Swedish names\\ $\pi$ & 1 in 5& Common in math\\ \$ & 4 in 5 & Used in business\\ $\Psi^2_1$ & 1 in 40,000& Unexplained usage\\ \bottomrule \end{tabular} \end{table} To set a wider table, which takes up the whole width of the page's live area, use the environment \textbf{table*} to enclose the table's contents and the table caption. As with a single-column table, this wide table will ``float'' to a location deemed more desirable. Immediately following this sentence is the point at which Table~\ref{tab:commands} is included in the input file; again, it is instructive to compare the placement of the table here with the table in the printed output of this document. \begin{table*} \caption{Some Typical Commands} \label{tab:commands} \begin{tabular}{ccl} \toprule Command &A Number & Comments\\ \midrule \texttt{{\char'134}author} & 100& Author \\ \texttt{{\char'134}table}& 300 & For tables\\ \texttt{{\char'134}table*}& 400& For wider tables\\ \bottomrule \end{tabular} \end{table*} Always use midrule to separate table header rows from data rows, and use it only for this purpose. This enables assistive technologies to recognise table headers and support their users in navigating tables more easily. \section{Math Equations} You may want to display math equations in three distinct styles: inline, numbered or non-numbered display. Each of the three are discussed in the next sections. \subsection{Inline (In-text) Equations} A formula that appears in the running text is called an inline or in-text formula. It is produced by the \textbf{math} environment, which can be invoked with the usual \texttt{{\char'134}begin\,\ldots{\char'134}end} construction or with the short form \texttt{\$\,\ldots\$}. You can use any of the symbols and structures, from $\alpha$ to $\omega$, available in \LaTeX~\cite{Lamport:LaTeX}; this section will simply show a few examples of in-text equations in context. Notice how this equation: \begin{math} \lim_{n\rightarrow \infty}x=0 \end{math}, set here in in-line math style, looks slightly different when set in display style. (See next section). \subsection{Display Equations} A numbered display equation---one set off by vertical space from the text and centered horizontally---is produced by the \textbf{equation} environment. An unnumbered display equation is produced by the \textbf{displaymath} environment. Again, in either environment, you can use any of the symbols and structures available in \LaTeX\@; this section will just give a couple of examples of display equations in context. First, consider the equation, shown as an inline equation above: \begin{equation} \lim_{n\rightarrow \infty}x=0 \end{equation} Notice how it is formatted somewhat differently in the \textbf{displaymath} environment. Now, we'll enter an unnumbered equation: \begin{displaymath} \sum_{i=0}^{\infty} x + 1 \end{displaymath} and follow it with another numbered equation: \begin{equation} \sum_{i=0}^{\infty}x_i=\int_{0}^{\pi+2} f \end{equation} just to demonstrate \LaTeX's able handling of numbering. \section{Figures} The ``\verb|figure|'' environment should be used for figures. One or more images can be placed within a figure. If your figure contains third-party material, you must clearly identify it as such, as shown in the example below. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{sample-franklin} \caption{1907 Franklin Model D roadster. Photograph by Harris \& Ewing, Inc. [Public domain], via Wikimedia Commons. (\url{https://goo.gl/VLCRBB}).} \Description{A woman and a girl in white dresses sit in an open car.} \end{figure} Your figures should contain a caption which describes the figure to the reader. Figure captions are placed {\itshape below} the figure. Every figure should also have a figure description unless it is purely decorative. These descriptions convey what’s in the image to someone who cannot see it. They are also used by search engine crawlers for indexing images, and when images cannot be loaded. A figure description must be unformatted plain text less than 2000 characters long (including spaces). {\bfseries Figure descriptions should not repeat the figure caption – their purpose is to capture important information that is not already provided in the caption or the main text of the paper.} For figures that convey important and complex new information, a short text description may not be adequate. More complex alternative descriptions can be placed in an appendix and referenced in a short figure description. For example, provide a data table capturing the information in a bar chart, or a structured list representing a graph. For additional information regarding how best to write figure descriptions and why doing this is so important, please see \url{https://www.acm.org/publications/taps/describing-figures/}. \subsection{The ``Teaser Figure''} A ``teaser figure'' is an image, or set of images in one figure, that are placed after all author and affiliation information, and before the body of the article, spanning the page. If you wish to have such a figure in your article, place the command immediately before the \verb|\maketitle| command: \begin{verbatim} \begin{teaserfigure} \includegraphics[width=\textwidth]{sampleteaser} \caption{figure caption} \Description{figure description} \end{teaserfigure} \end{verbatim} \section{Citations and Bibliographies} The use of \BibTeX\ for the preparation and formatting of one's references is strongly recommended. Authors' names should be complete --- use full first names (``Donald E. Knuth'') not initials (``D. E. Knuth'') --- and the salient identifying features of a reference should be included: title, year, volume, number, pages, article DOI, etc. The bibliography is included in your source document with these two commands, placed just before the \verb|\end{document}| command: \begin{verbatim} \bibliographystyle{ACM-Reference-Format}
\section{Introduction} Online communities are partially shaped by the design affordances of the platforms they inhabit~\cite{bucher2018affordances}. In Facebook Groups, administrators can turn on ``post approvals,'' a setting that requires members' posts to be accepted by community leaders (i.e., administrators and moderators) before others in the group can see and interact with them~\cite{pa22}. This setting changes \emph{when} norms are enforced in a community or group, as illustrated in Figure~\ref{fig:dic}. If the setting is turned off, community leaders must reactively moderate the posts in the community, e.g., by browsing posts in the group as they appear or by responding to reports from other members or the platform. If the setting is turned on, leaders can proactively moderate the community, prescreening posts that are low quality or that break the rules. \begin{figure} \centering \includegraphics[width=\linewidth]{imgs/diagram2.pdf} \caption{Post approvals allow posts that violate a community's guidelines (in red) to be filtered \emph{before} other members in the community see them. Without post approvals, these posts can only be moderated \emph{after} they are posted in the group. } \vspace{2mm} \label{fig:dic} \end{figure} Well-moderated spaces are more attractive to users~\cite{wise2006moderation} and can improve the quality of users' contributions~\cite{cosley2005oversight}. However, over-enforcement of rules can discourage participation~\cite{jhaver2019does, kiene2016surviving}, and moderation creates more work for leaders~\cite{lo2018all, dosono2019moderation}. Thus, post approvals, a proactive moderation strategy, involves several trade-offs. On the one hand, it may prevent harm caused by violations of a community's guidelines and improve members' overall experience. On the other hand, it introduces participation friction and may increase leaders' workloads. \xhdr{Present work} This paper presents an observational study of the adoption and the impact of post approvals in online communities. We ask: \begin{itemize} \item \textbf{RQ1} What leads communities to adopt post approvals? \item \textbf{RQ2} How do post approvals shape user activity and moderation in online communities? \item \textbf{RQ3} Does the impact of post approvals depend on community properties and on how the setting is used? \end{itemize} Using a longitudinal dataset of user activity\hyp{} and moderation\hyp{}related traces from 233,402 Facebook Groups from March to July 2021, we compared communities that enabled post approvals (PA-ON; $n=8{,}767$) to communities that did not change any moderation-related settings (PA-OFF; $n=224{,}635$). To examine the factors that led to the adoption of post approvals \textbf{(RQ1)}, we studied activity in PA-ON and PA-OFF communities in the 4 weeks before the former enabled the setting. During this period, PA-ON communities experienced greater growth in user activity (\abbrevStyle{e.g.}\xspace, \emph{Comments}) and moderation (\abbrevStyle{e.g.}\xspace, \emph{Posts reported}) compared to PA-OFF communities. Further, right before PA-ON communities enabled post approvals, they experienced a sudden increase in moderation, which may have been the final straw that led administrators to turn on the setting. These findings continue to hold when using propensity score matching to control for initial baseline user and moderation activity, and are further confirmed when examining how user activity or moderation predicts if post approvals will be turned on in future weeks. To study how post approvals shape online communities \textbf{(RQ2)}, we matched PA-ON and PA-OFF communities on user activity and moderation traces in the 4 weeks prior to post approvals being turned on and compared differences in their subsequent activity. We found that, while fewer posts were shared in groups that enabled post approvals, the posts that were shared received more comments, more reactions, more time spent, and fewer reports, suggesting improvements in the quality of content being posted. Further, post approvals did not significantly increase the average time leaders spent in their groups, though groups that enabled the setting tended to increase their moderation team. Last, post approvals may differently impact a community depending on its properties and on how post approvals are used in practice \textbf{(RQ3)}. To understand these differences, we studied how the effects of post approvals varied with group size (\abbrevStyle{i.e.}\xspace, how many members there were in a group), leaders' response time for submitted posts (\abbrevStyle{i.e.}\xspace, how much time did it take for a post to be approved) and the post approval rate (\abbrevStyle{i.e.}\xspace, what fraction of posts submitted in a given group were approved). For all three factors, we found significant interactions with time spent by leaders in the group and with changes in activity in the group following the adoption of the setting. Leaders spent significantly more time after adopting post approvals in larger groups, groups with higher post approval rates, and groups with faster response times. There were sharper decreases in the number of posts and increases in the number of comments, reactions, and time spent per post in larger groups, groups with lower post approval rates, and groups with slower response times. Still, other changes persisted across different communities. Independent of group size, response time, or approval rate, the fraction of posts reported decreased significantly after post approvals was adopted. This suggests that regardless of how post approvals was enforced, the setting nonetheless reduced content perceived by members as problematic or rule-breaking. Overall, our findings suggest that post approvals substantially change how online communities work and that the setting creates communities centered around fewer, higher-quality posts. These insights may guide improvements to community-level moderation processes and the quasi-experimental approach we adopted can be easily extended to analyze other opt-in features provided by social media platforms. \section{Related Work} Moderation in online communities increases their attractiveness to newcomers~\cite{wise2006moderation}, improves the quality of contributions~\cite{cosley2005oversight}, and decreases anti-social behavior~\cite{seering2017shaping}. Nonetheless, effective moderation is difficult -- platforms experience several challenges related to the scale, the legitimacy, and the contextual nature of content moderation~\cite{gillespie2018custodians, filgueiras2021digital}. Beyond work to better predict when content may violate community guidelines~\cite{schmidt2019survey, papadamou2020disturbed}, community-oriented social media (and moderation) has been suggested as part of the solution to these challenges because community leaders may better incorporate local and cultural context into moderation decisions~\cite{seering2020reconsidering} and because the decisions taken would be considered more legitimate~\cite{filgueiras2021digital}. To this end, some research has examined how moderators engage and regulate their communities~\cite{seering2019moderator} by developing specific design guidance from fundamental theories in the social sciences~\cite{kraut2012building}. Most relevant to the present work are existing studies that explored how technological affordances provided by platforms shape content moderation. For example, participation controls~\cite{kraut2012building} limit what specific users are allowed to see or do within a social media platform or a specific online community. In the development of open-source software, collaborators receive ``commit rights'' as they offer evidence of their technical expertise~\cite{ducheneaut2005socialization}; on PalTalk (an early video group chat service), moderators could impose ``activity quotas'' to chat room users, limiting their participation~\cite{kraut2012building}; on Twitch, moderation includes chat ``modes'' that change how users can participate, for instance allowing only emotes to be sent~\cite{seering2017shaping}; on Reddit, \citet{jhaver2019human} studied the usage of \textit{AutoModerator}, a system that allows moderators to define ``rules'' to be automatically applied to posts in their communities. This work examines post approvals, a participation control that is central to community-level moderation in Facebook Groups but whose specific effects have not yet been systematically studied. Post approvals change the dynamics of content moderation by allowing community leaders to \textit{proactively} moderate posts before they ever land in the communities' feeds. Moreover, when someone attempts to contribute to a community with post approvals turned on, posts may take hours or even days to get published (if they do). Communities could thrive in the better-moderated spaces enabled by post approvals~\cite{wise2006moderation} and the participation friction could disrupt mindless interactions~\cite{mejtoft2019design}. However, the setting could also discourage participation~\cite{kiene2016surviving} and create unnecessary work for leaders~\cite{lo2018all,dosono2019moderation}. Studying the impact of post approvals (and other participation controls) in online communities can help create better governance practices and further our understanding of how participation friction and proactive moderation can improve online spaces. \section{Data} \label{sec:data} Between March 28, 2021, and July 11, 2021, we collected data on 1)~communities that turned on post approvals and did not change other moderation-related settings (PA-ON; $n=8{,}767$); and 2)~a random sample (50\%) of communities that did not change \emph{any} moderation-related setting (PA-OFF; $n=224{,}635$). For PA-ON groups, we considered only communities that enabled post approvals at least 28 days after the start of the study period and at least 28 days before its end. For both PA-ON and PA-OFF groups, we considered only communities with 128 or more members and at least one comment and one post over any 7-day window. We analyzed PA-ON communities relative to when they turned on post approvals, referring to the day when they enabled the setting as day 0. For PA-OFF communities, we randomly assigned a pseudo-intervention date drawn from the distribution of dates (day and hour) when PA-ON groups enabled post approvals (\abbrevStyle{cf.}\xspace \Appref{app:adplots}; \Figref{fig:day_hour}). We considered the set of variables described in \Tabref{tab:cov} in the 28 days before and after each intervention, for a total of 57 days (from $-28$ to 28). Some variables are 1)~time-dependent, capturing group activity and group moderation (\abbrevStyle{e.g.}\xspace, number of posts, number of posts deleted), while others are 2)~time-invariant, capturing group topic, demographics, and moderation settings (\abbrevStyle{e.g.}\xspace, group visibility, group category, if a group was a buy-and-sell group, \abbrevStyle{etc.}\xspace). All data was de-identified and analyzed in aggregate, and no individual-level data was viewed by the researchers. In the analyses that follow, variables were 95\%-winsorized (\abbrevStyle{i.e.}\xspace, the 2.5\% smallest and largest values were replaced with the most extreme remaining values~\cite{wilcox2011introduction}) prior to aggregation unless otherwise stated. This ensured that trends/effects were not dominated by a few large groups. Nonetheless, results were qualitatively similar without winsorization. \section{What Leads to the Adoption of Post Approvals?} \label{sec:rq1} This section examines \textit{why} communities adopt post approvals to begin with (\textbf{RQ1}). We focus on what happens \textit{before} the setting was enabled, contrasting PA-ON and PA-OFF groups. All analyses in this section were done at the group level, with each group weighted equally. \begin{table}[H] \centering \footnotesize \begin{tabular}{p{2cm}p{5.5cm}} \toprule \multicolumn{2}{c}{\textbf{Group characteristics} (not time-dependent) }\\ \midrule \textbf{Visibility$^\star$} & Whether group is private or public.\\ \midrule \textbf{Join approvals$^\star$} & Whether leaders have to manually approve new members. \\ \midrule \textbf{Average age$^\star$} & Average age of the members in the group. \\ \midrule \textbf{\% women$^\star$} & The percentage of women in the group. \\ \midrule \textbf{Buy-\&-Sell$^\star$} & Whether the group is a buy and sell group or not (specified by admin). \\ \midrule \textbf{Group categories$^\star$} & Lexical categories obtained from the groups' description and title using Empath~\cite{fast2016empath}. See \Appref{app:topics} for details. \\ \midrule \multicolumn{2}{c}{\textbf{Moderation-related}} \\ \midrule \textbf{Moderating TS} & Average time leaders spent in moderation-related interfaces (e.g., approving posts).\\ \midrule \textbf{Leader TS} & Average time leaders spent in the group.\\ \midrule \textbf{Members Removed} & Number of members removed. \\ \midrule \textbf{Posts deleted} & Number of posts by regular members deleted by leaders. \\ \midrule \textbf{Posts reported} & Number of posts reported in the community by users. \\ \midrule \textbf{Num leaders} & Number of leaders in the community. \\ \midrule \multicolumn{2}{c}{\textbf{Activity-related}} \\ \midrule \textbf{Posts} & Number of posts. \\ \midrule \textbf{Comments} & Number of comments. \\ \midrule \textbf{Time spent} & Total time users spent browsing posts in the group (in hours). \\ \midrule \textbf{Reactions} & Number of Likes and of other reactions (Sad, Happy, Wow, Laugh, Angry). \\ \midrule \textbf{Num members} & Number of members in the community. \\ \bottomrule \end{tabular} \caption{Description of the group-level variables considered in this paper. Variables marked with a star ($\star$) were measured on the day prior to the intervention (for PA-ON groups) or the pseudo-intervention (for PA-OFF groups). They were not analyzed in the result sections of this paper, but were used in the matching to ensure the two sets of communities were comparable (\abbrevStyle{cf.}\xspace, \Appref{app:psm}).} \label{tab:cov} \end{table} \begin{figure*}[t] \centering \begin{minipage}[t]{0.49\linewidth} \subcaption{All} \includegraphics[width=\linewidth]{imgs/pred1_all.pdf} \end{minipage}% \hspace{1mm} \begin{minipage}[t]{0.49\linewidth} \subcaption{Matched} \includegraphics[width=\linewidth]{imgs/pred1_matched.pdf} \end{minipage} \caption{Average values for user activity\hyp{} and moderation\hyp{}related variables in the four weeks before communities enabled post approvals. Values for communities that enabled post approvals (PA-ON) are in red and those for communities that did not (PA-OFF) are in blue. For PA-OFF communities, day 0 corresponds to a pseudo-intervention date selected at random. We show trends for all communities in our dataset in \textit{(a)} (PA-ON $n=8{,}767$; PA-OFF $n=224{,}635$) and for matched pairs of communities in \textit{(b)} (PA-ON/PA-OFF $n=8{,}643$). The period when matching was done is marked in gray. Error bars represent 95\% CIs. } \label{fig:case_control} \end{figure*} \xhdr{Case--control analysis} Our first analysis follows a case--control design~\cite{schlesselman1982case}: we compared user activity and moderation traces of groups that enabled post approvals (PA-ON; the ``case'') with those that did not change any moderation settings (PA-OFF; the ``control''). We considered three variables related to user activity (\emph{Num Members}, \emph{Posts}, and \emph{Comments}) and three variables related to moderation activity (\emph{Posts reported}, \emph{Posts deleted}, \emph{Leader TS}) in the 28 days before the intervention (\abbrevStyle{cf.}\xspace \Tabref{tab:cov} for descriptions). We refer to this scenario as ``all'' since, in what follows, we examine a subset of this data corresponding to matched pairs of PA-ON and PA-OFF groups. \Figref{fig:case_control}a shows the average value of each of the variables mentioned above. We found significant differences between PA-ON and PA-OFF groups that are consistent across the 28-day period considered ($p<10^{-4}$ for independent t-tests conducted each day). PA-ON groups have significantly more reported and deleted posts, more comments, and fewer posts than PA-OFF groups. Leaders also spent more time in PA-ON groups than in PA-OFF groups. Temporal trends also differed significantly between the two sets of groups: PA-ON groups experienced larger increases in all considered variables in the weeks before enabling post approvals. For moderation-related metrics, we observed a sharp spike on the day (or in the case of posts reported, on the day before) post approvals was turned on. These changes were not observed in PA-OFF groups. The shifts in user activity (\abbrevStyle{e.g.}\xspace, \emph{Comments}) and in moderation (\abbrevStyle{e.g.}\xspace, \emph{Posts deleted}) before post approvals was turned on suggests that leaders enable the setting in response to new (and perhaps more chaotic) group dynamics. Specifically, the setting was commonly enabled in groups that were quickly growing and that experienced a surge in moderation-related events, which may have been the final straw that led administrators to enable post approvals. This finding is consistent with prior work suggesting that major changes in moderation (\abbrevStyle{e.g.}\xspace, changing settings, creating new rules) happen in reaction to problems that emerge \cite{seering2019moderator}. \xhdr{Matched analysis} While indicative, the previous analysis conflates two factors. Not only do PA-ON and PA-OFF communities differ in their baseline user and moderation activity, but they also differ in the way the studied variables change over time. Thus, observed differences in temporal trends may come from the fact that groups that adopt post approvals are different from those that do not. To more fairly compare these communities, we matched PA-ON and PA-OFF groups on user activity and moderation-related metrics between days $-28$ and $-22$. This matching ensures that communities were similar in the first week of the study period. Specifically, we performed one-to-one propensity score matching of PA-ON and PA-OFF communities using moderation and activity-related variables, as well as general group characteristics (\abbrevStyle{e.g.}\xspace, \emph{Group categories}). Details of the matching procedure can be found in \Appref{app:psm}. After performing this matching, we repeated the same analysis as in the previous subsection (\Figref{fig:case_control}b). Again, we found that PA-ON groups experienced a gradual increase in moderation-related traces which was accentuated right before post approvals was turned on — changes that were not observed in PA-OFF groups. Differences in user activity were subtler. Both PA-ON and PA-OFF groups experienced growth in the number of members, but this growth was higher for PA-ON groups. Moreover, PA-ON groups experienced a significant increase in the number of daily comments received, while comments received remained largely unchanged in PA-OFF groups. Last, in both PA-ON and PA-OFF groups the number of posts increased slightly during the 28 days considered. Overall, the matched case--control analysis confirms that there are differences in the temporal trends of moderation and user activity of PA-ON and PA-OFF communities. Even when considering communities that were initially similar, PA-ON communities experienced larger increases in user and moderation activity prior to the day when they turned on post approvals. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{imgs/pred2.pdf} \caption{AUCs for classifiers trained to distinguish PA-ON and PA-OFF groups using data from different time spans and different sets of features. Error bars represent 95\% CIs obtained through a 20-fold cross validation. } \label{fig:class} \end{figure} \xhdr{Predicting if post approvals will be turned on in future weeks} While findings thus far indicate that both changes in user activity and in moderation precede the use of post approvals, is one a stronger indicator than the other? And how far in advance might they predict the adoption of the setting? To answer these questions, we examined if user activity or moderation can be used to distinguish PA-ON groups from PA-OFF groups. We created two balanced samples of groups. The first sample (\emph{all}) comprised 10,000 groups — half PA-ON and half PA-OFF. The second (\textit{matched}) comprised the same PA-ON groups as in the \emph{all} sample, while corresponding PA-OFF groups were obtained using one-to-one propensity score matching previously described. We considered two sets of features (group activity-related and moderation-related; \abbrevStyle{cf.}\xspace \Tabref{tab:cov}) and five time spans,% \footnote{ Days -28 to -22 (week -4; W-4), -21 to -15 (week -3; W-3), -14 to -8 (week -2; W-2), -7 to -1 (week -1; W-1), and day 0 (D+0).} calculating the value of each feature in each time span by taking its average. We trained Gradient Boosting classifiers to distinguish PA-ON and PA-OFF groups, varying the feature set and the time span used. \Figref{fig:class} shows the AUC of the classifiers trained in each of the different settings (all \abbrevStyle{vs.}\xspace matched; moderation \abbrevStyle{vs.}\xspace activity) considering the features up to the time specified on the $x$-axis. For instance, the points shown above $x=$ W-3 correspond to the AUC of classifiers trained with features associated with W-4 and W-3. For the \emph{all} sample, we found that moderation features were more predictive in earlier weeks (W-4 to W-2). However, for $x=$ W-1, there was an increase in the AUC of the classifier trained with activity features. We observed a similar pattern in the \emph{matched} sample: classifiers started with similar AUC values at $x=$ W-4 (user activity: 0.53 AUC \abbrevStyle{vs.}\xspace moderation: 0.53 AUC), but the classifiers trained with activity features saw a larger increase in performance at $x=$ W-1 (0.58 for activity \abbrevStyle{vs.}\xspace 0.63 for moderation). Including data up until the time of intervention, $x=$ D+0, the performance of classifiers trained with moderation features increased sharply (\abbrevStyle{e.g.}\xspace, in the \emph{matched} sample: 0.65 activity \abbrevStyle{vs.}\xspace 0.77 moderation). Overall, these results suggest that the adoption of post approvals was associated with gradual changes in user activity in the weeks before the adoption of the setting and sudden changes in moderation activity on the day the setting was enabled. Repeating this analysis but instead training classifiers using features belonging to each individual time span (e.g., using only W-1 vs. using W-4 to W-1 for prediction) resulted in qualitatively similar findings. \section{How do Post Approvals Shape Online Communities?} \label{sec:rq2} Having explored changes in user activity\hyp{} and moderation-related signals that \emph{precede} the adoption of post approvals, we now turn our attention to what happens \emph{after} communities choose to adopt the setting. Here, we examine how user and moderation activity in online communities change following the adoption of the setting (\textbf{RQ2)}. To do so, we matched communities that turned on post approvals (PA-ON) with similar communities that did not (PA-OFF) and validated the observed differences using regression. To obtain this matching, we performed one-to-one propensity score matching on moderation and activity\hyp{}related variables as well as general group characteristics. Matching was done across the entire pre-intervention period (day $-28$ up to day 0 right before the intervention). See Appendix A for details. All analyses in this section were done at the group-level, with each group weighted equally. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{imgs/posts1.pdf} \caption{The average number of posts in PA-ON (solid red) and PA-OFF (dashed blue) communities. For PA-ON communities, the average number of post attempts after post approvals was enabled is shown in dotted red. Error bars represent bootstrapped 95\% CIs. } \label{fig:posts1} \end{figure} \xhdr{Posts} First, we examined how posting behavior changed after the adoption of post approvals. In \Figref{fig:posts1}, we show both the number of posts that were actually published (\emph{Posts}), but also, for PA-ON communities, the number of post attempts, i.e., post requests initiated by regular group members following the adoption of post approvals. For PA-ON communities, we found a significant decrease in the number of posts following the adoption of post approvals. The average number of posts went from roughly 80 posts a day pre\hyp{}intervention to around 30 posts a day post\hyp{}intervention, a decrease that was not observed in the matched set of PA-OFF communities. What explains this decrease in posting? Was it because posts were being filtered? Or were people more hesitant to even post? To understand the relative contribution of these factors, we examined two corresponding quantities that make up the decrease in posting: 1)~the difference between the number of posts in the control (PA-OFF) and treatment setting (PA-ON) (blue line vs. dotted red line); and 2) the difference between the number of post attempts and actual posts in PA-ON communities (dotted red line vs. solid red line). We observed a gradual decrease in the average number of posts submitted (the first component mentioned above), from 76 posts a day on day 1 to 58 posts a day on day 28. However, the fraction of posts approved per community (the second component) remained largely stable at around 63\% of posts (note that this was calculated without winsorization and per group, instead of dividing the overall averages; \abbrevStyle{cf.}\xspace \Figref{fig:pct}, \Appref{app:adplots}). These findings suggest that post approvals reduce the number of posts by directly filtering out undesired posts, but also by reducing the likelihood of people to attempt to post in the first place. \begin{figure} \centering \includegraphics[width=\linewidth]{imgs/posts2.pdf} \caption{User activity-related signals before and after the adoption of the post approval setting. Signals are shown both in absolute terms (left) and normalized per number of posts (right). Error bars represent bootstrapped 95\% CIs.} \label{fig:posts2} \end{figure} \xhdr{Other user activity-related signals} Second, we looked at other user activity-related metrics (\emph{Comments}, \emph{Reactions}, and \emph{Time spent}). These are shown in \Figref{fig:posts2} both in absolute terms (first column) and normalized per number of posts (second column). Comparing PA-ON with PA-OFF communities, there was an absolute \emph{decrease} but relative \emph{increase} in all of these user activity metrics for PA-ON communities following the enabling of post approvals. In other words, there were fewer posts, but each post received, on average, more comments, reactions, and time spent. For instance, before the intervention (day $-1$), PA-ON and PA-OFF communities received an average of around 402 and 421 daily comments and around 7.6 and 7.4 comments per post. (Note that although the two sets of communities are matched, their averages are not perfectly identical.) After day 0, when PA-ON communities enabled post approvals, the number of daily comments declined substantially, reaching an average of 233 daily comments on day 28. Meanwhile, the number of comments per post nearly doubled to around 13.4. This change was not observed in the matched PA-OFF groups. \begin{figure} \centering \includegraphics[width=\linewidth]{imgs/posts3.pdf} \caption{Moderation-related signals before and after the adoption of post approvals. Error bars represent 95\% CI. We omit days 0 and 1 from the plot showing the \emph{Leader TS}, as it contains a sharp peak.} \label{fig:posts3} \end{figure} \xhdr{Moderation-related signals} Third, in \Figref{fig:posts3}, we examined moderation-related metrics -- \emph{Posts reported}, \emph{Posts deleted}, \emph{Leader TS} and \emph{Moderating TS} (\abbrevStyle{cf.}\xspace \Tabref{tab:cov} for descriptions). We normalized the number of posts reported and deleted by the total number of posts, and moderating time spent by the total leader time spent. Recall that the moderating time spent encompasses activities such as responding to reported content and, notably, approving posts (if the post approvals setting is turned on). Following day 0, PA-ON groups had fewer members removed and fewer posts reported/deleted (per post) than PA-OFF communities. For example, the percentage of posts reported decreased from around 0.75\% pre-intervention to 0.10\% post-intervention for PA-ON groups. This decrease was larger than that for matched PA-OFF groups (from 0.78\% to 0.60\%). Around the time that post approvals was enabled for PA-ON groups, time spent per admin increased substantially, likely because leaders were getting used to the new moderation style. However, by week 4, time spent per leader in PA-ON groups had returned to pre-intervention levels, though PA-ON groups had also tended to appoint new leaders. Examining the fraction of time spent in admin surfaces, leaders went from spending around 25\% of their time using group moderation tools to around 45\%, suggesting that leaders spent a substantial fraction of their time approving posts. While this increase appears large, group leaders in groups without post approvals may nonetheless be informally vetting posts by browsing posts in a group as they appear. \begin{figure} \centering \includegraphics[width=\linewidth]{imgs/posts4.pdf} \caption{Standardized effect of enabling post approvals on user activity\hyp{} and moderation\hyp{}related variables. Error bars represent 95\% confidence intervals. Data was not winsorized prior to this analysis.} \label{fig:posts4} \end{figure} \begin{figure*} \centering \includegraphics[width=\linewidth]{imgs/posts5.pdf} \caption{Effects of enabling post approvals for different stratifications of the data. Here, we report quartile-specific effects for group size (\abbrevStyle{i.e.}\xspace, number of members in a group; first column), the post approval rate (\abbrevStyle{i.e.}\xspace, percentage of posts that get approved in a group; second column) and the response time (\abbrevStyle{i.e.}\xspace, average time taken to accept posts in a group; third column). Data was not winsorized prior to this analysis. Error bars represent 95\% CIs.} \label{fig:posts5} \end{figure*} \xhdr{Regression analysis} Previously, we compared the user and moderation signals between PA-ON and PA-OFF communities before and after the post approvals are turned on after matching. Here, we performed a more rigorous analysis of the same signals under a regression framework. We considered the average value of each variable of interest in week $-4$ (days $-28$ to $-22$) and week 4 (days 22 to 28). Then, for the variables in the post-intervention period, we estimate the impact of adopting post approvals using a linear model: \begin{equation} \label{eq:reg} y = \hm{\alpha} \mathbf{X} + \beta \, \hm{1}_{\text{[PA-ON = True]}}, \end{equation} where $y$ represents the average value of one of the variables we studied in week 4 (\abbrevStyle{i.e.}\xspace, after the intervention), \abbrevStyle{e.g.}\xspace post approvals, $\mathbf{X}$ represents an array with all the variables we did the matching with in week $-4$ (\abbrevStyle{i.e.}\xspace, before the intervention), and $\beta$ represents the coefficient associated with turning on post approvals, as it multiplies an indicator variable that equals 1 for PA-ON, and 0 for PA-OFF, communities. To facilitate interpretability, we standardized the dependent variable $y$, so that the coefficients represent (pooled) standard deviations. The coefficient $\beta$ captures the difference between our treatment and control groups in the matched setting. Since the coefficient is associated with an indicator variable, the effects reported represent the differences between PA-ON and PA-OFF groups in standard deviations. We report $\beta$ for all outcomes of interest in \Figref{fig:posts4}. This analysis largely confirms results shown in \Figref{fig:posts1}, \Figref{fig:posts2}, and \Figref{fig:posts3}. The use of post approvals was significantly associated with a reduction in the number of posts ($-0.35$ standard deviations) but an increase in the number of comments, reactions, and time spent per post (e.g., the number of comments per post increased by 0.14 SDs). Use of the setting was also associated with a decrease in the number of posts reported per post ($-0.15$ SDs), posts deleted per post ($-0.55$ SDs) and number of members removed ($-0.07$ SDs). Taken along with the previous analyses, these results suggest that the setting improves the quality of posts. Further, post approvals do not significantly increase the average time leaders spend in the group, although groups that enable the setting tend to increase the size of their leadership team (around 0.04 SDs). \section{Heterogeneity of Post Approvals} \label{sec:het} While post approvals change how online communities function, the effect of the setting may vary by group size as well as how it is used. For example, we found that, on average, community leaders do not spend more time in their communities following the adoption of the setting. Yet, this may not be the case for all groups: very large groups (with possibly hundreds of daily post attempts) may actually require more time from leaders after the setting is turned on, while smaller groups may require less time. Thus, we analyzed the impact of post approvals in communities with 1)~different member counts, as well as in communities that 2)~approved different fractions of the posts submitted (approval rate); and 3)~took a different amount of time to approve posts (response time). For each of the aforementioned variables (number of members; response time and approval rate), we divided PA-ON communities into 4 quartiles.% \footnote{Defined by three points: for approval rate: 0.45, 0.69, 0.84; for response time: 1.2, 2.7, 5.75 (hours); for group size: 2850, 8500, 24000 (rounded) Approval rate and response time were measured across the entire post-intervention period. Group size was measured on day 0.} Then, we used the same regression setup depicted in Equation \eqref{eq:reg}, but estimated the effect of post approvals separately for communities in each of the quartiles. This amounts to a linear model of the form: \begin{equation} \label{eq:reg2} y = \hm{\alpha} \mathbf{X} + \sum_{i=1}^{4} \beta_i \, \hm{1}_{\text{[PA-ON = True and Quartile = $i$]}}, \end{equation} where $\beta_i$ is the effect for groups in a given quartile. We ran a different regression for each of the three setups described above (group size, approval rate, and response time). All three factors had noteworthy interactions with user activity\hyp{} and moderation-related signals (\abbrevStyle{cf.}\xspace\ \Figref{fig:posts5}). \xhdr{Time spent by leaders} Leaders in larger groups (group size Q4), groups with lower approval rates (approval rate Q4), and groups with faster response time (response time Q4) spent more time in their communities following the adoption of post approvals (\textit{Leader TS}: 0.15; 0.10; and 0.15 SDs). These trends were gradual across quartiles, and contrast with the overall null effect reported in \Figref{fig:posts4}. In other words, the moderation burden after enabling post approvals depends on the kind of group and on how community leaders proactively moderate the community. \xhdr{User activity} Larger groups experienced larger decreases in the number of posts (\abbrevStyle{e.g.}\xspace, Q4: $-0.79$ SDs) and larger increases in relative activity (\abbrevStyle{e.g.}\xspace, 0.22 SDs for \textit{Time spent} per post). Groups with a higher approval rate (Q3/Q4) experienced smaller decreases in the number of posts and smaller increases in relative activity. The higher the approval rate, the smaller the deviations were from PA-OFF matched communities. To a lesser extent, this was also observed for response time: the faster the response time, the smaller the deviations were. These results suggest that activity-related changes were greater in larger communities and that the strictness and speed of community leaders in approving or rejecting posts mediated changes in user activity. \xhdr{Moderation} Regardless of group size, response time, or approval rate, the number of posts reported and deleted decreased significantly across quartiles in all three analyses. Other moderation-related metrics such as members removed also decreased in most cases. Overall, this suggests that the decrease in potentially problematic content following the enabling of post approvals is robust and that it holds even when groups are very large (\abbrevStyle{e.g.}\xspace $-0.11$ SDs for \emph{Posts reported} per post for group size Q4) or when a vast majority of posts are approved (\abbrevStyle{e.g.}\xspace $-0.15$ SDs for approval rate Q4). In \Figref{fig:posts1}, we saw that post approvals changed the number of posts through both behavior change and through the filtering done by community leaders. Here, we see evidence that, regardless of the strictness of this filtering, the number of posts reported and deleted (normalized per post) decreases. \section{Discussion and Conclusion} In this work, we presented a large study of post approvals in Facebook Groups, examining both their adoption and their subsequent impact. Post approvals was adopted after changes in the groups' dynamics in the weeks prior: user activity and moderation increased in the weeks before the setting is enabled, and, on the day when the setting was turned on, there was often a surge in moderation activity. After the setting is adopted, communities become, on average, centered around fewer posts that receive more comments and reactions, and which users interact with for longer. These posts were less likely to be reported, and members were less likely to be removed, which suggests an increase in the quality of the discussions happening in the group. However, the strength of these effects varied with group size and with how proactive moderation was carried out -- \abbrevStyle{e.g.}\xspace in larger groups, leaders spent more time in the group after the setting was enabled, while in smaller groups, they spent less time. Overall, the findings provide preliminary insight on how proactive moderation may improve online information ecosystems: by adding participation friction in online communities, post approvals elicit behavior change (\abbrevStyle{cf.}\xspace \Figref{fig:posts1}). A limitation of our work is that we focus on a limited set of community-level analyses over a short period without considering spillover effects. This limitation suggests several potential extensions. First, future work could analyze how post approvals impact the participation of different kinds of users (including leaders); for instance, the setting may disproportionately affect highly-active users or may affect newcomers more than veteran members of a group, discouraging the former from participating. Related, future work could examine the reasons for the decrease in post attempts -- to what extent do post approvals discourage lower-quality posts vs. all posts? Second, future work could investigate the impact of post approvals in the long run. In other words, do the patterns we observe here continue for months or even years? How do communities evolve with and without the setting? Third, future work might examine spillover effects across different communities. If two communities have many overlapping members and one adopts post approvals (as well as stricter moderation practices), does this influence the behavior of users in the other community which did not adopt the setting? Fourth, future work could explore other community-level variables, such as within-group friendship network properties. This work may include examining if these variables can help explain the adoption of post approvals (as in \Secref{sec:rq1}), if they change suddenly after post approvals are enabled (\Secref{sec:rq2}), or if the effect of post approvals is heterogeneous across these variables (\Secref{sec:het}). Last, we note that our analysis was limited to Facebook Groups. Adapting the methodology here to explore participation controls studied qualitatively in other platforms such as ``chat modes'' in live streaming platforms~\cite{seering2017shaping} or software such as Reddit's \textit{AutoModerator}~\cite{jhaver2019human} remains future work. As argued by \citet{kraut2012building}, participation controls are ``design levers'' that shape how people connect with others in online communities. Thus, understanding how they work may inform the design of better-governed online spaces.
\section{Conclusion}\label{sec:conclusion} We have studied the problem of user localization using the RSS measurements collected by a UAV. To do so, we first proposed a hybrid channel model which aims to accurately learn the path loss parameters as well as the UAV antenna pattern. A PSO technique then was employed by exploiting the learned hybrid channel model and leveraging the 3D map of the environment to accurately localize the ground users. The performance of the developed algorithm was evaluated through simulations and also real-world experiments. \section{Acknowledgments} This work was funded via the HUAWEI France supported Chair on Future Wireless Networks at EURECOM. \bibliographystyle{IEEEtran} \section{Introduction}\label{sec:Intro} In a wireless localization system, nodes with perfectly-known positions known as anchor nodes (which can be stationary or mobile) collect various radio measurements from the emitted radio frequency (RF) signals from the users in the network, and use them for localization purposes. Various measurements such as received signal strength (RSS), time-of-arrival (TOA), angle of arrival (AOA), etc., can be obtained from the RF signals by the anchor nodes \cite{zekavat2011handbook,delRauLop}. On the other hand, advancement in robotic technologies and miniaturization of wireless equipment have made it possible to have flying radio networks (FRANs), where wireless connectivity to ground users can be provided by aerial base stations (BSs) that are mounted on unmanned aerial vehicles (UAVs) \cite{GanEsaGes,MozSaadBennNamDebb}. Advantage of FRANs include, fast and dynamic network deployment during an emergency or temporary crowded events, providing connectivity in areas lacking network infrastructure, etc. While in terrestrial radio access networks static BSs are used as anchor nodes, in FRANs UAV BSs can be used as mobile anchor nodes. Localization of ground users using RSS measurements collected by aerial UAV anchor nodes has gained interest recently \cite{Ref5_sallouha2017aerial,Ref19_lima2019support,Ref9_artemenko2015evaluation,Ref10_ji2019fair,Ref6_koohifar2018autonomous,ShahidSoltan,EsrGanGesAsil,esrafilian20203d}. The main advantage of using UAV BS anchors in localization compared to static BSs is that UAV BSs with their inherent 3D mobility can collect radio measurements in difference geographic locations which improves the localization performance. Generally, RSS measurements are easy to obtain in many wireless networks and does not require stringent synchronization and calibration constraints associated with timing based measurements. The works in \cite{Ref10_ji2019fair,Ref6_koohifar2018autonomous,ShahidSoltan} assumed that the UAV flies high enough so that the RSS of the UAV-user or Air-to-ground (A2G) link is modeled as a simple {\text{}}{los} channel. This LoS assumption is generally not valid in urban scenarios as A2G links are often blocked by city buildings. To over come this, the authors of \cite{EsrGanGesAsil,esrafilian20203d} have used a segmented pathloss model that differentiates between LoS and {\text{}}{nlos} channel conditions and showed improvement in localization performance. Moreover, in \cite{esrafilian20203d} it is shown that by exploiting the 3D city map which contains the building locations and height information, one can significantly improve the localization performance. One common assumption in all the works in \cite{Ref5_sallouha2017aerial,Ref19_lima2019support,Ref9_artemenko2015evaluation,Ref10_ji2019fair,Ref6_koohifar2018autonomous,ShahidSoltan,EsrGanGesAsil,esrafilian20203d}, is that the UAV is assumed to have a perfect isotropic radiating antennas. However, in reality this is not true and several complications arise with UAV BSs as opposed to static BSs: a) The UAV altitude and heading changes depending on its mobility pattern, hence the antenna gain changes with the UAV location and orientation \cite{7228721} b) The radiation pattern of the antenna mounted on UAV is affected by the chassis, and hence it is difficult to measure the actual antenna pattern while UAV is flying \cite{7510362,8402597}. The work in \cite{CheDevSinGuv} has demonstrated that the 3D radiation pattern of an antenna mounted on a drone can significantly influence the RSS of the A2G link. Therefore, it is important to consider this in a practical localization system using UAV BS anchors. The impact of the antenna radiation pattern in A2G channels in a 3D localization system using time-difference-of-arrival (TDOA) measurements has been studied in \cite {SinYapISm}. However, the authors assume that the radiation pattern of the UAV antenna is known. To the best of our knowledge, localizing users with a UAV with an unknown radiation pattern and RSS measurements has not been studied before. Specifically, our contributions are as follows: \begin{itemize} \item The unknown antenna radiation pattern of the UAV during the flight is parameterized by a neural network by feeding RSS measurements in the training phase. \item An optimization framework is proposed capable of using the trained model, which characterizes the path loss and the antenna gain pattern, along with the 3D map of the environment to improve the localization performance. \end{itemize} \section{System Model and Problem Formulation}\label{sec:SysModel} We consider a scenario similar to the one illustrated in Fig. \ref{fig:SystemModel}, where a UAV BS that is connected to $K$ ground level users in an urban area consisting of a number of city buildings. The users are spread over the city and ${\bf u}_{k}=[x_{k},y_{k}]^{{\Transpose}}\in\mathbb{R}^{2},\,k\in[1,K]$ denotes the $k$-th user's location. The users are considered static and their locations are unknown. A 3D map of the environment where the UAV and users are located is assumed to be available. The aim of the UAV is to estimate the unknown user locations based on RSS measurements taken in $N$ different time steps from the users. In the $n$-th time step, the UAV/drone position is denoted by ${\bf{v}}_n=[x[n],y[n],z[n]]^{{\Transpose}}\in\mathbb{R}^{3}$. We assume that the UAV is equipped with a GPS receiver, hence ${\bf{v}}_n,\forall n$ is known. \subsection{Channel Model} We now describe the radio channel model between the UAV and ground users. Note that the channel parameters and the UAV antenna pattern are unknown and need to be learned. In general, the channel between UAV position ${\bf{v}}$ and user location ${\bf{u}}$ in dB can be modeled as \begin{equation} g_{z}=\phi_{z}({\bf{v}}, {\bf{u}}) + \gamma({\bf{v}}, {\bf{u}}, \psi) + \eta_{z}, \label{eq:CH_Model_dB} \end{equation} where $\phi_{z}({\bf{v}}, {\bf{u}})$ is the path loss between the UAV and the user link, $\gamma({\bf{v}}, {\bf{u}}, \psi)$ stands for the antenna gain of the UAV with $\psi$ denoting the heading angle of the UAV with respect to the north pole, and $\eta_{z}$ is the shadowing component that is modeled as a Gaussian random variable with $\mathcal{N}(0,\sigma_{z}^{2})$. $z\in\left\{ \text{LoS},\text{NLoS}\right\}$ emphasizes the strong dependence of the propagation parameters on the {\text{}}{los} or {\text{}}{nlos} segments. The variance of the shadowing component $(\sigma_{z}^{2})$ is assumed to be known for both segments. Note that \eqref{eq:CH_Model_dB} represents the logarithm of the channel gain which is averaged over the small scale fading of unit variance. Classically, the path loss $\phi_{z}({\bf{v}}, {\bf{u}})$ between two radio nodes is modeled as \cite{ChenYanGes} \begin{equation} \phi_{z}({\bf{v}}, {\bf{u}})\triangleq \phi_{z}(d) =\ss_{z}-10\,\alpha_{z}\log_{10}\left(d\right), \label{eq:classical_ch_gain} \end{equation} where $d = \|{\bf{v}} - {\bf{u}}\|_2$, $\alpha_{z}$ is the path loss exponent, and $\ss_{z}$ is the log of average path loss at the reference point $d=1\si{m}$. We assume that the users are equipped with an omnidirectional antenna. However, the antenna mounted on the UAV does not have a specific gain pattern and can have a very complex form depending on the design of the antenna and also the type of materials used in the UAV itself. \section{Radio channel Learning and User Localization \label{sec:LearningLocalization}} In this section, we propose a map-based algorithm to estimate the user locations from the channel gain measurements collected by the UAV. Let us denote an arbitrary set of measurements taken by the UAV during the mission by a sequence $\chi = \left\{{\bf{v}}_n, n\in [1,N]\right\}$. From each of these locations, the UAV collects radio measurements form all $K$ users. We denote the channel gain or RSS measurement (in dB scale) obtained from the $k$-th user by the UAV in the $n$-th time step with $g_{n,k}$. Using the channel model in \eqref{eq:CH_Model_dB} we can write \begin{equation}\label{eq:MeasurementModel} g_{n,k} {=} \begin{cases} \phi_{{\text{}}{los}}(d_{n, k}) + \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n) + \eta_{n,k,{\text{}}{los}} & \small{\text{if} \text{ LoS}}\\ \phi_{{\text{}}{nlos}}(d_{n, k}) + \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n) + \eta_{n,k,{\text{}}{nlos}} & \small{\text{if} \text{ NLoS}}, \end{cases} \end{equation} where $d_{n,k} = \| {\bf{v}}_n - {\bf{u}}_k \|_2$, and $\psi_n$ is the UAV heading angle at time step $n$. The function $\gamma (.)$ is the antenna gain which is unknown and it needs to be learned. The probability distribution of a single measurement in \eqref{eq:MeasurementModel} is modeled as \begin{equation} \label{eq:mixdit} p(g_{n,k}) = (f_{n,k,\text{LoS}})^{w_{n,k}} (f_{n,k,\text{NLoS}})^{(1-w_{n,k})}, \end{equation} where $\omega_{n,k} \in \{0,1\}$ is the classifier binary variable (yet unknown) indicating whether a measurement falls into the LoS or NLoS category, and $f_{n,k,z}$ has a Gaussian distribution with $\mathcal{N}(\phi_{z}(d_{n, k}) + \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n),\sigma_{z}^{2})$. Assuming that collected measurements conditioned on the channel and user positions are independent and identically distributed (i.i.d) \cite{ChenYanGes}, using \eqref{eq:mixdit}, the negative log-likelihood of measurements leads to \noindent \begin{equation} \begin{aligned}\label{eq:localization_liklihood} \mathcal{L} &= \log\left(\frac{\sigma_{{\text{}}{los}}^2}{\sigma_{{\text{}}{nlos}}^2}\right)\sum_{k=1}^{K}\sum_{n=1}^{N} \omega_{n,k}+ \\ &\sum_{k=1}^{K}\sum_{n=1}^{N} \frac{\omega_{n,k}}{\sigma_{{\text{}}{los}}^2}\left |g_{n,k}{-}\phi_{{\text{}}{los}}(d_{n, k}) - \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n)\right|^2 + \\ & \sum_{k=1}^{K}\sum_{n=1}^{N} \frac{(1-\omega_{n,k})}{\sigma_{{\text{}}{nlos}}^2} \left | g_{n,k}{-}\phi_{{\text{}}{nlos}}(d_{n, k}) - \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n)\right|^2. \end{aligned} \end{equation} The estimate of the unknown channel parameters $\{\alpha_z, \ss_{z} \}$, $\bf{u}_k$, and $\gamma (.)$ can then be obtained by solving \begin{subequations} \begin{align} \begin{split} \min_{\substack{\omega_{n,k},\,{{\bf{u}}}_k\\ {\alpha_z, \ss_{z}, \gamma (.)}} } & \quad \mathcal{L} \end{split}\\ \begin{split} \text{s.t.}&\quad \omega_{n,k} \in \{0,1\}, \forall n, \forall k. \end{split} \end{align}\label{eq:Localization_Opt_Org}% \end{subequations} The binary variables $\omega_{n,k}$ in objective function \eqref{eq:localization_liklihood}, and the fact that $\gamma(.)$ is not explicitly known and is a function of user locations, make problem \eqref{eq:Localization_Opt_Org} challenging to solve since it is a joint classification, channel learning and user localization problem. To tackle this difficulty, we split \eqref{eq:Localization_Opt_Org} into two sub-problems of offline channel learning and online user localization . We also exploit the 3D map of the city for the measurements classification which will be elaborated next. \subsection{Offline Radio Channel Learning} \label{sec:cahnnel_learning} We aim to learn the radio channel using a set of offline radio measurements which are collected from users with known locations in advance. In this manner, we have a set of training data set to learn the radio channel. Since the characteristic of the radio channel is independent of the user location and only affected by the structure of the city (i.e. the blocking objects in the environment) and the UAV antenna pattern, therefore learning the radio channel from a set of offline training data set can provide a good approximation for the radio channel. We also exploit the 3D map of the city to perform the LoS/NLoS classification of the measurements, since for a user with a known location the classification variables $\omega_{n,k}$ can be directly inferred from a trivial geometry argument: for a given UAV position, the user is considered in LoS to the UAV if the straight line passing through the UAV's and the user position lies higher than any buildings in between. Moreover, we use a neural network with parameters ${{\boldsymbol{\theta}}}$ as an approximation of the UAV antenna gain $\gamma_{{{\boldsymbol{\theta}}}}(.)$. We call this channel model a \textit{hybrid} channel model, since it consists of a traditional path loss representation $\phi_{z}(.)$ along with a neural network approximating the UAV antenna gain. The main reason for choosing such a channel model lies in the fact that a rough estimation of the channel can be obtained using the classical path loss model \eqref{eq:classical_ch_gain}, while all the uncertainties which can not be captured by the path loss function are then modeled using a neural network. Now having classified the measurement and using the hybrid channel model, problem \eqref{eq:Localization_Opt_Org} just by considering the offline training data set (with known user locations) can be rewritten as follows \begin{equation} \begin{aligned} \min_{\substack{{\alpha_z, \ss_{z}, {\boldsymbol{\theta}}}} } & \quad \mathcal{L}, \end{aligned} \label{eq:cahnnel_learning} \end{equation} where $\theta$ is the parameters of the neural network for estimating of the antenna gain. Solving this problem is still challenging since the UAV antenna gain is the same for both LoS and NLoS measurements. To alleviate this burden, we split up our problem into two phases. In the first phase, we only find the path loss parameters by solving the following optimization problem \begin{equation} \begin{aligned} {\alpha_z^*, \ss_{z}^*} := \argmin_{\substack{{\alpha_z, \ss_{z}}} } & \quad \Bar{\mathcal{L}}, \end{aligned} \label{eq:cahnnel_learning_p1} \end{equation} where \begin{equation} \begin{aligned}\label{eq:L_p1} \Bar{\mathcal{L}} =& \sum_{k=1}^{K}\sum_{n=1}^{N} \frac{\omega_{n,k}}{\sigma_{{\text{}}{los}}^2}\left |g_{n,k}{-}\phi_{{\text{}}{los}}(d_{n, k}) \right|^2 + \\ & \sum_{k=1}^{K}\sum_{n=1}^{N} \frac{(1-\omega_{n,k})}{\sigma_{{\text{}}{nlos}}^2} \left | g_{n,k}{-}\phi_{{\text{}}{nlos}}(d_{n, k})\right|^2. \end{aligned} \end{equation} In \eqref{eq:L_p1} the effect of the UAV antenna gain is ignored which allows us to find the closest estimate to the measurements using the path loss model. The parameters obtained by solving \eqref{eq:cahnnel_learning_p1} are denoted as ${\alpha_z^*, \ss_{z}^*}$. In the second phase, the path loss parameters are fixed to ${\alpha_z^*, \ss_{z}^*}$ and the UAV antenna gain parameters are obtained as follows \begin{equation} \begin{aligned} {\boldsymbol{\theta}}^* := \argmin_{\substack{{{\boldsymbol{\theta}}}} } & \quad \mathcal{L}|_{\alpha_z^*, \ss_{z}^*}. \end{aligned} \label{eq:cahnnel_learning_p2} \end{equation} Note that, both problems \eqref{eq:cahnnel_learning_p1}, \eqref{eq:cahnnel_learning_p2} can be solved using standard optimization frameworks (i.e. any gradient-based optimizer). \subsection{User Localization} \label{sec:localization} Having learned the radio channel, we continue to localize the unknown users in the online data set. The optimization problem \eqref{eq:Localization_Opt_Org} by utilizing the learned radio channel can be reformulated as follows: \begin{subequations} \begin{align} \begin{split} \min_{\substack{\omega_{n,k},\,{{\bf{u}}}_k} } & \quad \mathcal{L}^* \end{split}\\ \begin{split} \text{s.t.}&\quad \omega_{n,k} \in \{0,1\}, \forall k , \forall n, \end{split} \end{align}\label{eq:Localization_unkown_users}% \end{subequations} where $\mathcal{L}^* $ is obtained by substituting the channel model with learned parameters ${\alpha_z^*, \ss_{z}^*}, {\boldsymbol{\theta}}^*$ in \eqref{eq:localization_liklihood}. It is hard to find a closed form and analytical solution to problem \eqref{eq:Localization_unkown_users} due to the binary random variables $\omega_{n,k}$, and the non-linear and non-convex objective function $\mathcal{L}^*$. We employ the particle swarm optimization (PSO) technique to solve this problem since PSO is suitable for solving various non-convex and non-linear optimization problems. More specifically, PSO is a population-based optimization technique that tries to find a solution to an optimization problem by iteratively trying to improve a candidate solution with regard to a given measure of quality (or objective function). The algorithm is initialized with a population of random solutions, called particles, and a search for the optimal solution is performed by iteratively updating each particle's velocity and position based on a simple mathematical formula (for more details on PSO see \cite{KenEbe}). As will be clear later, the PSO algorithm is enhanced to exploit the side information stemming from the 3D map of the environment which improves the performance of user localization and reduce the complexity of solving $\eqref{eq:Localization_unkown_users}$, since the binary variables $\omega_{n,k}$ can be obtained directly from the 3D map \cite{esrafilian20203d}. For ease of exposition, we first solve $\eqref{eq:Localization_unkown_users}$ by assuming only one unknown user. Then we will generalize our proposed solution to the multi-user case. To apply the PSO algorithm, we define each particle to have the following form \begin{equation} {\bf{c}}_j = [ x_j, y_j]^{\text{T}} \in \mathbb{R}^2, j \in [1, C], \end{equation} where $C$ is the number of particles and each particle is an instance of the possible user location in the city. Therefore, by treating each particle as a potential candidate for the user location, the negative log-likelihood $\eqref{eq:localization_liklihood}$ for a given particle and learned parameters ${\alpha_z^*, \ss_{z}^*}, {\boldsymbol{\theta}}^*$ can be rewritten as follows \begin{equation} \begin{small} \begin{aligned} \mathcal{L}^*(&{\bf{c}}_{j}^{(i)}) = \log\left(\frac{\sigma^2_{{\text{}}{los}}}{\sigma^2_{{\text{}}{nlos}}}\right) \left |\mathcal{M}_{{\text{}}{los},1,j}\right| + \\ & \small{\sum_{z\in \{{\text{}}{los},{\text{}}{nlos}\}} \, \sum_{n\in \mathcal{M}_{z,1,j}}} \frac{1}{\sigma^{2}_{z}} \left |g_{n,1}{-}\phi_{z}(d_{n, j}) - \gamma_{\theta^*}({\bf{v}}_n, {\bf{c}}_{j}^{(i)}, \psi_n)\right|^2 ,\label{eq:SSE_PSO_single_Ue} \end{aligned} \end{small} \end{equation} \noindent where ${\bf{c}}_{j}^{(i)}$ is the $j$-th particle at the $i$-th iteration of the PSO algorithm, $d_{n, j} = \|{\bf{v}}_n - {\bf{c}}_{j}^{(i)}\|_2$, and $\mathcal{M}_{z,1,j}$ is a set of time indices of measurements collected from user 1 which are in segment $z$ by assuming that the location of user 1 is the same as particle $j$. To form $\mathcal{M}_{z,1,j}$, a 3D map of the city is utilized. For example, measurement $g_{n,1}$ is considered LoS, if the straight line passing through ${\bf{c}}_{j}^{(i)}$ and the drone location ${\bf{v}}_n$ lies higher than any buildings in between. Therefore, the best particle minimizing \eqref{eq:SSE_PSO_single_Ue} can be obtained from solving the following optimization \noindent \begin{equation} j^* := \arg \min_{j\in [1,C]} {\mathcal{L}^{*}({\bf{c}}_{j}^{(i)})}, \label{eq:best_particle} \end{equation} where $j^* $ is the index of the best particle which minimizes the objective function in \eqref{eq:best_particle}. In the next iteration of the PSO algorithm, the position and the velocity of particles are updated and the algorithm repeats for $\tau$ iterations. The best particle position in the last iteration is considered as the estimate of the user location. Note that for the multi-user case, without loss of optimality, the problem can be transformed into multiple single-user localization problems, and then each problem can be solved individually. This stems from the fact that the radio channel is learned beforehand and is assumed to have the same characteristics for all the UAV-user links (the radio channel parameters and the UAV antenna pattern are independent of user locations). \section{Numerical Results}\label{sec:simulations} We consider a dense urban city neighborhood comprising buildings and streets as shown in Fig. \ref{fig:hybrid_localziation}-a. The height of the buildings is Rayleigh distributed in the range of 5 to \SI{40}{m} \cite{Ref26_HourKandeepJamail}. The true propagation parameters are chosen as $\alpha_{{\text{}}{los}}=2.2,\,\alpha_{{\text{}}{nlos}}=3.2,\,\ss_{{\text{}}{los}}=-32\,\text{dB},\,\ss_{{\text{}}{nlos}}=-35\,\text{dB}$ according to an urban micro scenario \cite{3GPP}. The variances of the shadowing components in {\text{}}{los} and {\text{}}{nlos} scenarios are $\sigma_{{\text{}}{los}}^{2}=2\,\text{dB}$, and $\sigma_{{\text{}}{nlos}}^{2}=5\,\text{dB}$, respectively. The following UAV antenna gain is considered to conduct the simulation \begin{equation} \gamma({\bf{v}}_n, {\bf{u}}_k, \psi_n) = 15 \left(| cos(\rho_{n, k})| + 2 |sin(\varphi_{n, k} + \psi_n)|\right), \end{equation} where $\rho_{n, k}, \varphi_{n, k}$ are , respectively, the elevation and azimuth angles between the UAV and the user, and $\psi_n$ is the heading angle of the UAV. The hybrid channel model is trained in the same city as shown in Fig. \ref{fig:hybrid_localziation}-a by collecting radio measurements from $K=10$ different random users and over $N=200$ individual random UAV locations. To train the hybrid model, we first need to learn the pathloss parameters. To do so, we use the training data set $\mathcal{D}^{tr}_{pl} = \{ (d_{n, k}, g_{n, k}), \forall n, k \}$. The path loss parameters can then be obtained by solving \eqref{eq:cahnnel_learning_p1}. Now we continue to learn the UAV antenna gain. To estimate the UAV antenna gain, a neural network with four hidden layers is used where the first and the second layers have $60$ neurons with the $tanh$ activation function, and the third and the fourth layers with $40$ neurons and the $relu$ activation function. To train this network the training data set $\mathcal{D}^{tr}_{ag} = \{ (d_{n, k}, {\bf{x}}_{n, k}, g_{n, k}), \forall n, k \}$ is used where ${\bf{x}}_{n, k}$ is the input vector to the neural network and is defined as follows \begin{equation} {\bf{x}}_{n, k} = [\frac{x[n] - x_k}{\|{\bf{v}}_n - {\bf{u}}_k\|_2}, \frac{y[n] - y_k}{\|{\bf{v}}_n - {\bf{u}}_k\|_2}, \frac{z[n]}{\|{\bf{v}}_n - {\bf{u}}_k\|_2}, \psi_n]^{\text{T}}. \end{equation} The parameters of the neural network $(\theta)$ can be obtained by solving the optimization problem \eqref{eq:cahnnel_learning_p2} where $\mathcal{L}$ is defined as follows \begin{equation} \begin{aligned} \mathcal{L} &= \log\left(\frac{\sigma_{{\text{}}{los}}^2}{\sigma_{{\text{}}{nlos}}^2}\right)\sum_{k=1}^{K}\sum_{n=1}^{N} \omega_{n,k}+ \\ &\sum_{k=1}^{K}\sum_{n=1}^{N} \frac{\omega_{n,k}}{\sigma_{{\text{}}{los}}^2}\left |g_{n,k}{-}\phi_{{\text{}}{los}}(d_{n, k}) - \gamma_{\theta}({\bf{x}}_{n, k})\right|^2 + \\ & \sum_{k=1}^{K}\sum_{n=1}^{N} \frac{(1-\omega_{n,k})}{\sigma_{{\text{}}{nlos}}^2} \left | g_{n,k}{-}\phi_{{\text{}}{nlos}}(d_{n, k}) - \gamma_{\theta}({\bf{x}}_{n, k})\right|^2. \end{aligned} \end{equation} Having trained the hybrid channel model, the estimate of each measurement in accordance with \eqref{eq:MeasurementModel} is given by: \begin{equation}\label{eq:mixed_ch_model_with_input} \hat{g}_{n,k} {=} \begin{cases} \phi_{{\text{}}{los}}(d_{n, k}) + \gamma_{\theta}({\bf{x}}_{n, k}) & \small{\text{if} \text{ LoS}}\\ \phi_{{\text{}}{nlos}}(d_{n, k}) + \gamma_{\theta}({\bf{x}}_{n, k}) & \small{\text{if} \text{ NLoS}}. \end{cases} \end{equation} In Fig. \ref{fig:hybrid_localziation}-a, the result of the user localization after the training phase is shown. We also compared the performance of the proposed algorithm with \cite{esrafilian20203d} which uses the conventional channel model consisting of the path loss model without considering the effect of the UAV antenna gain. Moreover, in Fig. \ref{fig:hybrid_localziation}-b the results of the channel model estimation is shown for different algorithms. It is clear that by using the hybrid channel model we can obtain a better estimation of the channel which results in a more precise user localization. Moreover, the user location estimated using the proposed algorithm for the multi-user scenario is illustrated in Fig. \ref{fig:multiUser_localization} and confirmed to be very close to the true user positions. \begin{figure}[t] \begin{centering} \includegraphics[width=0.8\columnwidth]{IMG/MultiUser.eps} \par\end{centering} \caption{The performance of proposed localization algorithm for multi-user case. \label{fig:multiUser_localization}} \vspace{-6pt} \end{figure} In Fig. \ref{fig:cdf_localization}, the cumulative distribution function (CDF) of user localization error of our proposed algorithm with comparison to \cite{esrafilian20203d} over Monte-Carlo simulations is shown. We can see that the localization accuracy is considerably improved by using the hybrid channel model. \begin{figure}[t] \begin{centering} \includegraphics[width=0.8\columnwidth]{IMG/CDF.eps} \par\end{centering} \caption{The CDF of user localization error for different algorithms. \label{fig:cdf_localization}} \vspace{-6pt} \end{figure} \section{Experimental Results}\label{sec:experiment} We have also validated the performance of the proposed algorithm through real-world experimentation. We established a Wi-Fi mesh network comprising sets of outdoor ground nodes and a UAV node. all the nodes are equipped with a MicroTick Wi-Fi card, which is configured on channel 48 in the 5 GHz band, with two omnidirectional vertically polarized dipole antennas. Prior to applying the localization algorithm, we learned the wireless channel by training the hybrid channel model over the training measurements collected from different ground users in the environment where the experiment is conducted. Having learned the channel model, different test user locations are chosen to be localized. In Fig. \ref{fig:experiment_localization}, the top view of the UAV trajectory taken to collect the test data, the performance of the localization, and the estimate of the channel using our proposed method as well as the method in \cite{esrafilian20203d} for different scenarios are shown. In both trajectories, the heading of the UAV is set to a fixed angle facing towards the south over the course of the trajectory. It is worth noting that when the relative angle between the UAV and the ground node changes drastically, Fig. \ref{fig:experiment_localization}-b, the algorithm in [12] which uses the convectional channel model fails to localize the users. This stems from the fact that the UAV antenna pattern is changed considerably and is no longer symmetric and omnidirectional due to the proximity to all the components on the UAV (i.e. the body frame, propellers, motors, etc.) which makes it difficult to be precisely modeled by conventional channel models. Moreover, in \cite{VideoClip}, a video recording of the experiment in EURECOM campus is captured, illustrating the localization of two ground nodes while flying the UAV in the environment. As the UAV collects more measurements from the ground nodes, the estimate of the user location becomes more accurate. \begin{figure}[t] \centering \subfloat[]{ \includegraphics[clip,width=0.49\columnwidth]{IMG/Exp1_Trj.eps} \includegraphics[clip,width=0.48\columnwidth]{IMG/Exp1_rss.eps} } \newline \subfloat[]{ \includegraphics[clip,width=0.49\columnwidth]{IMG/Exp2_Trj.eps} \includegraphics[clip,width=0.48\columnwidth]{IMG/Exp2_rss.eps} } \caption{Left: top view of the UAV trajectory, true user and estimated user location. Right: corresponding test measurements collected from the user and the channel estimate using different models. \label{fig:experiment_localization}} \end{figure}
\section{Introduction} Let $\mathbb H =SL(2,\ensuremath{\mathbb{R}})/SO(2)$ be the hyperbolic plane equipped with the Riemannian metric of constant negative curvature and $\Gamma\subset SL(2,\ensuremath{\mathbb{R}})$ a discrete torsion-free subgroup. Then $\Gamma\backslash \mathbb H$ is a Riemannian surface of constant negative curvature and the relations between the geometry of $\Gamma\backslash \mathbb H$, the group theoretic properties of $\Gamma$, the dynamical properties of the $\Gamma$-action on $\mathbb H$ or its compactification, and the spectrum of the positive Laplace-Beltrami operator $\Delta$ have been intensively studied over several decades. Let us focus on the discrete $L^2$-spectrum of the Laplace-Beltrami operator, i.e. those $\mu\in \ensuremath{\mathbb{R}}$ such that $(\Delta-\mu)f=0$ for some $f\in L^2(\Gamma\backslash \mathbb H)$, $f\neq 0$. If $\Gamma\subset SL(2,\ensuremath{\mathbb{R}})$ is cocompact, then $\mu_0=0$ is always an eigenvalue corresponding to the constant function and Weyl's law for the elliptic selfadjoint operator $\Delta$ implies that there is a discrete set of infinitely many eigenvalues $0=\mu_0<\mu_1\leq\ldots$ of finite multiplicity. From a representation theoretic perspective there is a clear distinction between $\mu_i\in \,]0,1/4[$ and $\mu_i\geq 1/4$. The former correspond to complementary series representations and the latter to principal series representations occurring in $L^2(\Gamma\backslash SL(2,\mathbb R))$. We call the eigenvalues accordingly principal eigenvalues (if $\mu_i\geq1/4$) and complementary or exceptional eigenvalues (if $\mu_i\in ]0,1/4[$). Merely by discreteness of the spectrum we know that there are at most finitely many complementary eigenvalues and infinitely many principal eigenvalues. If we pass to non-compact $\Gamma\backslash \mathbb H$, the situation becomes more intricate: For the modular surface $SL(2,\mathbb Z)\backslash \mathbb H$, which is non-compact but of finite volume, it is well known that there are no complementary eigenvalues but still infinitely many principal eigenvalues obeying a Weyl asymptotic. In general the question of existence of principal eigenvalues on finite volume hyperbolic surfaces is wide open. A long standing conjecture by Phillips and Sarnak \cite{Sarnak85} states that for a generic lattice $\Gamma \subset SL(2,\mathbb R)$ there should be no principal eigenvalues. If we pass to hyperbolic surfaces of infinite volume the situation is much better understood. A classical theorem by Patterson \cite{Patterson} states that if $\mathrm{vol}(\Gamma\backslash \mathbb H) = \infty$ and $\Gamma\subset SL(2,\mathbb R)$ is geometrically finite, then there are no principal eigenvalues. The result has later been generalized to real hyperbolic spaces of higher dimensions by Lax and Phillips \cite{laxphil}. Even if we are not aware of a reference, it seems folklore that the statement holds for general rank one locally symmetric spaces. In this article we are interested in a generalization of Patterson's theorem to higher rank locally symmetric spaces: Let us briefly\footnote{A more detailed description of the setting will be provided in Section~\ref{sec:notation}.} introduce the setting: Let $X=G/K$ be a Riemannian symmetric space of non-compact type and $\Gamma\subset G$ a discrete torsion-free subgroup. We will be interested in the $L^2$-spectrum of the locally symmetric space $\Gamma\backslash X$. As for hyperbolic surfaces the Laplace-Beltrami operator is a canonical geometric differential operator whose spectral theory can be studied. If the symmetric space is of higher rank, there are however further $G$-invariant differential operators on $X$ that descend to differential operators on $\Gamma\backslash X$. It is from many perspectives more desirable to study the spectral theory of the whole algebra of invariant differential operators $\mathbb D(G/K)$ instead of just the spectrum of the Laplacian. In order to introduce the definition of the joint spectrum of $\mathbb D(G/K)$ we recall that $\mathbb D(G/K)$ is a commutative algebra generated by $r\geq 1$ algebraically independent differential operators and $r$ equals the rank of the symmetric space $X$. After a choice of generating differential operators a joint eigenvalue of these commuting differential operators would be given by an element in $\ensuremath{\mathbb{C}}^r$. A more intrinsic way of defining the spectrum which does not require to choose any generators, is provided by the Harish-Chandra isomorphism. This is an algebra isomorphism $\HC: \mathbb D(G/K) \to \text{Poly}(\mathfrak a^*)^W$ between the invariant differential operators and the complex-valued Weyl group invariant polynomials on the dual of $\mathfrak a =\rm{Lie}(A)$, where $A$ is the abelian subgroup of $G$ in the Iwasawa decomposition $G=KAN$. If we fix $\lambda \in \mathfrak a^*$ and compose the Harish-Chandra isomorphism with the evaluation of the polynomial at $\lambda$ we obtain a character $\chi_\lambda:= \text{ev}_\lambda\circ \HC : \mathbb D(G/K)\to \mathbb C$. With this notation we call $\lambda\in\mathfrak a_\ensuremath{\mathbb{C}}^*$ a joint $L^2$-eigenvalue on $\Gamma\backslash X$ if there exists $f\in L^2(\Gamma \backslash X)$ such that for all $D\in \mathbb D(G/K)$: \[ Df=\chi_\lambda(D) f. \] As for the hyperbolic surfaces we can distinguish two kinds of $L^2$-eigenvalues: The purely imaginary joint eigenvalues $\lambda \in i\mathfrak a^*$ correspond to principal series representations and we call them \emph{principal joint $L^2$-eigenvalues}. The remaining eigenvalues are called \emph{complementary} or \emph{exceptional} eigenvalues. These two kind of eigenvalues are not only distinguished by representation theory, but they also behave differently from the point of view of spectral theory: In their seminal paper \cite{DKV}, Duistermaat, Kolk and Varadarajan consider the case of cocompact discrete subgroups $\Gamma\subset G$. They prove that there exist infinitely many principal joint eigenvalues and their asymptotic growth is precisely described by a Weyl law with a remainder term. They furthermore prove an upper bound on the number of complementary eigenvalues whose growth rate is strictly inferior than the Weyl asymptotic of the principal eigenvalues. There are thus much less complementary than principal eigenvalues. The most prominent non-compact higher rank locally symmetric space is without doubt $\ensuremath{\Gamma}\backslash X =SL(n,\mathbb Z) \backslash SL(n,\mathbb R)/ SO(n)$. By \cite{Mue07} it is known that there are infinitely many joint $L^2$-eigenvalues. Assuming the generalized Ramanujan conjecture which implies the absence of complementary eigenvalues (see e.g. \cite{Blomerbrumley}), we would get infinitely many principal joint $L^2$-eigenvalues. If one replaces the full modular group by a congruence subgroup $\ensuremath{\Gamma}(n)$ of level $n\geq3$, the existance of infinitely many principal joint $L^2$-eigenvalues has been shown by Lapid and Müller \cite{lapidmueller09}. More precisely, there is a Weyl law for the principal joint eigenvalues and the number of complementary eigenvalues are shown to be bounded by a function of lower order growth. In the recent article \cite{edwardsoh22} Edwards and Oh give examples and conditions on the discrete subgroup $\ensuremath{\Gamma}$ which imply that the complementary eigenvalues are not only of lower quantity but that they are indeed absent. The main example are selfjoinings of convex-cocompact subgroups in $PSO(n,1)$, but they conjecture that this holds for every Anosov subgroup. In this article we are interested in conditions on the group $\Gamma$ which imply the absence of principal eigenvalues. In order to state our main theorem, recall the definition of a wandering point: If $\Gamma$ acts continuously on a topological space $T$, then a point $t\in T$ is called wandering, if there exists a neighborhood $U\subset T$ of $t$ such that $\{\gamma \in \Gamma: \gamma U\cap U\neq \emptyset\}$ is finite. The collection of all wandering points is called the wandering set $\w(\Gamma,T)$. We can now state our main theorem. \begin{theorem}\label{thm:main_intro} Let $\ensuremath{\overline} X$ be the geodesic or the maximal Satake compactification (see Sections~\ref{sec:geo} and \ref{sec:satake}) and let $\w(\ensuremath{\Gamma},\ensuremath{\overline} X)$ be the wandering set for the action of $\ensuremath{\Gamma}$ on $\ensuremath{\overline} X$. If $\w(\ensuremath{\Gamma},\ensuremath{\overline} X)\cap\partial \ensuremath{\overline} X\neq \emptyset$, then there are no principal joint $L^2$-eigenvalues on $\Gamma\backslash X$. \end{theorem} Let us compare our theorem to the classical result of Patterson: First of all, for $\mathbb H$ the geodesic compactification and the Satake compactification coincide. Furthermore, if $\Gamma\subset SL(2,\ensuremath{\mathbb{R}})$ is geometrically finite, then it is well known that the following are equivalent: \begin{enumerate} \item $\mathrm{vol}(\Gamma\backslash \mathbb H) = \infty$ \item the limit set of $\Gamma$ is not the whole boundary $\Lambda(\Gamma)\neq \partial \mathbb H$ \item there is a non-empty open set of discontinuity $\Omega(\Gamma)\subset \partial \mathbb H$ on which $\Gamma$ acts properly discontinuously. \end{enumerate} The last point immediately implies the existence of a wandering point of the $\Gamma$ action on $\overline{ \mathbb H}$. In this sense our theorem boils down to the classical result of Patterson. Also the higher dimensional result of Lax-Phillips on $\mathbb H^n$ is easily recovered from our main theorem: If $\Gamma\subset PSO(1,n)$ is geometrically finite and $\Gamma\backslash \mathbb H^n$ of infinite volume, then at least one non-compact end has to be a funnel or a cusp of non-maximal rank, and the existence of such a non-compact end directly implies the wandering condition of Theorem~\ref{thm:main_intro}. As discrete subgroups on higher rank semisimple Lie groups are known to be constrained by strong rigidity results, it is a valid question whether there are interesting examples in higher rank which fulfill the wandering condition of Theorem~\ref{thm:main_intro}. We address this question in Section~\ref{sec:examples} and we will see that all images of Anosov representations fulfill our condition. This is a consequence of recent results on compactifications of Anosov symmetric spaces \cite{KL18,GGKW15} that are modeled on the Satake compactification. A further natural question is, whether one can also in the higher rank setting obtain the result by an assumption on the volume of the symmetric spaces instead of the dynamical assumption on the group action used in our theorem. We do not know a definitive answer. However, it should be noted, that there is so far no good notion of a geometrically finite group $\Gamma$ in higher rank. Without the assumption of geometric finiteness, to our best knowledge even for $SL(2,\mathbb R)$ it is unknown if infinite volume implies the absence of principal eigenvalues. \emph{Outline of the proof and the article}. Let $f\in C^ \infty(X)$ be the $\ensuremath{\Gamma}$-invariant lift of a joint eigenfunction for $\mathbb D(X)$ that is in $L^ 2(\ensuremath{\Gamma}\backslash X)$. The proof of Theorem~\ref{thm:main_intro} relies on the analysis of the asymptotic behavior of $f$ towards the boundary of the compactification at infinity. For the result on the geodesic compactification it suffices to study the asymptotics of $f$ into the regular directions. In order to obtain the result on the Satake compactification we are required to also analyze the behavior in singular directions along the different boundary strata of the Weyl chambers. In a first step we show that $f$ satisfies a certain growth condition called \emph{moderate growth}. This is done by elliptic regularity combined with coarse estimates on the injectivity radius (see Section~\ref{sec:modgrowth}). The knowledge of moderate growth then allows us (see Section~\ref{sec:absence}) to use asymptotic expansion results for $f$ by van den Ban-Schlichtkrull \cite{vdBanSchl87, vdBanSchl89LocalBD}. For the asymptotics into the regular directions, i.e. in the interior of the positive Weyl chamber $ \ensuremath{\mathfrak} a^ +\subset \ensuremath{\mathfrak} a$, it follows from \cite{vdBanSchl87} that the leading term for the expansion of $f(k\exp(tH)K)$ with $k\in K$ and $H\in \ensuremath{\mathfrak} a^ +$ is \[ \sum_{w\in W} p_w(k)e^ {(w\lambda-\rho)(tH)} \quad \text{as} \quad t\to \infty, \] where $W$ is the Weyl group, $\rho$ the usual half sum of roots and $\lambda\in i\mathfrak a^*$ a regular spectral parameter (for singular spectral parameters the formula becomes slightly more complicated but is still tractable). The wandering condition of $\ensuremath{\Gamma}$ acting on the geodesic compactification $X\cup X(\infty)$ yields a neighborhood of $U$ in $X\cup X(\infty)$ such that $f\in L^ 2(U)$. Combining this with the expansion and the description of such neighborhoods $U$ implies that all the boundary values $p_w$ vanish on an open subset of $K$. This implies, again by \cite{vdBanSchl87}, that $f=0$. The result for the Satake compactification follows the same strategy but involves more complicated expansions from \cite{vdBanSchl89LocalBD} that describe the asymptotic behavior into the singular directions along the different boundary strata of the Weyl chamber (Section~\ref{sec:satabsence}). Finally, in Section~\ref{sec:examples} we provide some examples of higher rank locally symmetric spaces that fulfill the wandering condition of Theorem~\ref{thm:main_intro}. In particular, we show that all quotients by Anosov subgroups fulfill the assumption. \emph{Acknowledgement.} We thank Valentin Blomer for his suggestion to study this question and for numerous stimulating discussions. We furthermore thank Joachim Hilgert, Lizhen Ji, Fanny Kassel, Michael Magee, Werner Müller and Beatrice Pozzetti for discussions and advice to the literature. This work has received funding from the Deutsche Forschungsgemeinschaft (DFG) (Grant No. WE 6173/1-1 Emmy Noether group “Microlocal Methods for Hyperbolic Dynamics”) \section{Preliminaries} \subsection{Symmetric spaces}\label{sec:notation} In this section we fix the notation for the present article. Let $G$ be a real semisimple non-compact Lie group with finite center and with Iwasawa decomposition $G=KAN$. Furthermore, let $M\coloneqq Z_K(A)$ be the centralizer of $A$ in $K$. We denote by $\ensuremath{\mathfrak} g, \ensuremath{\mathfrak} a, \ensuremath{\mathfrak} n, \ensuremath{\mathfrak} k,\ensuremath{\mathfrak} m$ the corresponding Lie algebras. We have a $K$-invariant inner product on $\ensuremath{\mathfrak} g$ that is induced by the Killing form and the Cartan involution. We futher have the orthogonal Bruhat decomposition $\ensuremath{\mathfrak} g =\ensuremath{\mathfrak} a \oplus \ensuremath{\mathfrak} m \oplus \bigoplus _{\alpha\in\Sigma} \ensuremath{\mathfrak} g_\alpha$ into root spaces $\ensuremath{\mathfrak} g_\alpha$ with respect to the $\ensuremath{\mathfrak} a$-action via the adjoint action $\ad$. Here $\Sigma\subseteq \ensuremath{\mathfrak} a^\ast$ is the set of restricted roots. Denote by $W$ the Weyl group of the root system of restricted roots. Let $n$ be the real rank of $G$ and $\Pi$ (resp. $\Sigma^+$) the simple (resp. positive) system in $\Sigma$ determined by the choice of the Iwasawa decomposition. Let $m_\alpha \coloneqq \dim_\ensuremath{\mathbb{R}} \ensuremath{\mathfrak} g_\alpha$ and $\rho \coloneqq \frac 12 \Sigma_{\alpha\in \Sigma^+} m_\alpha \alpha$. Let $\ensuremath{\mathfrak} a_+ \coloneqq \{H\in \ensuremath{\mathfrak} a\mid \alpha(H)>0 \,\forall \alpha\in\Pi\}$ denote the positive Weyl chamber. If $\ensuremath{\overline} {A^+} \coloneqq \exp (\ensuremath{\overline} {\ensuremath{\mathfrak} a_+})$, then we have the Cartan decomposition $G=K\ensuremath{\overline} {A ^+}K$. The main object of our study is the symmetric space $X=G/K$ of non-compact type. On $X$ we have the integral formula \begin{align}\label{eq:intKAK} \int_{X} f(x)dx=\int_K\int_{\ensuremath{\mathfrak} a_+} f(k\exp(H)) \prod_{\alpha\in\Sigma^+} \sinh(\alpha(H))^{m_\alpha} dHdk. \end{align} (see \cite[Ch.~I Theorem~5.8]{gaga}). \subsection{Invariant differential operators}\label{sec:harishchandra} Let $\mathbb D(G/K)$ be the algebra of \emph{$G$-invariant differential operators} on $G/K$, i.e. differential operators commuting with the left translation by elements $g\in G$. Then we have an algebra isomorphism $\HC\colon \mathbb D(G/K)\to \text{Poly}(\ensuremath{\mathfrak} a^\ast)^W$ from $\mathbb D(G/K)$ to the $W$-invariant complex polynomials on $\ensuremath{\mathfrak} a^\ast$ which is called the \emph{Harish-Chandra homomorphism} (see \cite[Ch.~II~Theorem 5.18]{gaga}). For $\lambda\in \ensuremath{\mathfrak} a^\ast_\ensuremath{\mathbb{C}}$ let $\chi_\lambda$ be the character of $\mathbb D(G/K)$ defined by $\chi_\lambda(D)\coloneqq \HC(D)(\lambda)$. Obviously, $\chi_\lambda= \chi_{w\lambda}$ for $w\in W$. Furthermore, the $\chi_\lambda$ exhaust all characters of $\mathbb D(G/K)$ (see \cite[Ch.~III Lemma~3.11]{gaga}). We define the space of joint eigenfunctions $$E_\lambda \coloneqq\{f\in C^\infty(G/K)\mid Df = \chi_\lambda (D) f \quad \forall D\in \mathbb D(G/K)\}.$$ Note that $E_\lambda$ is $G$-invariant. Let $\ensuremath{\Gamma}\leq G$ be a torsion-free discrete subgroup. Since $D\in \mathbb D(G/K)$ is $G$-invariant, it descends to a differential operator ${}_\ensuremath{\Gamma} D$ on the locally symmetric space $\ensuremath{\Gamma}\backslash G/K$. Therefore, the left $\ensuremath{\Gamma}$-invariant functions of $E_\lambda$ (denoted by ${}^\ensuremath{\Gamma} E_\lambda$) can be identified with joint eigenfunctions on $\ensuremath{\Gamma}\backslash G/K$ for each ${}_\ensuremath{\Gamma} D$: $${}^\ensuremath{\Gamma} E_\lambda = \{f\in C^\infty(\ensuremath{\Gamma}\backslash G /K)\mid {}_\ensuremath{\Gamma} D f = \chi_\lambda (D) f \quad \forall \, D\in \mathbb D(G/K)\}.$$ The goal is to show that $L^2(\ensuremath{\Gamma}\backslash G/K)\cap {}^\ensuremath{\Gamma} E_\lambda =\{0\}$ for $\lambda\in i\ensuremath{\mathfrak} a^\ast$ and certain discrete subgroups $\ensuremath{\Gamma}$. Then $$\sigma(\ensuremath{\Gamma}\backslash X)\coloneqq\{\lambda\in\ensuremath{\mathfrak} a^ \ast_\ensuremath{\mathbb{C}}\mid L^2(\ensuremath{\Gamma}\backslash G/K)\cap {}^\ensuremath{\Gamma} E_\lambda \neq\{0\}\}$$ has the property that the set of principal eigenvalues $\sigma(\ensuremath{\Gamma}\backslash X)\cap i\ensuremath{\mathfrak} a^ \ast$ is empty. \subsection{Geodesic compactification}\label{sec:geo} Let $X$ be a simply connected and non-positively curved Riemannian manifold. \begin{definition}[{\cite[Section I.2.2]{BJ}}] Two (unit speed) geodesics $\ensuremath{\gamma}_1,\ensuremath{\gamma}_2$ are equivalent if $\limsup_{t\to \infty} d(\ensuremath{\gamma}_1(t),\ensuremath{\gamma}_2(t))<\infty$. The space $X(\infty)$ is the factor space of all geodesics modulo this equivalence relation. The union $X\cup X(\infty)$ is called \emph{geodesic compactification}. The topology on $X\cup X(\infty)$ is given as follows: For $[\ensuremath{\gamma}]\in X(\infty)$ the intersection with $X$ of a fundamental system of neighborhoods is given by $C(\ensuremath{\gamma}, \varepsilon, R) = C(\ensuremath{\gamma},\varepsilon)\setminus B(R)$ where $$C(\ensuremath{\gamma},\epsilon)=\{x\in X\mid\text{the angle between $\ensuremath{\gamma}$ and the geodesic from $x_0$ to $x$ is less than $\varepsilon$}\}$$ and $B(R)$ is the ball of radius $R$ centered at some base point $x_0\in X$. This topology is Hausdorff and compact. \end{definition} The space $X(\infty)$ can be canonically identified with the unit sphere in the tangent space at the base point $x_0 \in X$. If $\exp \colon T_{x_0} X\to X$ is the (Riemannian) exponential map at $x_0$, then a representative of the equivalence class of geodesics corresponding to a unit vector $Y\in T_{x_0} X$ is given by the geodesic $t\mapsto \exp(tY)$. This identification yields the neighborhoods $C(Y_0,\varepsilon,R) = \{\exp{tY}\mid t>R, \cos(\langle Y,Y_0\rangle) < \varepsilon\}$. Let us return to the setting where $X=G/K$ is a symmetric space of non-compact type, then $X$ is simply connected and non-positively curved. Hence, the geodesic compactification of $X$ is defined and we have the following proposition. \begin{proposition}[{\cite[Proposition I.2.5]{BJ}}] The action of $G$ on $X$ extends to a continuous action on $X\cup X(\infty)$. \end{proposition} \subsection{Maximal Satake compactification}\label{sec:satake} In this section we introduce a different compactification for the symmetric space $X$. We will need the following notion of standard parabolic subgroups. For $I\subsetneq \Pi$ let $\ensuremath{\mathfrak} a_I\coloneqq\bigcap_{\alpha\in I} \ker \alpha$, $\ensuremath{\mathfrak} a^I\coloneqq \ensuremath{\mathfrak} a_I^\perp$, $\ensuremath{\mathfrak} n_I\coloneqq\bigoplus_{\alpha\in \Sigma^+\setminus\langle I\rangle} \ensuremath{\mathfrak} g_\alpha$ and $\ensuremath{\mathfrak} m_I \coloneqq \ensuremath{\mathfrak} m\oplus \ensuremath{\mathfrak} a^I \oplus\bigoplus _{\alpha\in\langle I\rangle} \ensuremath{\mathfrak} g_\alpha$. Define the subgroups $A_I\coloneqq\exp \ensuremath{\mathfrak} a_I$, $N_I\coloneqq\exp \ensuremath{\mathfrak} n_I$ and $M_I\coloneqq M\langle\exp\ensuremath{\mathfrak} m_I\rangle$. Then $P_I\coloneqq M_IA_IN_I$ is the standard parabolic subgroup for the subset $I$. Let $\ensuremath{\mathfrak} a_{I,+} \coloneqq \{H\in \ensuremath{\mathfrak} a_I\mid \alpha (H)>0\,\forall \alpha\in \Pi\setminus I\}$. The maximal Satake compactification $\ensuremath{\overline} X^{\max}$ is the $G$-compactification of $X$ (i.e. a compact Hausdorff space containing $X$ as an open dense subset such that the $G$-action extends continuously from $X$ to the compactification) with the orbit structure $\ensuremath{\overline} X^{\max} = X \cup \bigcup_{I\subsetneq \Pi} Gx_I$ with $\operatorname{Stab}(x_I)=N_IA_I(M_I\cap K)$. The topology can be described as follows: Since $G = K\ensuremath{\overline} {A_+} K$ and $K$ is compact, it suffices to consider sequences $\exp H_n$, $H_n\in \ensuremath{\overline} {\ensuremath{\mathfrak} a_+}$. Such a sequence by definition converges iff $\alpha(H_n)$ converges in $\ensuremath{\mathbb{R}}\cup\{\infty\}$ for all $\alpha\in \Pi$. If this is the case, to determine the limit, let $I=\{\alpha\in \Pi \mid \lim\alpha(H_n)<\infty \}$ and $H_\infty\in \ensuremath{\overline}{\ensuremath{\mathfrak} a^I_+}$ such that $\alpha(H_\infty)=\lim\alpha(H_n)$ for $\alpha\in I$. Then $\exp H_n\to \exp (H_\infty)x_I$. The intersection with $X$ of a fundamental system of neighborhoods of $k\exp(H_\infty)x_I$ with $k\in K, H_\infty\in {\ensuremath{\mathfrak} a^I_+}$ is given by $$V\exp\{H\in \ensuremath{\overline}{\ensuremath{\mathfrak} a_+}\mid |\alpha(H)-\alpha(H_\infty)|< \varepsilon,\alpha\in I, \alpha(H)>R,\alpha\not\in I\}x_0,$$ where $V$ is a fundamental system of neighborhoods of $k$ in $K$, $\varepsilon\searrow 0$, $R\nearrow \infty$. If $H_\infty\in \ensuremath{\overline}{\ensuremath{\mathfrak} a^I_+}$, let $J=\{\alpha\in I\mid \alpha(H_\infty)=0\}$. Then the intersection with $X$ of a fundamental system of neighborhoods of $k\exp(H_\infty)x_I$ with $k\in K$ is given by $$V(K\cap M_J) \exp\{H\in \ensuremath{\overline}{\ensuremath{\mathfrak} a_+}\mid |\alpha(H)-\alpha(H_\infty)|< \varepsilon, \alpha\in I, \alpha(H)>R,\alpha\not \in I\}x_0,$$ where $V,\varepsilon,R$ are as above. Note that usually one defines the Satake compactification in a different way (see e.g. \cite[Ch.~I.4]{BJ}). Namely, let $\tau\colon G\to PSL(n,\ensuremath{\mathbb{C}})$ be an irreducible faithful projective representation such that $\tau(K)\subseteq PSU(n)$. The closure in the projective space of Hermitian matrices of the image of the embedding of $X$ given by $gK\mapsto\ensuremath{\mathbb{R}} (\tau(g)\tau(g)^ \ast)$ is then called Satake compactification. It only depends on the highest weight $\chi_\tau$ of $\tau$. If $\chi_\tau$ is contained in the interior of the Weyl chamber, then this compactification is isomorphic to the maximal Satake compactification defined above. It is maximal in the sense that it dominates every other Satake compactification $\ensuremath{\overline} X^ S$ (i.e. there is a continuous $G$-equivariant map $\ensuremath{\overline} X^{\max}\to \ensuremath{\overline} X^ S$). Since we only need the description of neighborhoods and the orbit structure we chose to introduce $\ensuremath{\overline} X^ {\max}$ this way. \section{Moderate growth}\label{sec:modgrowth} In this section we show that on a locally symmetric space each joint eigenfunction which is $L^2$ satisfies a growth condition in the following sense. \begin{definition} \begin{enumerate}[(i)] \item A function $f\colon X\to\ensuremath{\mathbb{C}}$ is called \emph{function of moderate growth} if there exist $r\in \ensuremath{\mathbb{R}}, C>0$ such that $$|f(x)|\leq C e^{rd(x,x_0)}$$ for all $x\in X$. \item For $\lambda\in \ensuremath{\mathfrak} a_\ensuremath{\mathbb{C}}^ \ast$ the space $E_\lambda^\ast$ is the space of joint eigenfunction with moderate growth, i.e. $$E_\lambda^\ast = \{f\in E_\lambda\mid f \text{ has moderate growth}\}.$$ \end{enumerate} \end{definition} Let $\ensuremath{\Gamma}\leq G$ be a torsion-free discrete subgroup. \begin{theorem}\label{thm:modgrowth} Let $f\in {}^\ensuremath{\Gamma} E_\lambda\cap L^2(\ensuremath{\Gamma}\backslash G/K)$. Then $f$ has moderate growth. \end{theorem} The proof uses Sobolev embedding and the following estimate on the injectivity radius. \begin{proposition}[{see \cite[Thm. 4.3]{CGT}}] Let $(M,g)$ be a complete Riemannian manifold such that the sectional curvature $K_M$ satisfies $K_M\leq K$ for constant $K\in\ensuremath{\mathbb{R}}$. Let $0< r <\pi/4\sqrt K$ if $K >0$ and $r\in (0,\infty)$ if $K\leq 0$. Then the injectivity radius $\mathrm{inj}(p)$ at $p$ satisfies $$\mathrm{inj}(p)\geq \frac{r\mathrm{Vol} (B_M(p,r))}{\mathrm{Vol} (B_M(p,r)) + \mathrm{Vol}_{T_pM}(B_{T_pM}(0,2r))},$$ where $\mathrm{Vol}_{T_pM}(B_{T_pM}(0,2r))$ denotes the volume of the ball of radius $2r$ in $T_pM$, where both the volume and the distance function are defined using the metric $g^\ast:= exp^\ast_p g$, i.e. the pull-back of the metric $g$ to $T_pM$ via the exponential map. \end{proposition} For $M=\ensuremath{\Gamma}\backslash G/K$ we obtain that the injectivity radius decreases at most exponentially. \begin{proposition}\label{prop:injectivity} There are constants $C,s>0$ such that $$\mathrm{inj}_{\ensuremath{\Gamma}\backslash G /K}(\ensuremath{\Gamma} x)\geq C\ensuremath{^{-1}} e^{-sd(x,eK)}$$ for every $x\in G/K$. \end{proposition} \begin{proof} Since $\ensuremath{\Gamma}\backslash G/K$ is of non-positive curvature we can apply the above proposition for every $r> 0$. Note that $\exp\colon T_pM\to M$ is the universal cover of $M$ and therefore $\mathrm{Vol}_{T_{\ensuremath{\Gamma} x}M}(B_{T_{\ensuremath{\Gamma} x}M}(0,2r)) = \mathrm{Vol}_{G/K}(B_{G/K}(x,2r)) = \mathrm{Vol}_{G/K}(B_{G/K}(x_0,2r)) \leq C e^{sr}$ for some constants $C,s$ independent of $x$, where $x_0$ is the base point $eK$ of $G/K$. Hence, $$\mathrm{inj}(\ensuremath{\Gamma} x)\geq r (1+\mathrm{Vol}_{T_{\ensuremath{\Gamma} x}M}(B_{T_{\ensuremath{\Gamma} x}M}(0,2r))/\mathrm{Vol} (B_M(\ensuremath{\Gamma} x,r)))\ensuremath{^{-1}}\geq r(1+ Ce^{sr}/\mathrm{Vol} (B_M(\ensuremath{\Gamma} x,r)))\ensuremath{^{-1}}$$ For $r=1+d(x,x_0)$ we have $B_M(\ensuremath{\Gamma} x,r)\supseteq B_M(\ensuremath{\Gamma} x_0,1)$ and therefore $$\mathrm{inj}(\ensuremath{\Gamma} x)\geq (1+d(x,x_0)) (1+ Ce^{s(1+d(x,x_0))}/\mathrm{Vol} (B_M(\ensuremath{\Gamma} x_0,1))\ensuremath{^{-1}} \geq (1+C'e^{sd(x,x_0)})\ensuremath{^{-1}}.$$ This finishes the proof. \end{proof} Let $m=\dim X$. We need the following lemma on the geodesic balls in $G/K$. \begin{lemma}\label{la:boxcounting} Fix $r>0$. There is a constant $C$ such that for every $x\in G/K$ and $\varepsilon > 0$ there is a finite set $A\subseteq B(x,r)$ such that $\bigcup_{a\in A} B(a,\varepsilon) \supseteq B(x,r)$ and $\#A\leq C \varepsilon^{-m}$. \end{lemma} \begin{proof} Let $a_1=x$ and choose inductively $a_{i+1} \in B(x,r)\setminus \bigcup_{j=0}^i B(a_j,\varepsilon)$ if the latter is non-empty. This yields a finite set $A=\{a_1,\ldots,a_N\}$ (since $\overline {B(x,r)}$ is compact) such that $B(x,r+\varepsilon)\supseteq \bigcup_{j=0}^N B(a_j,\varepsilon)\supseteq B(x,r)$ and $B(a_j,\varepsilon/2)$ are pairwise disjoint. It follows that $\mathrm{Vol}(B(x,r+\varepsilon))\geq \sum_i \mathrm{Vol}(B(a_i,\varepsilon/2) = \# A \cdot \mathrm{Vol}(B(x,\varepsilon/2))$ and therefore $\# A\leq \frac C {\mathrm{Vol}(B(x,\varepsilon/2))}$. The lemma follows from the fact that the volume is independent from the center and decreases like $\varepsilon^m$ as $\varepsilon \to 0$. \end{proof} We can now combine Proposition~\ref{prop:injectivity} with Sobolev embedding to prove Theorem~\ref{thm:modgrowth}. \begin{proof}[Proof of Theorem~\ref{thm:modgrowth}] Since $B(x_0,1)$ is relatively compact, there exists a constant $C$ such that $$\sup_{x\in B(x_0,1)} |f(x)| \leq C \|(\Delta +1)^{m/4+\varepsilon}f\|_{L^2(B(x_0,1))} = C(\chi_\lambda(\Delta)+1)^{m/4+\varepsilon} \|f\|_{L^2(B(x_0,1))}$$ by ellipticity of the Laplace operator $\Delta$ on $G/K$ and the Sobolev embedding $H^{m/2+\varepsilon}(B(x_0,1))\hookrightarrow C(B(x_0,1))$. By $G$-invariance of $\Delta$ and $d$ the same holds true for $x_0$ replaced by an arbitrary point $x\in X$. In particular, $$|f(x)|\leq C(\lambda) \|f\|_{L^2(B(x,1))}.$$ By Proposition~\ref{prop:injectivity} there are constants $C,s>0$ independent of $x$ such that $\mathrm{inj}_{\ensuremath{\Gamma}\backslash G/K}(\ensuremath{\Gamma} y)\geq C\ensuremath{^{-1}} e^{-sd(x,eK)}$ for every $y\in B(x,1)$. Let $\varepsilon(x) \coloneqq \frac 1 C e^{-sd(x,eK)}$. Then there is a finite set $A(x)\subseteq B(x,1)$ such that $\bigcup_{a\in A(x)} B(a,\varepsilon(x))$ covers $ B(x,1)$ and $\#A(x)\leq C' \varepsilon(x)^{-m}$ by Lemma~\ref{la:boxcounting}. Hence, $$\|f\|_{L^2(B(x,1))}^2\leq \sum_{a\in A(x)} \|f \|_{L^2(B(a,\varepsilon(x)))}^2$$ Since $\mathrm{inj}_{\ensuremath{\Gamma}\backslash G/K}(\ensuremath{\Gamma} a)\geq \varepsilon(x)$ we have $\|f \|_{L^2(B(a,\varepsilon(x)))}\leq \|f\|_{L^2(\ensuremath{\Gamma}\backslash G/K)}$ for $a\in A(x)$. Therefore, \begin{align*} |f(x)|&\leq C(\lambda) \|f\|_{L^2(\ensuremath{\Gamma}\backslash G/K)} \sqrt{\#A(x)}\\ &\leq C(\lambda) \|f\|_{L^2(\ensuremath{\Gamma}\backslash G/K)} C'^{1/2} \varepsilon(x)^{-m/2}\\ &= C(\lambda) \|f\|_{L^2(\ensuremath{\Gamma}\backslash G/K)} C'^{1/2}C^{m/2} e^{msd(x,x_0)/2}. \qedhere \end{align*} \end{proof} \begin{remark} In the case of locally symmetric spaces of finite volume there is a different argument showing Theorem~\ref{thm:modgrowth}: If we lift $f$ to a function on $G$ which we also call $f$, then there is smooth compactly supported function $\alpha$ on $G$ such that $f=f\ast \alpha$ (see~\cite[Theorem~1]{HC66}). Then one easily shows that $|f(\ensuremath{\Gamma} x)|\leq C\|f\|_{L^1(\ensuremath{\Gamma}\backslash G/K)} e^{sd(x,x_0)}$ using simple estimates for lattice point counting. Since $L^2\subseteq L^1$ for spaces of finite volume, we can deduce moderate growth for $f$. Unfortunately, this argument does not work for infinite volume locally symmetric spaces since a pointwise bound including the $L^2$-norm of $f$ would need much better counting estimates. \end{remark} \section{Absence of imaginary values in the $L^2$-spectrum}\label{sec:absence} We introduce the space of smooth vectors in $E_\lambda^\ast$. It is precisely the space of joint eigenfunction with smooth boundary values (see \cite{vdBanSchl87}). \begin{definition} $$E_\lambda^\infty = \{f\in E_\lambda\mid \exists\, r \,\forall\, u\in\ensuremath{\mathcal} U(\ensuremath{\mathfrak} g)\,\colon |(uf)(x)|\leq C e^{r d(x,x_0)}\}$$ \end{definition} \subsection{Geodesic compactification}\label{sec:geoabsence} In this section we want to prove the following theorem. \begin{theorem}\label{thm:smoothsquarevanish} Let $f\in E_\lambda^\ast$, $\lambda\in i\ensuremath{\mathfrak} a^\ast$, such that $f$ is square-integrable on $C(Y_0, \varepsilon,R)$ for some $\varepsilon, R, Y_0$. Then $f=0$. \end{theorem} Let $X(\lambda)\coloneqq \{w\lambda-\rho-\mu\mid w\in W, \mu \in \ensuremath{\mathbb{N}}_0\Pi\}$. We will use the following asymptotic expansion for functions in $E_\lambda^\infty$. \begin{theorem}[{\cite[Thm~3.5]{vdBanSchl87}}]\label{thm:expansion} For each $f\in E_\lambda^\infty$, $g\in G$, and $\xi \in X(\lambda)$ there is a unique polynomial $p_{\lambda,\xi}(f,x)$ on $\ensuremath{\mathfrak} a$ such that $$f(g\exp(tH))\sim\sum_{\xi\in X(\lambda)} p_{\lambda,\xi}(f,g,tH) e^{t\xi(H)}$$ at every $H_0\in \ensuremath{\mathfrak} a_+$, i.e. for every $N$ there exist a neighborhood $U$ of $H_0$ in $\ensuremath{\mathfrak} a_+$, a neighborhood $V$ of $x$ in $G$, $\varepsilon>0$, $C>0$ such that $$\left|f(y\exp(tH)) - \sum_{\Re \xi(H_0)\geq -N} p_{\lambda,\xi}(f,y,tH) e^{t\xi(H)}\right| \leq C e^{(-N-\varepsilon)t}$$ for all $y\in V, H\in U$, $t\geq 0$. \end{theorem} \begin{remark} The uniformity in $x$ is not stated in \cite{vdBanSchl87} but it follows from (6.18) therein. \end{remark} \begin{figure} \centering \begin{minipage}{.5\textwidth} \centering \frame{\includegraphics[width=.8\linewidth, trim=11.5cm 1cm 10cm 6cm,clip]{A2_exponents.pdf}}\end{minipage}\begin{minipage}{.5\textwidth} \centering \frame{ \includegraphics[width=.8\linewidth,trim=11.5cm 1cm 10cm 6cm,clip]{A2_finiteexpansion.pdf}} \end{minipage} \caption{Real part of the exponents of the asymptotic expansion from Theorem~\ref{thm:expansion} for $G=SL(3,\ensuremath{\mathbb{R}})$} \label{fig:exponentsofexpansion} \end{figure} \begin{proof}First, we will consider the case $f\in E_\lambda^ \infty$. By continuity there is a unit vector $H_0 \in \ensuremath{\mathfrak} a_+$, a neighborhood $U$ of $H_0$ in the unit sphere of $\ensuremath{\mathfrak} a$, and an open set $V$ in $K$ such that $$\Omega=\left\{k\exp(H)\colon k\in V, \frac{H}{\|H\|}\in U,\|H\|>R\right \}\subseteq C(Y_0,\varepsilon, R).$$ Let $N=\rho(H_0)$ such that w.l.o.g. \begin{align}\label{eq:approximation} |f(k\exp(H)) - \sum_{w\in W} p_{\lambda,w\lambda-\rho}(f,k,H) e^{(w\lambda-\rho)(H)}| \leq C e^{(-\rho(H_0)-\varepsilon)\|H\|} \end{align} for all $k\in V, \frac H{\|H\|}\in U$. We use the integral formula \eqref{eq:intKAK} and observe that \begin{align*} \int_{(R,\infty)U} &e^{-2(\rho(H_0)+\varepsilon)\|H\|}\prod_{\alpha\in\Sigma^+} \sinh(\alpha(H))^{m_\alpha} dH\\ \leq& \int_{(R,\infty)U} e^{-2(\rho(H_0)+\varepsilon)\|H\|}e^{2\rho(H)}dH\leq \int_{(R,\infty)U} e^{2(\rho(\frac H{\|H\|}-H_0)-\varepsilon)\|H\|}dH \end{align*} which is finite after shrinking $U$ such that $\rho(\frac H{\|H\|}-H_0)<\varepsilon$ for $H\in U$. Consequently, the right hand side of \eqref{eq:approximation} and therefore also the left hand side of is square integrable on $\Omega$. Since $f$ is $L^2$ and the approximation \eqref{eq:approximation} holds, $$\left|\sum_{w\in W} p_{\lambda,w\lambda-\rho}(f,k,H) e^{(w\lambda-\rho)(H)}\right|^2 \prod_{\alpha\in\Sigma^+} \sinh(\alpha(H))^{m_\alpha}$$ is integrable on $V\times (R,\infty)U$. Hence, $\left|\sum_{w\in W} p_{\lambda,w\lambda-\rho}(f,k,H) e^{(w\lambda-\rho)(H)}\right|^2 \prod_{\alpha\in\Sigma^+} \sinh(\alpha(H))^{m_\alpha}$ is integrable on $(R,\infty)U$ for almost every $k\in V$. Since $\sinh(x)\geq e^x/4$ for $x\geq \frac 12 \log 2$, $$\left|\sum_{w\in W} p_{\lambda,w\lambda-\rho}(f,k,H) e^{(w\lambda-\rho)(H)}\right|^2 e^{2\rho(H)}=\left|\sum_{w\in W} p_{\lambda,w\lambda-\rho}(f,k,H) e^{w\lambda(H)}\right|^2$$ is integrable on $(R,\infty)U$ for $R$ large enough. This is only possible if $p_{\lambda,w\lambda-\rho}(f,k)$ vanishes on $\ensuremath{\mathfrak} a$ for every $w\in W$ by \cite[Lemma~8.50]{Kna86}. Since $p_{\lambda,w\lambda-\rho}(f,\bigcdot)$ is smooth it vanishes identically on $V$. Using now \cite[Lemma~8.5 and 8.7]{vdBanSchl87} we see that this expression vanishes also on $VAN$, in particular on an open subset of $G$. By \cite[Corollary~4.2]{vdBanSchl89LocalBD} this implies $f=0$. It remains to show that the statement also holds for $f\in E_\lambda^\ast$. Since $C(Y_0,\varepsilon,R)$ is a fundamental system of neighborhoods of $Y_0$ in the geodesic compactification and $G$ acts continuously on $X\cup X(\infty)$, there is a neighborhood $ V$ of $e$ in $G$ and $\varepsilon ', R'$ such that $V\ensuremath{^{-1}} C(Y_0,\varepsilon',R')\subseteq C(Y_0,\varepsilon,R)$. Let $\varphi_n$ be an approximate identity on $G$ with $\operatorname{supp} \varphi_n\subseteq V$, i.e. $\varphi_n \in C_c^\infty(G)$ is non-negative with $\int_G\varphi_n(g) dg =1$ and $\operatorname{supp}(\varphi_n)$ shrinks to $\{e\}$. We consider $(\varphi_n\ast f)(x)=\int_G \varphi_n(g)f(g\ensuremath{^{-1}} x)dg$. Obviously, $\varphi_n\ast f\in E_\lambda^\infty$ since $L_x R_y(\varphi_n\ast f)=(L_x\varphi_n)\ast (R_yf), x,y\in G$. \begin{lemma}\label{la:conv_square_int} $\varphi_n\ast f$ is square-integrable on $C(Y_0, \varepsilon',R')$. \end{lemma} Combining the already established case $f\in E_\lambda^\infty$ with Lemma~\ref{la:conv_square_int} we infer that $\varphi_n\ast f=0$ for all $n$ and therefore $f=0$. This completes the proof. \end{proof} \begin{proof}[Proof of {Lemma~\ref{la:conv_square_int}}] Abbreviate $C'=C(Y_0, \varepsilon',R')$ and $C=C(Y_0, \varepsilon',R')$. It suffices to show that \begin{align*} \left|\int_{C'} h(x)(\varphi_n\ast f)(x)dx\right|\leq B\|h\|_{L^2(C')} \end{align*} for $h\in C_c(C')$ with a constant $B$ independent of $h$. Let us write $|h(x)\varphi_n(g)f(g\ensuremath{^{-1}} x)| =(|h|^2(x)\varphi_n(g))^{1/2} (|f|^2(g\ensuremath{^{-1}} x)\varphi_n(g))^{1/2}$ and use the Cauchy-Schwarz inequality of $L^2(V\times C')$ to obtain \begin{align*} \left|\int_{C'} h(x)(\varphi_n\ast f)(x)dx\right|&\leq \int _V \int_{C'}|h(x)\varphi_n(g)f(g\ensuremath{^{-1}} x)|dx dg \\ &\leq \left(\int_{V}\int_{C'} |h|^2(x) \varphi_n(g) dx dg \int_V \int_{C'} |f|^2(g\ensuremath{^{-1}} x) \varphi_n(g) dx dg\right)^{1/2}\\ &\leq \|h\|_{L^2(C')} \left(\int_V \int_{C} |f|^2(x) \varphi_n(g) dx dg\right)^{1/2}\\ &= \|h\|_{L^2(C')} \|f\|_{L^2(C)} \end{align*} where we used $V\ensuremath{^{-1}} C'\subseteq C$ in the last inequality. This finishes the proof. \end{proof} \subsection{Maximal Satake compactification}\label{sec:satabsence} In this section we prove a statement analogous to Theorem~\ref{thm:smoothsquarevanish} for the maximal Satake compactification. First of all we remark that each neighborhood of an element in the orbit $Gx_\emptyset\subseteq \ensuremath{\overline} X^ {\max}$ contains a neighborhood $C(Y_0,\varepsilon, R)$. Hence, we have the following proposition. \begin{proposition} Let $f\in E_\lambda^\ast$, $\lambda\in i\ensuremath{\mathfrak} a^\ast$, such that $f$ is square-integrable in some neighborhood of an element in $Gx_\emptyset\subseteq \ensuremath{\overline} X^ {\max}$. Then $f=0$. \end{proposition} The goal is to prove this statement for general neighborhoods in $\ensuremath{\overline} X^{\max}$. \begin{theorem}\label{thm:satakesquarevanish} Let $f\in E_\lambda^\ast$, $\lambda\in i\ensuremath{\mathfrak} a^\ast$, such that $f$ is square-integrable in some neighborhood of an element $x_\infty \in \partial X^ {\max}$. Then $f=0$. \end{theorem} \begin{proof} By the same reasoning as in the proof of Theorem~\ref{thm:smoothsquarevanish} we can assume $f\in E_\lambda^\infty$. Moreover, we can assume that $x_\infty=k \exp(H_\infty)x_I$ with $k\in K$ and $H_\infty\in {\ensuremath{\mathfrak} a^I_+}$ (instead of $H_\infty\in \ensuremath{\overline}{\ensuremath{\mathfrak} a^I_+}$) since every neighborhood of $k\exp(H_\infty)x_I$ contains an element $k'\exp(H_\infty')x_I$ with $H_\infty'\in \ensuremath{\mathfrak} a^I_+$. Let $\Omega=V\exp (U)x_0\subseteq X$ with $U\coloneqq \{H\in \ensuremath{\overline}{\ensuremath{\mathfrak} a_+}\mid |\alpha(H)-\alpha(H_\infty)|< \varepsilon,\alpha\in I, \alpha(H)>R,\alpha\not\in I\}$, so that $\Omega$ is the intersection of a neighborhood of $x_\infty$ with the interior of $\ensuremath{\overline} X^ {\max}$. Define $U^I\coloneqq \{H^I\in\ensuremath{\mathfrak} a^I\mid |\alpha(H^I)-\alpha(H_\infty)|<\varepsilon, \alpha\in I\}$ which is a bounded open set in $\ensuremath{\mathfrak} a^I$ since the set of linear forms $I$ restricted to $\ensuremath{\mathfrak} a^I$ is linear independent. W.l.o.g. $U^I\subseteq \ensuremath{\mathfrak} a^I_+$ has positive distance to the boundaries. Let $U_I\coloneqq \{H_I\in \ensuremath{\mathfrak} a_I\mid \alpha(H_I)>C, \alpha\not\in I\}\subseteq \ensuremath{\mathfrak} a_{I,+}$ so that $U_I+U^I\subseteq U$ for $C$ large enough. \begin{figure} \includegraphics[width=.5\textwidth,trim=5cm 3cm 13cm 3cm, clip]{A2_Satake.pdf} \caption{Decomposition of $U$ for $G=SL(3,\ensuremath{\mathbb{R}})$ and $I=\{\alpha_1\}$.} \end{figure} As in Theorem~\ref{thm:smoothsquarevanish} we use the integral formula \eqref{eq:intKAK} to obtain $$\int_{U\subseteq \ensuremath{\mathfrak} a_+} |f|^2(k\exp(H))\prod \sinh(\alpha(H))^{m_\alpha}dH<\infty$$ for almost every $k\in V$. Therefore, $$\int_{U_I\subseteq \ensuremath{\mathfrak} a_{I,+}} |f|^2(k\exp(H^I)\exp(H_I))\prod \sinh(\alpha(H_I+H^I))^{m_\alpha}dH_I<\infty$$ for almost every $k\in V$ and $H^I\in U^I\subseteq \ensuremath{\mathfrak} a^I$ (with suitable Lebesgue measures on $\ensuremath{\mathfrak} a_I$ and $\ensuremath{\mathfrak} a^I$). The property that $U^I\subseteq \ensuremath{\mathfrak} a^I_+$ has positive distance to the boundaries implies that $\alpha(H_I+H^I)>\varepsilon$ and hence $$\prod_{\alpha\in \Sigma^+} \sinh(\alpha(H_I+H^I))^{m_\alpha}\geq C e ^ {2\rho(H_I)},\quad H_I\in U_I,H^I\in U^I.$$ Therefore, $|f|^2(k\exp(H^I)\exp(H_I))e^{2\rho(H_I)}$ is integrable on $U_I$. Similarly to the proof of Theorem~\ref{thm:smoothsquarevanish} we use an asymptotic expansion for $f$, but this time we have to consider asymptotics along the boundary of the positive Weyl chamber instead of regular directions. \begin{theorem}[{\cite[Thm~1.5]{vdBanSchl89LocalBD}}] There exists a finite set $S(\lambda,I)\subseteq \ensuremath{\mathfrak} a_I^\ast$ such that for each $f\in E_\lambda^\infty$, $g\in G$, and $\xi \in X(\lambda,I)= S(\lambda,I) - \ensuremath{\mathbb{N}}_0\Pi|_{\ensuremath{\mathfrak} a_I}$ there is a unique polynomial $p_{I,\xi}(f,x)$ on $\ensuremath{\mathfrak} a_I$ such that $$f(g\exp(tH_0))\sim\sum_{\xi\in X(\lambda,I)} p_{I,\xi}(f,g,tH_0) e^{t\xi(H_0)}$$ at every $H_0\in \ensuremath{\mathfrak} a_{I,+}$, i.e. for every $N$ there exist a neighborhood $U$ of $H_0$ in $\ensuremath{\mathfrak} a_{I,+}$, a neighborhood $V$ of $x$ in $G$, $\varepsilon>0$, $C>0$ such that $$\left |f(y\exp(tH)) - \sum_{\Re \xi(H_0)\geq -N} p_{I,\xi}(f,y,tH) e^{t\xi(H)}\right| \leq C e^{(-N-\varepsilon)t}$$ for all $y\in V, H\in U$, $t\geq 0$. \end{theorem} \begin{remark} The uniformity in $x$ is not stated in \cite{vdBanSchl89LocalBD} but it follows from Proposition~1.3 therein. \end{remark} Let $H_0\in \ensuremath{\mathfrak} a_{I,+}$, $\|H_0\|=1$. After shrinking we can assume that $$\left|f(k\exp(H^I)\exp(H_I)) - \sum_{\Re \xi(H_0)\geq -\rho(H_0)} p_{I,\xi}(f,k\exp(H^I),H_I) e^{\xi(H_I)}\right| \leq C e^{(-\rho(H_0)-\varepsilon)\|H_I\|}$$ for all $k\in V, H^I\in U^I$, and $\frac{H_I}{\|H_I\|}$ in some neighborhood $\tilde U_I$ of $H_0$ in $\ensuremath{\mathfrak} a_{I,+}$ such that $(R',\infty)\tilde U_I\subseteq U_I$. The error term $e^{(-\rho(H_0)-\varepsilon)\|H_I\|}$ satisfies $$e^{2(-\rho(H_0)-\varepsilon)\|H_I\|}e^{2\rho(H_I)}=e^{2(\rho(-H_0+\frac{H_I}{\|H_I\|}) -\varepsilon)\|H_I\|}\leq e^{-\varepsilon\|H_I\|}$$ if $\tilde U_I$ is sufficiently small. Since $e^{-\varepsilon\|H_I\|}$ is integrable on $(R',\infty)\tilde U_I$ the same is true for $$\left |\sum_{\Re \xi(H_0)\geq -\rho(H_0)} p_{I,\xi}(f,k\exp(H^I),H_I) e^{(\xi+\rho)(H_I)}\right |^2 .$$ Using \cite[Lemma~8.50]{Kna86} we obtain that $p_{I,\xi}(f,k\exp(H^I),H_I) = 0$ if $\Re (\xi+\rho)(H_I) \geq 0$ for almost every $k\in V$ and $H^I\in U^I$. Since $p_{I,\xi}(f,\bigcdot,H_I)$ is smooth, this holds for every $k\in V$ and $H^I\in U^I$. By \cite[Corollary~2.5]{vdBanSchl89LocalBD} the mapping $M_I\ni m\mapsto p_{I,\xi}(f,xm,H_I)$, $x\in G$, is real analytic. Therefore, $\ensuremath{\mathfrak} a^I\ni H^I\mapsto p_{I,\xi}(f,k\exp{H^I}, H_I)$ is real analytic as well and vanishes on the open set $U^I$ for $k\in V$, $\Re (\xi+\rho)(H_I)\geq 0$. Hence it vanishes on $\ensuremath{\mathfrak} a^I$ identically. In a last step of the proof we show that the vanishing of $p_{I,\xi}(f,k)$ for $\Re(\xi+\rho)(H_I)\geq 0$ implies that the expansion coefficients $p_{\lambda,\eta}(f,k)$ from Theorem~\ref{thm:expansion} vanish for all $\eta\in W\lambda-\rho$ and $k\in V$. For this purpose we use the following expansion for the polynomial $p_{I,\xi}$. \begin{proposition}[{\cite[Theorem~3.1]{vdBanSchl89LocalBD}}] Let $f\in E_\lambda^\infty, g\in G, $ and $\xi\in X(I,\lambda)$. \begin{enumerate} \item For every $H_I\in \ensuremath{\mathfrak} a_{I,+}$ and $H^I\in \ensuremath{\mathfrak} a^I_+$ the following asymptotic expansion holds: $$p_{I,\xi}(f,g\exp(tH^I),H_I)\sim \sum _{\eta \in w\lambda -\rho - \ensuremath{\mathbb{N}}_0\Pi, \eta|_{\ensuremath{\mathfrak} a_I}=\xi} p_{\lambda,\eta}(f,g,H_I+tH^I) e^{t\eta(H^I)}.$$ \item For all $\eta = w\lambda -\rho - \ensuremath{\mathbb{N}}_0\Pi$ with $\eta|_{\ensuremath{\mathfrak} a_I}\not\in X(\lambda,I)$ we have $p_{\lambda,\eta}(f,x)=0$. \end{enumerate} \end{proposition} Let $\eta=w\lambda-\rho$, $w\in W$, and $k\in V, H_I\in U_I$. If $\eta|_{\ensuremath{\mathfrak} a_I}\not \in X(I,\lambda)$, then $p_{\lambda,\eta}(f,k)=0$. If $\eta|_{\ensuremath{\mathfrak} a_I} = \xi \in X(I,\lambda)$, then $\Re(\xi+\rho)(H_I) = \Re w\lambda(H_I)=0\geq 0$. Therefore, $p_{I,\xi}(f,k\exp{H^I}, H_I)= 0$ for all $H^I\in\ensuremath{\mathfrak} a^I$ by the previous paragraph. It follows that the asymptotic expansion has every coefficient vanishing (see \cite[Lemma~3.2]{vdBanSchl87}), in particular $ p_{\lambda,\eta}(f,k,H_I+tH^I)=0$, $H_I\in U_I$, $H^I\in \ensuremath{\mathfrak} a^I$. Since $ p_{\lambda,\eta}(f,k)$ is a polynomial, this implies $p_{\lambda,\eta}(f,k)=0$. Hence in both cases $p_{\lambda,w\lambda-\rho}(f,k)=0$ for $k\in V$. Using now \cite[Lemma~8.5 and 8.7]{vdBanSchl87} we see that this expression vanishes also on $VAN$, in particular on an open set of $G$. By \cite[Corollary~4.2]{vdBanSchl89LocalBD} this implies $f=0$. \end{proof} \subsection{Proof of Theorem~\ref{thm:main_intro}}\label{sec:conclusion} Let $\ensuremath{\overline} X$ be one of the compactifications $X\cup X(\infty)$ or $\ensuremath{\overline} X^ {\max}$. Recall that the \emph{wandering set} $\w(\ensuremath{\Gamma},\ensuremath{\overline} X)$ is defined to be the points $x\in \ensuremath{\overline} X$ for which there is a neighborhood $U$ of $x$ such that $\ensuremath{\gamma} U\cap U\neq \emptyset$ for at most finitely many $\ensuremath{\gamma}\in \ensuremath{\Gamma}$. Clearly, $\w(\ensuremath{\Gamma},\ensuremath{\overline} X)$ is open, $\ensuremath{\Gamma}$-invariant and contains $X$. Theorem~\ref{thm:main_intro} is a simple consequence of Theorem~\ref{thm:modgrowth} combined with Theorem~\ref{thm:smoothsquarevanish}, respectively \ref{thm:satakesquarevanish}. \begin{proof}[Proof of Theorem~\ref{thm:main_intro}] Let $x\in \w(\ensuremath{\Gamma},\ensuremath{\overline} X) \cap \partial \ensuremath{\overline} X$. Hence, there is an open subset $U$ of $\ensuremath{\overline} X$ containing $x$ such that $\{\ensuremath{\gamma}\mid \ensuremath{\gamma} U\cap U\neq \emptyset\}$ contains $N\in \ensuremath{\mathbb{N}}$ elements. Let $\lambda\in i\ensuremath{\mathfrak} a^\ast$ and $f\in L^2(\ensuremath{\Gamma}\backslash X)$ a joint eigenfunction of $\mathbb D(X)$ for the character $\chi_\lambda$. Let $\ensuremath{\overline} f\in E_\lambda$ be $\ensuremath{\Gamma}$-invariant lift of $f$ to $X$. Then \begin{align*} \|\ensuremath{\overline} f\|^2_{L^2(U)} &= \int _U |\ensuremath{\overline} f|^2 = \int_{\ensuremath{\Gamma}\backslash X} \sum_{\ensuremath{\gamma}\in \ensuremath{\Gamma}} 1_U(\ensuremath{\gamma} y) |\ensuremath{\overline} f|^2(\ensuremath{\gamma} y) d (\ensuremath{\Gamma} y) = \int_{\ensuremath{\Gamma}\backslash X} \# \{\ensuremath{\gamma}\mid \ensuremath{\gamma} y\in U\} | f|^2(\ensuremath{\Gamma} y) d (\ensuremath{\Gamma} y)\\ &\leq N \|f\|^2_{L^2(\ensuremath{\Gamma}\backslash X)}<\infty. \end{align*} Hence, $f$ is $L^2$ on $U$ and $f$ is of moderate growth by Theorem~\ref{thm:modgrowth}. Using Theorem~\ref{thm:smoothsquarevanish} or \ref{thm:satakesquarevanish} finishes the proof. \end{proof} \section{Examples}\label{sec:examples} In this section we discuss three classes of examples that satisfy the wandering condition of Theorem~\ref{thm:main_intro}. As mentioned in the introduction the condition is satisfied for geometrically finite discrete subgroups of $PSO(n,1)$ of infinite covolume. \subsection*{Products} The most basic example is the case of products. Let $X=X_1\times X_2$ be the product of two symmetric spaces of non-compact type where $X_i = G_i/K_i$. Let $\Gamma\leq G_1\times G_2$ be a discrete torsion-free subgroup that is the product of two discrete torsion-free subgroups $\ensuremath{\Gamma}_i\leq G_i$. Then it is clear that the spectral theory of $\ensuremath{\Gamma}\backslash X$ is completely determined by the spectral theory of the two factors. In particular, since the algebra $\mathbb D(G/K)$ is generated by $\mathbb D(G_i/K_i)$, $i=1,2$, there are no principal joint eigenvalues if the same holds for one of the factors. The same statement can be obtained by Theorem~\ref{thm:main_intro} using the maximal Satake compactification. Indeed, by \cite[Prop. I.4.35]{BJ} it holds that the maximal Satake compactification of $X$ is the product of the maximal Satake compactifications of $X_i$, i.e. $\ensuremath{\overline} X ^{\max}= \ensuremath{\overline} {X_1} ^{\max} \times \ensuremath{\overline} {X_2} ^{\max}$. Then it is clear from the definition of the wandering set that $\w(\ensuremath{\Gamma},\ensuremath{\overline} X^{\max})=\w(\ensuremath{\Gamma}_1,\ensuremath{\overline} {X_1} ^{\max})\times \w(\ensuremath{\Gamma}_2,\ensuremath{\overline} {X_2} ^{\max})$. Hence, the wandering condition $\w(\ensuremath{\Gamma},\ensuremath{\overline} X ^{\max} )\cap \partial \ensuremath{\overline} X^ {\max} \neq \emptyset$ is fulfilled if and only if it is fulfilled for one of the actions $\ensuremath{\Gamma}_i\curvearrowright \ensuremath{\overline} {X_i}^{\max}$. \subsection*{Selfjoinings} A more interesting class of examples is given by selfjoinings of locally symmetric spaces. These are given as follows. As above let $X=X_1\times X_2$ be the product of two symmetric spaces of non-compact type where $X_i = G_i/K_i$. Now, let $\Upsilon$ be a discrete group and $\rho_i\colon \Upsilon\to G_i$, $i=1,2$, two representations into real semisimple non-compact Lie groups with finite center. We assume that $\rho_1$ has finite kernel and discrete image. We want to consider the subgroup $\ensuremath{\Gamma}$ of $G_1\times G_2$ given by $\ensuremath{\Gamma}=\{(\rho_1(\sigma),\rho_2(\sigma))\colon \sigma\in \Upsilon\}$ which is discrete. We assume that $ \ensuremath{\Gamma}$ is torsion-free (e.g. if $\Upsilon$ is torsion-free). In contrast to the previous example the locally symmetric space $\ensuremath{\Gamma}\backslash X$ is not a product of two locally symmetric spaces anymore, so also the spectral theory cannot be reduced to some lower rank factors. However, we can exploit that the globally symmetric space is still a product and consider the maximal Satake compactification which is given by $\ensuremath{\overline} X ^{\max}= \ensuremath{\overline} {X_1} ^{\max} \times \ensuremath{\overline} {X_2} ^{\max}$. Since $\rho_1(\Upsilon)$ is discrete, it acts properly discontinuously on $X_1$. Hence every point of $X_1$ is wandering for the action of $\rho_1(\Upsilon)$. It follows easily that $X_1\times \ensuremath{\overline} {X_2} ^{\max}$ is contained in the wandering set $\w(\ensuremath{\Gamma},\ensuremath{\overline} X^{\max})$ of the action $\ensuremath{\Gamma}\curvearrowright \ensuremath{\overline} X^ {\max}$. Therefore, the wandering condition is fulfilled. Indeed, $\w(\ensuremath{\Gamma},\ensuremath{\overline} X^{\max}) \cap \partial\ensuremath{\overline} X^{\max} \supseteq X_1\times \partial \ensuremath{\overline} {X_2} ^{\max} \neq \emptyset$. \subsection*{Anosov subgroups} The result of Lax and Phillips \cite{laxphil} is in particular true if we consider a (non-cocompact) convex-cocompact subgroup of $PSO(n,1)$. Anosov subgroups as introduced by Labourie \cite{Lab06} for surface groups and generalized to arbitrary word hyperbolic groups by Guichard and Wienhard \cite{GW12} generalize convex-cocompact subgroups to higher rank symmetric spaces. For such $\ensuremath{\Gamma}$ we have the following proposition. \begin{proposition} Let $\ensuremath{\Gamma}$ be a torsion-free Anosov subgroup that is not a cocompact lattice in a rank one Lie group. Then the wandering condition $\w(\ensuremath{\Gamma}, \ensuremath{\overline} X^ {\max})\cap \partial \ensuremath{\overline} X^ {\max} \neq \emptyset$ is fulfilled. \end{proposition} \begin{proof} By \cite{KL18} (and \cite{GGKW15} for a specific maximal parabolic subgroup) every locally symmetric space arising from an Anosov subgroup admits a compactification modeled on the maximal Satake compactification $\ensuremath{\overline} X^{\max}$, i.e. there is $X\subseteq \Omega \subseteq \ensuremath{\overline} X^ {\max}$ open such that $\ensuremath{\Gamma}$ acts properly discontinuously and cocompactly on $\Omega$. Since $\Gamma$ does not act cocompactly on $X$, we have $ \Omega \cap \partial \ensuremath{\overline} X^ {\max} \neq \emptyset$. As every point in a region of discontinuity is wandering by definition we have $\Omega \subseteq \w(\ensuremath{\Gamma},\ensuremath{\overline} X^ {\max})$, and in particular the wandering condition is fulfilled. \end{proof} Combining the above proposition with Theorem~\ref{thm:main_intro} we obtain the following corollary. \begin{korollar} Let $\ensuremath{\Gamma}$ be a torsion-free Anosov subgroup that is not a cocompact lattice in a rank one Lie group. Then there are no principal joint $L^2$-eigenvalues on $\ensuremath{\Gamma}\backslash X$. \end{korollar} It is worth mentioning that selfjoinings of two representations into $PSO(n,1)$ yield Anosov subgroups if and only if one of the images of the representations is convex-cocompact. One can thus easily construct non-trivial examples which are not Anosov subgroups but fulfill the wandering condition of Theorem~\ref{thm:main_intro}. This is again parallel to Patterson's result that holds beyond the convex-cocompact case for hyperbolic surfaces admitting cusps and at least one funnel. \bibliographystyle{amsalpha}
\section{Introduction} Alfv\'en wave (AW) turbulence, that plays an important role in magnetized collisionless plasmas such as the solar wind \citep{Bruno13, BC16}, is often imbalanced in the sense that the energy carried by the waves propagating in the forward and backward directions relatively to the ambient field have significantly different magnitudes \citep{Tu89,Lucek98,Wicks13}. The degree of imbalance is dependent on the type of wind \citep{Tu90} and also on the distance from the Sun \citep{Roberts87,Marsch-Tu90,Chen2020}. For example, in a classical model of solar wind, outgoing AWs are emitted at the Sun's surface, as a consequence of reconnection processes in the chromospheric magnetic network, while in-going waves result from reflection of these waves on density gradients \citep{Perez13,Chandran19}, or from parametric decay instability \citep{Malara01}. In the case of low-frequency highly transverse perturbations, corresponding to the assumptions underlying the gyrofluid model derived in \citet{PST18}, imbalance is associated with a non-zero value of an invariant referred to as generalized cross helicity (GCH), which identifies with the cross-helicity at the magnetohydrodynamic (MHD) scales and with the magnetic helicity at sub-ion scales. As cross-helicity cascades to small scales and magnetic helicity to large scales \citep{Milo21}, the questions arises of the behaviour of the GCH flux arriving from large scales to the transition zone between MHD and sub-ion scales. Two publications recently addressed this issue. One uses a gyrofluid model (in the limit of small values of the electron beta parameter) which isolates the AW dynamics \citep{Meyrand21}. The other is based on a hybrid-kinetic PIC simulation which enables the coupling of low-frequency quasi transverse AW with quasi-parallel high-frequency ion-cyclotron waves (ICW) \citep{Squire21}. The role of ICWs and of the dissipation associated with the proton cyclotron resonance at the spectral break separating the MHD and the sub-ion ranges was indeed stressed, using the data from the Messenger and Wind spacecraft missions \citep{Telloni15,Woodham18}. In the regimes studied by \citet{Meyrand21}, the nonlinear parameter, defined as the ratio of the inverse nonlinear time to the Alfv\'en wave frequency is typically above unity. The dynamics then rapidly develops a significant transfer of energy towards the large parallel wavenumbers, resulting in the breaking of the asymptotics underlying gyrofluid models. Despite this shortcoming, the gyrofluid simulation reveals the existence of a helicity barrier which depletes the energy flux towards the small perpendicular scales, leading to a transfer in the parallel direction at the ion scale, together with a steepening of the energy (and magnetic) spectra. Energy accumulates at large scales and imbalance increases until saturation occurs under the action of a strong parallel dissipation. In contrast with usual fluid turbulence, the energy level that is reached depends on the magnitude of the parallel viscosity coefficient. In this framework, dissipation, which plays a central role in the dynamics, is not associated with any realistic physical phenomenon. The above scenario was then validated by the kinetic simulation of \citet{Squire21}, where the dissipation originates from ion-cyclotron resonance. In this simulation, performed at $\beta_e =0.3$, the level of fluctuations remains moderate because cyclotron resonance is rapidly triggered. In fact, an argument based on critical balance, together with the requirement that $k_\| d_i=1$ (where $d_i$ is the ion inertial length) at perpendicular scales such that $k_\perp \rho_i=1$ ($\rho_i$ denoting the ion Larmor radius), leads to a saturation amplitude scaling like $\beta_i^{1/2}$. As a consequence, when $\beta_e$ is taken of order unity (for comparable ion and electron temperatures), one may expect that high amplitude fluctuations should develop before a stationary regime can establish. Recent observations using Parker Solar Probe have comforted the results of the above simulation, with evidence of the coincidence between the presence of ICWs and of magnetic spectra displaying an ion transition zone associated with a polarity change, as expected when Alfv\'en waves trigger the formation of ICWs \citep{Bowen21}. Transition zones are commonly observed in the solar wind at 1AU, where the plasma beta parameter is of order unity or larger (see e.g. \citet{Huang_2021} and references therein). When the amplitude of the fluctuations is moderate (such as in the fast wind), the above argument suggests that ICWs can hardly be excited at the perpendicular ion scale. In this context, an alternative mechanism should be at work, like for example the effect of co-propagating Alfv\'en wave interactions that become relevant at ion scales \citep{Voitenko16,Voitenko20}. In order to address this question, it is appropriate to use a two-field gyrofluid model \citep{PST18}, where driving and dissipation have been supplemented, which only retains the Alfv\'en waves, but requires that the fluctuation amplitudes remain small and the parallel dynamics sub-dominant (conditions that can be checked a posteriori). We chose to prescribe the "energy imbalance" (referred to as imbalance in the following) by maintaining constant the amplitudes of the largest modes retained in the simulations, a driving process classically used in hydrodynamics turbulence \citep{Siggia78}. It turns out that, in the quasi-stationary phases of the simulation, the GCH and energy injection rates are roughly constant (equal to the total dissipation rates), the "injection imbalance", measured by their ratio, resulting from the dynamics. The paper is organized as follows. Section \ref{Gyrofluid} describes the model and the numerical setup. Section \ref{GCH-barrier} discusses the gyrofluid simulations, showing that, for moderate imbalance, the spectrum of the magnetic fluctuations (and also that of the most energetic wave) displays a steep transition zone near the ion scale, while the parallel transfer (and thus the parallel dissipation) remains weak. The helicity barrier is mostly conspicuous on the perpendicular GCH flux, which displays a significant decay past the ion scale, while the transverse energy flux remains almost constant. In the situation where parallel energy and cross-helicity dissipations are negligible, the effect of co-propagating wave interactions seems to be the only alternative mechanism at the origin of the transition zone within the context of the present model. Section \ref{transition-zone} discusses this mechanism using a Leith-type phenomenological spectral model. Section \ref{conclusion} is the conclusion. \section{Equations and numerical setup} \label{Gyrofluid} Let us consider a situation where the plasma dynamics results from weak perturbations of a homogeneous equilibrium state characterized by a density $n_0$, isotropic ion and electron temperatures $T_{0i}$ and $T_{0e}$ (characterized by their ratio $\tau = T_{0i}/T_{0e}$), and subject to an ambient magnetic field of amplitude $B_0$ along the $z$-direction. The various characteristic scales are conveniently measured in terms of the sonic Larmor radius $\rho_s = c_s/\Omega_i$, where $c_s = \sqrt {T_{0e}/m_i}$ is the sound speed and $\Omega_i= eB_0/(mc)$ the ion gyrofrequency. In particular, the ion Larmor radius $\rho_i =v_{th\,i}/\Omega_i$ (where the ion thermal velocities is given by $v_{th , i}=(2T_{0i}/m_i)^{1/2}$) and the ion inertial length $d_i=v_A/\Omega_i$ (where $v_A=B_0/(4\upi n_0 m_i)^{1/2} =c_s \sqrt{2/\beta_e}$ is the Alfv\'en velocity), satisfy $\rho_i = \sqrt{2\tau} \rho_s$ and $d_i = \sqrt{2/{\beta_e}} \rho_s$. The two-field gyrofluid model is derived from the full gyrofluid model of \citet{Bri92} under specific scaling assumptions. Such a simple reduced fluid model does not retain physical phenomena like kinetic dissipation, but also misses some nonlinear couplings with other modes. Discarding these effects, one here focuses on the nonlinear dynamics of AWs, or kinetic Alfvén waves (KAWs). Fully kinetic simulations will ultimately be necessary to validate the findings. Like the parent model, the model is not restricted to the small $\beta_e$ regime, unless physics at the electron inertia scale $d_e$ is retained (in the absence of electron FLR terms in the two-field equations, the electron Larmor radius must indeed remain smaller than $d_e$). More precisely, leaving aside issues related to kinetic damping, the model reproduces Reduced MHD in the limit of large transverse scales, and Electron Reduced MHD at sub-ion scales, both systems describing AWs or KAWs, uncoupled to slow waves, with no restriction on $\beta_e$ (especially since the parallel magnetic field component is retained). Only at the ion scales, where the system includes a dispersive term associated with the electron pressure gradient, can a coupling between Alfvén and slow waves become relevant (see Appendix E of \citet{Schekochihin09}). We here neglect the electron inertia, so the model covers a spectral range extending from the MHD to the sub-ion scales, within an anisotropic scaling where the transverse scales are much smaller than the parallel ones. \subsection{The two-field gyrofluid model} The model (which retains no dissipation process) is written as equations for the electron gyrocenter number density $N_e$ and the parallel component of the magnetic potential $A_\|$. When electron inertia is neglected, it takes the form \begin{eqnarray} &&\partial_t N_e +[\varphi,N_e]-[B_z,N_e]+\frac{2}{\beta_e}\nabla_\| \Delta_\perp A_\|=0\label{eq:gyro-2fields-Ne} \label{eq:Ne}\\ &&\partial_t A_\| + \nabla_\| (\varphi-N_e-B_z)=0\label{eq:gyro-2fields-A}.\label{eq:A} \end{eqnarray} Here, $\Delta_\perp = \partial_{xx} + \partial_{yy}$ is the Laplacian in the plane transverse to the ambient field and $[f,g]= \partial_x f \partial_y g-\partial_y f \partial_x g$ the canonical bracket of two scalar functions $f$ and $g$. Furthermore, $\Gamma_n$ denotes the (non-local) operator $\Gamma_n(-\tau \Delta_\perp)$ which in Fourier space reduces to the multiplication by the function $\Gamma_n(\tau k_\perp^2)$, defined by $\Gamma_n(x) = I_n(x) e^{-x}$ where $I_n$ is the modified Bessel function of first type of order n. For a scalar function $f$, the parallel gradient operator $\nabla_{\parallel}$ is defined by $\nabla_{\parallel} f=-[ A_{\parallel} , f]+ \partial_z f$. The equations are written in a nondimensional form, using the following units: $\Omega_i^{-1}$ for time, $\rho_s$ for the space coordinates (and thus $\rho_s^{-1}$ for the wavenumber components), $B_0$ for the parallel magnetic fluctuations $B_z$, $n_0$ for the electron gyrocenter density $N_e$, $T_e/e$ for the electric potential $\varphi$ and $B_0\rho_s$ for the parallel magnetic potential $A_\|$. Introducing the operators $L_1 = {2}/{\beta_e} +(1+2\tau)(\Gamma_0-\Gamma_1)$, $L_2 = 1 + (1-\Gamma_0)/\tau - \Gamma_0 +\Gamma_1$, $L_3 = (1-\Gamma_0)/\tau$ and $L_4 = 1-\Gamma_0+\Gamma_1$, the parallel magnetic fluctuations are given by $ B_z = M_1 \varphi$, with $M_1 = L_1^{-1} L_2 $, and the electrostatic potential by $\varphi =-M_2^{-1} N_e$, where $M_2 = L_3 + L_4L_1^{-1}L_2$ is positive definite. Thus, $B_z$ and $\varphi$ can both be expressed in terms of $N_e$. At the linear level, the phase velocity $v_{ph}= \omega/k_z$ is given by \begin{equation} v_{ph}^2\equiv\left(\frac{\omega}{k_z}\right)^2 = \frac{2}{\beta_e} k_\perp^2 \frac{1 -{\widehat M}_1 + {\widehat M}_2} {{\widehat M}_2}, \end{equation} where the caret refers to the Fourier symbol of the operator. The associated operator $V_{ph}$ is given by \begin{equation} V_{ph}= s (-\Delta_\perp)^{1/2} (1 -M_1 + M_2)^{1/2}M_2^{-1/2}, \end{equation} where $s= (2/\beta_e)^{1/2}$ is the equilibrium Alfv\'en velocity in sound speed units. In physical space, the eigenmodes, that can be viewed as generalized Elsasser potentials, are given by $\mu^\pm=\Lambda \varphi \pm s A_\|$, where $\Lambda = (-\Delta_\perp)^{-1} (1+M_2-M_1)^{1/2} M_2^{1/2}$. In the absence of dissipation processes (needed in the turbulent regime), the system (\ref{eq:Ne})-(\ref{eq:A}) preserves the energy ${\mathcal E}$ and the generalized cross-helicity ${\mathcal C}$, \begin{eqnarray} &&{\mathcal E} = \frac{1}{2} \int \Big ( \frac{2}{\beta_e} |\mathbf{\nabla}_\perp A_\| |^2 + \frac{4\delta^2}{\beta_e^2}|\Delta_\perp A_\| |^2 - N_e(\varphi -N_e-B_z) \Big ) d^3 {x}, \label{energy}\\ &&{\mathcal C} =-\int N_e A_\|d^3 {x}.\label{defC} \end{eqnarray} In terms of $\mu^\pm$, the two invariants rewrite ($D=(-\Delta)^{1/2}$), \begin{eqnarray} {\mathcal E} &=& \frac{1}{4} \int \left \{ (D \mu^+)^2 + (D \mu^-)^2 \right \} d^3x\\ {\mathcal C} &=& \frac{1}{4} \int V_{ph}^{-1}\{D \mu^+)^2 - (D \mu^-)^2 \} d^3x. \end{eqnarray} \subsection{Numerical setup} Equations (\ref{eq:Ne})--(\ref{eq:A}) with $\beta_{\rm e}=2$ and $\tau = 1$ were solved in a isotropic periodic box of size $L$, using a spectral method for the space variables and a third-order Runge-Kutta scheme for the time stepping. An eight-order hyper-dissipation operator $\nu_\perp(\Delta_\perp)^4 + \nu_z \partial^8_{z}$ acting on $N_e$ or on $A_\|$ is supplemented in the equations for the corresponding quantities. For convenience, the parameters $\nu_\perp$ and $\nu_\|$ are referred to as transverse (or perpendicular) and parallel viscosities. The system is driven by freezing the amplitude of the modes whose transverse wavenumber stands in the first spectral shell and the parallel one corresponds to $k_z (L / 2\upi)= \pm 1$, as in \citet{Siggia78}. A main interest of this procedure is that it permits simulations with a high imbalance and a moderate nonlinearity parameter. In such a regime, the injection rates of energy and of GCH are not prescribed, in contrast with the situations where the system is driven by an external random force or by a negative damping \citep{Meyrand21}. \begin{table} \begin{center} \def~{\hphantom{0}} \begin{tabular}{cccccccccc} & & & & & & & & & \\ & $N$ & $L/2 \upi$ & I & $\chi_0$ & $\chi_{\rm final}$ & $\nu_{perp}$ & $\nu_z/\nu_{perp}$ & $\Delta t$ & Color code \\ \hline \hline $R_1$ & \hspace{0.3cm} $784^3$ & \hspace{0.3cm} 11 & \hspace{0.3cm} 100 & \hspace{0.3cm} 0.47 & \hspace{0.3cm} 0.61 & \hspace{0.3cm} $3\cdot 10^{-9}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $2\cdot 10^{-3}$ \\ \hline $R_{2}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 100 & \hspace{0.3cm} 0.50 & \hspace{0.3cm} 0.68 & \hspace{0.3cm} $5\cdot 10^{-9}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & red \\ \hline $R_{3}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 10 & \hspace{0.3cm} 0.43 & \hspace{0.3cm} 0.60 & \hspace{0.3cm} $2\cdot 10^{-8}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & green \\ \hline $R_{4}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 1 & \hspace{0.3cm} 0.36 & \hspace{0.3cm} 0.56 & \hspace{0.3cm} $5\cdot 10^{-8}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & orange \\ \hline $R_{5}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 100 & \hspace{0.3cm} 0.87 & \hspace{0.3cm} 1.2 & \hspace{0.3cm} $2\cdot 10^{-8}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & magenta \\ \hline $R_{6}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 100 & \hspace{0.3cm} 0.50 & \hspace{0.3cm} 0.45& \hspace{0.3cm} $5\cdot 10^{-9}$ & \hspace{0.3cm} 0.025 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & blue \\ \hline $R_{7}$ & \hspace{0.3cm} $280^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 100 & \hspace{0.3cm} 0.50 & \hspace{0.3cm} 0.43 & \hspace{0.3cm} $5\cdot 10^{-9}$ & \hspace{0.3cm} 0 & \hspace{0.3cm} $3.125\cdot 10^{-3}$ & cyan \\ \hline $R_{8}$ & \hspace{0.3cm} $720^3$ & \hspace{0.3cm} 5.5 & \hspace{0.3cm} 1400 & \hspace{0.3cm} 0.49 & \hspace{0.3cm} 0.55 & \hspace{0.3cm} $2\cdot 10^{-10}$ & \hspace{0.3cm} 1 & \hspace{0.3cm} $8\cdot 10^{-4}$& violet \\ \hline \hline \end{tabular} \label{tabruns} \caption{Parameters of the runs, together with the values $\chi_0$ and $\chi_{\rm final}$ of the nonlinear parameter at the beginning and at the end of the simulation, estimated by the square root of the magnetic energy at this time. The color code refers to the color of the lines in figures \ref{fig7}-\ref{fig11}.} \end{center} \end{table} \section{The GCH barrier}\label{GCH-barrier} \subsection{Spectral transition zone and arrest of the GCH cascade}\label{GCH-arrest} In addition to the imbalance given by the ratio $I={\mathcal E}^+ / {\mathcal E}^+$ of the energies of the forward and backward propagating waves, another quantity governing the dynamics is provided by the nonlinearity parameter $\chi$, defined as the ratio of the inverse nonlinear time to the Alfv\'en frequency. At early times, when the maintained modes are dominant, a simple phenomenological argument \citep{Milo20} leads to $\chi \approx (k_{\perp 0}/k_{z 0}) |B_\perp(k_{\perp 0})| = |B_\perp(k_{\perp 0})|$, where $B_\perp$ is the transverse magnetic fluctuations (measured in units of the ambient field), and the index zero refers to the maintained modes for which $k_{\perp 0} = k_{z 0}$ in the (anisotropic) units of the gyrofluid model. At later times, in the isotropic simulation box, the rms value of the magnetic fluctuation is used as an estimation of $\chi$. In this paper, we concentrate on the case where the nonlinearity parameter keeps moderate values (initially $\chi \leq 0.5$), unless otherwise stated. \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig1a.pdf} \includegraphics[width=0.5\textwidth]{fig1b.pdf} } \caption{Transverse energy spectrum $E^\pm$ of the forward and backward propagating waves (left panel) and energy spectrum of the transverse and parallel magnetic fluctuations $E_{B_\perp}$ and $E_{B_z}$, averaged on three Alfv\'en crossing times $L/v_A$, for run $R_1$.} \label{fig1} \end{figure} \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig2a.pdf} } \caption{Energy and GCH fluxes in the transverse direction for run $R_1$ averaged in the same time interval as in Fig. 1.} \label{fig2} \end{figure} \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig3a.pdf} \includegraphics[width=0.5\textwidth]{fig3b.pdf} } \caption{Parallel energy (left panel) and GCH (right panel) dissipations ${\mathcal D}_z({\mathcal E})$ and ${\mathcal D}_z({\mathcal C})$ respectively, for run $R_1$. The run was started using equal perpendicular and parallel viscosity coefficients $\nu=5 \times 10^{-8}$ using a resolution of $420^3$ collocation points (red line); a first restart was then performed with $\nu = 5 \times 10^{-9}$ and $560^3$ collocation points (green line), and another one with $\nu = 3 \times 10^{-10}$ and $784^3$ collocation points (blue line). The inserts show the corresponding perpendicular energy and GCH dissipations ${\mathcal D}_\perp({\mathcal E})$ and ${\mathcal D}_\perp({\mathcal C})$. Due to the lack of space, the time labels were not specified for the inserts that cover the same time interval as the main graphs.} \label{fig3} \end{figure} We shall first illustrate our main results on a large-resolution simulation (run $R_1$) that displays extended inertial ranges. At the end of this simulation, the system did not yet reach a stationary state. Nevertheless, as mentioned in section \ref{sec:temporal_evolution}, the observed dynamics is similar to the one found in a lower-resolution simulation (run $R_2$), carried out until saturation is reached. For the $R_1$ simulation characterized by an initial imbalance $I = 100$ and an initial value $\chi_0 = 0.47$ of the nonlinearity parameter, performed in a computational box of size $L=11 \times 2 \upi$, figure \ref{fig1} displays the transverse spectra (integrated over $k_z$) $E^\pm(k_\perp)$ of the forward and backward propagating waves (left panel), and $E_{B_\perp}(k_\perp)$, $E_{B_z}(k_\perp)$ of the transverse and parallel magnetic fluctuations (right panel), averaged over the time interval [14656, 14760] corresponding to $1.5$ Alfv\'en crossing times (see figure \ref{fig3} for a characterization of this interval relatively to the full simulation). The spectra $E^+(k_\perp)$ and $E_{B_\perp}(k_\perp)$ display a transition zone at scales slightly larger than the sonic Larmor radius (corresponding to $k_\perp = 1$), with a spectral index close to $-3$, located between a sub-ion range with a spectral index $-2.7$ and a MHD range whose extension is strongly limited by the numerical constraints which make difficult the simulation in a box that would ideally cover a more extended range at large scale, while also retaining the small-scale dynamics. The transition zone is seen to extend up to the wavenumber where the spectrum $E_{B_z}(k_\perp)$ changes from a quasi-flat range to a decay range displaying the same spectral exponent as $E_{B_\perp}(k_\perp)$. The large-scale $B_z$ fluctuations are much smaller than those of $B_\perp$ as expected when only Alfvén waves are excited at large scale (see e.g. \citet{kobayashi17}). Figure \ref{fig2} shows the perpendicular fluxes of energy and GCH, averaged over the same time interval as the spectra displayed in figure \ref{fig1}. One observes that the energy flux is quasi-constant, even if the temporal fluctuations are comparable to the mean value (not shown) at scales larger than the transition one. Differently, the GCH flux undergoes a conspicuous decay at the transition range, a consequence of the helicity barrier whose existence was pointed out by \citet{Meyrand21} in similar simulations (although in the asymptotic regime $\beta_e \to 0$), performed in the large $\chi$ regime where the energy flux to small transverse scales is also significantly inhibited by the barrier. Because of numerical constraints, run $R_1$ was performed in three steps, associated with increased resolutions ($N=420^3$, $560^3$ and $784^3$ mesh points) and decreased (equal) parallel and perpendicular viscosities. This procedure permitted us to analyze the sensitivity of the parallel and perpendicular dissipations of energy (figure \ref{fig3} left) and GCH (figure \ref{fig3} right). We observe that the perpendicular dissipations are essentially not affected by the transition from one step to the following one, as expected in a usual turbulence cascade: reduction of the viscosity does not affect the dissipation and only shifts the dissipation range to smaller scales. In contrast, we observe that this is not the case for the parallel dissipation of energy and even more of GCH, which both decrease with the viscosity, confirming the absence of a standard turbulent cascade in the direction of the ambient field, at least in the regime of small or moderate nonlinear parameters considered in the present study. \begin{figure} \centerline{ \includegraphics[width=1.05\textwidth]{fig4.pdf} } \caption{Parallel (left) and perpendicular (right) dissipation of GCH in the $(k_\perp,k_z)$-plane (logarithmic coordinates) for run $R_1$. } \label{fig4} \end{figure} \begin{figure} \centerline{ \includegraphics[width=1.05\textwidth]{fig5.pdf} } \caption{Parallel dissipation of the energies of the $+$ (left) and $-$ (right) waves in the $(k_\perp,k_z)$-plane for run $R_1$. } \label{fig5} \end{figure} \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig6a.pdf} \includegraphics[width=0.5\textwidth]{fig6b.pdf} } \caption{Left panel: parallel (red) and perpendicular (blue) dissipations of the energy of the $+$ wave, and parallel (green) and perpendicular (magenta) dissipations of the energy of the $-$ wave, integrated on $k_z$, versus $k_\perp$ for run $R_1$. Right panel: parallel (red) and perpendicular (blue) dissipations of GCH, integrated on $k_z$, versus $k_\perp$, for the same run.} \label{fig6} \end{figure} Figure \ref{fig4} displays two-dimensional color plots of the time-averaged parallel (left panel) and perpendicular (right panel) GCH dissipations, defined by $D_z^C(k_\perp, k_z) = \nu_z k_z^8 E_C(k_\perp, k_z)$ and $D_{\perp}^C(k_\perp, k_z) = \nu_\perp k_\perp^8 E_C(k_\perp, k_z)$ respectively, where both the viscosities $\nu_\perp$ and $\nu_z$ are here equal to $3 \times 10^{-10}$ (and where $E_C(k_\perp, k_z)$ stands for the GCH power spectrum, after angle averaging in the transverse plane). In addition to the usual small-scale dissipation in both parallel and perpendicular directions, one clearly observes the existence of a significant parallel dissipation of GCH, which is larger near a transverse wavenumber close to $k_\perp=1$ than at the smallest scales. These observations can be understood by considering the contributions of the $+$ and $-$ waves, separately. Figure \ref{fig5} shows the two-dimensional color plots of the time-averaged parallel dissipations $D_z^+(k_\perp, k_z) = \nu_z k_z^8 E^+(k_\perp, k_z)$ and $D_z^-(k_\perp, k_z) = \nu_z k_z^8 E^-(k_\perp, k_z)$ of the energies associated with the forward and backward propagating waves. A dissipation spot is visible near $k_\perp = 1$ in the case of the $+$waves only. In contrast, comparable dissipations of the forward and backward propagating waves take place at small scales, both in the parallel and perpendicular directions. Indeed, the (weak) perpendicular transfer $\epsilon^{-}$ of $E^{-}$ is almost not affected by the GCH barrier, while $\epsilon^{+}$ is reduced past the barrier to a value close to $\epsilon^{-}$ since at these scales imbalance has almost disappeared (see also \citet{Meyrand21}, in a case where the helicity barrier affects the energy transfer more significantly than in the present simulation). In order to reach a stationary state, the transfer in the $z$-direction and the resulting parallel dissipation thus have to become sizeable near the ion scale for the $+$ waves. At small scale, the dissipation of the two types of waves are comparable and thus almost cancel out in the GCH dissipation, making the parallel dissipation of GCH to be dominant at transverse wavenumbers close to $k_\perp =1$, as observed in figure \ref{fig4}. A synthetic view of the dissipations in terms of the transverse wavenumber is obtained when integrating on $k_z$ the dissipations $D_z^+$, $D_z^-$, $D_{\perp}^+$, $D_{\perp}^-$ associated with the energy of the backward and forward propagating waves, and the analogous dissipations $D_z^C$, $D_{\perp}^C$ for the GCH. The resulting functions $d_z^+(k_{\perp})$, $d_z^-(k_{\perp})$, $d_{\perp}^+(k_{\perp})$, $d_{\perp}^-(k_{\perp})$, $d_z^C(k_{\perp})$, $d_{\perp}^C(k_{\perp})$ are displayed in figure \ref{fig6} (left panel: dissipation of energies; right panel: dissipations of GCH), under the same time averaging as in figures \ref{fig4} and \ref{fig5}. The perpendicular energy dissipation is concentrated at small scales, with comparable magnitudes for both directions of propagation. Differently, for the parallel dissipation, while the energy of the backward propagating waves is dissipated at small scales only, the dissipation of the forward propagating waves, and thus the GCH, also displays a maximum near the transition zone. It turns out that the effect of the helicity barrier is enhanced when the large-scale imbalance is increased, resulting in a steeper transition zone, in agreement with solar wind observations reported in \citet{Huang_2021}. This is exemplified in figure \ref{fig7} (left) which displays the time-averaged spectrum $E^+(k_\perp)$ for three runs with different initial imbalance : $I=10$ (run $R_3$), $I=100$ (run $R_2$), $I=1400$ (run $R_8$). Time averages are performed in the intervals [20000, 25000], [30000, 40000] and [7064, 7096], respectively. Compared to run $R_1$, they have a similar value of $\chi$ but are integrated in a box of size $L=5.5\times 2\upi$, with resolutions of $280^3$ (for $I$ = 10, 100) and $720^3$ (for $I$ = 1400) mesh points. When considering the ratio $E^+(k_\perp)/E^-(k_\perp)$ (figure \ref{fig7}, right), we observe that it becomes close to unity for $k_\perp \gtrsim 2$, whatever the value of the imbalance at large scales. \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig7a.pdf} \includegraphics[width=0.5\textwidth]{fig7b.pdf} } \caption{Influence of the imbalance on the perpendicular $E^+(k_\perp)$ spectrum (left panel) and on the ratio $E^+(k_\perp)/ E^-(k_\perp)$ (right panel): $I = 10$ (run $R_3$), $I=100$ (run $R_2$), $I=1400$ (run $R_8$).} \label{fig7} \end{figure} \subsection{Temporal evolution of the dissipations and of the ideal invariants } \label{sec:temporal_evolution} While at zero imbalance the energy quickly reaches its saturation value (with nevertheless significant temporal oscillations), when the imbalance is increased, the time needed to reach saturation can become very large. This is shown in figure \ref{fig8} which also indicates that, for a small initial value of $\chi$, the typical saturation time increases with $I$ (runs $R_2$, $R_3$. $R_4$).\footnote{In order to perform simulations significantly longer than run $R_1$, we resorted to reduce the numerical resolution to $280^3$ mesh points and to use a smaller computational box, of size $L=5.5\times 2\upi$.} Interestingly, for run $R_2$ with an energy imbalance $I=100$, the injection imbalance, given by the GCH to energy injection ratio, is relatively small, with a value close to $0.1$ at saturation, as seen in figure \ref{fig9} (left). Here, the injection rates are given by the slope of the cumulative injections, estimated as the sums of the energy or the GCH and of their respective cumulative dissipations. Figure \ref{fig9} (right) displays the energy and GCH fluxes for run $R_2$ in the steady state. They look qualitatively similar to those of run $R_1$, and in particular confirm the persistence of the GCH barrier in the saturated regime, in spite of the small value of the injection imbalance. In contrast, an energy barrier is hardly visible in this regime. Furthermore, as illustrated in figure \ref{fig10}, the ratio of perpendicular to parallel energy and GCH dissipations at saturation decreases as $I$ increases. When saturation is reached with a small value of $\chi$, perpendicular transfer and dissipation still strongly dominate the parallel ones. This is no longer the case when $I$ is large, as illustrated with the run $R_5$. Note that in this simulation, the initial value of $\chi$ was increased in order to shorten the time needed to reach saturation. For such a large value of $\chi$, the parallel dissipation rapidly overcomes the perpendicular one, as described in \citet{Meyrand21}. It is to be noted that this situation is not specific of imbalanced turbulence but also occurs for balanced simulations at large $\chi$ (not shown), indicating that the breakdown of the asymptotics is not limited to imbalanced runs. Moreover, it is conspicuous that the ratio of the perpendicular to parallel dissipation is always smaller for the GCH than for the energy, pointing out that the barrier acts dominantly on the GCH. As the nonlinear parameter $\chi$ is increased, the transition zone is less extended and displays a shallower slope (not shown), except possibly when the imbalance is also increased, as in the simulations presented in \citet{Meyrand21}. \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig8a.pdf} \includegraphics[width=0.5\textwidth]{fig8b.pdf} } \caption{Time evolution (averaged over 3 Alfvén crossing times) of the energy (left panel) and GCH (right panel), normalized to their initial values, for runs $R_2$, $R_3$ and $R_4$, with similar values of the nonlinear parameter $\chi$ (whose time evolution is displayed in the insert within the right panel) and different imbalances: I=100 (red), I=10 (green), I=1 (orange), respectively; a fourth run ($R_5$) with I=100 and a larger $\chi$ is also displayed in magenta.} \label{fig8} \end{figure} \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig9a.pdf} \includegraphics[width=0.5\textwidth]{fig9b.pdf} } \caption{Left: Cumulative injections of energy (solid line) and GCH (dashed line). Right: energy (solid line) and GCH (dashed line) fluxes of Run 2, averaged on the time interval $[30000, 40000]$.} \label{fig9} \end{figure} \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig10a.pdf} \includegraphics[width=0.5\textwidth]{fig10b.pdf} } \caption{Time evolution (averaged over 3 Alfvén crossing times) of the ratio between perpendicular and parallel dissipations of energy (left) and GCH (right), for the simulations shown in figure \ref{fig8} (same color code). } \label{fig10} \end{figure} \subsection{Transition zone with negligible parallel dissipation} The transition zone not only exists in regimes where $\nu_z=\nu_\perp$ (as in all the runs presented in the previous sections), but persists when the parallel viscosity $\nu_z$ is decreased while keeping $\nu_\perp$ unchanged. Figure \ref{fig11} (left) shows the transverse energy spectra $E^\pm(k_\perp)$ when $\nu_z$ is reduced by a factor $40$ relatively to its value in the run $R_2$. Parallel viscosity can in fact be taken arbitrary small and even zero without significantly affecting the accuracy of the numerical simulation during a significant integration time. As seen on figure \ref{fig11} (right), when reducing $\nu_z$ the perpendicular dissipation remains unchanged, while the parallel one (which is always subdominant) decreases further and the contribution of the spectral range close to $k_\perp = 1$ still dominates that of the small transverse scales. Regimes with small parallel dissipation are in fact relevant for the solar wind where the dynamics being quasi-transverse \citep{Sahraoui10}, the parallel transfer, and consequently the parallel dissipation at the smallest scales, are much weaker than the transverse ones. The above results suggest that the existence of the transition zone is not a consequence of the parallel dissipation, at least for small values of the nonlinear parameter. A possible origin of the transition in this case could be the interactions between co-propagating waves that take place at the sub-ion scales, as suggested by \citet{Voitenko16} and \citet{Voitenko20}. This issue is addressed in the next section, using a semi-phenomenological model. \begin{figure} \centerline{ \includegraphics[width=0.5\textwidth]{fig11a.pdf} \includegraphics[width=0.5\textwidth]{fig11b.pdf} } \caption{Left panel: $E^\pm $ energy spectra, averaged over the time interval [15000, 20000], for run $R_6$ with a parallel viscosity smaller by a factor 40 than in run $R_2$. Right panel: perpendicular (solid lines) and parallel (dotted lines) energy dissipations (averaged over 3 Alfvén crossing times) for simulations performed with different parallel viscosities, all the other parameters being kept unchanged (red: run $R_2$; blue: run $R_6$; cyan: run $R_7$).} \label{fig11} \end{figure} \section{Modeling of the transition zone}\label{transition-zone} \subsection{A phenomenological model including co-propagating wave interactions} \label{model-coprop} \begin{figure} \centering \includegraphics[width=0.98\hsize]{fig12.pdf} \caption{Spectra $E^\pm((k_\perp)$ and local slopes predicted by the phenomenological model for $d=3$ (top) and $d=0$ (bottom), with $C=15$, $\epsilon=1$, $\eta(k_\perp)=0.82 /v_{ph}^{1.1}(k_\perp)$.} \label{fig12} \end{figure} We here concentrate on a diffusion model in spectral space which was first derived in \citet{PS19}, and then reproduced in \citet{Milo20} using a heuristic approach based on the conservation of the energy and and of the GCH, together with a phenomenological estimate of the transfer times. This model does not capture the interactions between co-propagating waves, not only in the MHD range, where they do not exist, but also in the sub-ion range where co-propagative KAWs can actually interact. In \citet{PS19}, following \citet{Voitenko16}, we enriched the model by retaining interactions between triad wavenumbers which are comparable but not necessarily asymptotically close. We introduce the nonlinear characteristic frequencies for the mode ${\boldsymbol k}$ propagating in the $\pm$ direction, $\gamma_{\boldsymbol k}^{\pm (\uparrow\uparrow)}= V_{\boldsymbol k}^{(\uparrow\uparrow)} \sqrt{k_\perp^3 {E}^\pm(k_\perp)}$ and $\gamma_{\boldsymbol k}^{\pm (\uparrow\downarrow)}= V_{\boldsymbol k}^{(\uparrow\downarrow)} \sqrt{k_\perp^3 {E}^\mp(k_\perp)}$ (where $V_{\boldsymbol k}^{(\uparrow\uparrow)}$ and $V_{\boldsymbol k}^{(\uparrow\downarrow)} $ estimate the strength of the corresponding interactions), associated with the interactions between co-propagating $(\uparrow\uparrow)$ or counter-propagating $(\uparrow\downarrow)$ waves, respectively. Restricting the discussion to the case where both waves undergo strong nonlinear interactions, we can define global inverse transfer times as $(\tau_{tr, G}^\pm)^{-1} = \gamma_{\boldsymbol k}^{\pm (\uparrow\uparrow)} +\gamma_{\boldsymbol k}^{\pm(\uparrow\downarrow)}$. The ratio $\alpha(k_\perp)=V_{\boldsymbol k}^{(\uparrow\uparrow)} / V_{\boldsymbol k}^{(\uparrow\downarrow)}$ should be an increasing function of $k_\perp$, that is essentially zero in the MHD range and saturates to a finite value in the dispersive range. Identifying the inverse transfer times $\gamma_{\boldsymbol k}^{\pm(\uparrow\downarrow)}$ associated with the contra-propagating waves with the nonlinear frequencies $\sqrt{k_\perp^3 v_{ph}^2 {E}^\mp(k_\perp)}$, the new inverse transfer times then rewrite \begin{equation} (\tau_{tr, G}^\pm)^{-1} \approx k^{3/2}_\perp v_{ph} \left(({E}^\mp)^{1/2}+ \alpha(k_\perp)({E}^\pm)^{1/2} \right). \end{equation} Defining $u^\pm = {E}^\pm/ k_\perp$, the equations governing the evolution of ${E}^\pm(k_\perp)$ is rewritten, in the stationary regime, \begin{equation} \frac{d}{d k_\perp} u^\pm(k_\perp)=-C\frac{\varepsilon\pm\eta v_{ph}}{k^5_\perp v_{ph}}\frac{1} {u^\mp(k_\perp)^{1/2} + \alpha(k_\perp) u^\pm(k_\perp)^{1/2} },\label{eq:coprop-interaction} \\ \end{equation} where the energy and GCH fluxes $\epsilon$ and $\eta$ are a priori functions of $k_\perp$ and $C$ is a numerical constant. This equation is similar to Eq.(7.34) of \citet{PS19} when $\nu=0$, except that the weighting factor of the co-propagating wave interactions is here taken to be $\alpha(k)$ instead of its square. The function $\alpha$, which is taken as $\alpha(k_\perp)=3((1+ck_\perp^2)^{1/2}-1)/((1+ck_\perp^2)^{1/2}+1)$ in \citet{Voitenko16}, with $c$ denoting a slowly varying function of $k_\perp$, can also be written \begin{equation} \alpha(k_\perp)=d\left ( \frac{v_{ph}(k_\perp)-s}{v_{ph}(k_\perp)+s}\right ), \end{equation} where $s = \sqrt{2/\beta_e}$ is the Alfv\'en velocity (in sound speed units) and $d$ a free constant parameter. An important remark, related to the existence of the helicity barrier, is that Eq. (\ref{eq:coprop-interaction}) does not have a satisfactory solution when $\eta\ne 0$. The linear growth of the phase velocity $v_{ph}$ at small scales implies that for $k_\perp$ large enough, depending on the sign of $\eta$, one of the spectra ${E}^+$ or ${E}^-$ increases with $k_\perp$. \subsection{Numerical integration of the phenomenological model} \label{numeric-model} As discussed in \citet{PS19}, Eq. (\ref{eq:coprop-interaction}) can be considered either as an initial value problem when the energy and generalized cross-helicity fluxes $\varepsilon$ and $\eta$ are given and the spectra ${E}^\pm$ prescribed at a wavenumber $k_\perp=k_0$ or, alternatively, as a nonlinear eigenvalue problem for $\varepsilon$ and $\eta$, when the spectra are specified at $k_0$ and prescribed to decrease to zero at infinity. Numerical integration of these equations is best performed as an initial value problem where $k_0$ is taken close to the largest wavenumber of the spectral domain. Indeed, the eigenvalue problem (where ideally $k_0$ is chosen at the lower end of the spectral domain) requires a shooting method and turns out to be extremely difficult to solve numerically, due to its instability. Indeed, under the effect of any small perturbation, the small-scale spectrum takes the form of an absolute equilibrium or goes to zero at a finite value of $k_\perp$, depending on the boundary conditions. In the integrations presented below, we choose $\beta=2$, $\tau=1$, $k_0=200$ and small enough initial conditions such as to obtain a solution where the spectra tend to zero for a value of $k_\perp$ slightly in excess of $k_0$. As suggested by the numerical simulations of the gyrofluid equations, in the conditions where $\chi$ is not too large, $\varepsilon$ can be taken constant. We used $\varepsilon=1$ (close to the almost constant energy flux observed in the gyrofluid simulations) and $C=15$. Differently, the gyrofluid simulations show that the flux of GCH undergoes a significant decrease at the barrier \footnote{As discussed in \citet{PS19} and \citet{Milo20}, a constant GCH flux would lead to unrealistically large amplitudes and large imbalance at large scale, a consequence of the fact that transfer in the z-direction is not retained by the diffusion model.} To comply with this observation, we were led to prescribe that $\eta$ decreases faster than $1/v_{ph}(k_\perp)$. For simplicity, we here chose to take $\eta(k_\perp)=\eta_0/v_{ph}^{\gamma}(k_\perp)$. The numerical factor $\eta_0=0.82$ ensures that the imbalance at large scales tends to a value close to $100$, as in most of the numerical simulations presented in Section \ref{GCH-barrier}, while the exponent $\gamma=1.1$ leads to a small-scale imbalance which is also compatible with the simulations. A larger value of $\gamma$ would produce a smaller imbalance at small scales. Note that decaying transfer rates also arise in nonlinear diffusion models of turbulence retaining Landau damping \citep{Howes11}. In figure \ref{fig12}, we display the ${E}^\pm$ spectra (left) and their local spectral exponents (right) for the cases $d=3$ (top) and $d=0$ (bottom), the other parameters being taken as mentioned above. In the absence of co-propagating wave interactions ($d=0$), the ${E}^+$ spectrum exponent undergoes a transition, at $k_\perp$ close to unity, between the Kolmogorov exponent $-5/3$ and a value slightly steeper than the theoretical value $-7/3$, as expected in the presence of imbalance \citep{PS19}. When $d=3$ (a value compatible with kinetic theory, used by \citet{Voitenko16}), a clear overshoot of the spectral index is observed, associated with the existence of a transition zone which starts for $k_\perp$ slightly smaller than unity, the steeper slope being equal to -3.28 at $k_\perp=1.18$. Near this wavenumber, the ${E}^-$ spectrum displays a weak flattening. Several remarks can be made concerning the influence of the various parameters of the model, which, at this stage, remains only qualitative. First, the slope of the transition zone is steeper (shallower) as $d$ in increased (respectively decreased). This further indicates the role of the co-propagating wave interactions in the generation of this transition zone. At larger imbalance (e.g. when taking $\eta_0=0.92$, which leads to a large-scale imbalance close to $I=1000$), the transition zone is slightly steeper, with a slope reaching $3.52$ at $k_\perp=1.11$. In the absence of co-propagating wave interactions, and when the variation of $\eta$ is such that $\eta v_{ph}(k_\perp)$ is constant, the imbalance remains independent of $k_\perp$. This is no longer the case when $\eta$ decreases faster than $1/v_{ph}(k_\perp)$. As $\gamma$ is increased from the value $1.1$ chosen in the figure, the imbalance at small scale is strongly reduced but the transition zone takes a different form. While the slope of the ${E}^+$ spectrum is not as steep as for smaller values of $\gamma$, the ${E}^-$ spectrum becomes shallower. The case where $\eta$ decreases faster can be associated with a stronger transfer and/or dissipation in the $z$-direction and thus a larger value of $\chi$. This effect is seen in some simulations but a systematic study has not been performed. \section{Conclusion} \label{conclusion} Using a two-field gyrofluid model retaining AWs only, we have observed that, for $\beta_e$ of order unity or larger and a weak or moderate energy imbalance, a transition zone can exist in the absence of a significant parallel energy dissipation, in contrast with the mechanism based on the dissipation induced by the ion-cyclotron resonance, recently proposed by \citet{Squire21}. This transition zone is found to be steeper at larger imbalance, in line with Parker Solar Probe observations \citep{Huang_2021}. In these simulations, an helicity barrier also forms, associated with a decay of the perpendicular CGH flux at the ion scales, while the corresponding energy flux is almost scale independent. Such simulations are consistent with the possible effect of the interactions between co-propagating AWs. The efficiency of this mechanism is supported by the analysis of a phenomenological model based on diffusion equations in the spectral space, in the spirit of the Leith's model \citep{Leith67} for hydrodynamic turbulence. It turns out that, in the presence of co-propagative waves, and only in this case, the energy barrier, modeled by a decay of the GCH flux with the transverse wavenumber, leads to a spectral transition zone. As a consequence of weak or negligible parallel dissipation, the injected energy accumulates and a relatively long time is needed for turbulence to reach a steady state. As a consequence, in the context of a more realistic model, one may suspect that before ion-cyclotron wave can be excited, other dissipative effects can come into play, and among them, Landau damping or stochastic heating. Kinetic simulations for values of the beta parameters of order unity or larger are necessary to address these issues. \section*{Acknowledgments} This work was granted access to the HPC resources of CINES/IDRIS under the allocation A0090407042. Part of the computations have also been done on the “Mesocentre SIGAMM” machine, hosted by Observatoire de la Côte d’Azur. \section*{Declaration of Interests} The authors report no conflict of interest. \bibliographystyle{jpp}
\section{Introduction and motivation} Paraphrasing Laplace's famous dictum, probability depends both on the information we do possess and on the information we do not. Underlying this picture are two ideas: first, probability functions quantify uncertainty with the operational meaning of ``rational'' degrees of belief \cite{DeFinetti1931,Savage1972,Lindley1982,Paris1994} and second, information \emph{resolves} fully uncertainty. In other words, probability provides a principled estimate of an agent's uncertainty about events whose truth-conditions are fully decided by information as yet not possessed by the agent. For a straightforward illustration which is also useful to fix some basic terminology, take an urn with $n$ balls which only differ in colour, say yellow, red and green. \paolo{Assume that an agent is further equipped with the information that 1/3 of the balls are yellow, 1/3 are red, 1/3 green, and is asked to draw a ball from the urn. The agent is uncertain about the colour of the particular ball that will be drawn from the urn, but knows which conditions will need to obtain for, say the event ``the ball is red'' to have happened. Furthermore, she knows the distribution of the balls in the urn, and will thus readily assess the likelihood of each particular outcome of this kind of experiment, i.e. will rationally assess her degree of belief on the event e.g. ``the ball is red'', $Bel(Red)$ for short, equal to the proportion of red balls on the urn, that is $Bel(Red) = 1/3$. The same will clearly apply for $Bel(Green)$ and $Bel(Yellow)$. } \paolo{ Now, let us imagine a second scenario, where an agent only knows that the balls in the urn are either yellow, red or green, without knowing their distribution. Here, the ``Laplacian'' way of looking at the problem will translate the lack of information about the composition of the urn into very precise probabilistic (as it turns out) information about the event of interest: since no further information on the composition is indeed available, then there is no reason to depart from the assumption that colours are uniformly distributed in the urn, which readily gives $Bel(Red)=1/3$, and similarly for \emph{Green} and \emph{Yellow}.} \paolo{Both scenarios sketched so far lead to the same assignment, but relying on different kinds of information. This is however problematic, as shown by the following example, where both types of situations coexist in the same context. Take another three-colours urn composed for 1/3 of red balls and for 2/3 of balls which are either yellow or green, in unknown proportion. Whilst the assignment of belief to $Red$ will follow the pattern of the first scenario, and, using the provided information about the proportion of red balls will lead to $Bel(Red)=1/3$, the assignment of belief to the other two colours would follow the pattern of the second scenario. A reasoning based on the lack of information will lead indeed to $Bel(Yellow)=Bel(Green)=1/3$, and again, we will have $Bel(Yellow)=Bel(Green)= Bel(Red) =1/3$, with an assignment motivated by two different kinds of information (and lack thereof). } Over the past century many have taken issue with the Laplacian line of argument above. Among them \cite{Keynes1921,Shafer1976a,Walley1991} had a profound and continuing impact on the foundations of uncertain reasoning, whereas \cite{Knight1921,Ellsberg1961,Schmeidler1989,Jaffray1989} brought related problems to the attention of decision theory. More recently, similar concerns have been raised in artificial intelligence from a variety of distinct angles, among which \cite{Dubois2001c,Kyburg2001} had significant impact. With regard to this growing literature, readers may find out more in the general exposition provided by \cite{Halpern2003} and an up-to-date overview \cite{Marquis2020}. Whilst the formal models which originated from the above criticisms may diverge significantly, a unifying feature which is easily found in all of them is the criticism of the additivity forced upon degrees of belief by the probabilistic representation of uncertainty. This, as will be developed in the remainder of this section, can be undesirable in those situations in which telling precisely the information an agent possesses from that which it doesn't, is neither practically nor conceptually straightforward. The research reported in this paper aims at adding a logical dimension to this long-standing issue in the foundations of uncertain reasoning. Unlike the above mentioned criticisms, we do not take issue directly with the additivity of the measure representing uncertainty. Rather, we focus on an important but very much neglected element in the analysis of the quantification/resolution view of uncertain reasoning, namely the fact that it requires certain \emph{inferential abilities}. \paolo{These, under suitable conditions, can give rise to \emph{information}, which eventually leads the agent's degree of belief converge to an additive measure -- i.e. a probability.} By tackling the problem at its logical roots we also hope to encourage logicians to join this very interesting multidisciplinary conversation of the very foundations of rational reasoning and decision-making. To motivate the need for a logical approach to the problem, it is useful to point out explicitly the way \emph{classical} logic constraints (finitely additive) probability functions. So take $\vdash$ to be the classical consequence relation on a (finite) propositional language $\L$. A \emph{probability function on $\L$} is a normalised and finitely additive function from the sentences of the language to the real unit interval, i.e. one satisfying the following conditions: \begin{enumerate} \item[(PL1)] If $\vdash \theta$ then $P(\theta)=1$, \item[(PL2)] If $\vdash \neg (\theta\wedge \varphi)$ then $P(\theta\vee \varphi)=P(\theta)+ P(\varphi)$. \end{enumerate} The Stone representation theorem for Boolean algebras and the representation theorem for probability functions (see e.g. \cite{Paris1994}) guarantee that the Kolmogorov measure-theoretic axiomatisation of probability is equivalent to the logical one above. Framing the axioms logically however puts forward the role of $\vdash$ in giving probability functions an unwelcome inability to distinguish between ``probabilistic knowledge'' and ``probabilistic ignorance''. To see this, recall that $\vdash \theta\vee\neg\theta$, and that (PL1) and (PL2) immediately give us \begin{equation} P(\neg \theta)=1-P(\theta).\label{eq:lem} \end{equation} This amounts to saying that in the framework we have no way of representing a very common situation: the agent doesn't known anything about $\theta$. Instead of allowing the agent to represent its lack of opinions about the event $\theta$, \eqref{eq:lem} effectively translates absence of information about $\theta$ into information about its negation. Whilst this is easily seen to be inappropriate in many realistic scenarios, to the best of our knowledge \cite{DAgostino2017} was the first paper to point out that the root of the problem, and hence a robust way to fix it, was not to be found (exclusively) in the axioms of probability functions, but at the more fundamental level of the underlying consequence relation. This is apparent by focusing on another immediate consequence of (PL1), (PL2): \begin{equation} \theta \vdash \varphi \text{ implies } P(\theta)\le P(\varphi),\label{eq:mon} \end{equation} which expresses the monotonicity of probability functions with respect to $\vdash$. This property is mathematically convenient, but puts on the agent a very heavy burden which owes to its intractability. Indeed, a logical deduction from $\theta$ to $\varphi$ might be highly nontrivial and hard to find, making the application of \eqref{eq:mon} a constraint of rationality that realistic agents may not be in a position to comply with. Many authors, including \cite{Savage1967,Hacking1967} have pointed out that imposing that ``rational degrees of belief'' should be deductively closed is too tall an order, but they did not tackle the problem from the logical point of view. \paolo{This is what this paper attempts to do, by drawing on the theory of Depth-bounded Boolean logic (DBBL) investigated in \cite{DAgostino2013,DAgostino2015}.} A characteristic feature of DBBL is its informational nature. Whereas connectives in classical logic are defined in terms of truth-values, DBBL provide an informational view of logical consequence which, as a by-product, also provides a tractable approximation of it. Thus DBBL provide the ideal setting to tackle the shortcomings of the probabilistic quantification of uncertainty highlighted by \eqref{eq:lem} and \eqref{eq:mon} above. The central idea behind the (semantic) approach to DBBL is to distinguish two kinds of information. The first is information which the agent possesses explicitly or can trivially infer from it. For definiteness, it is the kind of information that an agent holds when she holds the information that a conjunction is true, i.e. that both conjuncts are true. Put otherwise, the information that both conjuncts are true is immediately available to the agent possessing the information that the conjunction is true. The second kind of information is more subtle and is \emph{obtained} by making a specific kind of hypothetical reasoning. This is closely related to classical reasoning by cases, with the additional requirement that its disjunctive premises always partition the set of (classical) valuations. To illustrate this kind of reasoning, let us consider a puzzle, originally due to Hector Levesque, and which has been largely discussed in the psychology of reasoning literature, see e.g. Chapter 6 of \cite{Stanovich2009}. \begin{example}\label{ex:ann} Experimental subjects are faced with the following test: \begin{quote} Jack is looking at Anne, and Anne is looking at George. Jack is married, but George is not. Is a married person looking at an unmarried person? \begin{itemize} \item[A)] Yes \item[B)] No \item[C)] Cannot be determined. \end{itemize} \end{quote} It is reported by \cite{Stanovich2009} that over 80\% of subjects give a wrong answer, the vast majority of which being C). Here is a plausible explanation for this systematic mistake, which was certainly engineered in the problem. The subject is provided with some explicit information, which in first-order logic notation can be represented as follows: \begin{eqnarray} \label{eq:1} Looks(Jack,Anne)\\ \label{eq:2} Looks(Anne,George)\\ \label{eq:3} Married(Jack)\\ \label{eq:4} \neg Married(George). \end{eqnarray} Hence there is no information which is provided about the marital status of Ann, which probably leads most respondents to this frequent mistake. The correct answer is instead A), which can be arrived at by performing a particular kind of hypothetical reasoning based on the fact that \begin{equation}\label{eq:biv}\tag{Biv} \text{either } Married(Anne) \text{ or } \neg Married (Anne). \end{equation} Those mutually exclusive disjuncts clearly exhaust the set of classical models. So we get two cases, both of which decide positively the question of interest, namely \paolo{$$\exists x\exists y \varphi(x,y) \qquad \text{ where } \varphi(x,y) := Looks(x,y)\land Married(x) \land \neg Married(y) .$$} For we have, from \eqref{eq:biv} and the information in \eqref{eq:1}-\eqref{eq:4} that either $$ \gamma:= Married (Anne) \wedge \neg Married(George) \wedge Looks(Anne,George)$$ or $$\gamma':= \neg Married (Anne) \wedge Married(Jack) \wedge Looks(Jack,Anne), $$ holds, with $\varphi(Anne,George)$ following immediately from $\gamma$, and $\varphi(Jack,Anne)$ following immediately from $\gamma'$. \end{example} This example singles out two senses of ``information''. The first is conveyed by \eqref{eq:1}-\eqref{eq:4} which is readily seen as information actually held by the experimental subjects. In addition, subjects can be seen to attain logical conclusions which exceed the information actually held, \paolo{by means of hypothetical reasoning}. This essentially amounts to applying a single instance of the reasoning by cases on a pair of jointly exhaustive alternatives - as pointed out in \eqref{eq:biv}, either Anne is married or she is not. The hierarchy of Depth-bounded Boolean logic arises by bounding the number $k$ of allowed nested iterations of hypothetical inferential steps of the kind just illustrated. If $k=0$, then only information actually held by the agent can be used as the premises of a logical deduction, yielding the $0$-depth consequence relation denoted by $\vdash_0$. So, an agent confined to a $0$-depth consequence relation, would be unable to solve the problem of Example \ref{ex:ann}, which is readily solved above at depth 1. For $0\le k < m$ it can be shown that $\vdash_k\ \subset \ \vdash_m$, whereas $\lim_{k\to\infty}\vdash_k \ = \ \vdash$. This justifies interpreting the hierarchy of DBBLs as an approximation to classical logic, which is indeed attained when the agent is allowed an unbounded use of hypothetical information along the lines illustrated. As we shall point out in due course, keeping this bound in place also results in each element $\vdash_k$ of the sequence being tractable, in the sense of computational complexity. \paolo{ While various approaches in the literature \cite{Finger06,Levesque2020} have similarly focused on feasible approximation of logical systems, what sets apart DBBLs from those is its clear information-based semantics: this provides indeed an uncertainty resolution mechanism which is naturally more adequate than a truth-based semantics, for tackling our motivating questions.} Recall that an \emph{event}, understood classically, is a binary random variable. This is captured by the (classical) valuation \begin{equation*} v(\theta)= \begin{cases} 1 \text{ if the event obtained}\\ 0 \text{ otherwise}, \end{cases} \end{equation*} which represents the event's indicator function. In this classical picture, uncertainty is resolved by a logical valuation, which is a total function from the language to the binary set $\{0,1\}$. In probabilistic modelling, this amounts to the usual assumption concerning the ``deterministic nature'' of the phenomena whose uncertainty is being quantified. See e.g. \cite{DeFinetti1974} for an authoritative point of view along these lines. By contrast, an information-based uncertainty resolution accounts explicitly for the possibility that the agent is not informed about a particular event. This can be illustrated by decorating the valuation symbol used above with a superscript $i$, meant to suggest ``information'': \begin{equation*} v^i(\theta)= \begin{cases} 1 \text{ if the agent is informed that $\theta$ obtained}\\ 0 \text{ if the agent is informed that $\neg\theta$ obtained}\\ * \text{ if the agent is not informed about $\theta$ }. \end{cases} \end{equation*} So in Example \ref{ex:ann} above, it is natural to represent the fact that the marital status of Ann is unspecified by $v^i(Married(Anne))=*$. However, a single binary branching leads to the hypothetical resolution of this uncertainty, with one branch deciding $v^i(Married(Anne))$ positively, and the other negatively. \paolo{The key difference between $v$ and an evaluation such as $v^i$ lies in the fact that the latter allows for a bounded number $k$ of iterations of hypothetical uncertainty resolution, and, in particular when $k=0$ may provide only a \emph{partial} evaluation of the sentences/events.} This in turn leads to a ``non-deterministic'' semantics \cite{DAgostino2013} which is instrumental to avoiding the automatic translation of the agent's ignorance about $\theta$ to information about $\neg\theta$. In analogy to DBBLs, this paper investigates a hierarchy of \emph{Depth-bounded Belief functions} which approximate probability functions and asymptotically coincide with them. Our construction is inspired by the theory of Dempster-Shafer Belief functions \cite{Shafer1976a}, as suggested by our choice of terminology. As in DS-theory, none of the belief functions in our hierarchy is constrained by additivity (PL2 above), except for the one attained in the limit. More precisely, given two incompatible events $\varphi$ and $\psi$, a depth-bounded belief function might give $B_k(\varphi\lor\psi)$ a value in $[0,1]$ which is distinct from $B_k(\varphi)+B_k(\psi)$. Going back to our comments on \eqref{eq:lem} above, the non-additive nature of our belief functions is necessary to ensure a distinct representation of `knowledge' and `ignorance'. However, unlike DS-theory (and related proposals) it is achieved {primarily} by replacing classical logic as the uncertainty resolution mechanism -- i.e. by changing `the logic of events'-- rather than by {just} relaxing the axiomatic properties of the uncertainty measure leaving the underlying logic classical, as put forward in the position paper \cite{DAgostino2017}. Finally, a very interesting feature of the framework to be introduced below is in our view this: endowing the agent with higher logical abilities (as captured by the index of the relation $\vdash_k$) allows her to obtain increasingly tighter approximations of $B_k(\varphi)+B_k(\psi)$ by $B_k(\varphi\lor\psi)$. This puts forward a seemingly novel approach, a logic-based one, to Ellsberg-like problems, as illustrated by Example \ref{ellsberg} below. \paolo{ As a welcome byproduct, major reasoning tasks which are based on any member $B_k$ of our hierarchy will turn out to be computationally tractable, in a sense to be clarified in Section \ref{sec:complex}. } \subsection{Plan of the paper and summary of contributions} Section \ref{sec:bounded} presents the key features of Depth-bounded boolean logics in a form which suits our present needs. Since this section is instrumental to making this paper self-contained, we refer the interested reader to \cite{DAgostino2013,DAgostino2015} for the full logical details and \cite{DAgostino09} for the philosophical underpinnings of the theory of DBBL. Section \ref{sec:approximating-probability-functions} introduces the belief functions which provide, through our main results, an approximation to probability functions. \paolo{The resulting approximation will be immune, by logical design, to the problem of turning the absence of information about an event into information about its negation.} Section \ref{sec:complex} investigates the complexity of our approximation and identifies the reasoning tasks with depth-bounded belief functions which are feasible (under the usual assumptions which will be briefly recalled). Section \ref{sec:conclusion} collects some final remarks and points to the directions for future work on this topic. Our main results read as follows. Theorem \ref{thm:approxprob} shows that each probability function can can be approximated by a hierarchy of Depth-bounded Belief functions, while, conversely, Theorem \ref{thm:prob} singles out the conditions under which our Depth-bounded Belief functions actually determine a probability in the limit. Theorems \ref{poly0},\ref{polyk}, and \ref{inf} show that under rather palatable restrictions, the depth-bounded \paolo{functions} introduced here are an adequate tool to tackle the well-known unfeasibility of logic-based uncertain reasoning \cite{Paris1994,sipser}. The framework and results presented below extend significantly those of \cite{Baldi2020a}, which is therefore superseded by the present paper. In the related \cite{Baldi2020} we put forward a logic-based framework which served as a direct inspiration for the one introduced below, and whose aim was the approximation of DS {Belief functions}. So the main result of \cite{Baldi2020} is that the hierarchy of approximating measures asymptotically coincides with DS Belief functions. Note that elements in the hierarchy of depth-bounded belief functions in \cite{Baldi2020} only provide a logical model of agents with increasingly higher inferential ability, which nonetheless has no impact on the resolution of uncertainty. This is reflected formally by the fact that, even in the limit, the Depth-bounded belief functions in \cite{Baldi2020} need not be additive. This work, in contrast, puts the hierarchy of depth-bounded belief functions in correspondence with an increasingly higher ability to resolve uncertainty \paolo{beyond} the information actually held by the agent. This leads in the limit to \emph{additive} measures. Furthermore, \cite{Baldi2020} provides no analysis of the computational complexity of Depth-bounded belief functions (though it is conjectured in there that they are actually intractable, in the most general case). \section{Bounded sequences and Bounded logics}\label{sec:bounded} We begin with some conventions and terminology. We will denote by $\L$ a finite propositional language, with variables $p,q$ etc., connectives $\neg, \wedge,\vee$, and the constant $\bot$, standing for any contradiction. The set of sentences generated recursively from $\L$ will be denoted by $\SL$. Lowercase Greek letters denote sentences, and uppercase Greek letters sets of sentences. Given any sentence $\varphi\land\psi,\varphi\lor\psi$ in $\SL$, the sentences $\varphi,\psi$ are said to be \emph{the immediate subsentences} of $\varphi\land \psi, \varphi\lor \psi$, respectively. Similarly, for any sentence $\neg\varphi$, its immediate subsentence is $\varphi$. A propositional variable has no immediate subsentences. The set of \emph{subsentences} of $\varphi$ is denoted by $S(\varphi)$ and is the smallest set containing $\varphi$ and closed under immediate subsentences -- ditto for $S(\Gamma)$, where $\Gamma$ is a set of sentences. Finally $At_\L$ denotes the set of \emph{atoms}, i.e. the maximal (classically) consistent conjunctions of literals from $\L$. Trees, and sequences thereof, will represent \paolo{the information} intervening in depth-bounded reasoning. In our framework the root of a tree is labelled with the information initially held by the agent. If no such information is available to the agent, the root will be labelled by $*$. Otherwise it will be labelled by a set of sentences from $\mathcal{SL}$. \paolo{In what follows, the leaves of a tree $T$ are denoted by $Le(T)$, and the \emph{depth of a node} $\a$ in a tree is the length of the path from the root of the tree to $\a$.} Branching is where the core construction \paolo{of the other kind of information, the hypothetical one}, leading to uncertainty resolution, takes place, along the line of our first definition: \begin{definition}\label{Tk} Let $\gamma \in \SL \cup\{*\}$. A \emph{depth-bounded tree sequence ${(T_k)}_{k\in\mathbb{N}}$ (DBT-sequence for short) rooted in $\gamma$} is defined recursively as follows: \begin{itemize} \item $T_0$ is a tree having as only node its root $\gamma$. \item for $k> 0$, $T_{k}$ is obtained by branching at least one node $\a$ of depth $k-1$ in $T_{k-1}$ with two nodes $\a\land \b$ and $\a\land \neg \b$, \paolo{for some $\b\in \SL$.} \end{itemize} A \emph{ finite depth-bounded tree sequence} is any initial segment ${(T_k)}_{k<n}$ of a depth-bounded sequence ${(T_k)}_{k\in\mathbb{N}}$, for some $n\in \mathbb{N}$. \end{definition} \paolo{A few consideration on the definition above are in place. First, the formula $\b\in\SL$, used for the branching in the Definition above, is not fixed, but different formulas can be used for each different parent node and each iteration of the construction of the $T_k$s. Second, in case $\gamma$ is the empty information $*$, we will take $T_1$ to be a tree rooted in $*$, with two branchings $\b$ and $\neg \b$, for some sentence $\b\in\SL$. Finally, note that at least one formula $\a\in Le(T_k)$ has to be of depth $k$, but this need not be the case for all the formulas in $Le(T_k)$. Consider indeed the following.} \begin{example}\label{ex:depth} \[ \Tree[.$*$ [.\ $p$ [.\ $q$ ] [.\ $q$ ]] [.\ $\neg p$ [.\ $r$ ] [.\ $\neg r$ ]]] \ \ \ \ \Tree[.$*$ [.\ $p$ [.\ $q$ ] [.\ $\neg q$ ]] [.\ $\neg p$ ]] \] Both the tree above on the left, that we will denote by $T_2$, and that on the right, that we will denote by $S_2$, are trees of depth 2, obtained by branching a tree (say $T_1=S_1$) composed of $*$ and children nodes $p,\neg p$. However, $T_2$ is obtained by branching each formula in $Le(T_1)$, so that each node in $Le(T_2)$ has depth $2$. On the other hand, $S_2$ is obtained by expanding only the node $p$, of depth 1, in $Le(S_1)$. The node $\neg p \in Le(S_1)$ is not expanded, so that we will also have $\neg p \in Le(S_2)$, while $\neg p$ is still of depth 1. Note that it will not suffice to expand the latter node to obtain a tree of depth 3, but rather at least one of the nodes of depth 2 in $Le(S_2)$ has to be expanded. \end{example} \hykel{The characteristic feature of Definition \ref{Tk} is {that} trees form an ordered \emph{sequence}, which can be interpreted as a hierarchy of levels of hypothetical uncertainty resolution branchings, of the kind illustrated by Example \ref{ex:ann}. Each successive level is obtained through a new binary branching aimed at deciding a yet undecided sentence and its negation. In this sense each new level of hypothetical uncertainty resolution is achieved by means of a constrained version of reasoning by cases. Put in yet another way, step $k+1$ in the recursive construction of ${(T_k)}_{k\in\mathbb{N}}$ amounts to the binary expansion of some \mbox{$k$-depth} leaves by new children nodes, each being labeled by a pair of mutually inconsistent pieces of information. Hence depth-bounded sequences can be seen as possible explorations of how uncertainty may be resolved by information which is \emph{not} held by the agent, starting from the information which the agent does hold. Clearly, agents whose reasoning is constrained by distinct bounds may not resolve the relevant uncertainty in the same way. This provides the logical basis to add in Section \ref{sec:approximating-probability-functions} an important and as yet under appreciated dimension to the the Laplacian dictum to the effect that probability depends in part on ``knowledge'' and in part on ``ignorance''.} Going back to the construction in Definition \ref{Tk}, note that if a leaf contains an atom as a subsentence and is not contradictory, then \emph{all} uncertainty in the sentences of interest has been resolved, i.e. the information reached coincides with a classical truth-value. However, and this is our main interest here, the agent will not normally possess sufficient resources to get there, and hence will be forced to content herself with an approximation of such truth-value. As we prove in the next section, the greater the depth of the tree-sequence, the better the agent will approximate a probabilistic estimate of such an uncertainty. \paolo{We must now integrate our framework with a sensible way of applying the recursive step in Definition \ref{Tk}, i.e. for selecting only limited, \emph{useful}} amount of branchings. A criterion of ``usefulness'' emerges rather naturally: given a sentence $\varphi$ in classical logic that an agent might want to decide, the agent checks which leaves $\a$ classically derive $\varphi$, i.e. $\a\vdash\varphi$. However, this is clearly not viable for resource-bounded agents. First, owing to the intractability of classical logic. Second, as pointed out in \cite{DAgostino2015} and informally in the introduction to this paper, a classical derivation $\a\vdash\varphi$ might itself make ``hidden'' use of hypothetical information, beyond that encoded in $\a$. This would be undesirable given our goal of accounting for the distinct roles played by actual and hypothetical information in the construction of the agent's uncertainty quantification. Hence we resort to 0-depth inference, introduced in \cite{DAgostino2013}. This logic, as mentioned in the introduction, does allow any use of hypothetical information, and, as a welcome byproduct, it is computationally tractable. So, in preparation for Proposition \ref{treeandlogic}, which collects the key properties of depth-bounded sequences, we briefly recall now the basic features of 0-depth inference from a proof-theoretic point of view. The presentation is entirely based on the IntElim (Introduction and Elimination) rules in Table \ref{intel}. We note in passing that this logic, and indeed the whole hierarchy of depth-bounded boolean logics which stems from it, is sound and complete with respect to a non-deterministic, information-based semantics. See \cite{DAgostino2015,DAgostino2013} for more details. \begin{table}[h!] \centering \begin{tabular}{|ccc|} \hline & & \\[1.0em] $\infer[(\wedge \mathcal{I}) ]{\varphi\land \psi}{\varphi & \psi } $ & $\infer[( \neg \wedge \mathcal{I}1)]{ \neg (\varphi \wedge \psi)}{\neg \varphi}$ & $\infer[( \neg \wedge \mathcal{I}2)]{\neg (\varphi \wedge \psi)}{\neg \psi}$ \\ & & \\ $\infer[ ( \neg \vee \mathcal{I})]{\neg(\varphi \vee \psi)}{\neg \varphi & \neg \psi}$ & $\infer[ (\vee \mathcal{I}1)]{\varphi \vee \psi}{\varphi}$ & $ \infer[ (\vee \mathcal{I}2)]{\varphi \vee \psi}{\psi}$ \\ & & \\ $\infer[ (\bot \mathcal{I})]{\bot}{ \varphi \ \ \neg \varphi}$ & $\infer[ (\neg \neg \mathcal{I})]{\neg \neg \varphi}{\varphi}$ & \\ & & \\ $\infer[ (\vee \mathcal{E}1)]{\psi} {\varphi \vee \psi \ \ \neg \varphi} $ & $ \infer[ (\vee \mathcal{E}2)] {\varphi}{\varphi \vee \psi \ \ \neg \psi}$ & $\infer[ (\neg \vee \mathcal{E}1)]{\neg \varphi} {\neg (\varphi \vee \psi)}$ \\ & & \\ $ \infer[ (\neg \vee \mathcal{E}2)]{\neg \psi}{\neg (\varphi \vee \psi)}$ & $ \infer[ (\wedge \mathcal{E}1)]{ \varphi}{\varphi \wedge \psi }$ & $\infer[ (\wedge \mathcal{E}2)]{\psi}{\varphi \wedge \psi}$ \\ & & \\ $ \infer[ (\neg \wedge \mathcal{E}1)] {\neg\psi}{\neg (\varphi \wedge \psi) \ \ \varphi}$ \ & \ $ \infer[(\neg \wedge \mathcal{E}2)]{ \neg\varphi}{\neg (\varphi \wedge \psi) \ \ \psi}$ & \\ & & \\ $ \infer[ (\neg \neg \mathcal{E})]{\varphi} {\neg \neg \varphi}$ & $ \infer[ (\bot \mathcal{E})] {\varphi}{\bot}$ & \\ & & \\ \hline \end{tabular} \caption{The standard propositional Introduction and Elimination rules for $\neg,\wedge,\vee$.} \label{intel} \end{table} \begin{definition}\label{0depthlogic} For $\Gamma\cup \{\varphi\}\subseteq \SL$, let $\Gamma \vdash_0 \varphi $ if and only if there is a sequence of sentences $\varphi_1,\dots,\varphi_m$ such that $\varphi_m = \varphi$ and each sentence $\varphi_i$ is either in $\Gamma$ or obtained by an application of the rules in Table \ref{intel} on the sentences $\varphi_j$ with $j<i$. \end{definition} So whilst $p\wedge q\vdash_0 p$, it is not the case that $*\vdash_0 p\vee\neg p$. More generally, it can be shown that, contrary to classical logic, $\vdash_0$ has no tautologies at all, i.e. for no $\varphi$, {do we have} $*\vdash_0\varphi$. The remainder of this section illustrates the pivotal role of 0-depth derivation in the construction of bounded sequences, starting with the definition of \emph{maximal sequences} which pins down the most useful form of uncertainty resolution. As usual, we say that $\c$ decides $\varphi$ if either $\c\vdash_0\varphi$ or $\c\vdash_0 \neg \varphi$. It is convenient to pin down the elements of a set $\Gamma$ which decide the sentence $\varphi$, i.e. we write \[ \dec{\Gamma}{\varphi} = \{\a \in\Gamma\mid \a \text{ decides } \varphi \}.\] This allows us to define maximality and closure in trees and sequences, as follows. \begin{definition}\label{max} Let $\{T_k\}_{k\in\mathbb{N}}$ be a DBT-sequence and $\varphi\in \SL, \Pi\subseteq \SL $. \begin{itemize} \item A tree $T_k$ is said to be \emph{$\{\varphi\}$-maximal} if there exists no tree $T'_k$ of depth $k$ with the same root, such that $|\dec{Le(T'_k)}{\varphi}| > |\dec{Le(T_k)}{\varphi}|$. \item A tree $T_k$ is said to be \emph{$\{\varphi\}$-closed} if $\dec{Le(T_k)}{\varphi} = Le(T_k)$, i.e. all the formulas $\a \in Le(T_k)$ decide $\varphi$. \item A sequence $\{T_k\}_{k\in\mathbb{N}}$ is \emph{$\Pi$-closed} if, for each $\varphi\in \Pi$ there is a $k\in\mathbb{N}$ such that $T_k$ is $\{\varphi\}$-closed. \item A finite sequence $\{ T_k\}_{k\leq n}$ is $\Pi$-maximal(closed) if for each $\varphi \in \Pi$, there is a $j\leq n$ such that $F_j$ is $\{\varphi\}$-maximal(closed). \end{itemize} \end{definition} Clearly, closed trees are in particular maximal. While a closed tree represents the ideal case in which an agent has resolved all the uncertainty relatively to a formula of interest, we can think of maximality as a ``second-best''. For DBT sequences, \paolo{it can be shown} that the two concepts actually coincide in the infinite case (this is the reason why we do not include a notion of maximality for them), while they differ for the finite case. Correspondingly, our approximation results, i.e. Theorem \ref{thm:prob} and Theorem \ref{thm:approxprob} make use of assumptions on closed sequences, while those in Section \ref{sec:complex}, where finite sequences are concerned, are limited to maximal ones. \begin{example}\label{ex:maxnomax} Consider the formula $(p\lor \neg p) \lor q$, and the following depth $1$ trees: \Tree[.$*$ [.\ $p$ ] [.\ $\neg p$ ]] \ \ \ \ \Tree[.$*$ [.\ $q$ ] [.\ $\neg q$ ]]\\ The tree on the left-hand side is $\{(p\lor \neg p) \lor q\}$- closed, for we have both $p \vdash_0(p\lor\neg p) \lor q$ and $\neg p\vdash_0 (p\lor\neg p) \lor q$. However, it is not the case that $\neg q$ on the tree on the right-hand-side decides $(p\lor\neg p) \lor q$. Hence the tree on the right-hand-side is not $\{(p\lor \neg p) \lor q\}$-closed, and in particular not maximal. Note that closeness (let alone maximality) does not imply uniqueness. This is easily shown by taking again the $1$ depth trees above, which are both $\{(p\lor \neg p) \lor (q\lor\neg q)\}$-closed. \end{example} So far, we have only used 0-depth consequence, which is only the starting point of the hierarchy of Depth-Bounded Boolean Logics. \paolo{The remaining logics in the hierarchy were defined in \cite{DAgostino2013} as follows.} \begin{definition}\label{kdepthlogic} For each $k>0$ and set of sentences $\Gamma\cup \{\varphi\}\subseteq \SL $, we let $\Gamma \vdash_k \varphi$ if and only if there is a $\b\in \sf(\Gamma\cup \{\varphi\})$ such that $\Gamma, \b\vdash_{k-1} \varphi $ and $\Gamma, \neg\b\vdash_{k-1} \varphi $. \end{definition} We refer to the original works \cite{DAgostino2013,DAgostino2015} for further details on the key properties of Depth-Bounded Boolean Logics which include the following: \begin{itemize} \item $\vdash_0\subset\vdash_1\subset\cdots\subset \vdash_k\subset\cdots$, so the depth-bounded consequence relations form a hierarchy; \item the limit for $ k\rightarrow \infty$ of $\vdash_k$ is $\vdash$, i.e. in the limit, the hierarchy of DBBLs coincides with classical logic; \item for each $k$, $\vdash_k$ has a polynomial-time decision procedure. \end{itemize} The next Proposition shows that $k$-depth logics and maximal trees are closely connected. Before that, let us recall that, as some classical inferences are available only at higher level of the hierarchy of DBBLs, the same holds for recognizing contradictions. In principle, it might be the case that a piece of information $\a$ is contradictory ($\a\vdash\bot$), while this might not be recognizable at 0-depth ($\a\not\vdash_0\bot $). Ruling out this case leads us to a even tighter connection between $k$-depth trees and the corresponding $k$-depth logic. In the following we will say that a tree $T_k$ is \emph{free of deep contradictions} iff for each $\a\in Le(T_k)$, having $\a\vdash\bot$ implies that $\a\vdash_0 \bot$. \begin{proposition}\label{treeandlogic} Let $\varphi \in \SL\cup\{*\},\psi\in\SL$. If $\varphi\vdash_k \psi$, then the following hold: \begin{enumerate}[(a)] \item There exists a tree $T_{k}$ of depth $k$ rooted in $\varphi$, such that $\a\vdash_0\psi$, for each $\a\in Le(T_{k})$. \item There exists a tree $T_{k}$ of depth $k$ rooted in any sentence $\c\in\SL\cup\{*\}$, such that, for each $\a\in Le(T_{k})$, if $\a\vdash_0\varphi$, then $\a\vdash_0\psi$. \item For any $\{\psi\}-$maximal tree $T_k$ of depth $k$ rooted in $\varphi$ and free of deep contradictions, we have that $\a\vdash_0\psi$, for each $\a\in Le(T_k)$. \item For any $\{\neg\varphi \lor \psi\}-$maximal tree $T_{k+1}$ of depth $k+1$ rooted in a sentence $\c$ and free of deep contradictions, we have that $\a\vdash_0\psi$, for each $\a\in Le(T_{k+1})$ such that $\a\vdash_0\varphi$. \end{enumerate} \end{proposition} \begin{proof} (a).\paolo{ Let us construct a tree $T_k$ of depth $k$ as follows. The root is $\varphi$. Now, since $\varphi\vdash_k \psi$, by Definition \ref{kdepthlogic}, there is a $\b$ such that $\varphi,\b\vdash_{k-1}\psi$ and $\varphi,\neg\b\vdash_{k-1}\psi$. We thus branch the root with two nodes $\varphi\land\b$, $\varphi\land \neg\b$. We repeat the procedure as follows: for any $1\leq j< k$, assuming that, for each node $\a$ at depth $j$, we have $\a \vdash_{k-j} \psi$, we branch the node $\a$ with the two formulas $\b$ and $\neg \b$ such that $\a,\b\vdash_{k-j-1}$ and $\a,\neg \b \vdash_{k-j-1} \psi$ (such a $\b$ exists, by Definition \ref{kdepthlogic}). } \paolo{ Proceeding by induction, we then obtain that any node $\a$ at depth $0\leq j\leq k$ in the tree thus constructed is such that $\a\vdash_{k-j} \psi$; hence, in particular, for any leaf $\a\in Le(T_k)$ (i.e. formula at depth k), $\a\vdash_0\psi$.} (b) \paolo{We consider the same tree as in (a), but with root $\c$, instead of $\varphi$. Let us write any leaf in this tree as $\gamma\land \b$ and any leaf in the tree in (a) as $\varphi\land\b$. By (a), we have that $\varphi\land\b\vdash_0\psi$ for any $\b$. Whenever $\gamma\land\b\vdash_0\varphi$, since by $(\land\mathcal{E}) $, $\gamma\land\b\vdash_0\b$, we also have $\gamma\land\b\vdash_0\varphi\land\b$ (by $\land\mathcal{I}$). Hence, by the transitivity of $\vdash_0$, we obtain our claim, namely that $\gamma\land\b\vdash_0\psi$, whenever $\gamma\land\b\vdash_0\varphi$.} (c) \paolo{The tree built in (a) is such that $\a \vdash_0 \psi$ for each $\a\in Le(T_k)$, hence it is a $\{\psi\}$-closed tree. Any other $\{\psi\}$-maximal tree $T'_k$ will thus also be in particular $\{\psi\}$-closed. Consider now a $\{\psi\}$-closed tree $T'_k$ which is free of deep-contradictions: each leaf will decide $\psi$. Assume that, for some leaf, say $\varphi\land\b \in Le(T'_k)$, it holds that $\varphi\land \b \vdash_0\neg\psi$. This means in particular that $\varphi\land\b \vdash_k \neg \psi$. But then, since $\varphi\vdash_k\psi$, we also have $\varphi\land\b\vdash_k\psi$. Hence, $\varphi\land\b\vdash_k\bot$, and by the assumption that $T'_k$ is free of deep contradictions (see Definition \ref{max}), we will have $\varphi\land\b\vdash_0 \bot$. Hence, by rule ($\bot\mathcal{E}$), we have again $\varphi\land\b\vdash_0\psi$. This finally shows that each leaf in a $\{\psi\}$-maximal tree derives at 0-depth $\psi$.} (d)\paolo{Assume $\varphi\vdash_k\psi$. Note that $\neg \varphi \vdash_0 \neg \varphi \lor \psi$ by the rule ($\lor \mathcal{I}1$), hence in particular $\neg \varphi \vdash_{k} \neg \varphi\lor \psi$. On the other hand, since $\varphi\vdash_k\psi$ , again by the rule ($\lor \mathcal{I}1$), we get $\varphi\vdash_{k}\neg\varphi \lor \psi$. This shows, by Definition \ref{kdepthlogic} that $\vdash_{k+1}\neg \varphi \lor \psi$. Applying (c), we obtain that for any $\{\neg\varphi\lor \psi\}$-maximal tree $T_{k+1}$ rooted in $\c$, we have $\a\vdash_0\neg\varphi\lor\psi$ for each $\a \in Le(T_{k+1})$. Now, let $\a \in Le(T_{k+1})$ be such that $\a\vdash_0\varphi$. By the rule $\neg\neg\mathcal{I}$ applied to $\varphi$, we obtain $\a\vdash_0\neg\neg \varphi$. Recalling that $\a\vdash_0\neg\varphi\lor\psi$, applying the rule $\lor\mathcal{E}1$ to $\neg\varphi\lor\psi$ and $\neg\neg\varphi$, we finally obtain $\a\vdash_0 \psi$. \end{proof} \section{Approximating Probability Functions}\label{sec:approximating-probability-functions} We now turn to our main concern, namely showing that finitely additive probability functions $P\colon \SL \to [0,1]$ can be approximated by sequences of uncertainty measures which we will call \emph{k-depth belief functions}. Depth-bounded trees capture the hypothetical uncertainty resolution of \emph{one} particular piece of information. However the probabilistic quantification of uncertainty typically involve the simultaneous hypothetical exploration of more pieces of information. Suppose, for instance, that an agent is informed that half of the balls in a urn are either yellow or green $(Y \lor G)$, and the remaining half are either red or white ($R\lor W$). Here, if an agent is willing to assign probabilities to the propositional variables $Y,G,R,W$, she needs to simulate information that she does not possess, concerning the piece of information $Y\lor G$ on the one hand, and $R\lor W$, on the other. For instance, on the basis of the symmetry of the problem, she might assign equal weights to $R$ and $W$, and to $Y$ and $G$. This would result in a probabilistic assignment $P$ such that $P(Y)=P(G)=P(R)=P(W)=1/4$. Once more, let us stress that the assignment $P(Y)=P(G)=P(R)=P(W)=1/4$ is different in nature from the information $P(Y\lor G) = P(R\lor W)= 1/2$: the former was arrived at by the agent, by taking into account different hypothetical scenarios and weighting them, while the latter was information actually provided to her from the start. This setup will be formally addressed, using our framework, in Example \ref{ellsbergvariant}. The information actually held by an agent, as that on $Y\lor G$ and $R\lor W$, in the above example, will be collected in the \emph{support set}, which we denote by $\mathit{Supp}$. \paolo{By this we do not mean that an agent possesses information on whether the sentences in $\mathit{Supp}$ are the case, but rather that only on these sentences the agent can initially quantify her uncertainty probabilistically. } Each formula of $\mathit{Supp}$ will act then as the root of a DBT-sequence, aimed at resolving the uncertainty therein contained. With this motivation we now generalise the framework of Section \ref{sec:bounded} from sequences of depth-bounded trees to \emph{depth-bounded forests}. To do this, it will be convenient to assume that $\mathit{Supp}$ is nonempty and contains at least one consistent sentence. As before, the symbol $*$ will be used to denote the special case in which the agent holds no initial information at all, i.e. we let in that case $\mathit{Supp} =\{*\}$. In the following $inc(\Gamma)$ will denote the set $\{\a\in S\mid \a\vdash_0 \bot\}$ for any $\Gamma\subseteq \SL$. Unless otherwise stated, we shall thus have $inc(\mathit{Supp})\subset \mathit{Supp} \subseteq \SL \cup\{*\}$. \begin{definition}\label{Fk} For each $\c \in \mathit{Supp}$, let $\{T_k(\c)\}_{k\in\mathbb{N}}$ be a DBT-sequence rooted in $\c$. Then: \begin{itemize} \item A \emph{depth-bounded forest} sequence (DBF-sequence, for short) ${(F_k)}_{k\in\mathbb{N}}$ based on $\mathit{Supp}$ is obtained by letting $F_k = \cup_{\c\in\mathit{Supp}} T_k(\c)$, for each $k\in\mathbb{N}$; \item A \emph{ finite depth-bounded forest sequence} is any initial segment ${(F_k)}_{k\leq n}$ of a depth-bounded sequence ${(F_k)}_{k\in\mathbb{N}}$, for some $n\in \mathbb{N}$. \end{itemize} \end{definition} The notion of maximality and closure (see Definition \ref{max} above) adapts immediately to forests as follows. \begin{definition}\label{maxf} For $\varphi\in\SL, \Pi\subseteq \SL $ we say that \begin{itemize} \item a forest $F_k$ based on $\mathit{Supp}$ is \emph{$\{\varphi\}$-closed} (maximal) if each tree $T_k(\gamma)$ in $F_k$ is $\{\varphi\}$-closed(maximal) for each $\c \in \mathit{Supp}$. \item a DBF-sequence $\{F_k\}_{k\in\mathbb{N}}$ based on $\mathit{Supp}$ is \emph{$\Pi$-closed} if each DBT-sequence $\{T_k(\c)\}_{k\in\mathbb{N}}$ in $\{F_k\}_{k\in\mathbb{N}}$ is $\Pi$-closed, for each $\c\in\mathit{Supp}$. \item \paolo{ a finite DBF-sequence $\{ F_k\}_{k\leq n}$ based on $\mathit{Supp}$ is \emph{$\Pi$-closed} (maximal) if each finite DBT-sequence $\{ T_k(\c)\}_{k\leq n}$ is $\Pi$-closed (maximal), for each $\c\in\mathit{Supp}$ .} \end{itemize} \end{definition} We can now start working our way up to the approximation of probability functions. \begin{definition}[Probability mass function]\label{m0} For $\Gamma \subseteq \SL \cup \{*\}$, say that $m\colon \mathcal{P}(\Gamma) \to [0,1]$ is a \emph{probability mass function over $\Gamma$} if $m$ is a finitely additive measure, such that $m(\Gamma)=1$, $m(\emptyset) =0$, and $m(inc(\Gamma))=0$. \end{definition} Note that in the interest of readability we write $m(\a)$ in place of $m(\{\a\})$, unless confusion may arise. We shall also refer to probability mass functions simply as ``mass functions''. \paolo{When applied to the set $\mathit{Supp}$, the mass function defined above captures, in analogy with Dempster-Shafer Belief functions, the uncontroversial probabilistic quantification of uncertainty which is licensed by the actual information possessed by the agent.} While in Shafer's theory \cite{Shafer1990} agents can fill in potential gaps in their ``evidence'' by using judgment, the key idea of our proposal is to provide a logical framework to constrain this judgment formation. In particular, depth-bounded forests provide a principled way to allow agents to go beyond the information they actually possess, by exploring hypotheses for the resolution of uncertainty. The characteristic feature of our construction is that this simulation will be bounded by a \emph{fixed} sequence. \begin{definition}[DBM-sequence]\label{quantsequence} Let $\{F_k\}_{k\in\mathbb{N}}$ be a DBF-sequence based on $\mathit{Supp}$, which is free of deep contradictions. We say that $\mathcal{F} = (F_k,m_k)_{k\in\mathbb{N}} $ is a \emph{depth-bounded mass sequence} (DBM-sequence for short) if each $m_k$ is a mass function over $Le(F_k)$, and for each $k >0 $, and leaf $\a \in Le(F_{k-1})$, the following holds: \begin{itemize} \item $m_k(\a) =m_{k-1}(\a)$, if $\a\in Le(F_{k})$. \item $m_k(\{\a\land\b,\a\land\neg\b \}) = m_{k-1}(\a)$, if $\a$ has children nodes $\a\land\b$, $\a\land\neg\b$. \end{itemize} \end{definition} The condition on deep contradictions excludes the possibility that sentences might result consistent at depth $k-1$, while turning out inconsistent at depth $k$ (see \cite{Baldi2020,DAgostino2013}). If this were the case, the inconsistent sentences would have to be assigned mass 0, and their original mass should be redistributed among the consistent formulas. We do not consider that more general case, since it would complicate our definitions, without any major conceptual gains for our main results. Note that the initial mass function $m_0$ is defined over $Le(F_0)$, which is equal to the initial support set $\mathit{Supp}$. \paolo{The agent further refines the quantification by distributing the mass assigned to each leaf at depth $k$, among its children nodes, which are the leaves at depth $m_{k+1}$}. The leaves of depth-bounded forests for $k>0$ keep track of the information that has been probabilistically quantified by the agent. To extend this to an arbitrary sentence $\varphi$, the agent looks at the set of sentences whose uncertainty has been assessed (the leaves) and that allows her to 0-derive $\varphi$. Dually, the agent can also consider the set of sentences whose uncertainty has been assessed (the leaves) and that do not allow a 0-derivation of $\neg\varphi$. This is again reminiscent of the construction of Dempster-Shafer Belief functions. Indeed, for any sentence $\varphi \in \SL$, given a DBF-sequence $\{F_k\}_{k\in \mathbb{N}}$ of depth-bounded forests, the set \[b_{k}(\varphi) = \{\a \in Le(F_k) \mid \a \vdash_0 \varphi, \ \a\not\vdash_0\bot\} \] captures the belief mass that an agent commits to a sentence $\varphi$ \emph{after} simulating uncertainty resolution of depth $k$ whereas \[ pl_{k}(\varphi) = \{\a \in Le(F_k) \mid \a \not\vdash_0 \neg\varphi \}\] similarly captures $k$-depth plausibility. This is the sense in which our construction puts the judgment component of Belief functions under logical constraints. \begin{definition}\label{bk} Let $(F_k,m_k)_{k\in\mathbb{N}}$ be a DBM-sequence. The \emph{$k$-depth Belief function $B_k$} and the \emph{$k$-depth Plausibility function $Pl_k$} are defined by letting: $$ B_k(\varphi) = m_k(b_k(\varphi)) \text{ and } Pl_k(\varphi) = m_k(pl_k(\varphi)),$$ respectively. \end{definition} Let us now put our framework to work through a classic example. Though anticipated by \cite{Keynes1921,Knight1921} the example has gained prominence in the analysis of \cite{Ellsberg1961}, who used it to argue normatively against the adequacy of the probabilistic representation of uncertainty in the face of partly resolving uncertainty, or ambiguity. In addition to illustrating the basic mechanism of our framework, the example also sheds new light on how the logical framework may contribute to the analysis of foundational issues in decision theory. \begin{example}[Ellsberg's ``one urn'' problem]\label{ellsberg} Let $\L$ be a finite language with the propositional variables $\{Y,G,R\}$, interpreted as {\em the ball is Yellow, Green, Red}, respectively. The problem is that of a single draw from an urn and the ``Laplacian information'' is to the effect that 2/3 of the balls are either yellow or green with the remaining 1/3 being red. This information is logically represented by the conjunction $\c$ of the sentences in the set \[\{ Y\to (\neg G \land \neg R), R\to (\neg G \land \neg Y), G \to (\neg R \land \neg Y), Y\lor G\lor R\}.\] The problem clearly suggests letting $ \mathit{Supp} = \{(Y\lor G) \land \c, R\land \c \}$. The first step in our model now requires us to quantify our uncertainty based only on actual information, which is readily done by letting $m_0((Y\lor G)\land \c) = 2/3$ and $ m_0(R \land \c) =1/3$. This implies \begin{eqnarray*} B_0(Y\lor G) =& 2/3\\ B_0(R)=&1/3\\ B_0(\c) =& 1\\ B_0(Y)=B_0(G)=&0. \end{eqnarray*} Since the interesting part of this problem is the process of analyzing the initial information and assigning probabilities to its sentences, it is natural to restrict the attention to sequences which are $S(\mathit{Supp})$-maximal. One can easily check that, for the node $R\land \c$ in $\mathit{Supp}$, we already have $R\land \c\vdash_0\neg Y$, $ R\land \c\vdash_0\neg G$ and $ R\land \c\vdash_0 R$. The node thus decides $S(\mathit{Supp})$, and needs not be expanded at depth 1. However, at depth 1 the node $(Y\lor R)\land\c$ will be suitably expanded. Note that there are only two possible $S({\mathit{Supp}})$-maximal forests at this depth: \begin{center} \Tree[.$(Y\lor G)\land\c$ [.$Y$ ] [.$\neg Y$ ]] \ \ \Tree[.$R\land\c$ ] \end{center} and \begin{center} \Tree[.$(Y\lor G)\land \c$ [.$G$ ] [.$\neg G$ ]] \ \ \Tree[.$R\land\c$ ] \end{center} In both cases all the leaves of the forest at depth 1 decide $S(\mathit{Supp})$, hence the forest is $S({\mathit{Supp}})$-closed, and in particular maximal. \paolo{ At this depth, the symmetry of the available, mutually exclusive, options may lead the agent to assign $ m_1((Y\lor G)\land\c \land Y)) =m_1((Y\lor G)\land \c\land \neg Y)) = 1/3 $, though this is not the unique available option)}. This in turn yields \begin{eqnarray*} B_1(Y)=&1/3\\ B_1(G)=& 1/3\\ B_1(R)=&1/3. \end{eqnarray*} Note that this is now compatible with the probabilistic quantification of uncertainty, which can be seen to have been obtained from information actually held by the agent, via a single iteration of hypothetical uncertainty resolution. \end{example} \begin{example}\label{ellsbergvariant} The variant of Ellsberg's problem sketched at the beginning of this Section arises by considering the propositional variables $\{Y,G,R,W\}$, a sentence $\c$ representing background information, and taking $ \mathit{Supp} = \{(Y\lor G) \land \c, (W\lor R)\land \c \}$. The quantification of uncertainty based on the information actually possessed by the agent is rendered by letting $$m_0((Y\lor G)\land \c) = 1/2$$ and $$ m_0( (W\lor R) \land \c) =1/2.$$ This implies \begin{eqnarray*} B_0(Y\lor G) =& 1/2\\ B_0(W\lor R)=&1/2\\ B_0(\c) =& 1\\ B_0(Y)=B_0(G)=B_0(W)=B_0(R)=&0. \end{eqnarray*} At depth 1 the nodes $(Y\lor G)\land\c$ and $(W\lor R)\land\c$ will be suitably expanded, for instance as follows: \begin{center} \Tree[.$(Y\lor G)\land\c$ [.$Y$ ] [.$\neg Y$ ]] \ \ \Tree[.$(W\lor R)\land\c$ [.$W$ ] [.$\neg W$ ]] \ \ \end{center} At this point, at depth 1 all the leaves of the forest decide $S(\mathit{Supp})$. Again, by the symmetry of the problem, we might consider $ m_1((Y\lor G)\land\c \land Y)) =m_1((Y\lor G)\land \c\land \neg Y)) = 1/4 $ and $ m_1((W\lor R)\land\c \land W)) =m_1((W\lor R)\land \c\land \neg W)) = 1/4 $ which in turn yields: \begin{eqnarray*} B_1(Y)=&1/4\\ B_1(G)=& 1/4\\ B_1(R)=&1/4\\ B_1(W)=&1/4. \end{eqnarray*} \end{example} According to the main result of this Section, and indeed of the paper, $k$-depth Belief functions are shown to approximate their additive counterparts. In preparation to it we will illustrate the close relation between $k$-depth Belief functions and $k$-depth deductions. We begin by adapting to the present framework Proposition 1 of \cite{Baldi2020}. The main difference between the two formalisms is that the $k$-depth belief functions here are based on a \emph{fixed} choice of hypothetical information, encoded in the underlying DBF-sequence, while those in \cite{Baldi2020} may take into account any such choices at once. This owes to the rather different research questions which motivate the two papers. However, the two formalisms {are} reconciled by adding suitable maximality assumptions to the DBF-sequence defining our functions. \begin{proposition}\label{bkprop} Let $\mathcal{F} = (F_k,m_k)_{k\in\mathbb{N}}$ be a DBM-sequence based on $\mathit{Supp}\subseteq \SL \cup\{*\}$. The following hold: \begin{enumerate} \item $\vdash_k \varphi$ implies $B_k(\varphi)=1$, for any $F_k$ which is $\{\varphi\}$-maximal and free of deep contradictions. \item $\vdash_k \neg \varphi$ implies $B_k(\varphi)=0$, for any $F_k$ that is $\{\varphi\}$-maximal and free of deep contradictions. \item $\varphi \vdash_k \psi$ implies \begin{itemize} \item $B_{k}(\varphi) \leq B_{k}(\psi)$, for some $F_k$. \item $B_{k+1}(\varphi)\leq B_{k+1}(\psi)$, for any $F_k$ which is $\{\neg \varphi \lor \psi\}$-maximal and free of deep contradictions. \end{itemize} \item$\displaystyle B_k( \bigvee_{i=1}^n \varphi_i ) \geq \sum_{\emptyset \neq S\subseteq\{1,\dots,n\}} (-1)^{|S|-1} B_k(\bigwedge_{i\in S} \varphi_i)$ for each $\varphi_1,\dots,\varphi_n\in \SL$. \end{enumerate} \end{proposition} \begin{proof} (1) and (2) are immediate consequences of Proposition \ref{treeandlogic} (b). The first item of (3) is an immediate consequence of Proposition \ref{treeandlogic}(c), and the second of Proposition \ref{treeandlogic}(d) (4). By a straightforward adaptation of Proposition 1 in \cite{Baldi2020}. \end{proof} \begin{remark}\label{rem:maximality} Proposition \ref{bkprop} makes explicit that suitable maximality assumptions play a fundamental role in establishing the close connection between $k$-depth Belief functions of Definition \ref{bk} and depth-bounded logics. The assumption requires that the agent chooses the \lq\lq right" pieces of hypothetical information: i.e. those which decide the sentence of interest in as many cases (i.e. leaves of the forest) as possible. This condition makes our results normatively interpretable: once the limitation of the inferential ability of the agent are taken into account (the depth), we are still requiring that her belief follows constraints dictated by the corresponding ($k$-depth) logic. \end{remark} We will now show that, under suitable assumptions, DBM-sequences determine a probability, in the limit. We begin with a lemma adapted from \cite{Baldi2021}, where it was originally presented in a qualitative setting. \begin{lemma}\label{threshold} \paolo{Let $\mathcal{F} = (F_k,m_k)_{k\in\mathbb{N}}$ be a DBM-sequence which is free of deep contradictions. For any formula $\varphi$, if there is a $j\in\mathbb{N}$ such that $F_j$ is $\{\varphi\}$-closed, then $B_k(\varphi)= B_j(\varphi)$ for any $k\geq j$.} \end{lemma} \begin{proof} Let $F_j$ be $\{\varphi\}$-closed, i.e. assume that each $\a\in Le(F_j)$ decides $\varphi$. Let us focus the set of leaves $\a$ such that $\a\vdash_0\varphi$, i.e. the set $b_j(\a)$. Now, for any $k\geq j$, the leaves which are descendants of $\a$ will be of the form $\a\land\b$. Hence, by applying rule $\land\mathcal{E}$ in Table \ref{intel}, and using the transitvity of $\vdash_0$ we will have $\a\land\b\vdash_0 \varphi$, for each such $\a\land\b$. A similar argument goes through for those remaining $\a\in Le(F_j)$ such that $\a\vdash\neg \varphi $. We get thus that $b_k (\varphi) = \{\a\land \b \in Le(F_k)\mid \a\vdash_0\varphi \}$. Moreover, since $\mathcal{F}$ is free of deep contradictions, we have that $m_j(\a) = m_k\{\a\land\b \mid \a\land \b \text{ descendant of } \a\in Le(F_j)\}$ (see Definition \ref{quantsequence}) for each $\a\in b_j(\varphi)$ . Hence, we obtain $m_k(b_k(\varphi)) = m_j(b_j(\varphi))$, and thus $B_k(\varphi) = B_j(\varphi)$ for each $k\geq j$. \end{proof} {We can now state and prove our main results. First, we show that \paolo{ (additive) probability functions can be approximated by $k$-depth Belief functions. Conversely we identify the conditions under which $k$-depth Belief functions give rise to probability functions in the limit.} \begin{theorem}\label{thm:approxprob} Let $P\colon \SL \to [0,1]$ be a probability function. Then there is a DBM-sequence $\mathcal{F}$ based on $\mathit{Supp} = \{ *\}$ such that $$P(\varphi) = \displaystyle\lim_{k\to\infty} B_k(\varphi),$$ for any $\varphi\in\SL$. \end{theorem} Something indeed quite stronger will be proved, namely that there is an $n\in\mathbb{N}$ such that $P(\varphi)= B_n(\varphi)$. Recall that we denote by $\mathit{At}_\L$ the set of maximally (classical) consistent conjunctions of literals from a language $\mathcal L$ with $n$ propositional variables. \begin{proof} Define a DBM-sequence $\mathcal{F} = (F_k,m_k)_{k\in\mathbb{N}}$ based on $*$ such that $Le(F_n)$ coincides with $\mathit{At}_\L$ and $m_n(\a) = P(\a)$ for each $\a \in \mathit{At}_\L = Le(F_n)$. Note that once we fix $m_n$, Definition \ref{quantsequence} forces us to uniquely determine all the $m_k$ for $k< n$. Moreover, it can be easily shown that, if $\a\in At_\L$, then for any $\varphi\in \SL$, we have that $\a\vdash\varphi$ iff $\a\vdash_0\varphi$. Hence for any $\varphi\in \SL$ \[P(\varphi) = \sum_{\substack{ \a \in At_\L \\ \a \vdash \varphi }} P(\a) = \sum_{\substack{ \a \in At_\L \\ \a \vdash_0 \varphi }} P(\a) = m_n(b_n(\varphi)) = B_n(\varphi). \] Moreover, at depth $n$, the uncertainty about all the propositional variables in $\L$ will have been resolved and $F_n$ will be $\{\varphi\}$-closed. Hence, by Lemma \ref{threshold} we will have $B_k(\varphi)=B_n(\varphi) = P(\varphi)$ for any $k\geq n$, as required.\end{proof} \begin{remark} Note that the sequence constructed in the proof above is in particular an $\SL$-closed sequence, which at a certain depth decides all the propositional variables, hence all the sentences, in our finite language. The argument extends also to a countable language. To see this, note that by Lemma \ref{threshold}, for each sentence $\varphi \in \SL$ there is a $j_\varphi\in\mathbb{N}$ such that $P(\varphi) = B_{j_\varphi}(\varphi)$, and $B_k(\varphi) = B_{j_\varphi}(\varphi)$ for each $k\geq j_\varphi$. Hence, what is peculiar to the countable case is the fact that the index $n$ at which $B_n(\varphi)$s equals $P(\varphi)$ may be distinct for distinct elements of $\SL$. Whether $\L$ is finite or countable, $P(\varphi) = \displaystyle\lim_{k\to\infty} B_k(\varphi)$. \end{remark} \begin{theorem}\label{thm:prob} \paolo{Let $\mathcal{F} = (F_k,m_k)_{k\in\mathbb{N}}$ be a DBM-sequence with $\{F_k\}_{k\in\mathbb{N}}$ a $\SL$-closed DBF-sequence free of deep contradictions. Then, the function $P\colon\SL\to[0,1]$, obtained by letting \[ P(\varphi) = \displaystyle\lim_{k\to\infty} B_k(\varphi)\] for any $\varphi\in\SL$, is a probability.} \end{theorem} \begin{proof} To prove that $P$ is a probability function, we need to show that it satisfies the two properties (PL1) and (PL2) in the introduction. For (PL1), assume $\vdash\varphi$ for some $\varphi\in\SL$. Then, since the DBLLs approximate $\vdash$ \cite{DAgostino2013} there is a $i$ such that $\vdash_i\varphi$. On the other hand, since $\{F_k\}_{k\in\mathbb{N}}$ is $\SL$-closed, there is a $\{\varphi\}$-closed $j$-depth forest $F_j$ free of deep contradictions. Hence, by Proposition \ref{bkprop} we will then have $B_j(\varphi) =1$, and by Lemma \ref{threshold}, $B_n(\varphi) =1$ for each $n\geq \max\{j,i\}$ . Let us now assume that $\vdash\neg(\varphi\land\psi)$. We want to show that $P(\varphi\lor\psi)=P(\varphi)+P(\psi)$. As before, for some $i$, we will have that $B_i(\varphi\land \psi ) =0$, and the same will hold for any $n\geq i$. Now, since $\mathcal{F}$ is $\SL$-closed, there will be a $j$ such $F_j$ is $\{\varphi\}$-closed. and a $k$ such that $F_k$ is $\{\psi\}$-closed. Now, let us consider any $n\geq \max\{i,j,k\}$. First, since $n\geq i$, we have $B_n(\varphi\land\psi)=m_n(b_n(\varphi\land\psi)) = 0$. Let us now consider the set $b_n(\varphi\lor\psi)$. Since $n\geq \max\{j,k\}$, $F_n$ will be both $\{\varphi\}$-closed and $\{\psi\}$-closed, hence we will have \begin{align}\label{bnsum} \begin{split} b_n(\varphi\lor\psi) & = \{ \a\in Le(F_n) \mid\a\vdash_0 \varphi\lor\psi)\} \\ & = \{ \a\in Le(F_n) \mid\a\vdash_0 \varphi, \a \vdash_0 \psi)\} \\ & \cup \{\a\in Le(F_n)\mid \a\vdash_0\varphi, \a\vdash_0\neg\psi\} \\ & \cup \{\a\in Le(F_n)\mid \a\vdash_0\neg \varphi, \a\vdash_0\psi\} \end{split} \end{align} where all three sets are clearly disjoint. On the other hand, we have \[ \{\a\in Le(F_n)\mid \a\vdash_0\varphi, \a\vdash_0\psi\} = \{ \a\in Le(F_j)\mid \a\vdash_0\varphi\land\psi\} \] and $m_n( \{\a\in Le(F_n)\mid \a\vdash_0\varphi\land\psi\})= m_n(b_n(\varphi\land\psi))= 0$. From this and Equation \ref{bnsum}, it follows that $m_n(b_n(\varphi\lor\psi))$ equals: \begin{align*} m_n \{\a\in Le(F_n)\mid \a\vdash_0\varphi, \a\vdash_0\neg\psi\} + m_n (\{\a\in Le(F_n)\mid \a\vdash_0\neg \varphi, \a\vdash_0\psi\})\\ = m_n(b_n(\varphi)) + m_n(b_n(\psi)) \end{align*} From the latter, we finally get $B_n(\varphi\lor\psi) = B_n(\varphi) + B_n(\psi)$. This will hold for any $n\geq \max \{i,j,k\}$, hence we finally obtain our desired result, i.e. $P(\varphi\lor\psi) = P(\varphi) + P(\psi)$. \end{proof} \section{When $k-$depth Belief functions are tractable}\label{sec:complex} We now turn to identifying the conditions under which the approximations granted by Theorem \ref{thm:approxprob} are computationally feasible. \begin{definition}\label{uniform} \paolo{A sequence $\mathcal{F} = (F_k)_{k\in\mathbb{N}}$ of depth-bounded forests with initial support $\mathit{Supp}$ is said to be: \begin{itemize} \item \emph{uniform} iff, for each $k$, all the nodes in the trees in $F_k$ contain the same hypothetical information, with the exception of the root. \item \emph{analytic} iff it is $S(\mathit{Supp})$-maximal, and all the nodes in the trees in $F_k$ contain as hypothetical information only formulas in $S(\mathit{Supp})$. } \item A \emph{$\Pi$-maximal uniform(analytic) sequence} is a sequence which is $\Pi$-maximal among the uniform(analytic) sequences. \end{itemize} \end{definition} Note that the restriction to uniform sequences is immaterial for the result in Theorem \ref{thm:approxprob}, since the approximating sequence built in the proof is based on $\{*\}$, hence it is trivially uniform. \begin{example} Let $\mathit{Supp} = \{p\lor q, s \lor r\}$. The 1-depth forest \begin{center} \Tree[.$(p\lor q)$ [.$p$ ] [.$\neg p$ ]] \ \ \Tree[.$(s\lor r)$ [.$p$ ] [.$\neg p$ ]] \ \ \end{center} is uniform, while the 1-depth forest \begin{center} \Tree[.$(p\lor q)$ [.$p$ ] [.$\neg p$ ]] \ \ \Tree[.$(s\lor r)$ [.$s$ ] [.$\neg s$ ]] \ \ \end{center} is not. Moreover, the forests in Example \ref{ex:maxnomax} are all trivially uniform, since they reduce to just single trees, while the forests at Depth 1 in Example \ref{ellsberg} are not uniform. \end{example} Let us now consider two core reasoning tasks with our depth-bounded belief functions. Following \cite{Paris1994,finger15,hansen2000,FHM90}, which investigate the complexity of reasoning with probability functions, we assume that an agent is provided with $n$ linear constraints on the sentences $\varphi_1,\dots,\varphi_p$, of the form: \begin{equation}\label{preclsystem} \sum\limits_{j=1}^p d_{ij} B(\varphi_j) \leq z_i \ \ \ \ i=1,\dots,n \ \ \ d_{ij}, z_i \in \mathbb{Q}. \end{equation} Let us equivalently rewrite \eqref{preclsystem} as \begin{equation}\label{clsystem} \sum\limits_{j=1}^{p_1} a_{ij} B(\varphi_j) + w_i \leq \sum\limits_{j=1}^{p_2} b_{ij} B(\varphi_j) +v_i \end{equation} where $i=1,\dots,n \ \ \ a_{ij},b_{ij},w_i,v_i \in \mathbb{N}, p_1+p_2 =p.$ The GENPSAT problem (see e.g. \cite{CCM17}) consists in finding out whether there is a probability function over $\SL$ satisfying such a system. It is well-known that GENPSAT, as well as other minor variants involving linear constraints, is NP-complete \cite{Paris1994,finger15}. For our present purposes, a variation on the problem will be more appropriate: \paolo{we will rather aim to find out whether there are depth-bounded Belief and Plausibility functions, which can be seen as approximations of a probability function satisfying the given linear constraints.} We will thus consider decision problems which stand to our $k$-depth logics and $k$-depth belief functions as the GENPSAT problem stands to classical logic and classical probability functions. Let us start from the 0-depth case: \\ \noindent {$\mathrm{GENSAT_0}$ Problem } \\ \noindent{\bf INPUT}: The set of $p$ sentences and $n$ linear constraints in \eqref{clsystem}.\\ \noindent {\bf PROBLEM}: Find a 0-depth belief function over $\mathit{Supp} =\{ \varphi_1,\dots,\varphi_p\}$ such that for each $i\in\{1,\dots,n\}$ : $$ \sum\limits_{j=1}^{p_1} a_{ij} B_0(\varphi_j) + w_i \leq \sum\limits_{j=1}^{p_2} b_{ij} Pl_0(\varphi_j) +v_i$$ where $ a_{ij},b_{ij},w_i,v_i \in \mathbb{N}$. By Definition \ref{bk} the problem boils down to finding a solution for the following $n$ system of linear inequalities in unknowns $m_0(\varphi_1),\dots, m_0(\varphi_p)$: \begin{equation}\label{0system} \begin{aligned} \sum\limits_{j=1}^{p_1} a_{ij} \sum\limits_{\substack{k= 1,\dots,p_1 \\ \varphi_k \vdash_0 \varphi_j}} m_0(\varphi_k) + w_i & \leq \sum\limits_{j=1}^{p_2} b_{ij} \sum\limits_{\substack{k= 1,\dots,p_2 \\ \varphi_k \not\vdash_0 \neg\varphi_j}} m_0(\varphi_k) + v_i & i=1,\dots,n \\ m_0(\varphi_j)& =0 & \text{ \ if \ } \varphi_j\vdash_0\bot. \end{aligned} \end{equation} Let us recall that $|inc(\mathit{Supp})|= |\{\a\in \mathit{Supp}\mid \a\vdash_0 \bot\}|$ stands for the count of inconsistent sentences in the support. \begin{theorem}\label{poly0} The $\mathrm{GENSAT_0}$ problem is solvable in $\mathbf{PTIME}(|S(\mathit{Supp})|+n)$. \end{theorem} \begin{proof} By results in \cite{DAgostino2013}, finding out whether $\varphi_k \vdash_0 \varphi_j$, $\varphi_k\not\vdash_0\neg\varphi_j$ and whether $\varphi_j\vdash_0\bot$ requires time polynomial in $|S(\mathit{Supp})|$. Note that the system \eqref{0system} has size $p \times (n+p+1+|inc(\mathit{Supp})|)$, so finding a solution requires polynomial time as well. Hence our problem is in {\bf PTIME}($|S(\mathit{Supp})|+n$). \end{proof} Let us now consider the problem of finding out whether there is a $k$-depth belief function, for a given $k>0$, which approximates a probability function satisfying the constraints in \eqref{clsystem}. The idea is to fix $k$ and an initial $\mathit{Supp}$, and then consider all the $S(\mathit{Supp})$-maximal depth-bounded forests $F_k$, in order to check whether there is a depth-bounded Belief function $B_k$ defined on such forests, which satisfies the constraints. We will take as initial support the set $\mathit{Supp} = \{\varphi_1,\dots,\varphi_p\}$ and assume that the forests are uniform. Note that this assumption prevents the number of forests to grow exponentially with $|\mathit{Supp}|$. Let us now fix a $k>0$ and consider the following problem:\newline \noindent{ $\mathrm{GENSAT_k}$ Problem.} \noindent{\bf INPUT}: The $n$ constraints in \eqref{clsystem}. \noindent {\bf PROBLEM}: Find out whether there is a finite DBM-sequence $\mathcal{F} = (F_j,m_j)_{j\leq k}$, where $\{F_j\}_{j\leq k}$ is a uniform, analytic, finite DBF-sequence based on $\mathit{Supp} = \{ \varphi_1,\dots,\varphi_p \}$, such that $$ \sum\limits_{j=1}^{p_1} a_{ij} B_k(\varphi_j) + w_i \leq \sum\limits_{j=1}^{p_2} b_{ij} Pl_k(\varphi_j) +v_i$$ where $i=1,\dots,n \ \ \ a_{ij},b_{ij},w_i,v_i \in \mathbb{N}, p_1+p_2 =p.$ Note that, also in this case with $k>0$, we have still taken $\mathit{Supp} = \{\varphi_1,\dots,\varphi_p\}$. Since these are the sentences involved in the formulation of the constraints, we can take them to be the initial information provided to an agent, i.e. the information that can be probabilistically quantified by the agent without the use of further hypothetical information. Recalling Definition \ref{bk}, solving the problem $GENSAT_k$ amounts to finding an $F_k$ based on $\mathit{Supp} = \{\varphi_1,\dots,\varphi_p\}$, such that the following system, in the unknowns $m_k(\a)$, for $\a \in Le(F_k)$, has a solution: \begin{equation}\label{ksystem} \begin{aligned} \sum\limits_{j=1}^{p_1} a_{ij} \sum_{\substack{\a\in b_k(\varphi_j) }} m_k(\a) + w_i & \leq \sum\limits_{j=1}^{p_2} b_{ij} \sum_{\substack{\a\in pl_k(\varphi_j) }} m_k(\a) + v_i & \text{ for each } i=1,\dots,n\\ m_k(\a) & \geq 0 & \text{ for each } \a \in Le(F_k) \\ \sum\limits_{\a\in Le(F_k)} m_k(\a) & = 1 & \\ m_k(\a)& =0 & \text{ if } \a\vdash_0\bot \end{aligned} \end{equation} \begin{theorem}\label{polyk} $\mathrm{GENSAT_k}$ is solvable in $\mathbf{PTIME}(|S(\mathit{Supp})|+n) $. \end{theorem} \begin{proof} Consider the number of possible forests of depth $k$, based on $\mathit{Supp}$. Since we assume that the forests are uniform, this reduces to the number of possible trees, which in turn reduces to the possible choices of formulas for expanding each node. The number of such choices at depth $k$ will be $2^k-1$ and, since we restrict to analytic sequences, we will only consider sentences in $S(\mathit{Supp})$ as candidates. We thus obtain that the number of possible forests at depth $k$ is bounded above by $|S(\mathit{Supp})|^{2^k-1}$. We then select among those $|S(\mathit{Supp})|^{2^k-1}$ different forests, those which are maximal with respect to $S(\mathit{Supp})$, see Definition \ref{max}. This is verified by running, for each forest, and for each formula $\varphi$ in $S(\mathit{Supp})$, the quadratic algorithm e.g. in \cite{DAgostino2013}, to verify whether the leaves decide $\varphi$. For each remaining selected forest $F_k$ of depth $k$, the number of leaves in $Le(F_k)$ will be bounded above by $|\mathit{Supp}|\cdot 2^k$, which is linear in $|\mathit{Supp}|$ ( once $k$ is fixed, $2^k$ is constant). We then need to check whether the set of sentences in $Le(F_k)$ may satisfy system \eqref{ksystem}. Each such system has size bounded by $2^k \times (n+ 2^k +1+ |inc(Le(F_k))|)$. Hence we have polynomially many systems of polynomial size. Finally, since solving each such system still requires polynomial time (by standard linear algebraic methods), we obtain our claim. \end{proof} The problems considered so far are decision problems, and in particular variants of the well-known SAT problem and GENPSAT problem for propositional satisfiability, and (generalized) probabilistic satisfiability, respectively. Another class of problems is also quite relevant in the area of probabilistic logic, as presented in \cite{Hailperin1996} and in subsequent developments \cite{Haenni2011}. The idea is to provide a probabilistic generalization of inference, by addressing the following problem: \begin{center} Let $\varphi_1,\dots, \varphi_p,\varphi$ be sentences. Take any probability function $P$ such that $P(\varphi_1),\dots, P(\varphi_p)$ obey a given set of constraints. What kind of constraints follow on $P(\varphi)$? \end{center} In \cite{Hailperin1996,Haenni2011} the constraints imposed on the probabilities of $\varphi_1,\dots,\varphi_p$ are typically intervals, and the goal is to identify the ``smallest'' interval $[a,b]\subseteq [0,1]$ such that $P(\varphi)\in[a,b]$, whenever $P$ satisfies the constraints on the premises. This reduces in the classical setting to a linear programming problem. We will consider here a more general problem, allowing constraints as in \eqref{clsystem}, and searching for solutions based on depth-bounded belief functions. We have then the following: \\ \noindent{\bf $B_k$INF Problem}\\ \noindent{\bf INPUT}: The $n$ constraints in \eqref{clsystem}, and an arbitrary sentence $\varphi$. \noindent {\bf PROBLEM}: Compute the smallest interval $[a,b]$ such that, for any $B_k, Pl_k$ which satisfy the constraints in \eqref{clsystem} as in the $\text{ GENSAT}_k$ Problem, $B_k,Pl_k$ satisfy $a\leq B_k(\varphi)$, $Pl_k(\varphi) \leq b$. As we now show, we can just adapt the classical techniques based on linear programming, and Theorem \ref{polyk} in this section, to obtain that also the functional problem $B_k\text{INF}$ is solvable in polynomial time. Again, we will let $\mathit{Supp} =\{\varphi_1,\dots,\varphi_m\}$, \begin{theorem}\label{inf} The problem $B_k\text{INF}$ is solvable in $\mathbf{FPTIME}(|S(\mathit{Supp})|+ S(\varphi)+ n)$. \end{theorem} \begin{proof} By the argument in the proof of Theorem \ref{polyk}, we identify polynomially many analytic uniform DBF-sequences based on $\mathit{Supp} = \{\varphi_1,\dots,\varphi_m\}$. For each such system our problem is solved by considering the following linear programming problem. \begin{equation}\label{fkminimize} \begin{aligned} \textbf{ minimize } & \sum_{\a\in b_k(\varphi) } m_k(\a) \\ \text{ subject to } & \\ \sum\limits_{j=1}^{p_1} a_{ij} \sum_{{\a\in b_k(\varphi_j) }} m_k(\a) + w_i & \leq \sum\limits_{j=1}^{p_2} b_{ij} \sum_{{\a\in pl_k(\varphi_j) }} m_k(\a) + v_i & \text{ for each } i=1,\dots,n\\ m_k(\a) & \geq 0 & \text{ for each } \a \in Le(F_k) \\ \sum\limits_{\a\in Le(F_k)} m_k(\a) & = 1 & \\ m_k(\a)& =0 & \text{ if } \a\vdash_0\bot \end{aligned} \end{equation} and similarly \begin{equation}\label{fkmaximize} \begin{aligned} \textbf{ maximize } & \sum_{\a\in pl_k(\varphi) } m_k(\a) \\ \text{ subject to } & \\ \sum\limits_{j=1}^{p_1} a_{ij} \sum_{{\a\in b_k(\varphi_j) }} m_k(\a) + w_i & \leq \sum\limits_{j=1}^{p_2} b_{ij} \sum_{{\a\in pl_k(\varphi_j) }} m_k(\a) + v_i & \text{ for each } i=1,\dots,n\\ m_k(\a) & \geq 0 & \text{ for each } \a \in Le(F_k) \\ \sum\limits_{\a\in Le(F_k)} m_k(\a) & = 1 & \\ m_k(\a)& =0 & \text{ if } \a\vdash_0\bot \end{aligned} \end{equation} Solving the two problems will provide our desired bounds for $\varphi$. This can be achieved in polynomial time invoking algorithms for linear programming \cite{Schrijver1987}, since the size of the systems to be solved is polynomial as well in the size of $\varphi_1,\dots,\varphi_p,\varphi$. \end{proof} \section{Conclusions} \label{sec:conclusion} The results of this paper suggest that there should be no methodological tension between requiring that \begin{itemize} \item[i)] models of uncertain reasoning should be aimed at realistic, rather than idealised agents; \item[ii)] the quantification of uncertainty should use all the information actually possessed by an agent and \item[iii)] the quantification of uncertainty should keep track of the reasoning which leads to the hypothetical resolution of uncertainty -- i.e. using information which the agent does not actually possess but which can be obtained by suitably exploiting reasoning by cases. \end{itemize} In consonance with the general view outlined in \cite{DAgostino2017} the results illustrated in this paper suggest that a key to achieving such a realistic model of uncertain reasoning lies in grounding it in logics which are sensitive to information, rather than classical truth-conditions. \hykel{Not only our main results may lead to a reconciliation between additive and non-additive approaches to uncertain reasoning, but they also suggest that logic may play a much more prominent role in uncertain reasoning compared to what is seen in current practice. Whilst AI has long benefitted methodologically from logical approaches, Economic theory has done this to a much lesser extent. Building on Examples \ref{ellsberg} and \ref{ellsbergvariant} future work will focus on this promising application of logical methods in uncertain reasoning.} As to AI applications, future work will be devoted first to the problem of determining, for a specific application-driven problem, the bounds $k$ for which the uncertainty quantification provided by $B_k$ turns out to be adequate. In addition, better algorithms for the problems in Section \ref{sec:complex} are desirable and will be investigated. Let us note that the proofs in Section \ref{sec:complex} contain essentially brute-force search algorithms, where the search space is bounded by the fixed required depth, and only this prevents an exponential explosion. This leaves open the investigation of algorithms which are more tightly calibrated to exploring only the necessary maximal forests. In future work, we will develop such algorithms and provide suitable time estimations \paolo{Finally, as we pointed out in Remark \ref{rem:maximality} the notion of maximal hypothetical uncertainty resolution makes our framework interpretable normatively.} Moreover the tractability results of Section \ref{sec:complex} suggest that reasoning with depth-bounded belief functions may be within the means of realistic agents. Hence, the framework introduced in this paper may be taken as a benchmark for the empirical analysis of what experimental subjects should be expected to do when performing uncertain reasoning tasks. \section*{Acknowledgments} This research was funded by the Department of Philosophy \lq\lq Piero Martinetti" of the University of Milan under the Project \lq\lq Departments of Excellence 2018-2022" awarded by the Ministry of Education, University and Research (MIUR). We are grateful to Marcello D'Agostino for very useful conversations on the theory of Depth-Bounded Boolean Logics which motivated a substantial part of this research. We are also very grateful to two anonymous reviewers for their unrestrained criticisms, which certainly lead this to becoming a much better paper.
\section{Microcavity and quantum dot characterisation} \label{SIsec:cavityQDcharacterisation} The quantum dot (QD) in a cavity system consists of two main elements. As shown in Supplementary Fig.\,\ref{SIfig:cavQDscans}a, we employ a semiconductor heterostructure consisting of an n-i-p diode with embedded self-assembled InGaAs quantum dots (QDs). This heterostructure is grown on top of a semiconductor distributed Bragg reflector (DBR) that acts as the planar ``bottom'' mirror of the cavity that is nearly 100\% reflective -- the total unwanted losses $\kappa_{\rm loss}/(2\pi)\leq0.72$\,GHz. The ``top'' mirror is made of a fused-silica substrate into which an atomically-smooth crater with radius of curvature $R=12\,\mu$m is machined, onto which a dielectric DBR coating is deposited. Further details of the sample and the system are described in detail in Ref.\,\cite{Tomm2021}, Supplementary Information. \begin{figure*}[hb!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_scansCavityQD_v1.pdf} \caption{\textbf{Microcavity and quantum dot characterisation.} \textbf{(a)} Schematic (adapted from Ref.\,\cite{Tomm2021}) of the QD and one-sided cavity setup. The QDs are embedded in a diode structure which allows tuning $\omega_{\rm QD}$. The cavity is composed of separate top and bottom mirrors, which allow tuning its frequency $\omega_{\rm C}$ with the help of nano-positioners. The laser light pulses with angular frequency $\omega_{\rm L}$ are coupled into the cavity and exit via the top mirror. \textbf{(b)} Normalised signal versus laser detuning of the cavity resonance. The cavity resonance is split into two linearly- and orthogonally-polarised modes, $H$ and $V$, separated by 58.8\,GHz. The $\mathcal{Q}$-factor is measured to be $\mathcal{Q}=16,200\pm1,200$, leading to a cavity loss rate $\kappa/(2\pi)=(20.1\pm1.5)$\,GHz. \textbf{(c)} Normalised signal versus QD detuning from the reference laser ($\lambda=918.23$\,nm). The neutral exciton X$^0$ transitions in the QD are separated by a fine-structure splitting (FSS). Upon application of an out-of-plane magnetic field of B=0.5\,T, the transitions are split further apart, resulting in a $\rm{FSS}=(11.0\pm0.1)$\,GHz. Application of the magnetic field allows us to work with just one of the QD transitions (the lower-frequency one).} \label{SIfig:cavQDscans} \end{figure*} The open-access nature of the cavity allows the tuning of its optical resonance $\omega_{\rm C}$ with the help of nano-positioners. One can also change the frequency of the input laser light $\omega_{\rm L}$ which enters and exits the system. A cavity scan is shown in Supplementary Fig.\,\ref{SIfig:cavQDscans}b, where the evident splitting of the fundamental mode into two orthogonal $H$ and $V$ linearly-polarised modes can be observed~\cite{Tomm2021PRAppl}, $\rm{MS}=(\omega_{\rm V}-\omega_{\rm H})/(2\pi)=-58.8$\,GHz. The mode-splitting is caused by residual strain in the semiconductor heterostructure. By fitting a double-Lorentzian line one extracts the total cavity loss rate $\kappa/(2\pi)=(20.1\pm1.5)$\,GHz, equivalently a quality factor $\mathcal{Q}=16,200\pm1,200$. Upon application of a voltage across the gates of the diode, the QD transition frequencies $\omega_{\rm QD}$ can be tuned using the DC-Stark effect. We use the transitions of a neutral exciton $X^0$, which exhibits a so-called fine-structure splitting (FSS): there are two non-degenerate, linearly-polarised dipole moments. In order to work with one transition only, we search for a highly strained region in the sample in which both the FSS of the QD and the mode-splitting of the cavity are large. We select a QD with a starting linear frequency splitting $\rm{FSS}=(7.6\pm0.1)$\,GHz. We apply an out-of-plane magnetic field B=0.5\,T, large enough to push the transitions further apart via the Zeeman effect, but not large enough to influence significantly the selection rules. (In a large magnetic field, the Zeeman splitting becomes much larger than the FSS such that the transitions become circularly polarised.) With this magnetic field strength, we finally have $\rm{FSS}=(11.0\pm0.1)$\,GHz as shown in Supplementary Fig.\,\ref{SIfig:cavQDscans}c. We focus the rest of the discussion on the lower-frequency transition. \section{Coupled quantum dot-cavity system} We characterise the coupled QD-cavity system. We use input-output theory and follow the procedure described in Ref.\,\cite{Auffeves-Garnier2007PRA, Antoniadis2022} to describe the interaction between the QD transition of interest, a two-level system (TLS), and two orthogonally and linearly polarised cavity modes. We examine the case of a continuous-wave, low-power input laser field of amplitude $b_{\rm in}$ with arbitrary polarisation, \begin{equation} b_{\rm in} = \alpha_H b_{\rm in} \mathbf{h} + \alpha_V b_{\rm in} \mathbf{v}, \end{equation} where $\alpha_{H/V}$ are the complex coefficients of the Jones vectors in the orthonormal basis $\mathbf{h}=(1\;\;0)^\intercal$ and $\mathbf{v}=(0\;\;1)^\intercal$. We consider a one-sided cavity with two optical modes along $\mathbf{h}$ and $\mathbf{v}$, both coupled to the continuum of modes with decay rate $\kappa_H=\kappa_V=\kappa$. We use the rotating frame of the quantum emitter. The field reflected by the QD-cavity system $b_{\rm r}$ is \begin{equation} b_{\rm r} = \epsilon_H b^H_{\rm r} \mathbf{h} + \epsilon_V b^V_{\rm r} \mathbf{v}, \end{equation} with the probed reflected field amplitude in each polarisation given by \begin{equation} b^{H/V}_{\rm r} = \alpha_{H/V} \, b_{\rm in} \left(1-t_{H/V}\right) - i \, t_{H/V} \, \Gamma_{H/V} \, \sigma_-, \end{equation} where $\sigma_-$ is the expectation value of the Pauli lowering operator for the TLS in the low-power regime. We denote $\Gamma_{H/V}=\frac{4\,g^2_{H/V}}{\kappa}$ as the Purcell-enhanced atomic decay rate due to the interaction, with $g_{H/V}$ the coupling constant between the linear dipole moment of the TLS and each cavity mode. We note that for linear transitions, $g_{H/V}$ is real and given by the projection of the TLS's linear dipole moment onto the cavity mode's linear electric vacuum field. We introduce also the transmission through the cavity modes in the absence of the quantum emitter: \begin{equation} t_{H/V}=\frac{1}{1+2i\left(\frac{\Delta_{H/V}-\Delta_{\rm L}}{\kappa}\right)}, \end{equation} where $\Delta_{H/V} = \omega^{H/V}_{\rm C}-\omega_{\rm QD}$ is the detuning of the $H/V$ polarised cavity mode with respect to the QD transition, and $\Delta_{\rm L} = \omega_{\rm L}-\omega_{\rm QD}$ is the laser detuning with respect to the QD transition. The lowering operator $\sigma_-$ is responsible for ``coupling'' the two polarised optical modes and described as \begin{equation} \sigma_- = \frac{i \, t_H \, \sqrt{\Gamma_H}\, \alpha_H \, b_{\rm in} + i \, t_V \, \sqrt{\Gamma_V}\, \alpha_V \, b_{\rm in}}{t_H \, \frac{\Gamma_H}{2} + t_V \, \frac{\Gamma_V}{2} - i \, \Delta_{\rm L} + \frac{\gamma}{2}}, \end{equation} where we account for the atomic decay rate into non-cavity optical modes via $\gamma$. Finally, the scattered field amplitude is given by the ratio of reflected field and input field, namely \begin{equation} \begin{split} \label{SIeq:transm} t_k = \frac{b_{\rm r}}{b_{\rm in}} = &\, \epsilon_H\,\left[\alpha_H\,\left(1 - 2\,t_H + \frac{2\,t^2_H\,\Gamma_H}{t_H\,\Gamma_H + t_V\,\Gamma_V - 2i \, \Delta_{\rm L} + \gamma}\right) + \alpha_V\,\left(\frac{2\,t_H\,\sqrt{\Gamma_H}\,t_V\,\sqrt{\Gamma_V}}{t_H\,\Gamma_H + t_V\,\Gamma_V - 2i \, \Delta_{\rm L} + \gamma}\right)\right]\\ &+ \epsilon_V\,\left[\alpha_H\,\left(\frac{2\,t_V\,\sqrt{\Gamma_V}\,t_H\,\sqrt{\Gamma_V}}{t_V\,\Gamma_V + t_H\,\Gamma_H - 2i \, \Delta_{\rm L} + \gamma}\right) + \alpha_V\,\left(1 - 2\,t_V + \frac{2\,t^2_V\,\Gamma_V}{t_V\,\Gamma_V + t_H\,\Gamma_H - 2i \, \Delta_{\rm L} + \gamma}\right)\right]. \end{split} \end{equation} \begin{figure*}[hb!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_TBR_v1.pdf} \caption{\textbf{Resonant response of a QD in a one-side microcavity.} \textbf{(a)} Transmission of laser light through the coupled QD-cavity system as a function of detuning from the cavity and the QD resonances. The measurement was performed in a cross-polarised mode (inset), where the input light is diagonal to the $H$ and $V$ cavity modes and the output polarisation is anti-diagonal. By fitting a Lorentzian function to the cut-through lines at the resonances of the two cavity modes, one can extract the Purcell enhanced decay rate of the QD, $\Gamma_{\rm H}/(2\pi)=4.24$\,GHz and $\Gamma_{\rm V}/(2\pi)=1.30$. \textbf{(b)} Simulation of the transmission through the QD-cavity system using the parameters extracted from the experiment. \textbf{(c)} Spectrum of the back-reflection light from the QD-cavity system. The measurement was performed in co-polarised mode (inset), where input and output modes are horizontally polarised, aligned to the $H$ polarised cavity mode, and \textbf{(d)} respective simulation.} \label{SIfig:VcVgs} \end{figure*} Experimentally, we operate the system with the aid of a cross-polarised microscope\,\cite{KuhlmannRSI2013, Tomm2021}, and we probe the reflected light intensity $\lvert t_k\rvert^2$. We first study the properties of the TLS-cavity interaction in what we call ``transmission'' mode, shown in Supplementary Fig.\,\ref{SIfig:VcVgs}a. Even though the signal is effectively reflected by the system, mathematically it is equivalent to probing the signal transmitted through a two-sided cavity with two orthogonal cavity modes. We achieve this by sending in linear-polarised light ``diagonal" to the cavity modes, and collecting light on the anti-diagonal, as depicted in the inset of Supplementary Fig.\,\ref{SIfig:VcVgs}a. In Eq.\,\ref{SIeq:transm} this means that the input coefficients are $\alpha_H=1/\sqrt{2}$, $\alpha_V=1/\sqrt{2}$, the output coefficients $\epsilon_H=1/\sqrt{2}$, $\epsilon_V=-1/\sqrt{2}$. We extract the Purcell-enhanced decay rate into each mode by taking the full-width-at-half-maximum (FWHM) of the two cavity resonances, $\Gamma_H/(2\pi)=4.24$\,GHz and $\Gamma_V/(2\pi)=1.30$\,GHz. This implies respective coupling constants $g_H/(2\pi)=4.62$\,GHz and $g_V/(2\pi)=2.55$\,GHz. The non-cavity losses are given by the natural decay rate of the emitter, $\gamma/(2\pi)=0.30$\,GHz, a parameter known from previous experiments\,\cite{Tomm2021, Najer2019}. We estimate the Purcell factors $F^H_P=14.1$ and $F^V_P=4.3$. We simulate the response of the system with the parameters determined experimentally and using Eq.\,\ref{SIeq:transm}. The result is shown in Supplementary Fig.\,\ref{SIfig:VcVgs}b. We note that the QD transitions are not perfectly linearly polarised due to Zeeman effect which induces a slight ellipticity to the transitions. Next, we examine the system in what we call ``back-reflection'' mode, in which both input and output fields are aligned to one of the linearly polarised cavity modes. In this work, we focus on the $H$ cavity; it interacts more strongly with the lower energy transition of the QD. In this case, for the input and output polarisation coefficients, we have $\alpha_H=1$, $\alpha_V=0$ and $\epsilon_H=1$, $\epsilon_V=0$. The experimental and simulated results are presented in Supplementary Fig.\,\ref{SIfig:VcVgs}c,d. We remark that in the case of a TLS with decay rate $\Gamma$ coupled to a single cavity mode with coupling rate $g$ and $\gamma=0$, the amplitude reflection coefficient would be unitary across the entire spectrum. In this limit the $\beta$-factor, defined as $\beta=F_P/(F_P+1)$, is unitary and the amplitude reflection coefficient reduces to Eq.~1 of the main text. At resonance the amplitude reflection coefficient is $-1$, which indicates that the light is scattered with unity intensity but undergoes a $\pi$ phase shift, a useful condition for photon-photon quantum gates\,\cite{Chen2021}. This limit is taken in the theoretical modelling throughout this work, see Sec.\,\ref{SIsec:theory}. In this work, the unity $\beta$-factor condition is almost achieved. We take advantage of the tunable nature of the miniaturised Fabry-Perot cavity to maximise the $\beta$-factor. Employing xy-nanopositioners one can position the QD relative to the optical axis of the cavity, and in this way tune the $\beta$-factor, and respectively the QD's decay rate/lifetime. In Supplementary Fig.\,\ref{SIfig:GammaLifetime}, we show the extracted $\Gamma/(2\pi)$ (blue dots, left axis) and equivalent emitter lifetime $\tau_{\rm QD}=1/\Gamma$ (red dots, right axis) as a function of the calculated $\beta$ for different lateral positions of the QD relative to the cavity's optical axis. Here, $\beta$ is calculated from the derived coupling constant $g=g_H$ at each position, and the known $\kappa$ and $\gamma$. For all experiments in this manuscript we work in the condition of maximised coupling, with parameters $\beta=0.934$, decay rate $\Gamma/(2\pi)=4.24$\,GHz and respective lifetime $\tau_{\rm QD}=37.5$\,ps. The average photon number per lifetime needed to saturate the quantum emitter in a one-sided cavity\cite{Auffeves-Garnier2007PRA, Antoniadis2022}, i.e.\ the ``critical photon number'' $\bar{n}_c$, is given by $\bar{n}_c=1/(8\beta)=0.1338$. \begin{figure*}[hb!] \centering \includegraphics[width=0.5\textwidth]{./SI/suppfig_GammaLifetimeBeta_v1.pdf} \caption{\textbf{Tuning the lifetime of the QD coupled to the microcavity.} The open-access microcavity enables tuning the lateral position of the QD relative to the centre of the cavity field, modifying \textit{in-situ} the coupling rate $g$, respectively the $\beta$-factor. We determine experimentally the Purcell-enhanced linewidth of the best-coupled dipole transition $\Gamma=\Gamma_{\rm H}$ (left axis, blue data points) and its respective expected lifetime $\tau_{\rm QD}$ (right axis, red data points). When the QD is well centred with the cavity mode (dashed gray line), $\beta=0.934$, $\Gamma/(2\pi)=4.24$\,GHz and $\tau_{\rm QD}=37.5$\,ps.} \label{SIfig:GammaLifetime} \end{figure*} \section{Experimental setup} The experimental setup for the generation and detection of single photons and photonic bound states consists of five segments, as shown in Supplementary Fig.\,\ref{SIfig:setup}. We employ a tunable continuous-wave laser (TOPTICA Photonics A.G., Germany) and select the laser power sent to the system with an acousto-optic modulator (AOM) controlled digitally by a PID-loop. We create electric Gaussian-shaped signals with FWHM between 75\,ps and 2\,ns with an arbitrary wave generator (AWG). A trigger signal is sent to a time-correlator to synchronize the experiment, and the analog output from the AWG is used to modulate an electro-optic modulator (EOM). The generated light pulses are sent into a 99:1 fibre beam-splitter, which we employ as an approximate optical circulator. We send 1\% of the light intensity into the QD-cavity system, which resides in a helium bath-cryostat at a temperature of 4.2\,K. The light is back-scattered and 99\% of it is sent to a 50:50 fibre-beam splitter and finally to two superconducting nanowire single-photon detectors (SNSPDs, Single Quantum B.V., The Netherlands). The time-tags of the single-photon detection events are recorded with a correlator (Time Tagger, Swabian Instruments, Germany). In the experimental determination of a three-photon correlation function $G^{(3)}$, we divide the signal once more with a second 50:50 fibre-beam splitter and use four SNSPD detectors. \begin{figure*}[ht!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_setup_v1.pdf} \caption{\textbf{The experimental setup.} Overview of the experimental setup for the measurement of the single photon and two-photon scattering dynamics. Light from a CW laser passes through an AOM (acousto-optic modulator) controlled via a PID loop in order to control the laser power. Laser light is sent to an EOM (electro-optic modulator) in order to create Gaussian pulses. These pulses are sent to the QD in a one-sided microcavity via a mock-circulator composed of a 99:1 fibre BS (beam-splitter). In the circulator, 1\% of the input light is sent to the QD-cavity system, but 99\% of the back-reflected light (co-polarised) is sent to the detection setup consisting of a Hanbury Brown-Twiss setup (a 50:50 BS with two detectors, Ch1 and Ch2, and a correlator).} \label{SIfig:setup} \end{figure*} \section{Wigner delay induced by a one-sided cavity} \label{SIsec:cavityWdelay} The elastic scattering of a wavepacket by a resonator is not an instantaneous process. It was shown by E.P.~Wigner in 1955 that the scattered wave propagates with a time delay with respect to an unscattered wave~\cite{Wigner1955}. The so-called ``Wigner delay" is given by the derivative of the phase shift acquired by the wave with respect to its frequency~\cite{Bourgain2013}. The delay is frequency dependent. In the case of a one-sided optical cavity with an inverse lifetime $\kappa$ the Wigner delay inherited by the interacting pulse is given by \begin{equation} \label{SIeq:cavWignerdelay} \Delta\tau_C(\omega_L,\omega_C) = \frac{4}{\kappa}\,\frac{1}{1+4\left(\frac{\omega_{\rm L}-\omega_{\rm C}}{\kappa}\right)^2}. \end{equation} It is easy to see that at resonance ($\omega_{\rm L}=\omega_{\rm C}$) the Wigner delay reduces to $\Delta\tau_C(0,0) = 4/\kappa$. We study the dynamical response of a $\sim$135\,ps Gaussian pulse scattered by the one-sided cavity. We work in ``back-reflection'' mode, such that the input light only interacts with the $H$ cavity mode. Supplementary Fig.\,\ref{SIfig:cavitydelay}a shows the time of arrival of the pulse $G^{(1)}(\tau)$ as a function of detuning between the laser and the cavity resonance. Even for the shortest pulses used here, the scattered pulse is shape-maintaining over the entire spectrum. We evaluate the delay of the pulse peak $\Delta\tau$ for one- (red dots) and two-photon components (blue dots) as a function of detuning (Supplementary Fig.\,\ref{SIfig:cavitydelay}b). The delay experienced in both cases is the same, and described by Eq.\,\ref{SIeq:cavWignerdelay}, which we fit to the data (red and blue solid lines) allowing us to retrieve the cavity linewidth $\kappa_{\rm fit}/(2\pi)=(21.6\pm0.2)$\,GHZ. This value is the same (within the error bars) as the value of $\kappa$ determined via the intensity measurement described in Section\,\ref{SIsec:cavityQDcharacterisation}, $\kappa/(2\pi)=(20.6\pm1.5)$. The photon lifetime in the cavity is $\tau_{\rm C}=1/\kappa_{\rm fit}=(7.3\pm0.1)$\,ps, leading to a Wigner delay at resonance of $\Delta\tau_{\rm C}(0,0) = 4/\kappa_{\rm fit}=(29.2\pm0.4)$\,ps. Finally, we show in Supplementary Fig.\,\ref{SIfig:cavitydelay}c that the Wigner delay for a classical resonator is linear, i.e.\ independent of input laser power. For the experiments in the main manuscript we use the average of the delays extracted in this measurement as the ``classical" (i.e.\ cavity-only) baseline. \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_cavityDelay_v1.pdf} \caption{\textbf{Wigner delay induced by a one-sided cavity.} \textbf{(a)} Measured $G^{(1)}(\tau)$ histogram as a function of cavity detuning. \textbf{(b)} Measured pulse peak delay $\Delta\tau$ of $G^{(1)}$ (red data points) and $G^{(2)}$ (blue data points) as a function of cavity detuning. For an optical cavity (a classical resonator), the Wigner delay is photon-number independent, and at resonance equal to $\Delta\tau_C=4/\kappa$ for a one-sided cavity. By fitting Eq.\,\ref{SIeq:cavWignerdelay} (solid lines) we determine $\kappa_{\rm fit}/(2\pi)=(21.6\pm0.2)$\,GHZ. \textbf{(c)} The Wigner delay for single-photon states (red data points) and two-photon states (blue data points) at resonance measured for different laser powers: the delay is independent of the power.} \label{SIfig:cavitydelay} \end{figure*} \section{Properties of the photon-number dependent scattering} \begin{figure*}[b!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_WdelvsPulseWidthpower.pdf} \caption{Input pulse width and input power dependent dynamics. (a) Time of arrival $\tau$ of the propagated pulse power $G^{(1)}(\tau_{\rm ch1})$ as a function of QD detuning from the laser resonance $\Delta_{\rm QD}/(2\pi)$ for a short (pulse FWHM = 81.86\,ps, left) and a long (pulse FWHM = 597.83\,ps, right) input Gaussian pulse. (b) Line cut-through of (a) at resonance, showing the pulse deformation for short pulses. (c) Peak delay $\Delta\tau$ as a function of input pulse width for one (red) and two photons (blue). The red and blue horizontal dashed lines represent the theoretical values in the infinite-pulse-width limit. (d) Time of arrival $\tau$ of the propagated pulse power $G^{(1)}(\tau_{\rm ch1})$ for a 135\,ps Gaussian pulse as a function of QD detuning from the laser resonance for an average input photon number $\bar{n}=0.0052$ (left) and $\bar{n}=0.1313$ (right), and (e) respective $G^{(2)}(\tau_{\rm ch1},\tau_{\rm ch2})$ maps at resonance. (f) Peak delay as a function of average input photon number for one- (red) and two-photon (blue) states. Solid lines are fits to the TLS-saturation relation, with critical photon number $\bar{n}_c=0.1338$. The red and blue dashed lines show the modelled $\Delta\tau$ for one- and two-photon states for a 135\,ps Gaussian pulse in the low power limit, and the black dashed line is the delay of the cavity alone.} \label{SIfig:scattproperties} \end{figure*} The scattered light dynamics depend on the input pulse shape and temporal width. Shorter pulses in time, a few times the lifetime of the emitter, undergo higher-order distortion as more spectral components interact with the TLS (see Sec.\,\ref{SIsec:theory}). Much longer pulses are spectrally narrow and the continuous-wave (CW) limit is appropriate in which only a delay (phase shift) is impinged onto the pulse. In Supplementary Fig.\,\ref{SIfig:scattproperties}a, the normalised power $G^{(1)}(\tau)$ as a function of QD--laser detuning ($\Delta_{\rm QD}=\omega_{\rm QD}-\omega_{\rm L}$) is shown. The laser is in resonance with the cavity. We show the one-photon scattering response for two pulse widths, a shorter one (left, pulse intensity-FWHM of 81.86\,ps, corresponding to $\sigma\Gamma=1.3$) and a longer one (right, pulse intensity-FWHM = 597.83\,ps, corresponding to $\sigma\Gamma=9.6$). In both cases, far from resonance, the pulse is delayed by the classical delay of the cavity alone and does not present any reshaping. In the shorter-pulse limit, the transmitted pulse is distorted near the resonance and no longer corresponds to a Gaussian pulse, as is seen in Supplementary Fig.\,\ref{SIfig:scattproperties}b. The distortion of the pulse results in a deviation of the peak delay $\Delta\tau$ in shorter pulses compared to the infinite-pulse limit, in which the distortion is negligible. The two-photon auto-correlation maps for these pulse widths are discussed in the main text. We probe the peak delay at resonance for single photons $\Delta\tau_1$ and for two-photon states $\Delta\tau_2$ as a function of pulse FWHM, displayed in Supplementary Fig.\,\ref{SIfig:scattproperties}c, where the red and blue dashed lines correspond to the theoretical prediction neglecting the effects of distortion. We point out that the single-photon scattering dynamics are more sensitive to dispersion effects (see Fig.\,2 of main text) than the dynamics of the two-photon bound states; this explains the larger variance in $\Delta\tau_1$ in this analysis. The response of a single TLS is highly susceptible to the number of photons impinging on it, as the TLS saturates upon absorption of a single photon\,\cite{Chang2007,Auffeves-Garnier2007PRA}. This results in a strong nonlinear response even at very low input laser powers. We expect the few-photon nonlinearity to fade with strong coherent fields, as in this regime a large fraction of the pulse is scattered without interacting with the saturated TLS. Supplementary Fig.\,\ref{SIfig:scattproperties}d presents the normalized power-time response as a function of QD-detuning from the laser-cavity resonance for a pulse with $\sim$135\,ps FWHM in the case of a low- (2.89\,nW, left) and high-power (73.64\,nW, right) input. These laser powers (measured at the ``power control'' setup) translate to an average photon-number per lifetime of $\bar{n}=0.0052$ and $\bar{n}=0.1313$ at the cavity, respectively. The QD saturates at the critical photon number \cite{Antoniadis2022} $\bar{n}_c=1/(8\beta)=0.1338$. In the latter measurement, the reduced delay at resonance testifies to the saturation of the QD. The fingerprints of two-photon correlated states (clustering and delay of coincidence counts along the diagonal) also diminish (Supplementary Fig.\,\ref{SIfig:scattproperties}e). We present in Supplementary Fig.\,\ref{SIfig:scattproperties}f the peak delay observed for one (red) and two photons (blue) as a function of average photon number per lifetime. At low photon-number, the measurements correspond well to the simulated $\Delta\tau$ for this pulse width (red and blue dashed lines), converging gradually as the laser power increases to the limit where only the classical delay, induced by the cavity alone, remains (black dashed line) as the laser power increases. The delay response for both one- and two-photon states correspond well to a TLS-saturation power law like function, \begin{equation} \Delta\tau(\bar{n})= 1 - (1-\Delta\tau^\infty/\Delta\tau^0)\cdot\frac{\bar{n}/\bar{n}_c}{1+\bar{n}/\bar{n}_c}, \end{equation} where $\Delta\tau^0$ and $\Delta\tau^\infty$ are the peak delays measured in the limits of zero and infinite input photons, respectively. The fits are depicted with red and blue solid lines in the plot. Next, we evaluate $G^{(1)}(\tau)$ and the diagonals of the auto-correlation functions $G^{(2)}(\tau,\tau)$ and $G^{(3)}(\tau,\tau,\tau)$ and determine the dynamical properties of the photon-number dependent scattering. We present in Supplementary Fig.\,\ref{SIfig:propertiesvsn}a,b the values of peak delay $\Delta\tau$ and relative pulse width $\sigma_n/\sigma_{\ket{in}}$ as a function of photon-number $n$. For each $n$, these values are extracted from $G^{(1)}(\tau)$, $G^{(2)}(\tau,\tau)$ and $G^{(3)}(\tau,\tau,\tau)$. Here, we extract the average and variance from all experiments presented in the course of this work under low-power resonant conditions. \begin{figure*}[h!] \centering \includegraphics[width=\textwidth]{./SI/suppfig_nvsWdelnvssigma_v1.pdf} \caption{\textbf{Photon-number-dependent scattering dynamics.} \textbf{(a)} Average peak delay of the scattered pulse $\Delta\tau$, and \textbf{(b)} average ratio of the measured pulse width after scattering ($\sigma_n$) to the input pulse width $\sigma$, for different photon-numbers $n$. The values are extracted by averaging over all the low-power resonant experiments carried out in the course of this work (including differing pulse widths), probed via $G^{(1)}$, $G^{(2)}(\tau,\tau)$ and $G^{(3)}(\tau,\tau,\tau)$.} \label{SIfig:propertiesvsn} \end{figure*} The single-photon components undergo a delay $\Delta\tau_1 = (144.02\pm27.90)$\,ps, in good agreement with the predicted value of $\Delta\tau^{\rm theory}_1 = 4/\Gamma = 150.00$\,ps. The large error stems from the sensitivity of the peak delay to distortions, as discussed in the main text and Section\,\ref{SIsec:theory}; the distortions depend sensitively on the exact detunings which can drift slightly. We determine the two- and three-photon delays to be $\Delta\tau_2 = (66.48\pm5.97)$\,ps and $\Delta\tau_3 = (45.51\pm0.09)$\,ps. The two-photon delay corresponds well to the prediction of $\Delta\tau^{\rm theory}_2=1/\Gamma+3/\kappa=61.3$\,ps. We note that as we approach the classical limit of $n\rightarrow\infty$, the delay converges to the value induced by the classical cavity alone (see Section\,\ref{SIsec:cavityWdelay}). Finally, we compare the Gaussian width of the interacting $n$-photon output pulse and the input pulse and determine $\sigma_1/\sigma_{\ket{in}} = 1.06\pm0.08$, $\sigma_2/\sigma_{\ket{in}} = 0.75\pm0.02$ and $\sigma_3/\sigma_{\ket{in}} = 0.52\pm0.00$. \section{Theory} \label{SIsec:theory} In the Supplement here, we provide a detailed derivation of the equations used to compute the results in the main text. Here we provide a scheme to compute the output state when considering a weak coherent input pulse with average photon number $\bar n \ll 1$. We use one- and two-photon scattering matrices that have previously been computed \cite{Shi2011PRA, Rephaeli2012IEEE}. In addition to this we compute the one- and two-photon delay and dispersion a pulse undergoes when interacting with a single-sided cavity QED system. In particular we do this for the one-photon pulse and we do this in the two-excitation center-of-mass coordinate for the two-photon bound state, whose form we also compute. The TLS-cavity system can be described by the Jaynes-Cummings interaction, where the cavity is unidirectionally coupled to a one-dimensional continuum of modes, specified by the Hamiltonian \begin{equation} \hat{\mathcal{H}}= -i\,v_g\,\int dx\,\hat{a}^\dagger(x)\,\partial_x \hat{a}(x) + \,\Delta_C\,\hat{c}^\dagger\hat{c} + \eta\,\left(\hat{a}(0)\hat{c}^\dagger + \hat{c}\hat{a}^\dagger(0)\right) + g\,\left(\hat{c}\hat{\sigma}_+ + \hat{\sigma}_-\hat{c}^\dagger\right). \end{equation} The first two terms describe respectively the free-evolution of the waveguide mode at position $x$ with annihilation operator $\hat{a}$ and the cavity field with annihilation operator $\hat{c}$ and cavity-atom detuning $\Delta_C = \omega_C - \omega_0$. Here, the energy has been renormalised to that of the atom and the dispersion of the mode continuum has been linearised about this point, and $v_g$ is its group velocity. The last two terms express the waveguide-cavity exchange with coupling constant $\eta = \sqrt{\kappa v_g}$, where $\kappa$ is the cavity decay rate, and the cavity-TLS interaction with coupling rate $g$. Here $\hat{\sigma}_-$ ($\hat{\sigma}_+$) is the Pauli lowering (raising) operator \subsection{The input state} We truncate the input coherent pulse with real-valued amplitude $\alpha = \sqrt{\bar n}$ at two photons, \begin{equation} | \textrm{in} \rangle \sim e^{- \alpha^2/2}\left[ 1 + \alpha \hat{a}_{\rm in}^\dagger + \frac{\alpha^2}{2} \hat{a}_{\rm in}^\dagger \hat{a}_{\rm in}^\dagger \right] | 0 \rangle. \end{equation} Here, \begin{equation} \hat{a}^\dagger_{\rm in} = \int dx \hat{a}^\dagger(x) f(x) \end{equation} creates a photon in the input mode with normalized spatial profile $f(x)$ (with equivalent annihilation operators). The input mode profile produced by the laser is approximately Gaussian. For an ideal Gaussian pulse with width $\sigma$ and central frequency detuning from the atomic resonance $v_g k_0$ we have \begin{equation} \label{eq:inputPulseShape} f(x) = \frac{1}{\sqrt{\sigma}\pi^{1/4}} e^{i k_0 x} e^{- \frac{x^2}{2 \sigma^2}}. \end{equation} Here, $v_g$ is the group velocity of the mode that is coupled to the cavity (see Fig. 1 of the main text for a schematic of the setup). In our experimental setup we have a free space mode with $v_g=c$. \subsection{Scattering Matrix} To compute the output state we apply photon scattering matrices on the one- and two-photon components of the coherent state. The one- and two-photon scattering matrices for a single-sided cavity QED setup have previously been reported \cite{Shi2011PRA, Rephaeli2012IEEE}. The single-photon scattering matrix can be written as a transmission coefficient in $k$-space such that scattering a photon maps \begin{equation} \label{eq:onePhotScattMat} \hat{a}^\dagger(k) \rightarrow t_k \hat{a}^\dagger(k) = \frac{v_g k - \Delta_{\rm C} - g^2/(v_g k) - i \kappa/2}{v_g k - \Delta_{\rm C} - g^2/(v_g k) + i \kappa/2} \hat{a}^\dagger(k), \end{equation} where $\hat{a}(k)$ is the Fourier Transform of $\hat{a}(x)$. We note that because there is no loss in the system $|t_k|=1$. The two-photon scattering matrix is given by \cite{Shi2011PRA, Rephaeli2012IEEE} and maps \begin{equation} \begin{split} \label{eq:twoPhotScattMat} &\int dp_1 dp_2 \hat{a}^\dagger (p_1)\hat{a}^\dagger (p_2) | 0 \rangle f(p_1) f(p_2) \rightarrow \int dk_1 dk_2 \hat{a}^\dagger (k_1)\hat{a}^\dagger (k_2) | 0 \rangle t_{k_1}t_{k_2}f(k_1) f(k_2) + \\ &\frac{i \sqrt{\kappa} g}{\pi} \int dk_1 dk_2 \hat{a}^\dagger (k_1)\hat{a}^\dagger (k_2) | 0 \rangle s_{k_1}^a s_{k_2}^a \int dp_1 dp_2 f(p_1) f(p_2) \delta(E_p - E_k) \frac{2g (s_{p_1}^c + s_{p_2}^c) + (E_p - 2\omega_c + i \kappa)(s_{p_1}^a + s_{p_2}^a)}{(E_p - \lambda_{+})(E_p - \lambda_{-})}, \end{split} \end{equation} where $E_p = p_1 + p_2$ and $E_k = k_1+k_2$ denote the total input and output wavenumbers which must be equal due to conservation of energy, and \begin{equation} \begin{split} s_{k}^a &= \frac{\sqrt{\kappa} \, g}{(v_g k - \Delta_{\rm C} + i \kappa/2)v_g k - g^2},\\ s_{k}^c &= \frac{\sqrt{\kappa} \, v_g k}{(v_g k - \Delta_{\rm C} + i \kappa/2)v_g k - g^2}. \end{split} \end{equation} In addition, we have \begin{equation} \lambda_\pm = \frac{2(\omega_0+\omega_c) + \Delta_{\rm C} - 3 i \kappa/2}{2} \pm \sqrt{\left(\frac{\Delta_{\rm C} - i \kappa/2}{2} \right)^2 + 2g^2 }. \end{equation} We use (\ref{eq:twoPhotScattMat}) to compute the full two-photon output wavepacket in the main text. The unnormalized second-order correlation function is, in the low-input power limit, proportional to the two-photon wavefunction \begin{equation} G^{(2)}(x_1, x_2) = \bar{n}^2 |\psi_2(x_1, x_2)|^2 + O(\bar{n}^3). \end{equation} Here, $\psi_2(x_1, x_2)$ is the two-photon wavefunction expressed in real space and $O(\bar n^3)$ indicates terms of order $\bar n^3$ and higher. \subsubsection{Single-photon scattering, delay, and dispersive effects} With the single-photon transmission coefficient one can calculate the delay and dispersion the cavity QED system imparts on an incoming Gaussian single-photon pulse. For an input state \begin{equation} |\textrm{in} \rangle = \frac{1}{\sqrt{\sigma}\pi^{1/4}} \int dx \hat{a}^\dagger(x) | 0 \rangle e^{i k_0 x} e^{- \frac{x^2}{2 \sigma^2}}, \end{equation} we calculate the output state by taking its Fourier Transform, computing the single-photon scattering using (\ref{eq:onePhotScattMat}), and then inverse Fourier Transforming back to real-space. From this we get the output state \begin{equation} | \textrm{out} \rangle = \sqrt{\frac{\sigma}{2\pi}} \frac{1}{\pi^{1/4}} \int dx \hat{a}^\dagger(x) | 0 \rangle \int dk \, t_k e^{-(k-k_0)^2 \sigma^2/2}e^{i k x}. \end{equation} The full output state is computed by calculating the Fourier integral over $k$ numerically. We get analytic insight into the delay and dispersive properties of pulse propagation by Taylor expanding the transmission coefficient about the detuning $\Delta_{\rm L} = v_g k_0$ at which the Gaussian pulse is centered. Noting that $|t_k|=1$, we write $t_k = e^{i \phi(\Delta_{\rm L}))}$, which implies \begin{equation} \phi(\Delta_{\rm L}) = -i \log{(t_{k})}. \end{equation} We then consider a Taylor expansion of $\phi(\Delta_{\rm L})$. Keeping terms up to third order in the Taylor expansion we obtain for the output state \begin{align} \label{eq:singleOut} |\textrm{out} \rangle &\sim \sqrt{\frac{\sigma}{2\pi}} \frac{1}{\pi^{1/4}} \int dx \hat{a}^\dagger(x) | 0, 0, g \rangle \int dk \, e^{i \left[\phi(\Delta_{\rm L}) + (k-k_0)\phi'(\Delta_{\rm L}) + \frac{(k-k_0)^2}{2}\phi''(\Delta_{\rm L}) + \frac{(k-k_0)^3}{3!}\phi'''(\Delta_{\rm L}) \right]} e^{-(k-k_0)^2 \sigma^2/2}e^{i k x}\\ &= \sqrt{\frac{\sigma}{2\pi}} \frac{1}{\pi^{1/4}} \int dx \hat{a}^\dagger(x) | 0, 0, g \rangle e^{i (\phi(\Delta_{\rm L}) - k_0\phi'(\Delta_{\rm L}))} \int dk e^{i k [x+\phi'(\Delta_{\rm L})]} e^{- \frac 1 2 (k-k_0)^2 \left( \sigma^2 + i \phi''(x) \right) } e^{i \frac{(k-k_0)^3}{3!}\phi'''(\Delta_{\rm L})}. \end{align} The different derivatives therefore affect the Gaussian pulse in different ways. The first derivative $\phi'(\Delta_{\rm L})$ describes the delay the pulse undergoes, while the second derivative $\phi''(\Delta_{\rm L})$ describes the broadening and chirp of the Gaussian pulse. These two terms preserve the Gaussian shape of the pulse. On the other hand the third derivative $\phi'''(x)$ describes pulse distortion, whereby the pulse becomes non-Gaussian in shape. These derivatives can be computed analytically using the definition of $t_k$ in (\ref{eq:onePhotScattMat}). The first and second derivatives as a function of detuning $\Delta_{\rm L}$ are, \begin{align} \label{eq:singlePhotonDelay} \phi'(\Delta_{\rm L}) &= \frac{4 \kappa (4 \Delta_{\rm L}^2 + \Gamma \kappa)}{16 \Delta_{\rm L}^4 + \Gamma^2 \kappa^2 + 4 \Delta_{\rm L}^2 \kappa(\kappa - 2\Gamma)},\\ \phi''(\Delta_{\rm L}) &= -\frac{32 \Delta_{\rm L} \kappa [16 \Delta_{\rm L}^4 + 8 \Gamma \Delta_{\rm L}^2 \kappa + \Gamma \kappa^2 (\kappa-3 \Gamma)]}{(16 \Delta_{\rm L}^4 + \Gamma^2 \kappa^2 + 4 \Delta_{\rm L}^2 \kappa (\kappa -2 \Gamma ))^2)}. \end{align} Here we have defined $\Gamma=4g^2/\kappa$. On resonance, when $\Delta_{\rm L}=0$, the derivatives simplify to \begin{align} \phi'(0) &= \frac 4 \Gamma,\\ \phi''(0) &= 0,\\ \phi'''(0) &= -\frac{32}{\Gamma^3} + \frac{96 \Gamma}{\Gamma^3 \kappa}, \end{align} where even-order derivatives are zero due to symmetry. These give significant insight into the role of the cavity. They show that on resonance, given that $\Gamma$ is fixed, the decay rate of the cavity does not influence the delay imparted on the pulse because $\phi'(0)$ is independent of $\kappa$. The delay here is the same as scattering off a bare two-level system \cite{Mahmoodian2020}. On the other hand, the cavity can significantly reduce the pulse distortion term on resonance $\phi'''(0)$. In particular when $\kappa=3 \Gamma$ the pulse distortion term vanishes. This occurs near the onset of strong coupling where the fluorescence spectrum develops a flat top. In this section we have taken advantage of the fact that, due to conservation of energy, the plane-wave states created by $\hat{a}^\dagger(k)$ are scattering eigenstates with eigenvalue $t_k$. We can thus use this to project an input state on a complete basis of these scattering eigenstates and compute the delay and dispersion imparted by the scattering process. Unfortunately, with the form of the two-photon scattering matrix in (\ref{eq:twoPhotScattMat}) we do not have the eigenstates an we therefore cannot do this for the two-excitation states. In order to perform an equivalent calculation for the two-photon input states we find the two-photon scattering eigenstate. \subsection{Two-photon Scattering Eigenstates} We now consider the two-excitation eigenstates. These are significantly more complicated than the plane-wave single-excitation eigenstates. This is because the energy of each individual photon is not necessarily conserved. We follow a process similar to that presented in \cite{Iversen2021PRL, Shen2007PRA}. The technique is reminiscent of computing two-excitation Bethe states in spin chains \cite{Giamarchi2003book}. We begin by writing an Ansatz that spans the two-excitation sector, \begin{equation} \begin{split} |\psi_2 \rangle = \left\{ \frac{1}{\sqrt{2}} \int dx_1 dx_2 \alpha(x_1, x_2) \hat{a}^\dagger(x_1) \hat{a}^\dagger(x_x) + \int dx_1 \hat{a}^\dagger(x_1) \hat{\sigma}_+ b(x_1) + e \hat{\sigma}_+ \hat{c}^\dagger + \int dx_1 \hat{a}^\dagger (x_1) \hat{c}^\dagger c(x_1) + c_0 \frac{c^\dagger c^\dagger}{\sqrt{2}} \right\}|0,0,g \rangle, \end{split} \end{equation} where $|0,0,g \rangle$ is the state corresponding to no photons in the waveguide or cavity and the atom in the ground state. Using the Hamiltonian in the main text, Schr\"{o}dinger's equation produces five coupled equations \begin{align} \label{eq:alphaEq} -i v_g \left(\frac{\partial}{\partial x_1} + \frac{\partial}{\partial x_1} \right)\alpha(x_1,x_2) + \frac{\eta}{\sqrt{2}} \left[ c(x_1) \delta(x_2) + c(x_2) \delta(x_1) \right] &= E \, \alpha(x_1,x_2),\\ \label{eq:c0Eq} 2 \Delta_{\rm C} c_0 + \sqrt{2} \eta c(0) + \sqrt{2} g e &= E c_0,\\ \label{eq:bEq} - i v_g \frac{d}{d x} b(x) + \eta e \delta(x) + g c(x) & = E b(x),\\ \label{eq:eEq} \Delta_{\rm C} e + \eta b(0) + \sqrt{2} g c_0 &= E e,\\ \label{eq:cEq} - i v_g \frac{d}{dx} c(x) + \Delta_{\rm C} c(x) + \frac{\eta}{\sqrt{2}} [\alpha(0,x) + \alpha(x,0) ] + \sqrt{2} \eta \delta(x) c_0 + g b(x) &= E c(x). \end{align} Our aim is to solve for the scattering eigenstates, which means we want $\alpha(x_1, x_2)$ in the limits $x_1,x_2 \rightarrow -\infty$ and $x_1,x_2 \rightarrow \infty$, giving the in and out states respectively. We note that due to bosonic symmetry $\alpha(x_1, x_2) = \alpha(x_2, x_1)$. We follow the standard approach for a two-body problem where we use center-of-mass $x_c = (x_1 + x_2)/2$ and difference $x=x_1-x_2$ coordinates. Using these coordinates, when $x_1$ and $x_2$ are away from the origin, Eq.~{\ref{eq:alphaEq}} simply becomes \begin{equation} - i v_g \frac{\partial}{\partial x_c} \alpha(x_c, x) = E\alpha(x_c, x). \end{equation} This has the solution \begin{equation} \alpha(x_c, x) = e^{i\frac{E}{v_g} x_c} f(x). \end{equation} The center-of-mass evolution follows the form of a plane wave which results from the two-photon energy being a conserved quantity. The physics of the two-photon scattering process therefore lies in the function $f(x)$. The function $f(x)$ is piecewise continuous, but has discontinuities in its derivative at $x_1=0$ and at $x_2=0$. Due to bosonic symmetry $f(-x) = f(x)$, we therefore, without loss of generality restrict ourselves to $x_1 > x_2$, which implies $x>0$. Values for $x<0$ can be obtained via symmetry. Using this information we write an Ansatz \begin{equation} f(x) = \begin{cases} f_{\rm in}(x) & 0>x_1>x_2 \\ f_{0}(x) & x_1>0>x_2 \\ f_{\rm out}(x) & x_1>x_2>0. \end{cases} \end{equation} With this Ansatz we aim to obtain an equation for $f_0(x)$ in terms of $f_{\rm in} (x)$ and then an equation for $f_{\rm out} (x)$ in terms of $f_0(x)$. To get the former we first integrate Eq.~\ref{eq:alphaEq} from $x_1=-\epsilon$ to $x_1=\epsilon$ giving, \begin{align} -i v_g \left(\alpha(0^+,x_2) - \alpha(0^-,x_2) \right) + \frac{\eta}{\sqrt{2}} c(x_2) &=0\\ \label{eq:c_for_f0_fin} c(x) &= \frac{i v_g \sqrt{2}}{\eta} \left[f_0(-x) - f_{\rm in}(-x) \right] e^{i E x/(2 v_g)}. \end{align} We then substitute Eq.~\ref{eq:cEq} in Eq.~\ref{eq:bEq} to eliminate $b(x)$, while noting that in these equations we are in the domain $x <0$. We also make use of the fact that $\alpha(x_1,x_2)$ has bosonic symmetry and is piecewise continuous, i.e., \begin{equation} \alpha(x,0)=\alpha(0,x) = \left[\alpha(0^-,x) + \alpha(0^+,x) \right]/2 = \left[f_{\rm in}(-x) + f_0(-x) \right]e^{i E x/(2 v_g)}, \end{equation} allowing us to eliminate $c(x)$. After some manipulation, we obtain the differential equation \begin{equation} \label{eq:DE1} f_0''(x) - a f_0'(x) + b f_0(x) = f_{\rm in}''(x) - \tilde{a} f_{\rm in}'(x) + \tilde b f_{\rm in}(x), \end{equation} where, \begin{align} a &= -\frac{i}{v_g}\left[E - \Delta_{\rm C} + \frac{i \kappa}{2} \right],\\ b &= \frac{E}{2 v_g^2} \left[ \Delta_{\rm C} - \frac{E}{2} + \frac{2g^2}{E} - i \frac{\kappa}{2} \right],\\ \tilde a &= -\frac{i}{v_g}\left[E - \Delta_{\rm C} - \frac{i \kappa}{2} \right],\\ \tilde b &= \frac{E}{2 v_g^2} \left[ \Delta_{\rm C} - \frac{E}{2} + \frac{2g^2}{E} + i \frac{\kappa}{2} \right]. \end{align} We have again defined the cavity relaxation rate as $\kappa = \eta^2/v_g$. We now follow the same procedure to obtain an equation for $f_{\rm out}(x)$ in terms of $f_0(x)$. We first integrate Eq.~\ref{eq:alphaEq} from $x_1 =- \epsilon$ to $x_1 =\epsilon$. This gives \begin{equation} \label{eq:c_for_fout_f0} c(x) = \frac{i \sqrt{2} v_g}{\eta} \left[f_{\rm out} (x) - f_0 (x) \right] e^{i E x/(2v_g)} \end{equation} We then substitute Eq.~\ref{eq:cEq} in Eq.~\ref{eq:bEq} to eliminate $b(x)$, but now we work in the domain $x > 0$. This time we make use of \begin{equation} \alpha(x,0)=\alpha(0,x) = \left[\alpha(x,0^-) + \alpha(x,0^+) \right]/2 = \left[f_{\rm 0}(x) + f_{\rm out}(x) \right]e^{i E x/(2 v_g)}, \end{equation} allowing us to eliminate $c(x)$. After some manupulation, we obtain the differential equation \begin{equation} \label{eq:DE2} f_{\rm out}''(x) + a f_{\rm out}'(x) + b f_{\rm out}(x) = f_0''(x) + \tilde{a} f_0'(x) + \tilde b f_0(x). \end{equation} We now have two coupled second-order differential equations. By operating on Eq.~\ref{eq:DE2} with $\left[ d^2/dx^2 - a d/dx + b \right]$ we obtain a single differential equation \begin{equation} \label{eq:DE2} \left[ \frac{d^4}{d x^4} + (2b - a^2) \frac{d^2}{dx^2} + b^2 \right] f_{\rm out} (x) = \left[ \frac{d^4}{d x^4} + (2b - a^2) \frac{d^2}{dx^2} + b^2 \right] f_{\rm in} (x) + c \frac{d^2 f_{\rm in}}{dx^2} + d \, f_{\rm in}(x), \end{equation} where, \begin{align} c &= \frac{2 i \kappa}{v_g} \left[\Delta_{\rm C} - \frac{E}{2} \right]\\ d &= i \frac{E^2 \kappa}{2 v_g^4} \left[ \Delta_{\rm C} - \frac{E}{2} + \frac{2 g^2}{E} \right]. \end{align} To find the eigenstates we then require $f_{\rm out}(x) = \lambda f_{\rm in}(x)$, where $\lambda$ is a scattering eigenvalue giving the transmission coefficient of the eigenstate. We then have the homogeneous differential equation \begin{equation} \label{eq:DE_FINAL} \left[\frac{d^4}{d x^4} + X \frac{d^2}{d x^2} + Y \right] f_{\rm in} (x)=0, \end{equation} where, \begin{align} X &= 2b - a^2 -\frac{c}{\lambda - 1},\\ Y &= b^2 - \frac{d}{\lambda - 1}. \end{align} Equation \ref{eq:DE_FINAL} has the general solution \begin{equation} \label{eq:genSol} f_{\rm in}(x) = A e^{i \Delta_1 x} + B e^{-i \Delta_1 x} + C e^{i \Delta_2 x} + D e^{- i \Delta_2 x}, \end{equation} where, \begin{align} \label{eq:Delta_1AND2} \Delta_1 &= \frac{\sqrt{X + \sqrt{X^2 - 4Y}}}{2},\\ \Delta_2 &= \frac{\sqrt{X - \sqrt{X^2 - 4Y}}}{2}. \end{align} We previously interpreted the factor in the exponent of the center-of-mass motion as being proportional to the total two-photon energy. Here the factors $\Delta_1$ and $\Delta_2$ in the exponents are proprtional to the difference between the energy of the two photons. Rearranging (\ref{eq:Delta_1AND2}) we can get the scattering eigenvalue $\lambda$ in terms of $\Delta_1$ and $\Delta_2$. Rearranging both equations in (\ref{eq:Delta_1AND2}) leads to the same functional form for the scattering eigenvalue, \begin{equation} \label{eq:lambda} \lambda(E, \Delta_1) = 1 + \frac{d - c \Delta_1^2}{a^2 \Delta_1^2 + (b - \Delta_1)^2} = \lambda(E, \Delta_2) = 1 + \frac{d - c \Delta_2^2}{a^2 \Delta_2^2 + (b - \Delta_2)^2}. \end{equation} This indicates that $\Delta_1$ and $\Delta_2$ are not both independent variables, but that one follows from the other. We will choose to use $\Delta_1$ as the independent variable and define $\Delta_2$ in terms of $\Delta_1$. Solving (\ref{eq:lambda}) for $\Delta_2$ gives \begin{equation} \label{eq:Delta2} \Delta_2 = \pm \frac{\sqrt{b^2 c + a^2 d - 2 b d + d \Delta_1^2}}{\sqrt{c \Delta_1^2 - d}} = \pm \frac{\sqrt{ 4 E g^2 \kappa ^2+\left[E (E-2 \Delta_{\rm C})-4 g^2\right] \left[E^3+4 g^2 (3 E-2 \Delta_{\rm C})-4 \Delta_1^2 E v_g ^2\right] }}{2 v_g \sqrt{ -4 E g^2-(E-2 \Delta_{\rm C}) (2 \Delta_1 v_g -E) (E+2 \Delta_1 v_g )}}. \end{equation} We note that the scattering eigenvalue in Eq.~\ref{eq:lambda} can be rearranged to a more intuitive form, \begin{equation} \lambda(E, \Delta_1) = \frac{\frac{E}{2} + v_g \Delta_1 - \Delta_{\rm C} - \frac{g^2}{E/2 + v_g \Delta_1} - i \frac{\kappa}{2}}{\frac{E}{2} + v_g \Delta_1 - \Delta_{\rm C} - \frac{g^2}{E/2 + v_g \Delta_1} + i \frac{\kappa}{2}} \frac{\frac{E}{2} - v_g \Delta_1 - \Delta_{\rm C} - \frac{g^2}{E/2 - v_g \Delta_1} - i \frac{\kappa}{2}}{\frac{E}{2} - v_g \Delta_1 - \Delta_{\rm C} - \frac{g^2}{E/2 - v_g \Delta_1} + i \frac{\kappa}{2}} = t_{E/(2v_g) + \Delta_1} t_{E/(2 v_g) - \Delta_1}, \end{equation} where $t_k$ is the single-photon transmission coefficient from (\ref{eq:onePhotScattMat}) and $E/2 \pm v_g \Delta_1$ gives the energy of each of the two photons. The two-photon transmission coefficient is therefore a product of two single-photon transmission coefficients for the energy of the two photons. In order to proceed we need to use the boundary conditions of the problem to derive the values $B/A$, $C/A$, and $D/A$. To do this we first need to compute $f_0(x)$, which we obtain by solving (\ref{eq:DE1}) directly, \begin{equation} \begin{split} f_0(x) = &\frac{\left[ -\Delta_1^2 - i a \Delta_1 + b + i \kappa \Delta_1/v_g + i E \kappa/(2 v_g^2) \right] A e^{i \Delta_1 x}}{b - i a \Delta_1 - \Delta_1^2} + \frac{ \left[ -\Delta_1^2 + i a \Delta_1 + b - i \kappa \Delta_1/v_g + i E \kappa/(2 v_g^2) \right]B e^{-i \Delta_1 x}}{b + i a \Delta_1 - \Delta_1^2}\\ & + \frac{ \left[ -\Delta_2^2 - i a \Delta_2 + b + i \kappa \Delta_2/v_g + i E \kappa/(2 v_g^2) \right]C e^{i \Delta_2 x}}{b - i a \Delta_2 - \Delta_2^2} + \frac{\left[ -\Delta_2^2 + i a \Delta_2 + b - i \kappa \Delta_2/v_g + i E \kappa/(2 v_g^2) \right]D e^{-i \Delta_2 x}}{b + i a \Delta_2 - \Delta_2^2}\\ = & t_{E/(2v_g) + \Delta_1} A e^{i \Delta_1 x} + t_{E/(2v_g) - \Delta_1} B e^{ - i \Delta_1 x} + t_{E/(2v_g) + \Delta_2} C e^{i \Delta_2 x} + t_{E/(2 v_g) - \Delta_2} D e^{-i \Delta_2 x}. \end{split} \end{equation} In the second line the form of $f_0(x)$ is intuitive: one of the two photons has scattered off the cavity and therefore each term acquires a single transmission coefficient. \subsubsection{Boundary conditions} We now use Eqs.~\ref{eq:alphaEq}-\ref{eq:cEq} to derive boundary conditions for $f_{\rm in}(x)$. Firstly, Eqs.~\ref{eq:c0Eq} and \ref{eq:eEq} are boundary conditions that relate $c_0$ and $c(0)$ as well as $b_0$ and $b(0)$. Again, we use $c(0) = \left[ c(0^+) + c(0^-) \right]/2$ and $b(0) = \left[ b(0^+) + b(0^-) \right]/2$. We obtain two more equations by integrating (\ref{eq:bEq}) and (\ref{eq:cEq}) over the origin, \begin{align} e &= \frac{i v_g}{\eta}\left[b(0^+) - b(0^-) \right],\\ c_0 &= \frac{i v_g}{\sqrt{2} \eta} \left[c(0^+) - c(0^-) \right]. \end{align} Eliminating $c_0$ and $e$ then gives two equations \begin{align} (2\Delta_{\rm C} - E)\frac{i v_g}{\sqrt{2} \eta} \left[c(0^+) - c(0^-) \right] + \frac{\eta}{\sqrt{2}} \left[c(0^+) + c(0^-) \right] + \frac{i \sqrt{2}v_g g}{\eta} \left[b(0^+) - b(0^-) \right] &= 0,\\ (\Delta_{\rm C} - E)\frac{i v_g}{\eta} \left[b(0^+) - b(0^-) \right] + \frac{\eta}{2} \left[b(0^+) + b(0^-) \right] + \frac{i v_g g}{\eta} \left[c(0^+) - c(0^-) \right] &= 0. \end{align} We now relate these boundary conditions to $f_{\rm in}(x)$ and $f_0(x)$. To do this we use (\ref{eq:c_for_f0_fin}) and (\ref{eq:c_for_fout_f0}) to obtain $c(x)$ in terms of $f_{\rm in}(x)$ and $f_0(x)$ when $x<0$ and $x>0$ respectively. We then use (\ref{eq:bEq}) to obtain $b(x)$ in terms of $c(x)$ and thus in terms of $f_{\rm in}(x)$ and $f_0(x)$ when $x<0$ and $x>0$. Using these we obtain two boundary conditions, \begin{align} \label{eq:BC1} \left. \frac{d f_{\rm in}}{d x} \right|_{x=0} &= 0,\\ \label{eq:BC2} 2 i v_g \left. \frac{d f_0}{dx} \right|_{x=0} &= \left[ (\lambda+1) i K_1 + (\lambda-1) K_3 \right] f_{\rm in}(0) + 2 i K_2 f_0(0) , \end{align} where $K_1 = -2(E - \Delta_{\rm C})(E/2 - \Delta_{\rm C})/\kappa + \kappa/2 + 2 g^2 / \kappa$, $K_2 = 2(E - \Delta_{\rm C})(E/2 - \Delta_{\rm C})/\kappa + \kappa/2 - 2 g^2/\kappa$, and $K_3 = 3 E/2 - 2 \Delta_{\rm C}$. In terms of the constants $A$, $B$, $C$, and $D$, these conditions are, \begin{align*} i \Delta_1(A - B) + i \Delta_2 (C - D) &= 0,\\ (A + B + C + D)\left[ (\lambda+1) i K_1 + (\lambda-1) K_3 \right] &= -2 \left[ (i K_2 + v_g \Delta_1)t_{E/(2v_g) + \Delta_1}A + (i K_2 - v_g \Delta_1)t_{E/(2v_g) - \Delta_1}B \right.\\ &\left. + (i K_2 + v_g \Delta_2) t_{E/(2 v_g) + \Delta_2} C + (i K_2 - v_g \Delta_2)t_{E/(2 v_g) - \Delta_2} D \right]. \end{align*} Here we have used a concise notation with $\lambda = \lambda(E, \Delta)$. These two boundary conditions, along with orthonormality, can be used find a class of extended states. We do not use the extended states in the main text for any of the computations. \subsubsection{Bound States} The general form of the two-photon eigenstates solution (\ref{eq:genSol}) is composed of a linear combination of four exponential functions. When $\Delta_1$ and $\Delta_2$ are real, these lead to plane-wave or spatially extended solutions. We are interested in bound-state solutions where the photons are exponentially localised in about the difference coordinate, i.e., solutions where $\Delta_1$ and $\Delta_2$ are imaginary or complex with a positive-values imaginary part for $x>0$. Here $\Delta_1$ is no longer a quantum number labelling the state meaning the state is only labelled by its total two-photon energy $E$. For these solutions to remain bounded (not go to infinite), we then require $B=0$ and $D=0$. The two boundary conditions (\ref{eq:BC1}) and (\ref{eq:BC2}) give two coupled equations which can be written in matrix form as $\mathbf M \mathbf v = \mathbf 0$. Here, $\mathbf v = \begin{pmatrix} A & C \end{pmatrix}^T$. We obtain a condition to find $\Delta_1$ by requiring the determinant of the matrix vanish $\operatorname{det(\mathbf M)} = 0$, \begin{equation} \label{eq:detM} \frac{2 K_2 (t_{\Delta_1} \Delta_2 - t_{\Delta_2} \Delta_1) + 2 i v_g \Delta_1 \Delta_2 (t_{\Delta_2} - t_{\Delta_1}) + i K_3 (\Delta_1 - \Delta_2) (\lambda - 1) - K_1 (\Delta_1 - \Delta_2) (1 + \lambda)}{2 K_2 (t_{-\Delta_2} \Delta_1 - t_{-\Delta_1} \Delta_2) + 2 i v_g \Delta_1 \Delta_2 (t_{-\Delta_2} - t_{-\Delta_1}) - i K_3 (\Delta_1 - \Delta_2) (\lambda - 1) + K_1 (\Delta_1 - \Delta_2) (1 + \lambda)} = 0 \end{equation} Here, we have used the concise notation $t_{\pm \Delta} \equiv t_{E/(2v_g) \pm \Delta}$. The eigenvector with coefficients $A$ and $C$ then corresponds to the eigenvector with zero eigenvalue. In general, the value of $\Delta_1$ that satisfies $(\ref{eq:detM})$ is complex. Furthermore the value of $\Delta_2$ corresponding to this value of $\Delta_1$ is also in general complex. The transmission coefficient for the bound state is then obtained by substituting the complex value of $\Delta_1$ in (\ref{eq:lambda}). Similarly $\Delta_2$ is also obtained by substituting the complex value of $\Delta_1$ in (\ref{eq:Delta2}). We solve these equations numerically and use a two-dimensional minimization algorithm to find the real and imaginary parts of $\Delta_1$. The general form of the eigenstate is then \begin{equation} \begin{split} \label{eq:boundStateFullDefinition} |B_E \rangle &= \frac{1}{\sqrt{2}} \int dx_1 dx_2 \hat{a}^\dagger(x_1) \hat{a}^\dagger(x_2) | 0 \rangle B_E(x_c, x)\\ B_E(x_c, x) &= e^{i E x_c/v_g} N \left\{ A e^{- \operatorname{Im}{(\Delta_1)}|x|} \left[ \cos{(\operatorname{Re}{(\Delta_1)} x)} + i \operatorname{sgn}{(x)} \sin{(\operatorname{Re}{(\Delta_1)} x)} \right] \right.\\ & \left. + C e^{- \operatorname{Im}{(\Delta_2)}|x|} \left[ \cos{(\operatorname{Re}{(\Delta_2)} x)} + i \operatorname{sgn}{(x)} \sin{(\operatorname{Re}{(\Delta_2)} x)} \right] \right\} \equiv e^{i E x_c/v_g} B_E(x), \end{split} \end{equation} where \begin{equation} N = \frac{1}{\sqrt{2 \pi}} \left\{\frac{|A|^2}{\operatorname{Im}{(\Delta_1)}} + \frac{|C|^2}{\operatorname{Im}{(\Delta_2)}} + 4 \operatorname{Re}{\left[ \frac{A \, C^*}{\operatorname{Im}{(\Delta_1)} + \operatorname{Im}{(\Delta_2)} - i (\operatorname{Re}{(\Delta_1)} - \operatorname{Re}{(\Delta_2)})} \right]}\right\}^{-1/2}. \end{equation} Again, we note that the full expression for $B_E(x)$ is obtained by solving for $A$ and $C$ numerically. \subsubsection{Perturbation approximation} While the full expression for the bound states can only be obtained numerically, we can perform a perturbative expansion to obtain approximate expressions. We begin by expanding (\ref{eq:detM}) to first order and in $1/\kappa$ and solving for $\Delta_1$. By $1/\kappa$ we refer to any term where the numerator has units of frequency and the denominator has the value $\kappa$. This gives \begin{equation} \Delta_1 = \frac{i \Gamma}{2 v_g} + \frac{i \Gamma^2}{2 v_g \kappa} + O\left(\frac{1}{\kappa^2} \right), \end{equation} and, \begin{equation} C = - A \frac{\Gamma}{\kappa} + O\left(\frac{1}{\kappa^2} \right). \end{equation} Substituting this into the expression for (\ref{eq:Delta2}) gives, \begin{equation} \Delta_2 = \frac{i \kappa}{2 v_g} + i \frac{E^2 - 2\Gamma^2}{4 v_g \Gamma} + O\left(\frac{1}{\kappa^2} \right). \end{equation} Combining these together and computing the normalization gives, \begin{equation} B_{E}(x_c, x) = \frac{e^{i \frac{E}{v_g} x_c }}{\sqrt{4 \pi v_g}} \frac{1}{\sqrt{\frac{\kappa}{\Gamma^2 + \Gamma \kappa} + \frac{8 \Gamma^2}{2\Gamma^3 + E^2 \kappa + 2 \Gamma \kappa^2} + \frac{2 \Gamma^3}{\kappa^2 [E^2 + 2 \Gamma (\kappa - \Gamma)]}}} \left[e^{-\frac{\Gamma}{2 v_g} (1 + \frac \Gamma \kappa)|x|} - \frac{\Gamma}{\kappa} e^{-\frac{\kappa}{2 v_g} \left(1 + \frac{E^2 - 2 \Gamma^2}{2 \kappa \Gamma} \right) |x|} \right] + O\left(\frac{1}{\kappa^2} \right). \end{equation} In comparison to the two-photon bound state in waveguide QED \cite{Mahmoodian2020PRX}, the addition of a cavity therefore introduces a new term to the bound state. This term, rather than having a decay length inversely proportional to $\Gamma$ has a decay length inversely proportional to the cavity decay rate $\kappa$. It also has the opposite sign to the other term and therefore the two terms interfere destructively. This causes the cusp at the origin to smooth out for infinitesimally small $\kappa$. Using the perturbative solution of $\Delta_1$, we obtain for the transmission coefficient to leading order \begin{equation} t_{B}(E) = \frac{-2 \Gamma^2 + E (i \kappa - 2 E) + 2\Gamma (\kappa + i E)}{2 \Gamma^2 + E (i \kappa + 2 E) - 2\Gamma (\kappa - i E)} + O\left(\frac{1}{\kappa^2} \right). \end{equation} The delay incurred by a resonant pulse of bound states in the center-of-mass coordinate is then \begin{equation} \phi'_B(0) = \frac{1}{\Gamma} + \frac{3}{\kappa} + O\left(\frac{1}{\kappa^2} \right), \end{equation} where $\phi_B(E) = -i \log{t_{B}(E)}$. The distortion on resonance is then \begin{equation} \phi'''_B(0) = -\frac{1}{2 \Gamma^3} \left[ 1 - \frac{3 \Gamma}{\kappa} \right] + O\left(\frac{1}{\kappa^2} \right). \end{equation} \subsubsection{Two-photon bound-state scattering, delay, and dispersive effects} To compute the scattered two-photon state in the bound subsector we simply compute \begin{equation} \label{eq:boundOut} |\textrm{out}\rangle_{\rm bound} = \int dE \, t_2(E) \, | B_E \rangle \langle B_E| \textrm{in} \rangle, \end{equation} where the bound eigenstates $|B_E \rangle$ are given in (\ref{eq:boundStateFullDefinition}). Here, the input state is taken to be a separable state, \begin{equation} |\textrm{in} \rangle = \frac{1}{\sqrt{2}}\int dx_1 dx_2 \hat{a}^\dagger(x_1) \hat{a}^\dagger(x_2) | 0 \rangle f(x_1) f(x_2), \end{equation} where, as for single photon scattering, the functions $f(x)$ can be the pulse shape given by the laser (which are approximately Gaussian) or the exact Gaussian functions in (\ref{eq:inputPulseShape}). We compute the output state by calculating the integral over $E$ numerically. We now show that the delay and the dispersion can be computed in the center-of-mass coordinate. We note that the input state can be written in center-of-mass and difference coordinate, which for a Gaussian input becomes \begin{equation} |\textrm{in} \rangle = \frac{1}{\sqrt{2}}\int dx_1 dx_2 \hat{a}^\dagger(x_1) \hat{a}^\dagger(x_2) | 0 \rangle \frac{1}{\sigma \sqrt{\pi}} e^{2i k_0 x_c}e^{-x_c^2/\sigma^2} e^{-x^2/(4\sigma^2)}. \end{equation} The overlap of the input state and the bound state $\langle B_E | \textrm{in} \rangle = \nu e^{-(E - 2k_0)^2\sigma^2/4}$, where the constant $\nu$ is the result of the difference-coordinate integral and it's form is not relevant here. The output state can thus be written \begin{equation} | \textrm{out} \rangle_{\rm bound} = \frac{1}{\sqrt{2}} \int dx_1 dx_2 \hat{a}^\dagger(x_1) \hat{a}^\dagger(x_2) | 0 \rangle \nu B_E(x) \int dE e^{i E x_c} t_B(E) e^{-(E - 2k_0)^2\sigma^2/4}. \end{equation} Here the bound-state transmission coefficient in the center-of-mass coordinate plays the same role as the single-photon transmission coefficient in (\ref{eq:singleOut}). We can therefore find the delay and dispersion in the same way as for the single-photon case by defining \begin{equation} \label{eq:boundPhi} \phi_B(k_0) = \left. -i \log{(t_B(E))}\right|_{E=2 v_g k_0} \end{equation} The delay and higher-order dispersion for the two-photon bound state are calculated numerically, by taking first, second and third, derivatives of (\ref{eq:boundPhi}) in $E$. \subsubsection{Extended States} The extended scattering eigenstates are those with the form (\ref{eq:genSol}) where the exponents are imaginary and the field is extended in the relative coordinate $x$. Here there are two sets of exponents, two with $\pm \Delta_1$ and two with $\pm \Delta_2$. As discussed, we take $\Delta_1$ to be the quantum number of the eigenstate and $\Delta_2$ then depends on $\Delta_1$ according to (\ref{eq:Delta2}). Depending on the values of $\Delta_1$, $E$, $\kappa$, and $g$, $\Delta_2$ can either be real or imaginary. Noting that in (\ref{eq:Delta2}) we are free to define the sign of $\Delta_2$, we always choose this such that when it is imaginary it has a positive imaginary part. In this case, for the solution to remain bounded, we require $D=0$. We then have two boundary conditions and the requirement that the eigenstate be normalized, which gives three conditions in total. Using the boundary conditions to solve for $B$ and $C$ gives \begin{align} \frac{B}{A} = \frac{(\lambda +1) K_1 (\Delta_1-\Delta_2)-2 \Delta_2 K_2 t_{\Delta_1}+2 \Delta_1 K_2 t_{\Delta_2}-i (\lambda -1) K_3 (\Delta_1-\Delta_2)+2 i \Delta_1 \text{$\Delta$2} t_{\Delta_1} v_g -2 i \Delta_1 \Delta_2 t_{\Delta_2} v_g }{(\lambda +1) K_1 (\Delta_1+\Delta_2)+2 K_2 (\Delta_2 t_{-\Delta_1}+\Delta_1 t_{\Delta_2})-i (\lambda -1) K_3 (\Delta_1+\Delta_2)+2 i \Delta_1 \Delta_2 v_g (t_{-\Delta_1}-t_{\Delta_2})},\\ \frac{C}{A} = -\frac{2 \Delta_1 ((\lambda +1) K_1+K_2 (t_{\Delta_1}+t_{-\Delta_1})-i (\lambda -1) K_3-i \Delta_1 v_g (t_{\Delta_1}-t_{-\Delta_1}))}{(\lambda +1) K_1 (\Delta_1+\Delta_2)+2 K_2 (\Delta_2 t_{-\Delta_1}+\Delta_1 t_{\Delta_2})-i (\lambda -1) K_3 (\Delta_1+\Delta_2)+2 i \Delta_1 \Delta_2 v_g (t_{-\Delta_1}-t_{\Delta_2})}, \end{align} where the compressed notation $t_\Delta \equiv t(E/2 + v_g \Delta)$ has been used. In addition to begin imaginary, $\Delta_2$ can also be real. Here, in general, the constant $D \neq 0$. We therefore have four unknown parameters and only two boundary conditions and one normalization condition. The lack of a boundary condition arises because the system has a degeneracy. In (\ref{eq:genSol}) one can interchange $\Delta_1$ and $\Delta_2$ and the solution remains valid and has the same eigenvalue (\ref{eq:lambda}). In order to obtain a further constraint we can require that the two degenerate solutions, \begin{align} f_{\rm in}^{\Delta_1}(x) = A_{\Delta_1} e^{i \Delta_1 x} + B_{\Delta_1} e^{-i \Delta_1 x} + C_{\Delta_1} e^{i \Delta_2 x} + D_{\Delta_1} e^{-i \Delta_2 x},\\ f_{\rm in}^{\Delta_2}(x) = A_{\Delta_2} e^{i \Delta_2 x} + B_{\Delta_2} e^{-i \Delta_2 x} + C_{\Delta_2} e^{i \Delta_1 x} + D_{\Delta_2} e^{-i \Delta_1 x}, \end{align} are orthogonal. Here we have used the fact that the function $\Delta_2 = h(\Delta_1)$ in (\ref{eq:Delta2}) is its own inverse, i.e., $\Delta_1 = h(\Delta_2)$. The orthogonality condition can be achieved by requiring $\Delta_1>0$, $\Delta_2>0$, and \begin{align} \frac{B_{\Delta_1}}{A_{\Delta_1}} &= - \frac{C_{\Delta_2}^*}{D_{\Delta_2}^*},\\ \frac{B_{\Delta_2}}{A_{\Delta_2}} &= - \frac{C_{\Delta_1}^*}{D_{\Delta_1}^*}. \end{align} This then gives a sufficient number of constraints to find all unknowns. \bibliographystyle{naturemag_noURL}
\section{Introduction} \label{sec:introduction} \IEEEPARstart{R}{ecent} advancements in computing technologies have witnessed a massive number of smart objects (e.g., smart meters, smart watches, and smart refrigerators) connected to the Internet to form the Internet of Things (IoT) \cite{8334540,CACM2021,ZhangSMTZHAASM20}. Furthermore, these smart objects are equipped with sensing, processing, and communication capabilities, allowing them to provide a variety of applications and services, which are expanding in a variety of areas, including personal, industrial, and commercial domains \cite{9427249} \cite{sagar_survey}. With the expansion of IoT applications ranging from smart homes, smart factories. smart cities. to e-Health, the number of IoT objects (i.e., devices) are rapidly increasing, limiting network discovery and navigability when IoT devices consume and use services from one another. Over the last decade, several research have have investigated the concept of incorporating social interactions components with IoT devices to enhance information discovery in the same way that humans do using the principle of small-world phenomenon, which refers to the short chain of links (i.e., relationships) among individuals in societies \cite{nitti2014_n}\cite{10.5555/2980539.2980596}. \begin{figure}[t] \centering \includegraphics[scale=0.5]{social_structure.png} \caption{Depicting the SIoT relationships} \label{fig:siot_rel} \vspace{-1em} \end{figure} The mapping of the social structure of human and physical (i.e., IoT) devices (see Figure \ref{fig:siot_rel}) has led to an emerging paradigm of \emph{Social Internet of Things (SIoT)} and has opened the ways for next generation of IoT \cite{Atzori2011SIoTGA}. Furthermore, the mapping encompasses three distinct relationships (i.e., user-object relationships, object-object relationships, and user-user relationships). In SIoT, objects have the potential to socialize by establishing social relationships with one another autonomously based on the rules defined by their individual owners \cite{ATZORI20123594}. The evolution of SIoT can be foreseen as trillions of objects acting as autonomous agents (i.e., requesting and providing services) with a number of benefits, including but not limited to the assurance of effective object and information discovery in a trust-oriented manner, network scalability similar to human beings, building trustworthiness by incorporating the interaction behaviour among friends (or objects), and to utilize and extends existing social network models for SIoT networks. Through the use of social relationships with IoT objects, SIoT has opened the way for the next generation of IoT. Maintaining trustworthy relationships, as well as security, privacy, and trust-related concerns, may however, limit the significance of SIoT paradigm. In the SIoT scenario, for example, a service requester (or \emph{trustor}) has the responsibility of observing the trustworthiness of the service providers (or \emph{trustee}) who provide the requested service; however, the possibility of a misbehaving object providing false services or false recommendations about a trustee to gain an advantage for a set of services can disrupt the availability and integrity of the SIoT services. Although some researches have presented cryptographic and non-cryptographic solutions to solve such concerns \cite{9011598} \cite{9382796}, security issues like trust as well as reputation are difficult to handle with such solutions. As a result, an effective SIoT trustworthiness management system is required to cope with misbehaving SIoT objects by limiting their services and by selecting only the credible and trustworthy objects before relying on the services provided by them. The motive for establishing trustworthiness management for SIoT is evident based on the observations made. Several studies have been proposed to address the challenges of trustworthiness management. However, most of these studies do not consider a thorough study of SIoT fundamentals, such as 1) the selection of SIoT-based trust metrics, 2) only considering the static characteristics of SIoT relationships (e.g., ownership, location), and 3) using the traditional approach (i.e., linear relationship) to map the input and output for trustworthiness management. In this article, we have proposed a trustworthy object classification framework, known as \emph{Trust--SIoT} by employing the concept of social trust theory to address the above-mentioned weaknesses. The main contributions of the proposed paper are as follows: \begin{itemize} \item A trustworthy object classification framework (\emph{Trust--SIoT}) is envisaged by employing the social characteristics of objects in terms of direct trust metrics, reliability and benevolence, credible recommendations, and the degree of relationships. \item We construct the SIoT knowledge graph to record five dynamic social relationships of SIoT objects in order to measure the degree of relationships. The learned graph embedding vectors are then used to estimate the object's social similarity using a knowledge graph embedding (KGE) model. \item Using complex non-linear correlations to map the input (i.e., trust measures) and output, we have proposed an artificial neural network-based heuristic for trustworthy object classification. \item Finally, the performance of the proposed framework is evaluated by a number of evaluation metrics, i.e., F1-score, MAE, and MSE on two real-world datasets against the existing state-of-the-art. \end{itemize} The remainder of the paper is organized as follows: Section \ref{sec:back_rel_work} presents the discussion on SIoT, generalized trust background and the existing trust management models for SIoT and online social networks. In Section \ref{sec:prob_setup}, we have defined the problem and introduced the used notations. Section \ref{sec:trust_quqn} delineates the proposed trust quantification framework for SIoT, and Section \ref{sec:exp_res} reports the experimental setup and experimental results from the performance evaluation of the proposed model. Finally, Section \ref{sec:conc} gives the concluding remarks and future research directions. \section{Background and Related Work} \label{sec:back_rel_work} \subsection{Social Internet of Things (SIoT)} The SIoT is the convergence of two domains: IoT and social networks. As a result, the paradigm of SIoT is formed wherein object establish the social links to create the social network of objects. In SIoT, an object is not only capable of measuring the surrounding ambience but can also establish the social relationships with other objects in the network on its own. These relationships enable an object to exchange the information with other objects (i.e., friends) in a trustworthy manner, and thus, provide the confidence of information sources as objects' tends to trust the friends having common characteristics, similar to humans (i.e., \emph{homophily} theory \cite{10.1145/1386790.1386838}). In the SIoT, an object can establish a variety of relationships, including but not limited to ownership object relationships (OOR), which are formed between objects belonging to the same owner (e.g., a mobile phone and a laptop), parental object relationships (POR), which are formed between objects manufactured by the same manufacturer and built at the same time (i.e., same batch), co-location and co-work object relationships (CLOR and CWOR), where CLOR represents the relationship established between the objects providing the services at the similar locations, whereas CWOR is established between the object providing the composite services, and social object relationships (SOR), which is established when two objects come into contact with each other because of their owners (e.g., mobile devices of two friends), and is dependent on the frequency of meeting between the owners's meeting. \subsection{Trust in SIoT} Trust is generally regarded as an integral constituent in any human social relationship. It is measured in terms of the degree of confidence pertinent to an individual's or any entity's likelihood to behave in an anticipated manner. The notion of trust varies across disciplines, i.e., trust has been studied by researchers in the domains of human sciences, i.e., sociology and psychology \cite{doi:10.1177/1368431003006002002} \cite{KRUEGER201992}, and in economics and computer science \cite{Backhouse2009} \cite{10.1145/642611.642634}. Each of these disciplines regard trust in a different perspective, and as such, their narrative could not be directly applied to SIoT. In SIoT, trust is referred to as the assessment of trustee's actions (or the assessment of data it provides) in view of trustor's expectations within a particular timespan. Furthermore, the assessment can be a probability, a value or a label, and be termed as trust esteem. In recent years, a plethora of trustworthiness management models are proposed, some of the latest literature is discussed in the subsection below. \subsection{Trustworthiness Models} There exists a limited relevant work on trust management that employ prediction-based techniques (e.g., machine learning, deep learning), particularly, classifying the misbehaving objects who attack the reliable objects in the SIoT network \cite{9305298} \cite{9328463} \cite{9148767} \cite{sagar1}. Most recently, Marche \textit{et al. } \cite{9305298} proposed a decentralized trust management model to detect the malicious objects that undertake various types of trust-related attacks. The suggested model, in general, employs machine learning heuristic to train the trust model on three trust scores: goodness, usefulness and perseverance. The suggested model's performance is compared to existing work using various trust-related attacks, and it is discovered that the proposed model performs well when using a combination of mix attacks, but decreases when using individual attacks. A matrix factorization-based approach is delineated by Aalibagi in \cite{9328463} wherein the SIoT network is portrayed as the bipartite graph of trustors and trustees providing and requesting different services. The model has exploited the Hellinger distance in order to propose a similarity and centrality-based social trust model. Finally, the matrix factorization approach is designed to extract the latent features of SIoT objects to classify the trustworthy objects, and to address the challenges of data sparsity and cold start problem. Sagar \textit{et al. } \cite{sagar1} presented a social trust computational model by employing various types of similarities in terms of community-of-interest, friendship, and co-work similarity, and cooperativeness via social cooperation between SIoT objects. The trust model is then trained using a machine learning method (i.e., random forest) to classify the objects as trustworthy or untrustworthy. Trust is also an important factor in social theory (i.e., social network) \cite{9142365}. A number of trust model for online social networks that may be extended for SIoT are presented in the literature, and they provide the extensive insight into the complex nature of social trust in terms of various trust properties, e.g., context-dependency, dynamic nature, uncertainty, transitivity, etc. The current literature employ a variety of approaches (neural network, walk-based, matrix factorization, etc.) to evaluate the trustworthiness of a node in online social network. Lin \textit{et al. } \cite{9155370} designed a trust model based on node's popularity and engagement as a trust features. Then, a graph convolutions neural network-based trust model is proposed to train the trust model in order to classify the trustworthy objects. The performance evaluation has shown the promising result when compared to the current existing state-of-the-art. Furthermore, a variety of walk-based approaches are delineated to assess the trust of a node by considering the trust propagation along the path from the trustor to the trustee \cite{8057106} \cite{6848107} to evaluate the trust score of a trustee. Furthermore, these techniques utilize a range of trust propagation (i.e., breadth first search and multi-path algorithms) method to traverse through social network graph. Finally, the trust estimation is computed as the aggregation of trust propagation from multiple paths. Furthermore, it is imperative to study the current emerging techniques, (e.g., knowledge graph embedding (KGE)) that are currently the mainstream approach for knowledge graph representation in term of entity and relationships \cite{KGSurvey,2017Survey} \cite{RotL} \cite{TransE}. As SIoT network consists of social relationships between the SIoT objects, and these relationships are important part of trust evaluation process, thus, KGE can be utilized to represent these social relationships as the learning vector in order to quantify the social strength between the objects. As of now, only a few studies have explored the concept of KGE in SIoT for similarity computation \cite{doi:10.1177/15501477211009047} \cite{8936977}. Chen \textit{et al. } in \cite{8936977} \cite{doi:10.1177/15501477211009047} constructed the time-aware SIoT knowledge graph to estimate the social similarity of heterogeneous SIoT relationships by embedding the SIoT relationships in low-dimensional vector. Then, these low-dimensional vectors are used to determine the social similarity of the objects in order to provide the service/object recommendations. In general, SIoT can benefit from the state-of-the-art trust evaluation methodologies and the trust properties utilized in online social networks, and in this paper, we have employed a number of such properties (i.e., reliability and benevolence) that have been explored in social networks. Furthermore, it is also imperative to explore the emerging techniques to effectively utilize SIoT paradigm's social aspects. Thus, we have exploited the low computation knowledge graph embedding (KGE) model to measure the social similarity of SIoT objects in terms of degree of relationships in the proposed framework. \section{Problem Setup} \label{sec:prob_setup} \begin{figure}[!tb] \centering \includegraphics[scale=0.4]{siot_network.png} \caption{SIoT network as a directed graph $\mathcal{G} = (\mathcal{V},\mathcal{E},\mathcal{W})$} \label{fig:siot_network} \end{figure} \begin{figure*}[h] \centering \includegraphics[scale=0.5]{trust_framework2.png} \caption{Illustration of \emph{Trust--SIoT} framework ($\otimes$ represents concatenation)} \label{fig:trust_framework} \end{figure*} In this paper, we consider the trust quantification of a social object in a SIoT network which is modeled in the form of a directed graph as $\mathcal{G} = (\mathcal{V},\mathcal{E},\mathcal{W})$ (Figure \ref{fig:siot_network}), wherein $s_i,s_j \in \mathcal{V}$ represents the social objects, the edge $e_{s_i,s_j} \in \mathcal{E}$ manifests the direct relationships, and $w_{s_i,s_j} \in \mathcal{W}$ represents the evaluation function in terms of trust relationship of social object (trustor-trustee) pair $(s_i,s_j)$. Let $\mathcal{W}^t = \{\mathcal{T}(s_i,s_j), w_{s_i,s_j}|e_{s_i,s_j} \in \mathcal{E}\}$ denotes the set of unobserved trust between any trustor-trustee pair to be quantified at any given time $t$. In order to quantify the trustworthiness of a social object, $object-object$ observations in terms of $successful$ and $unsuccessful$ interactions and social information of social objects via fundamental SIoT relationships are employed as our primary data source. The nomenclature is provided in Tabel \ref{tab:notation} for reference. \renewcommand{\arraystretch}{1.5} \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \newcommand{\centered}[1]{\begin{tabular}{l} #1 \end{tabular}} \begin{table}[h] \scriptsize \begin{center} \caption{Summary of notations} \label{tab:notation} \begin{tabular}{|>{\centering\arraybackslash}m{1.5cm} |>{\centering\arraybackslash}m{5.5cm}|} \hline \small\textbf{Notation} & \small\textbf{Description} \\ \hline $\mathcal{P}$ & Positive (Successful) Interactions \\ \hline $\mathcal{N}$ & Negative (Unsuccessful) Interactions \\ \hline $\mathcal{B}$ & Benevolence \\ \hline $\mathcal{R}$ & Reliability \\ \hline $\mathcal{CR}$ & Credibility \\ \hline $\mathcal{K}$ & Number of credible objects \\ \hline $\Phi$ & Trust Factor \\ \hline $\lambda$ & Rate of Trust Factor \\ \hline $f$ & KGE scoring function \\ \hline $\mathcal{L}$ & Cross Entropy Loss \\ \hline $\mathcal{C}-\mathcal{D}$o$\mathcal{R}$ & Context-aware Degree of Relationships \\ \hline $\mathcal{DTM}$ & Direct trust of trustor-trustee pair \\ \hline $\mathcal{RTM}$ & Recommendations for trustee \\ \hline $\mathbb{T}$ & Final Trust Score \\ \hline \end{tabular} \end{center} \vspace{-3mm} \end{table} Let $\mathcal{S} = \{s_1,s_2,...,s_n\}$ represents the set of social objects. Given a set of $object-object$ interactions and their social profiles in terms of a variety of relationships between them, the target problem of this research paper is to formulate the trust quantification by employing a number of trust metrics, i.e., Direct Trust Metric ($\mathcal{DTM}$), Reliability $\mathcal{R}$, Benevolence $\mathcal{B}$, Recommendations as a Trust Metric ($\mathcal{RTM}$), and Context-based Degree of Relationships ($\mathcal{C}-\mathcal{D}o\mathcal{R}$) in the form of a quintuple $<\mathcal{DTM},\mathcal{R}, \mathcal{B}, \mathcal{RTM},\mathcal{C}-\mathcal{D}o\mathcal{R}>$. Direct Trust Metric is measured when two object establish a direct relationship with each other via direct interaction between them, and as a result, a direct link $e_{s_i,s_j}$ is established in a graph with a weight $\mathcal{DTM}^t (s_i,s_j)$ refers to the direct of trust of $s_i$ towards $s_j$ at any time interval $t$. Recommendations as a Trust Metric is measured when two social object can only establish the relationship with each other by the word of mouth via objects' neighbours (i.e., friends) or via global reputation. Reliability is the fairness of object in providing recommendation to other objects and in contrast, benevolence represents on how other objects believe the object providing recommendations. Context-based Degree of Relationships ($\mathcal{C}-\mathcal{D}o\mathcal{R}$) refers to the context-based social strength between two social objects interacting with each other. It represents the confidence of information sources as objects tend to have more confidence on the objects similar to themselves in respect to a variety of qualities and characteristics. In general, the pairwise trust between social objects is quantified as: \begin{equation} \mathbb{T} (s_i,s_j) = \{\mathcal{T} (s_i,s_j), \forall \ s_i,s_j \in \mathcal{V},\mathcal{T} \in [0,1]\} \end{equation} \begin{equation} \mathcal{T} (s_i,s_j) \leftarrow \mathcal{DTM} \oplus \mathcal{R} \oplus \mathcal{B} \oplus \mathcal{RTM} \oplus \mathcal{C}-\mathcal{D}o\mathcal{R} \end{equation} Here $\oplus$ is the aggregation operator. \section{Trust Quantification Model for SIoT} \label{sec:trust_quqn} This study proposes the \emph{Trust--SIoT} framework for the quantification of trust vis-\'a-vis any two social objects. The proposed framework consists of five trust metrics, direct trust metric, reliability and benevolence, recommendations as a trust metric, and the degree of relationships. The high-level overview of the proposed framework is depicted in Figure \ref{fig:trust_framework}. For the trust quantification, at first, the proposed framework computes the direct trust metric by employing positive and negative interactions. The reliability and benevolence are then measured to observe how the trustee is known amongst the neighbours in the network. Subsequently, the reliability and benevolence are integrated to measure the credibility of neighbours for recommendations, and the neighbours with a credibility score above the threshold being considered to provide the recommendations for the trustee. The social resemblance of both the trustor and trustee in terms of their social relationships is measured by employing knowledge graph embedding to learn the embedding vector in order to quantify the degree of relationships (i.e., the social similarity of the trustor-trustee pair). Finally, an artificial neural network-based (ANN-based) model is trained for decision-making to identify the trustee's level of trustworthiness (trustworthy, neutral, or untrustworthy) of the trustee. The following are the details of the trust metrics: \subsection{Direct Trust Metric} Direct trust metric ($\mathcal{DTM}$) represents a direct trust score for a trustor-trustee pair. The proposed model adopts the Bayesian inference model \cite{Ismail2002TheBR} with beta probability density function to quantify the direct trust of a social object (Eq. \ref{eq:direct_trust}). The direct trust of a social object $s_x$ (trustor) towards another object $s_y$ (trustee) is defined as: \begin{figure}[!t] \centering \includegraphics[scale=0.5]{past-Exp.png} \caption{Decay in trust of a SIoT Object vis-\'a-vis time} \label{fig:past-Exp} \end{figure} \begin{equation} \mathcal{DTM}^t (s_i,s_j) = \frac{\mathcal{P}^t_{s_i,s_j}+1}{\mathcal{P}^t_{s_i,s_j}+\mathcal{N}^t_{s_i,s_j}+2} \label{eq:direct_trust} \end{equation} or, it can be simplified as: \begin{IEEEeqnarray}{rCl} \mathcal{DTM}^t (s_i,s_j) = \begin{cases} \frac{\mathcal{P}^t_{s_i,s_j}}{\mathcal{P}^t_{s_i,s_j}+\mathcal{N}^t_{s_i,s_j}} & \forall \ \mathcal{P}^t_{s_i,s_j},\mathcal{N}^t_{s_i,s_j} > 0 \\ 0.5 & otherwise \end{cases} \end{IEEEeqnarray} wherein, $\mathcal{P}^t_{s_i,s_j}$ denotes the number of the positive (successful) interaction carried out between trustor($s_i$)-trustee($s_j$) pair. Similarly, $\mathcal{N}^t_{s_i,s_j}$ denotes the count of negative (unsuccessful) interactions from the beginning to the current $t$. Past experience (interactions) from the beginning may not accurately reflect the behaviour of an object owing to the fact that an object's behaviour may change over time. Therefore, it is indispensable to model past experience by taking into account the feasible time interval that can provide the appropriate reputation of an object. The proposed model considers a trust factor $\Phi$ that can be tweaked to include the recent reputation of an object and can be employed in conjunction with interactions (i.e., $\mathcal{P}$ and $\mathcal{N}$). Eq. (\ref{eq:post}) and Eq. (\ref{eq:neg}) demonstrate the quantification of positive and negative interactions at any time $t$ with trust factor $\Phi$. \begin{equation} \begin{split} \mathcal{P}_{s_i,s_j} & = \Phi \times \mathcal{P}_{s_i,s_j}^{t-t_o} + \mathcal{P}_{s_i,s_j}^t \\ & = \left[1-(t-t_o)^\lambda \right] \times \mathcal{P}_{s_i,s_j}^{(t-t_o)} + \mathcal{P}_{s_i,s_j}^t \end{split} \label{eq:post} \end{equation} \begin{equation} \begin{split} \mathcal{N}_{s_i,s_j} & = \Phi \times \mathcal{N}_{s_i,s_j}^{t-t_o} + \mathcal{N}_{s_i,s_j}^t \\ & = \left[1-(t-t_o)^\lambda \right] \times \mathcal{N}_{s_i,s_j}^{(t-t_o)} + \mathcal{N}_{s_i,s_j}^t \end{split} \label{eq:neg} \end{equation} Here, $(t-t_o)$ denotes the time interval that is considered to include the past interactions and $\lambda$ is the rate of trust factor. It can be observed from Figure \ref{fig:past-Exp} that change in the rate of trust factor has the influence on the gradual increase or decrease of trust factor. Similarly, when the value to $(t-t_o)$ is closed to zero, it means the model is only considering the latest reputation in terms of interactions of a social object and thus, the trust factor factor is higher. In general, higher trust factor signifies that the model is considering only the recent interactions, and this factor can be tuned by setting up different $t_o$ and $\lambda$. In general, the direct trust is the integration of current and past interactions (see Figure \ref{fig:direct_trust}). \begin{figure}[t] \centering \includegraphics[scale=0.55]{direct_trust.png} \caption{Direct trust computation} \label{fig:direct_trust} \end{figure} \subsection{Reliability and Benevolence} In this section, we discuss two measure, \emph{reliability} and \emph{benevolence} by using the concept introduced in \cite{7837846}. Later, these measures will be used to compute the credibility of an object. \emph{Reliability} refers to the fairness of the object in providing a fair recommendation to the other objects in the network, an object providing a dishonest recommendation to a benign object must be considered less reliable. \emph{Benevolence}, on the other hand, represents the measure of an object on how other objects in the network trust or believe the object providing the recommendations. A benevolent object is believed to the trustworthy and intended to get a high rating from reliable objects. In general, both the reliability and the benevolence score depend on each other and can be computed recursively. The reliability and benevolence of an object $S$ can be quantified as: \begin{equation} \mathcal{B}^t(S) = \frac{1}{|InDeg(S)|} \sum\limits_{i \in InDeg(S)}{} \mathcal{R}^{t-1}(i) \times \mathcal{DTM}^t (i,S) \label{eq:benevolence} \end{equation} \begin{equation} \mathcal{R}^t(S) = 1 - \frac{1}{2|OutDeg(S)|} \sum\limits_{i \in OutDeg(S)}{} |\mathcal{DTM}^t (S,i) - \mathcal{B}^{t}(i)| \label{eq:reliability} \end{equation} Here, $InDeg(S)$ and $OutDeg(S)$ denote the inward and outward edge of an object $S$, $\forall \ edges \in \mathcal{E}$. It can be seen from Eq. (\ref{eq:benevolence}), measuring the benevolence of an object requires the reliability of the objects facilitating the rating as well as the direct trust between objects connected via incoming edges. The final score is the average of all the incoming edges. Similarly, the reliability score (Eq. (\ref{eq:reliability})) is computed using the difference between the benevolence score of the objects and their respective direct trust score, and averaging all such differences to get the final reliability score. Furthermore, the \emph{reliability} and \emph{benevolence} are utilized to compute the credibility score of an object, and is defined as the subjective assessment of the perceived quality of an object being trusted and accepted \cite{wells2021assessing}. Finally, the credibility of an object is quantified as the product of reliability and benevolence (Eq. (\ref{eq:cred})) , i.e., a credible object must be both reliable and benevolent. \begin{equation} \label{eq:cred} \mathcal{CR}^t(\mathcal{S}) = \mathcal{R}^t(\mathcal{S}) \times \mathcal{B}^t(\mathcal{S}) \end{equation} Algorithm \ref{alg:credibility} shows the steps involved for the computation of the credibility. The initial score of reliability and benevolence is set to $0.5$ (line 3). Line 7 to line 9 computes the benevolence of an object using the reliability score from the previous iterations. Likewise, line 10 to line 13 computes the reliability score of an object using the current benevolence score. The computation keeps going on until the convergence (i.e., the difference between both the score in two consecutive iterations is less than the error $\epsilon$) (line 6), and finally, the credibility is computed as the product of reliability and benevolence at line 14. For the demonstration of the credibility algorithm, consider a sample SIoT network (Figure 5) that has five objects. The set of objects $\{A,C,E\}$ are the credible objects and objects $\{B,C\}$ are not the credible objects. As can be seen from the reliability, benevolence, and credibility score in Table \ref{table:cred_score}, it is observed that credible objects need to be both reliable and benevolent. Though object $B$ and object $D$ have a high reliability score, the benevolence score for both these objects is very low which leads to a low credibility score. \begin{algorithm}[t] \caption{$\mathcal{R},\mathcal{B},$ and $\mathcal{CR}$ of a SIoT Object $\mathcal{S}$ ($\forall \ \mathcal{S} \in \mathcal{V}$)} \begin{algorithmic}[1] \STATE \textbf{Input}: SIoT Network as a Directed Graph $\mathcal{G} = (\mathcal{V},\mathcal{E},\mathcal{DTM)}$, $\mathcal{N}(\mathcal{S})$: Neighbours of an object $\mathcal{S}$, $InDeg(\mathcal{S})$ and $OutDeg(\mathcal{S})$ as in-degree and out-degree of an object $\mathcal{S}$ respectively. \STATE \textbf{Output}: $Reliability \ (\mathcal{R})$, $Benevolence \ (\mathcal{B})$ and $Credibility \ (\mathcal{CR})$ \STATE Let $\mathcal{R}^0(\mathcal{S}) = 0.5$ and $\mathcal{B}^0(\mathcal{S}) = 0.5$ \STATE $t=1$ \STATE $k \in \{ N(\mathcal{S}) , \forall \ N(\mathcal{S}) \in \mathcal{V}\}$ \WHILE{$|\mathcal{R}^t(k)-\mathcal{R}^{t-1}(k)| > \epsilon$ $||$ $|\mathcal{B}^t(k)-\mathcal{B}^{t-1}(k)| > \epsilon$} \FOR{$s_{ik} \in InDeg(k)$, $\forall s_{ik} \in \mathcal{V}$} \STATE $\mathcal{B}(s_{ik})^{t} = \frac{1}{|s_{ik}|} \sum_{s_{ik}} \mathcal{R}(k)^{t-1} * \mathcal{DTM}^t (s_{ik},k)$ \ENDFOR \FOR{$s_{ok} \in OutDeg(k)$, $\forall s_{ok} \in \mathcal{V}$} \STATE $\mathcal{R}(k)^{t} = 1-\frac{1}{2|s_{ok}|} \sum_{s_{ok}} \mathcal{DTM}^t (k,s_{ok}) - \mathcal{B}(s_{ok})^{t-1}$ \ENDFOR \ENDWHILE \STATE $\mathcal{CR}^{t} (k) = \mathcal{R}(k)^{t} * \mathcal{B}(k)^{t}$ \STATE \textbf{return} $\mathcal{CR}^{t}(k)$ \end{algorithmic} \label{alg:credibility} \end{algorithm} \begin{table}[ht] \begin{minipage}[b]{0.5\linewidth} \centering \includegraphics[scale=0.6]{credibility.png} \captionof{figure}{Sample SIoT Network} \label{fig:sample_siot} \end{minipage}\hfill \begin{minipage}[b]{0.5\linewidth} \centering \scriptsize \begin{tabular}{ c | c | c | c } \hline $S$ & $\mathcal{R}(S)$ & $\mathcal{B}(S)$ & $Cr(S)$\\ \hline \hline A & 0.96 & 0.82 & 0.79 \\ \hline B & 0.97 & 0.26 & 0.25 \\ \hline C & 0.88 & 0.72 & 0.63 \\ \hline D & 0.96 & 0.37 & 0.35 \\ \hline E & 0.96 & 0.76 & 0.73 \\ \hline \end{tabular} \caption{Credibility of $\mathcal{S}$} \label{table:cred_score} \end{minipage} \end{table} \subsection{Recommendation as a Trust Metric} Recommendation as a trust metric ($\mathcal{RTM}$) is indispensable when the direct information is insufficient to evaluate the trustworthiness of an object. Therefore, a reliable recommendation trust is essential to provide the requisite trust recommendations at any time $t$. In distributed SIoT network, the recommendations of an object is provided by the trustor's neighbours (i.e., local recommendations) having a direct relationship with the trustee or via the global reputation of a trustee. Nevertheless, to mitigate the malicious behaviour of objects providing dishonest recommendations (i.e., good and bad mouthing attack), we have proposed reliability ($\mathcal{R}$) and benevolence ($\mathcal{B}$) based credibility score ($\mathcal{CR}$) computation method (\ref{sec:cred_comp}) to select the top credible objects before relying on the recommendations provided by them. An object (i.e., trustor) $s_i$ compute the credibility of all the $k \in \{k, \forall k \in \mathcal{V}\}$ recommenders providing the recommendation trust for another object (i.e., trustee) $s_j$. The credibility ($\mathcal{CR}^t(S)$) of an object $S$ at any time $t$ is computed as the product of reliability and benevolence of that object (Eq. (\ref{eq:cred})) As a whole, the top $\mathcal{K} = \{\mathcal{K}, \forall \ \mathcal{K} \in \mathcal{V}\}$ credible objects having credibility above the pre-defined threshold $(Th)$ (Eq. (\ref{eq:credible_x})) are selected to provide the recommendation for a trustee. \begin{equation} \mathcal{K} = \begin{cases} \mathcal{K} & \mathrm{if} \ \mathcal{CR}^t (\mathcal{K}) \geq Th \\ \mathcal{K} \in \{\} & otherwise \end{cases} \label{eq:credible_x} \end{equation} Finally, the recommendation trust ($\mathcal{RTM}^t(s_i,s_j)$) can be computed as sum of the product of the direct trust of credible objects for the trustee ($\mathcal{DTM}^t(\mathcal{K},s_j)$) and the direct trust of trustor for the credible objects ($\mathcal{DTM}^t(s_i,\mathcal{K})$), and the final score is the average of all recommendations from $\mathcal{K}$. \begin{equation} \mathcal{RTM}^t (s_i,s_j) = \frac{1}{|\mathcal{K}|} \sum\limits_{i=1}^{|\mathcal{K}|} \mathcal{DTM}^t(s_i,i) \times \mathcal{DTM}^t(i,s_j) \end{equation} Furthermore, if the local recommendation is not present for a trustee at a specific time $t$, then the global recommendation (the overall reputation of a trustee in the SIoT network ($\mathcal{G}$)) is considered to compute the recommendation ($G-\mathcal{RTM}$). The global recommendation is computed in Eq. (\ref{eq:rec_gloabl}). \begin{equation} \mathcal{RTM}^t (s_i,s_j) = \frac{1}{|\mathcal{U}|} \sum\limits_{i=1}^{|\mathcal{U}|} \mathcal{DTM}^t(i,s_j) \label{eq:rec_gloabl} \end{equation} Here $\mathcal{U} = \{\mathcal{U}, \forall \ \mathcal{U} \in \mathcal{V}\}$ denotes the number of objects having at least one transaction with the trustee in the entire network. \subsection{Knowledge Graph Embedding-based Degree of Relationships} Context-aware Degree of Relationship ($\mathcal{C}-\mathcal{D}$o$\mathcal{R}$) is one of fundamental components of SIoT as objects maintain a number of relationships to interact with each other just as human beings do \cite{MS201932}. These relationships are important in modeling the trustworthiness of an object in SIoT network as object tends to trust the objects having similar behaviour and characteristics \cite{ATZORI20123594}. For $\mathcal{C}$-$\mathcal{D}$o$\mathcal{R}$ quantification, the proposed model has considered following relationships from the public SIoT dataset \cite{marche2020exploit}: \begin{itemize} \item[1)] \emph{CLOR}: If two or more objects provide the services at the similar location, then these objects form this type of location-based relationships. \item[2)] \emph{POR}: this type of relationships is correlated with similar objects having same manufacturer and are built within same period of time. \item[3)] \emph{OOR}: OOR represents the relationships between the objects of the same owners (i.e., devices of same owner). \item[4)] \emph{SOR}: When two or more objects come into contact with each other, they form a social relationship similar to that of humans. This type of relationships are based on number of meetings, meeting duration, and interval between two consecutive meetings. In the mentioned dataset, this relationship is created between private mobile devices. \item[3)] \emph{SOR$_2$}: This relationship is the variant of \emph{SOR} and it is created to connect public and private mobile devices. \end{itemize} Given the above five types of relationships, we propose a knowledge graph embedding (KGE) method for estimating social object similarity in terms of $\mathcal{C}$-$\mathcal{D}$o$\mathcal{R}$. The KGE model is currently one of mainstream techniques for knowledge graph representation learning, which aims to represent each entity $e \in E$ (or relation $r \in R$) as a $d$-dimensional continuous vector, denoted as $\mathbf{e}$ (or $\mathbf{r}$). The entity embedding vectors outputted by the KGE model record the structure features of SIoT objects in the multi-relational graph and can be utilized to compute the object similarity. Specifically, given the SIoT objects and their relational data according to the five relationships, we define the SIoT knowledge graph as a multi-relational graph $\mathcal{G}_k= (\mathcal{V},\mathcal{R})$ (Figure. \ref{fig:siot_kge}) that can be represented as a set of triples $T=\{(e_h,r,e_t)\}$, where head entity and tail entity $e_h,e_t \in \mathcal{V}$ are the object nodes and $r \in \mathcal{R}$ is one of the five relations between objects. $n_T$, $n_V$, $n_R$ represent the number of triples, entities and relations in the graph $\mathcal{G}_k$ respectively. \begin{figure}[!t] \centering \includegraphics[width=0.9\linewidth]{kge_graph1.png} \caption{SIoT knowledge graph} \label{fig:siot_kge} \end{figure} Considering the scalability of the proposed model in SIoT, we pay special attention to the training complexity and parameter amount of knowledge graph embeddings. To this end, we review the recent low-dimensional KGE models \cite{GoogleAttH,MulDE,RotL} and select the RotL model\cite{RotL}, a lightweight Euclidean-based KGE model. Unlike previous low-dimensional KGE models requiring complicated calculations in hyperbolic space, this model can process different kinds of relations and obtain high prediction accuracy in low-dimensional Euclidean vector space. The core part of the KGE model is the scoring function, which calculates the triple score based on the embedding vectors of the triple items. A higher score means this triple is more likely to be true. Given a KG triple $(e_h, r, e_t)$, The scoring function of RotL is defined as: \begin{align} f(e_h, r, e_t) = -\varphi(\|Rot(\mathbf{r})\mathbf{e_h} \oplus_\alpha \mathbf{e_t}\|) + b_{e_h} + b_{e_t} \end{align} where $\varphi(x)=xe^x$ is a nonlinear activation function, $Rot(\cdot)$ is a Givens Rotation operation, the addition operation $\oplus_\alpha$ is defined as $\mathbf{x} \oplus_\alpha \mathbf{y} = \alpha(\mathbf{x}+\mathbf{y})/(1+\mathbf{x}\mathbf{y})$, $\alpha$ is a relation-specific trainable parameter and $b_e (e\in E)$ are trainable entity biases. In order to train the embedding parameters in the RotL model, we exploit the negative sampling loss which is the commonly-used training strategy in the KGE field. Given a triple $t = (e_h, r, e_t) \in T$, a random sampling strategy is first used to replace one entity in the triple and generate a set of negative samples $T'_t$: \begin{align} T'_t = \{(e_h, r, e_t') \mid e_t' \in E \land e_t' \neq e_t\} \cup \\ \nonumber \{(e_h', r, e_t) \mid e_h' \in E \land e_h' \neq e_h\} \end{align} After that, the negative sampling loss forces the score of the correct triple higher than those of its negative samples, so as to learn effective vector representations for the KG. Given the training triple set $T_{tr}=\{t\}$, in which each triple $t$ has a set of negative triples $T'_t$, the loss function based on the binary classification cross entropy loss is as follows: \begin{align} \mathcal{L}_{KGE}=-\frac{1}{n_{T_{tr}}} \sum_{t=(e_h,r,e_t)\in T_{tr}} (log(\sigma(f(e_h,r,e_t))) \\ \nonumber + \sum_{(e_h',e_r',e_t')\in T'_t}log(1-\sigma(f(e_h',e_r',e_t')))), \end{align} where $\sigma(\cdot)$ denotes the Sigmoid function. Following the original settings of the RotL model, we utilize minimize the loss by exploiting the Adam optimizer \cite{ADAM}. After training the RotL model using the SIoT KG triples, we can obtain the low-dimensional embedding vector $\mathcal{O}_v(S)$ of each object ($\mathcal{S}$) in the SIoT network. Finally, we estimate the social similarity as the $\mathcal{C}-\mathcal{D}o\mathcal{R}$ vis-\'a-vis objects (Eq. (\ref{eq:cdor})). \begin{equation} \label{eq:cdor} \mathcal{C}-\mathcal{D}o\mathcal{R}(s_i,s_j) = \frac{\mathcal{O}_v(s_i).\mathcal{O}_v(s_j)}{||\mathcal{O}_v(s_i)|| \ ||\mathcal{O}_v(s_i)||} \end{equation} \subsection{Final Trust Score} This section introduces the heuristic to aggregate all the quantified trust metrics to classify the level the trustworthiness of an object. Traditionally, the existing works utilize the weighted average mean of the trust metrics (Eq. (\ref{eq:wei_trust})) to obtain the level of trustworthiness. However, selecting the appropriate weights for each metric is still a challenge as there could be an infinite number of possibilities to select the optimal weight. \begin{equation} \begin{aligned} \mathcal{T} (s_i,s_j) = {} & w_1*\mathcal{DTM} \oplus w_4*\mathcal{R} \oplus w_5*\mathcal{B} \oplus w_2*\mathcal{RTM} \oplus \\ & w_3*\mathcal{C}-\mathcal{D}o\mathcal{R} \end{aligned} \label{eq:wei_trust} \end{equation} where $w_1$-$w_5$ represent the weight for each metric and the sum $w_1+w_2+w_3+w_4+w_5 = 1$ to get the trust score in the range $\{0,1\}$. $\oplus$ denotes the concatenation operation. Furthermore, the final trust is computed as: \begin{equation} \mathbb{T} (s_i,s_j) = \{\mathcal{T} (s_i,s_j), \forall \ s_i,s_j \in \mathcal{V},\mathcal{T} \in [0,1]\} \end{equation} To cope with the issue of selecting a weight, we have introduced an ANN-based heuristic to synthesize the proposed trust metrics by learning the weights for each metric. The high-level overview of how the trust metrics are employed to train the ANN model is depicted in Figure \ref{fig:final_trust}. There are a total of five trust metrics are employed to feed in the input layer, these 5-metrics act as 5 neurons. The neuron in the output layer represents the level of trustworthiness for each object in the SIoT network $\mathcal{G}$. In the proposed framework, we have classified the objects into three levels: trustworthy, neutral, and untrustworthy. \begin{figure}[!t] \centering \includegraphics[scale=0.37]{final_trust.png} \caption{ANN-based trust training model} \label{fig:final_trust} \end{figure} Algorithm \ref{alg:ANN_train} summarizes the steps of training the ANN-based trust model. The training model takes trust metrics ($\mathcal{TM}$), data size ($N$), and cost threshold ($c$) as the input and returns the trained model ($\mathbb{T}$). Lines from 3 to 5 compute the contribution of each trust metric. The learning weights are computed using Adam's optimizer with the default cost threshold and subsequently, the difference between predicted trust and ground truth is used as the new cost value in each iteration from lines from 7 to 10. Finally, when the condition $cost>c$ satisfies, the loop terminates and returns the trained model $\mathbb{T}$. \begin{algorithm}[t] \caption{Training ANN-based Trust Model} \begin{algorithmic}[1] \STATE \textbf{Input}: Trust Metrics ($\mathcal{TM}$) $\{\mathcal{DTM},\mathcal{RTM},\mathcal{C}-\mathcal{D}o\mathcal{R},\mathcal{R},\mathcal{B}\}$, Data Size ($N$), Cost Function Threshold ($c$) \STATE \textbf{Output}: $\mathbb{T}$: Trained Trust Model \FOR{TM $\in \mathcal{TM}$} \STATE Compute the contribution of each TM. \ENDFOR \STATE Let $cost=\infty$ \WHILE{$cost>c$} \STATE Compute the ANN weights for each $TM \in \mathcal{TM}$ for $N$ data samples using Adam's optimizer. \STATE Update the cost value (i.e., $cost$) based on newly learned weights \ENDWHILE \STATE \textbf{return} Trained Model $\mathbb{T}$ \end{algorithmic} \label{alg:ANN_train} \end{algorithm} Conclusively, all the steps of trustworthiness management of the proposed framework are realized in Algorithm \ref{alg:final_trust_algorithm}. The algorithm of trustworthiness computation follows a number of steps, including the direct trust computation, reliability and benevolence, recommendation from credible objects, and the degree of relationships. Finally, the quantified metrics are employed in the ANN-based heuristic to train the trust model and to classify the trustworthy objects. \begin{algorithm}[!tb] \caption{Trust Evaluation} \begin{algorithmic}[1] \STATE \textbf{Input}: $\mathcal{P}_{s_i,s_j}, \mathcal{N}_{s_i,s_j}, \mathcal{R}, \mathcal{B}$ \STATE \textbf{Output}: $\mathcal{DTM}, \mathcal{RTM} \ and \ \mathcal{C}-\mathcal{D}o\mathcal{R} \ \mathcal{T}_{Final}$ \\ \textbf{Direct Trust Computation ($\mathcal{DTM}$)} \STATE Compute Positive Interactions: $\mathcal{P}_{s_i,s_j} = [1-(t-t_0)^{\lambda}] * \mathcal{P}_{i_s,s_j}^{t-t_o} + \mathcal{P}_{s_i,s_j}^t$ \STATE Compute Negative Interactions: $\mathcal{N}_{s_i,s_j} = [1-(t-t_0)^{\lambda}] * \mathcal{N}_{s_i,s_j}^{t-t_o} + \mathcal{N}_{s_i,s_j}^t$ \STATE $\mathcal{DTM}^t (s_i,s_j) = \frac{\mathcal{P}_{s_i,s_j}+1}{\mathcal{P}_{s_i,s_j}+\mathcal{N}_{s_i,s_j}+2}$ \\ \textbf{Reliability ($\mathcal{R}$), Benevolence ($\mathcal{B}$), Credibility ($\mathcal{CR}$)} \STATE Compute $\mathcal{R}$ and $\mathcal{B}$ using Algorithm \ref{alg:credibility} \\ \textbf{Recommendations Computation ($\mathcal{RTM}$)} \STATE Compute the Credibility of Trustors' Neighbours: \STATE $\mathcal{CR}(\mathcal{N}(s_i)) = \mathcal{R}(\mathcal{N}(s_i)) \times \mathcal{B}(\mathcal{N}(s_i)) $ from Algorithm \ref{alg:credibility} \STATE Select top $\mathcal{K}$ credible neighbours for providing $\mathcal{RTM}$ \IF{$\mathcal{K}\notin\{\}$} \STATE $\mathcal{RTM}^t (s_i,s_j) = \frac{1}{|\mathcal{K}|} \sum\limits_{i=1}^{|\mathcal{K}|} \mathcal{DTM}^t(s_i,i) \times \mathcal{DTM}^t(i,s_j)$ // Local Recommendations \ELSE \STATE $\mathcal{RTM}^t (s_i,s_j) = \frac{1}{|\mathcal{U}|} \sum\limits_{i=1}^{|\mathcal{U}|} \mathcal{DTM}^t(i,s_j)$ \\ // Global Recommendations \ENDIF \\ \textbf{Degree of Relationships ($\mathcal{C}-\mathcal{D}o\mathcal{R}$)} \\ \STATE \textbf{Input:} Relationships vis-\'a-vis objects \STATE \textbf{Output:} Embedded vectors representing objects' relationships ($\mathcal{O}_v$) \STATE Similarity Computation as $\mathcal{C}-\mathcal{D}o\mathcal{R}$ \STATE $\mathcal{C}-\mathcal{D}o\mathcal{R}(s_i,s_j) = \frac{\mathcal{O}_v(s_i).\mathcal{O}_v(s_j)}{||\mathcal{O}_v(s_i)|| \ ||\mathcal{O}_v(s_i)||}$ \\ \textbf{Final Trust Classification ($\mathbb{T}$)} \\ \STATE $\mathbb{T} = $\\ $w_1*\mathcal{DTM}+w_2*\mathcal{R}+w_3*\mathcal{B}+w_4*\mathcal{RTM}+w_5*\mathcal{C}-\mathcal{D}o\mathcal{R}$ where $w_1+w_2+w_3+w_4+w_5=1$ \STATE Trust decision making via object classification (i.e., Trustworthy, Neutral and Untrustworthy) using Neural Network \end{algorithmic} \label{alg:final_trust_algorithm} \end{algorithm} \section{Experimental Setup and Results} \label{sec:exp_res} This section presents the extensive experimental evaluation of our proposed framework (\emph{Trust--SIoT}). We have implemented the algorithms using Python 3.6 on a MAC environment with an 8-core CPU and 16GB RAM. To further validate, we have compared the \emph{Trust--SIoT} framework with a well-known trust model named \emph{Guardian}\cite{9155370} from existing state-of-the-art. \emph{Guardian} combines two trust features to classify the trustworthy objects: \emph{popularity}, refers to the trustworthiness of an object observed by other objects, and \emph{engagement}, refers to the trustworthiness of others observed by objects' perceptive. \subsection{Experimental Settings} \textbf{Datasets Description:} We conduct our experiments on two real-world datasets: \emph{Advogato}\footnote{http://www.trustlet.org/datasets/advogato/} and \emph{Bitcoin-Alpha\footnote{https://btc-alpha.com/en/} (BTC-Alpha)}. Advogato is an online social network of open source developers and it allows users to certify each other with different levels of trustworthiness. In particular, the different categories of trustworthiness are $\{Observer, Apprentices, Journeyer, Master\}$ with each having a numerical value of $\{0.1,0.5,0.7,1.0\}$. The BTC-Alpha dataset adopts the concept of Web-of-trust to provide safety and security by allowing users to rate each other they trust or distrust to maintain the record of the user's reputation. The site focuses on having an open market wherein users can make transactions with each other by using bitcoins, and respectively rate each other. The rating (or trust) in this dataset varies in the range of $\{0,1\}$. The statistical description of these datasets is presented in Table \ref{table:data_des}. \begin{table}[h] \centering \caption{Statistical Description of Datasets} \begin{tabular}{| c | c | c | c |} \hline $Datasets$ & $\# \ of \ Objects$ & $\# \ of \ Edges$ & $Avg. \ Degree$\\ \hline \emph{Advogato} & $6,541$ & $51,127$ & $19.2$ \\ \hline \emph{BTC-Alpha} & $3,775$ & $22,650$ & $12.79$ \\ \hline \end{tabular} \label{table:data_des} \end{table} \textbf{Data Preparation:} As the selected datasets do not contain the SIoT relationships information among the objects which is the fundamental component for any SIoT network, we have extracted the SIoT relationships information from \emph{social-dataset}\footnote{https://www.social-iot.org/}. The social-dataset contains the information of the real IoT objects deployed in Santandar city of Spain, and there are a total of $16,216$ IoT objects. Furthermore, this dataset includes the five different types of SIoT relationships (i.e., CLOR, POR, OOR, SOR, and SOR$_2$) between the IoT objects that connect them to form a SIoT network, and information about the service requested by these objects. We have selected the relationships information of a sub-network of this dataset to integrate it with the \emph{Advogato} and \emph{BTC-Alpha} by selecting the objects to enhance the probability of objects interacting with each other. The merging takes place in three steps: 1) conversion of SIoT dataset into SIoT graph, 2) selecting the sub-network of data to match the number of nodes for each of \emph{Advogato} and \emph{BTC-Alpha} datasets, and 3) merging the sub-network of SIoT data with both \emph{Advogato} and \emph{BTC-Alpha} dataset. Finally, we have mapped the labels of merged datasets into three classes $\{Trustworthy, Neutral, Untrustworthy\}$. For all the datasets, we have randomly chosen $80\%$ (i.e., training set) of the data for training, and the remaining $20\%$ of the data is used for testing (i.e., testing set). We further split the training set into 5 subsets for 5-fold cross-validation. Each time the training and validation phase chooses one of the 5 subsets for validation and the remaining for training and this step is repeated five times to pick the best average performance values. Furthermore, the testing set is used to evaluate the performance of the model on test data. We have implemented our framework by using grid search and 5-fold cross-validation, and with default hyperparameters (i.e., a single hidden layer, rectified linear unit function (relu) as the activation function, penalty (regularization term) of $0.0001$, and `adam' solver) to train our neural network. \textbf{Evaluation Metrics:} We employ three standard evaluation metrics (i.e., F1-score ($F1$), Mean Absolute Error ($MAE$), and Mean Squared Error ($MSE$)) to evaluate the prediction accuracy of our model in comparison with the existing state-of-the-art. In particular, we have used micro-averaged F1 score due to label imbalance in both the datasets. Note that higher value of $F1$ and lower values of $MAE$ and $MSE$ indicate better performance. \begin{itemize} \item \textbf{Mean Absolute Error:} \begin{equation} MAE = \frac{1}{N_{test}} \sum_{s_i,s_j} | \mathbb{T}_{s_i,s_j} - \hat{\mathbb{T}}_{s_i,s_j}| \end{equation} \item \textbf{Mean Squared Error:} \begin{equation} MSE = \frac{1}{N_{test}} \sum_{s_i,s_j} | \mathbb{T}_{s_i,s_j} - \hat{\mathbb{T}}_{s_i,s_j}|^2 \end{equation} \item \textbf{F1-Score:} \begin{equation} F1 = 2 \times \frac{Precision \times Recall}{Precision + Recall} \end{equation} \end{itemize} where $\mathbb{T}_{s_i,s_j}$ is the original trust score given by an object $s_i$ to another $s_j$ and $\hat{\mathbb{T}}_{s_i,s_j}$ is the predicted trust score of $s_i$ towards $s_j$. $N_{test}$ is the number of interactions in test data. \subsection{Results and Discussion} Firstly, we have analyzed the \emph{effectiveness} of \emph{Trust--SIoT} on both the datasets. Table \ref{table:pred_acc_adv} and Table \ref{table:pred_acc_btc} portray the effectiveness of the both the approaches on \emph{Advogato} and \emph{BTC-Alpha} respectively. It is evident from Table \ref{table:pred_acc_adv} that \emph{Trust--SIoT} outperforms the \emph{Guardian} in terms of F1-score with with an improvement of $3.6\%$. Furthermore, \emph{Trust--SIoT} achieves the higher prediction accuracy in terms of MAE and MSE score of $0.174$ and $0.240$ in comparison to MAE and MSE score of $0.214$ and $0.3008$ for \emph{Guardian}. In general, \emph{Trust--SIoT} achieves higher F1-Score and $18.7\%$ and $20.2\%$ decrease in the MAE and MSE score in comparison to \emph{Guardian}. Similarly, we have evaluated the performance of our approach on another dataset (i.e., \emph{BTC-Alpha}) to verify that our approach does not rely on datasets. As can be seen from Table \ref{table:pred_acc_btc}, \emph{Trust--SIoT} performance slightly better than \emph{Guardian} by increasing the F1-score $0.5\%$ with a decrease in $1.9\%$ of MAE score and almost similar MSE score. In general, \emph{Trust--SIoT} is highly effective on both the datasets, and it successfully clarify that the trust metrics along with the SIoT relationships similarity obtained from KGE model are able to classify the trustworthy SIoT objects more efficiently. \begin{table}[h] \centering \caption{Prediction accuracy - \emph{Advogato}} \begin{tabular}{| c | c | c | c |} \hline $Model$ & $F1-Score$ & $MAE$ & $MSE$\\ \hline \hline \emph{Trust--SIoT} & 0.859 & 0.174 & 0.240 \\ \hline \emph{Guardian} & 0.829 & 0.214 & 0.3008 \\ \hline \hline Improvement & \textbf{3.6\%} & \textbf{18.7\%} & \textbf{20.2\%} \\ \hline \hline \end{tabular} \label{table:pred_acc_adv} \end{table} \begin{table}[h] \centering \caption{Prediction accuracy - \emph{BTC Alpha}} \begin{tabular}{| c | c | c | c |} \hline $Model$ & $F1-Score$ & $MAE$ & $MSE$\\ \hline \hline \emph{Trust--SIoT} & 0.785 & 0.211 & 0.220 \\ \hline \emph{Guardian} & 0.781 & 0.215 & 0.219 \\ \hline \hline Improvement & \textbf{0.5\%} & \textbf{1.9\%} & -0.4\% \\ \hline \hline \end{tabular} \label{table:pred_acc_btc} \end{table} Furthermore, the \emph{robustness} of the proposed approach is evaluated by varying the proportion of training set into $80\%$, $60\%$, and $40\%$ respectively. The reported results for \emph{Advogato} is shown in Table \ref{table:rob_acc_adv} and in Figure \ref{fig:rob_acc_adv}. It can be seen that the \emph{Trust--SIoT} has a negligible performance decrease of $1.1\%$, $3.3\%$, $4\%$ in terms of F1-Score, MAE, and MSE respectively when the training set size is reduced to $40\%$. For \emph{Guardian}, the performance evaluation decreases by $1.3\%$, $6.7\%$, $6.2\%$ with regards to F1-score, MAE, and MSE respectively. Likewise, there is slight decrease in the performance of both \emph{Trust--SIoT} and \emph{Guardian} for \emph{BTC-Alpha} as shown in Table \ref{table:rob_acc_btc} and in Figure \ref{fig:rob_acc_btc}, and there is a similar performance of both the approaches in terms of all the evaluation metrics. In essence, the results suggest that the \emph{Trust--SIoT} framework effectively learns the trust relationships between the objects even with the low percentage of the training set, and is able to perform better in comparison with the other approach. \begin{table}[h] \centering \caption{Robustness with varying training set - \emph{Advogato}} \begin{tabular}{|c|c|c|c|c|} \hline $Model$ & $Training \ set $ & $F1-Score$ & $MAE$ & $MSE$\\ \hline \hline & 80\% & 0.860 & 0.174 & 0.240 \\ \emph{Trust--SIoT} & 60\% & 0.857 & 0.175 & 0.248 \\ & 40\% & 0.850 & 0.180 & 0.250 \\ \hline & 80\%& 0.838 & 0.209 & 0.290 \\ \emph{Guardian} & 60\%& 0.830 & 0.212 & 0.290 \\ & 40\%& 0.827 & 0.223 & 0.302 \\ \hline \end{tabular} \label{table:rob_acc_adv} \end{table} \begin{table}[h] \centering \caption{Robustness with varying training set - \emph{BTC Alpha}} \begin{tabular}{|c|c|c|c|c|} \hline $Model$ & $Training \ set$ & $F1-Score$ & $MAE$ & $MSE$\\ \hline \hline & 80\% & 0.785 & 0.211 & 0.220 \\ \emph{Trust--SIoT} & 60\% & 0.775 & 0.220 & 0.220 \\ & 40\% & 0.770 & 0.221 & 0.23 \\ \hline & 80\% & 0.781 & 0.215 & 0.219 \\ \emph{Guardian} & 60\% & 0.770 & 0.224 & 0.226 \\ & 40\% & 0.768 & 0.230 & 0.229 \\ \hline \end{tabular} \label{table:rob_acc_btc} \end{table} We have also evaluated the performance of the proposed framework with the varying number of pairwise interactions to observe the scalability of the \emph{Trust--SIoT}. The scalability of both the approaches for \emph{Advogato} dataset can be seen in Figure \ref{fig:scale_adv}a, \ref{fig:scale_adv}b, and \ref{fig:scale_adv}c in terms of F1-score, MAE and MSE respectively. It is evident from the results that the F1-score of \emph{Trust--SIoT} remains stable with the increase in the pairwise interactions and always remains higher than the \emph{Guardian}. Moreover, the MAE and MSE scores of \emph{Trust--SIoT} remain low over the varying interactions in comparison to \emph{Guardian}. \begin{figure}[!tb] \centering \begin{subfigure}[b]{0.25\textwidth} \centering \includegraphics[width=4.5cm,height=3.5cm]{adv_f1_mae.png} \caption{Advogato} \label{fig:rob_acc_adv} \end{subfigure}% \begin{subfigure}[b]{0.25\textwidth} \centering \includegraphics[width=4.5cm,height=3.5cm]{btc_f1_mae.png} \caption{BTC-Alpha} \label{fig:rob_acc_btc} \end{subfigure} \caption{Robustness of \emph{Trust--SIoT} and \emph{Guardian} for Advogato and BTC-Alpha} \end{figure} Similarly, Figure \ref{fig:scale_btc}a, \ref{fig:scale_btc}b, and \ref{fig:scale_btc}c present the F1-score, MAE and MSE with varying interactions for \emph{BTC-Alpha} dataset. As shown in Figure \ref{fig:scale_btc}a the F1-score decreases with the increase in number of interaction, however, it is slightly better than \emph{Guardian}. Furthermore, the MAE and MSE scores of both the approaches increase with growth in number of interactions. Nevertheless, these scores remain low for \emph{Trust--SIoT} in comparison to \emph{Guardian} with the increase in number of interactions. In general, it is noteworthy that \emph{Trust--SIoT} performs better on both the datasets and is scalable to generalize for large scale SIoT networks. \begin{figure*}[!t] \centering \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{adv_f1_int.png} \caption{} \label{fig:f1_adv} \end{subfigure} \hspace{0.35em} \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{adv_mae_int.png} \caption{} \label{fig:mae_adv} \end{subfigure} \hspace{0.35em} \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{adv_mse_int.png} \caption{} \label{fig:mse_adv} \end{subfigure} \caption{F1-score, MAE, and MSE with varying pairwise interactions - Advogato} \label{fig:scale_adv} \end{figure*} \begin{figure*}[t] \centering \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{btc_f1_int.png} \caption{} \label{fig:f1_btc} \end{subfigure} \hspace{0.35em} \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{btc_mae_int.png} \caption{} \label{fig:mae_btc} \end{subfigure} \hspace{0.35em} \begin{subfigure}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth]{btc_mse_int.png} \caption{} \label{fig:mse_btc} \end{subfigure} \caption{F1-score, MAE, and MSE with varying pairwise interactions - BTC-Alpha} \label{fig:scale_btc} \end{figure*} Finally, we have also analyzed the change in the reliability, benevolence, and credibility of trustworthy, neutral, and untrustworthy objects for both \emph{Advogato} and \emph{BTC-Alpha}. As depicted in Figure \ref{fig:rbc_adv} that for an object to be trustworthy, it needs to be credible and hence object must be reliable and benevolent as the credibility is the integration of both the metrics. Furthermore, it can be observed that the credibility of untrustworthy objects is lower than that of neutral and trustworthy objects. Likewise, Figure \ref{fig:rbc_btc} manifests the reliability, benevolence and credibility objects for \emph{BTC-Alpha} datasets. Similar to the results observed in \emph{Advogato}, all three metrics have a high score for trustworthy objects, and these scores are lower for neutral and untrustworthy objects. Thus, it is evident that both the reliability and benevolence trust metrics are essential to comment on the credibility of objects in the SIoT network, and the proposed metrics are not dataset dependant and can be generalized for other large scale SIoT and also for online social networks. \begin{figure}[t] \centering \begin{subfigure}[b]{0.25\textwidth} \centering \includegraphics[width=4.5cm,height=3.5cm]{adv_rel_ben.png} \caption{Advogato} \label{fig:rbc_adv} \end{subfigure}% \begin{subfigure}[b]{0.25\textwidth} \centering \includegraphics[width=4.5cm,height=3.5cm]{btc_rel_ben.png} \caption{BTC-Alpha} \label{fig:rbc_btc} \end{subfigure} \caption{Dependency analysis of $\mathcal{R}$, $\mathcal{B}$, and $\mathcal{CR}$ for Advogato and BTC-Alpha} \end{figure} \section{Conclusion and Future Work} \label{sec:conc} In this paper, we have envisaged an artificial neural network-based trust framework, \emph{Trust--SIoT}, wherein the convergence of dynamic social trust metrics, i.e., direct trust by integrating both current and past interactions, reliability and benevolence, credible recommendations, and the degree of relationships, has enhanced the trustworthiness evaluation of the SIoT objects. The recommendations are ascertained from the credible neighbouring objects and the SIoT knowledge graph is constructed so as to learn the embedding vectors for quantifying the degree of relationships. The experimental analysis suggests that \emph{Trust--SIoT} outperforms the state-of-the-art heuristics, particularly, in terms of the F1, MAE, and MSE measurement. In the near future, we intend to investigate this framework vis-\'a-vis the trust-related attacks in a bid to strengthen its resilience in dynamic SIoT environments. \section*{Acknowledgement} The corresponding author, Subhash Sagar, sincerely acknowledges the generous support of the Higher Education Commission of Pakistan and Macquarie University, Australia for funding the research-at-hand via its ``Macquarie University Research Excellence Award (Allocation No. 2019050)’'. Quan Z. Sheng's work has been partially supported by Australian Research Council Future Fellowship under Grant FT140101247 and Discovery Project under Grant DP200102298. \bibliographystyle{IEEEtran} \balance
\section{Introduction} Fu~et~al.~(2021)~\cite{fu2021hyperfine} had recently published magnetic hyperfine interaction ($A$) constants for 61 energy levels of Co~II by analysing hyperfine structure (HFS) of spectral lines measured by Fourier transform spectroscopy. This paper was published in May 2021 apparently without the authors and reviewers being aware of the prior existing literature at the time, specifically, the substantial work of Ding \& Pickering~(2020)~\cite{ding2020measurements} published in December 2020, which reported $A$ constants for 292 Co~II energy levels. These include values for all Co~II $A$ constants published by Fu~et~al.~\cite{fu2021hyperfine}, which were incorrectly claimed to have been measured for the first time, except for the energy level 3d$^6$4s$^2$~a$^5$D$_4$. Out of the 60 $A$ constants reported by both publications, 43 were in agreement within uncertainties. In this comment, discrepancies of the other 17 $A$ constants are discussed from the point of view of the authors of Ding \& Pickering~\cite{ding2020measurements}. The single new $A$ constant published by Fu~et~al.~\cite{fu2021hyperfine} for 3d$^6$4s$^2$~a$^5$D$_4$ is found to agree with corresponding line profiles from the visible spectra analysed by Ding \& Pickering~\cite{ding2020measurements}, using the $A$ constants of connecting levels published by both papers. \section{Cobalt Fourier transform spectra} Fu~et~al.~\cite{fu2021hyperfine} reported using 9 cobalt spectra from the National Solar Observatory (Kitt Peak, USA) historical archive (http://diglib.nso.edu/). However, these could not be found in the archive using the dates and serial numbers stated on table 1 of Fu~et~al.~\cite{fu2021hyperfine}. The spectrum transformation dates were likely listed instead of the dates at which the spectra were recorded. This is evident from the spectrum with index 7 on table~1 of Fu~et~al.~\cite{fu2021hyperfine} - it was dated 1994, but its transformation date, serial number and parameters match exactly with a spectrum listed on table 2 of Lawler~et~al.~(2018)~\cite{lawler2018transition}, which was in fact measured in 1983 and also used by Lawler~et~al.~\cite{lawler2018transition} for Co~II HFS analysis. The parameters of spectra listed on table~1 of Fu~et~al.~\cite{fu2021hyperfine} indicate no spectrum in common between the set of spectra used by Fu~et~al.~\cite{fu2021hyperfine} and the set of spectra used by Ding \& Pickering~\cite{ding2020measurements} for HFS analysis. Moreover, the UV spectra analysed by Fu~et~al.~\cite{fu2021hyperfine} were expected to have higher noise compared to those analysed by Ding \& Pickering~\cite{ding2020measurements}, due to their much wider spectral ranges and fewer interferogram co-adds. \section{Discrepancies and dependencies} All 17 energy levels with $A$ constants in disagreement between Fu~et~al.~\cite{fu2021hyperfine} and Ding \& Pickering~\cite{ding2020measurements} are listed on table \ref{tab 1: levels}. The first three columns specify level configuration, term label and $J$ value. The fourth column lists level energies from Ding \& Pickering~\cite{ding2020measurements}. The fifth column indicates the number of lines used by Ding \& Pickering~\cite{ding2020measurements} to estimate the values and uncertainties of $A$ constants in their publication. The sixth and seventh columns are $A$ constant mean values and uncertainties $\Delta A$ determined by Ding \& Pickering~\cite{ding2020measurements}, values in the eighth and ninth columns are those determined by Fu~et~al.~\cite{fu2021hyperfine}, which were converted from MHz to mK (1~mK~$=$~0.001~cm$^{-1}$=29.979~MHz). The final column lists the difference in $A$ constants, all of which were above discrepancies allowed by uncertainties. \begin{table* \renewcommand{\arraystretch}{1.1} \centering \caption{Table of 17 Co~II energy levels and their inconsistent $A$ constants between results from Ding \& Pickering~\cite{ding2020measurements} and Fu~et~al.~\cite{fu2021hyperfine}, 1~mK = 0.001~cm$^{-1}$.} \label{tab 1: levels} \begin{threeparttable} \begin{tabular}{lllrrrrrrr} \hline Config. & Term & $J$ & Energy\textsuperscript{a} & $N$ & $A$\textsuperscript{a} & $\Delta A$\textsuperscript{a} & $A$\textsuperscript{b} & $\Delta A$\textsuperscript{b} & Diff. \\ & & & (cm$^{-1}$) & & (mK) & (mK) & (mK) & (mK) & (mK) \\ \hline 3d$^8$ & a$^3$P & 1 & 13404.321 & 2 & -3.0 & 5.0 & -11.9 & 1.6 & 8.9 \\ 3d$^7$($^2$G)4s & a$^3$G & 5 & 21624.528 & 13 & 40.8 & 0.7 & 4.4 & 0.9 & 36.4 \\ 3d$^7$($^2$G)4s & a$^3$G & 4 & 22009.344 & 17 & 22.7 & 0.4 & 30.8 & 5.9 & -8.1 \\ 3d$^7$($^2$P)4s & c$^3$P & 2 & 24886.400 & 14 & 51.8 & 1.0 & 11.2 & 3.5 & 40.6 \\ 3d$^7$($^2$P)4s & a$^1$P & 1 & 27585.138 & 4 & 26.4 & 0.9 & 15.0 & 8.7 & 11.4 \\ 3d$^7$($^2$H)4s & a$^3$H & 4 & 27902.161 & 4 & 9.5 & 1.9 & -10.3 & 1.1 & 19.8 \\ 3d$^7$($^2$H)4s & a$^1$H & 5 & 30567.173 & 10 & 29.9 & 1.3 & -7.6 & 0.9 & 37.5 \\ 3d$^7$($^4$F)4p & z$^3$D & 1 & 52684.634 & 6 & 46.7 & 1.2 & 40.0 & 1.1 & 6.7 \\ 3d$^7$($^4$P)4p & y$^5$D & 3 & 61240.746 & 4 & 8.4 & 1.6 & 5.6 & 0.9 & 2.8 \\ 3d$^7$($^2$G)4p & z$^3$H & 5 & 63306.686 & 7 & 22.1 & 0.7 & 24.5 & 0.9 & -2.4 \\ 3d$^7$($^4$P)4p & y$^3$D & 3 & 63586.987 & 8 & 5.6 & 1.0 & -23.4 & 3.5 & 29.0 \\ 3d$^7$($^2$G)4p & z$^3$H & 6 & 63597.396 & 1 & 16.0 & 2.0 & -14.4 & 0.9 & 30.4 \\ 3d$^7$($^2$G)4p & z$^1$G & 4 & 64401.359 & 8 & 22.2 & 1.1 & -23.6 & 0.9 & 45.8 \\ 3d$^7$($^2$P)4p & z$^3$P & 1 & 65028.512 & 5 & 5.1 & 0.7 & -39.8 & 3.5 & 44.9 \\ 3d$^7$($^2$P)4p & x$^3$D & 3 & 67524.021 & 3 & 10.5 & 1.5 & -19.4 & 3.5 & 29.9 \\ 3d$^7$(a$^2$D)4p & w$^3$D & 1 & 69317.077 & 1 & 22.2 & 0.7 & -8.3 & 10.0 & 30.5 \\ 3d$^7$($^2$H)4p & z$^1$I & 6 & 69617.495 & 1 & 24.0 & 2.0 & -6.7 & 3.4 & 30.7 \\ \hline \end{tabular} \begin{tablenotes} \item[a]{Ding \& Pickering~\cite{ding2020measurements}} \item[b]{Fu~et~al.~\cite{fu2021hyperfine}} \item Columns show - level configuration, term label, $J$ value, level energy from Ding \& Pickering~\cite{ding2020measurements}, the number of lines ($N$) used by Ding \& Pickering~\cite{ding2020measurements} to estimate $A$ constant mean values and uncertainties, $A$ constants and uncertainties by Ding \& Pickering~\cite{ding2020measurements} and Fu~et~al.~\cite{fu2021hyperfine}, and the difference between $A$ constants from the two publications. \end{tablenotes} \end{threeparttable} \end{table*} Figure \ref{fig1} arranges the 17 levels, labelled using term and J value, into tree diagrams showing $A$ constant dependencies during the HFS analysis by Fu~et~al.~\cite{fu2021hyperfine} according to the combining levels listed on table 3 of Fu~et~al.~\cite{fu2021hyperfine}. \begin{figure} \centering \includegraphics[width=8cm]{fig1.pdf} \caption{Tree diagrams of 17 Co~II energy levels illustrating dependencies of their $A$ constants in the analysis by Fu~et~al.~\cite{fu2021hyperfine}, as indicated by table 3 of their paper. The arrows indicate which $A$ constant would have affected the determination of another, e.g., the $A$ constant of the first energy level of each tree affected hyperfine structure analysis for all other levels on the tree.} \label{fig1} \end{figure} \section{Experimentally unclassified transitions analysed} All $A$ constants of energy levels on the largest tree of figure \ref{fig1} were affected by the HFS analysis by Fu~et~al.~\cite{fu2021hyperfine} for the energy level 3d$^7$($^2$G)4s~a$^3$G$_5$ at 21624.528~cm$^{-1}$. In table 3 of Fu~et~al.~\cite{fu2021hyperfine}, the transition used to determine the $A$ constant of this level was at Ritz wavenumber 25453.966~cm$^{-1}$, combining with the energy level 3d$^7$($^4$F)4p~z$^5$G$_6$ at 47078.494~cm$^{-1}$. This transition has yet to be classified experimentally (see the spectrum and term analysis of Co~II by Pickering~et~al.~\cite{pickering1998spectrum} and the observed Co~II atomic transitions from the National Institute of Standards and Techonology Atomic Spectra Database~\cite{kramida2021}). The transition has been predicted by R.~L.~Kurucz (1988)~\cite{kurucz1988} with a very weak transition probability with a log~gf of $-3.6$ (available on the Vienna Atomic Line Database \cite{ryabchikova2015major}). In the spectra analysed by Ding \& Pickering~\cite{ding2020measurements}, only noise was visible at this wavenumber. Similarly for the second largest tree of figure \ref{fig1}, the $A$ constant of 3d$^7$($^2$P)4s~c$^3$P$_2$ at 24886.400~cm$^{-1}$ was analysed by Fu~et~al.~\cite{fu2021hyperfine} using 3d$^7$($^4$F)4p~z$^3$G$_3$ at 50036.348~cm$^{-1}$ as the combining level with the transition at Ritz wavenumber 25149.948~cm$^{-1}$. This transition is again not seen with an experimentally classified line and has a very weak predicted log~gf of $-3.9$ \cite{kurucz1988}, its signal-to-noise ratio of 2 in the spectra used by Ding \& Pickering~\cite{ding2020measurements} was too low for HFS analysis. Within the 9 spectra analysed by Fu~et~al.~\cite{fu2021hyperfine}, the two transitions at 25453.966~cm$^{-1}$ and at 25149.948~cm$^{-1}$ were likely too noisy for meaningful hyperfine structure analysis. This would have caused cascades in error for 10 other $A$ constants on the trees of 3d$^7$($^2$G)4s~a$^3$G$_5$ and 3d$^7$($^2$P)4s~c$^3$P$_2$. \section{Lack of validation of $A$ constants using transitions involving other levels} Checking consistency between the $A$ constants published by Fu~et~al.~\cite{fu2021hyperfine} further supported the conclusion that their determined $A$ constants were erroneous for the levels 3d$^7$($^2$G)4s~a$^3$G$_5$ and 3d$^7$($^2$P)4s~c$^3$P$_2$. In HFS analysis using Fourier transform spectroscopy, least-squares fitting of observed line profiles of one transition often cannot fully constrain $A$ constant values, i.e. ambiguities or a range of $A$ values can fit the spectral line, causing large uncertainties (see Ding \& Pickering~\cite{ding2020measurements} and Lawler~et~al.~\cite{lawler2018transition} for example). In general, the best practice is to analyse multiple transitions involving as many energy levels as possible for constraint and validation when estimating the $A$ constant of a single level. Fu~et~al.~\cite{fu2021hyperfine} had published $A$ constants for both levels 3d$^7$($^2$G)4p~y$^3$F$_4$ and 3d$^7$($^2$G)4s~a$^3$G$_5$. However, these two $A$ constants do not reproduce the line profile of the transition between their corresponding levels. The transition between these two levels was observed and analysed in the UV spectra used by Ding \& Pickering~\cite{ding2020measurements}, see figure \ref{fig2}. With a high signal-to-noise ratio of 950, this transition is expected to be observed in the archival spectra analysed by Fu~et~al.~\cite{fu2021hyperfine}. In figure \ref{fig2b}, only half of the total line width was characterised by the $A$ constants from Fu~et~al.~\cite{fu2021hyperfine}, the highest relative intensity component was also on the wrong side. It is assumed that Fu~et~al.~\cite{fu2021hyperfine} did not consider this transition at 41885.65~cm$^{-1}$ during their HFS analysis, as it was not listed by table 3 nor shown in figure 1 of their paper. This fit for validation would have avoided discrepancies in 7 other $A$ constants which were dependent on the HFS analysis of 3d$^7$($^2$G)4s~a$^3$G$_5$, as indicated on its tree in figure \ref{fig1}. \begin{figure* \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig2a.pdf} \caption{Spectral line fit using $A$ constants of Ding \& Pickering~\cite{ding2020measurements}.} \label{fig2a} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig2b.pdf} \caption{Spectral line fit using $A$ constants of Fu~et~al.~\cite{fu2021hyperfine}.} \label{fig2b} \end{subfigure} \caption{Hyperfine structure analysis of the transition between 3d$^7$($^2$G)4p~y$^3$F$_4$ and 3d$^7$($^2$G)4s~a$^3$G$_5$ of Co~II at 41885.65~cm$^{-1}$ using $A$ constants of Ding \& Pickering~\cite{ding2020measurements} (a) and Fu~et~al.~\cite{fu2021hyperfine} (b). Top - diagrams illustrating hyperfine transitions between the two levels using estimated $A$ constants (1~mK = 0.001~cm$^{-1}$), level splittings not to scale. Bottom - observation (black) and fits (red dashed) of the line in a UV spectrum analysed by Ding \& Pickering~\cite{ding2020measurements} with a signal-to-noise ratio of 950, the red vertical lines show relative intensities and wavenumbers of component transitions indicated above on the transition diagrams.} \label{fig2} \end{figure*} Likewise, the discrepancies in 3d$^7$($^2$P)4s~c$^3$P$_2$ and 3 other energy levels of the second largest tree in figure \ref{fig1} could have been avoided if the transition between energy levels 3d$^7$($^4$P)4p~y$^3$D$_2$ and 3d$^7$($^2$P)4s~c$^3$P$_2$ at 38729.59~cm$^{-1}$ was validated. In the spectra analysed by Ding \& Pickering~\cite{ding2020measurements}, this transition could not be fitted using the two corresponding $A$ constants published by Fu~et~al.~\cite{fu2021hyperfine}, see figure \ref{fig3}. \begin{figure* \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig3a.pdf} \caption{Spectral line fit using $A$ constants of Ding \& Pickering~\cite{ding2020measurements}.} \label{fig3a} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig3b.pdf} \caption{Spectral line fit using $A$ constants of Fu~et~al.~\cite{fu2021hyperfine}.} \label{fig3b} \end{subfigure} \caption{Hyperfine structure analysis of the transition between 3d$^7$($^4$P)4p~y$^3$D$_2$ and 3d$^7$($^2$P)4s~c$^3$P$_2$ of Co~II at 38729.59~cm$^{-1}$ using $A$ constants of Ding \& Pickering~\cite{ding2020measurements} (a) and Fu~et~al.~\cite{fu2021hyperfine} (b). Top - diagrams illustrating hyperfine transitions between the two levels using estimated $A$ constants (1~mK = 0.001~cm$^{-1}$), level splittings not to scale. Bottom - observation (black) and fits (red dashed) of the line in a UV spectrum analysed by Ding \& Pickering~\cite{ding2020measurements} with a signal-to-noise ratio of 40, the red vertical lines show relative intensities and wavenumbers of component transitions indicated above on the transition diagrams.} \label{fig3} \end{figure*} \section{Remaining discrepancies} Discrepancies in 5 other $A$ constants reported by Fu~et~al.~\cite{fu2021hyperfine} were from their HFS analysis of energy levels 3d$^7$($^4$P)4p~y$^5$D$_3$, 3d$^7$($^2$P)4s~a$^1$P$_1$, and 3d$^7$($^4$F)4p~z$^3$D$_1$, as shown in figure \ref{fig1}. The disagreements in the $A$ constants of these 3 levels are much smaller, as they were determined by Fu~et~al.~\cite{fu2021hyperfine} using observed and classified transitions. Though not discussed in detail, further investigation suggested the discrepancies to have arisen from the poorer quality of spectra analysed by Fu~et~al.~\cite{fu2021hyperfine} compared to those analysed by Ding \& Pickering~\cite{ding2020measurements}; results from Fu~et~al.~\cite{fu2021hyperfine} were likely affected by factors such as lower signal-to-noise ratios, broader Doppler line widths, poorer resolutions and possibly higher amounts of self-absorption. \section{Conclusion} Fourier transform spectroscopy offers sufficient spectral resolution for accurate atomic HFS measurements, but much care is needed during line profile fitting and analysis. For Co~II, magnetic hyperfine interaction $A$ constants for 292 energy levels were previously known, of which 264 were measured for the first time by Ding \& Pickering~\cite{ding2020measurements} using Fourier transform spectroscopy. A recent analysis of Co~II Fourier transform spectra by Fu~et~al.~\cite{fu2021hyperfine} published 61 $A$ constants without crucial awareness of this existing literature at the time, 17 of which were found to be inconsistent with results from Ding \& Pickering~\cite{ding2020measurements}. One new $A$ constant of Co~II was determined by Fu~et~al.~\cite{fu2021hyperfine} for the energy level 3d$^6$4s$^2$~a$^5$D$_4$, its value of $12.0\pm1.8$~mK was found to agree with line profiles observed by Ding \& Pickering~\cite{ding2020measurements}. Most discrepancies are suspected to be from the HFS analysis by Fu~et~al.~\cite{fu2021hyperfine} of the experimentally unclassified transitions with Ritz wavenumbers 25453.966~cm$^{-1}$ and 25149.948~cm$^{-1}$ for the $A$ constants of the two energy levels 3d$^7$($^2$G)4s~a$^3$G$_5$ and 3d$^7$($^2$P)4s~c$^3$P$_2$ respectively. This likely caused a cascade of errors in the HFS analysis that was dependent on the $A$ constants of these two levels, as the two $A$ constants were shown to be unable to reproduce observed line profiles at 41885.65~cm$^{-1}$ and 38729.59~cm$^{-1}$. Note that Ding \& Pickering~\cite{ding2020measurements} used 13 and 14 lines to find the $A$ constants for 3d$^7$($^2$G)4s~a$^3$G$_5$ and 3d$^7$($^2$P)4s~c$^3$P$_2$ respectively. Although the spectra analysed by Fu~et~al.~\cite{fu2021hyperfine} were likely poorer in quality compared to those analysed by Ding \& Pickering~\cite{ding2020measurements}, all discrepancies would have been minimal, if Fu~et~al.~\cite{fu2021hyperfine} had analysed more transitions involving other energy levels for the 17 discrepant $A$ constants. \section*{Acknowledgements} This work is funded by the STFC (UK). \bibliographystyle{elsarticle-num-names}
\section{Introduction} In the last decades, the growing availability of an increasingly larger amount of astrophysical and cosmological data has supposedly led us into a so-called ``precision cosmology'' era. The effective model that best fits most of the collected observations is the $\Lambda$CDM model, which is based on General Relativity (GR) and on the introduction of two exotic fluids, the cold dark matter (DM) and the dark energy (DE). They should represent the $\sim27\%$ and $\sim68\%$ of the matter--energy content of the present-day Universe, respectively \cite{Planck:2018vyg,eBOSS:2020yzd,DES:2021wwk}, and being responsible for the dynamical features of the Universe at all scales. Despite being the best model to explain the collected data, the $\Lambda$CDM paradigm is plagued by several problems, both experimental and theoretical \cite{Bull:2015stt}. On the one hand we have a huge variety of solutions for DM but we face the complete lack of any detection of any viable particle candidate for DM at fundamental scales \cite{Bertone:2004pz}. On the other hand, we also have an humongous number of possibilities to describe DE, but also many theoretical shortcomings regarding its nature and behaviour, such as the discrepancy ($\sim$120 orders of magnitude) between the observed value of the cosmological constant and the vacuum energy density calculated via QFT. Other big issues are the presence of singularities in the theory and the completely unsatisfactory description of gravity at quantum level. All these problems led to the idea of developing theories of gravity ``beyond GR'', aiming at fixing its infrared (IR) and ultraviolet (UV) shortcomings. Several proposal for extended theories of gravity (ETGs) have been made during last thirty years \cite{Clifton:2011jh,Ishak:2018his}. Some of these are based on modifications of the geometrical content of the theory, namely the Hilbert-Einstein Lagrangian; some others are based on modifications of the matter content, for example by adding extra scalar fields. Often these two kind of modifications are introduced together. The most famous and extensively investigated ETGs are $f(R)$ theories \cite{Capozziello:2002rd,RevModPhys.82.451, Capozziello:2012ie, CLIFTON20121, CAPOZZIELLO2011167, ReviewDeFelice}, where the Hilbert-Einstein Lagrangian is replaced by a general function of the Ricci scalar $R$, and scalar-tensor theories \cite{Nojiri:2010wj, Oikonomou, doi:10.1142/S021827180600942X, RevModPhys.75.559, Euclid, Huterer_2017}, in which one or more scalar fields are minimally or non-minimally coupled to gravity. These two classes of theories can be made equivalent, since $f(R)$ theories can be recovered by scalar-tensor ones with some specific changes of variables and viceversa. Other ETGs approaches replace the Ricci scalar $R$ with the torsion scalar $T$, instead \cite{Cai:2015emx}. In fact, it is possible to build the so called Teleparallel Equivalent of General Relativity (TEGR) by giving up the Equivalence Principle and replacing the Ricci scalar $R$ with the Torsion scalar $T$. TEGR, firstly introduced by Einstein himself \cite{unzicker2005translation}, and GR are dynamically equivalent. However, the equivalence does not hold for the teleparallel equivalent of $f(R)$, i.e. $f(T)$ theories. The latter leads to second-order field equations, while the field equations derived by $f(R)$ gravity, in metric formalism, are of fourth-order \cite{Bamba}. An interesting approach is the introduction of non-local terms \cite{Capozziello:ReviewNonLocal, Nojiri:2010wj}. Non-locality is one of the main feature of quantum theory, thanks to the Heisenberg Principle, and it automatically arises in quantum field theory (QFT) when one-loop effective actions are considered. Instead, GR is a classical theory, hence local by definition. In order to merge the gravitational interaction with the quantum formalism, it is thus possible to implement an effective approach by adding non-local operators to the gravitational Lagrangian. The procedure can be considered as an effective approach to link gravitation and QFT. In general, two main different families of non-local theories of gravity can be considered. The first ones are the Infinite Derivatives Theories of Gravity (IDGs), which present, at short range, non-locality caused by terms with entire analytic transcendental functions of a differential operator. The most commonly used terms are the exponential functions of the covariant d'Alembert operator, $\Box = g_{\mu\nu} \nabla^{\mu} \nabla^{\nu}$. IDGs have been introduced to solve one of the main problems of $f(R)$ theories, namely the lack of unitarity caused by bad ghosts. Moreover, this class of non-local terms weakens gravitational attraction at short length scale. Hence, a natural solution to UV shortcomings of GR is provided \cite{Buoninfante2018, Modesto:2013ioa, PhysRevD.87.083507, Conroy:2014eja}. Then, we also have Integral Kernel Theories of Gravity (IKGs), inspired by quantum corrections obtained in QFT on curved spacetime. In IKGs, the Lagrangian is extended by adding transcendental functions of the fields ($R$, $T$, $G$, etc.), which can be always represented by the integral kernels of differential operators, such as \begin{equation}\label{1.1} \Box^{-1} \eta(x) \equiv \int d^{4}x' G(x,x') \eta(x') \end{equation} Due to its integral nature, this class of terms gives rise to long range non-localities, which can fix the IR shortcomings of GR \cite{doi:10.1142/S0217732315400039, Deser:2007jk, Capriolo1,Capriolo2}. Interesting IKG models have been proposed in \cite{RRmodel,RTmodel}. Subsequent comparisons with cosmological observations \cite{Dirian:2016puz,RRtest2018,Nesseris:2014mea,Acunzo} showed agreement with data at a level statistically equivalent to $\Lambda$CDM and an intriguing reduction of the Hubble tension. In this paper, we consider a metric IKG proposed in \cite{Deser:2007jk} to explain the late-time cosmic acceleration. Non-locality is introduced by a general function of the inverse d'Alembert operator, Eq.~(\ref{1.1}), the form of which can be found by applying the so-called Noether Symmetry Approach as discussed in \cite{Capozziello:ReviewNonLocal}. Furthermore, we consider the local representation of the theory, firstly introduced in \cite{Nojiri:2007uq}. Two auxiliary scalar fields emerge as Lagrange multipliers, so that the new scalar-tensor theory is made equivalent to the original non-local theory. The Newtonian limit is finally performed and two Newtonian potentials, $\phi$ and $\psi$, are derived. These point-mass potentials can be generalized to extended spherically symmetric mass distributions which can model gravitational structures like galaxy clusters. Then, the non-local model can be compared to observational data. In other words, signatures of non-locality can emerge from large-scale structure. Here, we perform an analysis similar to \cite{Salzano:2017qac, Salzano:2016udu, Laudato:2021mnm} using a sample of 19 high-mass galaxy clusters, for which strong- and weak-lensing data sets from deep \textit{Hubble Space Telescope} (\textit{HST}) and ground-based wide-field observations are available. All data products used in this study are obtained from the Cluster Lensing and Supernova survey with Hubble (CLASH) program \cite{CLASH2012}. The aim of the paper is to constrain the free parameters of the non-local theory and compare the results to those obtained in \cite{Dialektopoulos:2018iph,Borka:2021omc}, where the same theory has been analyzed using the orbits of S2 stars around the Galactic center. The paper is organised as follow: in section \ref{Section 2} we present the non-local model and its local scalar-tensor representation. Then, we sketch the Noether Symmetry Approach to derive the form of the non-local terms related to the existence of conserved quantities. Moreover, we perform the weak-field limit in order to find the Newtonian potentials, $\phi$ and $\psi$, and we generalize the results to extended spherically symmetric systems. Finally, our choice for the mass density profile is presented and an overview of the gravitational lensing theory, used to derive the theoretical prediction, is introduced. In Sec. \ref{Section 3}, the data sets of the CLASH program that we have used in our analysis is presented. Then, we introduce the main points of the statistical analysis we have performed. Furthermore, in Sec. \ref{Section 4}, the results of the statistical analysis are discussed and a comparison between them and previous results in the literature is made. In Sec. \ref{Section 5}, the conclusions are drawn. \section{The Model}\label{Section 2} The model we are going to study in this paper was firstly introduced in \cite{Deser:2007jk}. Here, the Hilbert-Einstein action is extended by adding an extra non-local term characterized by a general function of the inverse d'Alembert operator \begin{equation}\label{2.1} S \, = \, \frac{1}{16 \pi G} \int d^{4}x \, \sqrt{-g} \, \Big[ R \big( 1 + f(\Box^{-1}R) \big) \Big] \end{equation} The function $f$ is called \textit{distortion function} and GR is immediately restored when $f$ is set to zero. Notice that the theory defined by Eq.~(\ref{2.1}) can be seen as a special case of the Generalized non-local Teleparallel Gravity (GNTG) proposed in \cite{Bahamonde:2017sdo}, from which the above model is recovered by setting the coupling constants equal to $1$ and $-1$, respectively. The model in Eq.~(\ref{2.1}) explains well the current cosmic acceleration. In fact, the non-local terms here introduced allow a delayed response to the transition from radiation to matter dominance, and then avoid fine tunings often introduced to address late time acceleration \cite{Deser:2007jk}. Furthermore, using a proper piecewise-defined distortion function, the non-local model may lead to the unification of the early-time inflation with late-time acceleration \cite{Nojiri:2007uq}. A local representation of the non-local model Eq.~(\ref{2.1}) has been proposed in \cite{Nojiri:2007uq}, where an equivalent scalar-tensor theory is built by introducing two auxiliary scalar fields, $\eta$ and $\xi$, so that the action is rewritten as follows \begin{equation}\label{2.2} \begin{aligned} S \, &= \, \frac{1}{16 \pi G} \int d^{4}x \, \sqrt{-g} \, \Big[ R \big( 1 + f(\eta) \big) + \xi \big( \Box\eta - R \big) \Big] \, = \\ &= \, \frac{1}{16 \pi G} \int d^{4}x \, \sqrt{-g} \, \Big[ R \big( 1 + f(\eta) - \xi \big) - \nabla^{\mu}\xi \, \nabla_{\mu}\eta \Big] \end{aligned} \end{equation} where the term $\xi\Box\eta$ has been integrated by parts and the boundary term is set to zero. A general procedure to build a local representation of non-local theories is presented in \cite{Capozziello:ReviewNonLocal}. Varying the action in Eq.~(\ref{2.2}) with respect to $\xi$ and $\eta$, we obtain the two Klein-Gordon equations: \begin{equation}\label{2.3} \Box \eta = R \;\; \Rightarrow \;\; \eta = \Box^{-1}R \end{equation} \begin{equation}\label{2.4} \Box \xi = -R \, \frac{df(\eta)}{d\eta} \end{equation} where the auxiliary fields behave as Lagrange multipliers. Eq.~(\ref{2.3}) is a constraint such that substituting it into (\ref{2.2}) one recovers (\ref{2.1}). Instead, equation (\ref{2.4}) is a non-trivial equation for the dynamics of the scalar field $\xi$. Furthermore, the variation of the action in Eq.~(\ref{2.2}) plus the matter action, with respect to the metric tensor $g_{\mu\nu}$, yields to the following gravitational field equation: \begin{equation}\label{2.5} \begin{aligned} G_{\mu\nu} \, &= \, \frac{1}{1+f(\eta)-\xi} \, \Big[ \big(8\pi G \big)^{2} \, T^{(m)}_{\mu\nu} + \nabla_{\mu}\xi \, \nabla_{\nu}\eta \,\, + \\ &+ \big( \nabla_{\mu}\nabla_{\nu} - g_{\mu\nu} \, \Box \big) \big( f(\eta) - \xi \big) - \frac{1}{2} g_{\mu\nu} \nabla^{\alpha}\xi \, \nabla_{\alpha}\eta \Big] \end{aligned} \end{equation} A non-trivial form for the distortion function has been reconstructed in \cite{WoodardDistFun} in order to reproduce the $\Lambda$CDM expansion. The model provided by substituting such form of $f$ in Eq.~(\ref{2.1}) has been analysed in its localized version in \cite{NersisyanConstraints2017}, using Redshift-Space Distortions (RSD) data: a slightly lower value of $\sigma_{8}$ is derived and, consequently, a better agreement with data results with respect to the $\Lambda$CDM model. Moreover, in \cite{Park2018}, the author has shown that the same results can be obtained in the original non-local version in \cite{WoodardDistFun}, as long as the initial conditions are set the same. Further analysis have been performed in \cite{AmendolaIdrianConstraints}, using Cosmic Microwave Background (CMB), Type Ia supernovae (SNIa) and RSD observations: a deficit of growth of linear structures and a higher lensing power as compared to $\Lambda$CDM is derived, so that a significant shift for the parameter $\sigma_{8}$ and $\tau_{re}$ results. It follows a CMB-RSD tension and ``weak'' evidence for the $\Lambda$CDM model. The same authors also highlight a modification in the propagation equations for Gravitational Waves (GWs), which provides a powerful way for testing deviations to GR with future third generation GW interferometers. See also \cite{Capriolo1, Capriolo2}. A drawback that could arise in the non-local theories of gravitation is the lack of a screening mechanism, which is necessary to avoid any undesired effect at Solar System scale. In \cite{DeserScreening}, it is argued that inside bound objects $\Box^{-1}R$ acquires positive value, whereas it is negative in cosmology. Thus, as one is free to choose the distortion function, one can set it so that it vanishes for positive values of $\Box^{-1}R$, i.e. $f(\Box^{-1}R) \sim \theta(\Box^{-1}R)$ where $\theta$ is the Heaviside step function. It follows a perfect screening mechanism which allows the model to reduce to GR at the Solar System scales. However, in \cite{LunarLaserRanging}, has been shown that the value of $\Box^{-1}R$ is actually negative also at Solar System scale, therefore this procedure cannot be applied. As a consequence, the above model would present a time dependence of the effective Newton constant in the small scale limit and it would thus be ruled out by Lunar Laser Ranging (LLR) observations. This conclusion, drawn in \cite{LunarLaserRanging}, seems to be too strong, since it is still not clear how a Friedman-Lema\^itre-Robertson-Walker (FLRW) background quantities behave when evaluated from cosmological scales down to Solar System ones, where the system decouples from the Hubble flow. In fact, a full non-linear time- and scale-dependent solution around a non-linear structure would be necessary. \subsection{The Noether Symmetry Approach} The action in Eq.~(\ref{2.2}) as well as the two non-trivial field equations Eqs.~(\ref{2.4}) and (\ref{2.5}), all depend on the specific form of the distortion function $f(\Box^{-1}R)$. It is thus possible to use the Noether Symmetry Approach \cite{Capozziello:1996bi} to select a form of the distortion function such that the theory is invariant under point transformations. This method has been extensively used in the literature \cite{Capozziello:1996bi, Dialektopoulos:2018qoe, sym10070233, Bahamonde2019, PhysRevD.95.064031, Bahamonde:2017sdo}, aiming to study modified theories of gravity based on general functions, such as $f(R)$, $f(T)$, etc. Such theories have to be checked against data in order to be constrained and then obtain physically reliable models. However, it is possible to constraint modified-gravity theories using a theoretical approach rather than a phenomenological one. Specifically, Noether symmetries can be used as a geometric criterion to choose among different models. Moreover, the presence of symmetries imply conserved quantities that, in many cases, have a physical meaning and allow to reduce dynamics and find exact solutions \cite{Capozziello:1996bi}. The Noether Symmetry Approach works as follows: \begin{itemize} \item one first selects a class of background space-time metrics, which, in our case, is spherically symmetric, and one therefore writes the metric; \item then, one substitutes the metric into the Lagrangian density Eq.~(\ref{2.1}) and, after integrating out all the total derivative terms, it is possible to obtain a point-like canonical Lagrangian; \item one derives the Noether vector $X$, i.e. the infinitesimal generator of point transformations; \item it is then possible to apply the Noether symmetry condition \cite{Dialektopoulos:2018qoe} \begin{equation}\label{2.6} X^{[1]} \mathcal{L} + \mathcal{L} \bigg( \frac{d\xi^{t}}{dt} + \frac{d\xi^{r}}{dr} \bigg) \, = \, \frac{dh^{t}}{dt} + \frac{dh^{r}}{dr} \end{equation} where $X^{[1]}$ is the first prolongation of $X$, $\xi^{t}$ and $\xi^{r}$ are the coefficients of the Noether vector and $h^{t}$ and $h^{r}$ are two arbitrary functions depending on time and generalized coordinates. Expanding the condition Eq.~(\ref{2.6}), one finds a system of equations with 9 unknown variables, which yields to two possible models that are invariant under point transformations \begin{equation}\label{2.7} f(\eta) \, = \, c_{4} + c_{3} \,, \eta \end{equation} \begin{equation}\label{2.8} f(\eta) \, = \, c_{4} + \frac{c_{5}}{c_{1}} \, e^{c_{1}\eta}\,. \end{equation} \end{itemize} See \cite{Capozziello:ReviewNonLocal} for details. An overview of the general method is given in \cite{Dialektopoulos:2018qoe}, while the explicit calculation of the Noether Symmetry Approach applied to the model \eqref{2.1} is performed in \cite{Dialektopoulos:2018iph}. It is interesting to note that the two forms Eq.~(\ref{2.7}) and (\ref{2.8}) of the distortion function correspond to those phenomenologically introduced in \cite{Nojiri2017, Wetterich1998}. Hereinafter, we consider the exponential form Eq.~(\ref{2.8}) for the distortion function and we set all the integration constants to one. Thus, we have \begin{equation}\label{2.9} f(\eta) \, = \, 1 + e^{\eta}\,. \end{equation} As reported in \cite{Modesto1}, this form of coupling is particularly relevant to achieve the so called "super-renormalizability" for effective theories of gravity. Here, it is selected thanks to the existence of related Noether symmetries. \subsection{The Newtonian limit} Now, let us perform the weak field limit for the above non-local model, in order to derive the Newtonian potentials which will be used to match observations. The gravitational field for a static and spherically symmetric metric is described by \begin{equation}\label{2.10} ds^{2} \, = \, A(r) \, dt^{2} - B(r) \, dr^{2} - r^{2} \, d\Omega^{2}\,. \end{equation} Notice that the Birkhoff theorem is not guaranteed in non-local gravity, but we expect that static and spherically symmetric solutions are a good approximation when the Newtonian limit is performed. Not even the existence of the solution $B(r) = 1/A(r)$ is guaranteed in modified theories of gravity \cite{Diego}, so it cannot be chosen \textit{a priori} in Eq.~(\ref{2.10}). It is well known, from GR, that expanding $g_{00}$ up to $v^{2} \sim \mathcal{O}(2)$, one obtains the Newtonian potential $\phi$ for time-like particles. However, for theories beyond GR the Post-Newtonian (PN) limit is necessary, i.e. \begin{equation}\label{2.11} g_{00} \sim \mathcal{O}(6), \quad g_{0i} \sim \mathcal{O}(5), \quad g_{ij} \sim \mathcal{O}(4)\, . \end{equation} When higher-order corrections are taken into account, two length scales arise, which are related to the scalar degrees of freedom we introduced to localize the theory. The expansion of the metric components as well as the scalar fields therefore gives \begin{equation}\label{2.12} A(r) \, = \, 1 + \frac{1}{c^2} \phi^{(2)}(r) + \frac{1}{c^4} \phi^{(4)}(r) + \frac{1}{c^6} \phi^{(6)}(r) + \mathcal{O}(8) \end{equation} \begin{equation}\label{2.13} B(r) \, = \, 1 + \frac{1}{c^2} \psi^{(2)}(r) + \frac{1}{c^4} \psi^{(4)}(r) + \mathcal{O}(6) \end{equation} \begin{equation}\label{2.14} \eta(r) \, = \, \eta_{0} + \frac{1}{c^2} \eta^{(2)}(r) + \frac{1}{c^4} \eta^{(4)}(r) + \frac{1}{c^6} \eta^{(6)}(r) + \mathcal{O}(8) \end{equation} \begin{equation}\label{2.15} \xi(r) \, = \, \xi_{0} + \frac{1}{c^2} \xi^{(2)}(r) + \frac{1}{c^4} \xi^{(4)}(r) + \frac{1}{c^6} \xi^{(6)}(r) + \mathcal{O}(8) \end{equation} Combining these expansions together with the 00- and 11- components of Eq.~(\ref{2.5}) and with the equations for the scalar fields, Eqs.~(\ref{2.3}) and (\ref{2.4}), one obtains \cite{Dialektopoulos:2018iph} \begin{equation}\label{2.16} \begin{aligned} A(r) \, &= \, 1 - \frac{2GM\eta_{c}}{c^{2}r} + \frac{G^{2}M^{2}}{c^{4}r^{2}} \Bigg[ \frac{14}{9}\eta_{c}^{2} + \frac{18 r_{\xi} - 11 r_{\eta}}{6 r_{\eta} r_{\xi}} \, r \Bigg] + \\ &- \frac{G^{3}M^{3}}{c^{6}r^{3}} \Bigg[ \frac{50 r_{\xi} - 7 r_{\eta}}{12 r_{\eta} r_{\xi}} \, \eta_{c} \, r + \frac{16}{27} \eta_{c}^{3} - \frac{2 r_{\xi}^{2} - r_{\eta}^{2}}{r_{\eta}^{2} r_{\xi}^{2}} \, r^{2} \Bigg] \end{aligned} \end{equation} \begin{equation}\label{2.17} B(r) \, = \, 1 + \frac{2GM\eta_{c}}{3 c^{2}r} + \frac{G^{2}M^{2}}{c^{4}r^{2}} \Bigg[ \frac{2}{9}\eta_{c}^{2} + \frac{3 r_{\eta} - 2 r_{\xi}}{2 r_{\eta} r_{\xi}} \, r \Bigg] \end{equation} \begin{equation}\label{2.18} \begin{aligned} \eta(r) \, &= \, \frac{4GM\eta_{c}}{3 c^{2}r} - \frac{G^{2}M^{2}}{c^{4}r^{2}} \Bigg[ \frac{11 r_{\eta} + 6 r_{\xi}}{6 r_{\eta} r_{\xi}} \, r - \frac{2}{9}\eta_{c}^{2} \Bigg] + \\ &- \frac{G^{3}M^{3}}{c^{6}r^{3}} \Bigg[ \frac{r^{2}}{r_{\eta}^{2}} - \frac{25 r_{\eta} - 14 r_{\xi}}{12 r_{\eta} r_{\xi}} \, \eta_{c} \, r - \frac{4}{81} \eta_{c}^{3} \Bigg] \end{aligned} \end{equation} \begin{equation}\label{2.19} \begin{aligned} \xi(r) \, &= \, 1 + \frac{G^{2}M^{2}}{c^{4}r^{2}} \Bigg[ \frac{2}{3}\eta_{c}^{2} - \frac{13 r_{\eta} - 6 r_{\xi}}{6 r_{\eta} r_{\xi}} \, r \Bigg] + \frac{G^{3}M^{3}}{c^{6}r^{3}} \, \cdot \\ &\cdot \Bigg[ \frac{20}{27} \eta_{c}^{3} - \frac{r_{\eta}^{2} - r_{\xi}^{2}}{r_{\eta}^{2} r_{\xi}^{2}} \, r^{2} - \frac{131 r_{\eta} + 6 r_{\xi}}{36 r_{\eta} r_{\xi}} \, \eta_{c} \, r \Bigg] \end{aligned} \end{equation} where $\eta_{c}$ is a dimensionless constant, which can be set to 1 in order to recover the Newtonian limit for $\phi$. The two parameters $r_{\eta}$ and $r_{\xi}$, which arise in the higher-order terms $\mathcal{O}(4)$ and $\mathcal{O}(6)$, are the length scales related to the the scalar degrees of freedom and thus to the non-localities. These length scales are the free parameters of the theory that we want to constrain by observations. \subsection{Extended spherically symmetric systems}\label{sec:potentials} In order to confront the theory against data, it is necessary to generalize the results in Eqs.~(\ref{2.16})~-~(\ref{2.17}) to extended mass distributions. First of all, from Eqs.~(\ref{2.16})~-~(\ref{2.17}) we derive the point-mass expressions for the gravitational $(\phi)$ and metric $(\psi)$ potentials, which are, respectively: \begin{align}\label{phi_point} \phi(r) &= \phi_{0}(r) + \phi_{1}(r) + \phi_{2}(r)\,, \\ \phi_{0}(r) &= -\frac{GM}{r}\,, \nonumber \\ \phi_{1}(r) &= \frac{G^{2}M^{2}}{2c^{2}r^{2}} \bigg[ \frac{14}{9} + \left(\frac{3} {r_{\eta}} - \frac{11}{6 r_{\xi}}\right) r \bigg]\,, \nonumber \\ \phi_{2}(r) &= \frac{G^{3}M^{3}}{2c^{4}r^{3}} \bigg[\frac{7 r_{\eta}-50r_{\xi}}{12r_{\eta}r_{\xi}} r -\frac{16}{27} + \frac{2r_{\xi}^{2}-r_{\eta}^{2}}{r_{\eta}^{2}r_{\xi}^2}r^2\bigg]\,; \nonumber \end{align} and \begin{align}\label{psi_point} \psi(r) &= \psi_{0}(r) + \psi_{1}(r)\,, \\ \psi_{0}(r) &= -\frac{GM}{3r} \nonumber\,, \\ \psi_{1}(r) &= -\frac{G^{2}M^{2}}{2c^{2}r^{2}} \bigg[ \frac{2}{9} + \left(\frac{3}{2 r_{\xi}} - \frac{1}{r_{\eta}} \right) r \bigg]\,. \nonumber \end{align} Before proceeding, it is worth having a look at the orders of magnitude of each of the above contributions, to forecast their weight in the analysis and thus estimate which kind of constraints (if any) it is possible to put on the theory. A rough estimation, using the typical masses and radii of the clusters of galaxies (respectively, $M=10^{15}$ $M_{\odot}$ and $r=3$ Mpc), tells us that: \begin{equation}\label{2.20} \mathcal{O}\left(\frac{G M}{r}\right)\sim 10^{-27} \; \mathrm{kpc^{2} \, s^{-2}} \end{equation} \begin{equation}\label{2.21} \mathcal{O}\left(\frac{G^2 M^2}{2 c^2 r^2}\right)\sim 10^{-32} \; \mathrm{kpc^{2} \, s^{-2}} \end{equation} \begin{equation}\label{2.22} \mathcal{O}\left(\frac{G^3 M^3}{2 c^4 r^3}\right) \sim 10^{-37} \; \mathrm{kpc^{2} \, s^{-2}} \end{equation} It immediately follows that the terms (\ref{2.22}) are completely negligible in our analysis, and we will not consider them further. However we can also make two additional and more important considerations about these qualitative results. The first one is that, in order to expect a significant contribution from $\phi_1$ and $\psi_1$ with respect to the standard terms, $\phi_0$ and $\psi_0$, we should have $r_{\eta} \sim r_{\xi}\sim 10^{-5}r$. The second consideration is probably even more decisive: in case the non-local corrections to the potential were not large enough, we would have here a theory which \textit{does not} reduce to GR. In fact, it is straightforward to see that in that case we would have $\psi \sim \phi/3$. If such a scenario would be able to fit the data (and if yes, with which implications) is something we are going to check carefully in the following analysis. The generalization to extended system is based on performing the following integrals (using spherical coordinates) \begin{equation}\label{ext_Phi0} \Phi_{0}(r) = \int_{0}^{\infty} \rho(x') x'^2 dx'\int_{0}^{\pi} \sin \theta' d\theta' \int_{0}^{2\pi} d\phi' \phi_0(r)\,, \end{equation} with $r$ defined as: \begin{equation} r = |\boldsymbol{x} - \boldsymbol{x'}| = \big(x^{2}+ x'^{2} - 2\,x\,x'\,\mathrm{cos}\theta \big)^{1/2}\, , \end{equation} where $\boldsymbol{x}$ is the vector position of the point in the space where we want to calculate the potential, and $\boldsymbol{x'}$ is the vector position connected to the mass distribution (source of the gravitational potential). Note how the integration over the radial coordinate has to be performed between $0$ and $\infty$ because Newton's theorems are not guaranteed in non-local gravity, so that we cannot apply the Gauss theorem and the effects of external shell of matter cannot be neglected\footnote{As discussed in \cite{Cardo}, the fact that the Gauss theorem could be violated in Extended Gravity is not a problem because conservation laws are guaranteed by the Bianchi identities.}. While the term $\Psi_0(r)$ is derived as in Eq.~(\ref{ext_Phi0}), $\Phi_1(r)$ and $\Psi_1(r)$ need an intermediate step, as they involve the term $M^2$. Since the mass element can be written as \begin{equation}\label{eq:dM} dM = \rho(x') \, x'^{2} \, dx' \, \sin \theta \, d\theta \, d\phi\, , \end{equation} and considering that $dM^2 = 2 M dM$, with \begin{equation}\label{2.27} M(r) = \, 4\pi \int_{0}^{r} dx' \, x'^{2} \, \rho(x')\, \end{equation} we get: \begin{align}\label{ext_Phi1} \Phi_{1}(r) &= 2 \int_{0}^{\infty} \rho(x') x'^2 dx'\int_{0}^{x'} \rho(x'') x''^2 dx'' \\ &\int_{0}^{\pi} \sin \theta' d\theta' \int_{0}^{\pi} \sin \theta'' d\theta'' \int_{0}^{2\pi} d\phi' \int_{0}^{2\pi} d\phi'' \phi_1(r)\,. \nonumber \end{align} The same results holds for $\Psi_{1}(r)$. \subsection{The mass density profile} To compute the integrals of the extended potentials, it is necessary to make a choice for the mass density profile describing the mass distribution in galaxy clusters. In our analysis, the matter distribution in galaxy clusters is considered to be dominated by DM. We have chosen to describe the cluster mass distribution with a spherically symmetric Navarro--Frenk--White (NFW) mass density profile \cite{NFW1996}, \begin{equation}\label{eq:NFW} \rho_\mathrm{NFW}(r) = \frac{\rho_{s}}{\frac{r}{r_{s}} \Big( 1 + \frac{r}{r_{s}} \Big)^{2}} \end{equation} where $\rho_{s}$ and $r_{s}$ are the characteristic halo density and radius, respectively. Here, the choice of the NFW density profile is motivated by cosmological $N$-body simulations \cite{NFW1996,Child2018} and observational results based on gravitational lensing \cite{Umetsu:2015baa} (see Section~\ref{Section 3}), both in GR context. It is useful to express the NFW parameters in terms of the overdensity radius $r_\Delta$ and the dimensionless concentration parameter $c_\Delta$ as \begin{equation}\label{eq:cr_delta} \rho_{s} = \frac{\Delta}{3} \rho_{c} \frac{c_{\Delta}^{3}}{\mathrm{ln}(1+ c_{\Delta}) - \frac{c_{\Delta}}{1 + c_{\Delta}}}, \end{equation} \begin{equation}\label{2.31} r_{s} = \frac{r_{\Delta}}{c_{\Delta}}, \end{equation} where $r_{\Delta}$ is the spherical radius within which the mean interior density equals $\Delta$ times the critical density $\rho_c$ of the Universe at the cluster redshift. Instead of working with $r_{\Delta}$, it is more common to use $M_{\Delta}$, i.e., the total mass contained within the overdensity radius $r_{\Delta}$, \begin{equation}\label{eq:M_delta} M_{\Delta} = \frac{4}{3} \pi r_{\Delta}^{3} \Delta \rho_{c} = 4 \pi \rho_{s} r_{s}^{3} \bigg[ \mathrm{ln}(1+ c_{\Delta}) - \frac{c_{\Delta}}{1 + c_{\Delta}} \bigg]\, . \end{equation} In the literature, the typical choice of the overdensity characterizing the halo mass is $\Delta = 200$, while higher overdensities, such as $\Delta = 500$ and $2500$, are used to characterize the properties of halos in their inner regions. In our analysis, we set $\Delta=200$. Thus, the free NFW parameters that we have used for our analysis are $\{ M_{200}, c_{200} \}$. Once the choice for the mass density profile has been made, it is finally possible to compute analytically the integrals for the extended potentials from Eqs.~(\ref{ext_Phi0}) and (\ref{ext_Phi1}), which we omit to write here explicitly just for the sake of clarity. \iffalse The analytical results that we've obtained are: \begin{equation}\label{2.33} \Phi(r) \, = \, \Phi_{0}(r) + \Phi_{1}(r) + \Phi_{2}(r) \end{equation} for the Newtonian potential $\Phi$, where \begin{equation}\label{2.34} \Phi_{0}(r) \, = \, 4 \,\pi \, G \, r_{s}^{3} \,\, \frac{\mathrm{ln}(r_{s}) - \mathrm{ln}(r + r_{s})}{r} \end{equation} \begin{equation}\label{2.35} \Phi_{1}(r) \, = \, \frac{8 \, \pi^{2} \, G^{2} \, r_{s}^{6}}{c^{2}} \, \bigg( \frac{3}{r_{\eta}} - \frac{11}{6 r_{\xi}} \bigg) \, \frac{r + (r + r_{s}) \, \mathrm{ln}\big( \frac{r}{r + r_{s}} \big)^{2}}{r (r + r_{s})} \end{equation} while $\Phi_{2}(r)$ has a quite lengthy expression. Moreover, for the Newtonian potential $\Psi$ we obtained: \begin{equation}\label{2.36} \Psi(r) \, = \, \Psi_{0}(r) + \Psi_{1}(r) + \Psi_{2}(r) \end{equation} where \begin{equation}\label{2.37} \Psi_{0}(r) \, = \, \frac{1}{3} \, \Phi_{0}(r) \end{equation} \begin{equation}\label{2.38} \Psi_{1}(r) \, = \, \frac{9 r_{\eta} - 6 r_{\xi}}{18 r_{\xi} - 11 r_{\eta}} \, \Phi_{1}(r) \end{equation} \begin{equation}\label{2.39} \Psi_{2}(r)= - \frac{1}{7} \Phi_{2}(r) \end{equation} \fi \subsection{Gravitational lensing} All the previous machinery is fundamental to calculate the quantity which we will then compare with observational data which, as explained in next section, are based on gravitational lensing event analysis from the clusters of galaxies we have considered. The general configuration for a gravitational lensing system \cite{LensingReview,Umetsu2020} has a foreground object (the lens) between the observer and the background source of light. The angular diameter distances between the observer and the lens and between the observer and the source are denoted by $D_{L}$ and $D_{S}$, respectively, while the angular diameter distance between the lens and the source is $D_{LS}$. The angular diameter distance as a function of redshift is defined as: \begin{equation}\label{eq:dA} D_{A}(z) = \frac{c}{1+z} \int_{0}^{z} \frac{dz'}{H(z')}\, . \end{equation} In a $\Lambda$CDM scenario, the Hubble function $H(z)$ is given by the first Freedman equation, \begin{equation}\label{2.41} H(z) = H_{0} \sqrt{\Omega_{m} (1+z)^{3} + \Omega_{k} (1+z)^{2} + \Omega_{\Lambda}}\, . \end{equation} In our analysis, we assume as our fiducial background cosmology the one from the latest release of the \textit{Planck} survey \cite{Planck:2018vyg}, with $\Omega_m = 0.308$, $H_0 = 67.89$ and $\Omega_k=0$ (from which $\Omega_{\Lambda} = 1-\Omega_m$). It is important to note here that we are implicitly assuming that the non-local model we are analyzing behaves on cosmological scales as this chosen $\Lambda$CDM one, at least effectively. Any cosmological implication and analysis is out of the scopes of this paper. It is generally verified that the distances $D_{L}$ and $D_{LS}$ are much larger than the physical extension of the lens, so that the latter can be approximated as a two-dimensional system (``thin-lens'' approximation). In such a configuration the relation among the angular position of the source $(\vec{\theta}_{s})$ and the angular position of the image $(\vec{\theta})$ is given by the lens equation: \begin{equation}\label{eq:lens_eq} \vec{\beta} = \vec{\theta} - \frac{D_{LS}}{D_S}\, \hat{\vec{\alpha}}(\vec{\theta})\,, \end{equation} where $\vec{\hat{\alpha}}$ is the deflection angle, which, in GR, is defined as: \begin{equation}\label{eq:defl_angle} \hat{\vec{\alpha}} = \frac{2}{c^{2}} \int_{-\infty}^{+\infty} \vec{\nabla}_{\perp} \Phi \mathrm{d}z\, , \end{equation} with $\vec{\nabla}_{\perp}$ being the two-dimensional gradient operator perpendicular to the light propagation and $z$ the line-of-sight direction. The deflection angle is then directly related to the quantity which we will use to constrain our model, the convergence \begin{equation}\label{eq:convergence_GR1} \kappa (R) \equiv \frac{1}{c^{2}} \frac{D_{LS}D_{L}}{D_{S}} \int_{-\infty}^{+\infty} \nabla^{2}_{r} \Phi(R,z)\mathrm{d}z \end{equation} where: $R$ is the two-dimensional projected radius in the lens plane\footnote{It is clear from the context that this $R$ is a radius which must not to be confused with the above curvature scalar.}; $r=\sqrt{R^2+z^2}$ is the three-dimensional radius; $\nabla^{2}_{r}$ is the Laplacian operator in spherical coordinates; and $c$ is the speed of light. If we make use of the Poisson equation \begin{equation}\label{2.48} \nabla^{2}_{r} \Phi = 4\pi G \rho(r)\, \end{equation} we then obtain the final expression for the convergence \begin{equation}\label{eq:convergence_GR2} \kappa (R) = \int_{-\infty}^{+\infty} \frac{4 \pi G}{c^{2}} \frac{D_{LS}D_{L}}{D_{S}} \rho(R,z)\mathrm{d}z \equiv \frac{\Sigma}{\Sigma_{cr}}\, \end{equation} where $\Sigma(R)$ is the surface density of the lens, defined as \begin{equation} \Sigma(R) = \int_{\infty}^{+\infty} \rho(R,z) \mathrm{d}z\, , \end{equation} and $\Sigma_{c}$ is the critical surface density for gravitational lensing, \begin{equation}\label{2.47} \Sigma_{c} \, \equiv \, \frac{c^{2}}{4\pi G} \, \frac{D_{s}}{D_{ls}D_{l}}\, . \end{equation} If we want to generalize all the results which we have obtained so far, valid in GR, we must express the convergence in its most general form as \begin{equation}\label{eq:convergence_All} \kappa (R) \equiv \frac{1}{c^{2}} \frac{D_{LS}D_{L}}{D_{S}} \int_{-\infty}^{+\infty} \nabla^{2}_{r} \left( \frac{\Phi(R,z) + \Psi(R,z)}{2}\right)\mathrm{d}z\, \end{equation} where the potentials $\Phi$ and $\Psi$ which we are going to use are those defined in Sec.~\ref{sec:potentials}. \section{The data}\label{Section 3} The data sets we use for our analysis are obtained from the CLASH program \cite{CLASH2012}. One of the main goals of the CLASH program was to precisely determine the mass density profiles of 25 high-mass galaxy clusters using deep multi-band \textit{HST} imaging, in combination with wide-field weak-lensing observations \cite{Umetsu2014}. The CLASH sample contains 20 hot X-ray clusters ($>5$~keV) with nearly concentric X-ray isophotes and a well-defined X-ray peak located close to the brightest cluster galaxy (BCG). Notice that no lensing preselection was used to avoid a biased sample towards intrinsically concentrated clusters and those systems whose major axis is preferentially aligned with the line of sight. Cosmological hydrodynamical simulations suggest that the CLASH X-ray-selected subsample is mostly composed of relaxed systems ($\sim 70\%$) and largely free of such orientation bias \cite{Meneghetti:2014xna}. Additionally, the CLASH sample has five clusters selected by their exceptional lensing strength so as to magnify galaxies at high redshift. These clusters often turn out to be dynamically disturbed systems \cite{Umetsu2020}. The CLASH sample spans nearly an order of magnitude in mass ($5\lower.5ex\hbox{$\; \buildrel < \over \sim \;$} M_{200}/10^{14}M_\odot\lower.5ex\hbox{$\; \buildrel < \over \sim \;$} 30$) and covers a wide redshift range ($0.18 < z < 0.90$ with a median redshift of $z_\mathrm{med} = 0.40$). For each of the 25 clusters, \textit{HST} weak- and strong-lensing data products are available in the central regions \cite{Zitrin2015}. For 20 of them (16 X-ray-selected and 4 lensing-selected clusters), radial convergence profiles were reconstructed \cite{Umetsu:2015baa} from the combination of ground-based weak-lensing shear and magnification data and \textit{HST} lensing data. In our analysis, we focus on 15 X-ray-selected and 4 lensing-selected clusters taken from the CLASH subsample analyzed in \cite{Umetsu:2015baa}. Here, one of the X-ray-selected clusters (RXJ1532) has been discarded because no multiple image systems have been identified in the cluster \cite{Zitrin2015} and thus the mass reconstruction is based only on the wide-field weak-lensing data \cite{Umetsu:2015baa}. Our analysis sample spans a redshift range of $0.187 \le z \le 0.686$, with a median redshift of $z_\mathrm{med}= 0.352$. The typical resolution limit of the mass reconstruction, set by the \textit{HST} lensing data, is $10$~arcseconds, which corresponds to $\approx 35 h^{-1}h$~kpc at $z_\mathrm{med}$. Note that, according to \cite{Meneghetti:2014xna}, about half of the selected sample clusters are expected to be unrelaxed. It was found in \cite{Umetsu:2015baa} that the ensemble-averaged surface mass density $\Sigma(R)$ of the CLASH X-ray-selected subsample is best described by the NFW profile, when GR is considered. The NFW model describes well the DM distribution in clusters, which is the dominant component over the whole cluster scale. The cluster baryons, such as the X-ray-emitting hot gas and BCGs, are sensitive to non-gravitational and local astrophysical phenomena. Accordingly, hydrostatic total mass estimates, based on the X-ray probe, are highly influenced by the dynamical and physical conditions of the cluster. In contrast, gravitational lensing can provide a direct probe of the projected mass distribution in galaxy clusters. \subsection{Statistical analysis} The aim of this work is to constrain the parameters of the non-local model (\ref{2.1}) and the parameters describing the NFW profile for each individual cluster. Thus, the vector of our free theoretical parameters is $\boldsymbol{\theta} = \{c_{200}, \, M_{200}, \, r_{\eta}, \, r_{\xi} \}$. The $\chi^{2}$ function for each cluster used in the analysis is defined as \begin{equation}\label{3.1} \chi^{2} = \big( \boldsymbol{\kappa^{theo}}(\boldsymbol{\theta}) - \boldsymbol{\kappa^{obs}} \big) \cdot \mathbf{C}^{-1} \cdot \big( \boldsymbol{\kappa^{theo}}(\boldsymbol{\theta}) - \boldsymbol{\kappa^{obs}} \big)\, , \end{equation} where $\boldsymbol{\kappa^{obs}}$ is the data vector containing the observed convergence values. The data vector consists of $15$ data elements, each representing the value of $\kappa$ measured in each radial bin. The vector $\boldsymbol{\kappa^{theo}}(\boldsymbol{\theta})$ contains theoretical predictions for the model convergence calculated from Eq.~(\ref{eq:convergence_All}). Finally, $\mathbf{C}$ is the covariance error matrix constructed by \cite{Umetsu:2015baa}. The $\chi^{2}$ function is then minimized using our own Monte Carlo Markov Chain (MCMC) code written in $\texttt{Wolfram Mathematica}$. The convergence of the chains has been checked according to the method proposed in \cite{10.1111/j.1365-2966.2004.08464.x}. Full convergence has been reached for 18 out of 19 sample clusters, while MACSJ0717 shows a pathological behaviour. Such behaviour is due to a peculiar shape of the $\chi^{2}$ function, with two different minima, which is shared by all the samples, but is especially pronounced in MACSJ0717. This shape is directly related to the degeneracy of the geometrical and the matter effects, as will clearly emerge from the results of our analysis. In order to assess the validity of our non-local model against the standard GR case, we calculated the Bayesian evidence $\mathcal{E}$, so as to provide a statistical meaningful comparison tool between the two theories. We have calculated the Bayesian evidence using the algorithm proposed in \cite{Mukherjee_2006}. As this algorithm is stochastic, in order to reduce the statistical noise we run it $\sim 100$ times, obtaining a distribution of values from which we extract the best value of $\mathcal{E}$, as the median of the distribution, and the corresponding error. Since the Bayesian evidence depends on the choice of the priors \cite{Nesseris_2013}, we have always used uninformative flat priors on the parameters. For each cluster, we have assumed flat positive priors on the NFW parameters, i.e., $c_{200}>0$ and $M_{200}>0$ (note that the choice of NFW priors is different from that of \cite{Umetsu:2015baa}, who used flat logarithmic priors on $M_{200}$ and $c_{200}$), while for the non-local parameters we use flat logarithmic priors, $-5<\mathrm{log}\,r_{\eta,\xi}<5$. \begin{figure*}[t!] \centering \includegraphics[width=8.5cm]{NL_GR_1.pdf}~~~ \includegraphics[width=8.5cm]{NL_GR_2.pdf} \caption{Concentrations and masses of CLASH clusters: comparison between our results and those from \citep{Umetsu:2015baa} in the GR scenario.}\label{fig:compare_Umetsu} \end{figure*} Finally, the Bayes factors $\mathcal{B}$ are computed for each sample cluster. The Bayes factor is defined as the ratio of evidence factors of two models \begin{equation}\label{3.4} \mathcal{B}^{\,i}_{j} = \frac{\mathcal{E}(M_{i})}{\mathcal{E}(M_{j})} \end{equation} where $M_{j}$ is the reference model, which, in this case, is GR. The model selection is then performed by using the so-called Jeffreys scale \cite{JeffreysScale}, which states that: for $\ln \mathcal{B}^{\,i}_{j}<0$ there is evidence against the model $M_{i}$, i.e. the reference model is statistically favored; for $0<\ln\mathcal{B}^{\,i}_{j} <1$ there is no significant evidence in favor of the model $M_{i}$; for $1<\ln\mathcal{B}^{\,i}_{j} <2.5$ the evidence is substantial; for $2.5< \ln\mathcal{B}^{\,i}_{j} <5$ the evidence is strong; for $\ln\mathcal{B}^{\,i}_{j} >5$ the evidence is decisive. \section{Results and Discussion}\label{Section 4} \begin{figure*}[t!] \centering \includegraphics[width=8.5cm]{NL_GR_3.pdf}~~~ \includegraphics[width=8.5cm]{NL_GR_4.pdf} \caption{Concentrations and masses of CLASH clusters: comparison between the GR and the nonlocal scenario from our analysis.}\label{fig:compare_GR_NL} \end{figure*} First of all, we have performed the fits in the classical GR scenario (second column of Table \ref{tab:results}), which will be our reference model. We can thereby cross-check our modelling and statistical analysis algorithm with results from the literature for the same sample. In Fig.~\ref{fig:compare_Umetsu}, we compare our results with \cite{Umetsu:2015baa}, the original work were the lensing data we are using were first obtained and presented. Note that a direct comparison is possible because the same NFW parametrization, $\{c_{200},M_{200}\}$, has been used, with the same mass modelling, i.e. no further components (gas, galaxies) have been used. The cross-check shows an excellent agreement, with all the nineteen estimates of both NFW parameters, $c_{200}$ and $M_{200}$, which agree within the $1\sigma$ level. Concerning the non-local model, results are shown in the third column of Table~\ref{tab:results}. The NFW parameters are well constrained by the lensing data. From Fig.~\ref{fig:compare_GR_NL} and Figs.~\ref{fig:comparisong_cM_1}--\ref{fig:comparisong_cM_4}, one can see that the estimates of concentration parameter $c_{200}$ show no significant differences between GR and our non-local model, being all consistent with each other at the $1\sigma$ level, although the non-local model tends to show higher concentrations than GR. On the other hand, this trend is much clearer in the cluster mass $M_{200}$, whose non-local estimates clearly deviate from the GR ones. Such increased estimates of $M_{200}$ are very likely related to the form of the metric potentials and the role/weight of the correction terms. As explained above, if the non-local corrections are small and the $\Phi_0$ and $\Psi_0$ terms are the dominant contributions, the theory does not reduce to GR, because the potential $\Psi_0$ only takes into account $1/3$ of the contribution which would be expected. Thus, in the non-local model, the cluster mass (mostly, and slightly for $c_{200}$) must be increased to compensate the missing contribution from $\Psi_0$ to the convergence. From Figs.~\ref{fig:comparisong_cM_1}--\ref{fig:comparisong_cM_4}, it immediately appears that the $1\sigma$- and $2\sigma$-regions shift toward higher masses, except for two cases (A2261 and MACSJ0717) where the $1\sigma$ contours do not overlap. As a further check, in Fig.~\ref{fig:comparing_cM_literature} we compare the\\ $(c_{200},M_{200})$ constraints obtained in our work for GR and for the non-local model with $c$--$M$ relations from the literature. As expected, the points representing the $c$--$M$ relation for each cluster scatter due to the different physical properties of the samples. However, for GR, the region spanned by the clusters agrees with the bands representing the relation obtained in the literature. Instead, for the non-local model, the same region shifts towards higher concentrations and masses, hence it does not coincide with expected results, especially with the green band derived in \cite{Merten2015} using the same sample of our work. The gap is around 2$\sigma$, thus the non-local model is just slightly statistically disfavoured respect to GR and cannot be discarded. When we consider the non-local length scales $r_{\eta}$ and $r_{\xi}$, the statistics does not appear as much regular as in the case of the NFW parameters. The MCMC sampling does not identify a clear minimum in the $\chi^2$ function; instead, the $\chi^2$ exhibits a shallow valley in the parameter space. This is due to the fact that the non-local corrections are too small to be effectively detected given the observational uncertainties. We find that the MCMC samples are mostly concentrated in the region $-1<\mathrm{log}\,r_{\eta \, , \, \xi}<5$, and only lower limits can be extracted (see column 3 of Table~\ref{tab:results}). Lower limits on the typical non-local scales can be set with the present data. They are $r_{\eta}>4\times 10^{-5} - 7\times 10^{-2}\, \mathrm{kpc}$ and $r_{\xi}>2\times 10^{-5} - 3\times 10^{-2}\, \mathrm{kpc}$, so that the magnitudes of the non-local corrections $\phi_{1}$ and $\psi_{1}$ in Eq.~(\ref{phi_point}~-~\ref{psi_point}) are $\phi_{1} \sim 10^{-28} - 10^{-25}\; \mathrm{kpc^{2} \, s^{-2}}$ and $\psi_{1} \sim 10^{-27} - 10^{-24} \; \mathrm{kpc^{2} \, s^{-2}}$. Thus, such terms might be dominant or of comparable magnitude with respect to the zeroth-order terms, $\phi_{0}$ and $\psi_{0}$, when the non-local parameters approach their lower bounds. This result would appear to conflict with the increased estimates of $c_{200}$ and $M_{200}$ that we obtained for the non-local model. However, a deeper insight of the MCMC results shows that it naturally emerges from the degeneracy of the geometrical and mass effects. In fact, given that the theory cannot be reduced to GR, and that $\Psi_{NL}$ can only account for $\Psi_{GR}/3$, there exist only two possibilities to fit the observations: an increase of estimated cluster mass or a strong contribution of the non-local corrections, $\Phi_{1}(r)$ and $\Psi_{1}(r)$, to the lensing potential. Both options are statistically viable, leading to an agreement with data at a level statistically equivalent to GR. This degeneracy of geometrical and matter effects corresponds to a peculiar shape of the $\chi^{2}$ function, which presents two minima. Such behaviour is extremely noticeable in MACSJ0717, whose Markov chain does not remain in a specific region and consequently does not converge to particular values of the parameters. In particular, for MACSJ0717, the minimum corresponding to low values of the non-local length scales (i.e. strong non-local correction to the gravitational potential) is remarkably deep and the associated estimates of $M_{200}$ are extremely low. It follows that the non-local model seems to be able to fit the observations thanks to its non-local geometrical contributions to the lensing potential, with a very good statistical viability. Moreover, the fact that the corresponding $M_{200}$ estimates are very low means that little matter contribution is necessary to fit data, so that it would open to the possibility to fit the gravitational lensing observations without dark matter. Further studies will be necessary to investigate in detail this possibility. On the other hand, the $\chi^{2}$ function of our non-local model shows a low sensibility with respect to the non-local parameters, $r_{\eta}$ and $r_{\xi}$, so that the $\chi^{2}$ minimum corresponding to their lower limits results in an unstable equilibrium point. In contrast, the $\chi^2$ minimum corresponding to increased values of the NFW parameters turns out to be a stable equilibrium point and, as a result, the MCMC sampling is concentrated in this specific area. This behaviour is dominant in all the sample clusters except for MACSJ0717. Such an example is illustrated in Figure \ref{fig:lensingpotentialA611}. The upper panel shows an overlap of the non-local lensing potential with that of GR, demonstrating that the two theories are able to fit the data at similar levels of significance. In the lower panels, the two contributions to the non-local lensing potential, $\Phi(r)$ and $\Psi(r)$, are presented separately and each of them is decomposed into its zeroth order and first order terms. One can immediately see that $\Phi_{1}(r)$ is completely subdominant with respect to the zeroth order term, which is greater (more negative) than the GR potential due to the increased mass estimate. Thus, the resulting effective potential is dominated by the contribution that corresponds to the ``2/3 of GR'' minimum. It follows the ostensibly contradictory results: the posterior constraints on the NFW parameters are dominated by regions of high posterior probability, while the lower bounds of the non-local length scales are related to the minimum corresponding to the fully non-local regime. Both solutions can fit data at similar levels of statistical significance, as a result of the matter-geometry degeneracy. We may now compare our results with those of \cite{Dialektopoulos:2018iph}, which are obtained by numerically simulating the S2 star orbits around our Galactic centre. It immediately appears that the two results for $r_{\eta}$ are not consistent: in \cite{Dialektopoulos:2018iph} the authors obtain a constraint of $10^{7}$ km $< r_{\eta} < 10^{10}$ km, while our lower bound is $r_{\eta} > 10^{14}$km. Instead, the two estimates for the parameter $r_{\xi}$ are consistent with each other, because our lower bound $r_{\xi} > 10^{12}$ km is within that found in \cite{Dialektopoulos:2018iph}, $r_{\xi} > 10^{6}$ km. These results are well expected. Our analysis is performed at galaxy cluster scales, while \cite{Dialektopoulos:2018iph} is at galactic scales. Even though the theoretical parameters should be independent of the test scale, it is difficult to reach a constraint of the AU order if the resolution limit of the galaxy clusters data is of the order of $\sim 10$~kpc. Notice that the results for $r_{\xi}$ are consistent, probably due to the fact that this parameter is associated with the scalar field which is not dynamical, but only plays an auxiliary role to localize the original Lagrangian in Eq.~(\ref{2.1}). Finally, the computed Bayes factors are presented in the fourth column of Table \ref{tab:results}. Using the Jeffreys scale, we can see that there is no evidence in favour of the non-local model with respect to GR. For ten samples we have $0<\ln\mathcal{B}^{\,i}_{j} <1$, for eight samples $\ln\mathcal{B}^{\,i}_{j}$ is slightly negative and for one sample $\ln\mathcal{B}^{\,i}_{j}>1$. However, in both negative and ``substantial'' cases the logarithm of the Bayes factor is consistent with $[0,1]$ within few $\sigma$. \section{Summary and Conclusions}\label{Section 5} Since the non-local theory provides a viable mechanism to explain the late time cosmic acceleration with no need to introduce any form of dark energy, it is of great interest to perform further tests of this model also to address dark matter issues. In fact, its features and the physical consequences of non-locality have to be further analysed both on astrophysical and cosmological scales. In this work, we have performed a completely new test of the non-local model, using gravitational lensing data at galaxy cluster scales. The theory provides two effective ways to fit the observations at the same level of statistical significance as GR. On the one hand, when the high-value limit of the non-local parameters is reached, the non-local model reduces to a GR-like theory, being able to fit the data at the cost of increased cluster mass. In this scenario, the non-local theory mimics GR at galaxy cluster scales, affecting only the estimated cluster mass. We cross-checked our results by comparing them with $c_{200}-M_{200}$ relations from the literature, finding that the non-local model is slightly disfavoured with respect to GR. However, further comparisons with the constraints from different probes are necessary. On the other hand, when the low-value limit of the non-local length scales is reached, the non-local corrections to the lensing potential become larger and comparable to, or even dominant over, the standard zeroth-order terms. In such a scenario, the non-local scenario may be able to mimic GR, neither affecting the mass estimates nor the statistical viability of the model. Moreover, when the non-local contributions becomes completely dominant, the non-local theory seems to be able to fit the lensing observations with extremely low cluster mass. Consequently, it emerges an intriguing possibility to fit data with no dark matter. In order to investigate such a scenario, further studies should be performed, taking into account the baryonic contributions from the hot gas and stellar components in galaxy clusters. {\renewcommand{\tabcolsep}{1.mm} {\renewcommand{\arraystretch}{2.} \begin{table*}[h]\label{Table 1} \begin{minipage}{\textwidth} \centering \caption{CLASH clusters ordered by redshift. For each cluster, we provide $1\sigma$ constraints on each parameter in the top line, and the minimum values in the $\chi^2$ function in bottom one. Units: cluster radii are in kpc. Lensing-selected CLASH clusters are indicated by stars.}\label{tab:results} \resizebox*{\textwidth}{!}{ \begin{tabular}{c|cc|cccc|cc} \hline \hline & \multicolumn{2}{c|}{GR} & \multicolumn{4}{c|}{Nonlocal} & & \\ name & $c_{200}$ & $M_{200}$ & $c_{200}$ & $M_{200}$ & $\log r_{\eta}$ & $\log r_{\xi}$ & $\mathcal{B}^{NL}_{GR}$& $\ln \mathcal{B}^{NL}_{GR}$\\ & & $(10^{15}\,\mathrm{M}_{\odot})$ & & $(10^{15}\,\mathrm{M}_{\odot})$ & $\mathrm{(kpc)}$ & $\mathrm{(kpc)}$ & & \\ \hline \hline A383 & $6.32^{+2.31}_{-1.79}$ & $0.81^{+0.32}_{-0.24}$ & $7.64^{+2.73}_{-2.05}$ & $1.30^{+0.57}_{-0.45}$ & $>-2.00$ & $>-2.90$ & $1.05^{+0.03}_{-0.02}$ & $0.05^{+0.03}_{-0.02}$ \\ A209 & $2.46^{+0.63}_{-0.54}$ & $1.94^{+0.53}_{-0.45}$ & $2.81^{+0.91}_{-0.72}$ & $3.83^{+1.99}_{-1.25}$ & $>-1.46$ & $>-1.52$ & $1.29^{+0.04}_{-0.03}$ & $0.26^{+0.03}_{-0.02}$ \\ A2261 & $3.79^{+1.01}_{-0.87}$ & $2.41^{+0.64}_{-0.52}$ & $4.83^{+1.70}_{-1.17}$ & $3.88^{+1.39}_{-1.29}$ & $>-1.61$ & $>-2.82$ & $0.97^{+0.02}_{-0.02}$ & $-0.03^{+0.02}_{-0.02}$ \\ RXJ2129 & $6.16^{+2.07}_{-1.65}$ & $0.61^{+0.21}_{-0.16}$ & $7.38^{+2.49}_{-2.00}$ & $0.99^{+0.39}_{-0.31}$ & $>-2.34$ & $>-3.47$ & $0.99^{+0.02}_{-0.02}$ & $-0.01^{+0.02}_{-0.02}$ \\ A611 & $4.07^{+1.44}_{-1.13}$ & $1.64^{+0.57}_{-0.44}$ & $5.20^{+2.07}_{-1.42}$ & $2.62^{+1.16}_{-0.93}$ & $>-1.82$ & $>-3.21$ & $1.04^{+0.03}_{-0.02}$ & $0.04^{+0.03}_{-0.02}$ \\ MS2137 & $3.09^{+2.28}_{-1.31}$ & $1.26^{+0.76}_{-0.51}$ & $4.28^{+3.68}_{-1.87}$ & $1.89^{+1.59}_{-0.99}$ & $>-1.74$ & $>-2.23$ & $1.23^{+0.02}_{-0.02}$ & $0.21^{+0.02}_{-0.02}$ \\ RXJ2248 & $4.21^{+1.65}_{-1.41}$ & $1.71^{+0.75}_{-0.52}$ & $5.35^{+2.54}_{-1.77}$ & $2.73^{+1.50}_{-1.04}$ & $>-1.56$ & $>-2.68$ & $1.09^{+0.03}_{-0.02}$ & $0.08^{+0.03}_{-0.02}$ \\ MACSJ1115 & $2.95^{+0.90}_{-0.70}$ & $1.86^{+0.51}_{-0.44}$ & $3.61^{+1.26}_{-0.94}$ & $3.23^{+1.29}_{-1.04}$ & $>-1.93$ & $>2.90$ & $0.97^{+0.02}_{-0.02}$ & $-0.03^{+0.02}_{-0.02}$ \\ MACSJ1931 & $4.66^{+2.80}_{-1.75}$ & $1.55^{+0.97}_{-0.60}$ & $5.75^{+3.44}_{-2.14}$ & $2.48^{+1.77}_{-1.13}$ & $>-2.28$ & $>-3.25$ & $1.03^{+0.02}_{-0.02}$ & $0.03^{+0.02}_{-0.02}$ \\ MACSJ1720 & $4.75^{+1.69}_{-1.27}$ & $1.34^{+0.45}_{-0.36}$ & $5.86^{+2.26}_{-1.59}$ & $2.18^{+0.94}_{-0.73}$ & $>-1.74$ & $>-3.80$ & $0.98^{+0.02}_{-0.02}$ & $-0.03^{+0.02}_{-0.02}$ \\ MACSJ0416* & $3.01^{+0.78}_{-0.65}$ & $1.14^{+0.31}_{-0.26}$ & $3.69^{+1.12}_{-0.85}$ & $2.02^{+0.77}_{-0.61}$ & $>-2.22$ & $>-4.04$ & $1.05^{+0.02}_{-0.03}$ & $0.05^{+0.02}_{-0.02}$ \\ MACSJ0429 & $5.14^{+2.03}_{-1.62}$ & $0.95^{+0.40}_{-0.28}$ & $6.30^{+2.74}_{-1.89}$ & $1.57^{+0.80}_{-0.55}$ & $>-1.96$ & $>-3.49$ & $0.96^{+0.02}_{-0.02}$ & $-0.04^{+0.02}_{-0.03}$ \\ MACSJ1206 & $4.31^{+1.43}_{-1.19}$ & $1.73^{+0.48}_{-0.40}$ & $5.51^{+2.32}_{-1.56}$ & $2.69^{+1.04}_{-0.98}$ & $>-2.40$ & $>-2.60$ & $1.12^{+0.02}_{-0.02}$ & $0.11^{+0.02}_{-0.01}$ \\ MACSJ0329 & $7.60^{+2.45}_{-1.95}$ & $0.88^{+0.23}_{-0.19}$ & $8.71^{+2.63}_{-2.19}$ & $1.50^{+0.50}_{-0.39}$ & $>-2.08$ & $>-2.17$ & $1.01^{+0.02}_{-0.02}$ & $0.008^{+0.022}_{-0.022}$ \\ RXJ1347 & $3.32^{+1.04}_{-0.88}$ & $3.59^{+1.06}_{-0.86}$ & $4.15^{+1.56}_{-1.08}$ & $6.00^{+2.39}_{-2.08}$ & $>-2.49$ & $>-3.14$ & $0.98^{+0.02}_{-0.02}$ & $-0.02^{+0.02}_{-0.02}$ \\ MACSJ1149* & $2.29^{+0.77}_{-0.60}$ & $2.53^{+0.67}_{-0.59}$ & $2.94^{+1.14}_{-0.82}$ & $4.31^{+1.64}_{-1.46}$ & $>-1.13$ & $>-3.26$ & $0.92^{+0.02}_{-0.02}$ & $-0.08^{+0.03}_{-0.02}$ \\ MACSJ0717* & $1.94^{+0.43}_{-0.38}$ & $2.81^{+0.64}_{-0.58}$ & $2.43^{+0.58}_{-0.49}$ & $4.87^{+2.07}_{-4.85}$ & $>-4.43$ & $>-4.79$ & $2.74^{+0.13}_{-0.13}$ & $1.01^{+0.05}_{-0.05}$ \\ MACSJ0647* & $4.44^{+2.12}_{-1.38}$ & $1.43^{+0.50}_{-0.41}$ & $5.63^{+2.63}_{-1.74}$ & $2.28^{+0.99}_{-0.82}$ & $>-1.90$ & $>-2.82$ & $1.01^{+0.03}_{-0.02}$ & $0.006^{+0.028}_{-0.024}$ \\ MACSJ0744 & $4.32^{+1.77}_{-1.23}$ & $1.62^{+0.53}_{-0.42}$ & $5.38^{+2.48}_{-1.62}$ & $2.72^{+1.14}_{-0.96}$ & $>-1.86$ & $>-2.96$ & $0.98^{+0.02}_{-0.02}$ & $-0.02^{+0.02}_{-0.03}$ \\ \hline \hline \end{tabular}} \end{minipage} \end{table*}}} \begin{figure*} \centering \includegraphics[width=8.5cm]{Potential_A611_1.pdf}~~ \includegraphics[width=8.5cm]{Potential_A611_2.pdf} \caption{Gravitational lensing potential (dimensionless) contributions for A611. \textit{Left panel}: total gravitational potential for GR (black) and nonlocal (blue). \textit{Right panel}: $\Phi(r)$ (green) and $\Psi(r)$ (red) contributions; zeroth-order terms are in dark colors, first-order terms are in light color}\label{fig:lensingpotentialA611} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=7.cm]{A383_cM200.pdf}~~~ \includegraphics[width=7.cm]{A209_cM200_100k.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{A2261_cM200.pdf}~~~ \includegraphics[width=7.cm]{RXJ2129_cM200.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{A611_cM200.pdf}~~~ \includegraphics[width=7.cm]{Ms2137_cM200.pdf} \caption{Contour Plot: blue - GR; green - nonlocal.}\label{fig:comparisong_cM_1} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=7.cm]{RXJ2248_cM200.pdf}~~~ \includegraphics[width=7.cm]{MACSJ1115_cM200.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{MACSJ1931_cM200.pdf}~~~ \includegraphics[width=7.cm]{MACSJ1720_cM200.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{MACSJ0416_cM200.pdf}~~~ \includegraphics[width=7.cm]{MACSJ0429_cM200.pdf} \caption{Contour Plot: blue - GR; green - nonlocal.}\label{fig:comparisong_cM_2} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=7.cm]{MACSJ1206_cM200.pdf}~~~ \includegraphics[width=7.cm]{MACSJ0329_cM200.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{RXJ1347_cM200_100k.pdf}~~~ \includegraphics[width=7.cm]{MACSJ1149_cM200.pdf}\\ ~~~\\ \includegraphics[width=7.cm]{MACSJ0717_cM200_100k.pdf}~~~ \includegraphics[width=7.cm]{MACSJ0647_cM200.pdf} \caption{Contour Plot: blue - GR; green - nonlocal.}\label{fig:comparisong_cM_3} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=7.cm]{MACSJ0744_cM200.pdf} \caption{Contour Plot: blue - GR; green - nonlocal.}\label{fig:comparisong_cM_4} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=8.5cm]{NL_GR_5.pdf}~~~ \includegraphics[width=8.5cm]{NL_GR_6.pdf} \caption{Concentrations and masses of CLASH clusters: comparison between our work and $c$--$M$ relations from the literature. Yellow band: $c$--$M$ relation from \citep{Correa:2015dva}; orange band: $c$--$M$ relation from \citep{Diemer:2018vmz}; green band: $c$--$M$ relation for CLASH clusters derived by \cite{Merten2015}. The upper and lower limits of the colored bands correspond to the minimum and maximum redshift values of CLASH clusters.}\label{fig:comparing_cM_literature} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=8.25cm]{A383.pdf}~~~ \includegraphics[width=8.25cm]{A209.pdf}\\ ~~~\\ \includegraphics[width=8.25cm]{A2261.pdf}~~~ \includegraphics[width=8.25cm]{RXJ2129.pdf}\\ ~~~\\ \includegraphics[width=8.25cm]{A611.pdf}~~~ \includegraphics[width=8.25cm]{MS2137.pdf}\\ ~~~\\ \includegraphics[width=8.25cm]{RXJ2248.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ1115.pdf} \caption{Profiles: blue - GR; red - nonlocal.}\label{fig:k_profiles_1} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=8.25cm]{MACSJ1931.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ1720.pdf} ~~~\\ \includegraphics[width=8.25cm]{MACSJ0416.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ0429.pdf}\\ \includegraphics[width=8.25cm]{MACSJ1206.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ0329.pdf}\\ ~~~\\ \includegraphics[width=8.25cm]{RXJ1347.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ1149.pdf} \caption{Profiles: blue - GR; red - nonlocal.}\label{fig:k_profiles_2} \end{figure*} \begin{figure*}[h] \centering \includegraphics[width=8.25cm]{MACSJ0717.pdf}~~~ \includegraphics[width=8.25cm]{MACSJ0647.pdf}\\ ~~~\\ \includegraphics[width=8.25cm]{MACSJ0744.pdf} \caption{Profiles: blue - GR; red - nonlocal.}\label{fig:k_profiles_3} \end{figure*} \bibliographystyle{apsrev4-1}
\section{Introduction and statement of results} \subsection{Introduction} In partition theory, we usually let $p(n)$ denote the number of partitions of $n$. We are not only interested in $p(n)$, but also the number of partitions of $n$ with some restriction. We denote such a number by $p(n\ |\ \mathrm{[condition]})$. For example, $Q(n):=p(n\ |\ \mathrm{distinct\ parts})$ denotes the number of partitions of $n$ into distinct parts. The number of partitions of $n$ in which no parts are multiples of $k$ is denoted by $b_k(n)$, the $k$-regular partitions. $b_k(n)$ is also the number of partitions of $n$ into at most $k-1$ copies of each part. We study $b_3(n)$ in this paper. For example, $b_3(5)=5$ since $$5=5=4+1=3+2=3+1+1=2+2+1$$ \noindent has $5$ such partitions. We define $b_3(0)=1$ by convention. Moreover, let $b_3(n)=0$ if $n$ is not a nonnegative integer. ~ In 1919, Ramanujan found three remarkable congruences of $p(n)$ as follows \begin{equation} \notag \begin{aligned} p(5n+4)&\equiv0\ (\mathrm{mod}\ 5),\\ p(7n+5)&\equiv0\ (\mathrm{mod}\ 7),\\ p(11n+6)&\equiv0\ (\mathrm{mod}\ 11). \end{aligned} \end{equation} In 2000, Ono\cite{ono2000distribution} proved that for each prime number $m$, there exists some arithmetic sequences $An+B$ such that $$p(An+B)\equiv0\ (\mathrm{mod}\ m).$$ Lovejoy\cite{lovejoy2001divisibility} gave similar results for the function $Q(n)$. For example, \begin{equation} \notag \begin{aligned} Q(26645n+76)\equiv0\ (\mathrm{mod}\ 5). \end{aligned} \end{equation} Such congruences are called Ramanujan-type congruences. Surprisingly, $b_3(n)$ also have Ramanujan-type congruences. Lovejoy and Penniston \cite{lovejoy20013} show that there are infinitely many Ramanujan-type congruences of $b_3(n)$ modulo $3$. Recently, Keith and Zanello\cite{keith2022parity} show that there are infinitely many Ramanujan-type congruences of $b_3(n)$ modulo $2$. Up to now, Ramanujan-type congruence of $b_3(n)$ modulo prime $m\geq5$ has not been found. Our main result in this paper is that for each prime $m\geq5$, there are infinitely many Ramanujan-type congruences of $b_3(n)$ modulo $m$. For example, we have \begin{equation} \notag b_3(18605n+127)\equiv0\ (\mathrm{mod}\ 5), \end{equation} \noindent satisfied for each integer $n$. More examples will be given in \textbf{Section} \ref{examples}. \subsection{Statement of results} \begin{theorem} \label{main theorem} Let $m\geq5$ be a prime. A positive density of the primes $l$ have the property that \begin{equation} b_3\left( \frac{mln-1}{12} \right)\equiv0\ (\mathrm{mod}\ m) \end{equation} \noindent for each nonnegative integer $n$ coprime to $l$. \end{theorem} ~ Since the number of selections of $l$ is infinite, choose $l>3$. Replacing $n$ by $12nl+ml+12$, then we have $b_3(ml^2n+ml+(m^2l^2-1)/12)\equiv0\ (\mathrm{mod}\ m)$ satisfied for each nonnegative integer $n$. Hence we obtain ~ \noindent \textbf{Corollary 1.} \textit{If $m\geq5$ is a prime, there are infinitely many Ramanujan-type congruences modulo $m$.} ~ Since the choices of $l$ is infinite, together with the Chinese Remainder Theorem, we obtain ~ \noindent \textbf{Corollary 2.} \textit{If $m$ is a squarefree integer, then there are infinitely many Ramanujan-type congruences modulo $m$.} ~ \noindent \textbf{Corollary 3.} \textit{If $m\geq5$ is a prime, then there are infinitely many positive integers $n$ for which} $$b_3(n)\equiv0\ (\mathrm{mod}\ m).$$ \noindent \textit{More precisely, we have} $$\#\{ 0\leq n\leq X\ :\ b_3(n)\equiv0\ (\mathrm{mod}\ m) \}\gg X.$$ ~ For other residue classes $i\not\equiv0\ (\mathrm{mod}\ m)$, we provide a useful criterion to verify whether there are infinitely many $n$ such that $b_3(n)\equiv i\ (\mathrm{mod}\ m)$. \begin{theorem} \label{other residue classes} If $m\geq5$ is a prime and there is one $k\in\mathbb{Z}$ such that $$b_3\left( mk+\frac{m^2-1}{12} \right)\equiv e\not\equiv0\ (\mathrm{mod}\ m),$$ \noindent then for each $i=1,2,\cdots,m-1$, we have $$\#\{ 0\leq n\leq X\ :\ b_3(n)\equiv i\ (\mathrm{mod}\ m) \}\gg \frac{X}{\log X}.$$ \noindent Moreover, if such $k$ exists, then $k<18(m-1)$. \end{theorem} \section{Preliminaries} \subsection{Notation and definitions} First we introduce the $U$ operator. If $j$ is a positive integer, then \begin{equation} \left( \sum_{n=0}^\infty a(n)q^n \right)\ |\ U(j):=\sum_{n=0}^\infty a(jn)q^n. \end{equation} \noindent Recalling that Dedekind's eta function is defined by \begin{equation} \eta(z)=q^\frac{1}{24}\prod_{n=1}^\infty (1-q^n), \end{equation} \noindent where $q=e^{2\pi iz}$. ~ If $m$ is a prime, then let $M_{k}(\Gamma_0(N),\chi)_m$(resp. $S_{k}(\Gamma_0(N),\chi)_m$) denote the $\mathbb{F}_m$-vector space of the reductions mod $m$ of the $q$-expansions of modular forms(resp. cusp forms) in $M_{k}(\Gamma_0(N),\chi)$(resp. $S_{k}(\Gamma_0(N),\chi)$) with integer coefficients. ~ Sometimes, we will use the notation $a\equiv_m b$ in the place of $a\equiv b\ (\mathrm{mod}\ m)$ for convenience. \subsection{Some useful results} We need the following theorem to construct modular forms\cite[Theorem 3]{gordon1993multiplicative}: \begin{theorem}[B. Gordon, K. Hughes] \label{eta-quotient} Let $$f(z)=\prod_{\delta|N}\eta^{r_\delta}(\delta z)$$ \noindent be a $\eta$-quotient provided ~ \noindent $\mathrm{(\romannumeral1)}$ $$\sum_{\delta|N}\delta r_\delta\equiv0\ (\mathrm{mod}\ 24);$$ $\mathrm{(\romannumeral2)}$ $$\sum_{\delta|N}\frac{Nr_\delta}{\delta}\equiv0\ (\mathrm{mod}\ 24);$$ $\mathrm{(\romannumeral3)}$ $$k:=\frac{1}{2}\sum_{\delta|N}r_\delta\in\mathbb{Z},$$ \noindent then $$f\left(\frac{az+b}{cz+d}\right)=\chi(d)(cz+d)^kf(z),$$ \noindent for each $\begin{pmatrix} a & b\\ c & d \end{pmatrix}\in\Gamma_0(N)$ and $\chi$ is a Dirichlet character $(\mathrm{mod}\ N)$ defined by $$\chi(n):=\left( \frac{(-1)^k\prod_{\delta|N}\delta^{r_\delta}}{n} \right),\ if\ n>0\ and\ (n,6)=1.$$ \end{theorem} ~ If $f(z)$ is holomorphic (resp. vanishes) at all cusps of $\Gamma_0(N)$, then $f(z)\in M_k(\Gamma_0(N),\chi)$ (resp. $S_k(\Gamma_0(N),\chi)$), since $\eta(z)$ is never vanishes on $\mathcal{H}$. The following theorem (c.f. \cite{martin1996multiplicative}) provide a useful criterion for compute the orders of an $\eta$-quotient at all cusps of $\Gamma_0(N)$. \begin{theorem}[Y. Martin] \label{order of cusp} Let $c$, $d$ and $N$ be positive integers with $d\,|\,N$ and $(c,d)=1$. If $f(z)$ is an $\eta$-quotient satisfying the conditions of Theorem \ref{eta-quotient}, then the order of vanishing of $f(z)$ at the cusp $\frac{c}{d}$ is $$\frac{N}{24}\sum_{\delta|N}\frac{r_\delta(d^2,\delta^2)}{\delta(d^2,N)}.$$ \end{theorem} ~ We need some important results due to Serre (c.f. \cite[(6.4)]{serre1974divisibilite}), which are the critical factors of the existence of Ramanujan-type congruences. \begin{theorem}[J-P. Serre] \label{Serre's theorem} The set of primes $l\equiv-1\ (\mathrm{mod}\ Nm)$ such that $$f\ |\ T(l)\equiv0\ (\mathrm{mod}\ m)$$ \noindent for each $f(z)\in S_k(\Gamma_0(N),\psi)_m$ has positive density, where $T(l)$ denotes the usual Hecke operator acting on $S_k(\Gamma_0(N),\psi)$. \end{theorem} ~ \begin{theorem}[J-P. Serre] \label{Serre's theorem v2} The set of primes $l\equiv1\ (\mathrm{mod}\ Nm)$ such that $$a(nl^r)\equiv(r+1)a(n)\ (\mathrm{mod}\ m)$$ \noindent for each $f(z)=\sum_{n=0}^\infty a(n)q^n\in S_k(\Gamma_0(N),\psi)_m$ has positive density, where $r$ is a positive integer and $n$ is coprime to $l$. \end{theorem} ~ Here we introduce a theorem of Sturm(\textbf{Theorem 1} of \cite{sturm1987congruence}), which provide a useful criterion for deciding when modular forms with integer coefficients are congruent to zero modulo a prime via finite computation. \begin{theorem}[J. Sturm] \label{Sturm's theorem} Suppose $f(z)=\sum_{n=0}^\infty a(n)q^n\in M_k(\Gamma_0(N),\chi)_m$ such that $$a(n)\equiv0\ (\mathrm{mod}\ m)$$ \noindent for all $n\leq \frac{kN}{12}\prod_{p|N}\left( 1+\frac1p \right)$. Then $a(n)\equiv0\ (\mathrm{mod}\ m)$ for all $n\in\mathbb{Z}$. \end{theorem} \section{Proof of the results} \begin{proof}[Proof of Theorem \ref{main theorem}] We begin with an $\eta$-quotient \begin{equation} f(m;z):=\frac{\eta(3z)}{\eta(z)}\eta^a(3mz)\eta^b(mz), \end{equation} \noindent where $a:=9-(m\ \mathrm{mod}\ 12)$ and $b:=(m\ \mathrm{mod}\ 12)-3$. Let $m'=m\ \mathrm{mod}\ 12$. ~ It is easy to verify that $f(m;z)\equiv_m\eta^{am+1}(3z)\eta^{bm-1}(z)$ satisfies the conditions of Theorem \ref{eta-quotient}. Moreover, one can compute via Theorem \ref{order of cusp} that $\eta^{am+1}(3z)\eta^{bm-1}(z)$ has the minimal order of vanishing of $(m(3a+b)+2)/24$ at the cusp $\infty$ and $(m(a+3b)-2)/24$ at the cusp $0$. ~ Since $(m(3a+b)+2)/24=(m(12-m')+1)/12>0$ and $(m(a+3b)-2)/24=(mm'-1)/12>0$, $\eta^{am+1}(3z)\eta^{bm-1}(z)\in S_{3m}(\Gamma_0(3),\chi_3)$, where $\chi_3(n)$ is defined by: $$\chi_3(n)=\left\{\begin{matrix} 0, & n\equiv0\ (\mathrm{mod}\ 3);\\ 1, & n\equiv1\ (\mathrm{mod}\ 3);\\ -1, & n\equiv2\ (\mathrm{mod}\ 3). \end{matrix}\right.$$ ~ On the other hand, \begin{equation} f(m;z)=\sum_{n=0}^\infty b_3(n)q^{n+\frac{m(3a+b)+2}{24}}\cdot\prod_{n=1}^\infty(1-q^{3mn})^a(1-q^{mn})^b. \end{equation} \noindent Thus, \begin{equation} \label{after U(m)} \left(\sum_{n=0}^\infty b_3(n)q^{n+\frac{m(3a+b)+2}{24}}\ |\ U(m)\right)\cdot\prod_{n=1}^\infty(1-q^{3n})^a(1-q^{n})^b\equiv_m\eta^{am+1}(3z)\eta^{bm-1}(z)\ |\ U(m). \end{equation} ~ As for LHS of (\ref{after U(m)}), $$\sum_{n=0}^\infty b_3(n)q^{n+\frac{m(3a+b)+2}{24}}\ |\ U(m)={\sum_{n\geq0}}^* b_3(n)q^{\frac{24n+m(3a+b)+2}{24m}},$$ \noindent where ${\sum}^*$ means take integral power coefficients of $q$, i.e. $$24n+m(3a+b)+2\equiv0\ (\mathrm{mod}\ 24m).$$ \noindent It is easy to check that $24\,|\,24n+m(3a+b)+2$. Thus the condition becomes $m\,|\,12n+1$. ~ As for RHS of (\ref{after U(m)}), we have $$\eta^{am+1}(3z)\eta^{bm-1}(z)\ |\ U(m)\equiv_m\eta^{am+1}(3z)\eta^{bm-1}(z)\ |\ T(m),$$ \noindent where $T(m)$ denotes usual Hecke operator acting on $S_{3m}(\Gamma_0(3),\chi_3)$. Now we analyze the $\eta$-product $\eta^6(z)\eta^6(3z)$. By Theorem \ref{eta-quotient} and Theorem \ref{order of cusp}, $\eta^6(z)\eta^6(3z)$ is a cusp form of weight $6$ and level $3$ and has the minimal order of vanishing of $1$ at the two cusps of $\Gamma_0(3)$. Since $\eta(z)$ never vanishes on $\mathcal{H}$, we can write $\eta^{am+1}(3z)\eta^{bm-1}(z)\ |\ T(m)=\eta^6(z)\eta^6(3z)g(m;z)$, where $g(m;z)\in M_{3m-6}(\Gamma_0(3),\chi_3)$. In summary, we have \begin{equation} \label{b_3(n)} \sum_{\genfrac{}{}{0pt}{}{n\geq0}{m|12n+1}} b_3(n)q^{\frac{24n+m(3a+b)+2}{24m}}\equiv_m\frac{\eta^6(z)\eta^6(3z)g(m;z)}{\prod_{n=1}^\infty(1-q^{3n})^a(1-q^{n})^b}. \end{equation} Replacing $q$ by $q^{12}$ and then multiplying by $q^{-(3a+b)/2}$ on both sides of (\ref{b_3(n)}), obtaining $$\sum_{\genfrac{}{}{0pt}{}{n\geq0}{m|12n+1}} b_3(n)q^{\frac{12n+1}{m}}\equiv_m\eta^{6-a}(36z)\eta^{6-b}(12z)g(m;12z),$$ \noindent namely, $$\sum_{n=0}^\infty b_3\left(\frac{mn-1}{12}\right)q^n\equiv_m\eta^{6-a}(36z)\eta^{6-b}(12z)g(m;12z).$$ Using Theorem \ref{eta-quotient} and Theorem \ref{order of cusp} again, one can verity that $\eta^{6-a}(36z)\eta^{6-b}(12z)$ is a cusp form of weight $3$ and level $432$ and has the minimal order of vanishing of $m'$ at the cusps $\frac cd$ if $d=1,2,3,4,6,8,12,16,24,48$ and $12-m'$ if $d$ is other divisor of $432$. Therefore we obtain $$\eta^{6-a}(36z)\eta^{6-b}(12z)\in S_3\left(\Gamma_0(432),\left( \frac{-1}{\bullet} \right)\right),$$ \noindent where $\left( \frac{-1}{n} \right)=(-1)^{\frac{n-1}{2}}$. Let \begin{equation} F(m;z):=\eta^{6-a}(36z)\eta^{6-b}(12z)g(m;12z)=\sum_{n=0}^\infty a(n)q^n, \end{equation} \noindent then $F(m;z)\in S_{3m-3}(\Gamma_0(432),\chi_{12})$, where $\chi_{12}(n)=\left( \frac{3}{|n|} \right)$ if $n$ is odd. ~ For a fix prime $m\geq5$, let $S(m)$ denote the of primes $l$ such that $$f\ |\ T(l)\equiv0\ (\mathrm{mod}\ m)$$ \noindent for each $f\in S_{3m-3}(\Gamma_0(432),\chi_{12})$. By Theorem \ref{Serre's theorem}, $S(m)$ contains a positive density of primes. So if $l\in S(m)$, we have $$F(m;z)\ |\ T(l)\equiv0\ (\mathrm{mod}\ m).$$ \noindent Then by the theory of Hecke operator we have \begin{equation} F(m;z)\ |\ T(l)=\sum_{n=0}^\infty\left( a(ln)+\left(\frac{3}{l}\right)l^{3m-4}a\left(\frac{n}{l}\right) \right)q^n\equiv0\ (\mathrm{mod}\ m). \end{equation} Since $a(n)$ vanishes when $n$ is not an integer, $a\left(n/l\right)=0$ for each $n$ coprime to $l$. Thus $a(ln)\equiv0\ (\mathrm{mod}\ m)$ for each $n$ coprime to $l$. Recalling that $b_3\left(\frac{mn-1}{12}\right)\equiv a(n)\ (\mathrm{mod}\ m)$, we obtain $$b_3\left(\frac{mln-1}{12}\right)\equiv 0\ (\mathrm{mod}\ m)$$ \noindent satisfied for each integer $n$ coprime to $l$. Moreover, the set of such primes $l$ has a positive density of primes. \end{proof} ~ \begin{proof}[Proof of Theorem \ref{other residue classes}] If there is one $k\in\mathbb{Z}$ such that $$b_3\left( mk+\frac{m^2-1}{12} \right)\equiv e\not\equiv0\ (\mathrm{mod}\ m),$$ \noindent let $s=12k+m$. Since $b_3(n)$ vanishes for negative $n$, we have $mk+\frac{m^2-1}{12}\geq0$. Hence $s=12k+m>0$ and $$b_3\left(\frac{ms-1}{12}\right)=b_3\left( mk+\frac{m^2-1}{12} \right)\equiv e\ (\mathrm{mod}\ m).$$ \noindent For a fix prime $m\geq5$, let $R(m)$ denote the set of primes $l$ such that $$a(nl^r)\equiv(r+1)a(n)\ (\mathrm{mod}\ m)$$ \noindent for each $f(z)=\sum_{n=0}^\infty a(n)q^n\in S_{3m-3}(\Gamma_0(432),\chi_{12})_m$, where $r$ is a positive integer and $n$ is coprime to $l$. By the proof of Theorem \ref{main theorem} we have $\sum_{n=0}^\infty b_3\left(\frac{mn-1}{12}\right)q^n\in S_{3m-3}(\Gamma_0(432),\chi_{12})_m$. Since $R(m)$ is infinite by Theorem \ref{Serre's theorem v2}, choose $l\in R(m)$ such that $l>s$, then $$b_3\left(\frac{ml^rs-1}{12}\right)\equiv(r+1)b_3\left(\frac{ms-1}{12}\right)\equiv(r+1)e\ (\mathrm{mod}\ m).$$ \noindent Now we fix $l$, choose $\rho\in R(m)$ such that $\rho>l$, then \begin{equation} \label{rho} b_3\left(\frac{m\rho n-1}{12}\right)\equiv2b_3\left(\frac{mn-1}{12}\right)\ (\mathrm{mod}\ m) \end{equation} \noindent satisfied for each $n$ coprime to $\rho$. For each $i=1,2,\cdots,m-1$, let $r_i\equiv i(2e)^{-1}-1\ (\mathrm{mod}\ m)$ and $r_i>0$. Let $n=l^{r_i}s$ in (\ref{rho}), we obtain $$b_3\left(\frac{m\rho l^{r_i}s-1}{12}\right)\equiv2b_3\left(\frac{ml^{r_i}s-1}{12}\right)\equiv2(r_i+1)e\equiv i\ (\mathrm{mod}\ m).$$ Since the variables except $\rho$ are fixed, it suffice to prove that the estimate of the choices of $\rho\gg X/\log X$ and which is easily derived from Theorem \ref{Serre's theorem v2} and the Prime Number Theorem. ~ Moreover, by Sturm's Theorem, if $b_3\left( \frac{mn-1}{12} \right)\equiv0\ (\mathrm{mod}\ m)$ for each $n\leq216(m-1)$, then $b_3\left( \frac{mn-1}{12} \right)\equiv0\ (\mathrm{mod}\ m)$ for all $n\in\mathbb{Z}$. Since $b_3(n)$ vanishes if $n$ is not an integer, it suffice to compute those $n$ of the form $12j+m$ for $12j+m\leq216(m-1)$. This implies $j<18(m-1)$. In addition, $$b_3\left( \frac{m(12j+m)-1}{12} \right)=b_3\left( mj+\frac{m^2-1}{12} \right).$$ \noindent Thus if such $k$ exist, then $k<18(m-1)$. \end{proof} \section{Examples of Ramanujan-type congruences} \label{examples} By Theorem \ref{Sturm's theorem} we find that $$F(m;z)\ |\ T(l)\equiv0\ (\mathrm{mod}\ m)$$ \noindent for the pairs $(m,l)=(5,61)$, $(7,71)$, $(11,12553)$. An elementary computation yields that ~ \noindent \textbf{Proposition 8.} \begin{equation} \notag b_3(18605n+127)\equiv0\ (\mathrm{mod}\ 5), \end{equation} \begin{equation} \notag b_3(35287n+207)\equiv0\ (\mathrm{mod}\ 7), \end{equation} \begin{equation} \notag b_3(1733355899n+126576)\equiv0\ (\mathrm{mod}\ 11). \end{equation} ~ \noindent Our method is not available to the case $m=3$, but one can prove that there are infinitely many Ramanujan-type congruences modulo $3$ via result of Lovejoy and Penniston \cite[Corollary 4]{lovejoy20013}. ~ \noindent \textbf{Proposition 9.} If $m$ is a prime of the form $12i+1$, then $$b_3\left(m^3n+\frac{m^2-1}{12}\right)\equiv0\ (\mathrm{mod}\ 3).$$ ~ \noindent For example, we obtain $$b_3\left(2197n+14\right)\equiv0\ (\mathrm{mod}\ 3).$$ \section{Open problems} We prove that for each squarefree integer $m$ that there are infinitely many Ramanujan-type congruences modulo $m$ in this paper. In fact, we conjecture that ~ \noindent \textbf{Conjecture 1.} \textit{For each positive integer $m$ that there are infinitely many Ramanujan-type congruences modulo $m$.} ~ We also have the following conjecture analogous to Newman's Conjecture. ~ \noindent \textbf{Conjecture 2.} \textit{If $m$ is an integer, then for each residue class $r\ (\mathrm{mod}\ m)$ there are infinitely many integers $n$ for which $b_3(n)\equiv r\ (\mathrm{mod}\ m)$.}
\section{Conclusions} \label{sec:conclusions} This paper examines challenges quantum program developers are facing by analyzing Stack Exchange forums posts related to QSE and the GitHub issue reports of quantum computing projects. Results indicate that QSE developers face traditional software engineering challenges (e.g., dependency management) as well as QSE-specific challenges (e.g., interpreting quantum program execution results). In particular, some QSE-related areas (e.g., bridging the knowledge gap between quantum and classical computing) are gaining the highest attention from developers while being very challenging to them. As the initial effort for understanding QSE-related challenges perceived by developers, our work shed light on future opportunities in QSE (e.g., supporting explanations of theory behind quantum program code and the interpretations of quantum program execution results). \begin{comment} Based on an existing taxonomy of question categories on Stack Overflow, we first perform a qualitative analysis of the categories of QSE-related questions. We find nine categories of questions, among which four are new or more frequent in QSE-related posts. We also use automated topic modeling to uncover the topics in QSE-related Q\&A posts and issue reports. We find overlapping and mutually complementary topics in these two types of data, which include traditional software engineering topics (e.g., dependency management) and QSE-specific topics (e.g., quantum program execution). In particular, some topics (e.g., Quantum simulator) are gaining the highest attention while being much more difficult than others to find accepted answers. \end{comment} \subsection*{\textbf{RQ1: Categories of QSE questions on technical Q\&A forums}} \vspace{-3pt} \subsection*{\textbf{RQ1: What types of QSE questions are asked on technical forums?}} \subsubsection{\textbf{Motivation}} In order to understand QSE challenges developers are facing, we first want to understand what types of questions they are asking (e.g., whether they are asking questions about using APIs or fixing errors). This is important to identify the areas in which QSE developers should be supported and the type of resources that they need. Similar to prior work~\cite{beyer2020kind}, we focus on the intent behind the questions asked by QSE developers instead of the topics of the questions. \subsubsection{\textbf{Approach}} To identify the type of questions that users are asking in technical forums, we performed a manual analysis of a statistically representative sample from our studied QSE questions. We sampled 323 questions with a confidence level of 95\% and a confidence interval of 5\%. For each question, we examined its title and body, to understand the intent of the user who posted the question. We used a hybrid card sorting approach to perform the manual analysis and assign labels (i.e., types of questions) to each sampled question. Specifically, we based our manual analysis on an existing taxonomy of the types of questions asked on Stack Overflow~\cite{beyer2020kind} and added new types when needed. For each question we assigned one label; in case a question is associated with two or more labels, which we found only in a few cases, we chose the most relevant one. \noindent \textbf{Hybrid card sorting process.} Two authors of the paper (i.e., coders) jointly performed the hybrid card sorting. We split the sampled data into two equal subsets and performed the sorting in two rounds, similar to prior work~\cite{li2020qualitative}. Our process guaranteed that each question is labelled by both coders. \begin{enumerate} \item \textbf{First-round labeling.} Each coder labels a different half of the questions independently. \item \textbf{First-round discussion.} In order to have a consistent labeling strategy, we had a meeting to discuss the labeling results in the first round and reached an agreed-upon set of labels. A third author of the paper is involved in the discussion. \item \textbf{Revising first-round labels.} Each coder updated the first round labeling results based on the discussion. \item \textbf{Second-round labeling.} Each coder labeled the other half of the questions independently based on the agreed-upon labels in the first round. New labels are allowed in this round. \item \textbf{Second-round discussion.} We had a meeting to discuss the second-round labeling results, validate newly added labels and verify the consistency of our labels. A third author is also involved in the discussion. \item \textbf{Revising second-round labels.} Based on the second-round discussion, each coder revised the labels and finalized its individual labeling of the questions. We calculate the inter-coder agreement after this step. \item \textbf{Resolving disagreement.} We had a final meeting to resolve the disagreement in our labeling results and reached the final label for each question. For each difference in our labels, the two coders and a third author discussed the conflict and reached a consensus. \end{enumerate} \noindent \textbf{Inter-coder agreement. } We measured the inter-coder agreement between the coders and obtained a Cohen’s kappa $k$ value of 0.73 which indicates a substantial agreement~\cite{MaryMcHugh}. Therefore our manual labeling results are reliable. \subsubsection{\textbf{Results}} \input{tables/QA_taxonomy} Table \ref{table:intent} shows the result of our qualitative analysis for identifying the categories of questions in technical forums. Among the 323 questions we analyzed, we could not assign a label to only one question. In the table, we provide the description of each category and how frequent it appears in our qualitative analysis. \noindent \textbf{All seven categories of Stack Overflow questions identified in prior work appear in QSE-related posts.} Prior work~\cite{beyer2020kind} identified seven categories of questions on Stack Overflow by studying Android-related questions, including \texttt{API usage}, \texttt{Conceptual}, \texttt{Discrepancy}, \texttt{Errors}, \texttt{Review}, \texttt{API change}, and \texttt{Learning}, ordered by their occurrence frequency. Although quantum computing is still a new area, people start to ask all these different categories of questions, indicating that quantum computing face similar software engineering challenges (e.g., \texttt{API usage} and \texttt{API change}) as other software engineering domains. Similar to prior work, we find that \texttt{API usage} is the most frequent category with 26.3\% instances. The questions of this category are usually identified by ``how to''; e.g., ``\textit{How to return measurement probabilities from the QDK Full-state simulator?}'' \noindent \textbf{The categories of \texttt{Errors} and \texttt{Learning} are relatively more frequent in QSE-related questions than in the prior taxonomy of question categories~\cite{beyer2020kind}.} Compare to prior work~\cite{beyer2020kind} on classifying Android-related questions, we find that \texttt{Errors} and \texttt{Learning} questions are relatively more frequent. As quantum computing is still an emerging domain, people practicing it face many errors when developing quantum computing applications and they find it challenging to find learning resource for quantum computing. An example of the \texttt{Errors} category is ``\textit{I have Qiskit installed via Anaconda and a virtual environment set up in Python 3.8. ... I get an error. I'm not sure what the problem is. How do I fix it?}''. Another example for the \texttt{Learning} category is ``\textit{How do I learn Q\#? What languages should I know prior to learning Q\#? How do I get started with quantum computing?}''. These findings suggest the need to develop tools or resources to help developers avoid or address such errors, as well as developing tutorials, books, and other learning resources to help beginners get acquainted with quantum computing. \noindent \textbf{Two new categories of questions (i.e., \texttt{Theoretical} and \texttt{Tooling}) emerge in QSE-related posts.} In fact, the category of \texttt{Theoretical} is the second most frequent among all categories. This category is usually associated with keywords such as ``can someone explain'', ``what is'', and ``does quantum''. An example question of this category is ``What is the analysis of the Bell Inequality protocol in Cirq's `examples'?'' where Cirq\cite{cirq_developers_2021_4586899} is a Python library for developing quantum computing applications. This category of questions indicates that people have challenges understanding the theoretical concepts behind quantum computing code. Future efforts are needed to explain such theoretical concepts for developers. The category of \texttt{tooling} represents questions that are looking for tools, frameworks, or libraries that can help solve a QSE-related problem or verifying whether a tool, framework, or library can help solve a problem. For example, ``\textit{I want to use Blender and Blender Python Scripts working with Qiskit. How can I do this? How to make communication between Blender and Qiskit installed with Anaconda Python?}''. This category indicates the lack of established tools for supporting quantum program development. \begin{tcolorbox} \vspace{-2mm} We identified nine categories of QSE-related questions in Stack Exchange forums. The categories \texttt{Theoretical}, \texttt{Errors}, \texttt{Learning}, and \texttt{Tooling} are new or become more frequent in QSE-related questions. Our results highlight the need for future efforts to support developers' quantum program development, in particular, to develop learning resources, to help developers fix errors, and to explain theory behind quantum computing code. \vspace{-2mm} \end{tcolorbox} \subsection{\textbf{RQ2: QSE topics in technical Q\&A forums}} \vspace{-5pt} \subsection*{\textbf{RQ2: What QSE topics are raised in technical forums?}} \setcounter{subsubsection}{0} \subsubsection{\textbf{Motivation}} Developers post QSE-related questions and answers on technical forums. Their posts may reflect their faced challenges when learning or developing quantum programs. To understand their faced challenges, we use topic models to extract the semantic topics in their posts and analyze the characteristics of these topics. \subsubsection{\textbf{Approach}} \noindent \textbf{Topic assignment and frequency.} The automated topic modeling generated nine topics and distribution of co-occurring words in each topic. We then manually assigned a meaningful label to each topic. Following prior work\cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667}, to assign a meaningful label to a topic, the first author first proposed labels using two pieces of information: (1) the topic's top 20 keywords, and (2) the top 10-15 most relevant questions associated with the topic. Then, three authors of the paper reviewed the labels in meetings and reassigned the labels when needed. We obtained a meaningful label for each of the nine topics at the end. For each topic, we measure the percentage of the posts (i.e., frequency) that have it as the dominant topic (i.e., with the highest probability). \noindent \textbf{Topic popularity.} To understand developers' attention towards each topic, following previous work \cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667}, we measured three metrics for each topic: (1) the median number of views of the associated posts, (2) the median number of associated posts marked as \texttt{favorite}, and (3) the median score of the associated posts. For each topic, the associated posts refer to the posts that have it as the dominant topic. \begin{comment} \begin{itemize} \item We group the posts by the dominant topic label. \item We aggregate the number of views, number of posts and post score with median aggregation function. \end{itemize} Hence \textbf{the topic is popular if he has the most number of view and the highest number of favorite and score}. \end{comment} \noindent \textbf{Topic difficulty.} In order to better understand the most challenging aspects for developers, we measure the difficulty of each topic in terms of how difficult it is for the associated posts to get accepted answers. Following prior work \cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667 }, for each topic, we measure two metrics: (1) the percentage of the associated questions with no accepted answer, and (2) the median time required by the associated questions to get an accepted answer (only considering the ones with an accepted answer). For each topic, the associated questions refer to the questions that have the topic as the dominant topic. \begin{comment} \begin{itemize} \item We group the posts by dominant topic label \item (1) We compute the percentage of the number of topics with and without accepted answer. \item (1) We select only the percentage of posts with no accepted answer. \item (2) We compute the difference between the date of an accepted answers and the creation data in hour per post. \item (2) We aggregate the median time required by the question to get an accepted answer with median aggregation function. \end{itemize} Hence \textbf{The topic is difficult if after a long waiting time he receives a few answers.}. \end{comment} \subsubsection{\textbf{Results}} \input{tables/tableQAtopics} \noindent \textbf{We derived nine topics that are discussed in QSE-related posts, including traditional software engineering topics (e.g., \texttt{environment management} and \texttt{dependency management}) and QSE-specific topics (e.g., \texttt{quantum execution results} and \texttt{Quantum circuits})}. Table \ref{table:QA_topic} describes the nine topics and their frequency in the analyzed posts. Table~\ref{table:QA popularity} shows the median views, scores, and favorites of the posts associated with these topics. The three most dominant topics are \texttt{environment management}, \texttt{dependency management}, and \texttt{algorithm complexity}. \textbf{\texttt{Environment management}} is the most dominant topic representing 15.03\% of posts. For example, the most viewed question of this topic is ``\textit{I downloaded the Quipper package but I have not been able to get haskell to recognize where all of the modules and files are and how to properly link everything}'' which gained 2772 views. Other examples include ``How can I run QCL (quantum programming language) on Windows?'' and ``Visualization of Quantum Circuits when using IBM QISKit''. We can observe that users are new to quantum computing and facing problem while setting up their environment and installing their tools. This topic is also linked to the question category \texttt{tooling} that we derived in RQ1. \textbf{\texttt{Dependency management}} is the second most discussed topic representing 14.82\% of the posts. For example, the most viewed question (with 2,239 views) of this topic is ``\textit{When trying the above code, I am receiving the following error: ModuleNotFoundError: No module named qiskit}'' where \texttt{qiskit} is an open source framework for quantum program development\cite{Qiskit}. We noticed that a large number of questions are directly related to \texttt{qiskit}. This can be explained by the lack of documentation or tutorials in using this framework. \textbf{\texttt{Algorithm complexity}} is the third most dominant topic. This topic is about understanding the complexity of quantum algorithms and how to optimize quantum algorithms. For example, the most viewed question of this topic is ``\textit{For the other algorithms, I was able to find specific equations to calculate the number of instructions of the algorithm for a given input size (from which I could calculate the time required to calculate on a machine with a given speed). However, for Shor's algorithm, the most I can find is its complexity: O( (log N)$^3$ )}'', which receives 4,718 views. This topic is linked to the questions category \texttt{theoretical} derived from RQ1. This topic indicates developers' challenge in understanding the complexity of quantum algorithms. \noindent\textbf{As quantum programming is oriented to searching solutions in a probabilistic space, which is counter-intuitive from the classical computing perspective, understanding \texttt{quantum execution results} is particularly challenging for developers.} As a Qubit can be 0 or 1 with a certain probability, a quantum program that has Qubits as its basic units can have many different states at the same time. The results of a quantum program are certain only when the results are observed (or ``measured''). Therefore, it is more challenging for developers to understand the results of quantum programs than that of classical programs. For example ``How to plot histogram or Bloch sphere for multiple circuits? I have tried to plot a histogram for the multiple circuits for the code given below. I think I have done it correctly but don't know why it's not working. Please help me out. If possible please solve it for the Bloch sphere'' Future efforts are needed to interpret quantum program outputs. \begin{comment} \begin{figure}[htbp] \vspace{-2mm} \centerline{\includegraphics[width=0.5\textwidth]{graphs/evolution.png}} \caption{Q\&A forums topics evolution overtime \label{figure:QAevolution} \vspace{-2mm} \end{figure} QSE has a distinct characteristic for each topic. For example, algorithm complexity is more focused on studying adopting and optimizing classical algorithms to quantum computing. The user's challenges evolve along with the topics associated. Therefore, in order to understand the topics evaluations, in figure \ref{figure:QAevolution} we show the trends of QSE topics between 2012 and 2020. For most topics, the trend starts gradually to increase. Quantum simulators started to get interested in 2012 compared to the rest of the topic. In 2014 the all QSE topic's the number of question and answers increased while in 2016 we observe the exponential jump of QSE posts in the Q\&A forums. The massive increase in the number of posts related to QSE indicates the growing interest in quantum computing by the software engineering community. Moreover as shown in figure \ref{figure:QAevolution} the trend is not showing any signs of decreasing in the future. We further study the popularity in QSE topics in the technical forum posts.\textbf{The number of QSE-related posts started to grow exponentially after 2017. In particular, the topics of Quantum algorithm understanding, quantum execution results and Quantum circuits which emerged in 2017 becomes the most frequent topic recently.} \end{comment} \input{tables/popularityQA} \noindent\textbf{Posts related to \texttt{quantum vs.} \texttt{classical computing} are gaining the most attention from developers.} Since quantum computing is based on a new philosophy different from classical computing, developers often ask questions about the differences and look to understand the new doors quantum computing is opening. According to Table~\ref{table:QA popularity}, posts with this topic receive the highest median number of views. This may show that software engineers are eager to contribute to QSE by starting from the differences between the two paradigms. However, as shown in Figure~\ref{figure:QAdifficulty}, posts on this topic are least likely to receive accepted answers. Our results indicate the need for resources and tools for bridging the knowledge gap between quantum computing and classical computing. \begin{figure}[!t] \vspace{-2mm} \centering \centerline{\includegraphics[width=0.5\textwidth]{graphs/QAdifficulty.png}} \caption{The difficulty aspect of QSE-related topics on Stack Exchange forums} \label{figure:QAdifficulty} \vspace{-8mm} \end{figure} \textbf{Questions of some topics (e.g., \texttt{environment management}) are much more difficult than others to receive accepted answers}. According to Figure \ref{figure:QAdifficulty}, the topic \texttt{environment management} is the most difficult topic to answer, with 61\% of posts not receiving an accepted answer and a median time of 12 hours to receive an accepted answer. \texttt{Learning resources}, \texttt{quantum vs. classical computing} and \texttt{data structures and operations} are also among the most difficult topics in terms of the ratio of posts getting accepted answers and the time to get one. The results indicate the lack of community support in aspects such as setting up a development environment, searching for learning resources, and understanding differences between quantum computing and classical computing, which could impair the advancement of quantum software development practices. \begin{tcolorbox} \vspace{-2mm} From Q\&A forums, we derived nine topics discussed in QSE-related posts, including traditional software engineering topics (e.g., \texttt{environment management}) and QSE-specific ones (e.g., \texttt{quantum execution results}). We highlighted some particularly challenging areas for QSE, such as interpreting quantum program outputs and bridging the knowledge gap between quantum computing and classical computing. \vspace{-2mm} \end{tcolorbox} \subsection*{\textbf{RQ3: What QSE topics are raised in the issue reports of quantum-computing projects?}} \input{tables/git_topics} \setcounter{subsubsection}{0} \subsubsection{\textbf{Motivation}} Issue reports of quantum computing projects record developers' concerns and discussions when adding features or resolving issues in these projects. The textual information in the issue reports may communicate developers' challenges when developing quantum computing applications. Therefore, we analyze the topics in the issue reports to understand the challenges developers are facing as well as the prevalence of these challenges. While the questions on technical forums can provide information about developers' general challenges, the issue reports may communicate developers' challenges for specific problems (i.e., issues). \subsubsection{\textbf{Approach}} \noindent \textbf{Topic assignment and frequency.} Our topic model on the issue report data generated 17 topics. We follow the same process as described in RQ2 to manually assign meaningful labels to the automated topics, based on the top words in the topics and the content of the associated issue reports. During the manual assignment process, we found that some topics are similar to each other even though such similarity is not detected by the probabilistic topic model. Therefore, we follow prior work~\cite{noei2019too, rosen2016mobile} and merged similar topics. We also discarded one topic as we could not derive a meaningful label from the top words and the associated issue reports. In the end, we obtained 13 meaningful topics. For each topic, we measure the percentage of the issue reports (i.e., frequency) that have it as the dominant topic (i.e., with the highest probability). We also measure the number and percentage of the studied projects that have at least one issue report of each topic. \noindent \textbf{Topic difficulty.} To further understand developers' challenges in developing quantum computing applications, we measure the ``difficulty'' of the issue reports associated with each topic. As we cannot directly measure the ``difficulty'' of issue reports, we measure three indirect metrics for each topic: (1) the percentage of issue reports associated with the topic that is \texttt{closed}, (2) the median time required to close an issue (since its creation) associated with the topic, and (3) the median number of comments in an associated topic (intuitively, an issue report with more comments may be more difficult \cite{Khomh11}). For each topic, the associated issue reports refer to the issue reports that have it as the dominant topic. \begin{comment} \begin{itemize} \item We group the issues by dominant topic label \item We compute the difference between the closer date and the creation date in hour per issue. \item We aggregate the time required by the issue to become closed and the issue number of comments with median aggregation function. \end{itemize} Hence \textbf{The topic is difficult if after a long waiting time he is closed.}. \end{comment} \subsubsection{\textbf{Results}} \begin{comment} \heng{Three main messages: 1) We derived 13 topics from GitHub issue reports, bringing new perspectives on developers' faced challenges related to QSE. 2) All the derived topics are general among the quantum computing projects, as each topic is present in 66\% to 90\% of the projects' issue reports. 3) Some topics are particularly challenging for developers, such as \texttt{data structures and operations}, \texttt{quantum circuits}, and \texttt{quantum execution results}. } \end{comment} \noindent \textbf{We derived 13 topics from GitHub issue reports, bringing new perspectives to the challenges faced by QSE developers. } Table~\ref{table:git} shows the list of our derived topics, their descriptions, their percentage frequency in the studied issue reports, and the number of projects that have at least one issue report of the topic. Among the 13 topics, 6 of them (\texttt{learning resources}, \texttt{environment management}, \texttt{quantum circuits}, \texttt{quantum execution results}, \texttt{data structures and operations}, and \texttt{dependency management}) are overlapping with the topics derived from Stack Exchange posts (RQ2), and another 2 of them (\texttt{API change} and \texttt{API usage}) are overlapping with the categories of Stack Exchange questions derived in RQ1. This result indicates that the QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in GitHub projects. Among the other five topics, two of them (i.e., \texttt{machine learning} and \texttt{quantum chemistry}) are related to the most popular and promising quantum computing application areas: machine learning and chemistry. For example, an issue report associated with \texttt{quantum chemistry} raises an issue when using a molecular optimizer Python library: ``\textit{it leads to PyBerny optimizing an unconverged ground state energy, which generally leads to the geometry optimization never converging}''. The other three topics (i.e., \texttt{quantum execution errors}, \texttt{unit testing}, \texttt{algorithm optimization}) are related to applications of traditional software engineering processes in quantum program development. \noindent\textbf{All derived topics are general among the quantum computing projects, as each topic is present in the issue reports of 58\% to 90\% of the projects}. We observe that \texttt{learning resources} and \texttt{environment management} are the two most frequent topics and appear in 90\% and 88\% of all the studied projects, respectively, which once again highlights the need of efforts for developing learning resources and supporting developers in setting up their quantum program development environment. \noindent\textbf{Some topics are particularly challenging for developers, such as \texttt{data structures} \texttt{and operations}, \texttt{quantum circuits}, and \texttt{quantum execution results}.} Table \ref{table:gitDiff} shows the median time it takes to close an issue report and the number of comments in an issue report associated with each topic. All the issues are closed at the time when we analyzed their status. The issues associated with each topic only have a median of one to two comments, indicating that developers' interactions on these issue reports are not intense. \texttt{Data structures and operations} is also among the most difficult topics on forum posts (as discussed in RQ2). However, the \texttt{Quantum circuits} and \texttt{quantum execution results} topics are not among the most difficult topics on forum posts, while they are two of the most difficult ones on GitHub issues, which indicates that quantum circuit issues and the interpretation of quantum program execution results are more difficult in specific problem contexts. \input{tables/Git_difficulty} \begin{tcolorbox} \vspace{-2mm} QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in GitHub projects, while GitHub issues bring new perspectives on developers' faced challenges (e.g., on specific quantum computing applications such as machine learning). In particular, we observe that the challenges are generally among the quantum computing projects. \vspace{-2mm} \end{tcolorbox} \section{Related Work} \label{sec:relatedwork} \heng{Todo: merge background and related work; add the Talavera manifesto list of principles} We discuss prior work related to our study along three categories: quantum software engineering, topic analysis of technical Q\&A data, and topic analysis of issue reports. \subsection{Quantum Software Engineering} Quantum software engineering (QSE) is still at its infancy. As the result of the first International Workshop on Quantum Software Engineering \& Programming (QANSWER), researchers and practitioners proposed the "Talavera Manifesto" for quantum software engineering and programming, which defines a set of principles about QSE (e.g.,``QSE is agnostic regarding quantum programming languages and technologie'')~\cite{piattini2020talavera}. Zhao~\cite{zhao2020quantum} performed a comprehensive survey of the existing technology in various phases of quantum software life cycle, including requirement analysis, design, implementation, testing, and maintenance. Prior work~\cite{moguel2020roadmap, piattini2020quantum, barbosa2020software, piattini2021toward} also discussed challenges and potential directions in QSE research, such as modeling~\cite{barbosa2020software} and quantum software processes \& methodologies~\cite{moguel2020roadmap}, and design of quantum hybrid systems~\cite{piattini2021toward}. In addition, prior work conducted extensive exploration along the lines of quantum software programming~\cite{garhwal2019quantum} and quantum software development environments~\cite{larose2019overview}. The survey~\cite{zhao2020quantum} provides an comprehensive overview of the work along these lines. Different from prior work, this work makes the first attempt to understand the current practices of QSE and the challenges perceived by practitioners. \subsection{Topic Analysis of Technical Q\&As} Prior work performs rich studies on technical Q\&A data, especially on Stack Exchange data\footnote{https://meta.stackexchange.com/questions/134495/academic-papers-using-stack-exchange-data}. Here we focus on prior work that performs topic analysis on technical Q\&A data. Topic models are used extensively in prior work to understand the topics of general Stack Overflow posts and the topic trends~\cite{wang2013empirical,chen2019modeling, barbosa2020software,allamanis2013and}. Prior work also leverages topic models to understand the topics of Stack Overflow posts related to specific application development domains, such as mobile application development~\cite{linares2013exploratory, rosen2016mobile}, client application development~\cite{venkatesh2016client}, machine learning application development~\cite{alshangiti2019developing}, as well as concurrency~\cite{ahmed2018concurrency} and security~\cite{yang2016security} related development. In addition, prior work leverages topic models to understand non-functional requirements communicated in Stack Overflow posts~\cite{zou2017towards,zou2015non}. Zhang et al.~\cite{zhang2015multi} use topic models to detect duplicate questions in Stack Overflow. Finally, Treude et al.~\cite{treude2019predicting} proposes an automated approach to suggest configurations of topic models for Stack Overflow data. Most of these studies use the Latent Dirichlet Allocation (LDA) algorithm or its variants to extract topics from the technical Q&A data. In this work, we also leverage the widely used LDA algorithm to extract topics from the technical Q\&A data related to quantum software enginering. \subsection{Topic Analysis of Issue Reports} Issue reports have been widely explored in prior work. Here we focus on studies that apply topic analysis on issue report data. Prior work leverages topic models to automatically assign issue reports to developers (\emph{a.k.a.} bug triage)~\cite{zhang2014novel,xia2013accurate,naguib2013bug,xia2016improving}. These studies first uses topic models to categorize the textual information in the issue reports, then learn mappings between the categorized textual information and developers. Prior work also leverages topic models to automatically detect duplicate issue reports based on the similarity of their topics~\cite{hindle2016contextual,nguyen2012duplicate,zou2016duplication}. Nguyen et al.~\cite{nguyen2011topic} use topic models to associate issue reports and source code based on their similarities, in order to help developers narrow down the searched source code space when resolving an issue. Finally, prior work also studies the trends of topics in issue reports~\cite{martie2012trendy, aggarwal2014mining}. LDA and its variants are the most popular topic model approaches used in these studies. Therefore, we also leverage LDA to extract topics from GitHub issue reports related to quantum software engineering. \section{Threats to Validity} \label{sec:threats} \noindent \textbf{External validity.} In this work, we analyze four Stack Exchange forums and 122 GitHub repositories to understand the challenges of QSE. Our studied forum posts and GitHub issues may not cover all the ones that are related to QSE. Developers may also communicate their discussions in other media (e.g., mailing lists). Future work considering other data sources may complement our study. In addition, we identify and collect the posts from Q\&A forums using a selected set of tags. Our analysis may miss some QSE tags. However, to alleviate this threat, we follow prior work~\cite{uddin2021understanding, 9240667} and use an iterative method to identify the relevant tags. \noindent \textbf{Internal validity.} In this work, we use topic models to cluster the forum posts and GitHub issue reports, based on the intuition that the same clusters would have similar textual information. However, different clusters of posts and issue reports may exist when a different approach is used. To ensure the quality of the clusters, we manually reviewed the resulting topics, merged similar topics when needed, and assigned meaningful labels to them. \noindent\textbf{Construct validity.} In RQ1, we manually analyze the categories of QSE-related questions on technical Q\&A forums. Our results may be subjective and depend on the judgment of the researchers who conducted the manual analysis. To mitigate the bias, two authors of the paper collectively conducted an manual analysis and reached a substantial agreement, indicating the reliability of the analysis results. A third author also participated in the discussions during the manual analysis, to ensure the quality of the results. In RQ2 and RQ3, the parameters of the topic models (e.g., the number of topics $K$) may impact our findings. To mitigate this threat, following previous work ~\cite{uddin2021understanding} \cite{9240667}, we did multiple experiments and use the topic coherence score to select the most suitable parameters. The manual labeling of topics can be subjective. To reduce this threat, the authors read each topic's top 20 keywords and the top 15 highest contributed posts to the topic. We followed a clear-cut approach adapted in previous works~\cite{uddin2021understanding} \cite{9240667}. In addition, in our analysis of the QSE posts, we did not filter posts using the number of comments, votes or answers (as done in prior work~\cite{farhana2019synthesizing}), which may lead to noise in the analyzed posts (e.g., low-quality posts). We made this decision since QSE is a new topic and the number of posts in the Q\&A forums is relatively small. \section{Background and Related Work} \label{sec:background} This study aims to understand the quantum software engineering challenges through examining technical forum posts and GitHub issue reports. In this section, we present the background and prior work related to our study. First, we describe the background and related work of quantum computing, quantum programming, and quantum software engineering. Then, we discuss prior work that performs topic analysis on technical forum posts and issue reports. \subsection{Quantum Computing} Quantum computers aim to leverage the principles of quantum mechanics such as \texttt{superposition} and \texttt{entanglement} to provide computing speed faster than today's classical computers. While classical computers use bits in the form of electrical pulses to represent 1s and 0s, quantum computers use quantum bits or \textbf{Qubits} in the form of subatomic particles such as electrons or photons to represent 1s and 0s. A Qubit, unlike a classical bit, can be 0 or 1 with a certain probability, which is known as the \textbf{superposition} principle~\cite{kaye2007introduction}. In other words, a quantum computer consisting of Qubits is in many different states at the same time. When a Qubit is \textbf{measured}, it collapses into a deterministic classical state. The status of two or more of Qubits can be correlated (or entangled) in the sense that changing the status of one Qubit will change the status of the others in a predictable way, which is known as the \textbf{entanglement} phenomenon~\cite{kaye2007introduction}. The \texttt{superposition} and \texttt{entanglement} phenomenons give quantum computers advantages over classical computers in performing large-scale parallel computation~\cite{kaye2007introduction}. Similar to classical logic gates (e.g., \texttt{AND}, \texttt{OR}, \texttt{NOT}), \textbf{quantum logic gates} (or \textbf{quantum gates}) alter the states (the probability of being 0 or 1) of the input Qubits. Like classical digit circuits, \textbf{quantum circuits} are collections of quantum logic gates interconnected by quantum wires. Figure~\ref{fig:quantumcomp} illustrates the architecture of a quantum computer \cite{DBLP:journals/corr/abs-1803-07407,zhao2020quantum}. The architecture contains two layers: a quantum computing layer where the quantum physics and circuits reside, and a classical computing layer where the quantum programming environment and software applications reside. \begin{itemize} \item \emph{Physical building blocks}: physical realization of Qubits and their coupling/interconnect circuitry. \item \emph{Quantum logic gates}: physical circuitry for quantum logic gates. \item \emph{Quantum-classical computer interface}: the hardware and software that provides the boundary between classical computers and the quantum computing layer. \item \emph{Quantum programming environment}: quantum programming languages and development environment. \item \emph{Business applications}: quantum software applications (based on quantum programming languages) that meet specific business requirements \end{itemize} \begin{figure}[htbp] \vspace{-3mm} \centerline{\includegraphics[width=0.49\textwidth]{graphs/arch.PNG}} \vspace{-5pt} \caption{The architecture of a quantum computer \cite{DBLP:journals/corr/abs-1803-07407,zhao2020quantum}}. \label{fig:quantumcomp} \vspace{-8mm} \end{figure} \subsection{Quantum Programming} Quantum computing as a new general paradigm can massively influence how software is developed~\cite{piattini2020talavera,zhao2020quantum,garhwal2019quantum}. Quantum programming is the process to design an executable quantum program to accomplish a specific task~\cite{garhwal2019quantum}. Quantum programming uses syntax-based notations to represent and operate quantum circuits and gates. Early efforts of quantum programming language development focused on the quantum Turing machine~\cite{doi:10.1098/rspa.1985.0070} but did not produce practical quantum programming languages. Later efforts have turned to the quantum circuits model where the quantum system is controlled by a classical computer~\cite{osti_366453}. This concept has given birth to many new quantum programming languages such as qGCL~\cite{SandersJW:quap}, LanQ~\cite{doi:10.1142/S0219749908004031}, Q\#~\cite{10.1145/3183895.3183901} and Qiskit \cite{Qiskit}. Prior work conducted extensive exploration along the lines of quantum programming~\cite{garhwal2019quantum} and quantum software development environments~\cite{larose2019overview}. The survey~\cite{zhao2020quantum} also provides a comprehensive overview of research works along these lines. \vspace{-1mm} \subsection{Quantum Software Engineering} Quantum software engineering (QSE) is still in its infancy. As the result of the first International Workshop on Quantum Software Engineering \& Programming (QANSWER), researchers and practitioners proposed the ``Talavera Manifesto'' for quantum software engineering and programming, which defines a set of principles about QSE~\cite{piattini2020talavera}, including: \emph{(1) QSE is agnostic regarding quantum programming languages and technologies; (2) QSE embraces the coexistence of classical and quantum computing; (3) QSE supports the management of quantum software development projects; (4) QSE considers the evolution of quantum software; (5) QSE aims at delivering quantum programs with desirable zero defects; (6) QSE assures the quality of quantum software; (7) QSE promotes quantum software reuse; (8) QSE addresses security and privacy by design; and (9) QSE covers the governance and management of software}. Zhao~\cite{zhao2020quantum} performed a comprehensive survey of the existing technology in various phases of quantum software life cycle, including requirement analysis, design, implementation, testing, and maintenance. Prior work~\cite{moguel2020roadmap, piattini2020quantum, barbosa2020software, piattini2021toward} also discussed challenges and potential directions in QSE research, such as modeling~\cite{barbosa2020software} and quantum software processes \& methodologies~\cite{moguel2020roadmap}, and design of quantum hybrid systems~\cite{piattini2021toward}. Different from prior work, this work makes the first attempt to understand the challenges of QSE perceived by practitioners. \vspace{-1mm} \subsection{Topic Analysis of Technical Q\&As} Prior work performs rich studies on technical Q\&A data, especially on Stack Exchange data\cite{StackExchange.data}. Here we focus on prior work that performs topic analysis on technical Q\&A data. Topic models are used extensively in prior work to understand the topics of general Stack Overflow posts and the topic trends~\cite{wang2013empirical,chen2019modeling, barbosa2020software,allamanis2013and}. Prior work also leverages topic models to understand the topics of Stack Overflow posts related to specific application development domains, such as mobile application development~\cite{linares2013exploratory, rosen2016mobile}, client application development~\cite{venkatesh2016client}, machine learning application development~\cite{alshangiti2019developing}, as well as concurrency~\cite{ahmed2018concurrency} and security~\cite{yang2016security} related development. In addition, prior work leverages topic models to understand non-functional requirements communicated in Stack Overflow posts~\cite{zou2017towards,zou2015non}. Zhang et al.~\cite{zhang2015multi} use topic models to detect duplicate questions in Stack Overflow. Finally, Treude et al.~\cite{treude2019predicting} proposes an automated approach to suggest configurations of topic models for Stack Overflow data. Most of these studies use the Latent Dirichlet Allocation (LDA) algorithm or its variants to extract topics from the technical Q\&A data. In this work, we also leverage the widely used LDA algorithm to extract topics from the technical Q\&A data related to quantum software enginering. \vspace{-1mm} \subsection{Topic Analysis of Issue Reports} Issue reports have been widely explored in prior work. Here we focus on studies that apply topic analysis on issue report data. Prior work leverages topic models to automatically assign issue reports to developers (\emph{a.k.a.} bug triage)~\cite{zhang2014novel,xia2013accurate,naguib2013bug,xia2016improving}. These studies first uses topic models to categorize the textual information in the issue reports, then learn mappings between the categorized textual information and developers. Prior work also leverages topic models to automatically detect duplicate issue reports based on the similarity of their topics~\cite{hindle2016contextual,nguyen2012duplicate,zou2016duplication}. Nguyen et al.~\cite{nguyen2011topic} use topic models to associate issue reports and source code based on their similarities, in order to help developers narrow down the searched source code space when resolving an issue. Finally, prior work also studies the trends of topics in issue reports~\cite{martie2012trendy, aggarwal2014mining}. LDA and its variants are the most popular topic modeling approaches used in these studies. Therefore, we also leverage LDA to extract topics from GitHub issue reports related to QSE. \section{Experiment Setup} \label{sec:setup} This section describes the design of our empirical study. \vspace{-1mm} \subsection{Overview} Figure~\ref{fig:overview} provides an overview of our empirical study. We study QSE-related posts on Stack Exchange (SE) forums and the issue reports of quantum computing GitHub projects. From Stack Exchange forums, we first use tags to filter QSE-related posts. In RQ1, we manually analyze a statistically representative sample of these posts to understand the type of information sought by developers. In RQ2, we use automated topic models to analyze the topics of these posts and their characteristics. From GitHub repositories, we first apply a set of heuristic rules to filter the quantum computing projects. Then we extract the issue reports of these quantum computing projects. Finally, we perform topics modeling on these issue reports to analyze the topics in the textual information of the issue reports (RQ3). We describe the details of our data collection and analysis approaches in the rest of this section. \begin{figure}[!t] \vspace{-5mm} \centering \includegraphics[width=0.49\textwidth]{graphs/overview.pdf} \vspace{-5mm} \caption{Overview of our empirical study} \label{fig:overview} \vspace{-5mm} \end{figure} \vspace{-1mm} \subsection{Stack Exchange forums data collection }\label{AA} We follow three steps to collect QSE related data from Stack Exchange forums. First, we collect Q\&A data from four Stack Exchange forums. Second, we identify a set of tags that are related to QSE. Finally, we use the identified tags to select the posts that are related to QSE. We explain the steps below. \noindent \textbf{Step 1: Collecting technical Q\&A data.} We extract technical Q\&A data from four Stack Exchange forums: Stack Overflow\cite{stackoverflow}, Quantum Computing Stack Exchange\cite{quantumcomputing.stackexchange}, Computer Science Stack Exchange\cite{cs.stackexchange}, and Artificial Intelligence Stack Exchange\cite{ai.stackexchange}. We consider the Stack Overflow forum as it contains posts related to quantum programming and it is widely used for studying various software engineering topics (e.g., mobile app development~\cite{linares2013exploratory, rosen2016mobile}, machine learning application development~\cite{alshangiti2019developing}, etc.). We consider the other three forums because they contain posts that discuss topics related to quantum computing and quantum programming. We extracted the post data from these forums with the help of the Stack Exchange Data Explorer\cite{data.stackexchange}. Stack Exchange data explorer holds an up to date data for these forum between 08-2008 and 03-2021. \noindent \textbf{Step 2: Identifying tags related to QSE.} The studied Stack Exchange forums use user defined tags to categorize questions. We follow two sub-steps to select the tags that are related to QSE. We started by searching for questions with the tag ``quantum-computing'' in the entire Stack Exchange dataset $D$ through the data exchange explorer. We obtained 254 questions tagged with ``quantum-computing'' from the studied forums. After manually inspecting the 30 most voted questions, we selected an initial tag set $T_{init}$ consisting of ten tags including ``quantum-computing'', ``qiskit'', ``qsharp'', ``q\#'', ``quantum-development'', ``quantum-circuit'', ``ibmq'', ``quantum-ai'', ``qubit'' and ``qutip''. Then we extracted the questions related to $T_{init}$ from the initial dataset $D$ and obtained a new set of questions $P$. In order to expand the initial tag set, we extracted the frequently co-occurring tags with $T_{init}$ from $P$ and build a new tag set $T_{2}$. Not all the tags in $T_{2}$ are related to quantum computing. To determine the final tag set $T_{final}$, following previous work~\cite{uddin2021understanding} \cite{9240667}, we filter the tags in $T_{2}$ based on their relationships when the initial tag set $T_{init}$. For each tag t in $T_{2}$, we calculate: \begin{equation} (\textnormal{Significance})\,\alpha (t) = \frac{\textnormal{\# of questions with tag } t \textnormal{ in } P}{\textnormal{\# of questions with tag } t \textnormal{ in } D} \end{equation} \begin{equation} (\textnormal{Relevance})\,\beta (t) = \frac{\textnormal{\# of questions with tag } t \textnormal{ in } P}{\textnormal{\# of questions in } P} \end{equation} To select a tag t, the value of significance-relevance $\alpha(t)$, $\beta(t)$ need to be higher than a threshold we set. To select the optimal threshold values for $\alpha$ and $\beta$, we experimented with a set of values respectively between 0.05, 0.35 and 0.001, 0.03. For each $\alpha$ and $\beta$ and for each tag above the threshold, we inspected the top 10 most voted posts and verified if the tag is related to QSE, we ended up with the optimal threshold respectively equal to 0.005 and 0.2 which are consistent with previous work~\cite{10.1109/MSR.2017.5}~\cite{9240667}. The final tag set $T_{final}$ is formed of 37 tags in total. Since quantum computing is a wide topic and our focus is QSE, we further manually inspected the description of each tag t in $T_{final}$ and the top 10 questions of each tag in each studied forum to remove tags that are not related to QSE. Finally our tag set $T_{final}$ was reduced from 37 to 18 tags (14 unique tags as different forums have tags with the same names). Table~\ref{tab:tags} lists our final set of tags. \input{tables/tagSetTable} \noindent\textbf{Step 3: Selecting questions and answers.} We extract the final sets of questions and answers using the final tag sets shown in Table~\ref{tab:tags}. We select all the posts that are tagged with at least one of the tags. We ended up with a total of 3,117 questions and answers from the four considered forums in our data set $D_{final}$. 35\% of the final data are answers where 65\% are questions. The number of posts (questions and answers) extracted from each forum is shown in Table~\ref{tab:tags}. \vspace{-1mm} \subsection{GitHub issues data collection} In this work, we study the issue reports of quantum computing projects on GitHub. We downloaded the GitHub selected quantum computing projects issues in March 2021. We follow three steps described below to extract the issue reports of quantum computing projects from GitHub. \noindent\textbf{Step 1: Searching candidate projects.} We search for quantum computing related projects using three criteria: 1) The description of the project must be in English (i.e., for us to better understand the content). 2) The project name or description must contain the word ``quantum'' (the word quantum is case sensitive in the project name or description). 3) The project is in a mainline repository (i.e., not a fork of another repository). We end up with a total of 1,364 repositories. \noindent\textbf{Step 2: Filtering quantum computing projects.} We filter the searching result and identify quantum computing related projects with three criteria: 1) To avoid selecting student assignments, following previous work~\cite{Businge2018CloneBasedVM}~\cite{Businge2019StudyingAA}, we select repositories that were forked at least two times. 2) The projects must have a sufficient history of development for us to analyze the issue reports. Therefore, we select the projects that were created at least 10 months earlier than the data extraction date. Moreover, only the projects that have at least 100 commits and 10 issues are selected. 3) To ensure the quality of the project selected, we manually inspect the projects' descriptions and remove projects that are not related to quantum computing, projects that are created for hosting quantum computing related documentation, as well as lecture notes related to quantum computing. Finally, we obtain a total of 122 projects directly related to quantum computing applications. \noindent\textbf{Step 3: Extracting issue reports.} We use the GitHub Rest API~\cite{githubrestapi} to extract all the issue reports of the final 122 projects on GitHub. In total, we obtain 43,979 issue reports. \vspace{-1mm} \subsection{Data pre-processing for topic modeling} We build one topic model on the Stack Exchange forum data and another topic model on the GitHub issue data. Below we describe how we pre-process these two types of data before feeding them into topic models. \noindent\textbf{Pre-processing Q\&A post data.} We treat each post (i.e., a question or an answer) as an individual document in the topic model. For each question, we join the title and the body of the question to create a single document. As Q\&A posts contain code snippets between \textless code\textgreater { and} \textless /code\textgreater { which} may bring noise to our topic models, we remove all text between \textless code\textgreater { and} \textless /code\textgreater. We also remove HTML tags (e.g., \textless p\textgreater\textless /p\textgreater), URLs and images from each post. In addition, we remove stop words (e.g., ``like'', ``this'', ``the''), punctuation, and non-alphabetical characters using the Mallet and NLTK stop words set. Finally, we apply the Porter stemming \cite{potterStemming} to normalize the words into their base forms (e.g., ``computing'' is transformed to ``comput''), which can reduce the dimensionality of the word space and improve the performance of topic models~\cite{PerformanceAnalysis:Stemming \begin{comment} \noindent \textbf{Technical forums posts:} \begin{enumerate} \item We join the title and the text body of the questions to create one final body The text body. Also Q\&A posts contains code snippets between \textless code\textgreater\textless \textbackslash code\textgreater which contains programming languages code that can be irrelevant to our analysis and can lead to bad topic modeling. We remove every text between \textless code\textgreater. \item HTML tags like \textless p\textgreater\textless \textbackslash p\textgreater, URLs and images are removed from Q\&A posts final body. \item We remove the stop word such as like, this, the, punctuation and non-alphabetical characters using Mallet \cite{McCallumMALLET} and NLTK stop words set. \item We apply Porter stemming \cite{potterStemming} to normalize the word and return it to the base form (i,e 'computing', transformed to 'comput'). The morphological form improves the contextual understanding by strengthening the similarity while conserving the diversity. Besides, the stemming will reduce the dimensionality, as a result, enhance the performance of the Topic modeling. \end{enumerate} \end{comment} \noindent\textbf{Pre-processing issue report data.} We treat each issue report as an individual document in the topic model. We join the title and the body of each issue as a single document. Similarly, we remove code snippets, URLs and images from the issue body. Since there are no tags in GitHub issues that identify code snippets, we look for backquote ” ” or triple backticks ``` in the content of the issues and remove the code enclosed between this punctuation. We also remove stop words, non-alphabetical characters, and punctuation. Finally, we apply Porter stemming to normalize the words into their base forms. \begin{comment} \begin{enumerate} \item We join the title and the body of the issue \item Since there is no HTML tags in GitHub issues, to remove the code snippets we look for back quote ” ” in the content of the issues and remove the code enclosed between this punctuation. \item URLs, numbers, punctuation, non-alphabetical characters and stop words are removed from final body. \item We apply Porter stemming to normalize the word and transform it to the base form. \end{enumerate} \end{comment} \vspace{-1mm} \subsection{Topic modeling} We use automated topic modeling to analyze the topics in the Q\&A posts and issue reports. Specifically, we use the Latent Dirichlet Allocation (LDA) algorithm~\cite{blei2003latent} to extract the topics from both of our datasets. LDA is a probabilistic topic modeling technique that derives the probability distribution of frequently co-occurred word sets (i.e., topics) in a text corpus. A topic is represented by a probability distribution of a set of words, while a document is represented as a probability distribution of a set of topics. LDA is widely used for modeling topics in software repositories~\cite{chen2016survey}, including technical Q\&A posts (e.g,~\cite{barua2014developers}) and issue reports (e.g.,~\cite{hindle2016contextual}). We use two separate topic models to extract the topics from the Q\&A post data and the issue report data. For a better performance of the topic modeling and a good classification quality, following previous work~\cite{9240667}~\cite{inproceedings}, we consider both uni-gram and bi-gram of words in our topic models. \noindent\textbf{LDA Implementation.} We use the Python implementation of the Mallet topic modeling package~\cite{McCallumMALLET} to perform our topic modeling. The Mallet package implements the Gibbs sampling LDA algorithm and uses efficient hyper-parameter optimization to improve the quality of the derived topics~\cite{McCallumMALLET}. \noindent\textbf{Determining topic modeling parameters.} The number of topics ($K$) is usually manually set by the user as it controls the granularity of the topics~\cite{9240667}. The $\alpha$ parameter controls the topic distribution in the documents (i.e., Q\&A posts or issue reports), while the $\beta$ parameter controls the word distribution in the topics. In this work, we use the topic coherence score~\cite{Rder2015ExploringTS} to evaluate the quality of the resulting topics and determine the appropriate parameters ($K$, $\alpha$, and $\beta$), similar to prior work~\cite{9240667, 10.1145/3183895.3183901}. The coherence score measures the quality of a topic by measuring the semantic similarity between the top words in the topic. Thus, this score distinguishes between topics that are semantically interpretable and topics that are coincidences of statistical inference \cite{Rder2015ExploringTS}. Specifically, we use the Gensim Python package's \texttt{CoherenceModel} \cite{Gensim.CoherenceModel} module to calculate the coherence scores of the resulting topics. To capture a wide range of parameters and keep the topics distinct from each other, we experiment with different combination of the parameters, by varying the values of $K$ from 5 to 30 incremented by 1 each time, the values of document-topic distribution $\alpha$ from 0.01 to 1 incremented by 0.01~\cite{Han2020WhatDP}, and the values of word-topic distribution $\beta$ from 0.01 to 1 incremented by 0.01~\cite{Han2020WhatDP}. We retain the resulting topics with the highest average coherence score. After getting the automatically derived topics, we manually analyze the resulting topics and assign meaningful labels to the topics. We elaborate more on this process in RQ2 and RQ3 for the Q\&A post topics and the issue report topics, respectively. \begin{comment} \Foutse{the following paragraph should be moved to the approach of the RQs!} To analyze the discussions in Q\&A and GitHub platforms and capture the topics. We run LDA algorithm on the different data set corpus. The data set is composed of two corpus: 43,979 GitHub issues and 3,117 Q\&A posts. Since LDA has no semantic knowledge, the topic has to be manually categorized to give a meaning. \end{comment} \begin{comment} \subsection{Type of questions manual labeling} To detect the type of question in QSE topics, following previous works~\cite{beyer2020kind} we perform manual analysis on statistical significant random sample SO and SE questions. On two round, and using cart sorting technique the authors label the posts according to 9 categories: API usage, Theoretical, Errors, Conceptual, Discrepancy, Learning, Review, Tooling and API change. \end{comment} \section{Introduction} Over the past decades, quantum computing has made steady and remarkable progress~\cite{knight2018serious, maslov2018outlook, zhao2020quantum}. For example, IBM Quantum\cite{ibm} now supports developers to develop quantum applications using its programming framework and execute them on its cloud-based quantum computers. Based on the quantum mechanics principles of \texttt{superposition} (quantum objects can be in different states at the same time)~\cite{dirac1981principles} and \texttt{entanglement} (quantum objects can be deeply connected without direct physical interaction)~\cite{schrodinger1935discussion}, quantum computers are expected to make revolutionary computation improvement over today's classical computers~\cite{mueck2017quantum}. In particular, quantum computing is expected to help solve the computational problems that are difficult for today's classical computers, including problems in cryptography, chemistry, financial services, medicine, and national security~\cite{piattini2020talavera}. The success of quantum computing will not be accomplished without quantum software. Several quantum programming languages (e.g., QCL~\cite{omer2003qcl}) and development tools (e.g., Qiskit\cite{Qiskit} have been developed since the first quantum computers. Large software companies like Google\cite{quantumai}, IBM\cite{ibm}, and Microsoft\cite{microsoft.azure} have developed their technologies for quantum software development. Quantum software developers have also achieved some preliminary success in applying quantum software to certain computational areas (e.g, machine learning~\cite{biamonte2017quantum}, optimization~\cite{guerreschi2017practical}, cryptography~\cite{mailloux2016post}, and chemistry~\cite{reiher2017elucidating}). However, there still lacks large-scale quantum software. Much like Software Engineering is needed for developing large-scale traditional software, the concept of Quantum Software Engineering (QSE) has been proposed to support and guide the development of large-scale, industrial-level quantum software applications. This concept has been gaining more and more attention recently~\cite{piattini2020talavera,zhao2020quantum, piattini2020quantum}. QSE aims to apply or adapt existing software engineering processes, methods, techniques, practices, and principles to the development of quantum software applications, or create new ones~\cite{piattini2020talavera}. Pioneering work sheds light on new directions for QSE, such as quantum software processes \& methodologies~\cite{moguel2020roadmap}, quantum software modeling~\cite{barbosa2020software}, and design of quantum hybrid systems~\cite{piattini2021toward}. In the meanwhile, we observe an exponential increase of discussions related to quantum software development on technical Q\&A forums such as Stack Overflow(e.g. from 8 in 2010 to 1434 in 2020). We also notice an increasing number of quantum software projects hosted on GitHub, where developers use issue reports to track their development and issue fixing processes. Such technical Q\&As and issue reports may communicate developers' faced challenges when developing quantum software applications. In this paper, we aim to understand the challenges perceived by quantum software developers and seek opportunities for future QSE research and practice. In particular, we examine technical Q\&A forums where developers ask QSE-related questions, and GitHub issue reports where developers raise QSE-related issues. We apply a series of heuristics to search and filter Q\&A posts that are related to QSE and to search and filter GitHub projects that are related to quantum software. In total, we extract and analyze 3,117 Q\&A posts and 43,979 Github issues that are related to QSE. We combine manual analysis and automated topic modeling to examine these Q\&A posts and Github issues, to understand the QSE challenges developers are facing. In particular, our study aims to answer the three following research questions (RQs): \begin{description} \item [\textbf{RQ1:}] \textit{What types of QSE questions are asked on technical forums?} To understand the intention behind developers' questions on technical forums and the types of information that they are seeking, we manually examined a statistically representative sample of questions. We extended a previous taxonomy from prior work \cite{Beyer2021WhatKO} and found nine categories of questions. Our results highlight the need for future efforts to support developers' quantum program development, in particular, to develop learning resources, to help developers fix errors, and to explain the theory behind quantum computing code. \item [\textbf{RQ2:}] \textit{What QSE topics are raised in technical forums?} The QSE-related posts may reflect developers' challenges when learning or developing quantum programs. To understand their faced challenges, we use topic models to extract the semantic topics in their posts. We derived nine topics including traditional software engineering topics (e.g., \texttt{environment management} and \texttt{dependency management}) and QSE-specific topics (e.g., \texttt{quantum execution results} and \texttt{quantum vs. classical computing}). We highlighted some particularly challenging areas for QSE, such as interpreting quantum program outputs, understanding quantum algorithm complexity, and bridging the knowledge gap between quantum computing and classical computing. \item [\textbf{RQ3:}] \textit{What QSE topics are raised in the issue reports of quantum-computing projects?} Issue reports of quantum computing projects record developers' concerns and discussions when developing these projects. Thus, we analyze the topics in the issue reports to understand the challenges are developers facing in practical quantum computing projects. We observe that the QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in these GitHub projects, while GitHub issues bring new perspectives on developers' faced challenges (e.g., on specific quantum computing applications such as machine learning). We also observe that such challenges are general among quantum computing projects. \end{description} \noindent \textbf{Paper organization.} The rest of the paper is organized as follows. In Section~\ref{sec:background} we discuss the background about quantum software engineering and the related work. Then, in Section~\ref{sec:setup} we describe the design of our study. In Section~\ref{sec:results} we present our results. Section~\ref{sec:threats} discusses threats to the validity of our findings. Finally, Section~\ref{sec:conclusions} concludes the paper. \section{Experiment Results} \label{sec:results} In this section we report and discuss the results of our three research questions. For each research question, we first present the motivation and approach, then discuss the results for answering the research question. \input{Sections/RQ1} \input{Sections/RQ2} \input{Sections/RQ3} \section{Conclusions} \label{sec:conclusions} This paper examines challenges quantum program developers are facing by analyzing Stack Exchange forums posts related to QSE and the GitHub issue reports of quantum computing projects. Results indicate that QSE developers face traditional software engineering challenges (e.g., dependency management) as well as QSE-specific challenges (e.g., interpreting quantum program execution results). In particular, some QSE-related areas (e.g., bridging the knowledge gap between quantum and classical computing) are gaining the highest attention from developers while being very challenging to them. As the initial effort for understanding QSE-related challenges perceived by developers, our work shed light on future opportunities in QSE (e.g., supporting explanations of theory behind quantum program code and the interpretations of quantum program execution results). \begin{comment} Based on an existing taxonomy of question categories on Stack Overflow, we first perform a qualitative analysis of the categories of QSE-related questions. We find nine categories of questions, among which four are new or more frequent in QSE-related posts. We also use automated topic modeling to uncover the topics in QSE-related Q\&A posts and issue reports. We find overlapping and mutually complementary topics in these two types of data, which include traditional software engineering topics (e.g., dependency management) and QSE-specific topics (e.g., quantum program execution). In particular, some topics (e.g., Quantum simulator) are gaining the highest attention while being much more difficult than others to find accepted answers. \end{comment} \subsection*{\textbf{RQ1: Categories of QSE questions on technical Q\&A forums}} \vspace{-3pt} \subsection*{\textbf{RQ1: What types of QSE questions are asked on technical forums?}} \subsubsection{\textbf{Motivation}} In order to understand QSE challenges developers are facing, we first want to understand what types of questions they are asking (e.g., whether they are asking questions about using APIs or fixing errors). This is important to identify the areas in which QSE developers should be supported and the type of resources that they need. Similar to prior work~\cite{beyer2020kind}, we focus on the intent behind the questions asked by QSE developers instead of the topics of the questions. \subsubsection{\textbf{Approach}} To identify the type of questions that users are asking in technical forums, we performed a manual analysis of a statistically representative sample from our studied QSE questions. We sampled 323 questions with a confidence level of 95\% and a confidence interval of 5\%. For each question, we examined its title and body, to understand the intent of the user who posted the question. We used a hybrid card sorting approach to perform the manual analysis and assign labels (i.e., types of questions) to each sampled question. Specifically, we based our manual analysis on an existing taxonomy of the types of questions asked on Stack Overflow~\cite{beyer2020kind} and added new types when needed. For each question we assigned one label; in case a question is associated with two or more labels, which we found only in a few cases, we chose the most relevant one. \noindent \textbf{Hybrid card sorting process.} Two authors of the paper (i.e., coders) jointly performed the hybrid card sorting. We split the sampled data into two equal subsets and performed the sorting in two rounds, similar to prior work~\cite{li2020qualitative}. Our process guaranteed that each question is labelled by both coders. \begin{enumerate} \item \textbf{First-round labeling.} Each coder labels a different half of the questions independently. \item \textbf{First-round discussion.} In order to have a consistent labeling strategy, we had a meeting to discuss the labeling results in the first round and reached an agreed-upon set of labels. A third author of the paper is involved in the discussion. \item \textbf{Revising first-round labels.} Each coder updated the first round labeling results based on the discussion. \item \textbf{Second-round labeling.} Each coder labeled the other half of the questions independently based on the agreed-upon labels in the first round. New labels are allowed in this round. \item \textbf{Second-round discussion.} We had a meeting to discuss the second-round labeling results, validate newly added labels and verify the consistency of our labels. A third author is also involved in the discussion. \item \textbf{Revising second-round labels.} Based on the second-round discussion, each coder revised the labels and finalized its individual labeling of the questions. We calculate the inter-coder agreement after this step. \item \textbf{Resolving disagreement.} We had a final meeting to resolve the disagreement in our labeling results and reached the final label for each question. For each difference in our labels, the two coders and a third author discussed the conflict and reached a consensus. \end{enumerate} \noindent \textbf{Inter-coder agreement. } We measured the inter-coder agreement between the coders and obtained a Cohen’s kappa $k$ value of 0.73 which indicates a substantial agreement~\cite{MaryMcHugh}. Therefore our manual labeling results are reliable. \subsubsection{\textbf{Results}} \input{tables/QA_taxonomy} Table \ref{table:intent} shows the result of our qualitative analysis for identifying the categories of questions in technical forums. Among the 323 questions we analyzed, we could not assign a label to only one question. In the table, we provide the description of each category and how frequent it appears in our qualitative analysis. \noindent \textbf{All seven categories of Stack Overflow questions identified in prior work appear in QSE-related posts.} Prior work~\cite{beyer2020kind} identified seven categories of questions on Stack Overflow by studying Android-related questions, including \texttt{API usage}, \texttt{Conceptual}, \texttt{Discrepancy}, \texttt{Errors}, \texttt{Review}, \texttt{API change}, and \texttt{Learning}, ordered by their occurrence frequency. Although quantum computing is still a new area, people start to ask all these different categories of questions, indicating that quantum computing face similar software engineering challenges (e.g., \texttt{API usage} and \texttt{API change}) as other software engineering domains. Similar to prior work, we find that \texttt{API usage} is the most frequent category with 26.3\% instances. The questions of this category are usually identified by ``how to''; e.g., ``\textit{How to return measurement probabilities from the QDK Full-state simulator?}'' \noindent \textbf{The categories of \texttt{Errors} and \texttt{Learning} are relatively more frequent in QSE-related questions than in the prior taxonomy of question categories~\cite{beyer2020kind}.} Compare to prior work~\cite{beyer2020kind} on classifying Android-related questions, we find that \texttt{Errors} and \texttt{Learning} questions are relatively more frequent. As quantum computing is still an emerging domain, people practicing it face many errors when developing quantum computing applications and they find it challenging to find learning resource for quantum computing. An example of the \texttt{Errors} category is ``\textit{I have Qiskit installed via Anaconda and a virtual environment set up in Python 3.8. ... I get an error. I'm not sure what the problem is. How do I fix it?}''. Another example for the \texttt{Learning} category is ``\textit{How do I learn Q\#? What languages should I know prior to learning Q\#? How do I get started with quantum computing?}''. These findings suggest the need to develop tools or resources to help developers avoid or address such errors, as well as developing tutorials, books, and other learning resources to help beginners get acquainted with quantum computing. \noindent \textbf{Two new categories of questions (i.e., \texttt{Theoretical} and \texttt{Tooling}) emerge in QSE-related posts.} In fact, the category of \texttt{Theoretical} is the second most frequent among all categories. This category is usually associated with keywords such as ``can someone explain'', ``what is'', and ``does quantum''. An example question of this category is ``What is the analysis of the Bell Inequality protocol in Cirq's `examples'?'' where Cirq\cite{cirq_developers_2021_4586899} is a Python library for developing quantum computing applications. This category of questions indicates that people have challenges understanding the theoretical concepts behind quantum computing code. Future efforts are needed to explain such theoretical concepts for developers. The category of \texttt{tooling} represents questions that are looking for tools, frameworks, or libraries that can help solve a QSE-related problem or verifying whether a tool, framework, or library can help solve a problem. For example, ``\textit{I want to use Blender and Blender Python Scripts working with Qiskit. How can I do this? How to make communication between Blender and Qiskit installed with Anaconda Python?}''. This category indicates the lack of established tools for supporting quantum program development. \begin{tcolorbox} \vspace{-2mm} We identified nine categories of QSE-related questions in Stack Exchange forums. The categories \texttt{Theoretical}, \texttt{Errors}, \texttt{Learning}, and \texttt{Tooling} are new or become more frequent in QSE-related questions. Our results highlight the need for future efforts to support developers' quantum program development, in particular, to develop learning resources, to help developers fix errors, and to explain theory behind quantum computing code. \vspace{-2mm} \end{tcolorbox} \subsection{\textbf{RQ2: QSE topics in technical Q\&A forums}} \vspace{-5pt} \subsection*{\textbf{RQ2: What QSE topics are raised in technical forums?}} \setcounter{subsubsection}{0} \subsubsection{\textbf{Motivation}} Developers post QSE-related questions and answers on technical forums. Their posts may reflect their faced challenges when learning or developing quantum programs. To understand their faced challenges, we use topic models to extract the semantic topics in their posts and analyze the characteristics of these topics. \subsubsection{\textbf{Approach}} \noindent \textbf{Topic assignment and frequency.} The automated topic modeling generated nine topics and distribution of co-occurring words in each topic. We then manually assigned a meaningful label to each topic. Following prior work\cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667}, to assign a meaningful label to a topic, the first author first proposed labels using two pieces of information: (1) the topic's top 20 keywords, and (2) the top 10-15 most relevant questions associated with the topic. Then, three authors of the paper reviewed the labels in meetings and reassigned the labels when needed. We obtained a meaningful label for each of the nine topics at the end. For each topic, we measure the percentage of the posts (i.e., frequency) that have it as the dominant topic (i.e., with the highest probability). \noindent \textbf{Topic popularity.} To understand developers' attention towards each topic, following previous work \cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667}, we measured three metrics for each topic: (1) the median number of views of the associated posts, (2) the median number of associated posts marked as \texttt{favorite}, and (3) the median score of the associated posts. For each topic, the associated posts refer to the posts that have it as the dominant topic. \begin{comment} \begin{itemize} \item We group the posts by the dominant topic label. \item We aggregate the number of views, number of posts and post score with median aggregation function. \end{itemize} Hence \textbf{the topic is popular if he has the most number of view and the highest number of favorite and score}. \end{comment} \noindent \textbf{Topic difficulty.} In order to better understand the most challenging aspects for developers, we measure the difficulty of each topic in terms of how difficult it is for the associated posts to get accepted answers. Following prior work \cite{Yang:Xin-Li:Lo, 10.1145/3338906.3338939, 9240667 }, for each topic, we measure two metrics: (1) the percentage of the associated questions with no accepted answer, and (2) the median time required by the associated questions to get an accepted answer (only considering the ones with an accepted answer). For each topic, the associated questions refer to the questions that have the topic as the dominant topic. \begin{comment} \begin{itemize} \item We group the posts by dominant topic label \item (1) We compute the percentage of the number of topics with and without accepted answer. \item (1) We select only the percentage of posts with no accepted answer. \item (2) We compute the difference between the date of an accepted answers and the creation data in hour per post. \item (2) We aggregate the median time required by the question to get an accepted answer with median aggregation function. \end{itemize} Hence \textbf{The topic is difficult if after a long waiting time he receives a few answers.}. \end{comment} \subsubsection{\textbf{Results}} \input{tables/tableQAtopics} \noindent \textbf{We derived nine topics that are discussed in QSE-related posts, including traditional software engineering topics (e.g., \texttt{environment management} and \texttt{dependency management}) and QSE-specific topics (e.g., \texttt{quantum execution results} and \texttt{Quantum circuits})}. Table \ref{table:QA_topic} describes the nine topics and their frequency in the analyzed posts. Table~\ref{table:QA popularity} shows the median views, scores, and favorites of the posts associated with these topics. The three most dominant topics are \texttt{environment management}, \texttt{dependency management}, and \texttt{algorithm complexity}. \textbf{\texttt{Environment management}} is the most dominant topic representing 15.03\% of posts. For example, the most viewed question of this topic is ``\textit{I downloaded the Quipper package but I have not been able to get haskell to recognize where all of the modules and files are and how to properly link everything}'' which gained 2772 views. Other examples include ``How can I run QCL (quantum programming language) on Windows?'' and ``Visualization of Quantum Circuits when using IBM QISKit''. We can observe that users are new to quantum computing and facing problem while setting up their environment and installing their tools. This topic is also linked to the question category \texttt{tooling} that we derived in RQ1. \textbf{\texttt{Dependency management}} is the second most discussed topic representing 14.82\% of the posts. For example, the most viewed question (with 2,239 views) of this topic is ``\textit{When trying the above code, I am receiving the following error: ModuleNotFoundError: No module named qiskit}'' where \texttt{qiskit} is an open source framework for quantum program development\cite{Qiskit}. We noticed that a large number of questions are directly related to \texttt{qiskit}. This can be explained by the lack of documentation or tutorials in using this framework. \textbf{\texttt{Algorithm complexity}} is the third most dominant topic. This topic is about understanding the complexity of quantum algorithms and how to optimize quantum algorithms. For example, the most viewed question of this topic is ``\textit{For the other algorithms, I was able to find specific equations to calculate the number of instructions of the algorithm for a given input size (from which I could calculate the time required to calculate on a machine with a given speed). However, for Shor's algorithm, the most I can find is its complexity: O( (log N)$^3$ )}'', which receives 4,718 views. This topic is linked to the questions category \texttt{theoretical} derived from RQ1. This topic indicates developers' challenge in understanding the complexity of quantum algorithms. \noindent\textbf{As quantum programming is oriented to searching solutions in a probabilistic space, which is counter-intuitive from the classical computing perspective, understanding \texttt{quantum execution results} is particularly challenging for developers.} As a Qubit can be 0 or 1 with a certain probability, a quantum program that has Qubits as its basic units can have many different states at the same time. The results of a quantum program are certain only when the results are observed (or ``measured''). Therefore, it is more challenging for developers to understand the results of quantum programs than that of classical programs. For example ``How to plot histogram or Bloch sphere for multiple circuits? I have tried to plot a histogram for the multiple circuits for the code given below. I think I have done it correctly but don't know why it's not working. Please help me out. If possible please solve it for the Bloch sphere'' Future efforts are needed to interpret quantum program outputs. \begin{comment} \begin{figure}[htbp] \vspace{-2mm} \centerline{\includegraphics[width=0.5\textwidth]{graphs/evolution.png}} \caption{Q\&A forums topics evolution overtime \label{figure:QAevolution} \vspace{-2mm} \end{figure} QSE has a distinct characteristic for each topic. For example, algorithm complexity is more focused on studying adopting and optimizing classical algorithms to quantum computing. The user's challenges evolve along with the topics associated. Therefore, in order to understand the topics evaluations, in figure \ref{figure:QAevolution} we show the trends of QSE topics between 2012 and 2020. For most topics, the trend starts gradually to increase. Quantum simulators started to get interested in 2012 compared to the rest of the topic. In 2014 the all QSE topic's the number of question and answers increased while in 2016 we observe the exponential jump of QSE posts in the Q\&A forums. The massive increase in the number of posts related to QSE indicates the growing interest in quantum computing by the software engineering community. Moreover as shown in figure \ref{figure:QAevolution} the trend is not showing any signs of decreasing in the future. We further study the popularity in QSE topics in the technical forum posts.\textbf{The number of QSE-related posts started to grow exponentially after 2017. In particular, the topics of Quantum algorithm understanding, quantum execution results and Quantum circuits which emerged in 2017 becomes the most frequent topic recently.} \end{comment} \input{tables/popularityQA} \noindent\textbf{Posts related to \texttt{quantum vs.} \texttt{classical computing} are gaining the most attention from developers.} Since quantum computing is based on a new philosophy different from classical computing, developers often ask questions about the differences and look to understand the new doors quantum computing is opening. According to Table~\ref{table:QA popularity}, posts with this topic receive the highest median number of views. This may show that software engineers are eager to contribute to QSE by starting from the differences between the two paradigms. However, as shown in Figure~\ref{figure:QAdifficulty}, posts on this topic are least likely to receive accepted answers. Our results indicate the need for resources and tools for bridging the knowledge gap between quantum computing and classical computing. \begin{figure}[!t] \vspace{-2mm} \centering \centerline{\includegraphics[width=0.5\textwidth]{graphs/QAdifficulty.png}} \caption{The difficulty aspect of QSE-related topics on Stack Exchange forums} \label{figure:QAdifficulty} \vspace{-7mm} \end{figure} \textbf{Questions of some topics (e.g., \texttt{environment management}) are much more difficult than others to receive accepted answers}. According to Figure \ref{figure:QAdifficulty}, the topic \texttt{environment management} is the most difficult topic to answer, with 61\% of posts not receiving an accepted answer and a median time of 12 hours to receive an accepted answer. \texttt{Learning resources}, \texttt{quantum vs. classical computing} and \texttt{data structures and operations} are also among the most difficult topics in terms of the ratio of posts getting accepted answers and the time to get one. The results indicate the lack of community support in aspects such as setting up a development environment, searching for learning resources, and understanding differences between quantum computing and classical computing, which could impair the advancement of quantum software development practices. \begin{tcolorbox} \vspace{-2mm} From Q\&A forums, we derived nine topics discussed in QSE-related posts, including traditional software engineering topics (e.g., \texttt{environment management}) and QSE-specific ones (e.g., \texttt{quantum execution results}). We highlighted some particularly challenging areas for QSE, such as interpreting quantum program outputs and bridging the knowledge gap between quantum computing and classical computing. \vspace{-2mm} \end{tcolorbox} \subsection*{\textbf{RQ3: What QSE topics are raised in the issue reports of quantum-computing projects?}} \input{tables/git_topics} \setcounter{subsubsection}{0} \subsubsection{\textbf{Motivation}} Issue reports of quantum computing projects record developers' concerns and discussions when adding features or resolving issues in these projects. The textual information in the issue reports may communicate developers' challenges when developing quantum computing applications. Therefore, we analyze the topics in the issue reports to understand the challenges developers are facing as well as the prevalence of these challenges. While the questions on technical forums can provide information about developers' general challenges, the issue reports may communicate developers' challenges for specific problems (i.e., issues). \subsubsection{\textbf{Approach}} \noindent \textbf{Topic assignment and frequency.} Our topic model on the issue report data generated 17 topics. We follow the same process as described in RQ2 to manually assign meaningful labels to the automated topics, based on the top words in the topics and the content of the associated issue reports. During the manual assignment process, we found that some topics are similar to each other even though such similarity is not detected by the probabilistic topic model. Therefore, we follow prior work~\cite{noei2019too, rosen2016mobile} and merged similar topics. We also discarded one topic as we could not derive a meaningful label from the top words and the associated issue reports. In the end, we obtained 13 meaningful topics. For each topic, we measure the percentage of the issue reports (i.e., frequency) that have it as the dominant topic (i.e., with the highest probability). We also measure the number and percentage of the studied projects that have at least one issue report of each topic. \noindent \textbf{Topic difficulty.} To further understand developers' challenges in developing quantum computing applications, we measure the ``difficulty'' of the issue reports associated with each topic. As we cannot directly measure the ``difficulty'' of issue reports, we measure three indirect metrics for each topic: (1) the percentage of issue reports associated with the topic that is \texttt{closed}, (2) the median time required to close an issue (since its creation) associated with the topic, and (3) the median number of comments in an associated topic (intuitively, an issue report with more comments may be more difficult \cite{Khomh11}). For each topic, the associated issue reports refer to the issue reports that have it as the dominant topic. \begin{comment} \begin{itemize} \item We group the issues by dominant topic label \item We compute the difference between the closer date and the creation date in hour per issue. \item We aggregate the time required by the issue to become closed and the issue number of comments with median aggregation function. \end{itemize} Hence \textbf{The topic is difficult if after a long waiting time he is closed.}. \end{comment} \subsubsection{\textbf{Results}} \begin{comment} \heng{Three main messages: 1) We derived 13 topics from GitHub issue reports, bringing new perspectives on developers' faced challenges related to QSE. 2) All the derived topics are general among the quantum computing projects, as each topic is present in 66\% to 90\% of the projects' issue reports. 3) Some topics are particularly challenging for developers, such as \texttt{data structures and operations}, \texttt{quantum circuits}, and \texttt{quantum execution results}. } \end{comment} \noindent \textbf{We derived 13 topics from GitHub issue reports, bringing new perspectives to the challenges faced by QSE developers. } Table~\ref{table:git} shows the list of our derived topics, their descriptions, their percentage frequency in the studied issue reports, and the number of projects that have at least one issue report of the topic. Among the 13 topics, 6 of them (\texttt{learning resources}, \texttt{environment management}, \texttt{quantum circuits}, \texttt{quantum execution results}, \texttt{data structures and operations}, and \texttt{dependency management}) are overlapping with the topics derived from Stack Exchange posts (RQ2), and another 2 of them (\texttt{API change} and \texttt{API usage}) are overlapping with the categories of Stack Exchange questions derived in RQ1. This result indicates that the QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in GitHub projects. Among the other five topics, two of them (i.e., \texttt{machine learning} and \texttt{quantum chemistry}) are related to the most popular and promising quantum computing application areas: machine learning and chemistry. For example, an issue report associated with \texttt{quantum chemistry} raises an issue when using a molecular optimizer Python library: ``\textit{it leads to PyBerny optimizing an unconverged ground state energy, which generally leads to the geometry optimization never converging}''. The other three topics (i.e., \texttt{quantum execution errors}, \texttt{unit testing}, \texttt{algorithm optimization}) are related to applications of traditional software engineering processes in quantum program development. \noindent\textbf{All derived topics are general among the quantum computing projects, as each topic is present in the issue reports of 58\% to 90\% of the projects}. We observe that \texttt{learning resources} and \texttt{environment management} are the two most frequent topics and appear in 90\% and 88\% of all the studied projects, respectively, which once again highlights the need of efforts for developing learning resources and supporting developers in setting up their quantum program development environment. \noindent\textbf{Some topics are particularly challenging for developers, such as \texttt{data structures} \texttt{and operations}, \texttt{quantum circuits}, and \texttt{quantum execution results}.} Table \ref{table:gitDiff} shows the median time it takes to close an issue report and the number of comments in an issue report associated with each topic. All the issues are closed at the time when we analyzed their status. The issues associated with each topic only have a median of one to two comments, indicating that developers' interactions on these issue reports are not intense. \texttt{Data structures and operations} is also among the most difficult topics on forum posts (as discussed in RQ2). However, the \texttt{Quantum circuits} and \texttt{quantum execution results} topics are not among the most difficult topics on forum posts, while they are two of the most difficult ones on GitHub issues, which indicates that quantum circuit issues and the interpretation of quantum program execution results are more difficult in specific problem contexts. \input{tables/Git_difficulty} \begin{tcolorbox} \vspace{-2mm} QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in GitHub projects, while GitHub issues bring new perspectives on developers' faced challenges (e.g., on specific quantum computing applications such as machine learning). In particular, we observe that the challenges are generally among the quantum computing projects. \vspace{-2mm} \end{tcolorbox} \section{Related Work} \label{sec:relatedwork} \heng{Todo: merge background and related work; add the Talavera manifesto list of principles} We discuss prior work related to our study along three categories: quantum software engineering, topic analysis of technical Q\&A data, and topic analysis of issue reports. \subsection{Quantum Software Engineering} Quantum software engineering (QSE) is still at its infancy. As the result of the first International Workshop on Quantum Software Engineering \& Programming (QANSWER), researchers and practitioners proposed the "Talavera Manifesto" for quantum software engineering and programming, which defines a set of principles about QSE (e.g.,``QSE is agnostic regarding quantum programming languages and technologie'')~\cite{piattini2020talavera}. Zhao~\cite{zhao2020quantum} performed a comprehensive survey of the existing technology in various phases of quantum software life cycle, including requirement analysis, design, implementation, testing, and maintenance. Prior work~\cite{moguel2020roadmap, piattini2020quantum, barbosa2020software, piattini2021toward} also discussed challenges and potential directions in QSE research, such as modeling~\cite{barbosa2020software} and quantum software processes \& methodologies~\cite{moguel2020roadmap}, and design of quantum hybrid systems~\cite{piattini2021toward}. In addition, prior work conducted extensive exploration along the lines of quantum software programming~\cite{garhwal2019quantum} and quantum software development environments~\cite{larose2019overview}. The survey~\cite{zhao2020quantum} provides an comprehensive overview of the work along these lines. Different from prior work, this work makes the first attempt to understand the current practices of QSE and the challenges perceived by practitioners. \subsection{Topic Analysis of Technical Q\&As} Prior work performs rich studies on technical Q\&A data, especially on Stack Exchange data\footnote{https://meta.stackexchange.com/questions/134495/academic-papers-using-stack-exchange-data}. Here we focus on prior work that performs topic analysis on technical Q\&A data. Topic models are used extensively in prior work to understand the topics of general Stack Overflow posts and the topic trends~\cite{wang2013empirical,chen2019modeling, barbosa2020software,allamanis2013and}. Prior work also leverages topic models to understand the topics of Stack Overflow posts related to specific application development domains, such as mobile application development~\cite{linares2013exploratory, rosen2016mobile}, client application development~\cite{venkatesh2016client}, machine learning application development~\cite{alshangiti2019developing}, as well as concurrency~\cite{ahmed2018concurrency} and security~\cite{yang2016security} related development. In addition, prior work leverages topic models to understand non-functional requirements communicated in Stack Overflow posts~\cite{zou2017towards,zou2015non}. Zhang et al.~\cite{zhang2015multi} use topic models to detect duplicate questions in Stack Overflow. Finally, Treude et al.~\cite{treude2019predicting} proposes an automated approach to suggest configurations of topic models for Stack Overflow data. Most of these studies use the Latent Dirichlet Allocation (LDA) algorithm or its variants to extract topics from the technical Q&A data. In this work, we also leverage the widely used LDA algorithm to extract topics from the technical Q\&A data related to quantum software enginering. \subsection{Topic Analysis of Issue Reports} Issue reports have been widely explored in prior work. Here we focus on studies that apply topic analysis on issue report data. Prior work leverages topic models to automatically assign issue reports to developers (\emph{a.k.a.} bug triage)~\cite{zhang2014novel,xia2013accurate,naguib2013bug,xia2016improving}. These studies first uses topic models to categorize the textual information in the issue reports, then learn mappings between the categorized textual information and developers. Prior work also leverages topic models to automatically detect duplicate issue reports based on the similarity of their topics~\cite{hindle2016contextual,nguyen2012duplicate,zou2016duplication}. Nguyen et al.~\cite{nguyen2011topic} use topic models to associate issue reports and source code based on their similarities, in order to help developers narrow down the searched source code space when resolving an issue. Finally, prior work also studies the trends of topics in issue reports~\cite{martie2012trendy, aggarwal2014mining}. LDA and its variants are the most popular topic model approaches used in these studies. Therefore, we also leverage LDA to extract topics from GitHub issue reports related to quantum software engineering. \section{Threats to Validity} \label{sec:threats} \noindent \textbf{External validity.} In this work, we analyze four Stack Exchange forums and 122 GitHub repositories to understand the challenges of QSE. Our studied forum posts and GitHub issues may not cover all the ones that are related to QSE. Developers may also communicate their discussions in other media (e.g., mailing lists). Future work considering other data sources may complement our study. In addition, we identify and collect the posts from Q\&A forums using a selected set of tags. Our analysis may miss some QSE tags. However, to alleviate this threat, we follow prior work~\cite{uddin2021understanding, 9240667} and use an iterative method to identify the relevant tags. \noindent \textbf{Internal validity.} In this work, we use topic models to cluster the forum posts and GitHub issue reports, based on the intuition that the same clusters would have similar textual information. However, different clusters of posts and issue reports may exist when a different approach is used. To ensure the quality of the clusters, we manually reviewed the resulting topics, merged similar topics when needed, and assigned meaningful labels to them. \noindent\textbf{Construct validity.} In RQ1, we manually analyze the categories of QSE-related questions on technical Q\&A forums. Our results may be subjective and depend on the judgment of the researchers who conducted the manual analysis. To mitigate the bias, two authors of the paper collectively conducted an manual analysis and reached a substantial agreement, indicating the reliability of the analysis results. A third author also participated in the discussions during the manual analysis, to ensure the quality of the results. In RQ2 and RQ3, the parameters of the topic models (e.g., the number of topics $K$) may impact our findings. To mitigate this threat, following previous work ~\cite{uddin2021understanding} \cite{9240667}, we did multiple experiments and use the topic coherence score to select the most suitable parameters. The manual labeling of topics can be subjective. To reduce this threat, the authors read each topic's top 20 keywords and the top 15 highest contributed posts to the topic. We followed a clear-cut approach adapted in previous works~\cite{uddin2021understanding} \cite{9240667}. In addition, in our analysis of the QSE posts, we did not filter posts using the number of comments, votes or answers (as done in prior work~\cite{farhana2019synthesizing}), which may lead to noise in the analyzed posts (e.g., low-quality posts). We made this decision since QSE is a new topic and the number of posts in the Q\&A forums is relatively small. \section{Background and Related Work} \label{sec:background} This study aims to understand the quantum software engineering challenges through examining technical forum posts and GitHub issue reports. In this section, we present the background and prior work related to our study. First, we describe the background and related work of quantum computing, quantum programming, and quantum software engineering. Then, we discuss prior work that performs topic analysis on technical forum posts and issue reports. \subsection{Quantum Computing} Quantum computers aim to leverage the principles of quantum mechanics such as \texttt{superposition} and \texttt{entanglement} to provide computing speed faster than today's classical computers. While classical computers use bits in the form of electrical pulses to represent 1s and 0s, quantum computers use quantum bits or \textbf{Qubits} in the form of subatomic particles such as electrons or photons to represent 1s and 0s. A Qubit, unlike a classical bit, can be 0 or 1 with a certain probability, which is known as the \textbf{superposition} principle~\cite{kaye2007introduction}. In other words, a quantum computer consisting of Qubits is in many different states at the same time. When a Qubit is \textbf{measured}, it collapses into a deterministic classical state. The status of two or more of Qubits can be correlated (or entangled) in the sense that changing the status of one Qubit will change the status of the others in a predictable way, which is known as the \textbf{entanglement} phenomenon~\cite{kaye2007introduction}. The \texttt{superposition} and \texttt{entanglement} phenomenons give quantum computers advantages over classical computers in performing large-scale parallel computation~\cite{kaye2007introduction}. Similar to classical logic gates (e.g., \texttt{AND}, \texttt{OR}, \texttt{NOT}), \textbf{quantum logic gates} (or \textbf{quantum gates}) alter the states (the probability of being 0 or 1) of the input Qubits. Like classical digit circuits, \textbf{quantum circuits} are collections of quantum logic gates interconnected by quantum wires. Figure~\ref{fig:quantumcomp} illustrates the architecture of a quantum computer \cite{DBLP:journals/corr/abs-1803-07407,zhao2020quantum}. The architecture contains two layers: a quantum computing layer where the quantum physics and circuits reside, and a classical computing layer where the quantum programming environment and software applications reside. \begin{itemize} \item \emph{Physical building blocks}: physical realization of Qubits and their coupling/interconnect circuitry. \item \emph{Quantum logic gates}: physical circuitry for quantum logic gates. \item \emph{Quantum-classical computer interface}: the hardware and software that provides the boundary between classical computers and the quantum computing layer. \item \emph{Quantum programming environment}: quantum programming languages and development environment. \item \emph{Business applications}: quantum software applications (based on quantum programming languages) that meet specific business requirements \end{itemize} \begin{figure}[htbp] \vspace{-3mm} \centerline{\includegraphics[width=0.49\textwidth]{graphs/arch.PNG}} \vspace{-5pt} \caption{The architecture of a quantum computer \cite{DBLP:journals/corr/abs-1803-07407,zhao2020quantum}}. \label{fig:quantumcomp} \vspace{-8mm} \end{figure} \subsection{Quantum Programming} Quantum computing as a new general paradigm can massively influence how software is developed~\cite{piattini2020talavera,zhao2020quantum,garhwal2019quantum}. Quantum programming is the process to design an executable quantum program to accomplish a specific task~\cite{garhwal2019quantum}. Quantum programming uses syntax-based notations to represent and operate quantum circuits and gates. Early efforts of quantum programming language development focused on the quantum Turing machine~\cite{doi:10.1098/rspa.1985.0070} but did not produce practical quantum programming languages. Later efforts have turned to the quantum circuits model where the quantum system is controlled by a classical computer~\cite{osti_366453}. This concept has given birth to many new quantum programming languages such as qGCL~\cite{SandersJW:quap}, LanQ~\cite{doi:10.1142/S0219749908004031}, Q\#~\cite{10.1145/3183895.3183901} and Qiskit \cite{Qiskit}. Prior work conducted extensive exploration along the lines of quantum programming~\cite{garhwal2019quantum} and quantum software development environments~\cite{larose2019overview}. The survey~\cite{zhao2020quantum} also provides a comprehensive overview of research works along these lines. \vspace{-1mm} \subsection{Quantum Software Engineering} Quantum software engineering (QSE) is still in its infancy. As the result of the first International Workshop on Quantum Software Engineering \& Programming (QANSWER), researchers and practitioners proposed the ``Talavera Manifesto'' for quantum software engineering and programming, which defines a set of principles about QSE~\cite{piattini2020talavera}, including: \emph{(1) QSE is agnostic regarding quantum programming languages and technologies; (2) QSE embraces the coexistence of classical and quantum computing; (3) QSE supports the management of quantum software development projects; (4) QSE considers the evolution of quantum software; (5) QSE aims at delivering quantum programs with desirable zero defects; (6) QSE assures the quality of quantum software; (7) QSE promotes quantum software reuse; (8) QSE addresses security and privacy by design; and (9) QSE covers the governance and management of software}. Zhao~\cite{zhao2020quantum} performed a comprehensive survey of the existing technology in various phases of quantum software life cycle, including requirement analysis, design, implementation, testing, and maintenance. Prior work~\cite{moguel2020roadmap, piattini2020quantum, barbosa2020software, piattini2021toward} also discussed challenges and potential directions in QSE research, such as modeling~\cite{barbosa2020software} and quantum software processes \& methodologies~\cite{moguel2020roadmap}, and design of quantum hybrid systems~\cite{piattini2021toward}. Different from prior work, this work makes the first attempt to understand the challenges of QSE perceived by practitioners. \vspace{-1mm} \subsection{Topic Analysis of Technical Q\&As} Prior work performs rich studies on technical Q\&A data, especially on Stack Exchange data\cite{StackExchange.data}. Here we focus on prior work that performs topic analysis on technical Q\&A data. Topic models are used extensively in prior work to understand the topics of general Stack Overflow posts and the topic trends~\cite{wang2013empirical,chen2019modeling, barbosa2020software,allamanis2013and}. Prior work also leverages topic models to understand the topics of Stack Overflow posts related to specific application development domains, such as mobile application development~\cite{linares2013exploratory, rosen2016mobile}, client application development~\cite{venkatesh2016client}, machine learning application development~\cite{alshangiti2019developing}, as well as concurrency~\cite{ahmed2018concurrency} and security~\cite{yang2016security} related development. In addition, prior work leverages topic models to understand non-functional requirements communicated in Stack Overflow posts~\cite{zou2017towards,zou2015non}. Zhang et al.~\cite{zhang2015multi} use topic models to detect duplicate questions in Stack Overflow. Finally, Treude et al.~\cite{treude2019predicting} proposes an automated approach to suggest configurations of topic models for Stack Overflow data. Most of these studies use the Latent Dirichlet Allocation (LDA) algorithm or its variants to extract topics from the technical Q\&A data. In this work, we also leverage the widely used LDA algorithm to extract topics from the technical Q\&A data related to quantum software enginering. \vspace{-1mm} \subsection{Topic Analysis of Issue Reports} Issue reports have been widely explored in prior work. Here we focus on studies that apply topic analysis on issue report data. Prior work leverages topic models to automatically assign issue reports to developers (\emph{a.k.a.} bug triage)~\cite{zhang2014novel,xia2013accurate,naguib2013bug,xia2016improving}. These studies first uses topic models to categorize the textual information in the issue reports, then learn mappings between the categorized textual information and developers. Prior work also leverages topic models to automatically detect duplicate issue reports based on the similarity of their topics~\cite{hindle2016contextual,nguyen2012duplicate,zou2016duplication}. Nguyen et al.~\cite{nguyen2011topic} use topic models to associate issue reports and source code based on their similarities, in order to help developers narrow down the searched source code space when resolving an issue. Finally, prior work also studies the trends of topics in issue reports~\cite{martie2012trendy, aggarwal2014mining}. LDA and its variants are the most popular topic modeling approaches used in these studies. Therefore, we also leverage LDA to extract topics from GitHub issue reports related to QSE. \section{Experiment Setup} \label{sec:setup} This section describes the design of our empirical study. \vspace{-1mm} \subsection{Overview} Figure~\ref{fig:overview} provides an overview of our empirical study. We study QSE-related posts on Stack Exchange (SE) forums and the issue reports of quantum computing GitHub projects. From Stack Exchange forums, we first use tags to filter QSE-related posts. In RQ1, we manually analyze a statistically representative sample of these posts to understand the type of information sought by developers. In RQ2, we use automated topic models to analyze the topics of these posts and their characteristics. From GitHub repositories, we first apply a set of heuristic rules to filter the quantum computing projects. Then we extract the issue reports of these quantum computing projects. Finally, we perform topics modeling on these issue reports to analyze the topics in the textual information of the issue reports (RQ3). We describe the details of our data collection and analysis approaches in the rest of this section. \begin{figure}[!t] \vspace{-5mm} \centering \includegraphics[width=0.49\textwidth]{graphs/overview.pdf} \vspace{-5mm} \caption{Overview of our empirical study} \label{fig:overview} \vspace{-5mm} \end{figure} \vspace{-1mm} \subsection{Stack Exchange forums data collection }\label{AA} We follow three steps to collect QSE related data from Stack Exchange forums. First, we collect Q\&A data from four Stack Exchange forums. Second, we identify a set of tags that are related to QSE. Finally, we use the identified tags to select the posts that are related to QSE. We explain the steps below. \noindent \textbf{Step 1: Collecting technical Q\&A data.} We extract technical Q\&A data from four Stack Exchange forums: Stack Overflow\cite{stackoverflow}, Quantum Computing Stack Exchange\cite{quantumcomputing.stackexchange}, Computer Science Stack Exchange\cite{cs.stackexchange}, and Artificial Intelligence Stack Exchange\cite{ai.stackexchange}. We consider the Stack Overflow forum as it contains posts related to quantum programming and it is widely used for studying various software engineering topics (e.g., mobile app development~\cite{linares2013exploratory, rosen2016mobile}, machine learning application development~\cite{alshangiti2019developing}, etc.). We consider the other three forums because they contain posts that discuss topics related to quantum computing and quantum programming. We extracted the post data from these forums with the help of the Stack Exchange Data Explorer\cite{data.stackexchange}. Stack Exchange data explorer holds an up to date data for these forum between 08-2008 and 03-2021. \noindent \textbf{Step 2: Identifying tags related to QSE.} The studied Stack Exchange forums use user defined tags to categorize questions. We follow two sub-steps to select the tags that are related to QSE. We started by searching for questions with the tag ``quantum-computing'' in the entire Stack Exchange dataset $D$ through the data exchange explorer. We obtained 254 questions tagged with ``quantum-computing'' from the studied forums. After manually inspecting the 30 most voted questions, we selected an initial tag set $T_{init}$ consisting of ten tags including ``quantum-computing'', ``qiskit'', ``qsharp'', ``q\#'', ``quantum-development'', ``quantum-circuit'', ``ibmq'', ``quantum-ai'', ``qubit'' and ``qutip''. Then we extracted the questions related to $T_{init}$ from the initial dataset $D$ and obtained a new set of questions $P$. In order to expand the initial tag set, we extracted the frequently co-occurring tags with $T_{init}$ from $P$ and build a new tag set $T_{2}$. Not all the tags in $T_{2}$ are related to quantum computing. To determine the final tag set $T_{final}$, following previous work~\cite{uddin2021understanding} \cite{9240667}, we filter the tags in $T_{2}$ based on their relationships when the initial tag set $T_{init}$. For each tag t in $T_{2}$, we calculate: \begin{equation} (\textnormal{Significance})\,\alpha (t) = \frac{\textnormal{\# of questions with tag } t \textnormal{ in } P}{\textnormal{\# of questions with tag } t \textnormal{ in } D} \end{equation} \begin{equation} (\textnormal{Relevance})\,\beta (t) = \frac{\textnormal{\# of questions with tag } t \textnormal{ in } P}{\textnormal{\# of questions in } P} \end{equation} To select a tag t, the value of significance-relevance $\alpha(t)$, $\beta(t)$ need to be higher than a threshold we set. To select the optimal threshold values for $\alpha$ and $\beta$, we experimented with a set of values respectively between 0.05, 0.35 and 0.001, 0.03. For each $\alpha$ and $\beta$ and for each tag above the threshold, we inspected the top 10 most voted posts and verified if the tag is related to QSE, we ended up with the optimal threshold respectively equal to 0.005 and 0.2 which are consistent with previous work~\cite{10.1109/MSR.2017.5}~\cite{9240667}. The final tag set $T_{final}$ is formed of 37 tags in total. Since quantum computing is a wide topic and our focus is QSE, we further manually inspected the description of each tag t in $T_{final}$ and the top 10 questions of each tag in each studied forum to remove tags that are not related to QSE. Finally our tag set $T_{final}$ was reduced from 37 to 18 tags (14 unique tags as different forums have tags with the same names). Table~\ref{tab:tags} lists our final set of tags. \input{tables/tagSetTable} \noindent\textbf{Step 3: Selecting questions and answers.} We extract the final sets of questions and answers using the final tag sets shown in Table~\ref{tab:tags}. We select all the posts that are tagged with at least one of the tags. We ended up with a total of 3,117 questions and answers from the four considered forums in our data set $D_{final}$. 35\% of the final data are answers where 65\% are questions. The number of posts (questions and answers) extracted from each forum is shown in Table~\ref{tab:tags}. \vspace{-1mm} \subsection{GitHub issues data collection} In this work, we study the issue reports of quantum computing projects on GitHub. We downloaded the GitHub selected quantum computing projects issues in March 2021. We follow three steps described below to extract the issue reports of quantum computing projects from GitHub. \noindent\textbf{Step 1: Searching candidate projects.} We search for quantum computing related projects using three criteria: 1) The description of the project must be in English (i.e., for us to better understand the content). 2) The project name or description must contain the word ``quantum'' (the word quantum is case sensitive in the project name or description). 3) The project is in a mainline repository (i.e., not a fork of another repository). We end up with a total of 1,364 repositories. \noindent\textbf{Step 2: Filtering quantum computing projects.} We filter the searching result and identify quantum computing related projects with three criteria: 1) To avoid selecting student assignments, following previous work~\cite{Businge2018CloneBasedVM}~\cite{Businge2019StudyingAA}, we select repositories that were forked at least two times. 2) The projects must have a sufficient history of development for us to analyze the issue reports. Therefore, we select the projects that were created at least 10 months earlier than the data extraction date. Moreover, only the projects that have at least 100 commits and 10 issues are selected. 3) To ensure the quality of the project selected, we manually inspect the projects' descriptions and remove projects that are not related to quantum computing, projects that are created for hosting quantum computing related documentation, as well as lecture notes related to quantum computing. Finally, we obtain a total of 122 projects directly related to quantum computing applications. \noindent\textbf{Step 3: Extracting issue reports.} We use the GitHub Rest API~\cite{githubrestapi} to extract all the issue reports of the final 122 projects on GitHub. In total, we obtain 43,979 issue reports. \vspace{-1mm} \subsection{Data pre-processing for topic modeling} We build one topic model on the Stack Exchange forum data and another topic model on the GitHub issue data. Below we describe how we pre-process these two types of data before feeding them into topic models. \noindent\textbf{Pre-processing Q\&A post data.} We treat each post (i.e., a question or an answer) as an individual document in the topic model. For each question, we join the title and the body of the question to create a single document. As Q\&A posts contain code snippets between \textless code\textgreater { and} \textless /code\textgreater { which} may bring noise to our topic models, we remove all text between \textless code\textgreater { and} \textless /code\textgreater. We also remove HTML tags (e.g., \textless p\textgreater\textless /p\textgreater), URLs and images from each post. In addition, we remove stop words (e.g., ``like'', ``this'', ``the''), punctuation, and non-alphabetical characters using the Mallet and NLTK stop words set. Finally, we apply the Porter stemming \cite{potterStemming} to normalize the words into their base forms (e.g., ``computing'' is transformed to ``comput''), which can reduce the dimensionality of the word space and improve the performance of topic models~\cite{PerformanceAnalysis:Stemming \begin{comment} \noindent \textbf{Technical forums posts:} \begin{enumerate} \item We join the title and the text body of the questions to create one final body The text body. Also Q\&A posts contains code snippets between \textless code\textgreater\textless \textbackslash code\textgreater which contains programming languages code that can be irrelevant to our analysis and can lead to bad topic modeling. We remove every text between \textless code\textgreater. \item HTML tags like \textless p\textgreater\textless \textbackslash p\textgreater, URLs and images are removed from Q\&A posts final body. \item We remove the stop word such as like, this, the, punctuation and non-alphabetical characters using Mallet \cite{McCallumMALLET} and NLTK stop words set. \item We apply Porter stemming \cite{potterStemming} to normalize the word and return it to the base form (i,e 'computing', transformed to 'comput'). The morphological form improves the contextual understanding by strengthening the similarity while conserving the diversity. Besides, the stemming will reduce the dimensionality, as a result, enhance the performance of the Topic modeling. \end{enumerate} \end{comment} \noindent\textbf{Pre-processing issue report data.} We treat each issue report as an individual document in the topic model. We join the title and the body of each issue as a single document. Similarly, we remove code snippets, URLs and images from the issue body. Since there are no tags in GitHub issues that identify code snippets, we look for backquote ” ” or triple backticks ``` in the content of the issues and remove the code enclosed between this punctuation. We also remove stop words, non-alphabetical characters, and punctuation. Finally, we apply Porter stemming to normalize the words into their base forms. \begin{comment} \begin{enumerate} \item We join the title and the body of the issue \item Since there is no HTML tags in GitHub issues, to remove the code snippets we look for back quote ” ” in the content of the issues and remove the code enclosed between this punctuation. \item URLs, numbers, punctuation, non-alphabetical characters and stop words are removed from final body. \item We apply Porter stemming to normalize the word and transform it to the base form. \end{enumerate} \end{comment} \vspace{-1mm} \subsection{Topic modeling} We use automated topic modeling to analyze the topics in the Q\&A posts and issue reports. Specifically, we use the Latent Dirichlet Allocation (LDA) algorithm~\cite{blei2003latent} to extract the topics from both of our datasets. LDA is a probabilistic topic modeling technique that derives the probability distribution of frequently co-occurred word sets (i.e., topics) in a text corpus. A topic is represented by a probability distribution of a set of words, while a document is represented as a probability distribution of a set of topics. LDA is widely used for modeling topics in software repositories~\cite{chen2016survey}, including technical Q\&A posts (e.g,~\cite{barua2014developers}) and issue reports (e.g.,~\cite{hindle2016contextual}). We use two separate topic models to extract the topics from the Q\&A post data and the issue report data. For a better performance of the topic modeling and a good classification quality, following previous work~\cite{9240667}~\cite{inproceedings}, we consider both uni-gram and bi-gram of words in our topic models. \noindent\textbf{LDA Implementation.} We use the Python implementation of the Mallet topic modeling package~\cite{McCallumMALLET} to perform our topic modeling. The Mallet package implements the Gibbs sampling LDA algorithm and uses efficient hyper-parameter optimization to improve the quality of the derived topics~\cite{McCallumMALLET}. \noindent\textbf{Determining topic modeling parameters.} The number of topics ($K$) is usually manually set by the user as it controls the granularity of the topics~\cite{9240667}. The $\alpha$ parameter controls the topic distribution in the documents (i.e., Q\&A posts or issue reports), while the $\beta$ parameter controls the word distribution in the topics. In this work, we use the topic coherence score~\cite{Rder2015ExploringTS} to evaluate the quality of the resulting topics and determine the appropriate parameters ($K$, $\alpha$, and $\beta$), similar to prior work~\cite{9240667, 10.1145/3183895.3183901}. The coherence score measures the quality of a topic by measuring the semantic similarity between the top words in the topic. Thus, this score distinguishes between topics that are semantically interpretable and topics that are coincidences of statistical inference \cite{Rder2015ExploringTS}. Specifically, we use the Gensim Python package's \texttt{CoherenceModel} \cite{Gensim.CoherenceModel} module to calculate the coherence scores of the resulting topics. To capture a wide range of parameters and keep the topics distinct from each other, we experiment with different combination of the parameters, by varying the values of $K$ from 5 to 30 incremented by 1 each time, the values of document-topic distribution $\alpha$ from 0.01 to 1 incremented by 0.01~\cite{Han2020WhatDP}, and the values of word-topic distribution $\beta$ from 0.01 to 1 incremented by 0.01~\cite{Han2020WhatDP}. We retain the resulting topics with the highest average coherence score. After getting the automatically derived topics, we manually analyze the resulting topics and assign meaningful labels to the topics. We elaborate more on this process in RQ2 and RQ3 for the Q\&A post topics and the issue report topics, respectively. \begin{comment} \Foutse{the following paragraph should be moved to the approach of the RQs!} To analyze the discussions in Q\&A and GitHub platforms and capture the topics. We run LDA algorithm on the different data set corpus. The data set is composed of two corpus: 43,979 GitHub issues and 3,117 Q\&A posts. Since LDA has no semantic knowledge, the topic has to be manually categorized to give a meaning. \end{comment} \begin{comment} \subsection{Type of questions manual labeling} To detect the type of question in QSE topics, following previous works~\cite{beyer2020kind} we perform manual analysis on statistical significant random sample SO and SE questions. On two round, and using cart sorting technique the authors label the posts according to 9 categories: API usage, Theoretical, Errors, Conceptual, Discrepancy, Learning, Review, Tooling and API change. \end{comment} \section{Introduction} Over the past decades, quantum computing has made steady and remarkable progress~\cite{knight2018serious, maslov2018outlook, zhao2020quantum}. For example, IBM Quantum\cite{ibm} now supports developers to develop quantum applications using its programming framework and execute them on its cloud-based quantum computers. Based on the quantum mechanics principles of \texttt{superposition} (quantum objects can be in different states at the same time)~\cite{dirac1981principles} and \texttt{entanglement} (quantum objects can be deeply connected without direct physical interaction)~\cite{schrodinger1935discussion}, quantum computers are expected to make revolutionary computation improvement over today's classical computers~\cite{mueck2017quantum}. In particular, quantum computing is expected to help solve the computational problems that are difficult for today's classical computers, including problems in cryptography, chemistry, financial services, medicine, and national security~\cite{piattini2020talavera}. The success of quantum computing will not be accomplished without quantum software. Several quantum programming languages (e.g., QCL~\cite{omer2003qcl}) and development tools (e.g., Qiskit\cite{Qiskit} have been developed since the first quantum computers. Large software companies like Google\cite{quantumai}, IBM\cite{ibm}, and Microsoft\cite{microsoft.azure} have developed their technologies for quantum software development. Quantum software developers have also achieved some preliminary success in applying quantum software to certain computational areas (e.g, machine learning~\cite{biamonte2017quantum}, optimization~\cite{guerreschi2017practical}, cryptography~\cite{mailloux2016post}, and chemistry~\cite{reiher2017elucidating}). However, there still lacks large-scale quantum software. Much like Software Engineering is needed for developing large-scale traditional software, the concept of Quantum Software Engineering (QSE) has been proposed to support and guide the development of large-scale, industrial-level quantum software applications. This concept has been gaining more and more attention recently~\cite{piattini2020talavera,zhao2020quantum, piattini2020quantum}. QSE aims to apply or adapt existing software engineering processes, methods, techniques, practices, and principles to the development of quantum software applications, or create new ones~\cite{piattini2020talavera}. Pioneering work sheds light on new directions for QSE, such as quantum software processes \& methodologies~\cite{moguel2020roadmap}, quantum software modeling~\cite{barbosa2020software}, and design of quantum hybrid systems~\cite{piattini2021toward}. In the meanwhile, we observe an exponential increase of discussions related to quantum software development on technical Q\&A forums such as Stack Overflow(e.g. from 8 in 2010 to 1434 in 2020). We also notice an increasing number of quantum software projects hosted on GitHub, where developers use issue reports to track their development and issue fixing processes. Such technical Q\&As and issue reports may communicate developers' faced challenges when developing quantum software applications. In this paper, we aim to understand the challenges perceived by quantum software developers and seek opportunities for future QSE research and practice. In particular, we examine technical Q\&A forums where developers ask QSE-related questions, and GitHub issue reports where developers raise QSE-related issues. We apply a series of heuristics to search and filter Q\&A posts that are related to QSE and to search and filter GitHub projects that are related to quantum software. In total, we extract and analyze 3,117 Q\&A posts and 43,979 Github issues that are related to QSE. We combine manual analysis and automated topic modeling to examine these Q\&A posts and Github issues, to understand the QSE challenges developers are facing. In particular, our study aims to answer the three following research questions (RQs): \begin{description} \item [\textbf{RQ1:}] \textit{What types of QSE questions are asked on technical forums?} To understand the intention behind developers' questions on technical forums and the types of information that they are seeking, we manually examined a statistically representative sample of questions. We extended a previous taxonomy from prior work \cite{Beyer2021WhatKO} and found nine categories of questions. Our results highlight the need for future efforts to support developers' quantum program development, in particular, to develop learning resources, to help developers fix errors, and to explain the theory behind quantum computing code. \item [\textbf{RQ2:}] \textit{What QSE topics are raised in technical forums?} The QSE-related posts may reflect developers' challenges when learning or developing quantum programs. To understand their faced challenges, we use topic models to extract the semantic topics in their posts. We derived nine topics including traditional software engineering topics (e.g., \texttt{environment management} and \texttt{dependency management}) and QSE-specific topics (e.g., \texttt{quantum execution results} and \texttt{quantum vs. classical computing}). We highlighted some particularly challenging areas for QSE, such as interpreting quantum program outputs, understanding quantum algorithm complexity, and bridging the knowledge gap between quantum computing and classical computing. \item [\textbf{RQ3:}] \textit{What QSE topics are raised in the issue reports of quantum-computing projects?} Issue reports of quantum computing projects record developers' concerns and discussions when developing these projects. Thus, we analyze the topics in the issue reports to understand the challenges are developers facing in practical quantum computing projects. We observe that the QSE-related challenges that we derived from forum posts indeed impact practical quantum program development in these GitHub projects, while GitHub issues bring new perspectives on developers' faced challenges (e.g., on specific quantum computing applications such as machine learning). We also observe that such challenges are general among quantum computing projects. \end{description} \noindent \textbf{Paper organization.} The rest of the paper is organized as follows. In Section~\ref{sec:background} we discuss the background about quantum software engineering and the related work. Then, in Section~\ref{sec:setup} we describe the design of our study. In Section~\ref{sec:results} we present our results. Section~\ref{sec:threats} discusses threats to the validity of our findings. Finally, Section~\ref{sec:conclusions} concludes the paper. \section{Experiment Results} \label{sec:results} In this section we report and discuss the results of our three research questions. For each research question, we first present the motivation and approach, then discuss the results for answering the research question. \input{Sections/RQ1} \input{Sections/RQ2} \input{Sections/RQ3} \section*{Acknowledgment} The preferred spelling of the word ``acknowledgment'' in America is without an ``e'' after the ``g''. Avoid the stilted expression ``one of us (R. B. G.) thanks $\ldots$''. Instead, try ``R. B. G. thanks$\ldots$''. Put sponsor acknowledgments in the unnumbered footnote on the first page. \section*{References} Please number citations consecutively within brackets \cite{b1}. The sentence punctuation follows the bracket \cite{b2}. Refer simply to the reference number, as in \cite{b3}---do not use ``Ref. \cite{b3}'' or ``reference \cite{b3}'' except at the beginning of a sentence: ``Reference \cite{b3} was the first $\ldots$'' Number footnotes separately in superscripts. Place the actual footnote at the bottom of the column in which it was cited. Do not put footnotes in the abstract or reference list. Use letters for table footnotes. Unless there are six authors or more give all authors' names; do not use ``et al.''. Papers that have not been published, even if they have been submitted for publication, should be cited as ``unpublished'' \cite{b4}. Papers that have been accepted for publication should be cited as ``in press'' \cite{b5}. Capitalize only the first word in a paper title, except for proper nouns and element symbols. For papers published in translation journals, please give the English citation first, followed by the original foreign-language citation \cite{b6}. \section*{Acknowledgment} The preferred spelling of the word ``acknowledgment'' in America is without an ``e'' after the ``g''. Avoid the stilted expression ``one of us (R. B. G.) thanks $\ldots$''. Instead, try ``R. B. G. thanks$\ldots$''. Put sponsor acknowledgments in the unnumbered footnote on the first page. \section*{References} Please number citations consecutively within brackets \cite{b1}. The sentence punctuation follows the bracket \cite{b2}. Refer simply to the reference number, as in \cite{b3}---do not use ``Ref. \cite{b3}'' or ``reference \cite{b3}'' except at the beginning of a sentence: ``Reference \cite{b3} was the first $\ldots$'' Number footnotes separately in superscripts. Place the actual footnote at the bottom of the column in which it was cited. Do not put footnotes in the abstract or reference list. Use letters for table footnotes. Unless there are six authors or more give all authors' names; do not use ``et al.''. Papers that have not been published, even if they have been submitted for publication, should be cited as ``unpublished'' \cite{b4}. Papers that have been accepted for publication should be cited as ``in press'' \cite{b5}. Capitalize only the first word in a paper title, except for proper nouns and element symbols. For papers published in translation journals, please give the English citation first, followed by the original foreign-language citation \cite{b6}.
\section*{Executive Summary} This explainer document aims to provide an overview of the current state of the rapidly expanding work on synthetic data technologies, with a particular focus on privacy. The article is intended for a non-technical audience, though some formal definitions have been given to provide clarity to specialists. This article is intended to enable the reader to quickly become familiar with the notion of synthetic data, as well as understand some of the subtle intricacies that come with it. We do believe that synthetic data is a very useful tool, and our hope is that this report highlights that, while drawing attention to nuances that can easily be overlooked in its deployment. The following are the key messages that we hope to convey. \paragraph{Synthetic data is a technology with significant promise.} There are many applications of synthetic data: privacy, fairness, and data augmentation, to name a few. Each of these applications has the potential for a tremendous impact but also comes with risks. \paragraph{Synthetic data can accelerate development.} Good quality synthetic data can significantly accelerate data science projects and reduce the cost of the software development lifecycle. When combined with secure research environments and federated learning techniques, it contributes to data democratisation. \paragraph{Synthetic data is not automatically private.} A common misconception with synthetic data is that it is inherently private. This is not the case. Synthetic data has the capacity to leak information about the data it was derived from and is vulnerable to privacy attacks. Significant care is required to produce synthetic data that is useful and comes with privacy guarantees. \paragraph{Synthetic data is not a replacement for real data.} Synthetic data that comes with privacy guarantees is necessarily a distorted version of the real data. Therefore, any modelling or inference performed on synthetic data comes with additional risks. It is our belief that synthetic data should be used as a tool to accelerate the ``research pipeline'' but, ultimately, any final tools (that will be deployed in the real world) should be evaluated, and if necessary, fine-tuned, on the real data. \paragraph{Outliers are hard to capture privately.} Outliers and low probability events, as are often found in real data, are particularly difficult to capture and include in a synthetic dataset in a private way. For example, it would be very difficult to ``hide'' a multi-billionaire in synthetic data that contained information about wealth. A synthetic data generator would either not accurately replicate statistics regarding the very wealthy or would reveal potentially private information about these individuals. \paragraph{Empirically evaluating the privacy of a single dataset can be problematic.} Rigorous notions of privacy (e.g differential privacy) are a requirement on the {\em mechanism that generated} a synthetic dataset, rather than on the dataset itself. It is not possible to rigorously evaluate the privacy of a given synthetic dataset by directly comparing it with real data. Empirical evaluations can prove useful as tools to detect possible flaws in an algorithm or its implementation but may lead to false claims of privacy when there is none. \paragraph{Black box models can be particularly opaque when it comes to generating synthetic data.} Overparametrised generative models excel in producing high-dimensional synthetic data, but the levels of accuracy and privacy of these datasets are hard to estimate and can vary significantly across produced data points. \paragraph{Synthetic data goes beyond privacy.} Synthetic data provides promising tools to improve fairness, bias and the robustness of machine learning systems, but significantly more research is required to fully understand the opportunities and the limitations of this approach. \clearpage { \tableofcontents } \section{Introduction} The availability of high volume, high velocity and high variety datasets, together with advanced statistical tools for extracting information, has the potential to improve decision-making and accelerate research and innovation. At the same time, many large-scale datasets are highly sensitive (e.g. in health or finance) and sharing them may violate fundamental rights guarded by modern privacy regulations (e.g. GDPR or CCPA). A large number of real-world examples demonstrate that high-dimensional, often sparse, datasets are inherently vulnerable to privacy attacks and that existing anonymisation techniques do not provide adequate protection. This limits our ability to share these large datasets, creating a bottleneck on the development and deployment of machine learning and data science methods. Synthetic data is generated by a model, often with the purpose of using it in place of real data. By controlling the data generation process, the end-user can, in principle, adjust the amount of private information released by synthetic data and control its resemblance to real data. As well as addressing privacy concerns, one can to adjust for biases in historical datasets and to produce plausible hypothetical scenarios. If used responsibly, synthetic data promises to enable learning across datasets when the privacy of the data needs to be preserved; or when data is incomplete, scarce or biased. It can help researchers and developers prototype data-driven models and be used to verify and validate machine learning pipelines, providing some assurance of performance. It can also fuel responsible innovation by creating digital sandbox environments used by startups and researchers in hackathon-style events. Each of these uses presents great opportunities, but also challenges that require tailor-made solutions. Synthetic data generation is a developing area of research, and systematic frameworks that would enable the deployment of this technology safely and responsibly are still missing. \subsection{Report Structure} This explainer is organised as follows. In Section \ref{sec:what} we introduce a definition for synthetic data, give a brief history of its inception, and begin to answer one of the core questions surrounding synthetic data: {\em can it replace replace real data?} In Section \ref{sec:app}, we introduce key machine learning applications for synthetic data. Sections \ref{sec:privacy}-\ref{sec:privsdg} are dedicated to private synthetic data generation. In Section \ref{sec:privacy}, we introduce privacy from a more general perspective than synthetic data, introducing differential privacy and discussing some of its limitations. In Section \ref{sec:3att} we discuss three key attributes for evaluation of private synthetic data: utility, fidelity, and privacy. In Section \ref{sec:privaudit}, we discuss empirical evaluations of synthetic data for these key attributes. In Section \ref{sec:privsdg}, we discuss key differences between general privacy, and privacy as applied to the generation of synthetic data. We also survey existing methods in the space of private synthetic data generation. At the end of the section we discuss partially synthetic data, in which synthetic data is generated to create a hybrid real-synthetic dataset. In Sections \ref{sec:debias} and \ref{sec:dataaug} we discuss synthetic data for fairness and data augmentation. In Section \ref{sec:generalgen}, we provide a more in-depth survey of existing generative models. Finally, in Section \ref{sec:indmess}, we summarise key themes from discussions with industry partners and start-ups in the field of synthetic data. \section{What is Synthetic Data?} \label{sec:what} Despite tremendous interest in synthetic data, \cite{jordon2020synthetic,assefa2020generating,mendelevitch2021fidelity,bellovin2019privacy,mckenna2021winning}, to the best of our knowledge there is no widely accepted definition. In order to encapsulate the full breadth of applications and approaches to synthetic data, we propose the following definition. \begin{definition} Synthetic data is data that has been generated using a purpose-built mathematical model or algorithm, with the aim of solving a (set of) data science task(s). \end{definition} We contrast synthetic data with real data, which is generated not by a model but by real world systems (e.g financial transactions, satellite images, medical tests etc.). The {\em model} -- the synthetic data generator -- can take many forms, from deep learning architectures such as the popular Generative Adversarial Networks (GANs) \cite{gan}, or Variational Auto-encoders (VAEs) \cite{vae}, through agent-based and econometric models \cite{bonabeau2002agent}, to a set of (stochastic) differential equations modeling a physical or economic system \cite{carmona2018probabilistic}. Using computer-generated synthetic data to solve particular tasks is not a new idea, and can be dated back at least as far as the pioneering work of Stanislaw Ulam and John von Neumann in the 1940s on Monte Carlo simulation methods. Synthetically generated data has been widely used in research, as it provides a `ground truth', which is very useful in developing and evaluating machine learning pipelines. The recent increase in data protection regulations has fueled the use of synthetic data to mitigate disclosure risk. The key hope, which goes back to work by Rubin and Little, \cite{rubin1987multiple,rubin1993discussion,little1993statistical}, is to be able to use synthetic data in place of real data, to avoid privacy concerns \cite{dpbook, privbayes, dpganxie, rcgan, pategan}. The need to extract actionable information from large datasets led to the development of complex, data-driven (machine learning) models. For these models, the role of data in driving model selection is more prominent than it is for simpler, handcrafted models. This means that the quality of the model's output is directly dependent on the quality of the data used to train these models. This leads to a number of uses for synthetically generated data. One such use is bias removal (e.g. historical biases in gender or race) \cite{feldman2015certifying, kamiran2009classifying, zhang2016causal, calmon2017optimized, fairgan, decaf}. Given biased training data, a natural approach is to train models using available data; these biases can then be seen in the output of the trained models. Rather than attempting to de-bias each trained model individually, one could generate a de-biased synthetic dataset and use it to train each model \cite{fairgan, decaf}, creating a unified approach for handling biases across an organisation. Another use would be to use synthetic data to enlarge datasets that are too small, e.g. to provide robustness against ``outlier'' examples \cite{wong2016understanding, gansemisup, badgansemi, ganmanisemi, timesemi, timeressemi}. Another key use case, to which we pay particular attention in this report, is the goal of using synthetic data to protect privacy. In each of these cases, the goal is to create synthetic data which resembles some aspects of the real data but not others. To maximise the utility of synthetic data, a fine balance must often be struck between competing objectives. It is crucial to understand that synthetic data does {\em not} automatically address any of these problems. Training an off-the-shelf generative model based on real data, and then using this trained model to generate synthetic data, is {\em not inherently private}. Standard GANs do not generate private nor unbiased data. In fact, machine learning models have demonstrated the capability to (undesirably) memorise their training inputs \cite{arpit2017closer, goodfellow2016deep}. Applied to GANs, this can result in memorisation and regurgitation of the training data \cite{modecollapse}, undermining privacy in the synthetic data. At the other extreme, synthetic data can be generated without training data, e.g. using agent-based models that mimic the data generation process, such as agents transacting in a financial network. With no access to any real data, the synthetic data generator is private, but the data it generates is limited to the model's predetermined configuration, and will not enable statistical inferences to be reliably drawn about the real world. \subsection{Can synthetic data replace real data?} \label{sec:likerealdata} The use of synthetic data raises two key questions: \begin{enumerate} \item Can we do the same things {\em with} synthetic data that we do {\em with} real data? \item Can we do the same things {\em to} synthetic data that we do {\em to} real data? \end{enumerate} The sorts of things we may wish to do {\em with} synthetic data are building models, performing data analysis, testing hypothesis, etc. Things one may wish to do {\em to} synthetic data, for example, might be linking separate datasets together, or extending a synthetic dataset when new records are added to the original dataset. \subsubsection{How should we approach doing things {\em with} synthetic data?} Ideally, one may hope that synthetic data can be simply plugged in wherever one might usually use real data (e.g. as training data for a model). Many papers on synthetic data evaluate it in this way. However, with private data, a more careful approach may lead to more accurate information being extracted from the synthetic data \cite{williams2010probabilistic}. In particular, conclusions from data analysis and hypothesis testing are necessarily weaker when using synthetic rather than real data, and the statistical significance of such analyses needs to be adjusted accordingly. A particular concern for private data is bias. Ghalebikesabi et al.~\cite{ghalebikesabi2021bias} warn against the risks of learning from synthetic data, and propose a methodology for learning unbiasedly from such data. Wilde et al. \cite{wilde2021foundations} demonstrate superior performance when model parameters are updated using Bayesian inference, rather than approaches that fail to account for the fact the training data is synthetic. \subsubsection{Data Linking} \label{sec:datalinking} Something that can naturally be done with real data is linking. One dataset may contain an individual's lab test results, another may contain their genetic data, and another their hospital appointments. Each of these datasets can be linked to create a larger dataset containing information about inter-dataset correlations. If these datasets were synthesised independently, the 1-1 match between datasets will be broken; if, in the future, someone wished to pull together these synthetic datasets to investigate the correlations between, say, genetic data and lab test results, they would not be able to do so effectively. One solution would be to encourage data holders to generate synthetic data with other (previously generated) synthetic datasets in mind. This may be appropriate in some situations (e.g. when the two datasets are being held by the same data holder), but in general this will not be the case. Moreover, the initial privacy loss suffered by an individual present in both datasets will be greater than if synthetic data was generated independently. This is particularly inefficient when linking the datasets might not be important, or the benefits of doing so are unclear. In these situations, there is a need to be able to link two independently generated synthetic datasets (given access to real data) in a minimally privacy-leaking way. One workaround would be to simply generate a new joint dataset from the newly-joined underlying real datasets; but this does not leverage the existing synthetic data. A less naive approach would be to conditionally generate one of the two synthetic datasets based on the other (existing) synthetic dataset. This is a reduction in privacy cost over generating from scratch, but still fails to leverage the second already-generated synthetic dataset. \subsection{Combining Synthetic Data with Other Technologies} \label{sec:othertech} \textbf{Secure Research environment.} Synthetic data, in particular with differential privacy, has a natural application within secure research environments, in which decreasingly private data can be accessed in increasingly more ``secure'' environments. Consider releasing a dataset with strong privacy guarantees initially, evaluating a range of machine learning methods, then selecting the top $N$ candidates, and giving them access to less private data. This can be repeated, giving a `tournament' of methods. This raises the question of how to generate a series of datasets $\mathcal{D}_1, ..., \mathcal{D}_n$ which decrease in privacy individually and when taken together (so any subset $\mathcal{D}_1, ..., \mathcal{D}_j$, $j < n$ is as private as the terminal dataset, $\mathcal{D}_j$). \textbf{Federated learning.} Federated learning is an emerging technology that enables training across decentralised datasets without pooling these datasets together. This contrasts with traditional centralised machine learning techniques, where the data is uploaded to one server, as well as to classical decentralised approaches which often assume that local data samples are identically distributed. In federated learning, distributed data holders allow an algorithm to be run on their private data, and only the (possibly noisy) outputs are released, without giving direct access to the data. The challenge with it is that, without accessing the data first, it might not be clear what algorithm one should run. Developing an algorithm on private synthetic data samples and evaluating its utility on real (distributed) data seems a very promising approach to this data bottleneck. \section{Why use Synthetic Data?} \label{sec:app} Synthetic data is being used as a solution to a variety of problems in many domains. Three key areas that are of particular interest in a machine learning context are: (i) private data release (Section \ref{sec:privacy}); (ii) data de-biasing and fairness (Section \ref{sec:debias}); and (iii) data augmentation for robustness (Section \ref{sec:dataaug}). Although these are the areas that appear to have the most promise, this list is not exhaustive. Before going into details for each of them, we outline the key ideas for these areas and some of the specific use cases (and non-use cases) below. \subsection{Private Data Release} The wide adoption of data-driven machine learning solutions as the prevailing approach to innovate has created a need to share data. Without access to quality data, scientists and developers cannot make meaningful progress. However, GDPR, HIPAA, and a host of privacy regulations require data on individuals not to be shared carelessly (rightly so). The result is typically a long series of ``jumping through hoops'' in an attempt to access the necessary data. Synthetic data offers a potential solution. \paragraph{Development of ML tools.} In this use case, a data controller may wish to assess an ML group's ability to solve a problem, or perhaps even assess several groups simultaneously to select the best partner with which to develop a final solution. In order to avoid privacy concerns, they plan to share synthetic data with their potential partners. For synthetic data to be useful in this setting, model development that is performed on the synthetic data should lead to the same conclusions as if it were carried out on the real data. More concretely, if a researcher comparing two models on the synthetic data were to conclude that model A outperforms model B for a given task, then the same conclusion should be reached when testing both algorithms on the real data. This suggests that, though the synthetic data would need to share many statistical properties with the real data, one can imagine that there are some properties that would not affect these comparisons. Once a final group/model has been determined, it can be taken to the real data for testing, tuning or even a complete re-training. \paragraph{Software testing.} There is a significant appetite for vast amounts of test production data for both system testing and User Acceptance Testing. Synthetic data can remove the requirement of going through lengthy and repeated approvals (e.g GDPR) and sanitation processes and hence save significant time and effort in the development lifecycle. In this setting, it is important that synthetic data used for software testing is semantically correct, but it need not necessarily be statistically correct. Mathematically, this amounts to learning the {\em support} of the distribution and relevant structural properties (e.g time-series data), but not necessarily the distribution itself. Naturally, by not requiring statistical accuracy, there is much more room for increased privacy (or increased utility at the same privacy level). This is one of the design principles of OpenSafely~\cite{williamson2020factors}, where practitioners are able to test and develop algorithms on dummy data before running them once on the real data. \paragraph{Deploying private machine learning tools.} Machine learning models are not inherently private. It is well known that neural networks have the capability to memorise training inputs. Membership inference attacks are possible against such networks~\cite{shokri2017membership} and, as such, privacy-enforcing training algorithms for machine learning models have been developed \cite{dpsgd, abadi2016deep, pate1, pate2}. An apparent alternative (to enforcing privacy during the training of a model) would be to generate private data and then train a model using this data. {\em Perhaps} one advantage of such an approach would be that a single private synthetic dataset could create a unified approach to privacy (within a single organisation, say), but we believe that the cost in utility would outweigh the potential ``simplicity'' of the approach in most applications. While training the model on private synthetic data might be appealing, it has limitations. Private data generation isn't often able to capture all of the statistical structure that might be important to develop accurate models. As such we believe it to be more prudent to focus efforts on the privacy of trained models, rather than on trying to generate private data with which to train. \subsection{De-biasing} \paragraph{Reducing/removing bias.} When generating synthetic data, one can aim at producing samples that do not suffer from historical biases but are otherwise still statistically accurate. Such data can be used then for training `black box' ML pipelines, while mitigating the risk of historical biases being amplified \cite{tiwald2021representative}. Importantly, such data can be reused to train multiple models. This should be contrasted with the approach of correcting each trained model separately. The latter approach has an additional disadvantage, as it could lead to inconsistencies in the way 'fairness and bias' are treated within an organisation. It must be recognised, however, that employing such methods to remove bias from the data introduces additional model risks that need to be quantified and monitored. \paragraph{What-if-scenario generation.} Adjacent to bias removal in datasets is the question of {\em causal modelling} -- i.e. asking the question ``What if?''. Synthetic data may allow us to explore data generated according to the same causal structure but adjusted distributions, or with different causal interventions placed on the data generating process. One must be very careful to properly model causal relationships though, as causal modelling is sensitive to assumptions and is {\em not} the same as conditional generation. Indeed, the trustworthy deployment of data-driven models requires that these perform well in situations that differ from the real data. Of course, again, we stress that model risk is being introduced as generative models are being used to produce these new scenarios. \subsection{Data Augmentation} \paragraph{Data labelling.} Deep neural networks are state of the art technology in computer vision applications. However, training deep neural networks requires vast amounts of (correctly) labelled data, which is often costly to produce. Synthetically generated labelled data offers a cost-efficient solution to this challenge, and has already been adopted by industry \cite{nikolenko2019synthetic}. In this application, one trains a neural network on synthetic data with the intention to deploy it on real data. In general, privacy is not of primary concern in these applications, as the data is not being used to replace the real data but to be used alongside it. \section{Privacy in Machine Learning - An Overview} \label{sec:privacy} Privacy is an incredibly large field, with practitioners coming from a wide variety of domains. Here, we present our view on privacy within the context of machine learning. We take a ground-up approach, motivating privacy through the notion of an adversary that has the potential to cause harm should too much information about an individual be revealed to them. Privacy is a fundamental human right and a prerequisite for freedom of thought and expression. For this reason, a key requirement of privacy is the \textit{consent} of individuals to have their data collected. This consent usually relies on the expectation that the collection of their data, and the subsequent release of information derived from it, will not cause them \textit{harm}. For some types of information, such as an individual's name, address, and phone number, the potential for harm is clear. For others, the potential for harm is more subtle: e.g. it might be that an insurance company would increase the price of an individual's insurance premiums based on knowledge that the specific individual is a smoker, without explicitly requesting this information. This potential for harm is caused by the ability of an {\em adversary} to gain information about an individual due to the release of data, or more generally from output that is derived from the data (again, this could be a synthetic dataset, or some other algorithm output). On the other hand, there is a highly social aspect to working with data. Shared datasets that can be used to benchmark models create a community that promotes rapid advancement of technology (see, for example, the rapid progress made in image classification that was caused by the availability of the MNIST and CIFAR datasets \cite{mnist, cifar}). In general, researchers want data, and it may not need to be too accurate for them to start being able to work with it. Since the late 1990s, much research has been carried out within the realm of privacy. Early on, privacy was often tied together with the notion of {\em anonymity}, which came in a variety of flavours, from basic name/address/birthday removal (``pseudonymisation''), to $k$-anonymity \cite{kanom} (which itself had several iterations \cite{ldiv, tclose, dpres}). Although these notions apply to data, they really only have meaning on the raw data itself, and moreover have been shown to be inadequate even for that \cite{kcrit, imdb}. These approaches were built to prevent against {\em known} attacks. More recently, privacy is being studied with a view to prevent against abstract {\em threat models} rather than specific instantiations of an attack. \subsection{The Threat Model View} \label{sec:threat} Threat model privacy attacks can be summarised into 3 types: membership inference; attribute inference; and reconstruction attacks. \vspace{1em} \begin{tabularx}{\linewidth}{lXX} \textbf{Threat} & \textbf{Attacker's knowledge of Targeted Individual} & \textbf{Attacker's goal} \\ Membership inference & Partial/Entire record & Determine if Targeted Individual was in the original data\\ Attribute inference & Partial record & Recover missing attributes of Targeted Individual's data\\ Reconstruction attack & N/A & Recover entire records from the original data\\ \end{tabularx} These attacks differ both in their goals and in some of the assumptions placed on the adversary's prior knowledge {\em of the targeted individual}. It should be noted, however, that these attacks do not necessarily place any assumptions on the prior knowledge that an adversary might have about the individuals it is {\em not} targeting. These attacks are not typically performed against a single individual but multiple individuals at once, with a breach of any individual's privacy being considered a success by the adversary. \paragraph{Membership Inference.} Membership inference \cite{shokri2017membership, hu2021membership} aims to determine whether an individual (whose full record might be known to the adversary) was part of the data that was given as input to an algorithm, given the output of the algorithm (and, potentially, knowledge of the workings of the algorithm). On its own, this is only of relevance when membership in the dataset implies some information about an individual. For example, it is not particularly useful (or much of a privacy violation) to ascertain that a particular individual's data was in the 2021 UK Census dataset. Following the example of the smoker, though, it is a violation to be able to ascertain that a given individual is in a dataset that contains only smokers (such as a dataset used in a scientific study of smokers). \paragraph{Attribute Inference.} Attribute inference \cite{al2012homophily, privtraits} is slowly becoming infamous as a non-violation of privacy. The goal with attribute inference is to determine some extra information about an individual given some prior knowledge about some of their attributes and access to an algorithm's output (e.g. synthetic data, or a trained ML model). Of course, this is precisely what predictive models aim to do -- predict (an) attribute(s) from a set of other attributes \cite{kosinski2013private}. But this leads to an almost paradoxical conclusion, how can a model that was trained {\em without} an individual's data, violate their privacy? This almost-paradox has led to many privacy researchers abandoning attribute inference as a violation of privacy \cite{dpinf, scienceharm}. However, the question should not be, ``does this allow you to learn more about an individual?'', but rather, ``does this allow you to learn more about an individual than if they had not been in the data?'' It is still possible (in fact, with ML it is very likely \cite{dlgen}) that a trained model will perform better on its training inputs than on inputs not used for its training. This indicates that the release of such a model does violate the privacy of the individuals in the training set \cite{aioverfit}. Recent work in the space has attempted to determine the feasibility of attribute inference attacks. \cite{zhao2021feasibility} show that even when membership inference is possible, attribute inference may not be; they do, however, demonstrate that {\em approximate} attribute inference is possible. \paragraph{Reconstruction Attacks.} Reconstruction attacks~\cite{dinur2003revealing} aim to extract entire records from the training dataset, based on the output of an algorithm. For instance, Dinur and Nissim showed how a database protected by a question-and-answer system can be reconstructed by an attacker if the level of the noise added to answers is low~\cite{dinur2003revealing}. Another high profile example is the attack performed by researchers at the US Census bureau on aggregates from the 2010 Census. They were able to retrieve exact records for 46\% of the US population using publicly released data~\cite{uscensus2021}. Unlike membership and attribute inference attacks, reconstruction attacks are not \textit{targeted}: they aim to retrieve records for any (or all) records in the original data. This could leverage prior knowledge about {\em some} of the individuals in the training set (with the remaining unknown individuals being considered the targets). Note that the same caveat as for attribute inference attacks applies: even an algorithm sampling records uniformly at random in $\mathcal{X}$ will reconstruct \textit{some} records in the real data with nonzero probability. Evaluation of a reconstruction attack should therefore be contrastive, i.e.~based on the difference of reconstruction likelihood for a record due to their presence in the data (although real-world attacks recover such large fractions of the data that this consideration is often not needed). \subsection{Differential Privacy} \label{sec:dp} Differential Privacy \cite{dpbook, nontechdp}, first proposed by Dwork et al.~in 2006 \cite{ogdp}, is becoming increasingly accepted as a robust, meaningful, and practical definition of privacy \cite{uscensus, microsoftdp, facebookdp}. Informally, differential privacy requires that an algorithm's (necessarily random) output not differ ``too much'' between {\em adjacent} datasets. Intuitively, because the outcome cannot differ significantly, there cannot be too much ``information leakage'' from the dataset to the algorithm output. The definition rests on some notion of datasets being {\em adjacent} to each other, and can be used to capture the notion of an individual's data. This adjacency can be defined in different ways depending on the type of data structure. With so-called tabular data, adjacency between two datasets is typically defined to mean that one can be obtained from the other by either the removal/addition (unbounded differential privacy \cite{dpbook}) or replacement (bounded differential privacy \cite{dpbook}) of a row. Defining this adjacency amounts to deciding precisely what information should be protected \cite{mcsherry2009differentially, hardt2012beating}. With graph-like data, one could consider either entire nodes (along with all associated edges) to be important, or instead consider only the edges themselves to each be individually important \cite{edgenodedp, edgenodedp2}. With tabular data, one might define adjacency as datasets differing in precisely one value, allowing ``feature-wise'' differential privacy that protects each value contributed to the dataset, rather than rows as a whole. This would allow data contributors to decide to maintain the privacy of some, but potentially not all, of their data. A particularly important feature of differential privacy is that it is {\em contrastive} -- it compares the outcome of an algorithm when an individual is in the training data to the outcome when the individual is not in the training data, or some similar adjacent perturbation. This idea, that privacy cannot be breached when an individual is not in the data, is crucial in dismissing several more ad-hoc notions of privacy. Crucially, for synthetic data, just because one of the synthetic data points {\em looks like} one of the original data points does not mean that privacy has been violated -- the synthetic point might have been generated even without the original point being present in the training data. \begin{definition}[Differential Privacy \cite{dpbook}] \sloppy A {\em randomized} algorithm, $\mathcal{M}$, is $(\varepsilon,\delta)$-differentially private if for all $\mathcal{S} \subset \mathrm{Im}(\mathcal{M})$ and for all neighboring datasets $\mathcal{D}, \mathcal{D}'$: \begin{equation*} \mathbb{P}(\mathcal{M(\mathcal{D})} \in \mathcal{S}) \leq e^\varepsilon \mathbb{P}(\mathcal{M(\mathcal{D}')} \in \mathcal{S}) + \delta \end{equation*} When $\delta = 0$, $\mathcal{M}$ is said to be \emph{pure $\varepsilon$-differentially private}. \end{definition} \fussy Intuitively, the key promise of differential privacy is that \textit{any} analysis run on the output of a differentially private procedure will yield approximately the same result whether or not any individual contributes their record to the dataset. This also includes potential harms that could be caused by the publication of potentially sensitive information. For instance, assume that a DP procedure is used to train a ML model to detect a specific disease from sensitive medical records. No operation performed on this model (e.g. inspecting its parameters, applying it to well chosen inputs) can reveal information about individual training records. Hence, it serves as a form of statistical guarantee for individuals that the collection and use of their data will not yield negative consequences (that would not otherwise occur even if the data was not shared\footnote{A notorious~\cite{dpbook} example of this is an insurance company updating premiums based on the result of a study showing correlation between smoking and lung cancer. A client's premium might go up even if their data is not used in the study. Differential privacy here ensures that the result of the study would not change too much whether they give their data or not.}). Formally, from a Bayesian point of view, this means that for all potential priors over datasets, the posterior computed after observing the outcome will be similar to the posterior obtained if any one user was removed from the dataset~\cite{kasiviswanathan2014semantics}. \paragraph{Bayesian interpretation of Differential Privacy} {\em It is instructive to consider the Bayesian interpretation of privacy guarantees implied by differential privacy, which compares the adversary’s prior with the posterior. To that end it is useful to view $\mathcal D$ and $\mathcal D'$ as a realisation of a random variable $\bm{ \mathcal D}$. That way we can model prior knowledge an adversary has about the dataset i.e $\mathbb P(\bm{ \mathcal D} = \mathcal D)$. Note that $(\epsilon,0)$-differential privacy implies a bound on the Bayes factor \[ \frac{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D )}{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D' )} \leq e^{\epsilon}\,. \] This then implies a privacy guarantee on posterior beliefs regarding the value of $\bm{\mathcal D}$ given the output of a differentially private algorithm \[ \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D | \mathcal M(\bm{ \mathcal D}))} {\mathbb P( \bm{ \mathcal D} = \mathcal D' | \mathcal M(\bm{ \mathcal D}))} = \frac{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D )}{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D' )} \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D ) } {\mathbb P( \bm{ \mathcal D} = \mathcal D' ) } \leq e^{\epsilon} \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D )} {\mathbb P( \bm{ \mathcal D} = \mathcal D') }\,. \] To put it another way, and due to symmetry between $D$ and $D'$, differential privacy implies that the log-odds cannot change significantly, \[ \left| \log \left(\frac{\mathbb P( \bm{ \mathcal D} = \mathcal D | \mathcal M(\bm{ \mathcal D}))} {\mathbb P( \bm{ \mathcal D} = \mathcal D' | \mathcal M(\bm{ \mathcal D}))} \right) - \log \left( \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D )} {\mathbb P( \bm{ \mathcal D} = \mathcal D') } \right)\right| \leq \epsilon. \]} In light of the threat model view introduced in Section \ref{sec:threat}, it should be noted that differential privacy provides provable bounds on the ability of an adversary to perform such attacks \cite{dpboundmi}. These bounds assume worst-case prior information, knowledge of the algorithms, and computing power of the adversary. Differential Privacy also enjoys several nice properties that have helped with its adoption, such as composability, resistance to post-processing, and plausible deniability \cite{dpbook}. Composability and the post-processing theorem, in particular, allow for differentially private algorithms to be built out of smaller building blocks, which is precisely the driving force behind Differentially Private Stochastic Gradient Descent (DPSGD) \cite{dpsgd, abadi2016deep}. DPSGD has enabled differential privacy to be applied to deep learning architectures. This, in turn, has allowed the development of several DPSGD-driven generative models for synthetic data (see Sec. \ref{sec:privmodels}). \paragraph{Flavours of Differential Privacy.} Above, we introduced the two most common notions of differential privacy, pure- and approximate-differential privacy ($\varepsilon$ and $(\varepsilon, \delta)$). There are in fact several relaxations of differential privacy, such as Renyi-Differential Privacy \cite{renyidp}; extensions, such as Label-DP \cite{labeldp}; and even stronger notions, such as local differential privacy \cite{localdp}. Depending on the task at hand, these notions may be more or less useful than vanilla DP. \subsubsection{Limits of DP} \label{sec:limitsdp} Despite being widely accepted as the best available privacy definition, differential privacy is not without its weaknesses. \paragraph{Choosing parameters $\varepsilon, \delta$.} The privacy protection afforded by a differentially private mechanism is controlled by parameters $\varepsilon$ and $\delta$. Choosing appropriate values for these parameters is notoriously difficult (in part due to their opaqueness in interpretability), and strongly depends on the context~\cite{lee2011much, hsu2014differential, abowd2019economic}. This is further complicated by the fact that many methodologies lack a tight analysis of their privacy, leading to larger-than-necessary noise being injected into the system, hindering utility~\cite{stadler2020synthetic}. \paragraph{Relaxations.} Though often celebrated as a strength, the lack of assumptions placed on an adversary's knowledge and capabilities can lead to overly conservative computations, which hinder the utility of the output. Researchers have proposed many relaxations of the original definition (which required $\delta = 0$)~\cite{desfontaines2019sok}. However, the privacy guarantees of these can be hard to understand and model. Similarly to the parameters issue, researchers have started using attacks to compare mechanisms using different definitions of privacy~\cite{labeldp}. \section{Utility, Fidelity and Privacy of Synthetic Data.} \label{sec:3att} For synthetic data to be {\em meaningful}, it must be similar to {\em and} different from the original data in some sense. If synthetic data is being considered, then there is a reason that the original data is inappropriate or inadequate for the task at hand -- be it because it is non-private, biased, or too small -- and so synthetic data that is too similar to the original data will also suffer from the same problems. The ``allowed'' similarity (or rather the required non-similarity) will differ from task to task, and constitutes one of the 3 attributes that are fundamental to synthetic data generation: {\em utility}, {\em fidelity}, and {\em privacy}. \paragraph{Utility:} The utility of synthetic data often is determined by its usefulness for a given task or set of tasks. This often involves contrasting the performance of models trained on real vs synthetic data, and might involve inspecting concrete metrics such as accuracy, precision, root mean-squared error, etc.; and/or model fairness properties such as demographic parity, fairness through unawareness, or conditional fairness \cite{decaf}. Doing so often requires the \emph{Train on Synthetic, Test on Real} (TSTR) paradigm \cite{rcgan} in which models are trained on synthetic data and their performance then evaluated on real data. \paragraph{Fidelity:} Often lumped together with utility, we define fidelity to be measures that directly compare the synthetic dataset with the real one (rather than indirectly through a model, or through performance on a given task). From a high-level perspective, fidelity is how well the synthetic data ``statistically'' matches the real data. Measures of fidelity are often used because of an underlying intuition that a specific fidelity will correspond to improved performance on a wide range of tasks. In the most general case, full statistical similarity (i.e. matching the distributions of the synthetic and real data), should allow many tasks that would be performed on the real data to be performed on the synthetic. However, such a match is difficult, especially in the presence of privacy requirements \cite{ullman2011pcps}, and even undesirable in the presence of biases \cite{decaf}. Rather than seeking a ``full'' statistical match, one might inspect low-dimensional marginals \cite{choi2017generating}, the syntactical accuracy of the synthetic data \cite{alaa2021faithful}, or look at the distribution of the remaining features conditional on a feature that is known to be biased in the original data. \paragraph{Utility vs. Fidelity:} Much of the literature on synthetic data, in particular for private synthetic data, focuses on the 2-dimensional trade-off between utility and privacy, folding fidelity into utility. While the two are unavoidably linked, they are not synonymous nor perfectly correlated. In some scenarios, fidelity can be reduced while leaving utility unaltered (or vice versa), potentially ``leaving room'' for other benefits, for example, improved privacy. \paragraph{Privacy:} The privacy of synthetic data is determined by the amount of information that it reveals about the real data used to produce it. Depending on the use case, different privacy guarantees might be required. For example, internal synthetic data release within a secure environment will typically require less stringent privacy evaluation than data released to the general public. Theoretically sound notions such as differential privacy and its offspring exist, allowing for systematic analysis of the privacy of algorithms used to produce synthetic data. Less is known about the precise meaning of the privacy of a specific synthetic data sample if the data generation method is not revealed, or how to evaluate it, since privacy is typically defined as a statistical property over many instances. Of course, extra care is required to ensure that privacy that has been proven on paper is not lost through sloppy implementation of these algorithms in practice \cite{stadler2020synthetic}. \paragraph{Privacy vs Fidelity:} As a rule of thumb, when fidelity increases, the privacy of synthetic data decreases. This means that, in general, it is impossible to generate private synthetic data that will be useful for all use cases. Instead, one might group potential use cases in terms of the type of fidelity that is required (i.e.~which features of the original dataset need to be captured by the synthetic data) and generate multiple synthetic datasets, each with user specified privacy guarantees. \subsection{Synthetic Data Desiderata} A good synthetic data generator (SDG) should simultaneously satisfy the following properties: \begin{enumerate} \item \textbf{Syntactical accuracy}: The generated data should be plausible (e.g.~a synthetically generated postcode should exist). However, this also requires that certain structural properties of the data are preserved. For example, with time-series data, one needs to ensure that data points are not generated using information from the future. Similarly, when synthesising financial transnational networks, the underlying graph structure of the data must be preserved. \item \textbf{Privacy}: It should be possible to precisely quantify how much information about the original data is revealed through the releasing of the synthetic sample. How exactly one measures privacy will depend on the specific task at hand. While differential privacy is one popular way of assessing the amount of information release through synthetic data generators, a different notion might be required when the data is sparse or one wants to move away from worst-case bounds. \item \textbf{Statistical accuracy}: It should be possible to precisely quantify the statistical similarity (or lack thereof) between the synthetic and the original data. When measuring statistical accuracy, one might be interested in capturing certain marginal distributions and certain relationships between variables, but not others. A good synthetic data generator should allow for control over this. \item \textbf{Efficiency}: The algorithm should scale well with the dimension of the data space (i.e. feature space). It is well known that, in general, approximation of distributions can suffer from the curse of dimensionality, and consequently sampling from unstructured distributions is an NP-hard problem. \end{enumerate} While it its relatively straightforward to design algorithms for which a subset of these properties hold, there is currently no systematic framework for developing SDGs for which all 4 properties are satisfied simultaneously. For example, generation of statistically accurate but private data is hard, as these goals may be in conflict. Specifically within the realm of differentially private {\em synthetic data}, Ullman et al.~\cite{ullman2011pcps} demonstrated that a computationally efficient algorithm (i.e. runs in polynomial time) that generates synthetic data that both: (i) satisfies differential privacy; and (ii) preserves the correlations between pairs of features, does not exist. This result holds in a general sense, in that for every algorithm that {\em could} generate synthetic data, there is {\em a} dataset that ``will not work''. That said, it is possible that: \begin{itemize} \item for a specific application (e.g., dataset), it is possible to efficiently generate DP synthetic data; \item one may not be interested in the correlations being preserved (i.e. the application may demand a different fidelity notion). \end{itemize} Nevertheless, this impossibility result implies that one needs to assess the privacy and fidelity of the data on a per-case basis. Most importantly, there is no ``one-size-fits-all'' differentially private synthetic data generation method. In \cite{boedihardjo2021covariance}, the authors show that by reducing the requirement that all correlations be matched to the requirement that {\em most} correlations be matched, a computationally efficient algorithm {\em does} exist. Such a result is promising for synthetic data, but raises the question of being able to quantify what aspects of the data structure (i.e. which correlations) are {\em not} being matched. Such results highlight the need for synthetic data to not try to be too general -- synthetic data should be generated with a use case in mind. For a given use case, relevant statistical properties can be preserved, while others can be ignored in the name of creating privacy. Below, we give some concrete examples of such use cases, alongside an application we believe to be a misguided endeavour. \section{Auditing Synthetic Data} \label{sec:privaudit} In this section, we discuss various approaches for empirically evaluating synthetic data, both in terms of its privacy, and its utility and fidelity. \subsection{Empirically Evaluating the Privacy of Synthetic Data} Given that differential privacy is a theoretical notion of privacy that must be proven, and correctly implemented, to be satisfied, a natural question is to ask whether or not one can verify some notion of privacy for a synthetically generated dataset, or a synthetic data generator, empirically. Given that the goal is to protect against the (abstract) threat models outlined in \ref{sec:threat}, can one ``prove'' privacy by attempting to perform attacks against a given dataset? \paragraph{DP verification.} As mentioned above, the differential privacy of a synthetic dataset is more precisely a property of the algorithm that generated it, and {\em cannot} be verified by inspecting the synthetic dataset itself. Researchers have been investigating methods for checking that an algorithm meets DP requirements~\cite{ding2018detecting,jayaraman2019evaluating,jagielski2020auditing}. These methods work either by querying the algorithm in search of violations of the privacy definition, or by running known attacks (e.g.~membership inference) against it. These are useful tools, which can be applied to SDG methods, as a way of testing/understanding their privacy. Perhaps the most useful application is to help us understand what values of $\varepsilon$ make the most sense in a specific context. However, using these tools to ``prove'' differential privacy is not possible, as they are based on statistical analysis of the generating algorithm. What is possible is that one can show, with a certain confidence, that an algorithm is {\em likely} to be differentially private, but doing so would require sampling many, many times (and more samples would be needed for more complex outputs/algorithms, e.g.~when the output is a dataset) from the algorithm with many, many different input datasets. Doing so would be {\em highly} computationally intractable if any sort of meaningful level of confidence was to be achieved. \paragraph{Leakage estimation.} An alternative option for evaluating the privacy of algorithms is to use \textit{leakage estimation} techniques~\cite{chatzikokolakis2010statistical,cherubin2017bayes}, which stem from the quantitative information flow community~\cite{smith2009foundations}. These techniques enable quantifying the privacy of an algorithm with respect to a specific threat model (or adversary). For example, in the context of SDG, this means one could use leakage estimation for assessing the resilience of a method against membership inference or attribute inference attacks, which we described above. A strong advantage of this approach, is that it does not require any formal analysis of the SDG method; additionally, it can be used for selecting the privacy parameters of a DP algorithm. Another advantage is that some of these methods enable a fully black-box analysis; that is, there is no need to describe the algorithm's internals analytically. One disadvantage is that the leakage estimation analysis is done with a specific threat model (or attack) in mind, although there are ways of capturing many attacks with the same analysis~\cite{m2012measuring}. A second disadvantage is that, in the case of black-box leakage estimation methods, the formal guarantees derived via these approaches make the assumption that we can sample an arbitrary amount of data from the algorithm. Nevertheless, they have been shown to be effective when tackling real-world tasks~\cite{cherubin2019fbleau}. \paragraph{Empirical privacy evaluation of datasets themselves.} The empirical evaluation of privacy of synthetic data is a nascent and challenging area of research. Despite the fact that {\em differential} privacy cannot be established for a dataset in isolation, practitioners in the field of synthetic data have made use of a hold-out test set to evaluate (other notions of) the privacy of generated synthetic data \cite{mostlyai}. The Nearest-Neighbour distance ratio (NNDR) has been used to inspect whether or not synthetic data points are closer than some hold-out test points to the underlying real data points (on average). This involves splitting the data into a training set, and a test set (as is similarly done in supervised learning problems). The training set is then used to train the model. Once trained, samples are drawn from the trained model, and the distance from these samples to the training data is compared with the distance from the test set to the training data. Note that although this method is agnostic of the method used to train the data generator, it does rely on a hold-out test set being available. As noted in \cite{mostlyaiblog}, non-existence of points can be just as revealing as the existence of points in the synthetic dataset, but privacy analysis via NNDR does not capture this behaviour. Indeed it is possible to satisfy NNDR by creating ``holes'' in the synthetic data around the real data points, but such an approach would reveal where the real records should be. A similar application of NNDR is performed in \cite{adsgan} to attempt to ensure privacy of the generative model, which also does not control for the creation of such ``holes''. In \cite{choi2017generating}, they use a nearest-neighbour based classifier to quantify the risk of attribute disclosure but do so in a non-contrastive way, thus rendering the privacy analysis weak. An NNDR-type metric was also used in \cite{yale2019assessing} to assess the relative privacy of several generative models proposed for health data. \paragraph{Attacks against private synthetic data.} As we explain in section~\ref{sec:threat}, one of the approaches to understand and analyse privacy is through the lens of attacks: what can a motivated attacker learn about users in the dataset? In addition to being intuitive, this approach can help us evaluate whether a system protects user privacy in a given context, and compare methods built with different privacy definitions in mind. This is particularly relevant for synthetic data generation: as we have presented in previous sections, a wide variety of SDG methods have been proposed, with widely different privacy definitions, choice of parameters, and assumptions. Despite the potential of adversarial approaches to evaluate privacy risks of synthetic data, the development of privacy attacks against SDG remains underexplored. We here review existing attacks, and suggest promising research areas. The main method to evaluate privacy risks in synthetic data was proposed by Stadler et al.~\cite{stadler2020synthetic} in a recent paper. They propose a general methodology to apply membership and attribute inference attacks on \textit{any} synthetic data generation model. They assume black-box access to the SDG method, and specifically, being able to retrain the SDG model on new data. Indeed, analysing the synthetic data alone (as in NNDR metrics) is, in general, not sufficient to properly understand information leakages: an algorithm sampling records uniformly at random might, by coincidence, replicate exactly some records from some private dataset, but this would not usually be considered a privacy violation. Further, this assumption is a key transparency requirement: in order to audit synthetic data, it is necessary to be able to understand how it was generated. Therefore, privacy guarantees cannot usually be obtained by maintaining secrecy of the generating algorithm. The method proposed by Stadler et al. uses \textit{shadow modelling}: the attacker simulates many runs of the SDG algorithm, using auxiliary data, to generate synthetic datasets trained with or without a target user. A binary classifier is then trained on features extracted from these synthetic datasets to predict whether the target user is in the training dataset. Empirical results suggest that current SDG methods either are vulnerable to this attack or, if the attack fails, lead to an accuracy worse than non-SDG methods for a range of data analysis tasks. Outside of this specific paper, there is a rich literature on privacy attacks that can be leveraged to develop attacks against synthetic data. We here detail two possible lines of research for this approach: \begin{enumerate} \item Many synthetic data generation methods rely on Generative Adversarial Networks (see, e.g., \cite{pategan, dpganxie, gpate, timegan, decaf}). Researchers have demonstrated that such GANs can be vulnerable to white-box and black-box membership inference attacks~\cite{chen2020ganleaks, logan}. A key question is then: how can these attacks be ported to the setup where the attacker has access to \textit{data} generated by the model, rather than the model itself. \item Some methods built with specific use cases in mind can aim to closely replicate statistical properties of the training dataset, such as one-way marginals histograms or correlations. Many membership inference attacks have been proposed against aggregate statistics, from simple statistical tests~\cite{homer2008resolving,dwork2015robust} to advanced attacks based on shadow models~\cite{pyrgelis2017knock}. If the synthetic data accurately reproduces many aggregates from the original data, one can apply these attacks to the synthetic data to infer membership of specific records in the training dataset. This leads to an interesting question: how many statistics can be accurately reproduced from the original data, without enabling such attacks? \end{enumerate} These are only two prospective research directions for the adversarial evaluation of synthetic data, which is an open line of research. \subsection{Evaluating the Utility and Fidelity of Synthetic Datasets} \label{sec:utilfidel} The methods presented in this section generally focus on privacy as their primary design goal, most often through explicit guarantees such as differential privacy. In this section, we review approaches to evaluate the secondary goal of such datasets: their \textit{utility} and \textit{fidelity}. The utility of a private synthetic dataset is determined entirely by its application. Generating synthetic data to enable release of otherwise private data has almost as many use cases as there are machine learning problems -- any data-driven problem might be derived from sensitive data and the data controllers may wish to investigate which ML methods might address the problem. Below (\ref{sec:privutil}) we give example use-cases, and suggest how utility might be measured in such cases. Fidelity is less well-defined: it generally aims at evaluating how close the \textit{distribution} of the synthetic dataset is to that of the real data, the idea being that if the distributions match, the synthetic data can be used to perform any task as accurately as with the real data. We discuss this more general use case, and review works studying fidelity, in section~\ref{sec:privfid}. \subsubsection{Utility-driven evaluation} \label{sec:privutil} The key use-case for privately-generated synthetic data is to enable research and industry data analysis tasks without access to sensitive data. A particularly important application is the development of machine learning (ML) models to perform inference and classification tasks from data. In this setting, the goal is to determine the best model (or a selection of best contenders), and train it (choose its parameters) to perform a given task. In general, such a task will come with its own metric of performance (e.g. accuracy/AUROC in a classification task). There are broadly two directions of research aiming to evaluate the suitability of synthetic data for ML training: (1) evaluating the performance of models trained on synthetic data, and (2) evaluating whether the \textit{relative performances} of different models are similar on synthetic and real data. The first approach assumes that analysts will train a machine learning model on the synthetic data, and use this model directly on real, future data. In this situation, it is important that the accuracy of a model estimated with synthetic data reflects its accuracy on real data. For instance, Beaulieu et al. evaluate their synthetic data generation method by measuring the accuracy of classifiers trained on synthetic datasets on the real sensitive medical data used to generate the synthetic data~\cite{beaulieu2019privacy}. Patki et al. pushed this further, by distributing synthetic datasets and real datasets randomly to teams of data scientists, and evaluating whether teams working on real and synthetic datasets would arrive at approximately the same conclusions~\cite{patki_synthetic_2016}. Similar approaches were used by Tao et al.~\cite{tao2021benchmarking}, where a XGBoost classifier is trained on synthetic data and evaluated on real data for a range of different tabular datasets. Note that this approach makes some assumptions on the family of models that will be trained, since it is impossible to test \textit{all possible classes of models}, as well as all possible choices of hyper-parameters. When synthetic data is generated with a set of specific tasks in mind, custom metrics can also be developed that capture the accuracy on these specific tasks. For instance, in the NIST challenge\footnote{\url{https://www.nist.gov/ctl/pscr/open-innovation-prize-challenges/current-and-upcoming-prize-challenges/2020-differential}}, accuracy was measured by the error on the Gini coefficient of incomes and the gender pay gap in (real) demographic data with financial information, when estimated on synthetic data~\cite{Bowen_Snoke_2021}. The second approach studies whether, for a battery of models, their ranking in terms of accuracy would be the same when trained on synthetic or real data. This setup assumes that analysts use synthetic data to \textit{select} a model, which is then trained on a real dataset (for better real-world performances). Crucially, the goal is that model development on synthetic data reflects model development on real data -- when a comparison is made (e.g. between two choices of hyperparameters), it should mirror the comparison on the real data. The utility of the synthetic dataset is then given by how well the performance ranking of models on the synthetic data matches the ranking that would be determined by the real data. This is challenging to measure since, in theory, one would want to ensure that ``all possible methods'' are appropriately ranked, including those which have yet to be developed/discovered. One approach might be to approximate this by comparing a list of representative models~\cite{kddsra}. It might also make sense to expand the list of representative models by incorporating small variations of each model (i.e. by varying the hyperparameters involved). Efficiently computing this for a broad enough class of models would be key, which may require new insights to ensure the class is indeed sufficiently broad. An important thing to keep in mind when utilising synthetic data in this way is the variability of various models' performances, especially the variability with respect to the real vs.~synthetic data. In particular, if several synthetic datasets (each with decreasing privacy) are going to be used to narrow-down the best methodology, then the process needs to be aware of how the earlier (more private) synthetic datasets will typically create noisier rankings and so the notion of a method being statistically significantly better than another needs to be adjusted accordingly. \subsubsection{Fidelity-driven evaluation}\label{sec:privfid} A promise of synthetic data is that it ``looks like'' real data, and can thus be used for a variety of purposes. From a statistical perspective, the goal that the distribution $\hat{\mathbb pP}$ used to generate synthetic data is \textit{close to} the (unknown) real data distribution $\mathbb{P}$. Typically, evaluating fidelity in this way involves choosing a distance with which to compare distributions, then evaluating this distance empirically from samples of the real and synthetic datasets. A simple example is to focus on 1- and 2-way marginals of the data, which can be efficiently computed. The difference between these marginals can be estimated with a wide range of metrics: total variational distance~\cite{tao2021benchmarking}, correlations and Cramer's V~\cite{tao2021benchmarking}, or classical distances~\cite{Bowen_Snoke_2021}. These metrics aim to capture whether the synthetic data captures basic properties of the real data, such as histograms of individual attributes and relations between pairs of attributes. Estimating distributional distances in higher dimensions, capturing relations between several attributes at a time, is challenging. Researchers have proposed ad hoc metrics, such as comparing the density of the synthetic and empirical distributions over random subsets of $\mathcal{X}$~\cite{Bowen_Snoke_2021}. Another solution is the \textit{propensity score}~\cite{woo2009global,snoke2018general}, which captures the accuracy of a classifier trained to differentiate real from synthetic data points. Intuitively, if the classifier cannot distinguish the two, then the distribution of synthetic data points must be close to that of real data points (this is the basis of the original GAN framework \cite{gan}). In the context of generative networks (and specifically, GANs), researchers have proposed measures to evaluate the fidelity of synthetic samples. Sajjadi et al. proposed metrics of \textit{precision} (the quality of synthetic samples) and \textit{recall} (the diversity of synthetic samples), inspired by common failure modes of GANs~\cite{sajjadi2018assessing}. The key question that these metrics seek to answer is how do the empirical and synthetic distributions \textit{overlap}: precision (resp. recall) captures how much of the synthetic (resp. real) data falls within the support of real (resp. synthetic) data. Researchers have proposed extensions of these metrics to increase their robustness to outliers and make them easier to compute~\cite{naeem2020reliable} and account for the probability distribution rather than just the support~\cite{alaa2021faithful}. \section{Private Synthetic Data Generation} \label{sec:privsdg} Thus far, we have focused on privacy in a broader context than synthetic data. This is natural, because most privacy notions apply more generally. However, synthetic data has an additional property that most other (non-synthetic data) outputs do not have -- it resides in the space of the real data. That is, the synthetic data takes values from precisely the same space as the original data. This allows us to use synthetic data in the place of real data, and also to compare the similarity of the synthetic and real data directly. We begin by highlighting some key considerations for private synthetic data generation. \paragraph{The space of datasets can be very high-dimensional.} Differential privacy has been conventionally applied to settings in which the dimensionality of the output space is relatively small, such as count queries on rows, classification tasks, etc. Synthetic data generation, on the other hand, gives output in a very high-dimensional space, i.e. the space of datasets (perhaps of a fixed size, $N$). Releasing such a high-dimensional object is challenging under differential privacy because it leads to higher (worst-case) sensitivity of the generating function (i.e.~the algorithm mapping the input dataset to the output dataset). Because of this increased worst case sensitivity, accurately constructing a dataset under differential privacy (according to some notion of accuracy) is likely to require a large privacy budget. A dataset of 1 million records, each with only 20 features, results in a 20 million dimensional output. Not only is the sensitivity of such a function likely to be high, but even trying to analyse the sensitivity can be an incredibly difficult task. By instead aiming to create a {\em private generator}, one can alleviate some of the difficulties - the complexity of the generator should not need to scale with the number of rows, but instead only with the dimensionality of the data (e.g. the number of columns in tabular data). \paragraph{Privacy is a property of the Algorithm, {\em not} of the Data.} An important-to-note property of differential privacy that it is a notion that is concern with probabilistic properties of the generated outputs and not a single realisation/output of the generator. A single output of the generator is is neither private, nor non-private. In a non-synthetic data setting this may be more obvious. If you query the average age of individuals in a dataset, and are given the response `35', without being told how this was computed, you do not know (even with access to the original data) whether the number 35 was computed privately or not. The algorithm that computed this answer could simply be ``always answer 35, regardless of input data'' which clearly reveals no information. The point is there is nothing private or ``unprivate'' about the {\em number} 35. What {\em is} private (or non-private) is the algorithm that produces the number, or in the case of this report, that produced the synthetic dataset. Crucially, this means that, at least from the perspective of differential privacy, it is {\em meaningless} to talk about the privacy as a property of a concrete synthetic dataset. \paragraph{Private Data vs. Private Generator.} The most common approach to generating private synthetic data is to first train a {\em private generator} (e.g., \cite{pategan, dpganxie, dpganxinyang, privbayes, dpgm}) on the real data. This model is then directly sampled from to generate individual datapoints and thus build up an entire synthetic dataset. Due to the post-processing theorem \cite{dpbook}, if the procedure used to train the private generator is $\varepsilon$-differentially private ($\varepsilon$-DP), it can be used to generate arbitrarily many synthetic data records without affecting the privacy guarantees. In fact, the procedure to generate the synthetic dataset (of arbitrary size) is itself $\varepsilon$-DP, which guarantees that individual records in the real data are protected from attacks. However, training an $\varepsilon-$DP generator to then generate some fixed number of synthetic samples can lead to overly conservative privacy guarantees, and thus lower utility. Intuitively, DP restricts the amount of information extracted from the real dataset when computing the output (the generator or dataset). The generator acts as a bottleneck for information: any finite sample from a generator necessarily has less information from the original dataset, and thus typically results in lower utility. \paragraph{Outliers and Fairness.} Capturing outliers with private synthetic data is difficult. Outliers are precisely data points with {\em some} uniquely identifying features; this means that ``hiding them in the masses'' becomes impossible. In some scenarios, for example credit card fraud detection, detecting outliers is the goal. In such a setting, private synthetic data is unlikely to provide much utility, as the outliers will necessarily be suppressed by the need for privacy. Indeed, \cite{oprisanu2021measuring} posit that if outliers are to be captured, then an SDG method cannot attain both a high privacy and a high utility. This has a problematic implication for fairness: minority groups, like outliers, can often end up being under-represented in synthetic data~\cite{pereira2021analysis, ganev2021robin}. Indeed, there is a clear tension between fairness and privacy, with fairness requiring that there is a good utility, even for minority groups, and privacy hiding the contributions of individuals, and thus collectively hiding the contribution of a minority group. Indeed, \cite{cheng2021can} posit that current mechanisms are unable to simultaneously achieve privacy, fairness and utility. \subsection{Existing Methods and Technologies} \label{sec:privmodels} Much attention in the machine learning community is being given to the problem of {\em generative modelling}. The goal of generative modelling is to generate samples with similar statistical properties to the available training data. Generative models are a key ingredient in synthetic data generation, but crucially require additional thought beyond their basic capability to ``generate samples'' - the problem of generating samplings from a distribution given training data is under-specified, and can be satisfied by memorising the training data and regurgitating when asked. We defer discussion of generative modelling in general to section \ref{sec:generalgen}, but draw attention to existing {\em privacy-preserving} generative models here. As already noted in section \ref{sec:dp}, a key ingredient driving many of the deep learning based algorithms is DPSGD \cite{dpsgd} (differentially private stochastic gradient descent), which enables differentially private training of general neural network based architectures. Though not designed specifically for generative models, DPSGD can be applied to both GANs \cite{dpganxie, dpganxinyang, rcgan, dpgm}, and VAEs \cite{dpvae}. Other approaches leverage the popular PATE mechanism \cite{pate1}, which can be applied to black-box models to create a private predictor. This has been used to replace the discriminator in a GAN model with a private PATE model \cite{pategan}, and as a means of passing gradients from discriminator to generator \cite{gpate}. \cite{dpsyn} use a subsample-and-aggregate approach (similar to PATE) alongside differentially private expectation-maximisation (DP-EM) \cite{dpem}. \sloppy Other popular approaches involve representing the data in a simple, low-dimensional form, such as using a Bayesian network to represent the data generation process as a series of low-dimensional marginal distributions \cite{privbayes}, or leveraging the classical copula framework \cite{copula} to learn the generation process \cite{dpcopula}. The recent NIST competition\footnote{\url{https://www.nist.gov/ctl/pscr/open-innovation-prize-challenges/current-and-upcoming-prize-challenges/2020-differential}}, was won with an algorithm that learns all 2-way distributions (marginals) in a differentially private way, and then does post-processing to generate data from these (potentially inconsistent) marginals \cite{mckenna2021winning}. See also \cite{zhang2021privsyn} for similar ideas. \fussy As should be clear from the proceeding discussion, there are many ways to enforce privacy, even when using the same underlying algorithm (e.g. a GAN). The question of where and how to enforce privacy is very much open. Intuitively, one wants to apply privacy simultaneously: (i) as close as possible to the output (e.g. to the generator of a GAN rather than the discriminator); (ii) wherever the tightest analysis of the privacy can be done (with GANs, the discriminator is typically easier to analyse). With GANs, we see examples of privacy being applied to the discriminator \cite{pategan, dpganxie, dpganxinyang}, and to the generator \cite{gpate}. \subsection{Partially Synthetic Data} \label{sec:partsdg} For tabular data, where a user's data is a $n$-tuple of \textit{attributes} an alternative to the common flavour of SDG is \textit{partially synthetic data}. In partially synthetic data, the attributes of user records are divided into two categories: \textit{quasi-identifiers} and \textit{sensitive attributes} (formally $\mathcal{X} = \mathcal{X}_\text{quasi} \times \mathcal{X}_\text{sensitive}$). The quasi-identifiers are assumed to be non-sensitive and can be disclosed unchanged, while the sensitive attributes need to be protected. Partially synthetic data is obtained by first fitting a statistical model $f:\mathcal{X}_\text{quasi}\rightarrow\mathcal{X}_\text{sensitive}$ on the quasi-identifiers to predict the value of the sensitive attribute, then replacing the sensitive attributes of the data by values produced by the statistical model, a process known as multiple imputation~\cite{rubin1996multiple}. The synthetic data generated thus contains the quasi-identifiers of all real records. Researchers have proposed partially SDG models using decision trees, support vector machines, and random forests~\cite{reiter2005using,caiola2010random} (see the \textsf{synthpop} package~\cite{nowok2016synthpop}). Utility-wise, partially synthetic data have a clear advantage over \textit{fully} synthetic data, as they not require to estimate the full joint distribution $\mathbb{P}(\mathcal{X})$ but only the conditional distribution $\mathbb{P}(\mathcal{X}_\text{sensitive}|\mathcal{X}_\text{quasi})$. However, some reports suggest that the utility of such data in practice is not particularly appealing, and that they are probably best suited for preliminary data analyses~\cite{loong2013disclosure}, or when combined with restricted access to confidential data~\cite{abowd2001disclosure}. Privacy-wise, there is the issue that revealing quasi-identifiers might be considered sensitive in some contexts (and this approach is trivially vulnerable to membership inference attacks). Researchers have shown that current methods are vulnerable to record linkage attacks~\cite{drechsler2008accounting,reiter2009estimating}, where an attacker identifies which record belongs to a target user using the sensitive attributes. Partially synthetic data generation methods are generally heuristic methods, and do not satisfy guarantees of privacy. Label DP~\cite{chaudhuri2011sample} is an extension of differential privacy that fits this context well. \section{De-biased Synthetic Data Generation} \label{sec:debias} Machine learning models are known to inherit biases from their training data \cite{aisentencing, nlpgenderbias, buolamwini2018gender, amazonrecruit}. De-biasing trained models requires expert knowledge of the model \cite{eqop, kilbertus2017avoiding}, and also an understanding of the different notions of fairness that one may wish to achieve (e.g. fairness through unawareness, demographic parity, conditional fairness \cite{decaf}). An alternative approach that is being explored is to learn to de-bias the dataset itself, thus creating so-called {\em fair data}\cite{feldman2015certifying, kamiran2009classifying, zhang2016causal, calmon2017optimized}. This data de-biasing can be viewed as a sort of synthetic data generation, in which the synthetic data is the de-biased data. Some approaches take it a step further and explicitly model the problem of data de-biasing as a one of ``ground-up'' generation \cite{decaf, fairgan}. These approaches aim to learn a generative model that itself is fair. In \cite{decaf}, they explore several notions of fairness and, via causal modelling, identify strategies for generating data that satisfy the given notions. \subsection{Notions of Fairness} As we have seen, identifying a meaningful, interpretable notion of privacy is difficult, and the same is true for fairness. These are both complex ethical questions that the machine learning community must address sooner rather than later. Unlike privacy, however, obvious notions of fairness {\em do exist}, and are enforceable in a meaningful way\footnote{This contrasts with the fact that, with privacy, the notion of not wanting your data to affect the output {\em at all} is not achievable without simply ignoring your data completely.}. Each notion typically requires some notion of a set of {\em protected attributes}, along which fairness must be ensured (e.g. gender, race). {\bf Fairness Through Unawareness (FTU)} \cite{ftu1, decaf} requires that the protected attributes, and only the protected attributes, not be used by the predictor. This aligns with the idea that two equally qualified people deserve the same job opportunities, independent of race or gender \cite{decaf}. FTU, however, fails to take into account the effect that protected attributes might have on other unprotected attributes, such as an individual's race resulting in them not being afforded the same educational opportunities as an individual of a different race (and thus resulting in them appearing to be disparately qualified). \begin{definition}[Fairness Through Unawareness \cite{decaf}] A predictor $f: \mathcal{X} \to \mathcal{Y}$ is fair if and only if protected attributes $\mathcal{A} \subset \mathcal{X}$ are not explicitly used by $f$ to predict $Y \in \mathcal{Y}$. \end{definition} {\bf Demographic Parity (DPa)} \cite{dpar}, instead, requires that a predictors output's not be correlated with the protected attributes. Indeed, with FTU, an attribute that is correlated with the protected attributes can be used as input to a predictor and thus the predictor can indirectly be correlated with the protected attributes (despite not having direct access to them). DPa is a significantly stronger notion of fairness than FTU, which requires adjusting the distributions of {\em all} variables that are correlated with the protected attributes. \begin{definition}[Demographic Parity \cite{decaf}] A predictor $f: \mathcal{X} \to \mathcal{Y}$ is fair if and only if protected attributes $\mathcal{A} \subset \mathcal{X}$ are independent of the predictions. That is, given a random variable $X \in \mathcal{X}$, let $A \in \mathcal{A}$ be the components of $X$ that are protected. Then $f$ satisfies demographic parity if and only if $f(X)$ is independent of $A$. \end{definition} Under the graphical model approach used in \cite{decaf}, for example, DPa is ensured by deleting all edges that originate from a variable that has a protected attribute anywhere in its causal predecessors. Naturally, such an approach can significantly degrade performance, as many of these variables can be useful predictors of the target. A trade-off is present, in which some fairness may need to be sacrificed for performance, and vice-versa. \subsection{Limitations of Fair Synthetic Data Generation} Though one might hope that fair synthetic data would lead directly to fair predictors (which {\em is} the case with private synthetic data and private predictors), this is not the case. Of particular importance to note is the fact that a predictor's fairness is {\em with respect to} a distribution of the features. Indeed, a predictor that is trained on synthetic data may not longer be fair when moved to real data due to a shift in the distribution of the real features. This is partly the reason that \cite{decaf} take such an extreme approach in removing all contaminated features (rather than trying to only remove the influence of the protected attributes on contaminated unprotected ones). Moreover, a synthetic dataset's fairness is defined through a given predictor. Giving a more general definition for fair synthetic data, and determining whether or not predictors trained on such a synthetic dataset would be fair, are open problems. The hope that an organisation might make a single ``fair'' synthetic dataset for use across an organisation would require advancements in this space, requiring a shift in thinking from fair predictors to fair data. \subsection{Existing Methods} As noted above, fair synthetic data generation is a young field. While there is significant amounts of work on creating fair predictors (see e.g. \cite{mehrabi2021survey} for a recent survey), the work on synthetic data for fairness is more limited. \cite{decaf} take a causal, GAN-based approach, using several GAN networks, along with an assumed known causal graph to learn the generative process of the data. Armed with the causal graph, they then generate synthetic data by selectively dropping edges from the model depending on the notion of fairness being targeted. \cite{fairgan} use a more indirect approach to ensuring fairness. Again based on a GAN model, they instead opt to introduce an additional loss term that penalises disparity between protected attributes taking different values. This means that the learned model might still generate unfair data, but only if doing so results in an increase in the fidelity of the generated synthetic data. This trade-off is controlled by a hyperparameter than can be increased to more stringently ensure fairness. \subsection{Evaluating Utility and Fidelity} Much of the discussion found in Section \ref{sec:utilfidel} can be applied to fair synthetic data. An additional consideration will necessarily be whether or not the bias has been successfully removed, metrics for which can be found in \cite{decaf}. These typically involve a comparison between outputs of a predictor trained on the synthetic data when the input protected attributes are varied. \section{Data Augmentation} \label{sec:dataaug} Perhaps the most successful use case (so far) for synthetic data has been for data augmentation - using synthetic data to enlarge datasets with additional samples to use for training \cite{wong2016understanding, timeressemi, timesemi}. This is often referred to as semi-supervised learning. The intuition is that synthetic data can act as a regulariser, reducing variance in the learned downstream model \cite{timeressemi}. Fortunately, there are several good surveys for data augmentation, and so we defer the reader to those for a more thorough background: time-series data \cite{timeseriesreview}; image data \cite{imagereview}. Of note is the fact that synthetic data driven techniques are more important in domains with less structure (such as with generic tabluar data). In the image domain, there is significant structure that can be exploited to create additional data, such as small rotations, image-flipping, cropping, etc. This structure often does not have a parallel in generic tabular data. As such, augmentation methods driven by synthetic data generators are a promising approach to fill this gap. \subsection{The Basic Principle} The key idea driving the use of synthetic data for data augmentation is that of {\em generalisability}. The goal of a model is not just to perform well on its training data, but also on data that has not been seen before by the model \cite{deeplearnrev}. The hope with synthetic data is that one can take the available training data and learn a generative model, such as a GAN \cite{gansemisup}. This generative model will then be able to produce ``realistic'' samples of training data, and, {\em hopefully} these samples will be sufficiently different from the original training data so as to be useful additional data points for the training of the model. It is particularly important to stress that these samples need to be {\em sufficiently different} from the original data. If these samples are too similar, then they will provide no benefit over using the original data on its own for training. As is hopefully clear by now, this need for dissimilarity is a common theme with synthetic data. In the context of data augmentation, this need is less strict; with privacy and fairness, the dissimilarity is a question of ethics and a failure to satisfy it can have both moral and legal repercussions. With data augmentation, this is unlikely to be the case. \subsection{What methods are used?} Depending on the domain in question, a variety of models exist that can perform the task of data augmentation. For the most part, the only real requirement is a generative model that is tailored to the domain in question. In Section \ref{sec:generalgen}, we discuss different types of generative models in more detail. Due to the need for (some level of) dissimilarity, training a generative model and hoping for the best may not be sufficient, however. Instead, one may wish to impose restrictions that enable this dissimilarity. The authors in \cite{badgansemi} show that learning a perfect generator in a GAN leads to poor semi-supervised learning, but that a bad generator performs well, for example. This idea of dissimilarity is often referred to as a need for {\em diversity} in the generated samples. Metrics for measuring this exist, such as the score presented in \cite{alaa2021faithful}. \section{Generative Modelling - An Overview} \label{sec:generalgen} \begin{figure}[htp] \centering \includegraphics[width=0.7\textwidth]{images/models.pdf} \caption{Generative modelling taxonomy based on the maximum likelihood from \cite{goodfellow_nips_2017} } \label{fig:taxonomyGM} \end{figure} Though there is a wealth of {\em directed} work on synthetic data generation with a specific goal in mind (such as one of the ones discussed in sections \ref{sec:privacy}, \ref{sec:debias}, and \ref{sec:dataaug}), there is also a lot of work focused on generative modelling [for the sake of generative modelling]. The original GAN paper was introduced as a means to generate fake images, not because they wanted to create private, debiased, or even augmented image datasets, but because the task of generating realistic images was hard and the success was easy to evaluate even for non-experts in the field. To that end, there are several methodologies that exist that have yet to be applied to a specific problem. The remainder of this section is more technical than the rest of this manuscript. Those that wish may skip to Section \ref{sec:indmess} without any loss of flow. These methodologies could be taxonomised as in Figure \ref{fig:taxonomyGM}, as proposed by Goodfellow \cite{goodfellow_nips_2017}, focusing on generative models whose parameters are trained to maximise the likelihood of the original data. Such methods can be grouped into two main families, where the underlying density function is either explicitly or implicitly defined. Within explicit models reside statistical methods where new samples are extracted from the distribution arising from the model's definition, which, in turn, must strike a balance between the ability of the model to capture data complexity and to maintain computational tractability \citep{frey_does_1996, breiman2017classification, rasmussen_nite_1999, naivebayes}. Non-tractable density functions can be explicitly tackled through deterministic and stochastic approximations. Variational Auto-Encoders (VAEs) \citep{vae} define the loss functions as tractable lower bounds of the non-tractable log-likelihood densities. However, if these deterministic approximations are not carefully calibrated, the model may not converge to the target distribution and consequently generate inconsistent data. On the other hand, stochastic approximations are the basis of Markov chain approaches, where samples are repeatedly drawn after the application of a chosen transition operator. Deep Boltzmann Machines \citep{dbm} are the main representatives of this class, having all neural units composed of random variables, which simultaneously act as inputs and outputs of the closest layers. Such versatility results in difficulties with training, and thus it is preferable to consider the networks as composed of Restricted Boltzmann Machines (RBMs) \citep{rbm}, consisting of only one visible and one latent layer. In a two-pass learning process, RBMs are progressively trained and then globally fine-tuned. Gibbs-sampling is then used to extract synthetic values. A completely different direction is taken by implicit generative models, which can be thought of as “black-boxes”, where distributions are not explicitly defined but indirectly revealed through sampling. A first example is Generative Stochastic Networks (GSNs), based on Markov chains. In these networks, the distribution is estimated indirectly, employing a parametric transition operator instead of a parametric model. Nonetheless, they are subject to scalability issues, being not efficiently applicable to high-dimensional scenarios. Generative Adversarial Networks (GANs) \citep{gan} were designed to be jointly parallel and multi-modal (i.e. capable of simultaneously generating multiple valid outputs for the same input). GANs consist of two networks: the generator and the discriminator. These two networks are trained {\em adversarially}. The generator creates artificial outputs that are passed to the discriminator along with real data. The discriminator is then tasked with identifying which outputs were real, and which were `fake'. The final goal here is to reach equilibrium, in which the generated samples follow the same distribution as the real data. When this happens, the discriminator can do no better than random guessing. Theoretically, GAN generators can perfectly imitate the original distribution provided that the network is sufficiently complex enough and the discriminator is optimal \citep{gan}. In practive, however, training a standard GAN discriminator to optimality can cause convergence issues and zero-gradients for the generator. Attempts to increase model stability include feature matching, label smoothing, and mini-batch discrimination \citep{salimans_improved_2016}. Alternatives to the Jensen-Shannon divergence (JSD) (that is implicitly used by standard GANs) have been investigated, such as the Wasserstein distance in WGAN \cite{arjovsky_wasserstein_2017}, and the Maximum Mean Discrepancy in MMD-GAN \cite{mmdgan, demmd}. A generalisation of the JSD to f-divergences has also been explored \citep{nowozin_f-gan_2016}. Unfortunately, no method has proven to be a clear winner \citep{lucic_are_2018}. A further risk of GANs lies in mode-collapse, when the generator memorises only a subset of the training information, hence failing to capture the high-level characteristics of the distribution. To tackle this issue, new architectures have been proposed, such as Conditional GANs (CGANs) \citep{cgan}, where additional classification information is provided to both generator and discriminator networks as a form of semi-supervised learning, Deep Convolutional GANs (DCGANs) \cite{dcgan}, where convolutional layers substitute pooling layers and Information maximising GANs (InfoGANs) \citep{chen_infogan_2016} that takes an information-theoretic approach to controlling the generation process. Generative Moment Matching Networks (MMNs) \citep{mmn} constitute another emerging cluster of implicit models, replacing GANs' discriminators with two-sample tests based on kernel maximum mean discrepancy to measure the distance between modelled and target distributions. Although MMNs offer theoretical guarantees, they are currently outperformed by GANs. Research on generative models is exploding, both in the evolution of existing models as well as in the introduction of new ones. GAN models are the most popular approach, but their implicit nature necessitates the development of trust through the definition and application of rigorous methodologies and metrics, so far demonstrated to be a difficult task. \begin{sidewaysfigure}[htp] \centering{\includegraphics[width=\textwidth]{images/datatypes.pdf}} \caption{Generative models for specific data types.} \label{fig:data_types} \end{sidewaysfigure} \subsection{Existing Methodologies} The discussion above focused on generative models in the most general sense, without any consideration for the {\em type} of data the model needs to generate. Much work in generative modelling has focused on the image domain with GANs, for example, being originally proposed as an image generation framework. Since their inception, however, many works have looked to generalise GANs to other domains. Below we overview some of the leading generative models that exist for a variety of different data types. Figure \ref{fig:data_types} gives an overview of the taxonomy. \subsubsection{Tabular data} Tabular data consists of values stored in rows and columns, whose synthesis requires the simultaneous modelling of distinct column distributions, as well as row-wise and table-wise constraints. Receiving less attention than image data in the generative domain, tabular data generation still has many obstacles to overcome. Initial generators relied on classifiers, as in the case of inverted decision-trees, vector machines and random forests, which struggle to strike a balance between classifier’s accuracy and the risk of leaking information \citep{caiola_random_2010, drechsler_using_2010, eno_generating_2008}. On the other hand, the application of GANs required the conversion of categorical, discrete columns to a continuous form using auto-encoders or through the decomposition in a variable number of Gaussian modes \citep{choi_generating_2018, xu_modeling_2019, zhao_ctab-gan_2021}. Nonetheless, the independent generation of column values might result in invalid rows, whose semantic correctness requires either the training of additional classifiers \citep{park_data_2018, xu_synthesizing_2018} or techniques based on Gaussian Copulae \citep{patki_synthetic_2016} and Bayesian networks \citep{abowd_how_2008, ping_datasynthesizer_2017,privbayes,gogoshin_synthetic_2020}. \subsubsection{Time-series data} Time-series are series of data points indexed in time order (e.g. electronic health record data containing information about visits to a GP, or higher frequency financial data, such as stock prices). Historically, they were generated via auto-regressive models \citep{tsay_analysis_2002}, hardly applicable to practical scenarios where stationarity only holds in specific time regions and in the presence of skewed and heavy-tailed distributions. Conversely, most implicit models focused on conditional distributions of future events given the occurrence of past ones, instead of capturing the full joint-law \citep{rcgan, timegan, fu_time_2019, wiese_quant_2019}. Recent developments allow training effort to be optimised by exploiting a reduced feature space, where the data stream is identified by its signature, resulting in a graded sequence of statistics \citep{ni_conditional_2020}. \subsubsection{Images} Applications of image synthesis are extremely diverse, ranging from the reconstruction of a damaged or missing region to the improvement of resolution and colour reproduction. The creation of an image consists in choosing a specific colour for each pixel, as the result of an image-to-image transformation or a text-to-image conversion. Variational Auto-Encoders were somewhat successful \citep{gregor_draw_2015, mansimov_generating_2016}, however, they featured a pixel-wise loss and simple conditioning, as in the case of class labels and image captions. On the contrary, GANs employ a semantic loss which is more aligned with the human visual system as well as being better suited to highly multi-modal outputs, where several valid images could be created \citep{renault_deep_2019}. Starting from vanilla GANs \citep{gan}, different architectures were proposed to generate plausible images in various datasets, as in the case of human faces \citep{karras_progressive_2018, huang_beyond_2017, brock_neural_2017, li_generative_2017, antipov_face_2017, zhang_age_2017, bin_high-quality_2017}, high-resolution photographs \citep{ledig_photo-realistic_2017, zhang_image_2019, brock_large_2019} and multi-domain images \citep{taigman_unsupervised_2016, liu_coupled_2016}. In text-to-image scenarios, the generation process starts from a brief text description, which is used as additional training information \citep{reed_generative_2016,reed_learning_2016} with the eventual aid of stacked architectures \citep{zhang_stackgan_2017,sharma_chatpainter_2018,zhang_photographic_2018} and attentive, semantic frameworks \citep{xu_attngan_2017,qiao_mirrorgan_2019,hong_inferring_2018} to preserve sentence-level consistency. \subsubsection{Audio} Similar to the generation of time-series, audio signals have a high temporal resolution, requiring representation and synthesis strategies capable of operating efficiently with a large number of dimensions. A significant attempt was the design of WaveNets \citep{oord_wavenet_2016}, arising from the architecture of PixelRNN \citep{oord_pixel_2016} borrowed from the image domain, further evolved by considering the speed difference between the raw audio and the hidden semantic-signal, which is usually many times slower \citep{mehri_samplernn_2017, sotelo_char2wav_2017}. A different approach consisted in the use of spectrograms, i.e. the simultaneous representations of audio signals in time and frequency, which requires lossy assumptions to cope with their non-invertible nature, inevitably reducing the overall quality \citep{shen_natural_2018, donahue_adversarial_2019}. \subsubsection{Video} The synthesis of a video can be considered as the generation of a sequence of images, where the main challenge stems from their inter-dependency and hidden temporal dimension. Unconditional video generation tried to maintain scene and foreground consistencies by separately focusing on objects' motion and RGB frame generation \cite{vondrick_generating_2016, ohnishi_hierarchical_2017, tulyakov_mocogan_2017, saito_temporal_2017}. Conversely, conditional approaches required smaller training datasets and allowed for finer control of modes of distributions, as in the case of audio conditioning for synchronising speech with a talking character \citep{vougioukas_end--end_2018, zhou_talking_2019, mittal_animating_2019}, text conditioning for video generation \citep{pan_create_2018, balaji_conditional_2019, li_storygan_2019}, image conditioning for the prediction of future frames \citep{mathieu_deep_2016, lee_stochastic_2018, villegas_decomposing_2018,walker_pose_2017,liang_dual_2017} and video-to-video for object animation \citep{bansal_recycle-gan_2018,chan_everybody_2019,kim_deep_2018,siarohin_animating_2019}. \section{Messages from Industry/Start-ups} \label{sec:indmess} In preparation of this report, the authors interviewed several industry partners and start-ups in the space of synthetic data. In this section we highlight some of the key themes and messages that we received in response to our questions. {\bf AI itself is in the early stages of mass adoption.} Though serious AI research has been ongoing for a long time now, widespread adoption of AI systems is in its infancy. Synthetic data is a younger field than the classical AI/ML problems of prediction, clustering, forecasting, etc. and significant research is required to fully benefit from this technology. That said, there is pressure for the adoption of private synthetic data (more than for other technologies) due to a heightening desire from the public for more privacy control. {\bf Empirical evaluations are necessary.} Though differential privacy is an attractive theoretical notion of privacy, industries struggle to trust it without empirical supporting evidence of privacy. Understanding practical implications of differential privacy (i.e. its susceptibility to attacks, what the parameters actually correspond to) is crucial to enable widespread adoption of private synthetic data. {\bf Synthetic data cannot wholly replace real data, or can it?} Opinions were more divided on this subject. The impossibility result of Ullman et al. \cite{ullman2011pcps} is a blow against the notion of a completely general-use synthetic dataset. The relaxed result of \cite{boedihardjo2021covariance}, however, indicates it might still be possible in many cases. Several in industry believe that real data should remain at the core of model development, with the final models ultimately being tweaked or even completely re-trained on the real data. Others believe that it will be possible to completely replace real data with synthetic data in the future. {\bf Synthetic data is about enabling.} The final takeaway is that synthetic data is about enabling processes that would otherwise not be possible, or that perhaps would drain a lot of resources (such as time). Synthetic data could be used to ``access'' data across legislative borders (e.g. in companies with an international presence), or to speed up model development times by allowing model designers access to {\em something} as early as possible. Ultimately, data is very powerful, and synthetic data may allow many more people to tap into its true potential. \section{Conclusion} Synthetic data is a promising technology, with a wide variety of applications. For both privacy and fairness, there is a large cost to getting it wrong. The methods that exist today should be implemented with caution, and significantly more research is needed, from a machine learning perspective, but also from a societal perspective, in order to understand properly the methods that exist. \section*{Acknowledgements} We would like to thank Accenture, Hazy, HSBC, MOSTLY AI, and the Office for National Statistics for their participation in our interviews. \bibliographystyle{unsrtnat} \section*{Executive Summary} This explainer document aims to provide an overview of the current state of the rapidly expanding work on synthetic data technologies, with a particular focus on privacy. The article is intended for a non-technical audience, though some formal definitions have been given to provide clarity to specialists. This article is intended to enable the reader to quickly become familiar with the notion of synthetic data, as well as understand some of the subtle intricacies that come with it. We do believe that synthetic data is a very useful tool, and our hope is that this report highlights that, while drawing attention to nuances that can easily be overlooked in its deployment. The following are the key messages that we hope to convey. \paragraph{Synthetic data is a technology with significant promise.} There are many applications of synthetic data: privacy, fairness, and data augmentation, to name a few. Each of these applications has the potential for a tremendous impact but also comes with risks. \paragraph{Synthetic data can accelerate development.} Good quality synthetic data can significantly accelerate data science projects and reduce the cost of the software development lifecycle. When combined with secure research environments and federated learning techniques, it contributes to data democratisation. \paragraph{Synthetic data is not automatically private.} A common misconception with synthetic data is that it is inherently private. This is not the case. Synthetic data has the capacity to leak information about the data it was derived from and is vulnerable to privacy attacks. Significant care is required to produce synthetic data that is useful and comes with privacy guarantees. \paragraph{Synthetic data is not a replacement for real data.} Synthetic data that comes with privacy guarantees is necessarily a distorted version of the real data. Therefore, any modelling or inference performed on synthetic data comes with additional risks. It is our belief that synthetic data should be used as a tool to accelerate the ``research pipeline'' but, ultimately, any final tools (that will be deployed in the real world) should be evaluated, and if necessary, fine-tuned, on the real data. \paragraph{Outliers are hard to capture privately.} Outliers and low probability events, as are often found in real data, are particularly difficult to capture and include in a synthetic dataset in a private way. For example, it would be very difficult to ``hide'' a multi-billionaire in synthetic data that contained information about wealth. A synthetic data generator would either not accurately replicate statistics regarding the very wealthy or would reveal potentially private information about these individuals. \paragraph{Empirically evaluating the privacy of a single dataset can be problematic.} Rigorous notions of privacy (e.g differential privacy) are a requirement on the {\em mechanism that generated} a synthetic dataset, rather than on the dataset itself. It is not possible to rigorously evaluate the privacy of a given synthetic dataset by directly comparing it with real data. Empirical evaluations can prove useful as tools to detect possible flaws in an algorithm or its implementation but may lead to false claims of privacy when there is none. \paragraph{Black box models can be particularly opaque when it comes to generating synthetic data.} Overparametrised generative models excel in producing high-dimensional synthetic data, but the levels of accuracy and privacy of these datasets are hard to estimate and can vary significantly across produced data points. \paragraph{Synthetic data goes beyond privacy.} Synthetic data provides promising tools to improve fairness, bias and the robustness of machine learning systems, but significantly more research is required to fully understand the opportunities and the limitations of this approach. \clearpage { \tableofcontents } \section{Introduction} The availability of high volume, high velocity and high variety datasets, together with advanced statistical tools for extracting information, has the potential to improve decision-making and accelerate research and innovation. At the same time, many large-scale datasets are highly sensitive (e.g. in health or finance) and sharing them may violate fundamental rights guarded by modern privacy regulations (e.g. GDPR or CCPA). A large number of real-world examples demonstrate that high-dimensional, often sparse, datasets are inherently vulnerable to privacy attacks and that existing anonymisation techniques do not provide adequate protection. This limits our ability to share these large datasets, creating a bottleneck on the development and deployment of machine learning and data science methods. Synthetic data is generated by a model, often with the purpose of using it in place of real data. By controlling the data generation process, the end-user can, in principle, adjust the amount of private information released by synthetic data and control its resemblance to real data. As well as addressing privacy concerns, one can to adjust for biases in historical datasets and to produce plausible hypothetical scenarios. If used responsibly, synthetic data promises to enable learning across datasets when the privacy of the data needs to be preserved; or when data is incomplete, scarce or biased. It can help researchers and developers prototype data-driven models and be used to verify and validate machine learning pipelines, providing some assurance of performance. It can also fuel responsible innovation by creating digital sandbox environments used by startups and researchers in hackathon-style events. Each of these uses presents great opportunities, but also challenges that require tailor-made solutions. Synthetic data generation is a developing area of research, and systematic frameworks that would enable the deployment of this technology safely and responsibly are still missing. \subsection{Report Structure} This explainer is organised as follows. In Section \ref{sec:what} we introduce a definition for synthetic data, give a brief history of its inception, and begin to answer one of the core questions surrounding synthetic data: {\em can it replace replace real data?} In Section \ref{sec:app}, we introduce key machine learning applications for synthetic data. Sections \ref{sec:privacy}-\ref{sec:privsdg} are dedicated to private synthetic data generation. In Section \ref{sec:privacy}, we introduce privacy from a more general perspective than synthetic data, introducing differential privacy and discussing some of its limitations. In Section \ref{sec:3att} we discuss three key attributes for evaluation of private synthetic data: utility, fidelity, and privacy. In Section \ref{sec:privaudit}, we discuss empirical evaluations of synthetic data for these key attributes. In Section \ref{sec:privsdg}, we discuss key differences between general privacy, and privacy as applied to the generation of synthetic data. We also survey existing methods in the space of private synthetic data generation. At the end of the section we discuss partially synthetic data, in which synthetic data is generated to create a hybrid real-synthetic dataset. In Sections \ref{sec:debias} and \ref{sec:dataaug} we discuss synthetic data for fairness and data augmentation. In Section \ref{sec:generalgen}, we provide a more in-depth survey of existing generative models. Finally, in Section \ref{sec:indmess}, we summarise key themes from discussions with industry partners and start-ups in the field of synthetic data. \section{What is Synthetic Data?} \label{sec:what} Despite tremendous interest in synthetic data, \cite{jordon2020synthetic,assefa2020generating,mendelevitch2021fidelity,bellovin2019privacy,mckenna2021winning}, to the best of our knowledge there is no widely accepted definition. In order to encapsulate the full breadth of applications and approaches to synthetic data, we propose the following definition. \begin{definition} Synthetic data is data that has been generated using a purpose-built mathematical model or algorithm, with the aim of solving a (set of) data science task(s). \end{definition} We contrast synthetic data with real data, which is generated not by a model but by real world systems (e.g financial transactions, satellite images, medical tests etc.). The {\em model} -- the synthetic data generator -- can take many forms, from deep learning architectures such as the popular Generative Adversarial Networks (GANs) \cite{gan}, or Variational Auto-encoders (VAEs) \cite{vae}, through agent-based and econometric models \cite{bonabeau2002agent}, to a set of (stochastic) differential equations modeling a physical or economic system \cite{carmona2018probabilistic}. Using computer-generated synthetic data to solve particular tasks is not a new idea, and can be dated back at least as far as the pioneering work of Stanislaw Ulam and John von Neumann in the 1940s on Monte Carlo simulation methods. Synthetically generated data has been widely used in research, as it provides a `ground truth', which is very useful in developing and evaluating machine learning pipelines. The recent increase in data protection regulations has fueled the use of synthetic data to mitigate disclosure risk. The key hope, which goes back to work by Rubin and Little, \cite{rubin1987multiple,rubin1993discussion,little1993statistical}, is to be able to use synthetic data in place of real data, to avoid privacy concerns \cite{dpbook, privbayes, dpganxie, rcgan, pategan}. The need to extract actionable information from large datasets led to the development of complex, data-driven (machine learning) models. For these models, the role of data in driving model selection is more prominent than it is for simpler, handcrafted models. This means that the quality of the model's output is directly dependent on the quality of the data used to train these models. This leads to a number of uses for synthetically generated data. One such use is bias removal (e.g. historical biases in gender or race) \cite{feldman2015certifying, kamiran2009classifying, zhang2016causal, calmon2017optimized, fairgan, decaf}. Given biased training data, a natural approach is to train models using available data; these biases can then be seen in the output of the trained models. Rather than attempting to de-bias each trained model individually, one could generate a de-biased synthetic dataset and use it to train each model \cite{fairgan, decaf}, creating a unified approach for handling biases across an organisation. Another use would be to use synthetic data to enlarge datasets that are too small, e.g. to provide robustness against ``outlier'' examples \cite{wong2016understanding, gansemisup, badgansemi, ganmanisemi, timesemi, timeressemi}. Another key use case, to which we pay particular attention in this report, is the goal of using synthetic data to protect privacy. In each of these cases, the goal is to create synthetic data which resembles some aspects of the real data but not others. To maximise the utility of synthetic data, a fine balance must often be struck between competing objectives. It is crucial to understand that synthetic data does {\em not} automatically address any of these problems. Training an off-the-shelf generative model based on real data, and then using this trained model to generate synthetic data, is {\em not inherently private}. Standard GANs do not generate private nor unbiased data. In fact, machine learning models have demonstrated the capability to (undesirably) memorise their training inputs \cite{arpit2017closer, goodfellow2016deep}. Applied to GANs, this can result in memorisation and regurgitation of the training data \cite{modecollapse}, undermining privacy in the synthetic data. At the other extreme, synthetic data can be generated without training data, e.g. using agent-based models that mimic the data generation process, such as agents transacting in a financial network. With no access to any real data, the synthetic data generator is private, but the data it generates is limited to the model's predetermined configuration, and will not enable statistical inferences to be reliably drawn about the real world. \subsection{Can synthetic data replace real data?} \label{sec:likerealdata} The use of synthetic data raises two key questions: \begin{enumerate} \item Can we do the same things {\em with} synthetic data that we do {\em with} real data? \item Can we do the same things {\em to} synthetic data that we do {\em to} real data? \end{enumerate} The sorts of things we may wish to do {\em with} synthetic data are building models, performing data analysis, testing hypothesis, etc. Things one may wish to do {\em to} synthetic data, for example, might be linking separate datasets together, or extending a synthetic dataset when new records are added to the original dataset. \subsubsection{How should we approach doing things {\em with} synthetic data?} Ideally, one may hope that synthetic data can be simply plugged in wherever one might usually use real data (e.g. as training data for a model). Many papers on synthetic data evaluate it in this way. However, with private data, a more careful approach may lead to more accurate information being extracted from the synthetic data \cite{williams2010probabilistic}. In particular, conclusions from data analysis and hypothesis testing are necessarily weaker when using synthetic rather than real data, and the statistical significance of such analyses needs to be adjusted accordingly. A particular concern for private data is bias. Ghalebikesabi et al.~\cite{ghalebikesabi2021bias} warn against the risks of learning from synthetic data, and propose a methodology for learning unbiasedly from such data. Wilde et al. \cite{wilde2021foundations} demonstrate superior performance when model parameters are updated using Bayesian inference, rather than approaches that fail to account for the fact the training data is synthetic. \subsubsection{Data Linking} \label{sec:datalinking} Something that can naturally be done with real data is linking. One dataset may contain an individual's lab test results, another may contain their genetic data, and another their hospital appointments. Each of these datasets can be linked to create a larger dataset containing information about inter-dataset correlations. If these datasets were synthesised independently, the 1-1 match between datasets will be broken; if, in the future, someone wished to pull together these synthetic datasets to investigate the correlations between, say, genetic data and lab test results, they would not be able to do so effectively. One solution would be to encourage data holders to generate synthetic data with other (previously generated) synthetic datasets in mind. This may be appropriate in some situations (e.g. when the two datasets are being held by the same data holder), but in general this will not be the case. Moreover, the initial privacy loss suffered by an individual present in both datasets will be greater than if synthetic data was generated independently. This is particularly inefficient when linking the datasets might not be important, or the benefits of doing so are unclear. In these situations, there is a need to be able to link two independently generated synthetic datasets (given access to real data) in a minimally privacy-leaking way. One workaround would be to simply generate a new joint dataset from the newly-joined underlying real datasets; but this does not leverage the existing synthetic data. A less naive approach would be to conditionally generate one of the two synthetic datasets based on the other (existing) synthetic dataset. This is a reduction in privacy cost over generating from scratch, but still fails to leverage the second already-generated synthetic dataset. \subsection{Combining Synthetic Data with Other Technologies} \label{sec:othertech} \textbf{Secure Research environment.} Synthetic data, in particular with differential privacy, has a natural application within secure research environments, in which decreasingly private data can be accessed in increasingly more ``secure'' environments. Consider releasing a dataset with strong privacy guarantees initially, evaluating a range of machine learning methods, then selecting the top $N$ candidates, and giving them access to less private data. This can be repeated, giving a `tournament' of methods. This raises the question of how to generate a series of datasets $\mathcal{D}_1, ..., \mathcal{D}_n$ which decrease in privacy individually and when taken together (so any subset $\mathcal{D}_1, ..., \mathcal{D}_j$, $j < n$ is as private as the terminal dataset, $\mathcal{D}_j$). \textbf{Federated learning.} Federated learning is an emerging technology that enables training across decentralised datasets without pooling these datasets together. This contrasts with traditional centralised machine learning techniques, where the data is uploaded to one server, as well as to classical decentralised approaches which often assume that local data samples are identically distributed. In federated learning, distributed data holders allow an algorithm to be run on their private data, and only the (possibly noisy) outputs are released, without giving direct access to the data. The challenge with it is that, without accessing the data first, it might not be clear what algorithm one should run. Developing an algorithm on private synthetic data samples and evaluating its utility on real (distributed) data seems a very promising approach to this data bottleneck. \section{Why use Synthetic Data?} \label{sec:app} Synthetic data is being used as a solution to a variety of problems in many domains. Three key areas that are of particular interest in a machine learning context are: (i) private data release (Section \ref{sec:privacy}); (ii) data de-biasing and fairness (Section \ref{sec:debias}); and (iii) data augmentation for robustness (Section \ref{sec:dataaug}). Although these are the areas that appear to have the most promise, this list is not exhaustive. Before going into details for each of them, we outline the key ideas for these areas and some of the specific use cases (and non-use cases) below. \subsection{Private Data Release} The wide adoption of data-driven machine learning solutions as the prevailing approach to innovate has created a need to share data. Without access to quality data, scientists and developers cannot make meaningful progress. However, GDPR, HIPAA, and a host of privacy regulations require data on individuals not to be shared carelessly (rightly so). The result is typically a long series of ``jumping through hoops'' in an attempt to access the necessary data. Synthetic data offers a potential solution. \paragraph{Development of ML tools.} In this use case, a data controller may wish to assess an ML group's ability to solve a problem, or perhaps even assess several groups simultaneously to select the best partner with which to develop a final solution. In order to avoid privacy concerns, they plan to share synthetic data with their potential partners. For synthetic data to be useful in this setting, model development that is performed on the synthetic data should lead to the same conclusions as if it were carried out on the real data. More concretely, if a researcher comparing two models on the synthetic data were to conclude that model A outperforms model B for a given task, then the same conclusion should be reached when testing both algorithms on the real data. This suggests that, though the synthetic data would need to share many statistical properties with the real data, one can imagine that there are some properties that would not affect these comparisons. Once a final group/model has been determined, it can be taken to the real data for testing, tuning or even a complete re-training. \paragraph{Software testing.} There is a significant appetite for vast amounts of test production data for both system testing and User Acceptance Testing. Synthetic data can remove the requirement of going through lengthy and repeated approvals (e.g GDPR) and sanitation processes and hence save significant time and effort in the development lifecycle. In this setting, it is important that synthetic data used for software testing is semantically correct, but it need not necessarily be statistically correct. Mathematically, this amounts to learning the {\em support} of the distribution and relevant structural properties (e.g time-series data), but not necessarily the distribution itself. Naturally, by not requiring statistical accuracy, there is much more room for increased privacy (or increased utility at the same privacy level). This is one of the design principles of OpenSafely~\cite{williamson2020factors}, where practitioners are able to test and develop algorithms on dummy data before running them once on the real data. \paragraph{Deploying private machine learning tools.} Machine learning models are not inherently private. It is well known that neural networks have the capability to memorise training inputs. Membership inference attacks are possible against such networks~\cite{shokri2017membership} and, as such, privacy-enforcing training algorithms for machine learning models have been developed \cite{dpsgd, abadi2016deep, pate1, pate2}. An apparent alternative (to enforcing privacy during the training of a model) would be to generate private data and then train a model using this data. {\em Perhaps} one advantage of such an approach would be that a single private synthetic dataset could create a unified approach to privacy (within a single organisation, say), but we believe that the cost in utility would outweigh the potential ``simplicity'' of the approach in most applications. While training the model on private synthetic data might be appealing, it has limitations. Private data generation isn't often able to capture all of the statistical structure that might be important to develop accurate models. As such we believe it to be more prudent to focus efforts on the privacy of trained models, rather than on trying to generate private data with which to train. \subsection{De-biasing} \paragraph{Reducing/removing bias.} When generating synthetic data, one can aim at producing samples that do not suffer from historical biases but are otherwise still statistically accurate. Such data can be used then for training `black box' ML pipelines, while mitigating the risk of historical biases being amplified \cite{tiwald2021representative}. Importantly, such data can be reused to train multiple models. This should be contrasted with the approach of correcting each trained model separately. The latter approach has an additional disadvantage, as it could lead to inconsistencies in the way 'fairness and bias' are treated within an organisation. It must be recognised, however, that employing such methods to remove bias from the data introduces additional model risks that need to be quantified and monitored. \paragraph{What-if-scenario generation.} Adjacent to bias removal in datasets is the question of {\em causal modelling} -- i.e. asking the question ``What if?''. Synthetic data may allow us to explore data generated according to the same causal structure but adjusted distributions, or with different causal interventions placed on the data generating process. One must be very careful to properly model causal relationships though, as causal modelling is sensitive to assumptions and is {\em not} the same as conditional generation. Indeed, the trustworthy deployment of data-driven models requires that these perform well in situations that differ from the real data. Of course, again, we stress that model risk is being introduced as generative models are being used to produce these new scenarios. \subsection{Data Augmentation} \paragraph{Data labelling.} Deep neural networks are state of the art technology in computer vision applications. However, training deep neural networks requires vast amounts of (correctly) labelled data, which is often costly to produce. Synthetically generated labelled data offers a cost-efficient solution to this challenge, and has already been adopted by industry \cite{nikolenko2019synthetic}. In this application, one trains a neural network on synthetic data with the intention to deploy it on real data. In general, privacy is not of primary concern in these applications, as the data is not being used to replace the real data but to be used alongside it. \section{Privacy in Machine Learning - An Overview} \label{sec:privacy} Privacy is an incredibly large field, with practitioners coming from a wide variety of domains. Here, we present our view on privacy within the context of machine learning. We take a ground-up approach, motivating privacy through the notion of an adversary that has the potential to cause harm should too much information about an individual be revealed to them. Privacy is a fundamental human right and a prerequisite for freedom of thought and expression. For this reason, a key requirement of privacy is the \textit{consent} of individuals to have their data collected. This consent usually relies on the expectation that the collection of their data, and the subsequent release of information derived from it, will not cause them \textit{harm}. For some types of information, such as an individual's name, address, and phone number, the potential for harm is clear. For others, the potential for harm is more subtle: e.g. it might be that an insurance company would increase the price of an individual's insurance premiums based on knowledge that the specific individual is a smoker, without explicitly requesting this information. This potential for harm is caused by the ability of an {\em adversary} to gain information about an individual due to the release of data, or more generally from output that is derived from the data (again, this could be a synthetic dataset, or some other algorithm output). On the other hand, there is a highly social aspect to working with data. Shared datasets that can be used to benchmark models create a community that promotes rapid advancement of technology (see, for example, the rapid progress made in image classification that was caused by the availability of the MNIST and CIFAR datasets \cite{mnist, cifar}). In general, researchers want data, and it may not need to be too accurate for them to start being able to work with it. Since the late 1990s, much research has been carried out within the realm of privacy. Early on, privacy was often tied together with the notion of {\em anonymity}, which came in a variety of flavours, from basic name/address/birthday removal (``pseudonymisation''), to $k$-anonymity \cite{kanom} (which itself had several iterations \cite{ldiv, tclose, dpres}). Although these notions apply to data, they really only have meaning on the raw data itself, and moreover have been shown to be inadequate even for that \cite{kcrit, imdb}. These approaches were built to prevent against {\em known} attacks. More recently, privacy is being studied with a view to prevent against abstract {\em threat models} rather than specific instantiations of an attack. \subsection{The Threat Model View} \label{sec:threat} Threat model privacy attacks can be summarised into 3 types: membership inference; attribute inference; and reconstruction attacks. \vspace{1em} \begin{tabularx}{\linewidth}{lXX} \textbf{Threat} & \textbf{Attacker's knowledge of Targeted Individual} & \textbf{Attacker's goal} \\ Membership inference & Partial/Entire record & Determine if Targeted Individual was in the original data\\ Attribute inference & Partial record & Recover missing attributes of Targeted Individual's data\\ Reconstruction attack & N/A & Recover entire records from the original data\\ \end{tabularx} These attacks differ both in their goals and in some of the assumptions placed on the adversary's prior knowledge {\em of the targeted individual}. It should be noted, however, that these attacks do not necessarily place any assumptions on the prior knowledge that an adversary might have about the individuals it is {\em not} targeting. These attacks are not typically performed against a single individual but multiple individuals at once, with a breach of any individual's privacy being considered a success by the adversary. \paragraph{Membership Inference.} Membership inference \cite{shokri2017membership, hu2021membership} aims to determine whether an individual (whose full record might be known to the adversary) was part of the data that was given as input to an algorithm, given the output of the algorithm (and, potentially, knowledge of the workings of the algorithm). On its own, this is only of relevance when membership in the dataset implies some information about an individual. For example, it is not particularly useful (or much of a privacy violation) to ascertain that a particular individual's data was in the 2021 UK Census dataset. Following the example of the smoker, though, it is a violation to be able to ascertain that a given individual is in a dataset that contains only smokers (such as a dataset used in a scientific study of smokers). \paragraph{Attribute Inference.} Attribute inference \cite{al2012homophily, privtraits} is slowly becoming infamous as a non-violation of privacy. The goal with attribute inference is to determine some extra information about an individual given some prior knowledge about some of their attributes and access to an algorithm's output (e.g. synthetic data, or a trained ML model). Of course, this is precisely what predictive models aim to do -- predict (an) attribute(s) from a set of other attributes \cite{kosinski2013private}. But this leads to an almost paradoxical conclusion, how can a model that was trained {\em without} an individual's data, violate their privacy? This almost-paradox has led to many privacy researchers abandoning attribute inference as a violation of privacy \cite{dpinf, scienceharm}. However, the question should not be, ``does this allow you to learn more about an individual?'', but rather, ``does this allow you to learn more about an individual than if they had not been in the data?'' It is still possible (in fact, with ML it is very likely \cite{dlgen}) that a trained model will perform better on its training inputs than on inputs not used for its training. This indicates that the release of such a model does violate the privacy of the individuals in the training set \cite{aioverfit}. Recent work in the space has attempted to determine the feasibility of attribute inference attacks. \cite{zhao2021feasibility} show that even when membership inference is possible, attribute inference may not be; they do, however, demonstrate that {\em approximate} attribute inference is possible. \paragraph{Reconstruction Attacks.} Reconstruction attacks~\cite{dinur2003revealing} aim to extract entire records from the training dataset, based on the output of an algorithm. For instance, Dinur and Nissim showed how a database protected by a question-and-answer system can be reconstructed by an attacker if the level of the noise added to answers is low~\cite{dinur2003revealing}. Another high profile example is the attack performed by researchers at the US Census bureau on aggregates from the 2010 Census. They were able to retrieve exact records for 46\% of the US population using publicly released data~\cite{uscensus2021}. Unlike membership and attribute inference attacks, reconstruction attacks are not \textit{targeted}: they aim to retrieve records for any (or all) records in the original data. This could leverage prior knowledge about {\em some} of the individuals in the training set (with the remaining unknown individuals being considered the targets). Note that the same caveat as for attribute inference attacks applies: even an algorithm sampling records uniformly at random in $\mathcal{X}$ will reconstruct \textit{some} records in the real data with nonzero probability. Evaluation of a reconstruction attack should therefore be contrastive, i.e.~based on the difference of reconstruction likelihood for a record due to their presence in the data (although real-world attacks recover such large fractions of the data that this consideration is often not needed). \subsection{Differential Privacy} \label{sec:dp} Differential Privacy \cite{dpbook, nontechdp}, first proposed by Dwork et al.~in 2006 \cite{ogdp}, is becoming increasingly accepted as a robust, meaningful, and practical definition of privacy \cite{uscensus, microsoftdp, facebookdp}. Informally, differential privacy requires that an algorithm's (necessarily random) output not differ ``too much'' between {\em adjacent} datasets. Intuitively, because the outcome cannot differ significantly, there cannot be too much ``information leakage'' from the dataset to the algorithm output. The definition rests on some notion of datasets being {\em adjacent} to each other, and can be used to capture the notion of an individual's data. This adjacency can be defined in different ways depending on the type of data structure. With so-called tabular data, adjacency between two datasets is typically defined to mean that one can be obtained from the other by either the removal/addition (unbounded differential privacy \cite{dpbook}) or replacement (bounded differential privacy \cite{dpbook}) of a row. Defining this adjacency amounts to deciding precisely what information should be protected \cite{mcsherry2009differentially, hardt2012beating}. With graph-like data, one could consider either entire nodes (along with all associated edges) to be important, or instead consider only the edges themselves to each be individually important \cite{edgenodedp, edgenodedp2}. With tabular data, one might define adjacency as datasets differing in precisely one value, allowing ``feature-wise'' differential privacy that protects each value contributed to the dataset, rather than rows as a whole. This would allow data contributors to decide to maintain the privacy of some, but potentially not all, of their data. A particularly important feature of differential privacy is that it is {\em contrastive} -- it compares the outcome of an algorithm when an individual is in the training data to the outcome when the individual is not in the training data, or some similar adjacent perturbation. This idea, that privacy cannot be breached when an individual is not in the data, is crucial in dismissing several more ad-hoc notions of privacy. Crucially, for synthetic data, just because one of the synthetic data points {\em looks like} one of the original data points does not mean that privacy has been violated -- the synthetic point might have been generated even without the original point being present in the training data. \begin{definition}[Differential Privacy \cite{dpbook}] \sloppy A {\em randomized} algorithm, $\mathcal{M}$, is $(\varepsilon,\delta)$-differentially private if for all $\mathcal{S} \subset \mathrm{Im}(\mathcal{M})$ and for all neighboring datasets $\mathcal{D}, \mathcal{D}'$: \begin{equation*} \mathbb{P}(\mathcal{M(\mathcal{D})} \in \mathcal{S}) \leq e^\varepsilon \mathbb{P}(\mathcal{M(\mathcal{D}')} \in \mathcal{S}) + \delta \end{equation*} When $\delta = 0$, $\mathcal{M}$ is said to be \emph{pure $\varepsilon$-differentially private}. \end{definition} \fussy Intuitively, the key promise of differential privacy is that \textit{any} analysis run on the output of a differentially private procedure will yield approximately the same result whether or not any individual contributes their record to the dataset. This also includes potential harms that could be caused by the publication of potentially sensitive information. For instance, assume that a DP procedure is used to train a ML model to detect a specific disease from sensitive medical records. No operation performed on this model (e.g. inspecting its parameters, applying it to well chosen inputs) can reveal information about individual training records. Hence, it serves as a form of statistical guarantee for individuals that the collection and use of their data will not yield negative consequences (that would not otherwise occur even if the data was not shared\footnote{A notorious~\cite{dpbook} example of this is an insurance company updating premiums based on the result of a study showing correlation between smoking and lung cancer. A client's premium might go up even if their data is not used in the study. Differential privacy here ensures that the result of the study would not change too much whether they give their data or not.}). Formally, from a Bayesian point of view, this means that for all potential priors over datasets, the posterior computed after observing the outcome will be similar to the posterior obtained if any one user was removed from the dataset~\cite{kasiviswanathan2014semantics}. \paragraph{Bayesian interpretation of Differential Privacy} {\em It is instructive to consider the Bayesian interpretation of privacy guarantees implied by differential privacy, which compares the adversary’s prior with the posterior. To that end it is useful to view $\mathcal D$ and $\mathcal D'$ as a realisation of a random variable $\bm{ \mathcal D}$. That way we can model prior knowledge an adversary has about the dataset i.e $\mathbb P(\bm{ \mathcal D} = \mathcal D)$. Note that $(\epsilon,0)$-differential privacy implies a bound on the Bayes factor \[ \frac{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D )}{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D' )} \leq e^{\epsilon}\,. \] This then implies a privacy guarantee on posterior beliefs regarding the value of $\bm{\mathcal D}$ given the output of a differentially private algorithm \[ \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D | \mathcal M(\bm{ \mathcal D}))} {\mathbb P( \bm{ \mathcal D} = \mathcal D' | \mathcal M(\bm{ \mathcal D}))} = \frac{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D )}{\mathbb P( \mathcal M(\bm{ \mathcal D}) | \bm{ \mathcal D} = \mathcal D' )} \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D ) } {\mathbb P( \bm{ \mathcal D} = \mathcal D' ) } \leq e^{\epsilon} \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D )} {\mathbb P( \bm{ \mathcal D} = \mathcal D') }\,. \] To put it another way, and due to symmetry between $D$ and $D'$, differential privacy implies that the log-odds cannot change significantly, \[ \left| \log \left(\frac{\mathbb P( \bm{ \mathcal D} = \mathcal D | \mathcal M(\bm{ \mathcal D}))} {\mathbb P( \bm{ \mathcal D} = \mathcal D' | \mathcal M(\bm{ \mathcal D}))} \right) - \log \left( \frac{\mathbb P( \bm{ \mathcal D} = \mathcal D )} {\mathbb P( \bm{ \mathcal D} = \mathcal D') } \right)\right| \leq \epsilon. \]} In light of the threat model view introduced in Section \ref{sec:threat}, it should be noted that differential privacy provides provable bounds on the ability of an adversary to perform such attacks \cite{dpboundmi}. These bounds assume worst-case prior information, knowledge of the algorithms, and computing power of the adversary. Differential Privacy also enjoys several nice properties that have helped with its adoption, such as composability, resistance to post-processing, and plausible deniability \cite{dpbook}. Composability and the post-processing theorem, in particular, allow for differentially private algorithms to be built out of smaller building blocks, which is precisely the driving force behind Differentially Private Stochastic Gradient Descent (DPSGD) \cite{dpsgd, abadi2016deep}. DPSGD has enabled differential privacy to be applied to deep learning architectures. This, in turn, has allowed the development of several DPSGD-driven generative models for synthetic data (see Sec. \ref{sec:privmodels}). \paragraph{Flavours of Differential Privacy.} Above, we introduced the two most common notions of differential privacy, pure- and approximate-differential privacy ($\varepsilon$ and $(\varepsilon, \delta)$). There are in fact several relaxations of differential privacy, such as Renyi-Differential Privacy \cite{renyidp}; extensions, such as Label-DP \cite{labeldp}; and even stronger notions, such as local differential privacy \cite{localdp}. Depending on the task at hand, these notions may be more or less useful than vanilla DP. \subsubsection{Limits of DP} \label{sec:limitsdp} Despite being widely accepted as the best available privacy definition, differential privacy is not without its weaknesses. \paragraph{Choosing parameters $\varepsilon, \delta$.} The privacy protection afforded by a differentially private mechanism is controlled by parameters $\varepsilon$ and $\delta$. Choosing appropriate values for these parameters is notoriously difficult (in part due to their opaqueness in interpretability), and strongly depends on the context~\cite{lee2011much, hsu2014differential, abowd2019economic}. This is further complicated by the fact that many methodologies lack a tight analysis of their privacy, leading to larger-than-necessary noise being injected into the system, hindering utility~\cite{stadler2020synthetic}. \paragraph{Relaxations.} Though often celebrated as a strength, the lack of assumptions placed on an adversary's knowledge and capabilities can lead to overly conservative computations, which hinder the utility of the output. Researchers have proposed many relaxations of the original definition (which required $\delta = 0$)~\cite{desfontaines2019sok}. However, the privacy guarantees of these can be hard to understand and model. Similarly to the parameters issue, researchers have started using attacks to compare mechanisms using different definitions of privacy~\cite{labeldp}. \section{Utility, Fidelity and Privacy of Synthetic Data.} \label{sec:3att} For synthetic data to be {\em meaningful}, it must be similar to {\em and} different from the original data in some sense. If synthetic data is being considered, then there is a reason that the original data is inappropriate or inadequate for the task at hand -- be it because it is non-private, biased, or too small -- and so synthetic data that is too similar to the original data will also suffer from the same problems. The ``allowed'' similarity (or rather the required non-similarity) will differ from task to task, and constitutes one of the 3 attributes that are fundamental to synthetic data generation: {\em utility}, {\em fidelity}, and {\em privacy}. \paragraph{Utility:} The utility of synthetic data often is determined by its usefulness for a given task or set of tasks. This often involves contrasting the performance of models trained on real vs synthetic data, and might involve inspecting concrete metrics such as accuracy, precision, root mean-squared error, etc.; and/or model fairness properties such as demographic parity, fairness through unawareness, or conditional fairness \cite{decaf}. Doing so often requires the \emph{Train on Synthetic, Test on Real} (TSTR) paradigm \cite{rcgan} in which models are trained on synthetic data and their performance then evaluated on real data. \paragraph{Fidelity:} Often lumped together with utility, we define fidelity to be measures that directly compare the synthetic dataset with the real one (rather than indirectly through a model, or through performance on a given task). From a high-level perspective, fidelity is how well the synthetic data ``statistically'' matches the real data. Measures of fidelity are often used because of an underlying intuition that a specific fidelity will correspond to improved performance on a wide range of tasks. In the most general case, full statistical similarity (i.e. matching the distributions of the synthetic and real data), should allow many tasks that would be performed on the real data to be performed on the synthetic. However, such a match is difficult, especially in the presence of privacy requirements \cite{ullman2011pcps}, and even undesirable in the presence of biases \cite{decaf}. Rather than seeking a ``full'' statistical match, one might inspect low-dimensional marginals \cite{choi2017generating}, the syntactical accuracy of the synthetic data \cite{alaa2021faithful}, or look at the distribution of the remaining features conditional on a feature that is known to be biased in the original data. \paragraph{Utility vs. Fidelity:} Much of the literature on synthetic data, in particular for private synthetic data, focuses on the 2-dimensional trade-off between utility and privacy, folding fidelity into utility. While the two are unavoidably linked, they are not synonymous nor perfectly correlated. In some scenarios, fidelity can be reduced while leaving utility unaltered (or vice versa), potentially ``leaving room'' for other benefits, for example, improved privacy. \paragraph{Privacy:} The privacy of synthetic data is determined by the amount of information that it reveals about the real data used to produce it. Depending on the use case, different privacy guarantees might be required. For example, internal synthetic data release within a secure environment will typically require less stringent privacy evaluation than data released to the general public. Theoretically sound notions such as differential privacy and its offspring exist, allowing for systematic analysis of the privacy of algorithms used to produce synthetic data. Less is known about the precise meaning of the privacy of a specific synthetic data sample if the data generation method is not revealed, or how to evaluate it, since privacy is typically defined as a statistical property over many instances. Of course, extra care is required to ensure that privacy that has been proven on paper is not lost through sloppy implementation of these algorithms in practice \cite{stadler2020synthetic}. \paragraph{Privacy vs Fidelity:} As a rule of thumb, when fidelity increases, the privacy of synthetic data decreases. This means that, in general, it is impossible to generate private synthetic data that will be useful for all use cases. Instead, one might group potential use cases in terms of the type of fidelity that is required (i.e.~which features of the original dataset need to be captured by the synthetic data) and generate multiple synthetic datasets, each with user specified privacy guarantees. \subsection{Synthetic Data Desiderata} A good synthetic data generator (SDG) should simultaneously satisfy the following properties: \begin{enumerate} \item \textbf{Syntactical accuracy}: The generated data should be plausible (e.g.~a synthetically generated postcode should exist). However, this also requires that certain structural properties of the data are preserved. For example, with time-series data, one needs to ensure that data points are not generated using information from the future. Similarly, when synthesising financial transnational networks, the underlying graph structure of the data must be preserved. \item \textbf{Privacy}: It should be possible to precisely quantify how much information about the original data is revealed through the releasing of the synthetic sample. How exactly one measures privacy will depend on the specific task at hand. While differential privacy is one popular way of assessing the amount of information release through synthetic data generators, a different notion might be required when the data is sparse or one wants to move away from worst-case bounds. \item \textbf{Statistical accuracy}: It should be possible to precisely quantify the statistical similarity (or lack thereof) between the synthetic and the original data. When measuring statistical accuracy, one might be interested in capturing certain marginal distributions and certain relationships between variables, but not others. A good synthetic data generator should allow for control over this. \item \textbf{Efficiency}: The algorithm should scale well with the dimension of the data space (i.e. feature space). It is well known that, in general, approximation of distributions can suffer from the curse of dimensionality, and consequently sampling from unstructured distributions is an NP-hard problem. \end{enumerate} While it its relatively straightforward to design algorithms for which a subset of these properties hold, there is currently no systematic framework for developing SDGs for which all 4 properties are satisfied simultaneously. For example, generation of statistically accurate but private data is hard, as these goals may be in conflict. Specifically within the realm of differentially private {\em synthetic data}, Ullman et al.~\cite{ullman2011pcps} demonstrated that a computationally efficient algorithm (i.e. runs in polynomial time) that generates synthetic data that both: (i) satisfies differential privacy; and (ii) preserves the correlations between pairs of features, does not exist. This result holds in a general sense, in that for every algorithm that {\em could} generate synthetic data, there is {\em a} dataset that ``will not work''. That said, it is possible that: \begin{itemize} \item for a specific application (e.g., dataset), it is possible to efficiently generate DP synthetic data; \item one may not be interested in the correlations being preserved (i.e. the application may demand a different fidelity notion). \end{itemize} Nevertheless, this impossibility result implies that one needs to assess the privacy and fidelity of the data on a per-case basis. Most importantly, there is no ``one-size-fits-all'' differentially private synthetic data generation method. In \cite{boedihardjo2021covariance}, the authors show that by reducing the requirement that all correlations be matched to the requirement that {\em most} correlations be matched, a computationally efficient algorithm {\em does} exist. Such a result is promising for synthetic data, but raises the question of being able to quantify what aspects of the data structure (i.e. which correlations) are {\em not} being matched. Such results highlight the need for synthetic data to not try to be too general -- synthetic data should be generated with a use case in mind. For a given use case, relevant statistical properties can be preserved, while others can be ignored in the name of creating privacy. Below, we give some concrete examples of such use cases, alongside an application we believe to be a misguided endeavour. \section{Auditing Synthetic Data} \label{sec:privaudit} In this section, we discuss various approaches for empirically evaluating synthetic data, both in terms of its privacy, and its utility and fidelity. \subsection{Empirically Evaluating the Privacy of Synthetic Data} Given that differential privacy is a theoretical notion of privacy that must be proven, and correctly implemented, to be satisfied, a natural question is to ask whether or not one can verify some notion of privacy for a synthetically generated dataset, or a synthetic data generator, empirically. Given that the goal is to protect against the (abstract) threat models outlined in \ref{sec:threat}, can one ``prove'' privacy by attempting to perform attacks against a given dataset? \paragraph{DP verification.} As mentioned above, the differential privacy of a synthetic dataset is more precisely a property of the algorithm that generated it, and {\em cannot} be verified by inspecting the synthetic dataset itself. Researchers have been investigating methods for checking that an algorithm meets DP requirements~\cite{ding2018detecting,jayaraman2019evaluating,jagielski2020auditing}. These methods work either by querying the algorithm in search of violations of the privacy definition, or by running known attacks (e.g.~membership inference) against it. These are useful tools, which can be applied to SDG methods, as a way of testing/understanding their privacy. Perhaps the most useful application is to help us understand what values of $\varepsilon$ make the most sense in a specific context. However, using these tools to ``prove'' differential privacy is not possible, as they are based on statistical analysis of the generating algorithm. What is possible is that one can show, with a certain confidence, that an algorithm is {\em likely} to be differentially private, but doing so would require sampling many, many times (and more samples would be needed for more complex outputs/algorithms, e.g.~when the output is a dataset) from the algorithm with many, many different input datasets. Doing so would be {\em highly} computationally intractable if any sort of meaningful level of confidence was to be achieved. \paragraph{Leakage estimation.} An alternative option for evaluating the privacy of algorithms is to use \textit{leakage estimation} techniques~\cite{chatzikokolakis2010statistical,cherubin2017bayes}, which stem from the quantitative information flow community~\cite{smith2009foundations}. These techniques enable quantifying the privacy of an algorithm with respect to a specific threat model (or adversary). For example, in the context of SDG, this means one could use leakage estimation for assessing the resilience of a method against membership inference or attribute inference attacks, which we described above. A strong advantage of this approach, is that it does not require any formal analysis of the SDG method; additionally, it can be used for selecting the privacy parameters of a DP algorithm. Another advantage is that some of these methods enable a fully black-box analysis; that is, there is no need to describe the algorithm's internals analytically. One disadvantage is that the leakage estimation analysis is done with a specific threat model (or attack) in mind, although there are ways of capturing many attacks with the same analysis~\cite{m2012measuring}. A second disadvantage is that, in the case of black-box leakage estimation methods, the formal guarantees derived via these approaches make the assumption that we can sample an arbitrary amount of data from the algorithm. Nevertheless, they have been shown to be effective when tackling real-world tasks~\cite{cherubin2019fbleau}. \paragraph{Empirical privacy evaluation of datasets themselves.} The empirical evaluation of privacy of synthetic data is a nascent and challenging area of research. Despite the fact that {\em differential} privacy cannot be established for a dataset in isolation, practitioners in the field of synthetic data have made use of a hold-out test set to evaluate (other notions of) the privacy of generated synthetic data \cite{mostlyai}. The Nearest-Neighbour distance ratio (NNDR) has been used to inspect whether or not synthetic data points are closer than some hold-out test points to the underlying real data points (on average). This involves splitting the data into a training set, and a test set (as is similarly done in supervised learning problems). The training set is then used to train the model. Once trained, samples are drawn from the trained model, and the distance from these samples to the training data is compared with the distance from the test set to the training data. Note that although this method is agnostic of the method used to train the data generator, it does rely on a hold-out test set being available. As noted in \cite{mostlyaiblog}, non-existence of points can be just as revealing as the existence of points in the synthetic dataset, but privacy analysis via NNDR does not capture this behaviour. Indeed it is possible to satisfy NNDR by creating ``holes'' in the synthetic data around the real data points, but such an approach would reveal where the real records should be. A similar application of NNDR is performed in \cite{adsgan} to attempt to ensure privacy of the generative model, which also does not control for the creation of such ``holes''. In \cite{choi2017generating}, they use a nearest-neighbour based classifier to quantify the risk of attribute disclosure but do so in a non-contrastive way, thus rendering the privacy analysis weak. An NNDR-type metric was also used in \cite{yale2019assessing} to assess the relative privacy of several generative models proposed for health data. \paragraph{Attacks against private synthetic data.} As we explain in section~\ref{sec:threat}, one of the approaches to understand and analyse privacy is through the lens of attacks: what can a motivated attacker learn about users in the dataset? In addition to being intuitive, this approach can help us evaluate whether a system protects user privacy in a given context, and compare methods built with different privacy definitions in mind. This is particularly relevant for synthetic data generation: as we have presented in previous sections, a wide variety of SDG methods have been proposed, with widely different privacy definitions, choice of parameters, and assumptions. Despite the potential of adversarial approaches to evaluate privacy risks of synthetic data, the development of privacy attacks against SDG remains underexplored. We here review existing attacks, and suggest promising research areas. The main method to evaluate privacy risks in synthetic data was proposed by Stadler et al.~\cite{stadler2020synthetic} in a recent paper. They propose a general methodology to apply membership and attribute inference attacks on \textit{any} synthetic data generation model. They assume black-box access to the SDG method, and specifically, being able to retrain the SDG model on new data. Indeed, analysing the synthetic data alone (as in NNDR metrics) is, in general, not sufficient to properly understand information leakages: an algorithm sampling records uniformly at random might, by coincidence, replicate exactly some records from some private dataset, but this would not usually be considered a privacy violation. Further, this assumption is a key transparency requirement: in order to audit synthetic data, it is necessary to be able to understand how it was generated. Therefore, privacy guarantees cannot usually be obtained by maintaining secrecy of the generating algorithm. The method proposed by Stadler et al. uses \textit{shadow modelling}: the attacker simulates many runs of the SDG algorithm, using auxiliary data, to generate synthetic datasets trained with or without a target user. A binary classifier is then trained on features extracted from these synthetic datasets to predict whether the target user is in the training dataset. Empirical results suggest that current SDG methods either are vulnerable to this attack or, if the attack fails, lead to an accuracy worse than non-SDG methods for a range of data analysis tasks. Outside of this specific paper, there is a rich literature on privacy attacks that can be leveraged to develop attacks against synthetic data. We here detail two possible lines of research for this approach: \begin{enumerate} \item Many synthetic data generation methods rely on Generative Adversarial Networks (see, e.g., \cite{pategan, dpganxie, gpate, timegan, decaf}). Researchers have demonstrated that such GANs can be vulnerable to white-box and black-box membership inference attacks~\cite{chen2020ganleaks, logan}. A key question is then: how can these attacks be ported to the setup where the attacker has access to \textit{data} generated by the model, rather than the model itself. \item Some methods built with specific use cases in mind can aim to closely replicate statistical properties of the training dataset, such as one-way marginals histograms or correlations. Many membership inference attacks have been proposed against aggregate statistics, from simple statistical tests~\cite{homer2008resolving,dwork2015robust} to advanced attacks based on shadow models~\cite{pyrgelis2017knock}. If the synthetic data accurately reproduces many aggregates from the original data, one can apply these attacks to the synthetic data to infer membership of specific records in the training dataset. This leads to an interesting question: how many statistics can be accurately reproduced from the original data, without enabling such attacks? \end{enumerate} These are only two prospective research directions for the adversarial evaluation of synthetic data, which is an open line of research. \subsection{Evaluating the Utility and Fidelity of Synthetic Datasets} \label{sec:utilfidel} The methods presented in this section generally focus on privacy as their primary design goal, most often through explicit guarantees such as differential privacy. In this section, we review approaches to evaluate the secondary goal of such datasets: their \textit{utility} and \textit{fidelity}. The utility of a private synthetic dataset is determined entirely by its application. Generating synthetic data to enable release of otherwise private data has almost as many use cases as there are machine learning problems -- any data-driven problem might be derived from sensitive data and the data controllers may wish to investigate which ML methods might address the problem. Below (\ref{sec:privutil}) we give example use-cases, and suggest how utility might be measured in such cases. Fidelity is less well-defined: it generally aims at evaluating how close the \textit{distribution} of the synthetic dataset is to that of the real data, the idea being that if the distributions match, the synthetic data can be used to perform any task as accurately as with the real data. We discuss this more general use case, and review works studying fidelity, in section~\ref{sec:privfid}. \subsubsection{Utility-driven evaluation} \label{sec:privutil} The key use-case for privately-generated synthetic data is to enable research and industry data analysis tasks without access to sensitive data. A particularly important application is the development of machine learning (ML) models to perform inference and classification tasks from data. In this setting, the goal is to determine the best model (or a selection of best contenders), and train it (choose its parameters) to perform a given task. In general, such a task will come with its own metric of performance (e.g. accuracy/AUROC in a classification task). There are broadly two directions of research aiming to evaluate the suitability of synthetic data for ML training: (1) evaluating the performance of models trained on synthetic data, and (2) evaluating whether the \textit{relative performances} of different models are similar on synthetic and real data. The first approach assumes that analysts will train a machine learning model on the synthetic data, and use this model directly on real, future data. In this situation, it is important that the accuracy of a model estimated with synthetic data reflects its accuracy on real data. For instance, Beaulieu et al. evaluate their synthetic data generation method by measuring the accuracy of classifiers trained on synthetic datasets on the real sensitive medical data used to generate the synthetic data~\cite{beaulieu2019privacy}. Patki et al. pushed this further, by distributing synthetic datasets and real datasets randomly to teams of data scientists, and evaluating whether teams working on real and synthetic datasets would arrive at approximately the same conclusions~\cite{patki_synthetic_2016}. Similar approaches were used by Tao et al.~\cite{tao2021benchmarking}, where a XGBoost classifier is trained on synthetic data and evaluated on real data for a range of different tabular datasets. Note that this approach makes some assumptions on the family of models that will be trained, since it is impossible to test \textit{all possible classes of models}, as well as all possible choices of hyper-parameters. When synthetic data is generated with a set of specific tasks in mind, custom metrics can also be developed that capture the accuracy on these specific tasks. For instance, in the NIST challenge\footnote{\url{https://www.nist.gov/ctl/pscr/open-innovation-prize-challenges/current-and-upcoming-prize-challenges/2020-differential}}, accuracy was measured by the error on the Gini coefficient of incomes and the gender pay gap in (real) demographic data with financial information, when estimated on synthetic data~\cite{Bowen_Snoke_2021}. The second approach studies whether, for a battery of models, their ranking in terms of accuracy would be the same when trained on synthetic or real data. This setup assumes that analysts use synthetic data to \textit{select} a model, which is then trained on a real dataset (for better real-world performances). Crucially, the goal is that model development on synthetic data reflects model development on real data -- when a comparison is made (e.g. between two choices of hyperparameters), it should mirror the comparison on the real data. The utility of the synthetic dataset is then given by how well the performance ranking of models on the synthetic data matches the ranking that would be determined by the real data. This is challenging to measure since, in theory, one would want to ensure that ``all possible methods'' are appropriately ranked, including those which have yet to be developed/discovered. One approach might be to approximate this by comparing a list of representative models~\cite{kddsra}. It might also make sense to expand the list of representative models by incorporating small variations of each model (i.e. by varying the hyperparameters involved). Efficiently computing this for a broad enough class of models would be key, which may require new insights to ensure the class is indeed sufficiently broad. An important thing to keep in mind when utilising synthetic data in this way is the variability of various models' performances, especially the variability with respect to the real vs.~synthetic data. In particular, if several synthetic datasets (each with decreasing privacy) are going to be used to narrow-down the best methodology, then the process needs to be aware of how the earlier (more private) synthetic datasets will typically create noisier rankings and so the notion of a method being statistically significantly better than another needs to be adjusted accordingly. \subsubsection{Fidelity-driven evaluation}\label{sec:privfid} A promise of synthetic data is that it ``looks like'' real data, and can thus be used for a variety of purposes. From a statistical perspective, the goal that the distribution $\hat{\mathbb pP}$ used to generate synthetic data is \textit{close to} the (unknown) real data distribution $\mathbb{P}$. Typically, evaluating fidelity in this way involves choosing a distance with which to compare distributions, then evaluating this distance empirically from samples of the real and synthetic datasets. A simple example is to focus on 1- and 2-way marginals of the data, which can be efficiently computed. The difference between these marginals can be estimated with a wide range of metrics: total variational distance~\cite{tao2021benchmarking}, correlations and Cramer's V~\cite{tao2021benchmarking}, or classical distances~\cite{Bowen_Snoke_2021}. These metrics aim to capture whether the synthetic data captures basic properties of the real data, such as histograms of individual attributes and relations between pairs of attributes. Estimating distributional distances in higher dimensions, capturing relations between several attributes at a time, is challenging. Researchers have proposed ad hoc metrics, such as comparing the density of the synthetic and empirical distributions over random subsets of $\mathcal{X}$~\cite{Bowen_Snoke_2021}. Another solution is the \textit{propensity score}~\cite{woo2009global,snoke2018general}, which captures the accuracy of a classifier trained to differentiate real from synthetic data points. Intuitively, if the classifier cannot distinguish the two, then the distribution of synthetic data points must be close to that of real data points (this is the basis of the original GAN framework \cite{gan}). In the context of generative networks (and specifically, GANs), researchers have proposed measures to evaluate the fidelity of synthetic samples. Sajjadi et al. proposed metrics of \textit{precision} (the quality of synthetic samples) and \textit{recall} (the diversity of synthetic samples), inspired by common failure modes of GANs~\cite{sajjadi2018assessing}. The key question that these metrics seek to answer is how do the empirical and synthetic distributions \textit{overlap}: precision (resp. recall) captures how much of the synthetic (resp. real) data falls within the support of real (resp. synthetic) data. Researchers have proposed extensions of these metrics to increase their robustness to outliers and make them easier to compute~\cite{naeem2020reliable} and account for the probability distribution rather than just the support~\cite{alaa2021faithful}. \section{Private Synthetic Data Generation} \label{sec:privsdg} Thus far, we have focused on privacy in a broader context than synthetic data. This is natural, because most privacy notions apply more generally. However, synthetic data has an additional property that most other (non-synthetic data) outputs do not have -- it resides in the space of the real data. That is, the synthetic data takes values from precisely the same space as the original data. This allows us to use synthetic data in the place of real data, and also to compare the similarity of the synthetic and real data directly. We begin by highlighting some key considerations for private synthetic data generation. \paragraph{The space of datasets can be very high-dimensional.} Differential privacy has been conventionally applied to settings in which the dimensionality of the output space is relatively small, such as count queries on rows, classification tasks, etc. Synthetic data generation, on the other hand, gives output in a very high-dimensional space, i.e. the space of datasets (perhaps of a fixed size, $N$). Releasing such a high-dimensional object is challenging under differential privacy because it leads to higher (worst-case) sensitivity of the generating function (i.e.~the algorithm mapping the input dataset to the output dataset). Because of this increased worst case sensitivity, accurately constructing a dataset under differential privacy (according to some notion of accuracy) is likely to require a large privacy budget. A dataset of 1 million records, each with only 20 features, results in a 20 million dimensional output. Not only is the sensitivity of such a function likely to be high, but even trying to analyse the sensitivity can be an incredibly difficult task. By instead aiming to create a {\em private generator}, one can alleviate some of the difficulties - the complexity of the generator should not need to scale with the number of rows, but instead only with the dimensionality of the data (e.g. the number of columns in tabular data). \paragraph{Privacy is a property of the Algorithm, {\em not} of the Data.} An important-to-note property of differential privacy that it is a notion that is concern with probabilistic properties of the generated outputs and not a single realisation/output of the generator. A single output of the generator is is neither private, nor non-private. In a non-synthetic data setting this may be more obvious. If you query the average age of individuals in a dataset, and are given the response `35', without being told how this was computed, you do not know (even with access to the original data) whether the number 35 was computed privately or not. The algorithm that computed this answer could simply be ``always answer 35, regardless of input data'' which clearly reveals no information. The point is there is nothing private or ``unprivate'' about the {\em number} 35. What {\em is} private (or non-private) is the algorithm that produces the number, or in the case of this report, that produced the synthetic dataset. Crucially, this means that, at least from the perspective of differential privacy, it is {\em meaningless} to talk about the privacy as a property of a concrete synthetic dataset. \paragraph{Private Data vs. Private Generator.} The most common approach to generating private synthetic data is to first train a {\em private generator} (e.g., \cite{pategan, dpganxie, dpganxinyang, privbayes, dpgm}) on the real data. This model is then directly sampled from to generate individual datapoints and thus build up an entire synthetic dataset. Due to the post-processing theorem \cite{dpbook}, if the procedure used to train the private generator is $\varepsilon$-differentially private ($\varepsilon$-DP), it can be used to generate arbitrarily many synthetic data records without affecting the privacy guarantees. In fact, the procedure to generate the synthetic dataset (of arbitrary size) is itself $\varepsilon$-DP, which guarantees that individual records in the real data are protected from attacks. However, training an $\varepsilon-$DP generator to then generate some fixed number of synthetic samples can lead to overly conservative privacy guarantees, and thus lower utility. Intuitively, DP restricts the amount of information extracted from the real dataset when computing the output (the generator or dataset). The generator acts as a bottleneck for information: any finite sample from a generator necessarily has less information from the original dataset, and thus typically results in lower utility. \paragraph{Outliers and Fairness.} Capturing outliers with private synthetic data is difficult. Outliers are precisely data points with {\em some} uniquely identifying features; this means that ``hiding them in the masses'' becomes impossible. In some scenarios, for example credit card fraud detection, detecting outliers is the goal. In such a setting, private synthetic data is unlikely to provide much utility, as the outliers will necessarily be suppressed by the need for privacy. Indeed, \cite{oprisanu2021measuring} posit that if outliers are to be captured, then an SDG method cannot attain both a high privacy and a high utility. This has a problematic implication for fairness: minority groups, like outliers, can often end up being under-represented in synthetic data~\cite{pereira2021analysis, ganev2021robin}. Indeed, there is a clear tension between fairness and privacy, with fairness requiring that there is a good utility, even for minority groups, and privacy hiding the contributions of individuals, and thus collectively hiding the contribution of a minority group. Indeed, \cite{cheng2021can} posit that current mechanisms are unable to simultaneously achieve privacy, fairness and utility. \subsection{Existing Methods and Technologies} \label{sec:privmodels} Much attention in the machine learning community is being given to the problem of {\em generative modelling}. The goal of generative modelling is to generate samples with similar statistical properties to the available training data. Generative models are a key ingredient in synthetic data generation, but crucially require additional thought beyond their basic capability to ``generate samples'' - the problem of generating samplings from a distribution given training data is under-specified, and can be satisfied by memorising the training data and regurgitating when asked. We defer discussion of generative modelling in general to section \ref{sec:generalgen}, but draw attention to existing {\em privacy-preserving} generative models here. As already noted in section \ref{sec:dp}, a key ingredient driving many of the deep learning based algorithms is DPSGD \cite{dpsgd} (differentially private stochastic gradient descent), which enables differentially private training of general neural network based architectures. Though not designed specifically for generative models, DPSGD can be applied to both GANs \cite{dpganxie, dpganxinyang, rcgan, dpgm}, and VAEs \cite{dpvae}. Other approaches leverage the popular PATE mechanism \cite{pate1}, which can be applied to black-box models to create a private predictor. This has been used to replace the discriminator in a GAN model with a private PATE model \cite{pategan}, and as a means of passing gradients from discriminator to generator \cite{gpate}. \cite{dpsyn} use a subsample-and-aggregate approach (similar to PATE) alongside differentially private expectation-maximisation (DP-EM) \cite{dpem}. \sloppy Other popular approaches involve representing the data in a simple, low-dimensional form, such as using a Bayesian network to represent the data generation process as a series of low-dimensional marginal distributions \cite{privbayes}, or leveraging the classical copula framework \cite{copula} to learn the generation process \cite{dpcopula}. The recent NIST competition\footnote{\url{https://www.nist.gov/ctl/pscr/open-innovation-prize-challenges/current-and-upcoming-prize-challenges/2020-differential}}, was won with an algorithm that learns all 2-way distributions (marginals) in a differentially private way, and then does post-processing to generate data from these (potentially inconsistent) marginals \cite{mckenna2021winning}. See also \cite{zhang2021privsyn} for similar ideas. \fussy As should be clear from the proceeding discussion, there are many ways to enforce privacy, even when using the same underlying algorithm (e.g. a GAN). The question of where and how to enforce privacy is very much open. Intuitively, one wants to apply privacy simultaneously: (i) as close as possible to the output (e.g. to the generator of a GAN rather than the discriminator); (ii) wherever the tightest analysis of the privacy can be done (with GANs, the discriminator is typically easier to analyse). With GANs, we see examples of privacy being applied to the discriminator \cite{pategan, dpganxie, dpganxinyang}, and to the generator \cite{gpate}. \subsection{Partially Synthetic Data} \label{sec:partsdg} For tabular data, where a user's data is a $n$-tuple of \textit{attributes} an alternative to the common flavour of SDG is \textit{partially synthetic data}. In partially synthetic data, the attributes of user records are divided into two categories: \textit{quasi-identifiers} and \textit{sensitive attributes} (formally $\mathcal{X} = \mathcal{X}_\text{quasi} \times \mathcal{X}_\text{sensitive}$). The quasi-identifiers are assumed to be non-sensitive and can be disclosed unchanged, while the sensitive attributes need to be protected. Partially synthetic data is obtained by first fitting a statistical model $f:\mathcal{X}_\text{quasi}\rightarrow\mathcal{X}_\text{sensitive}$ on the quasi-identifiers to predict the value of the sensitive attribute, then replacing the sensitive attributes of the data by values produced by the statistical model, a process known as multiple imputation~\cite{rubin1996multiple}. The synthetic data generated thus contains the quasi-identifiers of all real records. Researchers have proposed partially SDG models using decision trees, support vector machines, and random forests~\cite{reiter2005using,caiola2010random} (see the \textsf{synthpop} package~\cite{nowok2016synthpop}). Utility-wise, partially synthetic data have a clear advantage over \textit{fully} synthetic data, as they not require to estimate the full joint distribution $\mathbb{P}(\mathcal{X})$ but only the conditional distribution $\mathbb{P}(\mathcal{X}_\text{sensitive}|\mathcal{X}_\text{quasi})$. However, some reports suggest that the utility of such data in practice is not particularly appealing, and that they are probably best suited for preliminary data analyses~\cite{loong2013disclosure}, or when combined with restricted access to confidential data~\cite{abowd2001disclosure}. Privacy-wise, there is the issue that revealing quasi-identifiers might be considered sensitive in some contexts (and this approach is trivially vulnerable to membership inference attacks). Researchers have shown that current methods are vulnerable to record linkage attacks~\cite{drechsler2008accounting,reiter2009estimating}, where an attacker identifies which record belongs to a target user using the sensitive attributes. Partially synthetic data generation methods are generally heuristic methods, and do not satisfy guarantees of privacy. Label DP~\cite{chaudhuri2011sample} is an extension of differential privacy that fits this context well. \section{De-biased Synthetic Data Generation} \label{sec:debias} Machine learning models are known to inherit biases from their training data \cite{aisentencing, nlpgenderbias, buolamwini2018gender, amazonrecruit}. De-biasing trained models requires expert knowledge of the model \cite{eqop, kilbertus2017avoiding}, and also an understanding of the different notions of fairness that one may wish to achieve (e.g. fairness through unawareness, demographic parity, conditional fairness \cite{decaf}). An alternative approach that is being explored is to learn to de-bias the dataset itself, thus creating so-called {\em fair data}\cite{feldman2015certifying, kamiran2009classifying, zhang2016causal, calmon2017optimized}. This data de-biasing can be viewed as a sort of synthetic data generation, in which the synthetic data is the de-biased data. Some approaches take it a step further and explicitly model the problem of data de-biasing as a one of ``ground-up'' generation \cite{decaf, fairgan}. These approaches aim to learn a generative model that itself is fair. In \cite{decaf}, they explore several notions of fairness and, via causal modelling, identify strategies for generating data that satisfy the given notions. \subsection{Notions of Fairness} As we have seen, identifying a meaningful, interpretable notion of privacy is difficult, and the same is true for fairness. These are both complex ethical questions that the machine learning community must address sooner rather than later. Unlike privacy, however, obvious notions of fairness {\em do exist}, and are enforceable in a meaningful way\footnote{This contrasts with the fact that, with privacy, the notion of not wanting your data to affect the output {\em at all} is not achievable without simply ignoring your data completely.}. Each notion typically requires some notion of a set of {\em protected attributes}, along which fairness must be ensured (e.g. gender, race). {\bf Fairness Through Unawareness (FTU)} \cite{ftu1, decaf} requires that the protected attributes, and only the protected attributes, not be used by the predictor. This aligns with the idea that two equally qualified people deserve the same job opportunities, independent of race or gender \cite{decaf}. FTU, however, fails to take into account the effect that protected attributes might have on other unprotected attributes, such as an individual's race resulting in them not being afforded the same educational opportunities as an individual of a different race (and thus resulting in them appearing to be disparately qualified). \begin{definition}[Fairness Through Unawareness \cite{decaf}] A predictor $f: \mathcal{X} \to \mathcal{Y}$ is fair if and only if protected attributes $\mathcal{A} \subset \mathcal{X}$ are not explicitly used by $f$ to predict $Y \in \mathcal{Y}$. \end{definition} {\bf Demographic Parity (DPa)} \cite{dpar}, instead, requires that a predictors output's not be correlated with the protected attributes. Indeed, with FTU, an attribute that is correlated with the protected attributes can be used as input to a predictor and thus the predictor can indirectly be correlated with the protected attributes (despite not having direct access to them). DPa is a significantly stronger notion of fairness than FTU, which requires adjusting the distributions of {\em all} variables that are correlated with the protected attributes. \begin{definition}[Demographic Parity \cite{decaf}] A predictor $f: \mathcal{X} \to \mathcal{Y}$ is fair if and only if protected attributes $\mathcal{A} \subset \mathcal{X}$ are independent of the predictions. That is, given a random variable $X \in \mathcal{X}$, let $A \in \mathcal{A}$ be the components of $X$ that are protected. Then $f$ satisfies demographic parity if and only if $f(X)$ is independent of $A$. \end{definition} Under the graphical model approach used in \cite{decaf}, for example, DPa is ensured by deleting all edges that originate from a variable that has a protected attribute anywhere in its causal predecessors. Naturally, such an approach can significantly degrade performance, as many of these variables can be useful predictors of the target. A trade-off is present, in which some fairness may need to be sacrificed for performance, and vice-versa. \subsection{Limitations of Fair Synthetic Data Generation} Though one might hope that fair synthetic data would lead directly to fair predictors (which {\em is} the case with private synthetic data and private predictors), this is not the case. Of particular importance to note is the fact that a predictor's fairness is {\em with respect to} a distribution of the features. Indeed, a predictor that is trained on synthetic data may not longer be fair when moved to real data due to a shift in the distribution of the real features. This is partly the reason that \cite{decaf} take such an extreme approach in removing all contaminated features (rather than trying to only remove the influence of the protected attributes on contaminated unprotected ones). Moreover, a synthetic dataset's fairness is defined through a given predictor. Giving a more general definition for fair synthetic data, and determining whether or not predictors trained on such a synthetic dataset would be fair, are open problems. The hope that an organisation might make a single ``fair'' synthetic dataset for use across an organisation would require advancements in this space, requiring a shift in thinking from fair predictors to fair data. \subsection{Existing Methods} As noted above, fair synthetic data generation is a young field. While there is significant amounts of work on creating fair predictors (see e.g. \cite{mehrabi2021survey} for a recent survey), the work on synthetic data for fairness is more limited. \cite{decaf} take a causal, GAN-based approach, using several GAN networks, along with an assumed known causal graph to learn the generative process of the data. Armed with the causal graph, they then generate synthetic data by selectively dropping edges from the model depending on the notion of fairness being targeted. \cite{fairgan} use a more indirect approach to ensuring fairness. Again based on a GAN model, they instead opt to introduce an additional loss term that penalises disparity between protected attributes taking different values. This means that the learned model might still generate unfair data, but only if doing so results in an increase in the fidelity of the generated synthetic data. This trade-off is controlled by a hyperparameter than can be increased to more stringently ensure fairness. \subsection{Evaluating Utility and Fidelity} Much of the discussion found in Section \ref{sec:utilfidel} can be applied to fair synthetic data. An additional consideration will necessarily be whether or not the bias has been successfully removed, metrics for which can be found in \cite{decaf}. These typically involve a comparison between outputs of a predictor trained on the synthetic data when the input protected attributes are varied. \section{Data Augmentation} \label{sec:dataaug} Perhaps the most successful use case (so far) for synthetic data has been for data augmentation - using synthetic data to enlarge datasets with additional samples to use for training \cite{wong2016understanding, timeressemi, timesemi}. This is often referred to as semi-supervised learning. The intuition is that synthetic data can act as a regulariser, reducing variance in the learned downstream model \cite{timeressemi}. Fortunately, there are several good surveys for data augmentation, and so we defer the reader to those for a more thorough background: time-series data \cite{timeseriesreview}; image data \cite{imagereview}. Of note is the fact that synthetic data driven techniques are more important in domains with less structure (such as with generic tabluar data). In the image domain, there is significant structure that can be exploited to create additional data, such as small rotations, image-flipping, cropping, etc. This structure often does not have a parallel in generic tabular data. As such, augmentation methods driven by synthetic data generators are a promising approach to fill this gap. \subsection{The Basic Principle} The key idea driving the use of synthetic data for data augmentation is that of {\em generalisability}. The goal of a model is not just to perform well on its training data, but also on data that has not been seen before by the model \cite{deeplearnrev}. The hope with synthetic data is that one can take the available training data and learn a generative model, such as a GAN \cite{gansemisup}. This generative model will then be able to produce ``realistic'' samples of training data, and, {\em hopefully} these samples will be sufficiently different from the original training data so as to be useful additional data points for the training of the model. It is particularly important to stress that these samples need to be {\em sufficiently different} from the original data. If these samples are too similar, then they will provide no benefit over using the original data on its own for training. As is hopefully clear by now, this need for dissimilarity is a common theme with synthetic data. In the context of data augmentation, this need is less strict; with privacy and fairness, the dissimilarity is a question of ethics and a failure to satisfy it can have both moral and legal repercussions. With data augmentation, this is unlikely to be the case. \subsection{What methods are used?} Depending on the domain in question, a variety of models exist that can perform the task of data augmentation. For the most part, the only real requirement is a generative model that is tailored to the domain in question. In Section \ref{sec:generalgen}, we discuss different types of generative models in more detail. Due to the need for (some level of) dissimilarity, training a generative model and hoping for the best may not be sufficient, however. Instead, one may wish to impose restrictions that enable this dissimilarity. The authors in \cite{badgansemi} show that learning a perfect generator in a GAN leads to poor semi-supervised learning, but that a bad generator performs well, for example. This idea of dissimilarity is often referred to as a need for {\em diversity} in the generated samples. Metrics for measuring this exist, such as the score presented in \cite{alaa2021faithful}. \section{Generative Modelling - An Overview} \label{sec:generalgen} \begin{figure}[htp] \centering \includegraphics[width=0.7\textwidth]{images/models.pdf} \caption{Generative modelling taxonomy based on the maximum likelihood from \cite{goodfellow_nips_2017} } \label{fig:taxonomyGM} \end{figure} Though there is a wealth of {\em directed} work on synthetic data generation with a specific goal in mind (such as one of the ones discussed in sections \ref{sec:privacy}, \ref{sec:debias}, and \ref{sec:dataaug}), there is also a lot of work focused on generative modelling [for the sake of generative modelling]. The original GAN paper was introduced as a means to generate fake images, not because they wanted to create private, debiased, or even augmented image datasets, but because the task of generating realistic images was hard and the success was easy to evaluate even for non-experts in the field. To that end, there are several methodologies that exist that have yet to be applied to a specific problem. The remainder of this section is more technical than the rest of this manuscript. Those that wish may skip to Section \ref{sec:indmess} without any loss of flow. These methodologies could be taxonomised as in Figure \ref{fig:taxonomyGM}, as proposed by Goodfellow \cite{goodfellow_nips_2017}, focusing on generative models whose parameters are trained to maximise the likelihood of the original data. Such methods can be grouped into two main families, where the underlying density function is either explicitly or implicitly defined. Within explicit models reside statistical methods where new samples are extracted from the distribution arising from the model's definition, which, in turn, must strike a balance between the ability of the model to capture data complexity and to maintain computational tractability \citep{frey_does_1996, breiman2017classification, rasmussen_nite_1999, naivebayes}. Non-tractable density functions can be explicitly tackled through deterministic and stochastic approximations. Variational Auto-Encoders (VAEs) \citep{vae} define the loss functions as tractable lower bounds of the non-tractable log-likelihood densities. However, if these deterministic approximations are not carefully calibrated, the model may not converge to the target distribution and consequently generate inconsistent data. On the other hand, stochastic approximations are the basis of Markov chain approaches, where samples are repeatedly drawn after the application of a chosen transition operator. Deep Boltzmann Machines \citep{dbm} are the main representatives of this class, having all neural units composed of random variables, which simultaneously act as inputs and outputs of the closest layers. Such versatility results in difficulties with training, and thus it is preferable to consider the networks as composed of Restricted Boltzmann Machines (RBMs) \citep{rbm}, consisting of only one visible and one latent layer. In a two-pass learning process, RBMs are progressively trained and then globally fine-tuned. Gibbs-sampling is then used to extract synthetic values. A completely different direction is taken by implicit generative models, which can be thought of as “black-boxes”, where distributions are not explicitly defined but indirectly revealed through sampling. A first example is Generative Stochastic Networks (GSNs), based on Markov chains. In these networks, the distribution is estimated indirectly, employing a parametric transition operator instead of a parametric model. Nonetheless, they are subject to scalability issues, being not efficiently applicable to high-dimensional scenarios. Generative Adversarial Networks (GANs) \citep{gan} were designed to be jointly parallel and multi-modal (i.e. capable of simultaneously generating multiple valid outputs for the same input). GANs consist of two networks: the generator and the discriminator. These two networks are trained {\em adversarially}. The generator creates artificial outputs that are passed to the discriminator along with real data. The discriminator is then tasked with identifying which outputs were real, and which were `fake'. The final goal here is to reach equilibrium, in which the generated samples follow the same distribution as the real data. When this happens, the discriminator can do no better than random guessing. Theoretically, GAN generators can perfectly imitate the original distribution provided that the network is sufficiently complex enough and the discriminator is optimal \citep{gan}. In practive, however, training a standard GAN discriminator to optimality can cause convergence issues and zero-gradients for the generator. Attempts to increase model stability include feature matching, label smoothing, and mini-batch discrimination \citep{salimans_improved_2016}. Alternatives to the Jensen-Shannon divergence (JSD) (that is implicitly used by standard GANs) have been investigated, such as the Wasserstein distance in WGAN \cite{arjovsky_wasserstein_2017}, and the Maximum Mean Discrepancy in MMD-GAN \cite{mmdgan, demmd}. A generalisation of the JSD to f-divergences has also been explored \citep{nowozin_f-gan_2016}. Unfortunately, no method has proven to be a clear winner \citep{lucic_are_2018}. A further risk of GANs lies in mode-collapse, when the generator memorises only a subset of the training information, hence failing to capture the high-level characteristics of the distribution. To tackle this issue, new architectures have been proposed, such as Conditional GANs (CGANs) \citep{cgan}, where additional classification information is provided to both generator and discriminator networks as a form of semi-supervised learning, Deep Convolutional GANs (DCGANs) \cite{dcgan}, where convolutional layers substitute pooling layers and Information maximising GANs (InfoGANs) \citep{chen_infogan_2016} that takes an information-theoretic approach to controlling the generation process. Generative Moment Matching Networks (MMNs) \citep{mmn} constitute another emerging cluster of implicit models, replacing GANs' discriminators with two-sample tests based on kernel maximum mean discrepancy to measure the distance between modelled and target distributions. Although MMNs offer theoretical guarantees, they are currently outperformed by GANs. Research on generative models is exploding, both in the evolution of existing models as well as in the introduction of new ones. GAN models are the most popular approach, but their implicit nature necessitates the development of trust through the definition and application of rigorous methodologies and metrics, so far demonstrated to be a difficult task. \begin{sidewaysfigure}[htp] \centering{\includegraphics[width=\textwidth]{images/datatypes.pdf}} \caption{Generative models for specific data types.} \label{fig:data_types} \end{sidewaysfigure} \subsection{Existing Methodologies} The discussion above focused on generative models in the most general sense, without any consideration for the {\em type} of data the model needs to generate. Much work in generative modelling has focused on the image domain with GANs, for example, being originally proposed as an image generation framework. Since their inception, however, many works have looked to generalise GANs to other domains. Below we overview some of the leading generative models that exist for a variety of different data types. Figure \ref{fig:data_types} gives an overview of the taxonomy. \subsubsection{Tabular data} Tabular data consists of values stored in rows and columns, whose synthesis requires the simultaneous modelling of distinct column distributions, as well as row-wise and table-wise constraints. Receiving less attention than image data in the generative domain, tabular data generation still has many obstacles to overcome. Initial generators relied on classifiers, as in the case of inverted decision-trees, vector machines and random forests, which struggle to strike a balance between classifier’s accuracy and the risk of leaking information \citep{caiola_random_2010, drechsler_using_2010, eno_generating_2008}. On the other hand, the application of GANs required the conversion of categorical, discrete columns to a continuous form using auto-encoders or through the decomposition in a variable number of Gaussian modes \citep{choi_generating_2018, xu_modeling_2019, zhao_ctab-gan_2021}. Nonetheless, the independent generation of column values might result in invalid rows, whose semantic correctness requires either the training of additional classifiers \citep{park_data_2018, xu_synthesizing_2018} or techniques based on Gaussian Copulae \citep{patki_synthetic_2016} and Bayesian networks \citep{abowd_how_2008, ping_datasynthesizer_2017,privbayes,gogoshin_synthetic_2020}. \subsubsection{Time-series data} Time-series are series of data points indexed in time order (e.g. electronic health record data containing information about visits to a GP, or higher frequency financial data, such as stock prices). Historically, they were generated via auto-regressive models \citep{tsay_analysis_2002}, hardly applicable to practical scenarios where stationarity only holds in specific time regions and in the presence of skewed and heavy-tailed distributions. Conversely, most implicit models focused on conditional distributions of future events given the occurrence of past ones, instead of capturing the full joint-law \citep{rcgan, timegan, fu_time_2019, wiese_quant_2019}. Recent developments allow training effort to be optimised by exploiting a reduced feature space, where the data stream is identified by its signature, resulting in a graded sequence of statistics \citep{ni_conditional_2020}. \subsubsection{Images} Applications of image synthesis are extremely diverse, ranging from the reconstruction of a damaged or missing region to the improvement of resolution and colour reproduction. The creation of an image consists in choosing a specific colour for each pixel, as the result of an image-to-image transformation or a text-to-image conversion. Variational Auto-Encoders were somewhat successful \citep{gregor_draw_2015, mansimov_generating_2016}, however, they featured a pixel-wise loss and simple conditioning, as in the case of class labels and image captions. On the contrary, GANs employ a semantic loss which is more aligned with the human visual system as well as being better suited to highly multi-modal outputs, where several valid images could be created \citep{renault_deep_2019}. Starting from vanilla GANs \citep{gan}, different architectures were proposed to generate plausible images in various datasets, as in the case of human faces \citep{karras_progressive_2018, huang_beyond_2017, brock_neural_2017, li_generative_2017, antipov_face_2017, zhang_age_2017, bin_high-quality_2017}, high-resolution photographs \citep{ledig_photo-realistic_2017, zhang_image_2019, brock_large_2019} and multi-domain images \citep{taigman_unsupervised_2016, liu_coupled_2016}. In text-to-image scenarios, the generation process starts from a brief text description, which is used as additional training information \citep{reed_generative_2016,reed_learning_2016} with the eventual aid of stacked architectures \citep{zhang_stackgan_2017,sharma_chatpainter_2018,zhang_photographic_2018} and attentive, semantic frameworks \citep{xu_attngan_2017,qiao_mirrorgan_2019,hong_inferring_2018} to preserve sentence-level consistency. \subsubsection{Audio} Similar to the generation of time-series, audio signals have a high temporal resolution, requiring representation and synthesis strategies capable of operating efficiently with a large number of dimensions. A significant attempt was the design of WaveNets \citep{oord_wavenet_2016}, arising from the architecture of PixelRNN \citep{oord_pixel_2016} borrowed from the image domain, further evolved by considering the speed difference between the raw audio and the hidden semantic-signal, which is usually many times slower \citep{mehri_samplernn_2017, sotelo_char2wav_2017}. A different approach consisted in the use of spectrograms, i.e. the simultaneous representations of audio signals in time and frequency, which requires lossy assumptions to cope with their non-invertible nature, inevitably reducing the overall quality \citep{shen_natural_2018, donahue_adversarial_2019}. \subsubsection{Video} The synthesis of a video can be considered as the generation of a sequence of images, where the main challenge stems from their inter-dependency and hidden temporal dimension. Unconditional video generation tried to maintain scene and foreground consistencies by separately focusing on objects' motion and RGB frame generation \cite{vondrick_generating_2016, ohnishi_hierarchical_2017, tulyakov_mocogan_2017, saito_temporal_2017}. Conversely, conditional approaches required smaller training datasets and allowed for finer control of modes of distributions, as in the case of audio conditioning for synchronising speech with a talking character \citep{vougioukas_end--end_2018, zhou_talking_2019, mittal_animating_2019}, text conditioning for video generation \citep{pan_create_2018, balaji_conditional_2019, li_storygan_2019}, image conditioning for the prediction of future frames \citep{mathieu_deep_2016, lee_stochastic_2018, villegas_decomposing_2018,walker_pose_2017,liang_dual_2017} and video-to-video for object animation \citep{bansal_recycle-gan_2018,chan_everybody_2019,kim_deep_2018,siarohin_animating_2019}. \section{Messages from Industry/Start-ups} \label{sec:indmess} In preparation of this report, the authors interviewed several industry partners and start-ups in the space of synthetic data. In this section we highlight some of the key themes and messages that we received in response to our questions. {\bf AI itself is in the early stages of mass adoption.} Though serious AI research has been ongoing for a long time now, widespread adoption of AI systems is in its infancy. Synthetic data is a younger field than the classical AI/ML problems of prediction, clustering, forecasting, etc. and significant research is required to fully benefit from this technology. That said, there is pressure for the adoption of private synthetic data (more than for other technologies) due to a heightening desire from the public for more privacy control. {\bf Empirical evaluations are necessary.} Though differential privacy is an attractive theoretical notion of privacy, industries struggle to trust it without empirical supporting evidence of privacy. Understanding practical implications of differential privacy (i.e. its susceptibility to attacks, what the parameters actually correspond to) is crucial to enable widespread adoption of private synthetic data. {\bf Synthetic data cannot wholly replace real data, or can it?} Opinions were more divided on this subject. The impossibility result of Ullman et al. \cite{ullman2011pcps} is a blow against the notion of a completely general-use synthetic dataset. The relaxed result of \cite{boedihardjo2021covariance}, however, indicates it might still be possible in many cases. Several in industry believe that real data should remain at the core of model development, with the final models ultimately being tweaked or even completely re-trained on the real data. Others believe that it will be possible to completely replace real data with synthetic data in the future. {\bf Synthetic data is about enabling.} The final takeaway is that synthetic data is about enabling processes that would otherwise not be possible, or that perhaps would drain a lot of resources (such as time). Synthetic data could be used to ``access'' data across legislative borders (e.g. in companies with an international presence), or to speed up model development times by allowing model designers access to {\em something} as early as possible. Ultimately, data is very powerful, and synthetic data may allow many more people to tap into its true potential. \section{Conclusion} Synthetic data is a promising technology, with a wide variety of applications. For both privacy and fairness, there is a large cost to getting it wrong. The methods that exist today should be implemented with caution, and significantly more research is needed, from a machine learning perspective, but also from a societal perspective, in order to understand properly the methods that exist. \section*{Acknowledgements} We would like to thank Accenture, Hazy, HSBC, MOSTLY AI, and the Office for National Statistics for their participation in our interviews. \bibliographystyle{unsrtnat}
\section{Introduction} The local solutions represent a test bench for any gravity theory and have drawn the attention of physicists for over a hundred years. Exact vacuum solutions of General Relativity (GR) are well known, while in the non-vacuum case we can reproduce a wide class of different metrics with interesting features. See for instance the case of regular black holes \cite{Hayward} and the case of wormholes \cite{Morris:1988cz, Damour}. Other results can be obtained in alternative theories of GR: for example, one may consider the presence of new fields in the underlying theory \cite{Motohashi:2018wdq, Filippini:2017kov} or modify the gravitational Lagrangian as in $F(R)$-gravity or in other modified theories of gravity \cite{Calza:2018ohl,Kalita:2021hyt,Lobo:2011fr,Ghosh:2021msy,Oliveira:2011vu,Bahamonde:2021srr,Kehagias:2014sda}. In those cases, finding analytical exact solutions appears as a formidable task since the equations of motion are more complex with respect to GR ones. For this reason the numerical approach has also been pursued \cite{Sullivan:2019vyi}. The conformal anomaly \cite{Duff}, or trace anomaly (TA), is a quantum level anomaly breaking a conformal symmetry of the classical theory. It plays an important role in quantum field theories in curved space-time, and it is object of various studies since many decades \cite{Capper:1974ic, Duff:1977ay, BrownLowell, BrownLowell2, Fradkin:1983tg, OdiSha, Antoniadis:1992xu, Antoniadis:1992ep, Bastianelli:1992ct} (see also the recent works \cite{Ferrara:2020zef, Duff:2020dqb}). For example, the accelerated expansion in the early universe, i.e., inflation \cite{Guth, Sato}, can be realized by quantum effects of conformally invariant fields \cite{in1, in2, in3}, and various astrophysical and cosmological applications exist related to the quasi thermal emission of black-holes \cite{Christensen:1977jc} and the cosmological constant problem \cite{Robinson:2005pd,Iso:2006wa}. The trace anomaly also plays a role in string theory and statistical mechanics. In an homogeneous and isotropic universe, the trace anomaly totally determines its energy-momentum tensor. For example, some relevant results have been found by implementing conformal anomaly in different inflationary models \cite{FRW1, FRW2, FRW3, FRW4, FRW5, FRW6, FRW7}. However, in four dimensional spherically symmetric static (SSS) space-time, the trace anomaly energy-momentum tensor is known up to an arbitrary function of position \cite{Cai1} and usually we can consider only perturbative solutions around the background Einstein's equations. An analytical SSS black hole (BH) solution has been found in Refs. \cite{Cai1}, where the so-called ``Type A'' anomaly has been studied up to one loop quantum corrections, and the logarithmic correction to the black-holes entropy has been computed. Moreover, in Ref. \cite{Cai2}, a second BH solution has been derived in Anti-De Sitter (AdS) space-time by considering a negative cosmological constant contribution. In this paper, similarly to the seminal works of Cai {\textit{et al.}} in \cite{Cai1, Cai2}, we analyze pseudo-spherically symmetric static (SSS) solutions of GR in presence of trace anomaly. We will maintain the focus on SSS space-time in presence of one loop trace anomaly and we enlarge the discussion for generic topological case. We reconsider BH solutions in vacuum and non vacuum case and we derive for wormhole (WH) solutions, both of Type-A case and not. We propose two new solutions, showing that traversable wormholes can be reproduced by considering quantum effects without the presence exotic matter. The paper is organized as follows. In Sec. {\bf 2} we introduce the equations of motion of GR with trace anomaly on topological SSS space-time. In Sec. {\bf 3} we reconsider BH solutions in vacuum and non-vacuum cases. Sec. {\bf 4} is devoted to WH metrics, here we derive and discuss two new solutions. Conclusions and final remarks are given in Sec. {\bf 5}. In our convention, the speed of light $c = 1$ and the Planck mass $1/8\pi G_N = 1$. We also adopt the "mostly plus" metric convention. \section{Trace anomaly} The trace anomaly is a quantum effect at early universe, when we consider the contribute of (mass-less) matter fields. In the Standard Model of particle physics, almost a hundred among mass-less scalar fields, Dirac spinors and vectors are considered, and this number may be doubled if the Standard Model is embedded in a supersymmetric theory. Moreover, the number of scalar fields may skyrocket up to $10^5$ if one considers axion-like particles coming from string compactification \cite{Arvanitaki:2009fg, March-Russell:2021zfq, Calza:2021czr}. Fields action in curved space-time is conformal invariant, but a renormalization must be introduced in order to cancel the divergences from the one-loop vacuum contributions. As a consequence, the counter-terms necessary to avoid the poles of the divergences break the conformal invariance of the matter action itself. From a classical point of view, the trace of the energy momentum tensor in a conformally invariant theory vanishes, but after the renormalization procedure we get a non-zero trace of an anomalous energy momentum tensor, what is called quantum anomaly or trace anomaly \cite{an1, an2, an3, an4}. If we include the backreaction of the quantum fields to a curved space-time geometry in the field equations of GR we obtain \begin{equation} R_{\mu\nu} -\frac{1}{2}R g_{\mu\nu}=\left<T_{\mu\nu}\right>\,, \label{feq} \end{equation} where: $R_{\mu\nu}$ and $R$ are the Ricci tensor and scalar, respectively; $g_{\mu\nu}$ is the metric and $\left<T_{\mu\nu}\right>$ is an effective energy-momentum tensor by quantum loops and must be covariantly conserved, namely it obeys the continuity equation $\nabla^\mu T_{\mu\nu}=0$. In general it is almost impossible to derive the correct expression of such a tensor for a generic space-time, and some assumptions on the background must be considered. On the other hand, in four dimension, the trace anomaly has the following form, \begin{equation} <T>=\lambda C^2-\alpha G\,,\label{traceanomaly} \end{equation} where: $T=g^{\mu\nu}T_{\mu\nu}$ is the trace of the energy-momentum tensor; $\lambda$ and $\alpha$ are two positive constants depending on the degrees of freedom of quantum fields. The scalars $G$ and $C^2$ are the Gauss-Bonnet four dimensional topological invariant and the square of the Weyl tensor, namely \begin{equation} G=R^2-4 R_{\mu\nu}R^{\mu\nu} + R_{\mu\nu\sigma\xi}R^{\mu\nu\sigma\xi}\,, \quad C^2\equiv C_{\mu\nu\sigma\xi}C^{\mu\nu\sigma\xi}=\frac{R^2}{3}-2 R_{\mu\nu}R^{\mu\nu} + R_{\mu\nu\sigma\xi}R^{\mu\nu\sigma\xi}\,, \end{equation} where $R_{\mu\nu\sigma\xi}$ is the Riemann tensor, and correspond to the so called ``Type A'' and ``Type B'' anomaly, respectively \cite{type}. We are interested in the (pseudo-)spherically symmetric static metrics \begin{equation} ds^2=-f(r)dt^2+\frac{1}{g(r)} dr^2+r^2\,\left(\frac{d\rho^2}{1-k\rho^2}+\rho^2 d\phi^2\right) \,,\label{metric} \end{equation} where $f\equiv f(r)$ and $g\equiv g(r)$ are functions of the radial coordinate $r$ only, and the manifold topology will be either a sphere, a torus or a compact hyperbolic manifold, according to whether $k=1,0,-1$, respectively. Thus, the Gauss-Bonnet reads, \begin{equation} G= \frac{-2 k f f' g'+2g\left(-2kf f'' +3f f' g' +kf'^2\right)-2g^2\left(f'^2-2f f''\right)}{r^2f^2}\,, \label{G} \end{equation} while the squared Weyl tensor assumes the form, \begin{equation} C^2=\frac{1}{12}\left\lbrace\frac{r^2 g f'^2 + 2 f^2(2k-2g+rg')-rf[rf'g'-2g(f'-rf'')]}{f^2 r^2}\right\rbrace^2\,. \end{equation} In the equations above the prime index denotes the derivative with respect to the radial coordinate $r$. The symmetry of the metric brings to the identification \begin{equation} T_0^0=-\rho\,, \quad T_1^1=p\,,\quad T_2^2=T_3^3=p_\perp\,, \end{equation} where $\rho$ and $p$ are the effective energy density and radial pressure of trace anomaly, while $p_\perp$ is its effective transversal pressure. The first two field equations in \eqref{feq}, with the metric \eqref{metric}, read \cite{Chinaglia} \begin{align} \frac{d}{dr}\left[r(k-g)\right]&=8\pi r^2\rho\,, \label{00}\\ \frac{g}{f r}f'+\frac{(g-k)}{r^2}&=8\pi p\,. \label{11} \end{align} The above equations with the conservation law read \begin{equation} 4f(p-p_\perp)+(\rho+p)r f'+2r p' f=0\,, \label{conslaw} \end{equation} and considering the constraint in (\ref{traceanomaly}) we obtain \begin{equation} -\rho+p+2p_\perp=\lambda C^2 -\alpha G\,, \label{trace} \end{equation} which can be rewritten as \begin{equation} 2r f p'+r f'(\rho+p) +2f(3p-\rho)= 2(\lambda C^2-\alpha G)f\,. \label{last} \end{equation} In principle, given an Equation of State (EoS) $p=p(\rho)$, we get a system of differential equation (\ref{00}), (\ref{11}) and (\ref{last}) with respect to the quantities $p\,,f\,,g$, while $p_\perp$ follows from (\ref{trace}). In the next sections we solve this differential equations system with some metric Ansatz. Firstly, we revisit the black hole case firstly introduced in \cite{Cai1, Cai2}, and then we analyze wormhole solutions. \section{Black hole solutions} Following \cite{Cai1}, as a test of the procedure, we firstly consider black hole solutions in the presence of Type A anomaly only, when $\lambda=0$ and the contribution of the squared Weyl tensor disappears. The metric (\ref{metric}) may describe a black hole whose horizon is located at the zeros of the metric functions $g(r)$ and $f(r)$, simultaneously. Since the conditions $g(r)=0$ and $f(r)=0$ must be satisfied for the same value of $r=r_H$, a direct consequence of the field equations (\ref{00})--(\ref{11}) is that $p=-\rho$ on the BH horizon $r_H$. By generalizing this condition to the whole space-time, we can rewrite (\ref{last}) as \begin{equation} 4p+r p'=-\alpha G\,. \end{equation} Moreover, with the EoS $p=-\rho$ we are forced to put $f(r)=g(r)$ in order to solve (\ref{00}) and (\ref{11}) together. We obtain \begin{equation} p=\frac{2\alpha g(r)^2-4k\alpha g(r)+4r\alpha(k-g)g'(r)}{r^4}-\frac{c_1}{r^4}\,, \label{rad0} \end{equation} where $c_1$ is an integration constant and we used (\ref{G}). The field equations (\ref{00})--(\ref{11}) finally lead to \begin{equation} g(r)=k-\frac{r^2}{32\pi\alpha} \pm\frac{r^2}{32\pi\alpha} \sqrt{1+\frac{512\pi^2\alpha}{r^4}( 2 k^2 \alpha+c_1)-\frac{c_0}{r^3}}\,, \label{Cai0} \end{equation} where $c_0$ is a constant. The form of the effective transversal pressure $p_\perp$ can be easily computed by (\ref{trace}) \begin{equation} p_\perp=\frac{c_1 - \left( 2 \alpha g(r) (-2 k +g(r)-2 r g'(r) + r^2 g''(r)) + g'(r)(4 k r \alpha +2 \alpha r^2 g'(r)) -2 k r^2 \alpha g''(r) \right)}{r^4} \,. \end{equation} The solution (\ref{Cai0}) is the topological generalization of the one found in \cite{Cai1} for $k=1$. We have two branches, corresponding to the signs ``$\pm$'' in (\ref{Cai0}). For the branch with plus sign in the spherical case $k=1$, we obtain the Reissner-Nordstr{\"o}m solution for large values of $r$, namely \begin{equation} g(r)\simeq 1-\frac{c_0}{64\pi \alpha r} +\frac{8\pi}{r^2}(2 \alpha+c_1)\,. \end{equation} If $c_0>0$ the solution describes a static black hole. Thus, $c_0$ corresponds to the mass of the BH yielding to logarithmic corrections to the standard area law of the entropy \cite{Cai1}. On the other hand, by choosing the minus sign in (\ref{Cai0}), for large values of $r$ we have \begin{equation} g(r)\simeq k-\frac{c_0}{64\pi \alpha r} +\frac{8\pi}{r^2}(2k^2\alpha+c_1)-\frac{r^2}{16\pi\alpha}\,, \end{equation} i.e., an asymptotically De Sitter space-time. The metric describes a BH with various topologies and $c_0>0$. In particular, we observe that for the flat and hyperbolic cases with $k=0, -1$, an event horizon appears as soon as $(2k^2\alpha+c_1)>0$ (for quasi topological Reissner Nordstr{\"o}m solution see also \cite{Mann}). \\ \\ In principle, some other analytical BH solutions with $p=-\rho$ (and therefore $f(r)=g(r)$) can also be found by considering the full contribution from the trace-anomaly, but in general we have to introduce a constraint on the parameters $\alpha$ and $\lambda$. This procedure seems unnatural, since $\alpha$ and $\lambda$ depend on the degrees of freedom of quantum fields. As an example, we consider the topological Schwarzschild dS/AdS solution \begin{equation} f(r)=g(r)=k-\frac{c_0}{r}+{c_1}{r^2}\,, \end{equation} where $c_{0,1}$ are constants. In order to obtain $g_{00}>0$ when $r\rightarrow 0^+$, we assume $c_0>0$. In the spherical topological case, both a cosmological horizon and an event horizon appear. On the other hand, if $k=0, -1$, we need an asymptotically AdS space-time with $c_1>0$ and in this case an event horizon should be present. Since \begin{equation} p=-\rho=\frac{c_1}{8\pi }\,,\quad p_\perp=0\,, \end{equation} it turns out that (\ref{last}) is satisfied by making the choice, \begin{equation} \lambda = \alpha\,, \quad c_1=-\frac{1}{16 \pi \alpha}\,, \end{equation} or \begin{equation} \lambda = \alpha\,, \quad c_1= 0\,. \end{equation} Therefore the spherical case $k=1$ is the only relevant one. We note that $c_1$ is fixed by the model, such that $c_0$ can be correctly identified with the BH mass. \\ \\ To obtain BH solutions without constraints on $\alpha$ and $\lambda$, we may introduce additional fluid contributions to the field equations \cite{Saha}. In what follows, we will denote with the pedex ``$F$'' the contributions of the fluid and with the pedex ``$TA$'' the contribution of the trace anomaly. The effective energy density and pressure in (\ref{00})--(\ref{11}) and (\ref{conslaw}) are \begin{equation} \rho=\rho_{TA}+\rho_F\,,\quad p=p_{TA}+p_{F}\,, \quad p_\perp=p_{\perp TA}+p_{\perp F}\,, \end{equation} and (\ref{last}) is \begin{equation} 2r f p'+r f'(\rho+p) +2f(3p-\rho)= 2f(\lambda C^2-\alpha G)+2f(-\rho_F+p_F+2p_{\perp F})\,. \label{last2} \end{equation} Firstly, we recover the result of \cite{Cai2} by taking into account the contribution of a cosmological constant, namely \begin{equation} \rho_F=\Lambda\,,\quad p_F=p_{\perp F} =-\Lambda\,, \end{equation} where $\Lambda$ is a constant. In the presence of Type A anomaly and by assuming $p=-\rho$ we find \begin{equation} f(r)=g(r)= k-\frac{r^2}{32\pi\alpha} \pm\frac{r^2}{32\pi\alpha}\sqrt{1+\frac{64 \pi \alpha \left(c_1+16 \pi \alpha k^2\right)}{r^4}+\frac{1024 \pi ^2 \alpha ^2 c_0}{r^3}-\frac{512}{3} \pi ^2 \alpha \Lambda}\,, \end{equation} where $c_{0,1}$ are constants. This is the topological generalization of the BH solution found in \cite{Cai2}, where various aspects of the metric are discussed. Moreover, many BH solutions can be reconstructed by assuming different fluid contributions. We consider the case of a perfect fluid in the presence of the full contribution of the trace anomaly ($\alpha, \lambda\neq 0$). The stress energy tensor of a perfect fluid is given by \begin{equation} T^\mu_{\nu F} =diag (-\rho_F, p_F, p_F, p_F)\,, \end{equation} namely $p_{\perp F}=p_F$. The barotropic Equation of State reads \begin{equation} p_F=\omega \rho_F\,, \end{equation} with $\omega$ constant. If one looks for the topological Reisner-N{\"o}rdstrom solution \begin{equation} f(r)=g(r)=k-\frac{c_0}{r}+\frac{c_1}{r^2}\,, \end{equation} with $c_0\,,c_1$ constants, we find for the effective energy density and pressure \begin{equation} \rho= \frac{c_1}{8\pi r^4}\,,\quad p=- \frac{c_1}{8\pi r^4}\,, \end{equation} and (\ref{last2}) states that we need a perfect fluid with $\omega\neq 1/3$ (non trace-less fluid). On shell we get \begin{equation} \rho_F=\frac{8 c_1^2 (5\alpha-6\lambda)-48 c_0 c_1 r(\alpha-\lambda)+12c_0^2 r^2(\alpha-\lambda)}{r^8(3\omega-1)}\,. \end{equation} In the next section, we investigate wormhole vacuum solutions in the presence of the quantum anomaly. \section{Wormhole solutions} In this section, we study some wormhole solutions. The traversable wormholes are realized in the framework of GR only in the presence of a matter sources violating the null energy condition \cite{WH,WH2,WH3,WH4,WH5,WH6,WH7,WH8,WH9,WH10,WH11}. In modified gravity such a kind of solutions can be obtained also in vacuum since the role of the anti-gravitational matter can be played by the modification of gravity itself \cite{Calza:2018ohl,WHMG,WHM3,WHMG4,WHMG2}. In this paper we work in the GR framework and we aim to identify the trace anomaly as the source of the negative pressure fluid violating the null energy condition. In such a way, the trace anomaly prevents the wormhole throat to pinch off. For our purpose we replace the metric function $f(r)$ in (\ref{metric}) with \begin{equation} f(r)=\text{e}^{2\Phi(r)}\,, \end{equation} where $\Phi\equiv\Phi(r)$ is a new redshift metric function, such that the resulting line element reads \begin{equation} ds^2=-\text{e}^{2\Phi(r)}dt^2+\frac{1}{g(r)} dr^2+r^2\,\left(\frac{d\rho^2}{1-k\rho^2}+\rho^2 d\phi^2\right) \,.\label{metric2} \end{equation} A traversable wormhole occurs if the radial coordinate is embedded by a minimal radius at $r=r_0$, the so-called ``throat'', and no horizons appear. In particular, the function $\Phi(r)$ must be finite and regular everywhere along the throat and the following conditions must be satisfied \cite{WHcond,WHcond2,WHcond3}: \begin{itemize} \item $\Phi_\pm(r)$ and $g_\pm(r)$ are well defined smooth functions for all $r \geq r_0$; \item $\Phi'_+(r_0)=\Phi'_-(r_0)$; \item $g_\pm(r_0)=0$ and $g_\pm(r)>0$ for all $ r \geq r_0$; \item $g'_+(r_0)=g'_-(r_0)>0$. \end{itemize} Since the proper distance is defined as \begin{equation} l(r)=\pm\int ^r_{r_0}\frac{d\tilde r}{g(\tilde r)} \,, \end{equation} its minimal value is reached for $r=r_0$, while the positive and negative values of $l\equiv l(r)$ correspond to the lower and upper universes connected through the throat of the wormhole. The travelling time necessary to cross the wormhole between $l(r_1)=-l_1<0$ and $l(r_2)=+l_2>0$ is given by, \begin{equation} \Delta t=\int_{l_1}^{l_2} \frac{d l}{v \text{e}^{\Phi(l)}} \,, \end{equation} where $v=d l/[\text{e}^{\Phi(l)} dt]$ is the radial velocity of the traveler as he/she passes radius $r$ \cite{Morris:1988cz}. Thus, if $\Phi'(r)<0$ the repulsive tidal force makes impossible to travel across the throat. Firstly, we look for wormhole solutions with \begin{equation} \Phi(r)=0\,, \label{ex0} \end{equation} namely we consider a vanishing tidal force where the proper time measured by a static observer corresponds to the coordinate time $t$ (the result can be generalized to the case $\Phi(r)=\text{const}$). This choice greatly simplifies equation (\ref{last}) if we take into account the Type A anomaly ($\lambda=0$), since the Gauss-Bonnet term vanishes. By using (\ref{00}) and (\ref{11}) we obtain \begin{equation} g+r g' = k\,, \end{equation} whose solution is given by \begin{equation}\label{sol1} g(r)=k-\frac{c_0}{r}\,, \end{equation} where $c_0$ is an integration constant. The field equations (\ref{00})--(\ref{11}) lead to \begin{equation} \rho=0\,, \quad p=-\frac{c_0}{8\pi r^{3}}\,,\label{pWH0} \end{equation} and the metric finally reads \begin{equation} ds^2=-dt^2+\frac{1}{\left(k-\frac{c_0}{r}\right)} dr^2+r^2\,\left(\frac{d\rho^2}{1-k\rho^2}+\rho^2 d\phi^2\right) \,.\label{metric3} \end{equation} Note that the metric does not depend on the parameter $\alpha$. The trace anomaly supports the solution through an effective pressure, but on shell its trace contribution disappears. Wormhole solutions can be obtained for the spherical case with $k=1$ and $c_0>0$. In this case the radius of the throat corresponds to $r=c_0$. The Gauss-Bonnet (and therefore the Ricci scalar) vanishes, and the trace anomaly corresponds to a (trace-less) effective fluid with zero energy density and radial (negative) pressure (\ref{pWH0}). The transversal pressure can be derived from (\ref{trace}) and simply reads, \begin{equation} p_T=-\frac{p}{2}= \frac{c_0}{16\pi r^3}\,. \end{equation} Wormhole solutions require the violation of the Null Energy Condition (NEC) near the throat \cite{Visser:2003yf,Visser,Kanti:2011jz, Barcelo:2000zf}, which is usually written in terms of the stress-energy tensor as \begin{equation} T_{\mu\nu}n^\mu n^\nu \geq 0\,, \quad n_\mu n^\mu =-1\,, \end{equation} where $n^\mu$ is a null-vector and $T_{\mu \nu}= diag(\rho, p,p,p)$. Among the different energy conditions, the NEC is particularly interesting since it is the weakest: if violated, all the other energy conditions conditions are consequently violated\footnote{ The energy conditions read: \begin{itemize} \item Null Energy Condition (NEC) $\rho + p > 0$ ;\item Weak Energy Condition (WEC) $\rho + p > 0 $ , $\rho>0$; \item Dominant Energy Condition (DEC) $\rho> |p|$ ;\item Strong Energy Condition (SEC) $\rho + p>0$ , $\rho+ 3p >0$. \end{itemize}}. In our case the NEC is clearly violated as a consequence of (\ref{pWH0}). Thus, the conformal anomaly plays the role of an exotic fluid supporting the WH solution. Consider then the class of traversable WH-models with \begin{equation} \Phi(r)=\frac{1}{2}\log\left[\left(\frac{r}{r_0}\right)^z\right]\,,\quad z>0\,, \end{equation} where $z$ is a constant parameter. A choice which greatly simplifies the form of the Gauss-Bonnet and of the square of the Weyl tensor is given by $z=2$. In this case the metric has the form \begin{equation} ds^2=- r^2 dt^2+\frac{1}{g(r)} dr^2+r^2\,\left(\frac{d\rho^2}{1-k\rho^2}+\rho^2 d\phi^2\right) \,.\label{metric4} \end{equation} Equation (\ref{last}) leads to the solution \begin{equation} g(r)= \frac{k}{3}-\frac{r^2}{32\pi\alpha}\pm \frac{\sqrt{\xi(r)}}{96 \pi \alpha }\,, \label{gWH2} \end{equation} where \begin{equation} \xi(r)=1024 \pi ^2 \alpha ^2 \left(9 c_0+k^2\right)+2048 \pi ^2 \alpha k^2 \lambda \log (r)+9 r^4 \,,\label{gWH2bis} \end{equation} with $c_0$ constant. The solution has two branches, corresponding to the $\pm$ signs. The relevant case which reproduces a traversable wormhole corresponds to the plus sign. Thus, for large values of $r$ we get, \begin{equation} g(r)\simeq \frac{k}{3}\,, \end{equation} and the spherical case with $k=1$ preserves the metric signature. The throat is located at $r=r_0$, such that $g(r_0)=0$. In order to have $g'(r_0)>0$ we must require \begin{equation} \frac{2(3r_0^2+16\pi\lambda)}{r_0(9r_0^2-96\pi \alpha)}>0\,.\label{gprime} \end{equation} If we restrict the analysis to the Type A anomaly, we can find an analytical value for the radius of the throat. Since $g(r_0) = 0$ and therefore $\xi(r_0)= \left(3 r_0^2 -32 \pi \alpha \right)^2$ we get \begin{equation} c_0+\frac{r_0^2}{48 \pi \alpha }=0\,, \end{equation} whose solution is \begin{equation} r_0=4\sqrt{-3\pi\alpha c_0}\,. \label{lambda0} \end{equation} The condition $g'(r_0)>0$ simply reads $r_0>\sqrt{\frac{32}{3} \pi \alpha}$ implying \begin{equation} \quad c_0<-\frac{2}{9}\,. \label{Condc0} \end{equation} An implicit solution can be found also for the general case with $\lambda \neq 0$. Again, $\xi(r_0)= \left(3 r_0^2 -32 \pi \alpha \right)^2$ implying \begin{equation} c_0+\frac{r_0^2}{48 \pi \alpha }+\frac{2 \lambda \log (r_0)}{9 \alpha }=0\,. \end{equation} As a consequence, the radius of the throat is \begin{equation} r_0 = 4 \sqrt{\frac{\pi \lambda}{3} W\left[ \frac{3 }{16 \pi \lambda }e^{-\frac{9 \alpha c_0}{\lambda }}\right]} \,,\label{r0imp} \end{equation} where $W[x]$ is the is the principal solution of the (multi-valued special complex) Lambert function. If we restrict to real values the Lambert function is the inverse function of $x=W e^W $. In the limit $\lambda\rightarrow 0^+$ we obtain $ \sqrt{ \lambda W\left[ \frac{3 }{16 \pi \lambda }e^{-\frac{9 \alpha c_0}{\lambda }} \right]} = 3 \sqrt{-\alpha c_0}$ and the result in (\ref{lambda0}) is restored. The condition $g'(r_0)>0$ implies \begin{equation} \frac{\sqrt{\lambda } \left(W\left[\frac{3 e^{-\frac{9 \alpha c(0)}{\lambda }}}{16 \pi \lambda }\right]+1\right)}{2 \sqrt{3 \pi } \sqrt{W\left[\frac{3 e^{-\frac{9 \alpha c(0)}{\lambda }}}{16 \pi \lambda }\right]} \left(\lambda W\left[\frac{3 e^{-\frac{9 \alpha c(0)}{\lambda }}}{16 \pi \lambda }\right]-2 \alpha \right)}>0\,, \end{equation} which becomes (\ref{gprime}) by using (\ref{r0imp}). Taking into account that $\lambda>0$, both the numerator and $2 \sqrt{3 \pi } \sqrt{W\left[\frac{3 e^{-\frac{9 \alpha c(0)}{\lambda }}}{16 \pi \lambda }\right]}$ are positive quantities, such that the former inequality reduces to \begin{equation} \lambda W\left[\frac{3 e^{-\frac{9 \alpha c_0}{\lambda }}}{16 \pi \lambda }\right]>2 \alpha \,. \end{equation} Since $\alpha>0$ we obtain \begin{equation} c_0<-\frac{\lambda \log \left(\frac{32}{3} \pi \alpha e^{\frac{2 \alpha }{\lambda }}\right)}{9 \alpha }\,. \end{equation} Note that \begin{equation} \lim_{\lambda \rightarrow 0^+}{\left( -\frac{\lambda \log \left(\frac{32}{3} \pi \alpha e^{\frac{2 \alpha }{\lambda }}\right)}{9 \alpha } \right) }= -\frac{2}{9}\,, \end{equation} and we obtain the condition in (\ref{Condc0}). The explicit forms of $\rho\,,p$ and $p_\perp$ with $\alpha\,,\lambda\neq 0$ are derived as \begin{align} \rho &=\frac{1}{12 \pi r^2} +\frac{3}{256 \pi ^2 \alpha }-\frac{3 r^2}{128 \pi ^2 \alpha \sqrt{\xi(r)}}-\frac{\sqrt{\xi(r)}}{768 \pi ^2 \alpha r^2}-\frac{4 \lambda }{3 \sqrt{\xi(r)} r^2}\,,\nonumber\\ p&=\frac {1} {256 \pi^2 \alpha}\left(\frac { \sqrt{\xi(r)}} { r^2} -3\right)\,,\nonumber\\ p_\perp&=\frac{\alpha \left(12 c_0+\frac{4}{3}\right)}{\sqrt{\xi } r^2}+\frac{3 \left(\frac{3 r^2}{\sqrt{\xi }}-1\right)}{256 \pi ^2 \alpha }+\frac{4 \lambda (2 \log (r)+1)}{3 \sqrt{\xi } r^2}+\frac{1}{24 \pi r^2}\,. \end{align} The NEC on the throat reads \begin{equation} (\rho+p)\lvert_{r=r_0} = -\frac{16 \pi\lambda+3r_0^2}{4 \pi r_0^2 \left(9 r_0^2-96 \pi ^2 \alpha \right)}<0\,, \end{equation} which is clearly violated as a consequence of (\ref{gprime}). As a final remark about the choice of the minus sign in (\ref{gWH2})--(\ref{gWH2bis}), for large values of $r$ we obtain \begin{equation} g(r)\simeq \frac{k}{3}-\frac{2r^2}{32\pi\alpha}\,, \end{equation} with the appearance of a cosmological horizon when $k=1$. \section{Conclusions} In this paper, we studied exact analytic static pseudo-shperically symmetric solutions in semi-classical Einstein's equations in the presence of trace anomaly. These solutions are characterized by a fluid-like component which origins from trace anomaly. The solutions we analyzed are suitable to describe compact objects such as black holes and wormholes. The space of solutions is very large and provides a rich phenomenology. Nevertheless, finding exact solution is not a trivial task since it is not possible to reconstruct the exact form of effective stress-energy tensor associated to trace anomaly and some assumptions are necessary. This difficulty may lead future studies to consider numerical approaches to enlarge the space of solutions. Regarding black holes solutions, as previous studies already shown \cite{Cai1, Cai2}, the metric is in general different from Schwarzschild. This calls for a comparison with the Solar System tests, applying the Post Newtonian Parameters formalism in order to constrain the parameter space. Gravitational waves from black hole mergers may provide additional information and help to further constrain the space of parameters. In the case of Type A anomaly (namely $\lambda=0$) we generalized the solution in \cite{Cai1} to hyperbolic and flat topological cases. This solution do not pose any constraint on $\alpha$ which can be determined by the underlying theory of particle physics, and in the limit of large $r$ in the case $k = 1$ the solution reduces to the Reissner-N\"{o}rdstrom solution. In the case of a full contribution of the trace anomaly we recover notable solutions like the topological Schwarzschild dS/AdS ones only if we introduce specific constraints on the parameters $\alpha$ and $\lambda$, otherwise it is necessary to consider the non-vacuum case. The introduction of a cosmological constant allows to recover and generalize the result in \cite{Cai2}, while in the presence of perfect fluids it is possible to find the Reisner-N\"{o}rdstrom solution. In the case of wormholes, we found two new traversable solutions. These solutions show a striking conceptual advantage with respect to GR: they do not require the presence of exotic matter sources violating GR energy conditions. This unpleasant role is played by the trace anomaly contribution itself. The first solution is obtained for a Type A anomaly and represents one of the simplest wormhole solution. The latter solution is more general, and obtained considering the full trace-anomaly contribution. In this case the time-time component of the metric is Lifschitz-like inspired and the solution features a more complex description. \section*{Acknowledgements} M.C. is supported by the FCT doctoral grant SFRH/BD/146700/2019.
\section{Introduction} \label{intro} Novae are the most energetic category of accreting white dwarfs (WDs). They occur in interacting binary systems, within which mass transfer from the donor (secondary) star forms a layer of hydrogen on the WD (primary) surface. When enough material has been accreted, nuclear burning ignites at the base of the envelope, and, once sufficient pressure has built up, a thermonuclear runaway (TNR) begins \cite[see review articles in][]{bode08,woudt14}. The nova explosion expels material which initially obscures the WD surface from view. However, as the ejecta expand, they become optically thin, thus allowing any continuing nuclear burning on the WD to become visible. This emission ultimately peaks in the soft X-ray band, and is known as the Super-Soft Source (SSS) state \citep[e.g.,][]{krautter08}. The launch of the {\em Neil Gehrels Swift Observatory} \citep[{\em Swift} hereafter; ][]{geh04}, has led to this SSS phase being well monitored in many novae \citep[see][for recent reviews]{julo15, page20}, revealing previously unseen phenomena, such as high-amplitude flux variability and short timescale quasi-periodic modulations. Classical novae (CNe) are those which have only been seen to erupt once. A small number of systems, however, have been detected in outburst multiple times, and these are known as recurrent novae (RNe). There are ten confirmed Galactic recurrents, of which the subject of this paper, RS Ophiuchi (RS~Oph hereafter), is one. It is believed that all novae should eventually recur, but most over periods of thousands of years (\citealt{yaron05} discuss the parameter space of nova outbursts). The Galactic RNe have recurrence timescales of $\sim$~10--100~yr (the upper bound being a selection effect dependent on historical records), while some RNe outside our own Galaxy have been found to recur as frequently as every year \cite[e.g.,][]{darn14}. Reviews of the recurrent novae in the Milky Way are provided by \cite{brad10} and \cite{darn21}. The RS~Oph system comprises a massive WD and a red giant (RG) donor. The mass range estimate for the WD is 1.2--1.4~$\msun$ \citep[e.g.,][]{miko17}, and the orbital period, P$_{\rm orb}$, of the binary is 453.6~$\pm$~0.4~d \citep{brandi09}. Using the ephemeris in that paper, the eruption times in 2006 and 2021 are separated by (12.47~$\pm$~0.01)~P$_{\rm orb}$ -- that is, the orbital phase is close to 180$^{\circ}$ different between the two outbursts; the 1985 eruption occurred at approximately the same phase as in 2006. The RS~Oph WD and RG were in quadrature at each of these times (phases 0.26 and 0.72, respectively, where phase 0.0 is defined to be inferior conjunction of the RG). RS~Oph has previously passed through nova eruption cycles approximately every 15~yr, with a range spanning 9--27~yr \citep[see ][for a summary]{brad10}, having been first detected as a nova in 1898 \citep{pickering1905}. This short recurrence time suggests the system contains a massive WD, accreting at a substantial rate. Prior to 2021, the previous eruption occurred in 2006 Feb., and this was the first nova monitored in detail by {\em Swift}, leading to an exquisite dataset that was published by \cite{bode06} and \cite{julo11}. The detailed {\em Swift} results in 2006 revealed absorbed, hard X-rays early after the eruption, with the absorbing column decreasing and the temperature declining over the first few weeks. These spectra were explained as thermal emission from hot, shocked gas, as the nova ejecta interacted with the RG wind \citep{bode06}. On day 26, a new, very soft component was detected, signifying the beginning of the SSS phase. This soft emission was extremely variable in flux for almost three weeks, before settling at a consistently bright level until around day 60, when a monotonic decline set in. Collimated bipolar structures (jets) were detected following the 2006 eruption \citep[e.g., ][]{obrien06, bode07, sok08, montez22}, highlighting the lack of spherical symmetry during the explosion \citep[see also models by][]{orlando09,walder08}. No eclipses are seen in RS~Oph, placing limits on the angle of inclination, with estimates ranging from 30--52$^{o}$ \citep{dobrzycka94, brandi09, valerio12}. RS~Oph was reported to have erupted again on 2021 Aug. 08, as described in AAVSO\footnote{American Association of Variable Star Observers} Alert Notice 752\footnote{https://www.aavso.org/aavso-alert-notice-752}. This prompted a flurry of observations across the electromagnetic spectrum, from very high energy TeV/GeV $\gamma$-rays detected by H.E.S.S.\footnote{The High Energy Stereoscopic System} \citep{wagner21a, wagner21b,hess} and MAGIC\footnote{Major Atmospheric Gamma Imaging Cherenkov Telescopes} \citep{magic}, and MeV $\gamma$-rays by {\em Fermi}-LAT\footnote{Large Area Telescope} \citep{cheung21a, cheung21b, cheung22}; to X-rays seen by {\em MAXI}\footnote{Monitor of All-sky X-ray Image} \citep{maxi}, {\em INTEGRAL}\footnote{INTErnational Gamma-Ray Astrophysics Laboratory} \citep{integral}, {\em NICER}\footnote{Neutron Star Interior Composition Explorer Mission} \citep{nicer1, nicer2, nicernustar, nicer3, nicer4}, {\em NuSTAR}\footnote{Nuclear Spectroscopic Telescope Array} \citep{nicernustar}, {\em AstroSat} \citep{astrosat}, {\em Chandra} and {\em XMM-Newton} \citep{chandra}, as well as {\em Swift} \citep{page21, page21a, page21b}; to optical \citep{opt1, opt2, opt3, opt4, opt5, opt6, opt7, opt8, opt9, opt10, opt11, opt12, opt13}; infra-red \citep{ir1, ir2}; and radio \citep{radio1, radio2, radio3}. A neutrino search was performed by IceCube, though only upper limits could be placed \citep{icecube}. In this paper we present the {\em Swift} X-ray observations of the 2021 outburst of RS~Oph, and compare them to the data obtained following the 2006 eruption, finding significant differences over the soft X-ray band, while the harder X-rays are much more similar. We focus mainly on the SSS emission, while \cite{cheung22} present a discussion of the higher-energy shock emission alongside the LAT results. Despite the well-known close similarity between the optical light-curves of individual RNe \citep[e.g.,][]{brad10}, the SSS phase can sometimes show wider variations from one outburst to the next. For example, the yearly recurrent M31N 2008-12a showed very similar (optically identical) multi-wavelength results from 2008--2021, with the exception of the 2016 eruption, which was notably different in X-rays \citep[][Healy et al. in prep.]{henze18}. Nova LMC 1968 has also been observed by {\em Swift} through two eruptions (2016 and 2020), in both cases showing very similar X-ray (and optical) evolution \citep{kuin20, schwarz20}. RS~Oph is the first Galactic recurrent for which this comparison has been possible\footnote{We note that it appears that the latest eruption of U~Sco might have occurred during solar conjunction in 2017, and was thus entirely missed (B. Schaefer, priv. comm.), otherwise this event would also have been observed by {\em Swift}.}; it is also one of the brightest RNe in the X-ray band, thus allowing a detailed examination. Throughout this paper, errors are given at the 1$\sigma$ confidence level, unless otherwise stated. Spectra were binned such that they have a minimum of 1 count~bin$^{-1}$ to facilitate Cash statistic \citep{cash79} fitting within {\sc xspec} \citep{arn96}, and the abundances from \cite{wilms00}, together with the photoelectric absorption cross-sections from \cite{vern96}, have been assumed when using the T{\" u}bingen-Boulder Interstellar Medium ({\sc xspec/tbabs}) absorption model. For ease of comparison with the previous publications for the {\em Swift} 2006 data, the time origin of the light-curves presented here, T0, has been taken as the time at which the optical emission peaked; this is estimated to be 2021 Aug. 09.542 UT (MJD 59435.542) from the AAVSO light-curve\footnote{For the LAT data analysis, \cite{cheung22} have assigned T0 to be the start time of the eruption from \cite{munari21}, 1.04 day before our optical peak time.}. For 2006, T0 (again, the time of optical maximum) is taken to be 2006 Feb. 12.83 UT \citep{hirosawa06}. We also assume a distance of 1.6~kpc \citep{bode87}. The parallax determined by {\em Gaia} corresponds to a greater distance of 2.4$^{+0.3}_{-0.2}$~kpc \cite{gaia21}, but \cite{brad18} notes that these parallaxes are not yet reliable for systems with long-period binary orbits, and can lead to either under- or over-estimates of the distance. See \cite{montez22,magic} for recent discussions on the distance to RS~Oph. \section{Observations} \label{obs} Following a Target of Opportunity request promptly after the announcement of the new eruption, {\em Swift} observations began on 2021 Aug 9.9, only 0.37 day after the optical peak \citep[1.41 day after the probable start time of the nova event;][]{munari21}. Initially, observations were performed on a daily basis; from the start of September, the cadence was increased to every 12~hr, then to every 8~hr between Sep. 15 and Oct. 1. Daily observations then resumed until RS~Oph entered the {\em Swift} solar observing constraint on Nov. 5. In addition, on Sep. 12 observations were taken every {\em Swift} orbit (approximately every 1.5~hr); this date was chosen as a time corresponding to the number of days ($\sim$~33) after the 2006 eruption when high-amplitude soft flux variability was seen. These observations were all obtained using the X-ray Telescope \cite[XRT; ][]{xrt} Windowed Timing (WT) mode, since the count rate was consistently above 1~count~s$^{-1}$. There were, in addition, a number of separate observations performed in Photon Counting (PC) mode between Sep. 24 and Oct. 08; these were taken to investigate possible extended emission around the source. Given the extreme level of pile-up in these PC observations, the data are not considered in this paper. Photometric and grism data were also collected using the {\em Swift} UV/Optical telescope \cite[UVOT; ][]{uvot}. These results will be presented in a separate publication. In addition, the Burst Alert Telescope \cite[BAT; ][]{bat} Transient Monitor\footnote{https://swift.gsfc.nasa.gov/results/transients/RSOph/} \citep{krimm13} showed an apparent weak detection of RS~Oph over 15--50~keV for a few days (Fig.~\ref{bat}) around the time of the eruption \citep[as was the case in 2006; ][]{bode06}. \begin{figure} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{BAT_comp_line.ps} \caption{BAT data from the Transient Monitor, showing a faint, but clear, detection of RS~Oph over 15--50~keV in both 2006 (black crosses) and 2021 (red circles). The abscissa shows days since the peak in the optical light-curve for each eruption. The horizontal dotted line marks the zero count rate level.} \label{bat} \end{center} \end{figure} Fig.~\ref{opt} shows the optical data collected by the Asiago Novae and Symbiotic stars (ANS) Collaboration during both 2021 and 2006 \citep[see][for a summary of the 2006 results]{munari07}. The light-curves and colour evolution from the two eruptions appear almost identical. It can be seen that, at the time RS~Oph entered solar conjunction in 2021, on day 86, the system had not yet returned to the pre-eruption brightness, still being around half a magnitude brighter in $B$. The flux of the optical [Fe\,{\sc x}] 6375~\AA\ coronal line was measured from the RS~Oph spectral atlas by \cite{munari21,munari22}, which provides absolute fluxed spectra (primarily Echelle) obtained at nearly daily cadence. These results are discussed in Section~\ref{comp}. \begin{figure} \begin{center} \includegraphics[width=8cm]{Fig_photometry_3.ps} \caption{$B$-band photometry and colour diagrams from the ANS Collaboration, from both 2021 and 2006. The two outbursts are almost identical at optical wavelengths.} \label{opt} \end{center} \end{figure} The {\em Swift} XRT data were analysed with HEASoft 6.29 and the most up-to-date calibration files available at the time (release date of 2021 Sep. 23). Only grade 0 (single pixel) events were utilised, in order to help minimise optical loading\footnote{https://www.swift.ac.uk/analysis/xrt/optical\_loading.php}. We note that the 2006 data presented in \cite{julo11} used WT grades 0--2 (at that time our understanding of the best way to mitigate optical loading was less complete than it is today). The 2006 light-curves and spectra presented here have also been reprocessed with the latest software and only grades 0 considered; the results are not materially different from \cite{julo11}, however. \section{X-ray light-curve} Light-curves for both the 2006 and 2021 datasets were generated using the online XRT product generator\footnote{https://www.swift.ac.uk/user\_objects/} \citep{evans07, evans09}. Looking at the shape of the spectra, 1~keV was chosen as a suitable cut between the SSS component and the harder, shock-related emission. Fig.~\ref{lc} shows the light-curves over the soft (0.3--1~keV) and hard (1--10~keV) bands, together with the hardness ratios (defined as the ratio of the counts in the 1-10 keV and 0.3-1 keV bands) for the two eruptions. There are clearly some similarities between the datasets, particularly at earlier times before the start of the SSS phase, but, overall, the evolution of the soft-band light-curve is markedly different, with the bulk of the 2021 SSS emission rising later, peaking at a lower level and then starting to fade earlier, before rebrightening briefly, compared with 2006. \subsection{0.3--1~keV} \label{soft} Basing our expectations of the light-curve evolution on the results from 2006, and in order to put stringent limits on the start of the SSS in 2021, observations with at least a daily cadence were obtained from the very beginning of our monitoring campaign. The first hint of spectral softening appeared on day 20.6 \citep{page21a}, with no sign of enhanced low-energy emission during the previous observation on day 19.5. This `bump' in the spectrum stayed small until day 26.3, when the soft component increased significantly \citep{page21b}. In 2006, (weak) soft emission was first detected on day 26.0, with an obvious increase in counts below 1~keV on day 29.0 \citep{julo11}. Before this, the previous observation occurred eight days earlier, on day 18.2. Therefore, although the 2021 SSS was noted a few days earlier than in 2006, this may simply be due to the denser sampling of the more recent eruption. \begin{figure*} \begin{center} \includegraphics[clip, width=10cm, angle=-90]{0.3-1-10_hr_tick.ps} \caption{Top: A comparison of the soft (0.3-1 keV: 2006 -- black crosses; 2021 -- red circles) and hard (1-10 keV: 2006 -- grey pluses, 2021 -- blue circles) light-curves following the 2006 and 2021 eruptions. Bottom: The hardness ratios following the 2006 (black crosses) and 2021 (red circles) eruptions.} \label{lc} \end{center} \end{figure*} The onset of the SSS in 2006 was, however, much more dramatic than in 2021. Fig.~\ref{sss} zooms in on the soft light-curve between days 32 and 46, during which time the 2006 data showed high-amplitude flux variability, with changes in X-ray count-rate of more than an order of magnitude in $\sim$~12~hr \citep[see also ][]{julo11}. While the 2021 observations did show variability, Fig.~\ref{sss} shows this was at a significantly lower level, with a peak count rate less than half that measured in 2006. It is clear that the timing of peaks and troughs in 2006 and 2021 is not the same. This is expected if the flux variability is caused by absorption in random, clumpy ejecta, which was discussed as a possibility by \cite{julo11}. The other big difference, as shown in Fig.~\ref{lc}, is that the 2021 soft X-ray emission showed a definite fading trend between days $\sim$~48--53, decreasing from around 100~count~s$^{-1}$ to $\sim$~20~count~s$^{-1}$, before rebrightening again over a few days. In 2006, the X-rays stayed consistently bright between days 46--58, after which time a steady decline set in \citep{julo11}. As RS~Oph entered the solar observing constraint in 2021 (day 87), the 0.3--10~keV XRT count rate was $\sim$~3.4~count~s$^{-1}$, while the count rate on the corresponding day in 2006 was $\sim$~20~count~s$^{-1}$. The apparent rate of decline of the 2021 soft X-rays was also noticeably slower than the 2006 data at this late time: approximating the decay between days 75--85 with a power-law\footnote{Using a power-law is simply a numerical convenience, without any physical implication.} of t$^{-\alpha}$, the 2021 data can be fitted with $\alpha$~$\sim$~4.5, while the 2006 light-curve follows $\alpha$~$\sim$~11.5. If instead we consider all the data after day 62 (after which point both light-curves show a monotonic fading), the 2021 data decay can be approximated with a single power-law of $\alpha$~$\sim$~5.1 (although the data show considerable scatter), while the 2006 light-curve shows a break in its fading, with $\alpha$~$\sim$~3.6 until day 76, then steepening to $\sim$~11.5. By comparison of the light-curves, we estimate the integrated number of observed soft (0.3--1~keV) X-ray counts between days 30--86 in 2006 was about 4--5 times larger than in 2021. \begin{figure} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{SSS_new.ps} \caption{A comparison of the 2006 and 2021 0.3--1~keV light-curves during the early supersoft phase. The 2006 dataset reaches a higher count rate, and shows larger amplitude changes, though both datasets are variable. The peaks and troughs of the variability occur at different times in 2006 and 2021.} \label{sss} \end{center} \end{figure} \subsubsection{QPO} \label{sec:qpo} \begin{figure} \begin{center} \includegraphics[clip, width=8cm]{rsoph2021_wt_min_5cps_avepsd.eps} \caption{The upper panel shows the average of 59 periodograms (each spanning 700~s) from the 2021 WT data over days 36.87 -- 61.56 (the main SSS interval), fitted with the model described in the text (magenta line). The bottom panel shows the ratio obtained between the average and model when the Lorentz (QPO) term is removed. The dashed line shows the 99~per~cent detection level over the frequency range 0.01 -- 0.10~Hz (i.e., periods of 10 -- 100~s).} \label{qpo} \end{center} \end{figure} The 2006 eruption of RS~Oph revealed a strong $\sim$~35~s quasi-periodic oscillation (QPO) during the SSS phase \citep{andy08, julo11}. Short period oscillations were subsequently also identified in other bright novae observed by {\em Swift}, with timescales of up to $\sim$~100~s (e.g., KT~Eri -- \citealt{kteri}, V339~Del -- \citealt{v339del} and V5668~Sgr -- \citealt{v5668sgr}), and were confirmed in {\em XMM-Newton} and {\em Chandra} observations \citep{ness15}. In order to search for similar oscillations from the current outburst, we extracted light curves from the WT data at 0.1~s binning in the 0.3--1~keV energy band, and applied a standard Fast Fourier Transform algorithm to calculate periodograms from individual snapshots (that is, continuous on-target pointings) and their average \citep[e.g.][]{leahy83, vanderklis88, vaughan03}. The periodograms were normalised following Leahy et al., so have predictable Poisson noise properties allowing the significance of potential signals to be evaluated. A maximum likelihood periodogram fitting technique was then applied \cite[e.g.,][]{barret12} to identify the QPO parameters. Given the mean duration of the light curves from each snapshot was $\sim$~700~s, and ranged from 380--1250~s, the periodograms were computed over 700~s continuous time bins and padded to this duration with the mean snapshot count rate if they were shorter. The average periodogram from days 36.87--61.56 covering the SSS bright phase is shown in Fig.~\ref{qpo}. The 35~s modulation is clearly detected once more at greater than 99 per~cent confidence. By fitting the periodogram with a model consisting of a powerlaw (for the low frequency variations), a constant (for Poisson noise) and a Lorentzian (for the QPO), a best fit oscillation frequency of 28.31~$\pm$~0.21~mHz was obtained, corresponding to a period of 35.33~$\pm$~0.26~s, with a fractional rms of 1.94~$\pm$~0.2~per~cent. The best fit width of the Lorentzian corresponds to an average coherence of 7.7~$\pm$~1.8 cycles. The QPO was not detected before or after days 36.87--61.56. Examination of the individual periodograms shows the QPO was detected in approximately 20~per~cent of this interval. The maximum amplitude seen in any individual periodogram was 5~per~cent. {\em NICER} also reported the detection of a $\sim$~35~s oscillation \citep{nicer3}. During the 2006 outburst, the XRT measured an average best fit period of 35.04~$\pm$~0.09~s, a fractional rms of 2.43~$\pm$~0.20, and coherence of 20.9~$\pm$~2.4 cycles (Beardmore et al. in prep. will provide a full analysis of the 2006 data). Thus, while the QPO was not so strongly detected in 2021 (probably due in part to the shorter snapshots of data obtained, as well as the source being fainter), the periods are entirely consistent. \subsection{1--10~keV} In comparison with the large differences over the 0.3--1~keV band between the two eruptions, the 1--10~keV X-rays were much more consistent, in terms of both brightness and evolution, as Fig.~\ref{lc} shows. The 2021 {\em Swift} observations began almost three days earlier than in 2006, giving us a firmer handle on the initial rise of the X-rays. The harder emission was seen to increase in strength until around day 5 following both eruptions, though the 2021 peak 1--10~keV count rate is only about half that seen in 2006. (The higher cadence of observations in 2021 makes the peak time better defined.) The 2006 data then faded more rapidly until around day 15--20 (following an approximate power-law decay of $\alpha$~$\sim$~1, compared with 0.5 for the 2021 data), at which point both the count rate and rate of decline became very similar to what we see in 2021 ($\alpha$~$\sim$~2). There is an interval between days 60--70 where the 2006 data showed a slight excess compared with 2021 but, overall, the 1--10~keV light-curves are rather similar between the two nova events, especially in comparison with the differences in the soft emission. \section{X-ray Spectrum} \label{sec:spec} Fig.~\ref{spec} shows samples of X-ray spectra obtained during the 2006 and 2021 eruptions. The 2021 spectra show a very smooth, featureless super-soft component, which can be simply modelled by a blackbody (BB) component -- occasionally improved by the inclusion of absorption edge(s), though often well-modelled without. While \cite{julo11} parametrized the 2006 data by use of an atmosphere component \citep[the T{\" u}bingen non-local-thermodynamic-equilibrium model atmospheres;][]{rauch03}, a BB+edges model also provides an acceptable fit to these 2006 data -- in most cases, statistically better. In addition, the model atmospheres seemed unstable within {\sc xspec}, with the fitted temperatures appearing almost quantised at certain values, despite small step sizes for fitting, and the minimisation routine implemented. Given that high-resolution observations of novae have shown that the currently available atmosphere models do not account for all the complexities seen \citep{ness19}, we have chosen to use the BB option for a direct comparison between the two eruptions. Fig.~\ref{bb-atmos} demonstrates the better fit results obtained using a pure BB compared to the T{\" u}bingen grid 003 model atmosphere \cite[as used in ][]{julo11}, particularly between 0.7--1~keV. The best fits for these two models applied to this example spectrum are kT$_{\rm BB}$~=~43~$\pm$~1~eV, R$_{\rm BB}$~=~(3.9$^{+0.6}_{-1.8}$)~$\times$~10$^{10}$~cm, N$_{\rm H,BB}$~=~(2.6$^{+0.2}_{-0.3}$)~$\times$~10$^{21}$~cm$^{-2}$, and kT$_{\rm atmos}$~= 70~$\pm$~1~eV, R$_{\rm atmos}$~=~(1.0~$\pm$~0.3)~$\times$~10$^{10}$~cm, N$_{\rm H, atmos}$~=~(2.9~$\pm$~0.2)~$\times$~10$^{21}$~cm$^{-2}$, respectively. \begin{figure*} \begin{center} \includegraphics[clip, width=6cm, angle=-90]{RSOph_spec-comp_2006.ps} \includegraphics[clip, width=6cm, angle=-90]{RSOph_spec-comp_2021.ps} \caption{Evolution of the X-ray spectra through the 2006 (left) and 2021 (right) eruptions. Left: 2006 spectra. The black spectrum shows the last date when there was no detectable SSS emission, on day 18.2, while the red shows the first where a soft excess was seen, on day 26.0, eight days later. The next observation occurred on day 29, and showed a strong soft component. Days 44.2, 61.8 and 86.8 are shown for direct comparison with the 2021 results on those days (see right-hand plot and description below). Since there was no sudden drop in observed count rate between days 61.6 and 63.9 in 2006, the spectrum from day 76.9 is included instead. Right: 2021 spectra. The black spectrum again shows the last date when there was no detectable SSS emission, on day 19.5; the next observation, in this case taken only 27 hours later, showed a slight increase in counts below $\sim$~0.6~keV. The slightly-enhanced soft emission stayed around this level until day 26.3, when an obvious soft component appeared. The X-ray count rate reached a peak around day 44.4, after which there was a decline followed by a rebrightening. Due to the proximity of RS Oph to the Moon, the source could not be observed between days 61.6 and 63.9, during which time the count rate dropped from $\sim$~41.5~count~s$^{-1}$ to $\sim$~14~count~s$^{-1}$ (blue and cyan spectra). The blue/green spectrum corresponds to the last day RS~Oph could be observed before entering the Sun constraint.} \label{spec} \end{center} \end{figure*} \begin{figure} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{seg250_bb-atmos.ps} \caption{Comparison of the BB (with no absorption edges; kT~=~43~$\pm$~1~eV) and atmosphere fits (using Rauch grid 003; kT~=~70~$\pm$~1~eV) to the SSS emission on day 43.8 of the 2021 eruption. The bottom panel plots the ratio of the data to both models; this clearly shows the fit deficiency using the Rauch grid 003 atmosphere model in the interval 0.7--1~keV} \label{bb-atmos} \end{center} \end{figure} Looking in detail at the appropriate temperature Rauch atmosphere models, we determined that the strongest edges were those associated with He- and H-like N at 0.552 and 0.667~keV, and He- and H-like O at 0.739 and 0.871~keV. However, the energy dependence of the edge profiles in these grid model is very different from those implemented by the standard edge model in {\sc xspec}, which assumes an E$^{-3}$ cross-section above the edge. From the atmosphere models, we find a flatter dependence of E$^{+1}$ is more appropriate at the temperatures of interest for RS~Oph, so a local {\sc xspec} model was defined to implement this different edge shape\footnote{Our cross-section energy dependance changes both the edge depth and the post-edge spectrum compared to the standard E$^{-3}$ profile; while trends within our fits can be informative, direct comparisons with model fits using standard edges will not be meaningful.}. The differences are shown in Fig.~\ref{edges}. Additionally, the atmosphere models have absorption lines which may overlap/interact with the edges, one of which (H-like O at 0.654~keV) shifts the 0.667~keV edge energy to 0.635~keV at XRT CCD level spectral resolution. All four of these edges were implemented in our model (using the E$^{+1}$ shape). The optical depths of the edges accounting for He-like and H-like N (0.552 and 0.635~keV) and He-like O (0.739~keV) were allowed to vary over a range of $\tau$~=~0--5. The optical depth of the fourth edge (H-like O at 0.871~keV) included in the fit was fixed at 2; while this edge often improved the residuals, the overlap of the BB and cooler optically-thin component (see below) made constraining the depth difficult. The high-resolution grating spectra obtained following the 2006 eruption show both absorption and emission lines superimposed on the continuum \citep{ness07a,ness09}, as do the 2021 spectra (Ness et al. in prep.). Such lines are not required when modelling the lower-resolution XRT spectra, though unmodelled emission lines at low energies could affect the fitted absorbing column. A quick comparison between the 2021 {\em XMM-Newton} RGS\footnote{Reflection Grating Spectrometer.} spectra and contemporaneous XRT spectra gives no great cause for concern at these low energies, however. Indeed, the fit parameters from the {\em Swift} data closest in time to the {\em XMM-Newton} observation on day 37 of the 2021 eruption, applied directly to those RGS spectra shows that they are a reasonable approximation to the underlying continuum, with emission lines superimposed. Similarly, a comparison between contemporaneous XRT and {\em NICER} spectra (Orio et al. in prep.) shows general agreement. We note that the resolution of the XRT WT mode at 0.5~keV is currently 115~eV (full width at half maximum -- FWHM), compared with 82~eV in 2006\footnote{The FWHM of 63~eV given in \cite{julo11} was measured using an older response function (RMF). Since that work was published, the calibration was updated with a slightly broader response.}. Sharp spectral features will therefore not be resolved in the {\em Swift} data. \begin{figure} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{atm_80eV_bbody5edge_comp_mod.ps} \caption{Comparison of the Rauch atmosphere grid (solid black line), the BB model including standard {\sc xspec} edges following E$^{-3}$ dependence (blue dot-dashed lines; this is not an actual fit to the data, but aligned to show the different edge shapes clearly) and the BB model including edges with an E$^{+1}$ recovery (red dashed lines). In the model used for this example, only additional edges at 0.635, 0.739 and 0.871~keV were significant; the dip close to 0.55~keV is simply due to the interstellar absorption modelled by {\sc tbabs}, so the shape does not vary between the models.} \label{edges} \end{center} \end{figure} \begin{figure*} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{day6.6_2apec.ps} \includegraphics[clip, width=5.5cm, angle=-90]{day43.8_bbkedges2apec.ps} \caption{Example spectra demonstrating how well the models fit the 2021 data, before and during the SSS phase. Left panel: Spectrum from day 6.6 after the eruption, at the time the 1--10~keV emission peaked, fitted with two optically-thin components (red and blue). Right panel: Spectrum from day 43.8 after the eruption, around the time the 0.3--1~keV emission peaked, fitted with a blackbody plus edges (magenta), together with two optically-thin components (red and blue).} \label{spec-model} \end{center} \end{figure*} In both 2006 and 2021, the harder ($>$~1~keV) emission, due to the shocked wind, has been parametrized in this paper by two optically-thin ({\sc apec} in {\sc xspec}) components, fixed at solar abundance. Considering the pre-SSS shock data, there are no strong residuals suggesting non-solar abundances would improve the fits to the {\em Swift} spectra (see left-hand panel of Fig.~\ref{spec-model}). In some individual observations only one {\sc apec} was required at $\go$~90~per~cent confidence, while others could be improved by the inclusion of a third, cooler component (typically $\sim$~100--200~eV). This is a simplification of what may physically be a more complex underlying shock continuum \citep[see, for example, ][]{vaytet07,vaytet11}. However the two-temperature model accounts for the measured harder emission well. Each spectrum was also attenuated by two absorption components: the interstellar medium (ISM) value fixed at 2.4~$\times$~10$^{21}$~cm$^{-2}$ \citep{hjellming86}, and a variable column density due to the RG wind. In \cite{julo11}, this additional wind absorption was constrained to follow a power-law decline over time based on analysis in \cite{bode06}. However, in the current analysis (both for the new 2021 observations, and the re-analysis of the 2006 data), we have chosen to allow this column to vary because of the apparently more complex variation seen with this larger sample of data. The oxygen abundance for the excess N$_{\rm H,wind}$ above the ISM level was fixed at 0.3 solar (within the {\sc xspec/tbfeo} model). This lower oxygen abundance was determined from modelling the grating observations in 2006 \citep{ness07a, julo11}, and typically provides an improvement when fitting the 2021 datasets as well, so was adopted throughout the analysis described below. The same absorption parameter, N$_{\rm H,wind}$, was applied to all components in each fit; that is, the soft, optically-thick BB and harder optically-thin components were absorbed by the same column. Although it is possible that the emission from the nuclear burning on the WD surface and that from shocks with the RG wind experience different levels of absorption, a single varying column (in excess of the fixed Galactic value) led to acceptable fits. This excess absorption has been assumed to be neutral. Fig.~\ref{spec-model} shows two example spectra from the times in 2021 where the 1--10~keV and 0.3--1~keV emission peaked, respectively, with the fitted components shown (red dots and blue dashes for the optically-thin shock emission, and a magenta dot-dash line for the edge-absorbed BB component; in this example, only the He-like oxygen edge was significant). While the models are clearly not perfect, with some fit residuals apparent, the overall fit to the continuum is good (C-stat/dof = 852/766 and 275/245, respectively, for the spectra plotted). \subsection{Spectral fitting results} Experimenting with different fits, it became clear that the ionized edges were much more significant in the 2006 spectra, with most of the 2021 soft data being well modelled with a BB alone. Indeed, upon fitting the 2021 spectra with different combinations of edges, it was apparent that there could be significant degeneracy between the edges included and the BB temperature for some of the spectra. That is, fits with a low ($\sim$~50~eV) BB kT and shallow/no edges, or a higher kT ($\sim$~100--150~eV) and deep edges, often lead to a very similar goodness of fit (C-stat values within $\sim$~5 of each other), with little difference in the fit residuals. The majority of the 2006 spectra were better fitted by including some or all of the four absorption edges described above. The left-hand panel of Fig.~\ref{tau} demonstrates how the optical depths of the edges varied in the 2006 spectral fits; recall that the depth of the H-like O edge at 0.871~keV was fixed at $\tau$~=~2 throughout. Of the three with variable optical depths, the He-like O edge at 0.739~keV was the most significant at early times. This optical depth then decreased, until about day 70, after which time the edge was no longer strongly significant. The 0.552~keV He-like N edge is the second deepest at the start of the SSS phase, also decreasing in strength with time, until becoming insignificant after around day 55. The edge at 0.635~keV, related to H-like N, was really only required after day 60, and its optical depth increased steadily after this time. No such obvious trends were found in the typically less-significant optical depths in the 2021 fits, as can be seen in the right-hand panel of Fig.~\ref{tau}. Because of these findings, we choose to show both single BB fits, and those from a BB plus these four absorption edges (for the SSS emission) as described above; the underlying {\sc apec} components were included to account for the shock emission. \begin{figure*} \begin{center} \includegraphics[clip, width=5.5cm, angle=-90]{3edgedepths_2006_nozero.ps} \includegraphics[clip, width=5.5cm, angle=-90]{3edgedepths_2021_nozero_no5.ps} \caption{Plots of the fitted edge optical depths for which the 1$\sigma$ lower limit is inconsistent with zero. For the 2006 dataset (left), the He-like O edge (0.739~keV; blue) was the most significant at early times, decreasing in strength with time. The shallower optical depth of the He-like N (0.552~keV; black) edge followed a similar decreasing trend. H-like N (0.635~keV; red) improved the fits mainly after day 60. The optical depths of the edges fitted to the 2021 spectra (right) do not show any obvious trends. The small number of edges for which the optical depth pegged at the deepest allowed value of $\tau$~=~5 have been omitted from the plots. Note that the vertical scales are different for the two plots.} \label{tau} \end{center} \end{figure*} Figs.~\ref{fitsa} and \ref{fitsb} show the results of fitting the spectra with two absorbed optically-thin {\sc apec} components before the onset of the SSS phase, then with a BB without and with absorption edges included as well, for both 2006 and 2021. In both cases, the top panel plots the observed 0.3--10~keV fluxes (in units of erg~cm$^{-2}$~s$^{-1}$) corresponding to the BB component (modelling the SSS; shown in black and red) and the combined {\sc apec} emission (modelling the underlying shocks; grey and blue). The second panel demonstrates the evolution of the temperatures of the two optically-thin {\sc apec} components, while the third does the same for the BB, with the corresponding BB effective radius in the fourth. The bottom panel shows how the excess absorbing column, N$_{\rm H,wind}$, decreases with time. In both plots, the axes in each corresponding panel are scaled to be the same, for ease of direct comparison. The fitted parameters corresponding to these figures are provided in Table~\ref{swiftpar}. \begin{table*} \caption{Fits to the XRT spectra before (model consisting of two absorbed {\sc apec} components) and during (including an additional BB) the SSS phases in 2006 and 2021, as plotted in Figs.~\ref{fitsa} and \ref{fitsb}. The first column lists the mid-point of the spectrum in days since the optical peak of the eruption, while the second column provides the excess absorption. Columns three to five list the temperatures of the BB and {\sc apec} components, while columns six and seven show the observed flux over 0.3--10~keV for the BB and combined {\sc apec} components, respectively. The final column gives the Cash statistic and number of degrees of freedom. The full version of this table is available online.} \begin{center} \begin{tabular}{lccccccc} \hline \textbf{T$_{\rm mid}$} & \textbf{N$_{\rm H, wind}$} & \textbf{kT$_{\rm BB}$} & \textbf{{\sc apec} kT$_{\rm cool}$} & \textbf{{\sc apec} kT$_{\rm hot}$} & \textbf{BB Flux} & \textbf{{\sc apec} Flux}& \textbf{Cstat/dof}\\ \textbf{(day)} & \textbf{(10$^{22}$ cm$^{-2}$)} & \textbf{(eV)} & \textbf{(keV)} & \textbf{(keV)} & \textbf{(erg cm$^{-2}$ s$^{-1}$)} & \textbf{(erg cm$^{-2}$ s$^{-1}$)}\\ \hline \textbf{2006 eruption}\\ 3.178 & 6.77$^{+0.40}_{-0.38}$& ---& 0.168$^{+0.023}_{-0.028}$& 8.449$^{+0.637}_{-0.576}$&--- & 1.30$^{+0.02}_{-0.02}$~$ \times$~10$^{-9}$ & 903.6 / 799 \\ 5.033 & 2.47$^{+0.10}_{-0.09}$& ---& 0.248$^{+0.017}_{-0.024}$& 7.407$^{+0.312}_{-0.310}$&--- & 2.01$^{+0.02}_{-0.02}$~$ \times$~10$^{-9}$ & 1175.1 / 854 \\ 8.183 & 1.68$^{+0.10}_{-0.10}$& ---& 0.280$^{+0.017}_{-0.017}$& 5.964$^{+0.335}_{-0.268}$&--- & 1.11$^{+0.01}_{-0.01}$~$ \times$~10$^{-9}$ & 1007.5 / 781 \\ 10.99 & 1.75$^{+0.16}_{-0.20}$& ---& 0.192$^{+0.041}_{-0.028}$& 2.976$^{+0.199}_{-0.165}$&--- & 6.50$^{+0.17}_{-0.18}$~$ \times$~10$^{-10}$ & 655.4 / 602 \\ 11.057 & 1.55$^{+0.19}_{-0.20}$& ---& 0.263$^{+0.039}_{-0.054}$& 3.208$^{+0.294}_{-0.251}$&--- & 6.97$^{+0.23}_{-0.21}$~$ \times$~10$^{-10}$ & 563.1 / 574 \\ 11.124 & 2.07$^{+0.02}_{-0.08}$& ---& 0.138$^{+0.011}_{-0.007}$& 2.688$^{+0.093}_{-0.082}$&--- & 6.79$^{+0.19}_{-0.12}$~$ \times$~10$^{-10}$ & 574.4 / 585 \\ 13.605 & 1.56$^{+0.10}_{-0.11}$& ---& 0.200$^{+0.019}_{-0.012}$& 2.535$^{+0.101}_{-0.074}$&--- & 4.82$^{+0.08}_{-0.08}$~$ \times$~10$^{-10}$ & 749.4 / 659 \\ 15.616 & 1.54$^{+0.06}_{-0.06}$& ---& 0.621$^{+0.020}_{-0.058}$& 2.782$^{+0.109}_{-0.096}$&--- & 3.89$^{+0.06}_{-0.06}$~$ \times$~10$^{-10}$ & 890.9 / 639 \\ 18.176 & 1.54$^{+0.11}_{-0.13}$& ---& 0.800$^{+0.044}_{-0.038}$& 2.533$^{+0.256}_{-0.203}$&--- & 2.31$^{+0.09}_{-0.04}$~$ \times$~10$^{-10}$ & 408.5 / 437 \\ 18.229 & 1.50$^{+0.16}_{-0.18}$& ---& 0.844$^{+0.064}_{-0.070}$& 2.427$^{+0.630}_{-0.380}$&--- & 2.29$^{+0.08}_{-0.10}$~$ \times$~10$^{-10}$ & 257.0 / 311 \\ 18.239 & 1.54$^{+0.11}_{-0.13}$& ---& 0.665$^{+0.056}_{-0.051}$& 2.597$^{+0.289}_{-0.212}$&--- & 2.89$^{+0.10}_{-0.10}$~$ \times$~10$^{-10}$ & 447.0 / 461 \\ 25.998 & 1.37$^{+0.04}_{-0.05}$& 28.1$^{+1.6}_{-0.8}$& 0.672$^{+0.040}_{-0.015}$& 2.047$^{+0.156}_{-0.127}$&1.11$^{+0.06}_{-0.06}$~$ \times$~10$^{-11}$& 1.70$^{+0.03}_{-0.03}$~$ \times$~10$^{-10}$ & 665.9 / 499 \\ 29.01 & 0.94$^{+0.03}_{-0.02}$& 18.1$^{+0.3}_{-0.4}$& 0.701$^{+0.015}_{-0.015}$& 1.569$^{+0.047}_{-0.059}$&2.74$^{+0.02}_{-0.02}$~$ \times$~10$^{-10}$& 1.48$^{+0.02}_{-0.02}$~$ \times$~10$^{-10}$ & 715.8 / 467 \\ 29.886 & 0.65$^{+0.03}_{-0.04}$& 25.1$^{+1.0}_{-0.6}$& 0.707$^{+0.038}_{-0.016}$& 1.602$^{+0.056}_{-0.038}$&8.73$^{+0.13}_{-0.13}$~$ \times$~10$^{-11}$& 1.30$^{+0.02}_{-0.02}$~$ \times$~10$^{-10}$ & 836.0 / 432 \\ \hline \end{tabular} \label{swiftpar} \end{center} \end{table*} At later times in 2021, there were intervals where the fitted BB temperature was seen to jump dramatically within a day; as discussed above, this is caused by the temperature/edge depth degeneracy. Given that most of the spectra were better fitted (albeit often only slightly) with the cooler ($\sim$~50~eV) BBs, the sudden apparent jumps to higher temperatures are most probably anomalous, and not physical. For the fits to these spectra, the BB component was therefore fixed at the mean temperature of the two spectra before and after in time where the blackbody temperature was cooler; these data are plotted as magenta stars in Fig.~\ref{fitsb}, with the corresponding cooler/hotter {\sc apec} parameters shown in magenta/cyan. The optical depths of the edges shown in Fig.~\ref{tau} correspond to these lower BB temperature fits. \subsubsection{Comparison between fits with and without absorption edges} The main differences seen when absorption edges are included in modelling the observed spectra are an increase in BB temperature (by 10--15~eV), and a decrease in the effective radius of the emitting region (by about a factor of three), in both cases after day 40, once the SSS emission had settled down. To a lesser extent, there is also a slight decrease in the excess N$_{\rm H}$ over this same interval. All of these differences are clearer in the 2006 data, where the edges are more strongly detected. \subsubsection{Comparison between 2021 and 2006 fits} \label{comp} The underlying X-ray spectral shape was similar in both 2006 and 2021, with the temperatures and absorbing columns covering approximately the same parameter space, though with certain differences. The temperatures of the two optically-thin components, together with N$_{\rm H,wind}$, evolve most strongly during the first 10--15~days after the nova event, both in 2006 and 2021. Beyond this time, the shock emission cools slowly, and the measured absorbing column declines only a little further, although there is a drop in N$_{\rm H,wind}$ after day $\sim$ 60 in 2021. While a consistently higher absorbing column might present itself as a simple explanation for the lower SSS flux observed in 2021, these fits do not support that hypothesis. The BB temperatures cover a similar range in both outbursts, starting off cool, around 20--30~eV, before increasing. The inclusion of the edges leads to a larger rise in fitted temperature. The 2021 data show more variability in the BB parameters at the earliest times (i.e., before about day 30), when the SSS is only weakly present; this is particularly the case where absorption edges are included in the fit, which is likely a symptom of over-fitting the data. \begin{figure*} \begin{center} \includegraphics[clip, width=15cm]{BBnoedge_col_noline_scale_ticks.ps} \caption{Results from fitting the spectra from 2006 and 2021 with a simple BB to model the soft emission, together with two optically-thin {\sc apec} components. The top panel shows the observed 0.3--10~keV fluxes from the BB and {\sc apec} components (in units of erg~cm$^{-2}$~s$^{-1}$). The second panel shows the evolution of the {\sc apec} component temperatures, while the third panel shows the same for the BB. The fourth panel shows the emission radius for the BB component, and the bottom panel shows how the absorbing column N$_{\rm H,wind}$ (in excess of the Galactic ISM value) evolves with time. 2006 data are plotted in monochrome, while 2021 are in blue (hotter {\sc apec} parameters) and red (cooler {\sc apec} and all other parameters). Note that the ordinate scales are the same in each panel as in Fig.~\ref{fitsb}, for ease of comparison. See text for more details of the models.} \label{fitsa} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[clip, width=15cm]{BB3edges_col_noline_scale_ticks.ps} \caption{As for Fig.~\ref{fitsa}, but including four absorption edges as well. 2006 data are plotted in monochrome, while 2021 are in blue/cyan (hotter {\sc apec} parameters) and red/magenta (cooler {\sc apec} and all other parameters: red where BB kT was free to vary, magenta stars where that temperature was constrained. The {\sc apec} temperatures plotted in magenta and cyan correspond to the magenta BB bins, likewise for the radius and N$_{\rm H}$.) Note that the ordinate scales are the same in each panel as in Fig.~\ref{fitsa}, for ease of comparison. See text for more details of the models.} \label{fitsb} \end{center} \end{figure*} A large difference between the datasets is the excursion in BB kT around day 40 in 2006 (with and without absorption edges), where these data are better fitted with a temperature about 20--40~eV higher than observations shortly before or after this time (a bigger discrepancy when the edges are included). N$_{\rm H,wind}$ is correspondingly lower during this interval. The fitted temperature and column density are, of course, correlated to some level, due to the modest spectral resolution of the XRT at these energies. Forcing a higher N$_{\rm H,wind}$ causes the BB temperature to decrease (or vice versa); these forced fits are statistically worse, though. These observations with higher BB kT occurred during the time of large-scale flux variability -- something which was not seen to such an extent in 2021, so it is perhaps unsurprising that the same variation in temperature/absorption is not found following the latest eruption. \cite{julo11} describe a rather different evolution of the SSS temperature compared with the re-analysis of those same 2006 data herein, finding significant changes in kT throughout the early flux variability phase, which then settled at the highest value reached. This may be caused by the differences in how the absorption is modelled. As noted above, \cite{julo11} constrain N$_{\rm H,wind}$ to follow a power-law of t$^{-0.5}$~cm$^{-2}$ after the first detection of the SSS emission \citep[based on work in][]{bode06}. In our re-analysis, where N$_{\rm H,wind}$ is freely fitted, we initially find a more variable column, particularly during the chaotic start to the SSS phase (though note mention of N$_{\rm H,wind}$-BB kT degeneracies above). However, after $\sim$~day 50, the fit results for the 2006 dataset are not inconsistent with a power-law decline in N$_{\rm H,wind}$ of index 0.5, although there is still significant scatter. The estimate of the range of the absorbing column in 2021 is very similar to that in 2006 until around day 60, when it decreases more significantly. Around day 53 in 2021, there seems to be a brief dip in the effective BB radius, and an upward step in the temperature, corresponding to the temporary drop in observed soft flux at that time. About a week later, after day 60, the 2021 BB temperatures become consistently slightly hotter, with a notable decrease in the corresponding emitting radius compared with 2006. It is not unexpected that, as the WD runs out of fuel, the bloated outer layers begin to shrink and, consequently, the BB temperature rises \citep[e.g., ][]{macdonald85, krautter96, shore96b}. However, from our fit results, the drop in radius is only obvious in 2021 over the time frame considered (i.e., before day 86). This could be an indication that the nuclear burning phase ended earlier in 2021 -- though see discussion in Section~\ref{fe}. The geometry of nova systems post-eruption is not always clear, though, and the WD may remain bloated long after the end of the eruption \citep[e.g.,][]{mason21}. In Fig.~\ref{lum} we show the bolometric luminosities estimated from the BB fits to the data after day 40, for both the zero and multiple edge models, in 2006 and 2021. The inclusion of (significant) absorption edges decreases the estimated luminosities overall, in both years. The low 0.3--10~keV flux measurements seen in 2021, particularly after day 60, clearly correspond to much lower bolometric luminosities. This is also the time frame over which the BB radius decreases (consistently) in 2021. It is well-known that BB models can overestimate luminosities \citep[e.g.,][]{krautter96}, so the high peak values of 100-1000~L$_{\rm Edd}$ shown in Fig.~\ref{lum} should not be taken as physically realistic, and only the comparative trends considered. \begin{figure} \begin{center} \includegraphics[clip, angle=-90, width=8cm]{lum-comp_col.ps} \caption{Bolometric luminosity estimates from the BB fits for the 2006 (black/grey) and 2021 (red/blue) data, without and with absorption edges. Whether or not the edges are included, the 2021 data are systematically less luminous than the 2006 data after day 60. The luminosity is plotted in terms of the Eddington value for a 1.4~$\msun$ WD (1.76~$\times$~10$^{38}$~erg~s$^{-1}$), commensurate with the upper limit on the WD mass in \citet{miko17}.} \label{lum} \end{center} \end{figure} The optical [Fe\,{\sc x}] 6375~\AA\ coronal line (ionization energy of 235~eV) is often considered to be a tracer for the SSS phase, since it acts as a good indicator of photoionization from a hot WD \citep{krautter89}. While more energetic photons from the shocked ejecta will also be able to excite the [Fe\,{\sc x}] emission line, the behaviour of the line is much more reminiscent of the SSS evolution. The evolution of the optical [Fe\,{\sc x}] line flux is therefore presented in Fig.~\ref{fex}, with the X-ray light-curves for comparison. In 2021 the last non-detection of the line occurred on day 23.10, with the first positive detection occurring on day 25.10. In an effort to compare with the previous 2006 outburst, we have also measured the flux of [Fe\,{\sc x}] on four of the eight spectra presented by \cite{munari07} -- those for which an accurate absolute flux calibration is available -- and these results for 2006 are over-plotted as blue squares in Fig.~\ref{fex}. The overall shape and duration of the [Fe\,{\sc x}] curve is more similar to the X-ray evolution seen in 2006 than in 2021. \begin{figure} \begin{center} \includegraphics[clip, width=8cm]{FeX-XRT_square_tick.eps} \caption{The evolution of the [Fe\,{\sc x}] flux in 2021 and 2006 (red circles and blue squares; left-hand axis), compared with the corresponding 0.3--10~keV X-ray light-curves (grey triangles and black pluses; right-hand scale).} \label{fex} \end{center} \end{figure} \section{1985 eruption} Following the 1985 eruption, {\em EXOSAT}\footnote{European X-ray Observatory Satellite} observed RS~Oph six times between days 54 and 250 after the peak of the optical emission, the first time the nova had been observed in X-rays \citep{mason87}. Four of these observations lie within the post-outburst time frame we are considering in this paper. We extracted the count rates from the HEASARC database\footnote{\url{https://heasarc.gsfc.nasa.gov/cgi-bin/W3Browse/w3browse.pl}}, and converted the LE-LX3 (Low Energy imaging telescope with the Lexan 3000 filter\footnote{The Medium Energy proportional counter (ME; 1.2--50~keV) was also used, but the source was only detected during the first three observations.}) measurements (0.05-2~keV) to {\em Swift} 0.3--1~keV count rates using PIMMS\footnote{Portable, Interactive Multi-Mission Simulator: \url{https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/w3pimms/w3pimms.pl}}. This gave an approximate conversion of 1~count~s$^{-1}$ with the LE-LX3 corresponding to $\sim$~13--17~count~s$^{-1}$ in XRT-WT (grade 0) over 0.3--1~keV; this range was estimated by taking the BB and N$_{\rm H}$ values from the fits closest in time to each {\em EXOSAT} post-eruption day from both 2006 and 2021\footnote{We note that \cite{ness07b} scaled the {\em EXOSAT} data by eye to reproduce the XRT count rate on day 55 after the 2006 eruption, leading to a very different comparison.}. \cite{mason87} attempted to fit the {\em EXOSAT} ME data over $\sim$~1.5--5.5~keV. They found that the spectrum shows a strong rise at the soft energy end, indicating the emission was likely super-soft, as assumed for this conversion. Fig.~\ref{exosat} shows these converted {\em EXOSAT} measurements (using the mean conversion of 1 {\em EXOSAT}-LE count~s$^{-1}$ = 15 {\em Swift}-XRT count~s$^{-1}$) with respect to the {\em Swift} light-curves from 2006 and 2021, indicating that the soft X-ray emission in 1985 was even fainter than in 2021. However, the 1985 data drop off rapidly after day 60--70, more like the 2006 eruption than the 2021 one. Interestingly, the 1985 and 2006 eruptions occurred at about the same binary phase, while 2021 was $\sim$~180$^o$ different. Note that the RS~Oph eruption prior to 1985 occurred in 1967, so the 1985 eruption followed a quiescent interval of 18~yr. The X-rays detected with the limited {\em EXOSAT} observations were previously interpreted to be shock emission \citep{mason87}, although \cite{obrien92} suggested that a better solution might be that the shock in the RG wind provides the higher-energy X-ray emission whilst most of the low-energy flux is due to the white dwarf remnant. With the more detailed observations from {\em Swift}, we can state that the majority of these X-rays were most likely supersoft photons from the surface nuclear burning as it switched off \citep[as also concluded by][]{ness07b}. Indeed, while \cite{mason87} interpreted the earlier observations (including all those presented here in Fig.~\ref{exosat}) as shock-heated thermal emission, they ascribe the last detection around day 250 to residual nuclear burning on the WD surface. \begin{figure} \begin{center} \includegraphics[clip, angle=-90, width=8cm]{XRT-EXOSAT-LX3_0.3-1keV_tick.ps} \caption{Comparison of the {\em EXOSAT} LE/LX3 observations following the 1985 eruption of RS Oph with the {\em Swift} light-curves from 2006 and 2021. The {\em EXOSAT} measurements have been converted to {\em Swift}-equivalent 0.3--1~keV count rates using WebPIMMS.} \label{exosat} \end{center} \end{figure} \section{Discussion} With a mean recurrence timescale of 15~yr, RS~Oph is the first Galactic recurrent nova for which more than one eruption has been monitored by {\em Swift}. The quiescent interval preceding the 2021 eruption was 15.5~yr, close to this mean value; the 21~yr gap from 1985--2006, however, is around 35~per~cent longer than the average. In this paper we perform a detailed comparison of the XRT data collected during the first $\sim$~86~days of these eruptions, to investigate how similar -- or different -- the events were. The most obvious difference which requires explanation is the clearly brighter observed X-ray emission in 2006 compared with 2021 (and 1985). Here we summarise all the salient points: \vspace{5mm} {\bf Similarities}: \begin{itemize} \item The optical light-curves in 2006 and 2021 are almost identical. This strongly suggests that the WD mass and ejecta mass, velocity distribution and geometry are close to constant, since these are the parameters which affect the optical evolution \citep[e.g., ][and references therein]{shore12, chomiuk21}. \item Despite limited data from 2006, the evolution of the [Fe\,{\sc x}] coronal emission appears to be approximately the same following both eruptions. \item The harder X-ray emission (dominating $>$~1~keV) produced by shock interactions between the nova ejecta and the RG wind was similar, in terms of both brightness and temperature evolution, throughout the majority of the interval considered. This, like the identical optical light-curves, implies the ejecta parameters are similar, as well as the gross properties of the RG wind density structure close in to the system. \item The SSS emission became visible around the same time (day 20--26), and the final decline started around day 60 after each eruption. \item The magnitude and temporal evolution of the wind absorbing column (in excess of the Galactic value) was typically similar until day 60, although the 2006 data show more variation during the end of the high-amplitude flux changes (around day 40). \item The parametrization of the SSS with a BB mainly provided similar temperatures between the two eruptions, with or without the inclusion of absorption edges. \item A QPO was identified in both 2006 and 2021, with a consistent mean period of $\sim$~35~s. The modulation fraction was also similar during both eruptions. \end{itemize} {\bf Differences}: \begin{itemize} \item The measured count rate at the beginning of the SSS phase in 2006 was more variable than in 2021. \item The count rate peaks and troughs occurred at different times following each eruption. \item The SSS emission in 2006 was brighter than in 2021, peaking at more than double the count rate over 0.3--1~keV. The integrated number of soft X-ray counts is $\sim$~4--5 times larger in 2006 than 2021. \item The 2006 eruption occurred after an inter-eruption gap of 21~yr, about 35~per~cent longer than the average recurrence time. The 15.5~yr quiescent interval which ended in 2021 is almost exactly the average duration. \item In 2006, the SSS emission plateaued around a peak count rate between $\sim$~days 45--60, before a monotonic decline set in. The 2021 soft emission stayed at peak brightness from around days 45--48, then faded by a factor of about five over the next five days, followed by a brief rebrightening before a final fading trend set in around day 60. \item After day 76, the rate of decline of the 2006 soft emission was more than twice as rapid as at the corresponding time in 2021. \item As noted above, the range of BB temperatures was similar during both SSS phases. However, the 2006 spectra show a more rapid increase in temperature, then staying approximately constant until day 70. The 2021 temperature increase is gradual, becoming systematically hotter than the corresponding 2006 data after day 60; this is more obvious with the simple BB fits with no edges included, but the trend is still there with the edges. The 2006 data are also noticeably hotter for an interval around day 40. \item The 2006 spectra show more signs of absorption features, with the 2021 spectra appearing much smoother; those fits are therefore not significantly improved by the inclusion of ionized absorption edges, whereas the 2006 data are. \item After $\sim$~day~60, the radius of the emitting region in 2006 is consistently higher than in 2021, caused by the 2021 radius dropping, while the 2006 measurement stays approximately constant. This is the case with or without absorption edges. There is also a brief decrease in the 2021 BB radius around day 53, corresponding to the temporary drop in soft flux, though this is not clearly seen when edges are included. \item N$_{\rm H,wind}$ is also lower after $\sim$~day~60 in 2021, though very similar in both 2006 and 2021 at earlier times. \item After day 60, the apparent bolometric SSS luminosity in 2006 was much higher than in 2021. \end{itemize} The results of the spectral fitting (Figs.~\ref{fitsa} and \ref{fitsb}) imply the higher SSS count rate and luminosity in 2006, particularly after day 60, were due to a larger effective emitting surface compared with the recent 2021 eruption. There is no indication that the lower count rates in 2021 are caused by higher absorption, though we return to this possibility in Section~\ref{abs}. From the bullet points above, it is notable that many of the differences between the 2021 and 2006 X-ray spectral evolution results occur after day 60 -- that is, the time both X-ray light-curves showed a final monotonic fading, signifying the end of the nuclear burning. At earlier times, during the onset of the SSS phase, there is also a significant difference in the level of soft X-ray variability seen. \subsection{Differences in SSS related to quiescent interval?} While the {\em EXOSAT} dataset is much smaller than those of {\em Swift}, it is clear that there were very significant differences in the soft X-ray emission between the three RS~Oph eruptions, which followed quiescent intervals of around 18, 21 and 15.5~yr, respectively. M31N~2008-12a, the yearly recurrent nova in the Andromeda Galaxy, has been observed by {\em Swift} during every eruption since 2012. For the first four years of observations, the X-ray light-curves of M31N~2008-12a were very similar; the 2016 event was a surprise, though, showing a delayed start leading to a shorter and less luminous SSS phase \citep{henze18}. The optical light-curve, however, showed little variation from outburst to outburst, which is also the behaviour witnessed for the RS~Oph optical data. The inter-eruption time for M31N 2008-12a varies by $\sim$~15~per~cent, year on year \citep{darn16}, while still (except for 2016) showing a consistent SSS phase. \cite{henze18} suggest that the differences seen in 2016 (delayed eruption -- i.e., longer quiescent interval; earlier decline in the SSS emission) could be explained by a lower accretion rate, $\dot{M}_{\rm acc}$, between outbursts. This would have led to a lower mass disc, which was thus more disrupted by the nova explosion than the discs usually formed. A more thoroughly disrupted disc in turn leads to a longer delay before effective accretion restarts, hence shortening the SSS phase in this system. In the current case of RS~Oph, the 2006--2021 quiescent interval was {\it shorter} than 1985--2006; however, the 2021 SSS was nonetheless fainter. Thus the behaviour of RS~Oph does not replicate the longer quiescent interval/fainter SSS situation seen in M31N~2008-12a. There is also no strong sign of the mean accretion rate being different during the RS~Oph inter-eruption intervals (see Section~\ref{quiescence} below). \subsection{Quiescence} \subsubsection{Accretion rate and luminosity} \label{quiescence} Modelling by \cite{prialnik82} suggests that different accretion rates, $\dot{M}_{\rm acc}$, can lead to different accreted masses being required to initiate a TNR. If $\dot{M}_{\rm acc}$ is higher, both the accretion energy, and the rate at which the compressional energy is released, increases. This causes the temperature on the WD surface to increase more rapidly for a given amount of accreted mass, meaning that less mass needs to be accreted before the environment becomes hot enough to initiate a TNR. In such a situation (i.e., higher $\dot{M}_{\rm acc}$ over a shorter interval), we would expect a weaker nova explosion, with less material available to burn. Thus, if the accretion rate were higher during the 2006--2021 interval compared with 1985--2006, we could expect a less extreme eruption, with a shorter/weaker SSS phase in 2021. RS~Oph was intermittently observed by {\em Swift} between the 2006 and 2021 eruptions. Considering the 31.3~ks of data collected between 2009 Aug. and 2020 Jul. (days 1284--5269 after the 2006 eruption, during which time the X-ray count rate remained close to constant), the spectrum can be approximated with an optically-thin model, with kT~=~1.0~$\pm$~0.2~keV (C-stat/dof = 55/69). This spectrum has a 0.3--10~keV count rate of 4.0~$\times$~10$^{-3}$~count~s$^{-1}$ (well below the level observed just before the Sun constraint in 2021), which corresponds to a bolometric (unabsorbed) luminosity of $\sim$~6~$\times$~10$^{31}$~erg~s$^{-1}$. Such a measurement is in the same range as the quiescent luminosity determined from {\em ROSAT} observations between the 1985 and 2006 outbursts (\citealt{orio93}; see also estimates in \citealt{mukai08}). This suggests a consistent mass accretion rate during both quiescent periods -- though is by no means definitive, given the small number of observations being compared. A comparison of the AAVSO optical light-curves from 1985--2006 and 2006-2021 also shows no large differences during the inter-eruption periods. The optical magnitude does appear to brighten by up to a magnitude during the $\sim$~5~yr before each eruption, though. The mean quiescent visual magnitudes from these datasets are 11.3 (1985--2006) and 11.1 (2006-2021), each with a standard deviation of $\sim$~0.4. However, in general the disc luminosity is proportional to $\dot{M}_{\rm acc}$. A $\sim$~35~per~cent longer recurrence time up to 2006 would then suggest $\dot{M}_{\rm acc}$, and hence the disc luminosity, are $\sim$~35~per~cent lower, which equates to a change in magnitude of about 0.3. This would likely be swamped by the optical light from the donor star, so measuring such a change in the accretion rate in this manner would be tricky. Observations in the near UV band should be more informative. \cite{julo11} comment that this estimated quiescent X-ray luminosity is orders of magnitude lower than the expected inter-outburst accretion value of $\sim$~few~$\times$~10$^{36}$~erg~s$^{-1}$. \cite{mukai08} consider methods through which the expected quiescent X-ray emission could be suppressed. They concluded it unlikely that absorption could be the sole cause, since an unfeasibly high column would be required to hide emission over 2--10~keV. If the boundary layer between the accretion disc and WD surface were optically-thick, then softer X-rays would be emitted which could more easily be strongly absorbed, although an optically thick boundary layer is not expected in quiescence. \cite{nelson11} analyse observations obtained by {\em Chandra} and {\em XMM-Newton} 537--744 days after the 2006 eruption, finding the X-ray spectra can be modelled with a two-component plasma model (as we see here, underlying the SSS). Using this model, they determine an intrinsic accretion luminosity of 1--2~$\times$~10$^{35}$~erg~s$^{-1}$ from the boundary layer. They find that a combination of a complex (partial-covering) absorber and optically-thick emission from the boundary layer could indeed account for the apparently low quiescent luminosity measured. The X-ray flux at this time was still apparently following a power-law decline which started around day 100 post the 2006 eruption \citep{julo11,page20}, although considering the later light-curve as well, there were signs that the decline might have been ending; thus the interpretation of the flux as accretion-powered may not be secure. To summarise: the measured X-ray emission during quiescence provides no strong evidence for a difference in accretion rate between 1985--2006 and 2006--2021. A simple estimate of the accretion luminosities over these two quiescent intervals gives values orders of magnitude lower than expected, though this conflict might possibly be resolved if there is complex absorption in the system. \subsubsection{Accreted mass} The accreted mass required to trigger the TNR in RS~Oph is $\approx$~4.4~$\times$~10$^{-6}~\msun$ (\citealt{julo11}, following \citealt{truran86}), and a steady mass transfer over an interval of 21 yr will obviously lead to a greater build up of material than over only 15.5~yr. Although having less accreted material to burn might account for a fainter, or shorter-lived, SSS phase in 2021, it fails to explain why the nova did not erupt 5.5~yr before the 2006 event, when that same amount of material had been built up. Neither does it explain the fact that the optical evolution is identical, or that the turn-on time of the SSS phase is very similar. As discussed above, \cite{prialnik82} show that a higher accretion rates might lead to lower accreted masses being needed to trigger a TNR, but there is no strong evidence that $\dot{M}{_{\rm acc}}$ has varied significantly between the recent eruptions of RS~Oph. \cite{julo11} find that the mass burnt/ejected during the 2006 nova is likely only a few percent of the accreted envelope, and that the WD in the RS~Oph system is therefore gaining mass with time \citep[see also][]{hachisu07}. This mass gain during a single eruption cycle is, however, relatively small, and will not noticeably change the expected recurrence time. \subsection{[Fe\,{\sc x}]} \label{fe} As noted above, the [Fe\,{\sc x}] line is thought to mirror the evolution of the central source luminosity, and is therefore suggested to match up with the SSS emission seen in the X-ray band \citep[see discussion in][]{schwarz11}. From Section~\ref{soft}, the first hint of a soft excess in the 2021 X-ray spectrum was day 20.6, becoming significantly stronger from day 26.3. A monotonic decline in the X-ray flux set in after about day 60. These timings are loosely replicated by the changes in the [Fe\,{\sc x}] flux. While there are many fewer measurements available from 2006 than 2021, the [Fe\,{\sc x}] fluxes in Fig.~\ref{fex} align fairly well following the two eruptions. The 2021 [Fe\,{\sc x}] curve is much smoother than the soft X-ray emission we measured in 2021 (see also Fig.~\ref{lc}), and more reminiscent of the underlying shape of the 2006 X-ray light-curve. The [Fe\,{\sc x}] emission is believed to come from the body of the ejecta photoionized by the WD, and should generally be insensitive to occulting blobs of matter which would absorb the soft X-rays. The [Fe\,{\sc x}] evolution shown in Fig.~\ref{fex} suggests that the nuclear burning was again relatively steady throughout the 2021 eruption, and likely very similar in duration in both 2006 and 2021. This therefore does not seem to agree with the inferred decrease in the BB radius in 2021 corresponding to an earlier end to the nuclear burning, but rather suggests the SSS phase was the same both years. Note that the recombination timescale of [Fe\,{\sc x}] in this density environment will likely be a day or less \citep[][Munari et al. in prep]{opt5}, so cannot cause the differences seen. Fig.~5 of \cite{munari22} shows that the fluxes of the coronal lines [Fe\,{\sc x}], [Fe\,{\sc xi}] and [Fe\,{\sc xiv}] all begin to decline from their plateau phase around day 87 (seen as a steepening in the decay in Fig.~\ref{fex}, where we show the [Fe\,{\sc x}] flux in linear space), which strongly suggests the same power source (presumably the nuclear burning) switched off for them simultaneously, at which point the WD would start to cool. The shock breakout at the edge of the RG wind could also have an effect, however \citep{shore96a}. \subsection{Absorption} \label{abs} Looking solely at Fig.~\ref{lc}, one's first assumption might be that the lower soft flux in 2021 is due to greater absorption than in 2006. Excluding the interval of high-amplitude flux variability between days 30 and 40 \citep[which may itself be caused by clumpy ejecta;][]{julo11}, the 2021 observed flux is systematically much lower than in 2006 after day 45. This drop would require a large absorbing structure moving into view at this time, given that the 2021 flux is significantly lower for at least 40 days (about 10~per~cent of the binary orbit). If absorption were the cause of the 1985 X-rays being fainter, then the absorbing structure would need to be non-permanent, since the 1985 and 2006 eruptions occurred at similar orbital phases. The simulations by \cite{booth16} show a spiral accretion wake built up during the quiescent mass transfer, potentially positioned along our line of sight to the WD during the time of the 2021 eruption (around phase 0.72). In comparison, the 2006 nova took place at phase 0.26, where the simulations show a lower density. The 1985 eruption occurred around phase 0.32, closer to the 2006 viewing angle than 2021, but the X-ray emission measured in 1985 was even fainter than in 2021. \cite{booth16} do find their simulated structure to be clumpy, though, which could possibly account for this. Modelling by \cite{orlando09, drake09, walder08} also shows distinctly aspherical mass loss in the binary system, all indicating the absorption seen will likely depend on the phase of the orbit during the observations. \cite{shore93} and \cite{shore96a} investigated the UV spectra of recurrent novae, including RS~Oph following the 1985 outburst, finding differential absorption along the line of sight, and that the orbital modulation of the intensity of the ionizing source by the circumstellar medium can affect the strength of the emission lines. That is, no change in the photoionization source itself was needed to cause the spectral changes seen; rather, an aspect change in the line-of-sight opacity could explain the differences. Considering the more recent eruptions of RS~Oph, work by \cite{azz21} and Azzollini et al. (in prep.) finds that, although the optical photometric light-curves from 2006 and 2021 are the same, individual line fluxes (measured from the UVOT UV grism spectra) in 2021 are a factor of $\sim$~10--100 below the corresponding values in 2006. There is a chromatic dependence to this, with shorter wavelength lines showing larger decrements; this may be due to Rayleigh scattering -- the interaction of photons with bound electrons. That is, the neutral hydrogen, distributed around the emitting source, scatters the optical and UV line photons out of our view. Thus, if, in 2006, our line of sight passed through a more ionized region (for example, if the ionization of the wind is variable at different orbital phases), less Rayleigh scattering would occur, and higher line fluxes would be measured -- which is indeed the case. Whatever the simulations and modelling potentially show, however, the results from our spectral fitting do not obviously support significant differences in absorption. Figs.~\ref{fitsa} and \ref{fitsb} show that the fitted N$_{\rm H,wind}$ is largely consistent between the two eruptions, with the fainter 2021 data actually showing a {\em lower} column after day 60. This drop in N$_{\rm H,wind}$ after day 60 in 2021 could conceivably be related to the edge of the RG wind, established since the 2006 eruption. With the shorter recurrence interval, the wind has only had 15.5~yr of travel time, rather than the 21~yr prior to 2006. In 2006 this wind shock breakout time was found to occur around day 80 \citep{anupama08}. We considered a small sample of spectra where we have data on the same day post-eruption in both 2006 and 2021. In each case, the best-fit 2006 model was applied to the corresponding 2021 spectrum, with only the absorbing column density and edge depths allowed to vary. This assumes a simplified model, whereby the underlying SSS and shock emission were exactly the same at corresponding days in both 2006 and 2021, and the only difference was the intervening column. The resulting fits were statistically much worse ($\Delta$~C-stat $\sim$ 100--700), indicating these models are not acceptable, and it is unlikely we are seeing identical nuclear burning (temperature and strength), with only a change in N$_{\rm H,wind}$. The fit results in Figs.~\ref{fitsa} and \ref{fitsb} also imply that the emitting radius was smaller after around day 60 in 2021, though it is not clear whether this is caused by the ending of nuclear burning, or some other effect. The absorption fitted to the X-ray spectra presented here has been assumed to be neutral. If, instead, there is an ionized component as suggested by the optical/UV analysis, or the abundances are non-solar, this could affect the results. Indeed, the ionized He-like and H-like nitrogen and oxygen absorption edges are notably more significant in the 2006 X-ray spectral fits, which could be a sign of the differing ionization states observed. In summary, we find that the lower soft X-ray flux seen in 2021 compared with 2006 cannot readily be explained by an increase in simple neutral absorption. The investigation by \cite{nelson11} of post-eruption RS~Oph data suggests that the absorbing column(s) may be more complex, however. We reiterate that the inclination angle of the RS~Oph system is estimated to be in the range 30--52$^{o}$, which places constraints on the amount of absorption to which the accretion disc could lead. A paper analysing the much higher signal-to-noise {\em NICER} spectra is in preparation by Orio et al., and this may shed more light on the spectral complexities. \subsection{A Combination Nova?} \label{comb} The outbursts of RS~Oph have been suggested to be due to a dwarf nova (DN) disc instability, in which a burst of enhanced mass accretion triggers the outburst, rather than a TNR due to steady accretion during quiescence \citep{king09}, although a TNR-driven outburst is preferred \cite[see summary by ][for example]{obrien92}. A related suggestion is that RS~Oph is a `combination nova' \citep{sok06}. These are sources which show both dwarf and classical nova characteristics: eruptions in these systems start off as an accretion disc instability (as happens in DNe), leading to sufficient material being accreted to trigger the thermonuclear burning and mass ejection expected from a `normal' nova. \cite{alexander11} suggest that the outbursts in RS~Oph could be powered by an accretion dump due to a single disc instability, while the model by \cite{bollimpalli18} requires multiple DN events to provide the fuel more slowly to cause a TNR over the recurrence time observed. These disc instability events should be detectable in X-rays, yet no such events have been reported. However, dwarf nova outbursts can be faint, and RS~Oph is more distant than most DNe \citep[e.g., ][]{patterson11}. We also note that the model by \cite{bollimpalli18} requires the WD to have a significant magnetic field, as we discuss for the QPO. Could it therefore be that, in 2006, a disc instability led to a greater amount of material being dumped onto the WD than was the case in 2021 (or 1985)? This might explain the overall brighter SSS emission, and the fact that the integrated soft flux in 2006 was clearly larger than in 2021, and would side-step the problem of the accretion rate apparently being approximately consistent over the 21 and 15.5~yr inter-eruption intervals (as discussed in Section~\ref{quiescence}). As noted in that section, there is some indication that during the final five years before an eruption recurs, there is a slight brightening in the optical, possibly indicative of a change occurring in the accretion disc. Alternatively, it may suggest that energy from the incipient nuclear burning is reaching the surface some years before the actual thermonuclear runaway. Certainly this five year brightening interval is longer than the expected duration of a DN outburst, which is in the range of 50--550~day in the Bollimpalli models. Closer in time to each eruption than this, \cite{adamakis11} identify a pre-outburst signal in the optical light-curves of RS~Oph, up to $\sim$~450~d (one orbital period) before the subsequent nova, which they suggest may be caused by variable mass transfer. \cite{bollimpalli18} note that their combination nova model might explain this increase. It is still unclear whether the RG in RS~Oph fills its Roche Lobe \citep[though it seems likely it does, e.g.,][]{brandi09,booth16}, or if accretion onto the WD occurs via stellar wind capture -- or a combination of the two. While wind accretion does not {\em require} that an accretion disc exists, it also does not preclude one, and it is probable that there is a disc in the RS~Oph system \citep[see discussion by][]{wynn08}. Such a structure would naturally be required for any form of disc instability to occur. Following the 2006 eruption, \cite{worters07} concluded that accretion was likely re-established between days 117 and 241, a minimum of several weeks after the intervals we are comparing in the current work, based on the reappearance of optical flickering. However, as \cite{sok08} suggest, the earlier cessation of flickering noted by \cite{zamanov06} could just have been a sign of a change in the inner region of the accretion disc, rather than its complete destruction. \cite{booth16} also find that the disc survives the nova in most of their simulations. \cite{somero17} comment that their high-resolution optical spectroscopy of RS~Oph obtained 2--3~yr after the 2006 eruption did not show the double-peaked emission line profiles expected from an accretion disc, but note that this may be because the inclination of the system is too low. A difficulty with the combination nova model, however, is the fact that the optical light-curves are identical each time. The ejected mass (and hence the optical emission) following a nova explosion is very unlikely to be constant between eruptions spontaneously triggered in this manner. \subsection{QPO persistence} The fact that the QPO remains around 35~s during the distinctly different SSS phases following the two eruptions appears to be more consistent with a rotation explanation, rather than a pulsation mechanism \citep[see][for discussions about QPO provenance]{andy08, julo11, ness15,wolf18}. However, this begs the question of why the SSS is not emitting smoothly over the entire surface of the WD, as might typically be expected during a TNR. A possible explanation could be the presence of a magnetic field on the WD; this could manifest in a number of ways: \begin{itemize} \item The nuclear burning rate could be suppressed by the enhanced magnetic pressure at the poles, causing it to be lower. This is somewhat similar to the effect which leads to sunspots, whereby magnetic fields suppress the underlying convection, leading to cooler areas. Assuming the magnetic and rotational axes are misaligned, then this would lead to an observed flux modulation as the WD spins. \item If accretion is occurring during the SSS phase, the stream could be magnetically funnelled towards the polar regions, causing a nuclear burning hotspot which would move in and out of view as the WD rotates. For examples of SSS with probable signs of magnetic field confinement, see \cite{king02,aydi18,drake21}. V1500~Cyg was a nova outburst on a highly magnetised WD, where a probable hotspot of enhanced nuclear burning occurred \citep{stockman88}. \cite{shara82} discusses localised TNRs in more detail. If the luminosity is (super-)Eddington, however, accretion is not expected - at least, not fully spherical accretion. \end{itemize} In both of these possible cases, the majority of the SSS emission would come from the TNR spread over the full WD surface, with only small areas affected by magnetic fields leading to the detected modulation \citep[see discussion in ][]{aydi18}. While we are unaware of independent measurements of a magnetic field in RS~Oph, coherent X-ray modulation is usually taken as sufficient evidence for this in accreting systems, and one is assumed in the model by \cite{bollimpalli18}, as mentioned in Section~\ref{comb}. A simple rotation effect would imply a fixed period, rather than one which varies, albeit slightly, as shown by the coherence measurements (although a low coherence can also indicate that the phase of the oscillation is changing, leading to a broader QPO signal, while the period remains fixed. This was seen during the 2006 eruption of RS~Oph; Beardmore et al. in prep.). Cal~83 \citep{crampton87, vandenheuvel92} is a persistent SSS: a WD accreting at a sufficiently high rate such that (quasi-)steady hydrogen burning occurs \citep{kahabka97}. This source also shows a QPO ($\sim$~67~s), and \cite{odendaal14} suggested that the X-rays might originate from an extended atmosphere, only loosely coupled to the WD, so allowing differential, non-synchronous rotation \citep[see also][]{warner02}. \subsection{Post-SSS emission} After several months in Sun constraint, late-time observations of RS~Oph by {\em Swift} were obtained in 2022 Feb.--Apr. Fig.~\ref{late} shows that, at this time, the 2021 and 2006 eruption X-ray light-curves and hardness ratios are in good agreement. The X-ray spectrum now shows little evidence for any residual SSS emission, so the underlying shock continuum continues to be the same almost 200 days post eruption. As first suggested by \cite{krautter96} for V1974~Cyg, and later discussed by \cite{julo11} for RS~Oph in 2006, the X-rays seen during the decline from SSS peak may come from energy radiated as the remaining extended WD atmosphere undergoes gravitational contraction, and relaxes back onto the WD surface. \begin{figure} \begin{center} \includegraphics[clip, angle=-90, width=8cm]{all-lc_star_newest.ps} \caption{0.3--10~keV light-curves from 2006 and 2021, including the post-SSS data. The red stars highlight the post-Sun-constraint observations in 2022 Feb.-Apr.} \label{late} \end{center} \end{figure} \section{Summary} RS~Oph re-erupted in 2021, 15.5~yr after the previous nova event, and was monitored in detail by the {\it Neil Gehrels Swift Observatory} both times, the first Galactic recurrent nova for which this has been possible. Lessons learnt from the first eruption led to the 2021 hard emission being monitored earlier and more frequently than in 2006, while the SSS phase was again followed closely. In this paper we have compared the X-ray emission from these outbursts, together with another observed by {\em EXOSAT} in 1985. The overall optical light-curves were very similar in 2006 and 2021, suggesting the WD mass, ejecta mass, ejecta velocity distribution and ejecta geometry have remained the same. The harder X-ray emission also indicates the ejecta and immediate circumstellar environment parameters have not changed significantly, since the shocks were very similar both times. The consistency in the 2006 and 2021 outbursts of the [Fe\,{\sc x}] evolution is likely caused by a very similar duration, and luminosity, of nuclear burning. The observed soft X-ray emission, however, was much brighter in 2006, with the ratio of the observed integrated soft X-ray counts being around 4--5$\times$ higher than in 2021. This is a much larger factor than the difference in the quiescent intervals, so is unlikely to be due to a simple change in accreted mass. There is no clear sign of a change in accretion rate during the inter-eruption intervals, either. While a higher absorbing column in 2021 would seem to be a simple explanation for the fainter X-rays detected, the fits to our spectra do not support this, with the measured N$_{\rm H,wind}$ being very similar in both 2006 and 2021 until day 60. A notable difference to come out of the spectral fitting, however, is a smaller BB emitting area in 2021 from around two months after the eruption. It is not immediately obvious whether this smaller radius is related to the expected shrinking of the bloated WD atmosphere as nuclear burning comes to an end, since the [Fe\,{\sc x}] measurements imply the nuclear burning duration is similar for both eruptions. There is also a brief, earlier interval around day 53 in 2021, at the time when the observed soft flux decreased, where we also see a temporary drop in the effective BB radius. Given that the differing optical and UV line fluxes may lean towards the ionization along our line of sight to RS~Oph in 2006 being enhanced compared with 2021 (the orbital phases at the start of the two eruptions were almost 180$^{\circ}$ apart), it seems possible that our assumption of neutral absorption in the X-ray band may be an over-simplification. In summary, while the optical magnitude, [Fe\,{\sc x}] and hard X-ray light-curves appear very similar following both 2006 and 2021 eruptions, the observed soft X-ray emission was found to be much brighter in 2006 than in 2021 or 1985. We have explored some possible explanations for the difference in the supersoft phase, but our modelling of the {\em Swift}-XRT data does not provide any definitive conclusions. A reduced nuclear burning luminosity could explain the fainter X-rays in 2021 compared with 2006, although the [Fe\,{\sc x}] line emission suggests a similar luminosity both times. If indeed the luminosity was consistent following the separate eruptions, then the SSS X-ray emission in the line of sight must be partly blocked, though the mechanism for this is unclear. Looking ahead to the next RS~Oph eruption, it is likely that Athena\footnote{Advanced Telescope for High Energy Astrophysics} will have launched, and should be able to obtain high resolution, high signal-to-noise X-ray spectra. In general, UV and X-ray spectra in the late phase of the outburst will help to shed more light on the evolution of the nova ejecta; the proximity to the Sun during this latest event precluded this. \section{Data availability} The X-ray data underlying this article are available in the {\em Swift} archive at \url{https://www.swift.ac.uk/swift\_live/} and the HEASARC Browse archive at \url{https://heasarc.gsfc.nasa.gov/cgi-bin/W3Browse/w3browse.pl}. \section*{ACKNOWLEDGEMENTS} \label{ack} We thank the {\it Swift} PI, and Science and Mission Operations Teams for their continuing support. KLP, APB, PAE and NPMK acknowledge funding from the UK Space Agency. MJD acknowledges funding from the UK Science and Technology Facilities Council. This work made use of data supplied by the UK Swift Science Data Centre at the University of Leicester.
\section{Introduction - Living Lab Concept} Living Lab - a term that was first used at the Massachusetts Institute of Technology (MIT). It proposes a research methodology that is not only user-centred but “carried by the users” permitting the formulation, prototyping and validation of complex solutions in a multifaceted real-life environment\cite{businessModelSmartCity}. It is estimated that as much as 85\% of the problems with new products and analysis pipelines originate from a poor design process \cite{RajivGrover}; enterprises carrying out product development are under constant pressure to improve their design processes to stay competitive in an ever demanding competitive market. Simultaneously, the necessity for a more cost-effective and quick development of products, services and applications in the majority of these businesses remains inevitable. However, a significant number of well-developed technologies are lacking a sufficiently marketable application or service and only 15\% of product development time is invested in products which reach the real market to actual users. In order to achieve faster return on investment, developments are often based solely on technological possibilities, not on the actual needs of customers. A result of this practice, only 18\% of the innovations brought into the market prove sustainably successful \cite{Cappellin2009}. It follows that in order to reduce risks in the product development process, customers and other stakeholders need to be more directly integrated. One concept for such integration is that of Living Labs. It is a systemic innovation approach in which all stakeholders in a product, service or application participate directly in the development process. It refers to a research and development (R\&D) methodology in which innovations are created and validated collaboratively in multi-contextual, empirical real-world environments. The individual is in the focus in his or her role of as, for example, a citizen, consumer or worker. In Living Labs, collaborative Information and Communication Technologies (ICT) provide the basis for targeted customer-centred development. Given new possibilities to participate in emerging value networks, he or she can act as much as a producer than as a consumer. \section{Components of a Living Lab} \subsection{Design Thinking to Actual Conceptualization} Living Lab is an umbrella concept used for a diverse set of innovation milieus emerging all over the world. Even though they differ in many ways, both in focus and approach, there also exits a few common denominators pulling them all together \cite{LivingLabsAndUserEngagement}. In order to create a joint venture, coordinate activities, and share learning experiences, a European Network of Living Labs has developed. The aim of the network is to offer a gradually growing set of networked services to support the "Innovation Lifecycle" for all actors in the system: end-users, SMEs, corporations, the public sector, and academia \cite{Schumacher2007LivingL}. Figure 1, shows some of the main components of the Living Lab. The development flow is divided into 3 main sub-blocks, Conceptualization--Evaluation--Product Prototype Delivery \\The first part deals with from Evaluation of concepts, to generating needs and Planning. The second part is the Design prototyping and evaluation of the concept under study and finally the third and the final step is the delivery of the product prototype for user testing and hence commercialisation. One of the key components of the Living Lab is the real-life environment test. Testing a data service pipeline or a prototype product in a realistic looking condition and test-bench environment. This allows for a long term technical solutions to be drawn up that will be sustainable and full of value both from the developer and user aspect. \begin{figure}[ht] \includegraphics[width=\textwidth]{LivingLabComponents} \caption{Components of A Living Lab} \label{fig:figure1} \end{figure} \subsection{Evaluation and Prototyping} The other pillar of the Living Lab is the principle of co-creation. In a Living Lab, users are not simply the end-users but a community of people interacting with the final product or services. This concept includes not only end users but also upstream users and secondary users. At this step the actual evaluation of the device starts along with building the analysis framework, which can be based on virtual to actual prototyping to support the comprehensive evaluation of the system under consideration. This type of framework enables functional and timely verification of the prototype under consideration. Performance and reliability analysis is another important aspect to be considered while reducing the computational and economic cost. Additionally design space exploration both in terms of hardware and software of the over all system takes precedence. \subsection{Final Product Prototyping to Commercialisation} From a business perspective, it is useful to perceive Living Labs as providing a set of distinct services to their customers. The product which comprises of sensors and the associated data manipulation pipeline is being developed and benchmark-ed, needs to be properly packaged leading to commercialising. In this regard, the customers are for example, SMEs, industry, research or public and civic organisations along with the actual people using and evaluation the product. At this stage the services offered by the living lab can be looked upon as a core set of co-creation services supported by services for both integration and data preparation. \section{Application to health care facility} There exists many living labs that are currently active in healthcare innovation for assisted living. The focus of such living lab is the acceptance and use of Internet of Things(IOT) based cyber physical systems (sensors) to support both elderly people and people with chronic condition, which is also known as ambient assisted living. The aim is to build and enhance living CAPABILITY of the people under consideration which allows them to live independently at home longer, through the use of automated smart home devices. Inclusion of eHealth based apps are also integrated in the environment. The tasks involved are communication, protection through observation and safety using sensors, smart camera based monitoring systems and safety alarms. There remains a possibility to increase the in-house participation in fitness activities and safe sports. Integration of eHealth allows the user to be continuously monitored by keeping a tab on their vital health statistics like, blood pressure monitoring, blood sugar level, heart rate monitoring devise etc., from a distance. \section{Challenges} As stated in the introduction section, new proven and efficient strategies need to be adopted to both improve the design process of new products, pipelines and services. Simultaneously achieving a better product development time and successfully marketing the products packed with the associated pipeline should be the final goal. Some other challenges associated to this issue is integration of infrastructure, the alignment of methodological aspects and convergence of policy factors. With respect to methodological aspects, the key factor of differentiation of a Living Lab in comparison to other forms of co-operation, such as cluster of virtual breeding environments, is the direct involvement of users. So, the real challenge may lie in involving and convincing users in a sociological sense, which cab be only done effectively by taking into account the micro-context of their everyday lives. Significant research effort must be allocated to the development of both methodologies and supporting tools which enable such integration in the most un-obstructive way possible. Effective and timely interaction with the end users without violating ethics is another challenge in terms of user acceptability of the experiments to be performed on the platform. Another challenge is to bring co-creating users together and build a technological platform such as a Collaborative Working Environment (CWE) for the support co-creating process must receive a higher task priority. Such an efficient environment will be required to support all the creative stake holders. This bring us to the most important part of the discussion, which is the protection and implementation of the IPR (Intellectual Property Right). As private persons become a source of ideas and innovations, an appropriate rewarding and incentive mechanism needs to be put in place which simultaneously secures pay-back to all the actors involved whilst adopting fair and suitable mechanisms for the handling of IPR and other ethical issues. According to \cite{Goodpractices}, research is furthermore required in order to create comprehensive models and methods by which experiments can be analysed and values measured to protect infringements. \printbibliography \end{document}
\section{Introduction}\label{sec:introduction} Explainability in AI (XAI) is critical in reaching various objectives during a system’s development and deployment, including debugging the system, ensuring its fairness, safety and security, and understanding and appealing its decisions by end-users \citep{vaughan2021human,luo2021local}. A popular class of local explanation techniques is feature attribution methods, where the aim is to provide scores for each feature according to how important that feature is for the classifier decision for a given input. From an intuitive perspective, one issue with feature attribution scores is that it is not always clear how to interpret the assigned importance in operational terms. Specifically, saying that a feature is `important' might translate to two different predictions. The first interpretation is that if an important feature value is changed, then the prediction will change. The second interpretation is that, as long as the feature remains, the prediction will not change. The former interpretation corresponds to the \textit{necessity} of the feature value, while the latter corresponds to its \textit{sufficiency}. To further illustrate the difference between necessity and sufficiency, we take an example from hate speech detection. Consider the utterance ``I hate women''. For a perfect model, the token `women' should have low sufficiency for a positive prediction, since merely the mention of this identity group should not trigger a hateful prediction. However, this token should have fairly high necessity, since a target identity is required for an abusive utterance to count as hate speech (e.g., ``I hate oranges'' should not be classified as hate speech). In this paper, we develop a method to estimate the necessity and sufficiency of each word in the input, as explanations for a binary text classifier's decisions. Model-agnostic feature attribution methods like ours often perturb the input to be explained, obtain the predictions of the model for the perturbed instances, and aggregate the results to make conclusions about which input features are more influential on the model decision. When applying these methods to textual data, it is common to either drop the chosen tokens, or replace them with the mask token for those models that have been trained by fine-tuning a masked language model such as BERT \citep{devlin2019bert}. However, deleting tokens raises the possibility that a large portion of the perturbed examples are not fluent, and lie well outside the data manifold. Replacing some tokens with the mask token partially remedies this issue, however it raises others. Firstly, the explanation method ceases to be truly model-agnostic. Secondly, a masked sentence is in-distribution for the pre-trained model but out-of-distribution for the fine-tuned model, because the learned manifolds deviate from those formed during pre-training in the fine-tuning step. To avoid these problems we use a generative model to \textit{replace} tokens with most probable $n$-grams. Generating perturbations in this way ensures that the perturbed instances are close to the true data manifold. It also provides an additional layer of transparency to the user, so they can decide whether to trust the explanation by checking how reasonable the perturbed examples seem. Although supervised discriminative models rely fundamentally on correlations within the dataset, different models might rely on different correlations more or less depending on model architecture and biases, training methods, and other idiosyncrasies. To capture the distinction between correlations in the data and the direct causes of the prediction, we turn to the notion of \textit{interventions} from causal inference \citep{pearl2009causality}. Previous work employing causal definitions of necessity and sufficiency for XAI have assumed tabular data with binary or numerical features. The situation in NLP is much more complex, since each feature is a word in context, and we have no concept of `flipping' or `increasing' feature values (as in binary data and numerical data, respectively). Instead, our method generates perturbations of the input text that have high probability of being fluent while minimizing the probability that the generated text will also be a direct cause of the prediction we aim to explain. As our application domain we choose hate speech detection, a prominent NLP task with significant social outcomes \citep{fortuna2018survey,kiritchenko2021confronting}. It has been shown that contemporary hate speech classifiers tend to learn spurious correlations, including those between identity terms and the positive (hate) class, which can result in further discrimination of already marginalized groups \citep{dixon2018measuring, park2018reducing,garg2019counterfactual}. We apply our explainability metrics to test classifiers’ fairness towards identity-based groups (e.g., women, Muslims). We show how necessity and sufficiency metrics calculated for identity terms over hateful sentences can explain the classifier’s behaviour on non-hateful statements, highlighting classifiers' tendencies to over-rely on the presence of identity terms or to ignore the characteristics of the object of abuse (e.g., protected identity groups vs. non-human entities). The contributions of this work are as follows: \begin{itemize \item We present the first methodology for calculating necessity and sufficiency metrics for text data as a feature attribution method. Arguably, this dual explainability measure is more informative and allows for deeper insights into a model's inner workings than traditional single metrics. \item We use a generative model for producing input perturbations to avoid the out-of-distribution prediction issues that emerge with token deletion and masking techniques. \item To evaluate the new methodology, we apply it to the task of explaining hate speech classification, and demonstrate that it can detect and explain biases in hate speech classifiers. \end{itemize} We make the implementation code freely available to researchers to facilitate further advancement of explainability techniques for NLP.\footnote{\url{https://github.com/esmab/necessity-sufficiency}} \section{Background and Related Work} Explanations are often categorized as to whether they are for an individual prediction (local) or for the model reasoning as a whole (global), and whether the explanation generation is a part of the prediction process (self-explaining) or generated through additional post-processing (post-hoc) \citep{Guidotti2018, adadi2018peeking}. The necessity and sufficiency explanations presented here belong to the class of local explanation methods, as do most of the XAI methods applied to NLP data \citep{danilevsky2020survey}. It is also a post-hoc method to the degree that it is entirely model-agnostic: all it requires is binary predictions on provided inputs. There are a few classes of popular techniques for explaining natural language processing models (see \citet{danilevsky2020survey} for a survey). One approach is \textit{feature attribution methods} that allocate importance scores to each feature. These can be architecture-specific \citep{bahdanau2015neural, sundararajan2017axiomatic}, or model-agnostic \citep{ribeiro2016should, lundberg2017unified}. Another approach is \textit{counterfactual explanations}, which provide similar examples to the input in order to show what kinds of small differences affect the prediction of the model \cite{wu2021polyjuice,kaushik2021explaining,ribeiro2020beyond,ross2020explaining}. These contrastive examples are related to the concept of counterfactual reasoning from the causality literature, that formalizes the question: \textit{``Would the outcome have happened if this event had not occurred?''} in order to determine whether the event was a cause of the observed outcome \cite{pearl2009causality}. Counterfactual explanation methods are often targeted at certain semantic or syntactic phenomena such as negation \citep{kaushik2021explaining} or swapping objects and subjects \citep{zhang2019paws}, and hence do not guarantee that the counterfactuals cover the data distribution around the input text well. In this work, we combine methods from feature attribution and counterfactual generation models. This allows us to calculate scores that capture local feature importance, and provide counterfactual examples as justification for the assigned scores. \paragraph{Necessity and sufficiency.} These are two notions from causal analysis that capture what one intuitively expects a true cause of an event to exhibit \citep{pearl2009causality, halpern2016actual}. Several works have recently suggested applying necessity and sufficiency to explain model predictions. \citet{mothilal2021towards} used the \textit{actual causality} framework of \citet{halpern2016actual} to calculate necessity and sufficiency scores for tabular data. \citet{galhotra2021explaining} suggested an approach to capture the notions of necessity and sufficiency from probabilistic causal models \cite{pearl2009causality}. \citet{watson2021local} presented a different method for quantifying necessity and sufficiency over subsets of features. We follow the framework of probabilistic causal models, and adopt the definitions from \citet{galhotra2021explaining}. In NLP explanations, necessity and sufficiency have been used for evaluating rationales \citep{zaidan2007using, deyoung2020eraser, mathew2021hatexplain}\footnote{The term \textit{comprehensiveness} is often used instead of \textit{necessity} in this context.}, however to the best of our knowledge, this is the first work to explore their usage for estimating feature attribution scores. \paragraph{The out-of-distribution problem in feature attribution models.} Virtually all model-agnostic feature attribution models calculate importance scores by perturbing input features and assign importance according to which feature changes the outcome the most. However, an issue has been raised that these perturbed inputs are no longer drawn from the data distribution that the model would naturally encounter for a given task \citep{fong2017interpretable, chang2018explaining, hooker2019a, janzing2020feature, hase2021the}. This is problematic because then, any change in the model predictions could be caused by the distribution shift rather than the removal of feature values \citep{hooker2019a}. Recently, \citet{hase2021the} have argued that the problem is due to \textit{social misalignment} \citep{jacovi2021aligning}, where the information communicated by the model differs in non-intuitive ways from the information people expect. One solution to address these issues is to calculate importance scores by marginalizing over counterfactuals that respect the data distribution. \citet{kim2020interpretation} and \citet{harbecke2020considering} adopted this approach and targeted text data specifically by marginalizing over infills generated by BERT. In our preliminary experiments, this resulted in the model putting an overwhelmingly high probability mass to one or few very common words, making the generated perturbations relatively non-diverse.\footnote{Making the softmax scores more distributed across the vocabulary results in unpredictably disfluent infills.} As \citet{pham2021double} also pointed out, BERT is very good at guessing the masked word, doing so correctly about half of the time. This behaviour results in assigning low importance to highly predictable words regardless of their true importance. For this reason, we choose to use a generative language model to infill masked sections with $n$-grams. Our mask-and-infill approach is similar to that of \citet{wu2021polyjuice} and \citet{ross2021explaining}, who used fine-tuned causal language models to infill masked sections of text with variable length sequences. \citeauthor{ross2021explaining} also used the contrasting label to condition the generative model. However, both these works aim to find counterfactual examples as explanations, while we marginalize over them to calculate necessity and sufficiency of each token. \section{Our Method} A central idea in causal inference is that of \textit{intervention}, where a random variable is intervened on and set to a certain value. The intuition is that, if a random variable is the cause of another, then intervening on the first one should affect the other, whereas if they are correlated by other means then the intervention should not have an effect. \paragraph{Necessity.} Let $X \leftarrow a$ denote that the random variable $X$ has been intervened so that $X = a$. When talking about a feature vector $x$, we will denote by $x_{i \leftarrow a}$ that we intervene on the $i$th feature value and set it to $a$. For an input with features $x$ where $x_i = a$, the necessity of $x_i = a$ for the model prediction $f(x) = y$ is defined as: \begin{align*} \mathit{N_{x_i, y}} {\small=} P_{c\sim \mathcal{D}_n(x)} (f(c_{i \leftarrow a'}) {\small=} y' | c_i = a, f(c) = y) \end{align*} where $a'$ is an alternative feature value such that $a' \neq a$ and $y'$ is an alternate outcome such that $y' \neq y$. $\mathcal{D}_{n}(x)$ is a distribution that covers the neighborhood of $x$, and can be defined according to the data and the implementation. In words, $x_i = a$ has high necessity for the prediction $y$ if, for those points in the neighborhood of $x$ that also have the value $a$ for the $i$th feature and the same model prediction $y$, changing the $i$th feature value from $a$ to $a'$ changes the prediction from $y$ to $y'$ with high probability. \paragraph{Sufficiency.} The sufficiency of $x_i = a$ for the model prediction $f(x) = y$ is defined as: \begin{align*} \mathit{S_{x_i, y}} {\small=} P_{c\sim \mathcal{D}_{s}(x)}(f(c_{i \leftarrow a}) = y | c_i = a', f(c) = y') \end{align*} This means that if $x_i = a$ has high sufficiency for the outcome $y$, then for inputs in the neighborhood of $x$ that differ in the $i$th feature value, changing $i$th feature value to that of $a$ will flip the prediction to $f(x) = y$. \paragraph{Interventions.} Previous works applying notions of necessity and sufficiency from causal inference to XAI assume tabular data. This makes it relatively straightforward to apply these measures to the features since \textit{a)} it is clear how to assess and compare the $i$th feature of each input and \textit{b)} there is little ambiguity in how to change one feature value to another. Both these are issues for NLP data, where each feature is a token in the context of the wider text. We argue that the replacements should reflect the likelihood of natural data, but should still be distinct from purely observational correlations in task-specific aspects. To achieve this balance, we sample the replacement values $a'$ conditioned both on the other parts of the text and on the opposite class $y'$. If there are two features $x_i = a$ and $x_j = b$ that are both correlated with the outcome $y$, the intervention $x_{i\leftarrow a'}$, where $a'$ is sampled in this way results in $a'$ being still plausible with respect to the context $x_j = b$, but removes the potential indirect effect that $x_j = b$ causes $x_i = a$, which causes $f(x) = y$. This allows us to distinguish which of the correlated features the model relies on more for a given prediction. \paragraph{Estimation.} The formulae for necessity and sufficiency suggest a naive implementation of sampling first from the neighborhood of the input, picking those samples that conform to the conditions, and intervening on the feature of interest and marginalizing over the model predictions to calculate the final value. To perform these steps for each token in a sentence is prohibitively expensive. We therefore perform interventions on subsets of tokens at once, so that one perturbation can be used in the necessity and sufficiency estimation of multiple tokens. We estimate the necessity of a token by perturbing subsets of tokens containing the given token and calculating the average change in model prediction, weighted according to the size of the subset. For calculating necessity, we marginalize over $f(c_{i \leftarrow a'})$ where $c = x_{j_1 \leftarrow b_1, \cdots j_k \leftarrow b_k}$ for a random subset of features $x_{j_1}, \cdots, x_{j_k}$, not including the original feature $i$. This means that in our implementation, $\mathcal{D}_n(x)$ is an interventional distribution around $x$ rather than an observational one. In practice, we estimate a simplified version of this value where we do not explicitly condition on $f(c) = y$ in order to perform the estimation efficiently. We consider the instances where only one or a few tokens are perturbed to have higher probability in $\mathcal{D}_n(x)$. As such, the weight assigned to a sample with $k$ perturbed tokens is proportional to $1/k$. This means that the difference between the original and the perturbed instance is attributed to each perturbed token equally. For estimating sufficiency we take the dual approach. We perturb subsets of tokens \textit{excluding} the target token, and calculate the difference between the weighted average of the model predictions and the baseline prediction. Here too, $\mathcal{D}_s(x)$ is an interventional distribution where each sample $c = x_{i \leftarrow a', j_1 \leftarrow b_1, \cdots j_k \leftarrow b_k}$ for the focus feature $x_i$ and a subset of other features $x_{j_1}, \cdots, x_{j_k}$. Even though we do not explicitly condition on $f(c) = y'$, $\mathcal{D}_s(x)$ is biased towards such $c$ because the interventions are conditioned on $y'$. For a sequence of length $n$, the weight assigned to an instance where $k$ tokens are perturbed is $1/(n-k)$. This means that for an perturbed example that contains only a single token from the original instance, the difference from the baseline will be attributed entirely to that token, whereas if there is $k$ original tokens, the attribution is shared between them. Note that $\mathcal{D}_s(x)$ still assigns a higher probability mass to instances closer to $x$, but is less peaked than $\mathcal{D}_n(x)$. \begin{comment} \begin{figure*} \centering \small \begin{tikzpicture} \node (sentence) {``I hate \underline{women}''}; \node[above=1.75cm of sentence] (dummyabove) {} \node[below=1.75cm of sentence] (dummybelow) {} \node[box, right=1.2cm of dummyabove] (box11) {``I {[}MASK{]} {[}MASK{]}'' \\ ``I hate {[}MASK{]}'' \\ ``I hate {[}MASK{]}'' \\ $\vdots$\\``{[}MASK{]} hate {[}MASK{]}'' \\ ``I hate {[}MASK{]}'' \\ ``I {[}MASK{]} {[}MASK{]}''}; \node[box, right=0.7cm of box11] (box12) {``I don't know.'' \\ ``I hate her.'' \\ ``I hate how illiterate the administrators are.'' \\ $\vdots$\\ ``And yet you come and hate me.'' \\ ``I hate how it is sometimes.'' \\ ``I'm really confused.''}; \node[box, right=1.2cm of dummybelow] (box21) {``I {[}MASK{]} women.'' \\ ``{[}MASK{]} hate women.'' \\ ``{[}MASK{]} {[}MASK{]} women.''\\ $\vdots$\\ ``{[}MASK{]} {[}MASK{]} women.'' \\ ``{[}MASK{]} {[}MASK{]} women.'' \\ ``I {[}MASK{]} women.''}; \node[box, right=0.7cm of box21] (box22) {``I do not understand women.'' \\ ``'Please hate women.'' \\ ``I am so excited to see more women.''\\ $\vdots$\\ ``'He aint blind to women.'' \\ ``lol, i hate women.'' \\ ``I shouldn't harass women.''}; \node[preds, right=0.7cm of box12] (box13) {\hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} \\ $\vdots$ \\ \hlred{hateful} \\ \hlgreen{non-hate} \\ \hlgreen{non-hate} }; \node[preds, right=0.7cm of box22] (box23) {\hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} \\ $\vdots$ \\ \hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} }; \node[above=0.53cm of box11](masking){MASKING}; \node[above=0.2cm of box12](infilling){INFILLING}; \node[above=0.39cm of box13](prediction){PREDICTION}; \node[right=0.7cm of box13] (necc) {0.67}; \node[right=0.7cm of box23] (suff) {0.33}; \draw[arrow,in=180,out=90] (sentence.north) to node[above, left=0.25cm] {\textit{necessity}} (box11.west); \draw[arrow,in=180,out=-90] (sentence.south) to node[below, left=0.25cm] {\textit{sufficiency}} (box21.west); \draw[arrow] (box11.east) to (box12.west); \draw[arrow] (box21.east) to (box22.west); \draw[arrow] (box12.east) to (box13.west); \draw[arrow] (box22.east) to (box23.west); \draw[arrow] (box13.east) to (necc.west); \draw[arrow] (box23.east) to (suff.west); \end{tikzpicture} \caption{An illustration of how necessity and sufficiency are calculated for a chosen token ``\underline{women}'' in the input ``I hate women'' that the model classifies as hateful. In the MASKING step, the subsets of tokens are masked. For the necessity calculation the masked tokens always include the focus word, and for sufficiency they always exclude it. In the INFILLING step, the generative language model is used to infill the masked sections with $n$-grams of various lengths. These are then passed to the classifier. The necessity is the proportion of instances where changing the token changes the prediction, and sufficiency is the proportion of instances where changing other tokens does not change the original prediction. The infills are real examples generated by our method.} \label{fig:perturbations} \end{figure*} \end{comment} \begin{figure*} \centering \small \begin{tikzpicture} \node (sentence) {``\textcolor{teal}{I hate} \underline{\textcolor{darkblue}{women}}''}; \node[above=1.75cm of sentence] (dummyabove) {} \node[below=1.75cm of sentence] (dummybelow) {} \node[box, right=1.2cm of dummyabove] (box11) {``\textcolor{teal}{I} {[}MASK{]} {[}MASK{]}'' \\ ``\textcolor{teal}{I hate} {[}MASK{]}'' \\ ``\textcolor{teal}{I hate} {[}MASK{]}'' \\ $\vdots$\\``{[}MASK{]} \textcolor{teal}{hate} {[}MASK{]}'' \\ ``\textcolor{teal}{I hate} {[}MASK{]}'' \\ ``\textcolor{teal}{I} {[}MASK{]} {[}MASK{]}''}; \node[box, right=0.7cm of box11] (box12) {``\textcolor{teal}{I} don't know.'' \\ ``\textcolor{teal}{I hate} her.'' \\ ``\textcolor{teal}{I hate} how illiterate the administrators are.'' \\ $\vdots$\\ ``And yet you come and \textcolor{teal}{hate} me.'' \\ ``\textcolor{teal}{I hate} how it is sometimes.'' \\ ``\textcolor{teal}{I}'m really confused.''}; \node[box, right=1.2cm of dummybelow] (box21) {``\textcolor{teal}{I} {[}MASK{]} \textcolor{darkblue}{women}.'' \\ ``{[}MASK{]} \textcolor{teal}{hate} \textcolor{darkblue}{women}.'' \\ ``{[}MASK{]} {[}MASK{]} \textcolor{darkblue}{women}.''\\ $\vdots$\\ ``{[}MASK{]} {[}MASK{]} \textcolor{darkblue}{women}.'' \\ ``{[}MASK{]} {[}MASK{]} \textcolor{darkblue}{women}.'' \\ ``\textcolor{teal}{I} {[}MASK{]} \textcolor{darkblue}{women}.''}; \node[box, right=0.7cm of box21] (box22) {``\textcolor{teal}{I} do not understand \textcolor{darkblue}{women}.'' \\ ``'Please \textcolor{teal}{hate} \textcolor{darkblue}{women}.'' \\ ``I am so excited to see more \textcolor{darkblue}{women}.''\\ $\vdots$\\ ``'He aint blind to \textcolor{darkblue}{women}.'' \\ ``lol, i hate \textcolor{darkblue}{women}.'' \\ ``\textcolor{teal}{I} shouldn't harass \textcolor{darkblue}{women}.''}; \node[preds, right=0.7cm of box12] (box13) {\hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} \\ $\vdots$ \\ \hlgreen{non-hate} \\ \hlgreen{non-hate} \\ \hlgreen{non-hate} }; \node[preds, right=0.7cm of box22] (box23) {\hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} \\ $\vdots$ \\ \hlgreen{non-hate} \\ \hlred{hateful} \\ \hlgreen{non-hate} }; \node[above=0.53cm of box11](masking){MASKING}; \node[above=0.2cm of box12](infilling){INFILLING}; \node[above=0.39cm of box13](prediction){PREDICTION}; \node[right=0.7cm of box13] (necc) {0.83}; \node[right=0.7cm of box23] (suff) {0.33}; \draw[arrow,in=180,out=90] (sentence.north) to node[above, left=0.25cm] {\textit{necessity}} (box11.west); \draw[arrow,in=180,out=-90] (sentence.south) to node[below, left=0.25cm] {\textit{sufficiency}} (box21.west); \draw[arrow] (box11.east) to (box12.west); \draw[arrow] (box21.east) to (box22.west); \draw[arrow] (box12.east) to (box13.west); \draw[arrow] (box22.east) to (box23.west); \draw[arrow] (box13.east) to (necc.west); \draw[arrow] (box23.east) to (suff.west); \end{tikzpicture} \caption{An illustration of how necessity and sufficiency are calculated for a chosen token ``\underline{women}'' in the input ``I hate women'' that the model classifies as hateful. In the MASKING step, the subsets of tokens are masked. For the necessity calculation the masked tokens always include the focus word, and for sufficiency they always exclude it. In the INFILLING step, the generative language model is used to infill the masked sections with $n$-grams of various lengths. These are then passed to the classifier. The necessity is the proportion of instances where changing the token changes the prediction, and sufficiency is the proportion of instances where changing other tokens does not change the original prediction. The infills are real examples generated by our method.} \label{fig:perturbations} \end{figure*} \section{Explaining Hate Speech Models} For tasks with very skewed class distributions such as those for binary hate speech classification, it is not intuitive to ask for explanations for the majority class predictions: it is difficult to answer why a regular utterance such as ``I would like some coffee." is \textit{not} hate speech. This echoes the argument of \citet{miller2019explanation} that humans demand explanations only for selective and surprising aspects of an occurrence. We assume that there exists a majority, `neutral' class, and aim to provide explanations only for the minority, `positive' class. At the core of our approach is sampling replacements $x_i \leftarrow a'$ that are interventional with respect to the task, but also have high likelihood in the context of other tokens. We implement such a perturbation model for explaining positive predictions of hate speech classifiers, and explore what information necessity and sufficiency provide for this task through quantitative and qualitative analysis. Our implementation is \textit{task specific}, since we sample from the data labelled as `neutral' only; however, it is not \textit{dataset specific} in that it allows comparing hate speech classifiers that are trained on different datasets. Figure \ref{fig:perturbations} illustrates the calculations of necessity and sufficiency for an example classifier. \begin{table*} \centering \small \resizebox{\textwidth}{!}{% \renewcommand{\arraystretch}{1.27} \begin{tabular}{p{0.023\textwidth}m{0.28\textwidth}m{0.3\textwidth}C{0.1\textwidth}C{0.03\textwidth}} \toprule & \textbf{Functionality} & \textbf{Example Test Case} & \textbf{Gold Label} & \textbf{n} \\ \midrule \multirow{4}{*}{\rotatebox[origin=c]{90}{\parbox[c]{2.0cm}{\centering Explicit}}} & \textbf{F1}: Expression of strong negative emotions & ``I hate {[}IDENTITY{]}.'' \newline ``You {[}IDENTITY{]} make me sick.'' & \hlred{ hateful } & 40 \\ & \textbf{F2}: Description using very negative attributes & ``{[}IDENTITY{]} are disgusting.'' \newline ``All {[}IDENTITY{]} like them are vile.'' & \hlred{ hateful } & 40 \\ & \textbf{F3}: Dehumanisation & ``{[}IDENTITY{]} are scum.'' \newline ``{[}IDENTITY{]} are a pest.'' & \hlred{ hateful } & 40 \\ \midrule \multirow{2}{*}{\rotatebox[origin=c]{90}{\parbox[c]{1.25cm}{\centering Non-hate grp. ident.}}} & \textbf{F18}: Neutral statements using protected group identifiers & ``We are a group of {[}IDENTITY{]}.'' \newline ``I live with two {[}IDENTITY{]}.'' & \hlgreen{ non-hate } & 36 \\ & \textbf{F19}: Positive statements using protected group identifiers & ``I love {[}IDENTITY{]}.'' \newline ``{[}IDENTITY{]} are great.'' & \hlgreen{ non-hate } & 54 \\ \midrule \multirow{3}{*}{\rotatebox[origin=c]{90}{\parbox[c]{2.1cm}{\centering Abuse against non-prot. targets}}} & \textbf{F22}: Abuse targeted at objects & ``I really can't stand cauliflower.'' \newline ``All cocktails like these are vile'' & \hlgreen{ non-hate } & 65 \\ & \textbf{F23}: Abuse targeted at individuals (not as member of a prot. group) & ``You make me sick.'' \newline ``I will hurt you.'' & \hlgreen{ non-hate } & 65 \\ & \textbf{F24}: Abuse targeted at non-protected groups (e.g. professions) & ``Artists are parasites to our society.'' \newline ``Death to all capitalists.'' & \hlgreen{ non-hate } & 62 \\ \bottomrule \end{tabular}} \caption{\label{tab:hatecheck-cases} Test cases of interest from HateCheck \citep{rottger2021hatecheck}. We hypothesize that for identity terms in explicit test cases, if sufficiency is high then the model will have a high error rate on the test cases that capture \textit{non-hate group identity mentions}, and if necessity is low then the model will have a high error rate on the test cases that cover \textit{abuse against non-protected targets}.} \end{table*} \subsection{Generating perturbations} We use the infilling language model (ILM) of \citet{donahue2020enabling} to generate the perturbed examples. This model fine-tunes GPT-2 \citep{radford2019language} to allow infilling masked sections of text with $n$-grams, where the length of the infill varies from 1 to 7 tokens. We fine-tune the ILM on training data that is labelled `neutral', which is the opposite of the model prediction we aim to explain. Training the perturbation model only on the neutral examples allows us to distinguish direct causes of the model prediction from correlations in data. To see this, consider the case where we would like to determine whether a given identity mention is sufficient for a positive prediction. If the ILM captures the entire data distribution rather than just the neutral class, then a large chunk of the perturbed instances might still be hateful utterances. In those cases a good model should predict the positive class even though the occurrence of the identity term is arguably not the direct cause of the prediction. Rather, the presence of the identity term causes the ILM to generate a hateful infill, which then causes the positive prediction. Using the non-hateful data distribution to train the infilling model helps avoid such cases, and enables the method to attribute importance to a token only when the classifier relies on it directly. To train our infilling language model, we choose four widely-used datasets for hate speech and abusive language detection that are from various sources such as Twitter \citep{founta2018large}, Reddit \citep{vidgen2021introducing}, Wikipedia comments \citep{wulczyn2017ex} and news article comments \citep{borkan2019nuanced}. For all these datasets, we fine-tune our generative model on benign instances from the training sets. Details for training and datasets can be found in Appendix \ref{app:ILM}. \begin{figure*} \centering \begin{tabular}{c c c c c c | c c c c c c c} \hlnecc{81}{These} & \hlnecc{99}{women} & \hlnecc{96}{disgust} & \hlnecc{45}{me} & \hlnecc{50}{so} & \hlnecc{49}{much.} & \hlnecc{33}{These} & \hlnecc{100}{Muslims} & \hlnecc{20}{disgust} & \hlnecc{0}{me} & \hlnecc{2}{so} & \hlnecc{1}{much.} \\ \small{.81} & \small{.99} & \small{.96} & \small{.45} & \small{.50} & \small{.49} & \small{.33} & \small{1} & \small{.2} & \small{0} & \small{.02} & \small{.01} \\[5pt] \hlsuff{21}{These} & \hlsuff{30}{women} & \hlsuff{37}{disgust} & \hlsuff{0}{me} & \hlsuff{11}{so} & \hlsuff{3}{much.} & \hlsuff{31}{These} & \hlsuff{100}{Muslims} & \hlsuff{33}{disgust} & \hlsuff{29}{me} & \hlsuff{30}{so} & \hlsuff{37}{much.} \\ \small{.21} & \small{.3} & \small{.37} & \small{0} & \small{.11} & \small{.03} & \small{.31} & \small{1} & \small{.33} & \small{.29} & \small{.3} & \small{.37} \\[5pt] \end{tabular} \caption{Visualization for \hlnecc{50}{necessity} and \hlsuff{50}{sufficiency} scores on an example HateCheck test case targeting \textit{women} and \textit{Muslims} for the classifier \textit{Founta2018-hate}. Darker shades correspond to higher values.} \label{fig:example-necc-suff} \end{figure*} \section{Experiments}\label{sec:experiments} For our experiments, we focus on investigating the necessity and sufficiency of identity mentions for a sentence to be detected as hate speech, since a known bias in many hate speech detection models is that mere mentions of identity terms result in false positive predictions \citep{dixon2018measuring}. For a set of instances that contain mentions of identity terms we leverage HateCheck \citep{rottger2021hatecheck}, which is a suite of functional tests targeted at diagnosing weaknesses of hate speech classifiers. Tests are constructed from hand-crafted templates, where the target is picked from a predefined set of protected groups. To evaluate our explanation method, we train six BERT classifiers on three different datasets \citep{founta2018large, vidgen2021introducing, davidson2017automated}, and obtain the necessity and sufficiency of the identity terms on explicitly hateful test cases in HateCheck that target \textit{women} and \textit{Muslims}. Details for the datasets and classifiers can be found in Appendix \ref{app:classifiers}. We train classifiers on both `hate speech' labels and on more general `abusive' language labels in order to observe the effects of this distinction on the necessity and sufficiency values for identity terms. The difference between the two is that abusive language does not need to target a protected group identity. Accordingly, our first hypothesis is: \paragraph{\textit{Hypothesis 1:}}\textit{We will observe lower necessity for the identity terms for those models that are trained on the `abuse' labels compared to the ones that are trained on the `hate' labels.} \vspace{3pt} \noindent We further hypothesize that different necessity and sufficiency scores for identity mentions in explicitly hateful test cases indicate different biases, and correlate with how well a model does in the HateCheck functionalities that aim to capture those biases (see Table \ref{tab:hatecheck-cases} for the test cases), leading to our second and third hypotheses: \paragraph{\textit{Hypothesis 2:}} \textit{If a model has high sufficiency scores for identity terms in explicit expressions of hate (functionalities \textbf{F1}, \textbf{F2} and \textbf{F3}), this should indicate that the model is over-sensitive to identity terms. Therefore, we expect it have increased error rate in \textbf{F18} and \textbf{F19}, which consist of neutral or positive statements that mention identity terms.} \paragraph{\textit{Hypothesis 3:}} \textit{If the necessity scores for identity terms are low in explicit expressions of hate, we can conclude under-reliance on the identity terms, and over-reliance on the context. Consequently, we expect that the model will perform poorly on \textbf{F22}, \textbf{F23} and \textbf{F24}, which capture abuse not targeted at protected identity groups. } \begin{table*}[] \centering \small \begin{tabular}{r |c c | c c } \toprule & \multicolumn{2}{c|}{\textbf{women}} & \multicolumn{2}{c}{\textbf{Muslims}} \\ & \textit{necc} & \textit{suff} & \textit{necc} & \textit{suff} \\ \midrule \textit{Founta2018-hate} & 0.82 $\pm$0.18 & 0.29 $\pm$0.1 & 0.89 $\pm$0.16 & 0.81 $\pm$0.08 \\ \textit{Founta2018-abuse} & 0.54 $\pm$0.17 & 0.34 $\pm$0.1 & 0.65 $\pm$0.21 & 0.82 $\pm$0.06 \\ \textit{Davidson2017-hate} & 0.58 $\pm$0.09 & 0.21 $\pm$0.06 & 0.91 $\pm$0.12 & 0.74 $\pm$0.09 \\ \textit{Davidson2017-abuse} & 0.82 $\pm$0.14 & 0.43 $\pm$0.13 & 0.83 $\pm$0.13 & 0.41 $\pm$0.14 \\ \textit{Vidgen2021-hate} & 0.96 $\pm$0.02 & 0.71 $\pm$0.17 & 0.97 $\pm$0.03 & 0.88 $\pm$0.13 \\ \textit{Vidgen2021-abuse} & 0.82 $\pm$0.14 & 0.64 $\pm$0.14 & 0.82 $\pm$0.15 & 0.88 $\pm$0.07 \\ \bottomrule \end{tabular} \caption{The mean and standard deviation of necessity and sufficiency scores for target tokens in explicitly hateful cases of HateCheck (\textbf{F1}, \textbf{F2}, and \textbf{F3}) targeting \textbf{women} or \textbf{Muslims} for the the three classifiers trained on hate, and three classifiers trained on abuse labels. } \label{tab:hatecheck-necc-suff} \end{table*} \begin{table*}[] \centering \small \begin{tabular}{ r | >{\centering}p{2.5cm} >{\centering}p{2cm} | >{\centering}p{1.5cm} >{\centering}p{1.5cm} >{\centering\arraybackslash}p{1.5cm} } \toprule & \multicolumn{2}{c |}{ \begin{tabular} {@{}c@{}} \textit{Neutral/supportive group identity mention} \\ \textbf{(F18, F19)} \end{tabular}} & \multicolumn{3}{c }{ \begin{tabular} {@{}c@{}} \textit{Abuse against non-protected targets} \\ \textbf{(F22, F23, F24)} \end{tabular} } \\ \cline{2-6} \\[-1em] & \textbf{ women } & \textbf{Muslims} & \textbf{group} & \textbf{individual} & \textbf{object} \\[2pt] \hline \textit{Founta2018-hate} & 0.02 & 0.78 & 0.19 & 0.15 & 0.05 \\ \textit{Founta2018-abuse} & 0.02 & 0.78 & 0.45 & 0.72 & 0.37 \\ \textit{Davidson2017-hate} & 0.02 & 0.78 & 0.37 & 0.18 & 0.02 \\ \textit{Davidson2017-abuse} & 0.31 & 0.22 & 0.26 & 0.28 & 0.14 \\ \textit{Vidgen2021-hate} & 0.36 & 0.82 & 0.02 & 0.00 & 0.00 \\ \textit{Vidgen2021-abuse} & 0.42 & 0.96 & 0.40 & 0.61 & 0.00 \\ \bottomrule \end{tabular} \caption Proportions of test cases classified as hateful/abusive for different non-hateful HateCheck functionalities and targets. } \label{tab:hatecheck-results} \end{table*} \subsection{Implementation} We obtain the average necessity and sufficiency values for explicitly hateful test cases targeting \textit{women} and \textit{Muslims} for each of the classifiers. We calculate necessity and sufficiency by masking a subset of the tokens and using our fine-tuned language model to generate infillings. If multiple consecutive tokens are chosen, we aggregate them to a single mask instance to be infilled. We choose the number of perturbations for each example so that the expected number of perturbations for each token is 100. The necessity and sufficiency scores are only calculated for test cases that a classifier returns a correct prediction, since we only aim to explain positive predictions. The results can be found in Table~\ref{tab:hatecheck-necc-suff}. Table~\ref{tab:hatecheck-results} presents the proportions of test cases classified as hateful/abusive by each of the six classifiers on the non-hateful statements that mention identity terms (\textbf{F18} and \textbf{F19}) and abusive utterances not targeting protected identity groups (\textbf{F22}, \textbf{F23}, and \textbf{F24}). We report the results where necessity and sufficiency are calculated with masking rather than perturbing the chosen tokens in Appendix \ref{app:masking}. As baselines, we calculate the average importance of the tokens corresponding to target groups with SHAP\footnote{\url{https://github.com/slundberg/shap}} and LIME\footnote{\url{https://github.com/marcotcr/lime}}. For both of these methods, we use the default parameters for textual data. As with the calculation of necessity and sufficiency, we only include the attribution scores for test cases on which the classifier correctly predicts the positive class. These results can be found in Table \ref{tab:hatecheck-lime-shap}. \section{Results and Discussion} An example necessity and sufficiency attribution is given in Figure \ref{fig:example-necc-suff}. It shows that for this input, the token `Muslims' is more sufficient compared to `women', and the token `disgust' is more necessary in the context of `women' than that of `Muslims'. According to our first hypothesis, we expect the models that were trained on the \textit{abuse} versions of each dataset to have lower necessity for identity terms compared to those that have been trained on \textit{hate} labels. Indeed, in Table \ref{tab:hatecheck-necc-suff} we observe this pattern for all models and targets except \textit{Davidson2017} for the target \textit{women}. This correctly suggests that identity terms are necessary for a comment to be hate speech, but not for it to be abusive. The results also clearly support our second hypothesis that if an identity mention has high sufficiency on explicit examples for a given model, then this model is over-sensitive to the identity term. Comparing the sufficiency of \textit{women} and \textit{Muslims} in Table~\ref{tab:hatecheck-necc-suff} illustrates this difference: for all models except \textit{Davidson2017-abuse} sufficiency is high for \textit{Muslims} and significantly lower for \textit{women}. Accordingly, all models except \textit{Davidson2017-abuse} display a large difference between their error rates on neutral or positive mentions for \textit{women} and \textit{Muslims} in Table~\ref{tab:hatecheck-results} (\textbf{F18}, \textbf{F19}). That is, the mere occurrence of the word ``Muslims'' is sufficient for the classifiers to classify a text as hate speech, even if the text is neutral. Furthermore within each group, higher sufficiency values correspond to higher error rates in functionalities \textbf{F18, F19}. \textit{Vidgen2021-hate} and \textit{Vidgen2021-abuse} display the highest sufficiency for \textit{women}, and correspondingly have the highest error rates on these test cases for \textit{women}. \textit{Davidson2017-abuse} has the lowest sufficiency for \textit{Muslims}, and the lowest error rate for this target. Our third hypothesis is that low necessity for identity terms will be correlated with positive predictions for abusive instances that do not target a protected identity. In Table~\ref{tab:hatecheck-necc-suff}, the lowest necessity for both target groups are observed with \textit{Founta2018-abuse}. Indeed, this model has the highest rate of positive (abuse) predictions on all functionalities that test for abuse against non-protected targets in Table~\ref{tab:hatecheck-results}. The false positives in the test cases that target \textit{objects} is much higher than the corresponding errors for the other models, indicating that \textit{Founta2018-abuse} is indeed over-sensitive to abusive contexts, and does not consider the target of the abuse to be a necessary feature for the classification. On the other hand, the classifier trained on \textit{Vidgen2021-hate} shows the highest necessity values for both targets, and the lowest error rates on \textbf{F22}, \textbf{F23}, \textbf{F24}. \begin{table*}[] \centering \small \begin{tabular}{r |c c | c c } \toprule & \multicolumn{2}{c|}{\textbf{women}} & \multicolumn{2}{c}{\textbf{Muslims}} \\ & \textit{SHAP} & \textit{LIME} & \textit{SHAP} & \textit{LIME} \\ \midrule \textit{Founta2018-hate} & 0.36 $\pm$0.24 & 0.018 $\pm$0.045 & 0.84 $\pm$0.2 & 0.013 $\pm$0.036 \\ \textit{Founta2018-abuse} & -0.07 $\pm$0.21 & 0.011 $\pm$0.02 & 0.39 $\pm$0.25 & 0.042 $\pm$0.037 \\ \textit{Davidson2017-hate} & 0.01 $\pm$0.02 & -0.021 $\pm$0.018 & 0.89 $\pm$0.15 & -0.002 $\pm$0.057 \\ \textit{Davidson2017-abuse} & 0.42 $\pm$0.19 & 0.001 $\pm$0.086 & 0.37 $\pm$0.2 & -0.032 $\pm$0.092 \\ \textit{Vidgen2021-hate} & 0.89 $\pm$0.17 & 0.012 $\pm$0.077 & 0.95 $\pm$0.11 & 0.042 $\pm$0.049 \\ \textit{Vidgen2021-abuse} & 0.66 $\pm$0.23 & 0.045 $\pm$0.088 & 0.75 $\pm$0.22 & 0.087 $\pm$0.062 \\ \bottomrule \end{tabular} \caption{The mean and standard deviation of SHAP and LIME scores for target tokens in explicitly hateful cases of HateCheck (\textbf{F1}, \textbf{F2}, and \textbf{F3}) targeting \textbf{women} or \textbf{Muslims} for the the three classifiers trained on hate, and three classifiers trained on abuse labels. } \label{tab:hatecheck-lime-shap} \end{table*} \subsection{Comparison of Average SHAP and LIME Values with Necessity and Sufficiency} The average SHAP and LIME values for the two targets are presented in Table \ref{tab:hatecheck-lime-shap}. While \textit{Founta-abuse} and \textit{Davidson-abuse} get very similar SHAP scores for the target \textit{Muslims}, \textit{Founta2018-abuse} has high sufficiency for this token while \textit{Davidson2017-abuse} has high necessity. These two classifiers have very different false-positive rates for test instances that are non-abusive mentions of this target as reported in Table \ref{tab:hatecheck-results}, and hence can be observed to be biased against this group to a different extent. This distinction is clearly captured with the necessity and sufficiency scores, but not with SHAP. LIME scores seem even less consistent with the false-positive rates in Table \ref{tab:hatecheck-results} than SHAP. For example, \textit{Davidson2017-hate} has a very high false-positive rate for neutral/supportive mentions of the target \textit{Muslims}, however the average LIME score for this model and target group is in low negatives. This means that LIME was unable to capture the biases of the model against this target group. For the target \textit{women}, LIME gives very similar average importance to the target tokens for \textit{Founta2018-abuse} and \textit{Vidgen2021-hate}, however all of the other metrics we calculate highlight significant differences. Indeed, we can observe in Table~\ref{tab:hatecheck-results} that \textit{Founta2018-abuse} has high false-positive rates for abuse against non-protected targets, but low false-positive rates for neutral/supportive mentions of the target \textit{women}, whereas \textit{Vidgen2021-hate} shows the exact opposite pattern. LIME scores seem unable to distinguish this important difference, unlike our necessity and sufficiency scores. \subsection{Qualitative analysis} Examining the generated perturbations reveals that the majority of the time, the generator successfully replaces the original snippet with non-offensive text. There are minimal repetitions of the same infill, indicating that the perturbations are sufficiently diverse. The quality of the perturbations is mixed, and tends to decrease with the number of infills. Our method can be used with any generator that can model the data distribution conditioned on the label. For our current model we prioritize diversity over fluency, and leave improvements on this aspect for future work. Inspecting the generated perturbations reveal that there are often instances that combine a few HateCheck functionalities. For example, as a perturbation for ``I hate {[}IDENTITY{]}'' model generates ``This is a subreddit I hate.'', combining shuffling the word order with changing the target. For the template ``{[}IDENTITY{]} are the dumbest people.'', one of the generated counterfactuals is ``I don't believe that American people are the dumbest people.'', combining negation and phrasing. Interestingly, many infills for the identity terms do not clearly correspond to either object, individuals or non-protected groups, which are the three cases that HateCheck checks for. Instead, our generative model infills it with clauses such as ``I hate that I feel like I have to do these things'', actions such as ``I hate crying,'' or types of events like ``I hate surprises.'' This illustrates that our relatively non-constrained generation of counterfactuals provides better coverage of potential replacements, and provides a good complement to manual checks. \section{Conclusion} This work is a step towards more informative and transparent feature attribution metrics for explaining text classifiers. We argue that standard token importance metrics can be ambiguous in terms of what `importance' means. Instead, we adapt the theoretically-grounded concepts of \textit{necessity} and \textit{sufficiency} to explain text classifiers. Besides being more informative, the process of generating these two metrics is intuitive and can be explained to lay people in terms of ``how much the perturbations in input change the output of the classifier''. Moreover, the input perturbations can be presented to the users, leading to a transparent and understandable explainability framework. Considering the complexities of perturbing textual features, we introduced a practical implementation to compute the necessity and sufficiency of the input tokens. Taking hate speech detection as an example application, we showed that sufficiency and necessity can be used to explain the expected differences between a classifier that is intended to detect identity-based hate speech and those trained for detecting general abuse. We also leveraged these metrics to explain the observed over-sensitivity and under-sensitivity to mentions of target groups, issues that are tightly related to fairness in hate speech detection. While the current work focused on binary hate speech detection for English-language social media posts, in future work, we will explore the effectiveness of these metrics in generating explanations for other applications and languages. We will also explore how the new metrics can improve the debugging of the models or communicating the model’s decision-making process to the end-users. \section{Ethical Considerations} The proposed method has benefits and risks that should be considered from an ethics perspective. One principle of ethical AI is \textit{transparency}, and we have developed this method with the goal of improving transparency for system developers, end users, and other stakeholders to better understand the inner workings of complex NLP systems. In the application domain of hate speech detection, we demonstrated how necessity and sufficiency scores might be used to diagnose possible classification biases against identity groups, who are frequently subjects of online abuse. This can help in addressing the known issue of over-sensitivity to identity terms, ensuring that benign conversations around issues concerning marginalized groups are not mis-classified as hate speech. However, there are also potential risks. We make use of existing datasets and thus our analysis is limited by those data: they were collected from public, online platforms without user's explicit consent, and may not accurately represent speakers from all demographic groups, they are only in English, and they may be biased towards or against certain topics of conversation. The data and analysis are also limited to the English language. Training language models on user data also has privacy implications, as the language model may then re-generate user text when deployed. While transparency and explainability are seen as desirable properties, they can also expose AI systems to malicious attacks. In the context of hate speech, our explainability metrics could potentially be used to identify and then exploit system vulnerabilities. Finally, our approach requires the use of large language models, which are computationally expensive to train and can reflect the biases of their training data. Our method of generating multiple counterfactual examples per word, rather than simply removing or masking that word, also increases the computational resources required.
\section{Introduction} The claim ``Since $1/(1+\tau^2)$ is a Muckenhoupt $A_q$-weight for all $q>1$\ldots'' on page 465 of \cite{BP16} is false. Consequently, Equation 17 is false and Theorem~8 is unsubstantiated. In this corrigendum we show that a version of Equation~17 holds for the Hardy spaces of Dirichlet series considered in \cite{BP16} and correct the proof of Theorem~8. These results will be presented as Theorem~A and B below. The same mistake is repeated in the lead-up to the proof of \cite[Theorem 5.1]{BPS19}, and this is also rectified by Theorem~A and Theorem~B. Unless otherwise stated, we retain the notation from \cite{BP16}. Specifically, we set $\Gamma_\tau = \{s=\sigma+it \,:\, |t-\tau|<\sigma\}$ for $\tau$ in $\mathbb{R}$ and consider the maximal function \begin{equation}\label{eq:maxf} F^\ast(\tau) = \sup_{s \in \Gamma_\tau} |F(s)|. \end{equation} The following result yields a maximal function characterization of $\mathscr{H}^p$, the converse inequality being a trivial consequence of \cite[Lemma~5]{Bayart02}. \begin{theoremA} Fix $0<p<\infty$. There is a constant $C_p \geq 1 $ such that \[\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} |f_\chi^\ast(\tau)|^p \frac{d\tau}{\pi(1+\tau^2)} \leq C_p \|f\|_{\mathscr{H}^p}^p\] for every $f$ in $\mathscr{H}^p$. \end{theoremA} Consider next the square function \begin{equation}\label{eq:sqf} Sf(\tau) = \left(\int_{\Gamma_\tau} |f'(s)|^2\,ds \right)^\frac{1}{2}. \end{equation} The following square function characterization of $\mathscr{H}^p$ is precisely \cite[Theorem 8]{BP16}. \begin{theoremB} Fix $0<p<\infty$. There are constants $A_p>0$ and $B_p>0$ such that \[A_p \|f\|_{\mathscr{H}^p}^p \leq \int_{\mathbb{T}^\infty } \int_{\mathbb{R}} (S f_\chi(\tau))^p\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \leq B_p \|f\|_{\mathscr{H}^p}^p\] for every $f$ in $\mathscr{H}^p$ with $f(+\infty)=0$. \end{theoremB} We shall establish Theorem~A and Theorem~B by replacing the conformally invariant Hardy spaces $H^p_{\operatorname{i}}(\mathbb{C}_0)$ considered in \cite{BP16} with the (unweighted) Hardy spaces $H^p(\mathbb{C}_0)$. For a Dirichlet series $f$ in $\mathscr{H}^p$ and a character $\chi$ in $\mathbb{T}^\infty$, consider \begin{equation}\label{eq:Fchi} F_\chi(s) = \frac{f_\chi(s)}{\pi^{1/p}(s+1)^{2/p}}. \end{equation} It is well-known that if $f$ is in $\mathscr{H}^p$, then for almost every $\chi$ in $\mathbb{T}^\infty$ the Dirichlet series $f_\chi$ is convergent in $\mathbb{C}_0$ and $F_\chi$ is in $H^p(\mathbb{C}_0)$. Moreover, $\|f\|_{\mathscr{H}^p}^p$ can be recovered by averaging $\|F_\chi\|_{H^p(\mathbb{C}_0)}^p$ over $\mathbb{T}^\infty$. See Lemma~\ref{lem:pnorm} below. Our arguments will be based on this, the maximal function characterization of $H^p(\mathbb{C}_0)$ due to Burkholder, Gundy and Silverstein \cite{BGS71}, and the square function characterization of $H^p(\mathbb{C}_0)$ due to Fefferman and Stein \cite{FS72}. It is indeed straightforward to establish Theorem~A by comparing the maximal functions $f_\chi^\ast$ and $F_\chi^\ast$. However, for Theorem~B, the presence of a derivative in \eqref{eq:sqf} means that we need to compare the $L^2(\Gamma_\tau)$ integrals of $f_\chi'$ and \begin{equation}\label{eq:Fchidiff} F_\chi'(s) = \frac{f_\chi'(s)}{\pi^{1/p}(s+1)^{2/p}} - \frac{2}{p} \frac{f_\chi(s)}{\pi^{1/p}(s+1)^{2/p+1}}. \end{equation} One clearly expects the first term to be dominant, so our job is to prove that the second term can be neglected. This will be achieved through a compactness argument which proceeds along standard lines. Certain technical issues arise since we are working with Hardy spaces of Dirichlet series. We rely mostly on the standard toolbox of $\mathscr{H}^p$ developed in \cite{Bayart02}, but one of our preliminary results does not appear in the literature and may be of some independent interest. To state it, we introduce the notation $T_\sigma f(s) = f(s+\sigma)$. \begin{theoremC} Fix $0<p<\infty$. If $f(s) = \sum_{n\geq N} a_n n^{-s}$ for some $N\geq1$, then \[\|T_\sigma f\|_{\mathscr{H}^p} \leq N^{-\sigma} \|f\|_{\mathscr{H}^p}\] for every $\sigma\geq0$. \end{theoremC} Theorem~C is a direct consequence of the analogue of Hardy's convexity theorem for $\mathscr{H}^p$, which was recently established by the present authors in \cite{BP21} by adapting Hardy's original proof \cite{Hardy15}. \subsection*{Organization} The present corrigendum is comprised of three additional sections. Section~\ref{sec:prelim} contains some preliminary results and definitions, including the proof of Theorem~C. Section~\ref{sec:A} and Section~\ref{sec:B} are devoted to the proofs of Theorem~A and Theorem~B, respectively. \subsection*{Acknowledgements} We thank Jiale Chen for making us aware of the error in \cite{BP16}. \section{Preliminaries} \label{sec:prelim} For $0<p<\infty$, every Dirichlet series in $\mathscr{H}^p$ is absolutely convergent for $\mre{s}>1/2$. As elucidated in \cite[Section 2.1]{Bayart02}, it therefore follows from Birkhoff's ergodic theorem that the $\mathscr{H}^p$-norm of $T_\sigma f$ can computed using Carlson's formula whenever $\sigma>1/2$, \begin{equation}\label{eq:carlson} \|T_\sigma f\|_{\mathscr{H}^p}^p = \lim_{T\to\infty} \frac{1}{2T} \int_{-T}^T |f(\sigma+it)|^p \,dt. \end{equation} We are now ready to establish Theorem~C. \begin{proof} [Proof of Theorem~C] We assume that $a_N\neq0$ because if not, we would get a stronger inequality by replacing $N$ by $N+1$. If $\sigma=0$ there is nothing to do. For $\sigma>0$ we will use Hardy's convexity theorem for $\mathscr{H}^p$ \cite[Theorem 3.8 (ii)]{BP21}, which states that the function $\sigma \mapsto \|T_\sigma f\|_{\mathscr{H}^p}$ is logarithmically convex on $[0,\infty)$. Applying this to the points $0$, $\sigma$ and $\kappa>\sigma$ we find that \[\|T_\sigma f \|_{\mathscr{H}^p} \leq \|f\|_{\mathscr{H}^p}^{1-\sigma/\kappa} \|T_\kappa f \|_{\mathscr{H}^p}^{\sigma/\kappa}.\] Our plan is now to estimate the final quantity as $\kappa \to \infty$. If we assume that $\kappa>1/2$, then we can use \eqref{eq:carlson} to compute $\|T_\kappa f \|_{\mathscr{H}^p}^p$. The absolute convergence also implies that there is some $\kappa_0>1/2$ such that if $\kappa \geq \kappa_0$, then \[|f(\kappa+it)| \leq \sum_{n=N}^\infty \frac{|a_n|}{n^{\kappa}} \leq 2 |a_N| N^{-\kappa}.\] Combining these observations, we find that $\|T_\sigma f \|_{\mathscr{H}^p} \leq \|f\|_{\mathscr{H}^p}^{1-\sigma/\kappa} N^{-\sigma} (2|a_N|)^{\sigma/\kappa}$ for every $\kappa\geq\kappa_0$. Letting $\kappa\to \infty$ we obtain the stated result. \end{proof} For $0<p<\infty$, let $H^p(\mathbb{C}_0)$ be the Hardy space of analytic functions in the right half-plane $\mathbb{C}_0 = \{s=\sigma+it\,:\, \sigma>0\}$, endowed with the (quasi-)norm \begin{equation}\label{eq:Hp} \|F\|_{H^p(\mathbb{C}_0)}^p = \sup_{\sigma>0} \int_{-\infty}^\infty |F(\sigma+it)|^p\,dt. \end{equation} It follows from Hardy's convexity theorem \cite{Hardy15} that the $\sup$ in \eqref{eq:Hp} can be replaced by the limit as $\sigma \to 0^+$. In combination with results extracted from \cite[Section~2.2]{Bayart02}, we have the following. \begin{lemma}\label{lem:pnorm} Fix $0<p<\infty$ and suppose that $f$ is in $\mathscr{H}^p$. For almost every $\chi$ in $\mathbb{T}^\infty$, the Dirichlet series $f_\chi$ converges in $\mathbb{C}_0$ and $F_\chi$ is in $H^p(\mathbb{C}_0)$. Moreover, \[\|f\|_{\mathscr{H}^p}^p = \int_{\mathbb{T}^\infty} \|F_\chi\|_{H^p(\mathbb{C}_0)}^p \,dm_\infty(\chi).\] \end{lemma} We have one more trivial preliminary result, which is stated separately for ease of reference, without proof. \begin{lemma}\label{lem:trivial} Decompose $\Gamma_\tau = \Gamma_{\tau,0} \cup \Gamma_{\tau,1}$, where \[\Gamma_{\tau,0} = \{s = \sigma+it \,:\, 0 < \sigma < 1 \text{ and } |t-\tau|<\sigma\}\] and $\Gamma_{\tau,1} = \Gamma_\tau \setminus \Gamma_{\tau,0}$. \begin{enumerate} \item[(a)] If $s$ is in $\Gamma_\tau$, then $|s+1|^2 \geq (1+\tau^2)/2$. \item[(b)] If $s$ is in $\Gamma_{\tau,0}$, then $|s+1|^2 \leq 6(1+\tau^2)$. \end{enumerate} \end{lemma} \section{Proof of Theorem A} \label{sec:A} We know from \cite[Theorem~1]{BGS71} that there is a constant $c_p\geq 1$ such that \begin{equation}\label{eq:MFLB} \int_{\mathbb{R}} |F^\ast(\tau)|^p\,d\tau \leq c_p \|F\|_{H^p(\mathbb{C}_0)}^p \end{equation} for every $F$ in $H^p(\mathbb{C}_0)$. The plan is to apply \eqref{eq:MFLB} to the functions $F_\chi$ from \eqref{eq:Fchi} and then to use Lemma~\ref{lem:pnorm}. Decompose $\Gamma = \Gamma_{\tau,0}\cup \Gamma_{\tau,1}$ as above. The corresponding maximal functions will be denoted $F_0^\ast$ and $F_1^\ast$, so that \[F^\ast(\tau) = \max\big(F_0^\ast(\tau),F_1^\ast(\tau)\big).\] It follows from Lemma~\ref{lem:trivial} (b) that \begin{equation}\label{eq:chi0} |F_{\chi,0}^\ast(\tau)|^p \geq \frac{|f_{\chi,0}^\ast(\tau)|^p}{6\pi (1+\tau^2)}. \end{equation} Using Lemma~\ref{lem:trivial} (a) and the pointwise estimate $|f(s)|^p \leq \zeta(2\mre{s})\|f\|_{\mathscr{H}^p}^p$, valid for $\mre{s}>1/2$, from \cite[Theorem 3]{Bayart02}, we find that \begin{equation}\label{eq:chi1} |F_{\chi,1}^\ast(\tau)|^p \leq \frac{2\zeta(2) \|f\|_{\mathscr{H}^p}^p}{\pi(1+\tau^2)}. \end{equation} Exploiting the inequalities $\max(a^p,b^p) \geq a^p-b^p$ and $a^p+b^p \geq \max(a^p,b^p)$ for $a,b\geq0$, we obtain from \eqref{eq:chi0}, \eqref{eq:chi1}, and the pointwise estimate again, that \[|F_\chi^\ast(\tau)|^p \geq \frac{|f_{\chi,0}^\ast(\tau)|^p}{6 \pi (1+\tau^2)} - \frac{2\zeta(2) \|f\|_{\mathscr{H}^p}^p}{\pi(1+\tau^2)} \geq \frac{|f_{\chi}^\ast(\tau)|^p}{\pi (1+\tau^2)} - \frac{13\zeta(2) \|f\|_{\mathscr{H}^p}^p}{6\pi(1+\tau^2)}.\] Inserting this into \eqref{eq:MFLB}, integrating over $\chi$ and using Lemma~\ref{lem:pnorm}, we find that \[c_p \|f\|_{\mathscr{H}^p}^p \geq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} |f_{\chi}^\ast(\tau)|^p\,\frac{d\tau}{\pi (1+\tau^2)}\, dm_\infty(\chi) - \frac{13\pi^2}{36} \|f\|_{\mathscr{H}^p}^p.\] This implies the stated result with $C_p = c_p+13\pi^2/36$. \qed \section{Proof of Theorem B} \label{sec:B} Throughout this section, we will use the triangle inequality in its weak form, \[|a+b|^p \leq 2^p (|a|^p + |b|^p),\] which holds for $0<p<\infty$. \begin{proof} [Proof of the upper bound in Theorem~B] By the square function characterization of $H^p(\mathbb{C}_0)$ from \cite[Theorem~8]{FS72} and Lemma~\ref{lem:pnorm}, there is a constant $b_p>0$ such that \[b_p \|f\|_{\mathscr{H}^p}^p \geq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (SF_\chi(\tau))^p \,d\tau\,dm_\chi(\infty).\] We get a lower bound for the right hand side by restricting the integral over $\Gamma_\tau$ in the definition of the square function \eqref{eq:sqf} to $\Gamma_{\tau,0}$ and using the estimate from Lemma~\ref{lem:trivial} (b) therein to conclude that \[b_p \|f\|_{\mathscr{H}^p}^p \geq \frac{1}{6}\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,0}} \left|f'_\chi(s)-\frac{2}{p}\frac{f_\chi(s)}{(s+1)}\right|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi).\] From the triangle inequality for $L^2(\Gamma_\tau)$ and the triangle inequality, we find that \begin{multline*} b_p \|f\|_{\mathscr{H}^p}^p \geq \frac{2^{-p}}{6} \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,0}} |f'_\chi(s)|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \\ - \frac{1}{6}\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,0}} \left|\frac{2}{p}\frac{f_\chi(s)}{(s+1)}\right|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi). \end{multline*} Using Theorem~A and the estimate $|s+1|\geq1$, valid for $s$ in $\mathbb{C}_0$, we conclude that \[\frac{1}{6}\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,0}} \left|\frac{2}{p}\frac{f_\chi(s)}{(s+1)}\right|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \leq \left(\frac{2}{p}\right)^p \frac{C_p}{6} \|f\|_{\mathscr{H}^p}^p.\] Letting $\widetilde{B}_p = 6 \cdot 2^p \cdot b_p + (4/p)^p \cdot C_p$, we thus have \[\widetilde{B}_p \|f\|_{\mathscr{H}^p}^p \geq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,0}} |f'_\chi(s)|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi).\] Another application of the triangle inequality now gives that \begin{multline*} \widetilde{B}_p \|f\|_{\mathscr{H}^p}^p \geq 2^{-\frac{p}{2}} \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (Sf_\chi(\tau))^p\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \\ - \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_{\tau,1}} |f'_\chi(s)|^2 \,ds \right)^{\frac{p}{2}} \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi). \end{multline*} The final term can be estimated in different ways. One possibility is to apply Cauchy's formula to the function $g_\chi = T_{\sigma-1}(f_\chi-f(+\infty))$, where $s = \sigma + it$, integrating over the circle with centre $1+it$ and radius $1/3$, to conclude that \[|f_\chi'(s)| \leq 3 \zeta(4/3)^{1/p} \|T_{\sigma-1}(f-f(+\infty))\|_{\mathscr{H}^p} \leq 3 \zeta(4/3)^{1/p} 2^{-\sigma+1+1/p} \|f\|_{\mathscr{H}^p},\] where we also used the pointwise estimate of \cite[Theorem 3]{Bayart02}, Theorem~C, the triangle inequality, and the estimate $|f(+\infty)|\leq\|f\|_{\mathscr{H}^p}$. Applying this estimate and extending the innermost integral to $\Gamma_\tau$, we obtain by computation the stated result with $B_p = 2^{p/2}\widetilde{B}_p + 2\zeta(4/3) (6/\log{2})^p$. \end{proof} As mentioned in the introduction, the main difficulty in the proof of Theorem~B is to control the contribution from the second term in \eqref{eq:Fchidiff}. This will be achieved through the following result. \begin{lemma}\label{lem:Rpf} Fix $0<p<\infty$ and define \[\mathscr{R}_p(f) = \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \left(\int_{\Gamma_\tau} |f_\chi(s)|^2\,ds\right)^{\frac{p}{2}}\,\frac{d\tau}{\pi(1+\tau^2)} \,dm_\infty(\chi).\] There is a constant $D_p>0$ such that if $f(s) = \sum_{n\geq N} a_n n^{-s}$ for some $N\geq2$, then \[\mathscr{R}_p(f) \leq \frac{D_p}{(\log{N})^{p}} \|f\|_{\mathscr{H}^p}^p.\] \end{lemma} \begin{proof} It is instructive to first consider the case $p=2$. By interchanging the order of integration and using Theorem~C, we find that \begin{align*} \mathscr{R}_2(f) &\leq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} \int_{\Gamma_\tau} |f_\chi(s)|^2\,ds\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \\ &= \int_{\mathbb{R}}\int_{\Gamma_\tau} \|T_\sigma f\|_{\mathscr{H}^2}^2 \,ds \,\frac{d\tau}{\pi(1+\tau^2)} \\ &\leq \|f\|_{\mathscr{H}^2} \int_{\mathbb{R}}\int_{\Gamma_\tau} N^{-2\sigma} \,ds \,\frac{d\tau}{\pi(1+\tau^2)} = \frac{1}{2} \frac{\|f\|_{\mathscr{H}^2}^2}{(\log{N})^2}. \end{align*} This is the stated result with $D_2=1/2$. In the case $0<p<2$, we extract a maximal function to obtain \[\mathscr{R}_p(f) \leq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (f_\chi^\ast(\tau))^{\frac{p(2-p)}{2}} \left(\int_{\Gamma_\tau} |f_\chi(s)|^p\,ds\right)^{\frac{p}{2}}\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi).\] Next we use H\"older's inequality and Theorem~A, which yields that \[\mathscr{R}_p(f) \leq C_p^{\frac{2}{2-p}} \|f\|_{\mathscr{H}^p}^{\frac{(2-p)p}{2}} \left(\int_{\mathbb{T}^\infty} \int_{\mathbb{R}}\int_{\Gamma_\tau} |f_\chi(s)|^p\,ds\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi)\right)^{\frac{p}{2}}.\] Using Theorem~C as before, we get the stated result with $D_p = C_p^{2/(2-p)} 2^{p/2} p^{-p}$. In the case $2<p<\infty$, we first use H\"older's inequality to estimate \[\int_{\Gamma_\tau} |f_\chi(s)|^2 \,ds \leq \int_0^\infty (2\sigma)^{\frac{p-2}{p}}\left(\int_{\tau-\sigma}^{\tau+\sigma} |f_\chi(\sigma+it)|^p \,dt\right)^\frac{2}{p}\,d\sigma.\] Using this estimate and Minkowski's inequality, we find that $R_p(f)$ is bounded from above by \[ \left(\int_0^\infty\left(\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (2\sigma)^{\frac{p-2}{2}} \int_{\tau-\sigma}^{\tau+\sigma} |f_\chi(\sigma+it)|^p \,dt \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) \right)^\frac{2}{p} \,d\sigma\right)^\frac{p}{2}.\] Interchanging the order of integration and using Theorem~C, we find that \[\int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (2\sigma)^{\frac{p-2}{2}} \int_{\tau-\sigma}^{\tau+\sigma} |f_\chi(\sigma+it)|^p dt \frac{d\tau}{\pi(1+\tau^2)}dm_\infty(\chi) \leq (2\sigma)^{p/2} N^{-\sigma p} \|f\|_{\mathscr{H}^p}^p.\] Computing the final integral over $\sigma$ yields the stated result with $D_p = 2^{-p/2}$. \end{proof} For $N\geq2$, we let $S_N$ denote the partial sum operator \[S_N\left(\sum_{n=1}^\infty a_n n^{-s}\right) = \sum_{n< N} a_n n^{-s}.\] Lemma~\ref{lem:Rpf} will be used to establish the following. \begin{lemma}\label{lem:contradictme} Fix $0<p<\infty$. There are constants $E_p>0$ and $N_p \geq 2$ such that \[E_p \|f\|_{\mathscr{H}^p}^p \leq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (Sf_\chi(\tau))^p \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) + \|S_{N_p} f\|_{\mathscr{H}^p}^p.\] \end{lemma} \begin{proof} Let $N\geq2$ be a number to be chosen later. By the square function characterization of $H^p(\mathbb{C}_0)$ from \cite[Theorem~8]{FS72} and Lemma~\ref{lem:pnorm}, there is a constant $a_p>0$ such that \[a_p \|f\|_{\mathscr{H}^p}^p \leq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (SF_\chi(\tau))^p \,d\tau \,dm_\infty(\chi).\] Recalling \eqref{eq:Fchidiff}, we use the triangle inequality for $L^2(\Gamma_\tau)$, the triangle inequality, Lemma~\ref{lem:trivial} (a), the estimate $|s+1|^2 \geq 1$, and the estimate $(2/p)^p \leq e^{2/e}$, to see that \[\frac{a_p}{2^{p+1} e^{2/e}} \|f\|_{\mathscr{H}^p}^p \leq \int_{\mathbb{T}^\infty} \int_{\mathbb{R}} (Sf_\chi(\tau))^p \,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) + \mathscr{R}_p(f),\] where $\mathscr{R}_p(f)$ is as in Lemma~\ref{lem:Rpf}. To actually apply Lemma~\ref{lem:Rpf}, we need to subtract $S_N f$ from $f$. Using the triangle inequality, Lemma~\ref{lem:Rpf} twice, and then the triangle inequality again with the trivial estimates $1 \leq 2^p$ and $N\geq2$, we find that \[\mathscr{R}_p(f) \leq 4^p D_p \left(\frac{2\|S_N f\|_{\mathscr{H}^p}^p}{(\log{2})^p} + \frac{\|f\|_{\mathscr{H}^p}^p}{(\log{N})^p}\right)\] We have obtained the stated result with $E_p = (\log{2})^{p} a_p/(8^{p+1} e^{2/e} D_p)$, if $N = N_p\geq 2$ is chosen so large that \[\frac{4^p D_p}{(\log{N_p})^p} \leq \frac{a_p}{2^{p+2} e^{2/e}}. \qedhere\] \end{proof} \begin{proof} [Proof of the lower bound in Theorem~B] We will argue by contradiction. Assume that there is no constant $A_p>0$ such that \[A_p \|f\|_{\mathscr{H}^p}^p \leq \int_{\mathbb{T}^\infty } \int_{\mathbb{R}} (S f_\chi(\tau))^p\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi)\] for all $f$ in $\mathscr{H}^p$ with $f(+\infty)=0$. We can then find a sequence of functions $(f_k)_{k\geq1}$ in $\mathscr{H}^p$ such that $\|f_k\|_{\mathscr{H}^p} = 1$ for every $k\geq1$, but such that \begin{equation}\label{eq:squarelim} \lim_{k\to \infty } \int_{\mathbb{T}^\infty } \int_{\mathbb{R}} (S f_{k,\chi}(\tau))^p\,\frac{d\tau}{\pi(1+\tau^2)}\,dm_\infty(\chi) = 0. \end{equation} If we can derive from \eqref{eq:squarelim} that also $\|S_{N_p} f_k\|_{\mathscr{H}^p} \to 0$ as $k\to\infty$, we will obtain a contradiction to Lemma~\ref{lem:contradictme}. In view of the trivial estimate \begin{equation} \label{eq:SNpfk} \|S_{N_p} f_k\|_{\mathscr{H}^p} \leq \|S_{N_p} f_k\|_{\mathscr{H}^\infty} \leq \sum_{n<N_p} |a_{n,k}|, \end{equation} it is enough to deduce from \eqref{eq:squarelim} that $a_{n,k} \to 0$ as $k\to\infty$ for $n < N_p$. Let us first consider the simpler case $1 \leq p < \infty$. Since $\|f_k\|_{\mathscr{H}^p}=1$ we know that $|a_{n,k}|\leq 1$ for all $n\geq2$. By passing to subsequences, we may assume that there are complex numbers $a_n$ such that $a_{n,k} \to a_n$ for $n<N_p$. If $a_2=0$, there is nothing to do. If $a_2\neq0$, we can find $K_2$ such that if $k \geq K_2$, then $|a_{2,k}| \geq |a_2|/2$. In this case, pick $\kappa_2$ so large that if $\sigma\geq \kappa_2$, then \[|f_{k,\chi}'(s)| \geq \frac{|a_{2,k}| (\log{2})}{2^{\sigma}} - \sum_{n > 2} (\log{n}) n^{-\sigma} \geq \frac{|a_2| (\log{2})}{2^{\sigma+1}} - \sum_{n > 2} (\log{n}) n^{-\sigma} \geq \frac{|a_2| (\log{2})}{2^{\sigma+2}}.\] Restricting the integral over $\Gamma_\tau$ in \eqref{eq:squarelim} to $\mre{s}\geq \kappa_2$, we insert this estimate and let $k \to \infty$, to see that $a_2=0$. Similarly, if $a_3\neq0$, we may find $K_3$ and $\kappa_3$ such that if $k \geq K_3$ and $\mre{s} \geq \kappa_3$, then \[|f_{k,\chi}'(s)| \geq |a_3| (\log{3}) 3^{-\sigma}/4 - |a_{2,k}| (\log{2}) 2^{-\sigma}.\] We will now restrict our attention to the strip $\kappa_3 \leq \mre{s} \leq \kappa_3+1$. Since $a_{2,k}\to 0$, we can choose $K_{2,3}$ so large that if $k\geq \max(K_{2,3},K_3)$ and $\kappa_3 \leq \sigma \leq \kappa_3+1$, then \[|a_{2,k}| (\log{2}) 2^{-\sigma} \leq |a_3| (\log{3}) 3^{-\sigma}/8.\] This implies that $|f_{k,\chi}'(s)| \geq |a_3| (\log{3}) 3^{-\sigma}/8$ in the strip $\kappa_3 \leq \sigma \leq \kappa_3+1$ for every sufficiently large $k$. Restricting the integral over $\Gamma_\tau$ in \eqref{eq:squarelim} to this strip and letting $k \to \infty$, we find that $a_3=0$. We continue inductively and conclude that $a_n=0$ for every $n<N_p$ and obtain the desired contradiction to Lemma~\ref{lem:contradictme} through \eqref{eq:SNpfk}. The same argument works in the case $0<p<1$ with one minor modification. We no longer have the estimate $|a_{n,k}|\leq 1$, but by \cite[Theorem~9]{Bayart02} it holds that \[|a_{n,k}| \leq (2/p)^{\Omega(n)/2} \|f_k\|_{\mathscr{H}^p}^p = (2/p)^{\Omega(n)/2},\] where $\Omega(n)$ denotes the number of prime factors of $n$ counting multiplicities. By the estimate $\Omega(n) \leq \log{n}/\log{2}$ and a straightforward rough calculus estimate, we find that $|a_{n,k}| \leq n^{1/p}$. As a consequence, we simply need to choose a slightly larger $\kappa_n$ for each $n<N_p$, and otherwise argue in a more or less identical manner. \end{proof} \bibliographystyle{amsplain-nodash}
\section{Veracruz} \label{sect.veracruz} \input{s4.1-veracruz-overview} \input{s4.2-veracruz-attestation} \input{s4.3-veracruz-programming} \input{s4.4-veracruz-acceleration} \input{s4.6-veracruz-threat-model} \section{Evaluation} \label{sect.evaluation} \input{s5.1-evaluation-intro} \input{s5.2-deep-learning} \input{s5.2-evaluation-vod-case} \input{s5.3-evaluation-further} \input{s6-closing-remarks} \newpage \input{main.bbl} \inputencoding{utf8} \end{document} \section{Introduction} \label{sect.introduction} Code and data are now routinely shared with a \emph{delegate} who is better placed, either through economies of scale, or computational capacity, to host a computation. While Cloud computing is the obvious exemplar of this trend, other forms of distributed computing---including volunteer Grid Computing, wherein machines lend spare computational capacity to realize some large computation, and Ambient Computing, wherein computations are \emph{mobile} and hop from device-to-device as computational contexts change---also see computations freely delegated to third parties. At present, in the absence of the widespread deployment of Advanced Cryptography~\cite{10.1145/3243734.3268995}, delegating computation to a third party inexorably means entering into a trust relationship with the delegate, and for some especially sensitive computations this may be simply unacceptable. Yet, even for less sensitive delegated computations, there is still an interest in limiting the scope of this trust relationship. In the Cloud context, though established hosts may be reputable, technical means may be desired to shield computations from prying or interference which may originate from many sources, not only from the hosting company themselves: malefactors may exploit hypervisor bugs to spy on co-tenants, for example. Cloud hosts also increasingly see an interest in \emph{deniable hosting}, wherein technical measures ensure that a customer's computations simply cannot be interfered with, or spied upon, by the hosts themselves---even in the face of legal compulsion. For Ambient and volunteer Grid Computing, these concerns also manifest: nodes must be assumed hostile and assumed to be trying to \emph{undermine} a computation, either through malice or as a consequence of bugs or glitches. As a result, volunteer Grid Computing deployments may schedule computations on multiple nodes and check for consistency~\cite{1630798}. In response, novel \emph{Confidential Computing} technologies are being added to microprocessor architectures and cloud infrastructure, providing protected computing environments---variously called Secure Enclaves, Realms, Trusted Execution Environments, and which we generically call \emph{isolates}---that provide strong confidentiality and integrity guarantees to code and data hosted within, even in the face of a privileged attacker. Isolates are also typically paired with an \emph{attestation} protocol, allowing a third-party to deduce, with high confidence, that a remote isolate is authentic and configured in a particular way. Taken together, one may establish a protected ``beachhead'' on an untrusted third-party's machine---exactly what is needed to protect delegated computations. Isolates offer a range of benefits for system designers, namely allowing programmers to design arbitrarily complex privacy-preserving distributed systems using standard tools and programming idioms that run at close to native speed. Moreover, compared to cryptographic alternatives, Confidential Computing technology is available for use and deployment in real systems \emph{today}. Yet, the emergence of Confidential Computing technology poses some interesting problems. First, note that Confidential Computing technologies simply provide an empty, albeit secure, isolate. Associated questions like how computations are securely provisioned into an isolate, how to make this process straightforward and foolproof, and how systems are designed and built around isolates as a new kind of primitive, are left unanswered. Moreover, for some types of distributed system---such as Grid and Ambient computing systems, previously discussed---it is feasible that \emph{different} types of isolate will be used within a single larger system. Here, bridging differences in attestation protocol and programming model will be key, as will be easing deployment and scheduling of computations hosted within isolates. For this reason, we introduce our main research contribution: \emph{Veracruz}, a framework that abstracts over isolates and their associated attestation processes. Veracruz supports multiple different isolation technologies, including hardware-backed isolates like AWS Nitro Enclaves and Arm Confidential Computing Architecture Realms on a private branch. Adding support for more is straightforward. Veracruz provides a uniform programming model across different supported isolates---using WebAssembly (Wasm, henceforth)\cite{webassembly}---and a generalized form of attestation, providing a ``write once, isolate anywhere'' style of development: programs can be protected using \emph{any} supported isolation technology without recompilation. Veracruz is discussed in \S\ref{sect.veracruz}. Veracruz captures a particularly general form of interaction between mutually mistrusting parties. As a result, Veracruz can be specialized in a straightforward manner to obtain an array of delegated, privacy-preserving computations of interest. In support of this claim we provide a description of how Veracruz can be used for secure ML model aggregation, and an industrial case-study built around AWS Nitro Enclaves, demonstrating an end-to-end encrypted video decoding and object-detection flow, using a deep learning framework processing video obtained from an IoT camera. These case-studies, and further benchmarking, are discussed in \S\ref{sect.evaluation}. In \S\ref{sect.hardware-backed.confidential.computing} we argue that Confidential Computing technology is likely to be widely deployed within industry, despite well-known flaws in particular implementations. Yet, \emph{billions} of existing devices have already been shipped without any explicit support for Confidential Computing, and these devices will continue to be used for years, if not decades, to come. Is there some \emph{pragmatic} isolation mechanism that we could use on ``legacy'' devices which, while falling short of the confidentiality and integrity guarantees offered by hardware-backed Confidential Computing mechanisms, can yet provide believable isolation for workloads? Rising to this challenge, we introduce our second research contribution: \emph{IceCap}, a pragmatic ``software isolate'' for Armv8-A devices without explicit support for Confidential Computing. IceCap uses the high-assurance \emph{seL4} microkernel to provide strong confidentiality and integrity guarantees for VMs, with little overhead. IceCap is supported by Veracruz, and taken together, one may design and deploy delegated computations across hardware- and software-isolates on next-generation and legacy hardware, alike. We introduce IceCap in \S\ref{sect.icecap}, as a stepping stone to the introduction of Veracruz. \section{Hardware-backed Confidential Computing} \label{sect.hardware-backed.confidential.computing} In addition to the already widely-deployed \emph{Arm TrustZone\textsuperscript{\textregistered}}~\cite{arm:trustzone:2020} and \emph{Intel Software Guard Extensions} (SGX)~\cite{costan:intel:2016}, an emerging group of novel \emph{Confidential Computing} technologies are being added to microprocessor architectures and cloud infrastructures, including \emph{AMD Secure Encrypted Virtualization} (SEV)~\cite{kaplan:amd:2016}, \emph{Arm Confidential Computing Architecture} (CCA)~\cite{arm-cca}, \emph{AWS Nitro Enclaves}~\cite{AWSNitroAttestation}, and \emph{Intel Trust Domain Extensions} (TDX)~\cite{intel:tdx}. All introduce a hardware-backed protected execution environment, which we call an \deffont{isolate}, providing strong \deffont{confidentiality} (the content of the isolate remains opaque to external observers) and \deffont{integrity} (the content of the isolate remains protected from interference by external observers) guarantees to code and data hosted within. These guarantees apply even in the face of a strong adversary, with any operating system or, in most cases even a hypervisor, outside of the isolate assumed hostile. Memory encryption may also be provided as a standard feature to protect against a class of physical attack. Isolates are often associated with an \deffont{attestation protocol}---e.g., \emph{EPID} for Intel SGX~\cite{5591478, DBLP:journals/tdsc/BrickellL12} and \emph{AWS Nitro Attestation} for AWS Nitro Enclaves~\cite{AWSNitroAttestation}. These permit a third party to garner strong, cryptographic evidence of the authenticity and configuration of a remote isolate. Some isolate implementations have unfortunately fallen short of their promised confidentiality and integrity guarantees. A substantial body of academic work, demonstrating that side-channel (see e.g.~\cite{sgx-step, 7163052, 203868, 10.1145/3243734.3243822, DBLP:journals/tches/HuoMWHZZL20, DBLP:conf/ches/MoghimiIE17, 206170, DBLP:journals/tches/DallMEGHMY18, 8806740, DBLP:conf/infocom/00170SLH18}) and fault injection attacks~\cite{Murdock2019plundervolt, 203864, 263816} can be used to exfiltrate secrets from isolates, now exists, and a perception---at least in the academic community and technical press---appears to be forming that isolates are fundamentally broken and any consequent research project that builds upon them need necessarily justify that decision. We argue that this emerging perception is an instance of \emph{the perfect being the enemy of the good}. First, we expect that many identified flaws will be gradually ironed out over time, either in point-fixes, iterated designs, or by the adoption of software models that avoid known vulnerabilities. For hardware, we have already seen some flaws fixed using microcode updates and other point-fixes by affected manufacturers (e.g,~\cite{sgx-platypus-microcode}). For software, research into methods designed to avoid known classes of side-channels is emerging, through implementation techniques such as constant-time algorithms, and dedicated type-systems such as FaCT~\cite{FaCT} and CT-Wasm~\cite{ct-wasm}. These may prove to be useful in implementing systems with isolates, and we summarize our own ongoing experimentation with these approaches in \S\ref{sect.closing.remarks}. Second, we expect that industrial adoption of isolates will be widespread, and arguably this is already in evidence with the formation of consortia such as the LF's \emph{Confidential Computing Consortium}~\cite{ccc}, and an emerging ecosystem of industrial users and startups. Researching systems that use isolates, and ease their deployment, is therefore not only justifiable, but very useful. Here, industrial users pragmatically evaluate isolate-based systems in comparison with the \emph{status quo}, where delegated computations are---by and large---left completely unprotected, and we argue that it is this standard which should be applied when evaluating systems built around isolates, not comparison with side-channel free cryptography which is still impractical in an industrial context. In this light, forcing malefactors to resort to side-channel and fault injection attacks---many of which are impractical, or can be defended against using others means---to exfiltrate data from an isolate is a welcome, albeit incremental, improvement in the privacy-guarantees that real systems can offer users. \section{IceCap} \label{sect.icecap} \emph{IceCap} is a hypervisor with a minimal trusted computing base (TCB, henceforth) built around the formally verified \emph{seL4} microkernel. IceCap provides a pragmatic and flexible \emph{software isolate} for many existing Armv8-A devices. The IceCap hypervisor relegates the untrusted operator to a domain of limited privilege called the host. This domain consists of a distinguished virtual machine---housing a rich operating system such as Linux---and a minimal accompanying virtual machine monitor. The host domain manages the device's CPU and memory resources, and drives device peripherals which the TCB does not depend on. This includes opaque memory and CPU resources for confidential virtual machines---or isolates. However, the host does not have the right to access the resources of isolates---while scheduling and memory management \emph{policy} is controlled by the host, \emph{mechanism} is the responsibility of more trustworthy components. IceCap's TCB includes the seL4 microkernel and compartmentalized, privileged seL4-native services running in EL0. These co-operate defensively with the host to expose isolate lifecycle, scheduling, and memory management mechanisms. At system initialization, the hypervisor extends from the device's root of trust via a device-specific measured boot process and then passes control to the untrusted host domain. A remote party coordinates with the host to spawn a new isolate by first sending a declarative specification of the isolate's initial state to IceCap's \emph{trusted spawning service}, via the host, which then carves-out the requested memory and CPU resources from resources which are inaccessible to the host. A process on the host, called the \emph{shadow virtual machine monitor}, provides untrusted paravirtualized device backends to isolates, and also acts as a \emph{token} representing the isolate in the host's scheduler, to enable the host operating system to manage isolate scheduling policy with minimal modification. To support attestation of isolates, IceCap would use a platform-specific measured boot to prove its own identity and then attest that of an isolate to a remote challenger. This is not yet implemented, with IceCap attestation being stubbed to support Veracruz, but straightforward to do so. seL4 is accompanied by security and functional correctness proofs, checked in \emph{Isabelle/HOL}~\cite{DBLP:conf/itp/SewellWGMAK11, DBLP:conf/cpp/MurrayMBGK12, DBLP:conf/sp/MurrayMBGBSLGK13}, providing assurance that IceCap correctly protects isolates from software attacks. By using seL4, IceCap will also benefit from ongoing research into the elimination of certain classes of timing channels~\cite{sel4-timing-protection}. The trusted seL4 userspace components of IceCap are not yet verified, though they are compartmentalized and initialized using \emph{CapDL}~\cite{capdl}, which has a formal semantics known to be amenable to verification~\cite{capdl-semantics} from previous work. Using the high-level seL4 API, these components are also implemented at a high level of abstraction in Rust, making auditing easier and eliminating the need to subvert the Rust compiler's memory safety checks---even for components which interact with hardware address translation structures. The IceCap TCB is small and limited in scope---about $40,000$ lines of code. Virtual machine monitors are moved to the trust domains of the virtual machines they supervise, thereby eliminating emulation code from the TCB. Towards that end, cross-domain fault handling is replaced with higher-level message passing via seL4 IPC. Isolates are also protected with the System MMU (SMMU) from attacks originating from peripherals under the host's control. IceCap is designed to seamlessly take advantage of additional hardware security features based on, or aligned with, address translation-based access controls---Arm TrustZone~\cite{arm:trustzone:2020}, for example. TrustZone firmware typically uses the \texttt{NS} state bit to implement a coarse context switch, logically partitioning execution on the application processor into two \emph{worlds}. IceCap could use this to run isolates out of secure-world memory resources, protected by platform-specific mechanisms which may mitigate certain classes of physical attack. Under IceCap, isolate and host incur a minimal performance overhead compared to host and guests under \emph{KVM}~\cite{kvm}. We use \emph{Firecracker}~\cite{firecracker}---an open-source VMM for KVM from AWS---as a point of comparison, due to its minimalism for the sake of performance, and preference for paravirtualization over emulation. Compute-bound workloads in IceCap isolates incur a ${\sim}2.2$\% overhead compared to native Linux processes and a ${\sim}1.8$\% overhead compared to Firecracker guests due to context switches through the TCB on timer ticks (see Table~\ref{fig.icecap.overheads}). The virtual network bandwidth between the host and an isolate represents how data flows through IceCap in bulk. However, at the time of writing, untrusted network device emulation differs from Firecracker's trusted network device emulation in ways that hinder a satisfying comparison, and with this in mind, we note guest-to-host incurs a ${\sim}9.9$\% bandwidth overhead, whereas host-to-guest outperforms Firecracker by a small margin. As IceCap's implementation matures, we expect virtual network bandwidth overhead to settle between these two points. \begin{table}[t!] \centering \small \begin{tabular}{rl@{\quad}l} \toprule & \multicolumn{2}{c}{Events per second (via \texttt{sysbench})} \\ \cmidrule(l){2-3} & Host & Guest \\ \midrule \emph{Firecracker} & 586.18 & 582.65 (-0.60\%) \\ \emph{IceCap} & 583.68 (-0.43\%) & 572.28 (-2.18\%) \\ \midrule & \multicolumn{2}{c}{Bandwidth (Gbits/sec)} \\ \cmidrule(l){2-3} & Guest $\rightarrow$ Host & Host $\rightarrow$ Guest \\ \midrule \emph{Firecracker} & 3.42 & 3.14 \\ \emph{IceCap} & 3.08 (-9.9\%) & 3.18 (+1.3\%) \\ \bottomrule \end{tabular} \caption{Overheads for IceCap compute-bound workloads (top) and virtual network performance (bottom)} \label{fig.icecap.overheads} \end{table} The great performance of seL4 IPC~\cite{sel4-ipc} helps reduce IceCap's performance overhead, and this is further helped by minimizing VM exits using aggressive paravirtualization: VMMs for both host and guest do not even map any of their VMs' memory into their own address spaces, and their only runtime responsibility is emulating the interrupt controller, with their VMs employing interrupt mitigation to even avoid that. Next, we introduce a framework for designing and deploying privacy-preserving delegated computations across various different isolation technologies---IceCap included. \subsection{Overview} \begin{figure*}[t] \centering \input{figs/component_diagram}% \spacehack{5pt} \caption[Veracruz component diagram]% {An overview of an abstract Veracruz computation, showing principals and their roles, major system components, and a suggestive depiction of data-flow. Isolates, such as those hosting the Veracruz runtime, are marked with boxes with padlocks } \label{fig:components} \label{fig:veracruz_overview} \end{figure*} Throughout this section we make reference to the system components presented in the schematic in Fig.~\ref{fig:veracruz_overview}. Veracruz is a \emph{framework} which may be specialized to obtain a particular privacy-preserving, collaborative computation of interest. A Veracruz computation involves an arbitrary number of \deffont{data owners}, trying to collaborate with a single \deffont{program owner}. The framework places no limits on the number of data owners, but a particular computation obtained by specializing Veracruz will always spell out a precise number of participants. We use $\pi$ to denote the program of the program owner, and use $D_i$ for $1 \leq i \leq N$ to denote the data sets of the various data owners in an arbitrary Veracruz computation. Collectively, the goal of the various principals, \circlenumber{P}, is straightforward: they wish to compute the value $\pi(D_1, \ldots, D_N)$, that is, the value of the program $\pi$ applied to the $N$ inputs of the various data owners. To do this, they may choose to make use of a third party machine to power the computation, \circlenumber{D}. We refer to the owner of this machine as the \deffont{delegate}, and this machine is assumed capable of launching an isolate of a type that Veracruz supports, loaded with the Veracruz \deffont{trusted runtime}, \circlenumber{V}. This runtime acts as a ``neutral ground'' within which a computation takes place, and provides strong \deffont{sandboxing} guarantees to the delegate, who is loading untrusted code in the form of $\pi$, onto their machine. The runtime is open-source, and auditable by principals, assuming bit-for-bit reproducible builds. Each principal in a Veracruz computation has a mixture of \deffont{roles}, consisting of some combination of \deffont{data provider}, \deffont{program provider}, \deffont{delegate}, and \deffont{result receiver}. While the first three have been implicitly introduced, the latter role refers to principals who will receive the result of the computation. The identification details of each principal, in the form of cryptographic certificates (or an IP address for the delegate), and their mixture of roles, is captured in a public \deffont{global policy} configuration file, \circlenumber{L}, which parameterizes each computation, and which also contains other important bits of metadata. Only one principal may be delegate or program provider. The global policy captures the \deffont{topology} of a computation, specifying where information may flow from, and to whom, in a computation, while varying the program $\pi$ varies precisely \deffont{what} is being computed. By varying the two, Veracruz can capture a general pattern of interaction shared by many delegated computations, and one could, for example, effect a varied palette of computations of interest, including: \noindent \emph{Moving heavy computations safely off a computationally-weak device to an untrusted edge device or server.} The computationally-weak device is both data provider and result receiver, the untrusted edge device or server is delegate, and the computationally-weak device or its owner is the program provider, providing the computation to be performed. \noindent \emph{Privacy-preserving machine learning between a pair of mutually distrusting parties with private datasets, but where learnt models are made available to both participants.} Both principals are data providers, contributing their datasets provided in some common format, and also act as result receivers for the learnt model. Arbitrarily one acts as program provider, providing the implementation of the machine learning algorithm of interest. A third-party, e.g.,~a Cloud host, acts as delegate. \noindent \emph{A DRM mechanism wherein novel IP (e.g.,~computer vision algorithms) are licensed out on a ``per use'' basis, and where the IP is never exposed to customers.} The IP owner is program provider, and the licensee is both data provider and result receiver, providing the inputs to, and receiving the output from, the private IP. The IP owner themselves may act as delegate, or this can be contracted out to a third-party. With this, the IP owner never observes the input or output of the computation, and the licensee never observes the IP. \noindent \emph{The implementation of privacy-preserving auctions.} An auction service acts as program provider, implementing a sealed-bid auction, and also acts as delegate. Bidders are data providers, submitting sealed bids. All principals are also result receivers, receiving notice of the auction winner and the price to be paid, which is public. Neither bidder nor auction service ever learn the details of any bids, other than their own and the winning bid. In addition, it is easy to see how more complex distributed systems can be built \emph{around} Veracruz. For example, a volunteer Grid computing framework where confidentiality is not paramount, but computational integrity is; an Ambient computing runtime for mobile computations across a range of devices; a privacy-preserving MapReduce~\cite{mapreduce} or Function-as-a-Service (FaaS, henceforth) style framework. Here, computational nodes act as an independent delegate for some aspect of the wider computation, and \emph{different} isolation technologies may also be used in a single computation, either due to availability for Grid or Ambient computing, or due to scheduling of sensitive sub-computations onto stronger isolation mechanisms for MapReduce. In the most general case, each principal in a Veracruz computation is mutually mistrusting, and does not wish to \deffont{declassify}---or intentionally reveal---their data: data providers do not wish to divulge their input datasets and the program provider does not wish to divulge their program. Nevertheless, as the examples enumerated above indicate, for some computations declassification \emph{can} be useful, for example as inducement to other principals to enroll in the computation, a ``nothing up my sleeve'' demonstration. Referring back to the privacy-preserving machine learning use-case, above, the program provider may \emph{intentionally} declassify their program for auditing---before other principals agree to participate---as a demonstration that the program implements the correct algorithm, and will not (un)intentionally leak secrets. Similarly, for a Grid computing project, revealing details of the computation, as an enticement to users to donate their spare computational capacity, may be beneficial. Declassification can also occur as a side effect of the computation itself, for example when the result of a computation---which can reveal significant amounts of information about its inputs, depending on $\pi$---is shared with an untrusted principal. Principals must evaluate the global policy carefully, before enrolling, to understand where results will flow to, and what they may say about any secrets. Though Veracruz can be used to design privacy-preserving distributed computations, not \emph{every} computation is necessarily privacy-preserving. Once the delegate has spawned an isolate with the Veracruz runtime loaded, the program and data owners establish a TLS connection, using a modified TLS handshake, with the isolate \circlenumber{T}, as will be described later in \S\ref{subsect.veracruz.attestation}. This handshake assures the principals that the isolate is, in fact, executing the Veracruz runtime specified in the global policy, and that the isolate is the other end of their TLS connection. Once this TLS channel is established, the program and data providers use it to \deffont{provision} their respective secrets directly into the isolate, \circlenumber{1} and \circlenumber{2}. This makes use of an untrusted bridge, \circlenumber{U}, on the delegate's machine but outside of the isolate, to forward encrypted TLS data received into the isolate itself. To the delegate, communication via this bridge is immutable and opaque---except for sizing and timing information that TLS leaks---unless they can subvert TLS. Note that TLS configuration options, including permitted ciphersuites, and the \texttt{SHA-256} hash of the program $\pi$, are also specified in the global policy. This latter aspect ensures that when a program, $\pi$, is declassified, it can be audited by other principals, and verified to be the same program provisioned into the isolate. Provisioned secrets are stored as files in a virtual, \deffont{in-memory filesystem} maintained by the Veracruz runtime, \circlenumber{S}. The contents of this filesystem never leave the isolate, and are destroyed when the isolate is torn down. The paths of data inputs, $D_i$, are specified in the global policy file, as the program $\pi$ needs to know where its inputs are stored for processing when the computation starts executing. Similarly, the program $\pi$ is also stored as a file, and will be read from the filesystem itself when loaded for execution by the runtime. Once everything is in place, a result receiver may request the result of the computation, triggering the Veracruz runtime to load the provisioned program, $\pi$, into the execution engine, \circlenumber{S}, and either compute the result $\pi(D_1, \ldots, D_N)$, terminate with an error code, or diverge. Assuming a result is computed, it is stored by the program as a file in the filesystem at a path specified by the global policy. The runtime reads this path, or fails with an error if the program did not write a result there, and makes the result retrievable securely, via TLS, to all result receivers, \circlenumber{4}. The computation is now complete. \subsection{Attestation} \label{subsect.veracruz.attestation} \begin{figure*}[t] \centering \input{figs/attestation_diagram}% \spacehack{5pt} \caption{A schematic diagram of the Veracruz attestation service onboarding and challenge protocols} \label{fig:proxy_attestation} \end{figure*} Given Veracruz supports multiple isolation technologies, this poses a series of attestation-related problems: \emph{Complex client code}: Software used by principals delegating a computation to Veracruz must support multiple attestation protocols, complicating it. As Veracruz adds support for more isolation mechanisms---potentially with new attestation protocols---this client code must be updated to interact with the new class of isolate. \emph{Leaky abstraction}: Veracruz abstracts over isolation technology, allowing principals to easily delegate computations without worrying about the programming or attestation model associated with any one class of isolate. Forcing clients to switch attestation protocols, depending on the isolation technology, breaks this uniformity. \emph{Potential side-channel}: For some attestation protocols, each principal in a Veracruz computation must refer attestation evidence to an external attestation service. \emph{Attestation policy}: principals may wish to disallow computations on delegates with particular isolation technologies. These policies may stem from security disclosures---vulnerabilities in particular firmware versions, for example---changes in business relationships, or geopolitical trends. Given our support for heterogeneous isolation technologies, being able to declaratively specify who or what can be trusted becomes desirable. Existing attestation services do not take policy into account, pushing the burden onto client code---problematic if policy changes, as client code must be updated. In response, we introduce a \deffont{proxy attestation service} for Veracruz, which must be explicitly trusted by all principals to a computation, with associated server and management software open source, and auditable by anyone. This service is not protected by an isolate, though in principle could be, and doing so would allow principals to check the authenticity of the proxy attestation service, before trusting it, for example. Implementing this would be straightforward; for now we assume that the attestation service is trusted, implicitly. The proxy attestation service first uses an \deffont{onboarding} process to enroll an isolate hosting Veracruz, after which the isolate can act as a TLS server for principals participating in a computation. We describe these steps, referring to Fig.~\ref{fig:proxy_attestation}. \paragraph{Onboarding an isolate} The proxy attestation service maintains a root CA key (a public/private key pair) and a Root CA certificate containing the root CA public key, signed by the root CA private key. This root CA certificate is included in the global policy file of any computation using that proxy attestation service. An onboarding protocol is then followed: \begin{enumerate*} \item Upon initialization inside the isolate, the Veracruz runtime \circlenumber{V} generates an asymmetric key pair, along with a \emph{Certificate Signing Request} (or CSR, henceforth)\cite{RFC2986} for that key pair. \item The Veracruz runtime performs the platform's \deffont{native attestation flow} \circletwonumbers{O}{1} with the proxy attestation server acting as challenger \circlenumber{X}. These native attestation flows provide fields for user-defined data, which we fill with a cryptographic hash (\texttt{SHA-256}) of the CSR, which cryptographically binds the CSR to the attestation data, ensuring that they both come from the same isolate. The Veracruz runtime sends the CSR to the proxy attestation server along with the attestation evidence. \item The proxy attestation server \deffont{authenticates} the attestation evidence received via the native attestation flow. Depending on the particular protocol, this could be as simple as verifying signatures via a known-trusted certificate, or by authenticating the received evidence using an external attestation service. \item The proxy attestation service computes the hash of the received CSR and compares it against the contents of the user-defined field of the attestation evidence. If it matches, it confirms that the CSR is from the same isolate as the evidence. \item The proxy attestation server converts the CSR to an \texttt{X.509} Certificate~\cite{RFC5280} containing a custom extension capturing details about the isolate derived from the attestation process, including a hash of the Veracruz runtime executing inside the isolate (and optionally other information about the platform on which the isolate is executing). The certificate is signed by the private component of the proxy attestation server's Root CA key. \item The proxy attestation server returns the generated certificate to the Veracruz runtime inside the isolate. \end{enumerate*} In the typical CA infrastructure, a delegated certificate can be revoked by adding it to a \emph{Certificate Revocation List}, checked by clients before completing a TLS handshake. While this scheme is possible with our system, we elected to use a different approach, setting the expiry in the isolate's certificate to a relatively short time in the future, so that the proxy attestation service can limit the amount of time a compromised isolate can be used in computations. The lifetime of isolate certificates can be decided upon via a policy of the proxy attestation service, based upon their appetite for risk. \paragraph{Augmented TLS handshake} After an isolate is onboarded, \circletwonumbers{O}{1}, a principal, \circlenumber{R} can attempt to connect to it, using an augmented TLS handshake. In response to the ``Client Hello'' message sent by the principal, the isolate responds with a ``Server Hello'' message containing the certificate that the isolate received from the proxy attestation server, described above. The principal then verifies that certificate against the proxy attestation server root CA certificate contained within the global policy. If it matches, it recognizes that the certificate was indeed generated by the proxy attestation server. Recall that this certificate contains a custom extension. Assuming successful verification, the principal then checks the data contained in this extension against the expected values in the global policy. As currently implemented, the extension contains the hash of the Veracruz runtime, which is also listed in the global policy, and the two are checked by the principal. If they match, the principal continues the TLS handshake, confident in the fact that it is talking to a Veracruz runtime executing inside of a supported isolation technology. Note that the proxy attestation service solves the problems with attestation described above. First, client code is provided with a uniform attestation interface---here, we use Arm's PSA attestation protocol~\cite{Tschofenig_2019}---independent of the underlying isolation technology in use. Second, none of the principals in the computation need to communicate with any native attestation service. Thus, the native attestation service knows that software was started in a supported isolate, but it has no knowledge of the identities or even the number of principals. Finally, the global policy represents the only source of policy enforcement. The authors of the global policy can declaratively describe who and what they are willing to trust, with a principal's client software taking this information into account when authenticating or rejecting an attestation token. Lastly, we note. that our attestation process is specifically designed to accommodate client code running on embedded microcontrollers---e.g.,~Arm Cortex\textsuperscript{\textregistered}-M3 devices---with limited computational capacity, constrained memory and storage (often measured in tens of kilobytes), and which tend to be battery-powered with limited network capacity. Communication with an attestation service is therefore cost- and power-prohibitive, and using a certificate-based scheme allows constrained devices to authenticate an isolate running Veracruz efficiently. To validate this, we developed Veracruz client code for microcontrollers, using the Zephyr embedded OS~\cite{zephyr}. Our client code is {9}{\kiloB} on top of the \texttt{mbedtls} stack~\cite{mbedtls}, generally required for secure communication anyway. Using this, small devices can offload large computations safely to an attested Veracruz instance. \subsection{Programming model} \label{subsect.veracruz.programming.model} Wasm~\cite{wasm-semantics} is designed as a sandboxing mechanism for use in security-critical contexts---namely web browsers---designed to be embeddable within a wider host, has a precise semantics~\cite{DBLP:conf/cpp/Watt18}, is widely supported as a target by a number of high-level programming languages such as Rust and C, and has high-quality interpreters~\cite{wasmi} and JIT execution engines available~\cite{wasmtime}. We have therefore adopted Wasm as our executable format, supporting both interpretation and JIT execution, with the strategy specified in the global policy. Veracruz uses Wasm to protect the delegate's machine from the executing program, to provide a uniform programming model, to constrain the behavior of the program, and to act as a portable executable format for programs, abstracting away the underlying instruction set architecture. Via Wasm, the trusted Veracruz runtime implements a ``two-way isolate'' wherein the runtime is protected from prying and interference from the delegate, and the delegate is protected from malicious program behaviors originating from untrusted code. To complete a computation, a Wasm program needs some way of reading inputs provided to it by the data provider, and some way of writing outputs to the result receivers. However, we would like to constrain the behavior of the program as far as possible: a program dumping one of its secret inputs to \texttt{stdout} on the host's machine would break the privacy guarantees that Veracruz aims to provide, for example. Partly for this reason, we have adopted the WebAssembly System Interface~\cite{wasi} (or Wasi, henceforth) as the programming model for Veracruz. Intuitively, this can be thought of as ``Posix for Wasm'', providing a system interface for querying Veracruz's in-memory filesystem, generating random bytes, and executing other similar system tasks. (In this light, the Veracruz runtime can be seen as a simple operating system for Wasm.) By adopting Wasi, one may also use existing libraries and standard programming idioms when targeting Veracruz. Wasi uses \deffont{capabilities}, in a similar vein to Capsicum~\cite{DBLP:journals/cacm/WatsonALK12}, and a program may only use functionality which it has been explicitly authorized to use. The program, $\pi$'s, capabilities are specified in the global policy, and typically extend to reading inputs, writing outputs, and generating random bytes, constraining the program to act as a pure, randomized, function. \subsection{Ad hoc acceleration} \label{subsect.veracruz.ad.hoc.acceleration} Many potential Veracruz applications make use of common, computationally intensive, or security-sensitive routines: cryptography, (de)serialization, and similar. While these routines could be compiled into Wasm, this may incur a performance penalty compared to optimized native code, and for operations such as cryptography, compilation to Wasm may not preserve security properties such as timing side-channel safety. Rather, it is beneficial to provide a single, efficient, and correct implementation for common use, rather than routines being compiled into Wasm code haphazardly. In response, we introduced ``native modules'' providing acceleration for specific tasks which are linked into the Veracruz runtime and invoked from Wasm programs. In benchmarking one such module---the acceleration of (de)serialization of \texttt{Json} documents from the \texttt{pinecone} binary format---we observe a $35$\% speed-up when (de)serializing a vector of $10,000$ random elements ($238$s native vs.~$375$s Wasm). Additional optimization will likely further boost performance. Given the \emph{ad hoc} nature of these accelerators, their lack of uniformity, and the fact that more will be added over time, invoking them from Wasm is problematic. Extending the Veracruz system interface to incorporate accelerator-specific functionality would take us beyond Wasi, and require the use of support libraries for programming with Veracruz. Instead, we opt for an interface built around \deffont{special files} in the Veracruz filesystem, with modules invoked by Wasm programs writing-to and reading-from these files, reusing existing programming idioms and filesystem support in Wasi. \subsection{Threat model} \label{subsect.veracruz.threat.model} The Veracruz TCB includes the underlying isolate, the Veracruz runtime, and the implementation of the Veracruz proxy attestation service. The host of the Veracruz attestation service must also be trusted by all parties, as must the native attestation services or keys in use. The correctness of the various protocols in use---TLS, platform-specific native attestation, and PSA attestation---must also be trusted. The Wasm execution engine must also be trusted to correctly execute a binary, so that a computation is faithfully executed according to the published bytecode semantics~\cite{DBLP:journals/cacm/RossbergTHSGWZB18, DBLP:conf/cpp/Watt18}, and that the program is unable to escape its sandbox, damage or spy on a delegate, or have any other side-effect than allowed by the Veracruz sandboxing model. Recent techniques have been developed that use post-compilation verification to establish this trust~\cite{johnson2021}---we briefly discuss our ongoing experiments in this area in \S\ref{sect.closing.remarks}. Compiler verification could be used to engender trust in the Wasm execution engine, though we are not aware of any verified, high-performance Wasm interpreters or JITs suitable for use with Veracruz at the time of writing (see~\cite{Watt2021Two} for progress toward this, however). Memory issues have been implicated in attacks against isolates in the past~\cite{10.5555/3241189.3241231}---we write Veracruz in Rust in an attempt to avoid this, with the compiler therefore also trusted. Veracruz does not defend against denial-of-service attacks: the delegate is in charge of scheduling execution, and liveness guarantees are therefore impossible to uphold. A malicious principal can therefore deny others access to a computation's result, or refuse to provision a data input or program, thereby blocking the computation from even starting. Different isolation technologies defend against different classes of attacker, and as Veracruz supports multiple technologies we must highlight these differences explicitly. AWS Nitro Enclaves protect computations from the AWS customer running the EC2 instance associated with the isolate. While AWS assures users that isolates are protected from employees and other insiders, these assurances are difficult to validate (and, as silicon manufacturer, AWS and its employees must always be trusted). Our TCB therefore also contains the Nitro hardware, Linux host used inside the isolate, the attestation infrastructure for Nitro Enclaves, and any AWS insiders with access to that infrastructure. For Arm CCA Realms only the \emph{Realm Management Monitor} (RMM, henceforth), a separation kernel isolating Realms from each other, has access to the memory of a Realm other than the software executing in the Realm itself. Realms are protected from the non-secure hypervisor, and any other software running on the system other than the RMM, and will be protected against a class of physical attacks using memory encryption. Our TCB therefore contains the RMM, the system hardware, Linux host inside the Realm, along with the attestation infrastructure for Arm CCA. For IceCap our TCB includes the seL4 kernel which we rely on to securely isolate processes from one another, bolstered by a body of machine-checked proofs of the kernel's security and functional correctness (though at present these do not extend to the \texttt{EL2} configuration for AArch64). For a typical hypervisor deployment of seL4, the SMMU is the only defence against physical attacks. The TCB of Veracruz includes both local and remote stacks of hardware and software, while purely cryptographic techniques merely rely on a trustworthy implementation of a primitive and the correctness of the primitive itself. As demonstrated in \S\ref{sect.evaluation}, Veracruz provides a degree of efficiency and practicality currently out of reach for purely cryptographic techniques, at the cost of this larger TCB. Principals face a challenging class of threats stemming from collusion between the other principals, including the delegate. Some algorithms may be particularly vulnerable to an unwanted declassification of secret inputs to any result receiver, and some attacks may be enhanced by collusion between principals---e.g., a side-channel inserted into the program for the benefit of the delegate. As discussed in \S\ref{sect.hardware-backed.confidential.computing}, several powerful side-channel attacks have been demonstrated in the past against software executing within isolates, and other side-channels also exist including wall-clock execution time of the program, $\pi$, on the input data sets, and data sizes and arrival times leaked by TLS connections. In cases where programs are secret, principals must trust the program provider not to collude with the result receiver, as a secret program could trivially intentionally leak data into the result or contain convert channels. If the existence of this trust relationship is undesirable, then principals should insist on program declassification before enrolling in a computation. \subsection{Case-study: deep learning} \label{subsect.evaluation.case-study.deep.learning} Training datasets, algorithms, and learnt models may be sensitive IP and the learning and inference processes are vulnerable to malicious changes in model parameters that can cause a negative influence on a model's behaviors that is hard to detect~\cite{bagdasaryan2020backdoor, mo2021ppfl}. We present two Veracruz case-studies in protecting deep learning (DL henceforth) applications: privacy-preserving training and inference, and privacy-preserving model aggregation service, a step toward \emph{federated} DL. We use \emph{Darknet}~\cite{darknet13,mo2020darknetz} in both cases, and the \emph{Open Neural Network eXchange}~\cite{onnx2019, connxr2021} (\emph{ONNX}, henceforth) as the aggregation format. We focus on the \emph{execution time} of training, inference, and model aggregation on the \emph{Core~i7}~test platform. In the training and inference case-study, the program receives input datasets from the respective data providers and a pre-learnt model from a model provider. Thereafter, the provisioned program starts training or inference, protected inside Veracruz. The results---that is, the trained model or prediction---are made available to a result receiver. In the model aggregation case-study, clients conduct \emph{local training} with their favorite DL frameworks, convert the models to \emph{ONNX} format, and provision these derived models into Veracruz. The program then aggregates the models, making the result available to all clients. By converting to \emph{ONNX} locally, we support a broad range of local training frameworks---i.e., \emph{PyTorch}~\cite{pytorch2019}, \emph{Tensorflow}~\cite{tensorflow2015}, \emph{Darknet}, or similar. We trained a LeNet\cite{lecun1998gradient} on \emph{MNIST}\cite{lecun1998gradient}, a dataset of handwritten digits consisting of $60,000$ training and $10,000$ validation images. Each image is $28{\times}28$ pixels and less than {1}{\kibiB}; we used a batch size of $100$ in training, obtaining a trained model of {186}{\kibiB}. We take the average of $20$ trials for training on 100 $batches$ (hence, 10,000 images) and then ran inference on one image. For aggregation, we use three copies of this \emph{Darknet} model ({186}{\kibiB}), obtaining three \emph{ONNX} models ({26}{\kibiB}), performing $200$ trials for aggregation, as aggregation time is significantly less. Results are presented in Fig.~\ref{fig:veracruz.learning}. For all DL tasks we observe the same execution time between Wasmtime and Veracruz, as expected, with both around $2.1$--$4.1\times$ slower than native CPU-only execution, likely due to more aggressive code optimization available in native compilers. However, the similarity between Wasmtime and Veracruz diverges for file operations such as loading and saving of model data. Loading data from disk is $1.2$--$3.1\times$ slower when using Wasmtime compared to executing natively. However, I/O in Veracruz is usually \emph{faster} than Wasmtime, and sometimes faster than native execution, e.g., when saving images in inference. This is likely due to Veracruz's in-memory filesystem exhibiting a faster read and write speed transferring data, compared to the SSD of the test machine. \subsection{Case-study: video object detection} \label{subsect.evaluation.case-study.video.object.detection} We have used Veracruz to prototype a \emph{Confidential FaaS}, running on AWS Nitro Enclaves and using \emph{Kubernetes}~\cite{kubernetes}. In this model, a cloud infrastructure or other delegate initializes an isolate containing only the Veracruz runtime and provides an appropriate global policy file. Confidential functions are registered in a \emph{Confidential Computing as a Service} (CCFaaS, henceforth) component, which acts as a registry for clients wishing to use the service and which collaborates, on behalf of clients, with a \emph{Veracruz as a Service} (VaaS, henceforth) component which manages the lifetime of any spawned Veracruz instances. Together, the CCFaaS and VaaS components draft policies and initialize Veracruz instances, while attestation is handled by clients, using the proxy attestation service. Building atop this confidential FaaS infrastructure, we applied Veracruz in a full end-to-end encrypted video object detection flow (see Fig.~\ref{fig:APP-model-2}). Our intent is to demonstrate that Veracruz can be applied to industrially-relevant use-cases: here, a video camera manufacturer wishes to offer an object detection service to their customers while providing believable guarantees that they cannot access customer video. The encrypted video clips originating from an IoTeX Ucam video camera~\cite{iotexucam} are stored in an \emph{AWS S3} bucket. The encryption key is owned by the camera operator and perhaps generated by client software on their mobile phone or tablet. Independently, a video processing and object detection function, compiled to Wasm, is registered with the CCFaaS component which takes on the role of program provider in the Veracruz computation. This function makes use of the Cisco \texttt{openh264} library as well as the Darknet neural network framework and a prebuilt YOLOv3 model, as previously discussed in \S\ref{subsect.evaluation.case-study.deep.learning}, for object detection (our support for Wasi eased this porting). \begin{figure}[t!] \centering \vspace*{-10pt} \input{figs/faas} \caption{Video object detection case-study} \label{fig:APP-model-2} \end{figure} Upon the request of the camera owner, the CCFaaS and VaaS infrastructure spawn a new AWS Nitro Enclave loaded with the Veracruz runtime, and configured using an appropriate global policy that lists the camera owner as having the role of data provider and result receiver. The confidential FaaS infrastructure forwards the global policy to the camera owner, where it is automatically analyzed by their client software, with the camera owner thereafter attesting the AWS Nitro Enclave instance. If the global policy is acceptable, and attestation succeeds, the camera owner securely connects to the spawned isolate, containing the Veracruz runtime, and securely provisions their decryption key using TLS in their role as data provider. The encrypted video clip is also then provisioned into the isolate, by a dedicated AWS S3 application, which is also listed in the global policy as a data provider, and the computation can then go ahead. Once complete, meta-data containing the bounding boxes of any object detected in the frames of the video clips can be securely retrieved by the camera owner via TLS, in their result receiver role, for interpretation by their client software. Note that in this FaaS infrastructure desirable cloud application characteristics are preserved: the computation is on-demand and scaleable, and our infrastructure allows multiple instances of Veracruz, running different functions, to be executed concurrently. Only the AWS S3 application, the camera owner's client application and the video decoding and object detection function are specific to this use-case. All other modules are generic, allowing other applications to be implemented. Moreover, note that no user credentials or passwords are shared directly with the FaaS infrastructure in realizing this flow, beyond the name of the video clip to retrieve from the AWS S3 bucket and a one-time access credential for the AWS S3 application. Decryption keys are only shared with the Veracruz runtime inside an attested isolate. We benchmark by passing a $1920{\times}1080$ video to the object detection program, which decodes frame by frame, converts, downscales, and passes frames to the ML model. We compare four configurations on two different platforms: \begin{itemize*} \item On \emph{EC2}, a native \texttt{x86-64} binary on Amazon Linux; a Wasm binary under Wasmtime-0.27; a Wasm binary inside Veracruz as a Linux process; a Wasm binary inside Veracruz on AWS Nitro Enclaves. The video is $240$ frames long and fed to the YOLOv3-608 model~\cite{yolov3}. \item On \emph{RPi4}: a native AArch64 binary on Ubuntu 18.04 Linux; a Wasm binary under Wasmtime-0.27; a Wasm binary inside Veracruz as a Linux process; a Wasm binary inside Veracruz on IceCap. Due to memory limits the video is $240$ frames long and fed to the YOLOv3-tiny model~\cite{yolov3}. \end{itemize*} We take the native \texttt{x86-64} configuration as our baseline, and present average runtimes for each configuration, along with observed extremes, in Fig.~\ref{fig:veracruz.vod}. \begin{table}[t] \centering \begin{tabular}{ll} \hline Description & Time (ms) \\ \hline \emph{Proxy Attestation Service start} & 7 \\ \emph{Onboard new Veracruz isolate} & 3122 \\ \emph{Request attestation message} & 54 \\ \emph{Initialization of Veracruz isolate} & 1 \\ \emph{Check hashes (including TLS handshake)} & 184 \\ \emph{Provision object detection program} & 798 \\ \emph{Provision data (model, video)} & 282323 \\ \hline \end{tabular} \caption{Breakdown of Veracruz deployment overheads for the video object detection use-case on AWS Nitro Enclaves} \label{fig.attestation.overheads} \end{table} \paragraph{\emph{EC2}~results} Wasm (with experimental SIMD support in Wasmtime) has an overhead of ${\sim}39$\% over native code; most CPU cycles are spent in matrix multiplication, which the native compiler can better autovectorize than the Wasm compiler. The vast majority of execution time is spent in neural network inference, rather than video decode or image downscaling. Since execution time is dominated by the Wasm execution, Veracruz overhead is negligible. A ${\sim}5$\% performance discrepancy exists between Nitro and Wasmtime, which could originate from our observation that Nitro is slower at loading data into an enclave, but faster at writing, though Nitro runs a different kernel with a different configuration, on a separate CPU, making this hard to pinpoint. Deployment overheads for Nitro are presented in Table~\ref{fig.attestation.overheads}, showing a breakdown of overheads for provisioning a new Veracruz instance. \paragraph{\emph{RPi4}~results} The smaller ML model significantly improves inference performance at the expense of accuracy. Wasm has an overhead of ${\sim}10$\% over native code, smaller than the gap on \emph{EC2}, and could be due to reduced vectorization support in GCC's AArch64 backend. Veracruz overhead is again negligible, though IceCap induces an overhead of ${\sim}3$\% over Veracruz-Linux. This observation approximately matches the overhead of ${\sim}2$\% for CPU-bound workloads measured in Fig.~\ref{fig.icecap.overheads}, explained by extra context switching through trusted resource management services during scheduling operations. Using ``native modules'', introduced in \S\ref{subsect.veracruz.ad.hoc.acceleration}, explicit support for neural network inference could be added to the Veracruz runtime, though our results above suggest a max ${\sim}38$\% performance boost by pursuing this, likely less due to the costs of marshalling data between the native module and Veracruz file system. For larger performance boosts, dedicated ML acceleration could be used, requiring support from the Veracruz runtime, though establishing trust in accelerators outside the isolate is hard, with PCIe attestation still a work-in-progress. \subsection{Further comparisons} \begin{figure}[t!] \centering \vspace*{-4pt} \hspace*{-10pt} \input{evaluation/ec2-polybench.tex}\hspace*{-14pt \input{evaluation/ec2-polybench-gmean.tex} \spacehack{10pt} \caption{Relative execution time (vs.~native) of PolyBench/C (large dataset) on \emph{EC2}. \texttt{gmean} shows the geometric mean of all results} \label{fig:veracruz-polybench} \end{figure} \paragraph{PolyBench/C microbenchmarks} We further evaluate the performance of Veracruz on compute-bound programs using the PolyBench/C suite (version 4.2.1-beta)~\cite{polybench}, a suite of small, simple computationally-intensive kernels. We compare execution time of four different configurations on the \emph{EC2}~ instance running \emph{Amazon Linux 2}: a native \texttt{x86-64} binary; a Wasm binary under Wasmtime-0.27; a Wasm binary under Veracruz as a Linux process; and a Wasm binary executing under Veracruz in an AWS Nitro Enclave. We take \texttt{x86-64} as our baseline, and present results in Fig.~\ref{fig:veracruz-polybench}. Wasmtime's overhead against native CPU execution is relatively small with a geometric mean of ${\sim}13$\%, though we observe that some test programs execute even faster under Wasmtime than when natively compiled. Again, we compile our test programs with Wasmtime's experimental support for SIMD proposal, though this boosts performance for only a few programs. Veracruz-Linux doesn't exhibit a visible overhead compared to Wasmtime, which is expected as most execution time is spent in Wasmtime, and the presence of the Veracruz VFS is largely irrelevant for CPU-bound programs. Veracruz-Nitro exhibits a small but noticeable overhead (${\sim}3$\%) compared to Veracruz-Linux, likely due to the reasons mentioned in \S\ref{subsect.evaluation.case-study.video.object.detection}. \paragraph{VFS performance} \begin{figure}[t!] \centering \newcommand{\gibs}[1]{((67108864/\thisrow{#1})/1024/1024/1024)} \vspace*{-10pt} \input{evaluation/fs-read.tex}\hspace*{-38pt \input{evaluation/fs-write.tex}\hspace*{-55pt \input{evaluation/fs-update.tex} \spacehack{10pt} \caption{VFS bandwidth: read (L), write (M) and update (R)} \label{fig:veracruz-vfs} \end{figure} We evaluate Veracruz VFS I/O performance, previously discussed in \S\ref{subsect.veracruz.programming.model}. Performance is measured by timing common granular file-system operations and dividing by input size, to find the expected bandwidth. Results gathered on \emph{Core~i7}~test platform with a swap size of zero so that measurements would not be invalidated by physical disk access, are presented in Fig.~\ref{fig:veracruz-vfs}. Here, \deffont{read} denotes bandwidth of file read operations, \deffont{write} denotes bandwidth of file write operations with no initial file, and \deffont{update} denotes bandwidth of file write operations with an existing file. We use two access patterns, in-order and random, to avoid measuring only file-system-friendly access patterns. All random inputs, for both data and access patterns, used reproducible, pseudorandom data generated by \texttt{xorshift64} to ensure consistency between runs. All operations manipulate a {64}{\mebiB} file with {16}{\kibiB} buffer size---in practice, we expect most files will be within an order of magnitude of this size. We compare variations of our VFS against Linux's \texttt{tmpfs}, the standard in-memory filesystem for Linux. \deffont{Veracruz copy} moves data between the Wasm's sandboxed memory and the VFS through two copies, one at the Wasi API layer, and one at the internal VFS API layer. \deffont{Veracruz no-copy} improved on this by performing a single copy directly from the Wasm's sandboxed memory into the destination in the VFS. This was made possible thanks to Rust's borrow checker, which is able to express the temporarily shared ownership of the Wasm's sandboxed memory without sacrificing memory or lifetime safety. In theory this overhead can be reduced to zero copies through \texttt{memmap}, however this API is not available in standard Wasi. \deffont{Veracruz no-copy+soo} is our latest design, extending the no-copy implementation with a small-object optimization (SOO) \texttt{iovec} implementation---a Wasi structure describing a set of buffers containing data to be operated on, which for the majority of operations contain a reference to a single buffer. Through this, we inline two or fewer buffers into the \texttt{iovec} structure itself, completely removing memory allocations from the read and write path for all programs we tested with. Performance impact is negligible, however. Being in an-memory filesystem, the internal representation is relatively simple: directories and a global \texttt{inode} table are implemented using hash tables, with each file represented as a vector of bytes. While apparently na\"{i}ve, these data-structures have seen decades of optimization for in-memory performance, and even sparse files perform efficiently due to RAM over-commitment by the runtimes. However, we were still surprised to see very close performance between Veracruz and \texttt{tmpfs}, with Veracruz nearly doubling the \texttt{tmpfs} performance for reads, likely due to the overhead of kernel syscalls necessary to communicate with \texttt{tmpfs} in Linux. (Unfortunately \texttt{tmpfs} is deeply integrated into the Linux VFS layer, so it is not possible to compare with \texttt{tmpfs} in isolation.) Both Veracruz and \texttt{tmpfs} use hash tables to store directory information, with the file data-structure and memory allocator representing significant differences. In Veracruz we use byte vectors backed by the runtime's general purpose allocator, whereas \texttt{tmpfs} uses a tree of pages backed by the Linux VFS's page cache, which acts as a cache-aware fixed-size allocator. We expect this page cache to have a much cheaper allocation cost, at the disadvantage of storing file data in non-linear blocks of memory---observable in the difference between the \deffont{write} and \deffont{update} measurements. For \deffont{write}, \texttt{tmpfs} outperforms Veracruz due to faster memory allocations and no unnecessary copies, while \deffont{update} requires no memory allocation, and has more comparable performance. \begin{figure}[t!] \centering \vspace*{-4pt} \input{evaluation/FHE.tex} \caption{SEAL and Veracruz computation performance} \label{fig:veracruz.vs.fhe} \end{figure} \paragraph{Fully-homomorphic encryption} An oft-suggested use-case for fully-homomorphic encryption (FHE, hencefoth) is protecting delegated computations. We briefly compare Veracruz against SEAL~\cite{microsoft:seal:2019}, a leading FHE library, in computing a range of matrix multiplications over square matrices of various dimensions. Algorithms in both cases are written in \texttt{C}, though floating point arithmetic is replaced by the SEAL multiplication function for use with FHE. Results are presented in Fig.~\ref{fig:veracruz.vs.fhe}. Our results demonstrate that overheads for FHE are impractical, even for simple computations. \begin{figure}[t!] \vspace*{-10pt} \input{evaluation/teaclave.tex} \spacehack{20pt} \caption{Execution times of Veracruz and Apache Teaclave} \label{fig:teaclave.polybench} \end{figure} \paragraph{Teaclave} Apache Teaclave~\cite{apache/incubator-teaclave-sgx-sdk_2020} is a privacy-preserving FaaS infrastructure built on Intel SGX, supporting Python and Wasm with a custom programming model using the Wamr~\cite{wamr} interpreter. We compare the performance of Teaclave running under Intel SGX with Veracruz as a Linux process, both on \emph{Core~i7}, and Veracruz on AWS Nitro enclaves on \emph{EC2}---admittedly an imperfect comparison, due to significant differences in design, isolation technology, Wasm runtime, and hardware between the two. We run the PolyBench/C suite with its mini dataset---Teaclave's default configuration errors for larger datasets---and measure end-to-end execution time, which includes initialization, provisioning, execution and fetching the results, which we present in Fig.~\ref{fig:teaclave.polybench}. While Veracruz has better performance than Teaclave when executing Wasm---with Veracruz under AWS Nitro exhibiting a mean $2.11\times$ speed-up compared to Teaclave in simulation mode, and faster still than Teaclave in SGX---the fixed initial overhead of Veracruz, ${\sim}4$s in Linux and ${\sim}2.7$s in AWS Nitro, dominates the overall overhead in either case. \section{Closing remarks} \label{sect.closing.remarks} We have introduced \emph{Veracruz}, a framework for designing and deploying privacy-preserving delegated computations among a group of mutually mistrusting principals, using isolates as a ``neutral ground'' to protect computations from prying or interference. In addition to supporting a number of hardware-backed Confidential Computing technologies---such as AWS Nitro Enclaves and Arm Confidential Computing Architecture Realms---Veracruz also supports pragmatic ``software isolates'' through \emph{IceCap}. IceCap makes use of the high-assurance seL4 microkernel, on Armv8-A platforms without any other explicit support for Confidential Computing, to provide strong isolation guarantees for virtual machines. Veracruz, with IceCap, provides a uniform programming and attestation model across emerging and ``legacy'' hardware platforms, easing the deployment of delegated computations. Both projects are open-source~\cite{icecap-repo, veracruz-repo}, and Veracruz is adopted by the LF's \emph{Confidential Computing Consortium}. \paragraph{Related work} Isolates have been used to protect a zoo of computations of interest, e.g.,~ML~\cite{10.5555/3241094.3241143, DBLP:conf/iclr/TramerB19, 10.1007/978-3-319-66402-6_21, 10.1145/3133956.3134095, DBLP:journals/corr/abs-1902-04413} and genomic computations~\cite{10.1007/978-3-030-00305-0_21, feng:presage:2016, 8613959}, and have been used to emulate or speed up cryptographic techniques such as functional encryption~\cite{10.1145/3133956.3134106} and secure multi-party computations~\cite{3f80bb9409ae4c659cc5b1ed26d751f8, 10.1007/978-3-662-53357-4_20, 10.1145/3338466.3358919}. These can be seen as use-cases, specialized with a particular policy and program, of Veracruz. \emph{OpenEnclave}~\cite{openenclave} provides a common development platform for SGX Enclaves and TrustZone trusted applications. Veracruz provides a higher-level of abstraction than OpenEnclave, and includes various support libraries, client code, and attestation protocols to ease the provisioning of programs into an isolate. Veracruz also supports a wider range of isolates, including both hardware- and software-isolates. Previous work~\cite{DBLP:conf/trust/KoeberlPRS0Z15} suggested a framework similar to Veracruz, but never implemented it. \emph{Google Oak}~\cite{google-oak}, \emph{Profian Enarx}~\cite{redhat-enarx}, \emph{Apache Teaclave}~\cite{mesatee}, \emph{Fortanix Confidential Computing Manager}~\cite{fortanix-confidential-computing-manager} and \emph{SCONE}~\cite{DBLP:conf/osdi/ArnautovTGKMPLM16} are similar to Veracruz, though significant differences exist. Oak's emphasis is information flow control, while Enarx, Fortanix, and SCONE protect the integrity of legacy computations, either requiring recompilation to Wasm, or supporting containerized workloads under SGX, respectively. Apache Teaclave is the most similar project, discussed in \S\ref{sect.evaluation}, and we perform significantly better. The proxy attestation service, and our certificate-based attestation protocol, especially suitable for clients on resource-constrained devices, is also unique. \emph{Protected KVM (pKVM)}~\cite{pkvm, deacon-pkvm} is an attempt to minimize the TCB of KVM, enabling virtualization-based confidential computing on mobile platform, and similar in spirit to IceCap. pKVM, with an EL2 kernel specifically designed for the task, may have higher performance than IceCap, but will not benefit from the formal verification effort invested in seL4. \emph{OPERA}~\cite{10.1145/3319535.3354220} places a proxy between client code and the Intel Attestation Service, exposing the same EPID protocol to clients as the web-service exposes. The Veracruz proxy exposes a potentially different protocol to client code, compared to the native protocol, due to the variety of isolates Veracruz supports. Intel's \emph{Data Center Attestation Primitives (DCAP)}, also serves similar use-cases, reducing the number of calls to an external attestation service when authenticating attestation tokens, though is limited to use with Intel SGX. \paragraph{Ongoing and future work} The proxy attestation service, which currently signs each generated certificate with the same key, could sign certificates for different isolation technologies with different keys, each associated with a different root CA certificate. With this, a global policy could choose which technology to support based on the selection of root CA certificate embedded in the policy, and if multiple isolation technologies were to be supported, more than one root CA certificate could be embedded. The proxy attestation server could also maintain multiple Root CA certificates, arranged into a ``decision tree of certificates'', with the server choosing a CA certificate to use when signing the isolate's certificate from the tree, following a path from the root described by characteristics of the isolate technology itself (e.g.,~name of the manufacturer, whether memory encryption is supported, and so on). Again, the certificate associated with the security profile of the desired isolation technology can be embedded in the policy. We also aim to bound the intensional and extensional properties of programs provisioned into Veracruz. Pragmatically, cryptographic operations are perhaps most sensitive to timing attacks, and we aim to provide a limited defense by supplying a constant-time cryptography implementation---using \texttt{mbedtls}~\cite{mbedtls}---via the native module facility discussed in \S\ref{subsect.veracruz.ad.hoc.acceleration}. Moreover, we aim to explore the use of a statically verified, constant-time virtual machine to gives users the option to statically verify timing properties of their programs---an area of significant recent academic interest---though likely at the cost of limiting their program to constant-time constructs, which is intractable for general-purpose programming. Using FaCT~\cite{FaCT} Veracruz could provide flexible, verifiably constant-time components such as virtual machines or domain specific functions, while the CT-Wasm~\cite{ct-wasm} extension for Wasm also provides verifiable, constant-time guarantees as a set of secrecy-aware types and bytecode instructions. CT-Wasm has not yet adopted by the Wasm committee. We are also continuing work on statically verifying the \emph{Software Fault Isolation} (SFI, henceforth) safety of sandboxed applications. SFI systems, such as Wasm, add runtime checks to loads, stores, and control flow transfers to ensure sandboxed code cannot escape from its address space region, though bugs in SFI compilers can (and do) incorrectly remove these checks and introduce bugs that let untrusted code escape its sandbox~\cite{bartel2018twenty, cranelift_bug}. To address this---following other SFI systems~\cite{morrisett2012rocksalt,zhao2011armor,yee2009native}---we have built a static verifier for binary code executed by Veracruz, implemented as an extension of \emph{VeriWasm}~\cite{veriwasm}, an open-source SFI verifier for compiled Wasm code. To adapt \emph{VeriWasm} to Veracruz, we added support for AArch64, and ported VeriWasm from the \emph{Lucet}~\cite{lucet} toolchain to Wasmtime, as used by Veracruz. We plan to further extend VeriWasm to check other properties besides software fault isolation, e.g., Spectre~\cite{narayan:2021:swivel} resistance. Finally, observe that the provisioned program, $\pi$, is either kept classified by its owner, or is declassified to a subset of the other principals in the computation (maybe all). In the former case, other principals either must either implicitly trust that $\pi$ behaves in a particular way, or establish some other mechanism bounding the behavior of the program, out-of-band of Veracruz. We aim for a middle ground, allowing a program owner to declassify runtime \emph{properties} of the program, enforced by Veracruz, while retaining secrecy of the program binary (using e.g.,~\cite{supervisionary}).
\section*{Competing interests} The authors declare no competing interests.
\section{Introduction} Crowd counting is to predict the number of people from an image or a video sequence. Accurate crowd counting for crowded scenes has important applications such as traffic control, preventing stampedes from occurring, and estimating participation in large public events like parades. During a pandemic, authorities may need to maintain social distancing for public spaces to minimize the risk of infection. Thus, crowd counting systems are usually deployed to multiple diverse scenarios, such as malls, museums, squares, and so on. For one site, the running system is expected to continually handle the non-stationary data with different densities, illumination, occlusion, and various head scales. For multiple sites, the system should also consider dozens of scenes and perspective information. As data is increasingly produced and labeling is time-consuming, the new domain data available for training are usually collected and labeled incrementally. We may ask: \textbf{\textit{how to sustainably handle the crowd counting problem among multiple domains using a single model when the newly available domain data arrive?}} We try to find the most potential solution to this question from the following aspects. Currently, most crowd counting approaches~\cite{zhang2016single,babu2017switching,sindagi2017generating,jiang2019learning,cao2018scale, chen2019scale,song2021choose,liu2019context,li2018csrnet,tian2019padnet,gao2022s,bai2020adaptive,ma2019bayesian,tan2019crowd,ma2020learning} concentrate on training an independent model for each single domain dataset. It heavily relies on the \textbf{i.i.d. assumption} that images from both the training set and test set are independently and identically distributed. Although producing promising counting performance in the corresponding domain, such a training strategy (See Figure~\ref{results: singledomain} (a)) has drawbacks in dealing with multiple and incremental new datasets, which are common in the real world ({\it e.g.}, when limited labeled data from a new site is available before applying the model at the site). One is that these separately trained models often have low generalization ability when dealing with new, unseen domain data due to the domain shift (See Table~\ref{results: singledomain}). Another is that saving multiple different sets of trained parameters from distinct domains for inference is not economical when deploying them to hundreds of thousands of real-world sites. Training a shared and universal model from scratch by mixing all the data~(a.k.a. joint training) or sequential training for each new-coming dataset may improve the performance on the unseen domains~(see Figure~\ref{figures: introduction} (b) and (c)). Nevertheless, both paradigms still have some limitations respectively. Joint training strategy~\cite{ma2021towards,yan2021towards} requires storing all training data from previous domains when the newly available one arrives, leading to lengthy training time and high storage overhead. Meanwhile, the latter training strategy will dramatically deteriorate the model's performance among previous domains after training the new domain data~(\textit{i.e.}, catastrophic forgetting). To overcome the aforementioned forgetting, generalization, and storage overhead issues, inspired by the learning mechanism of mammals, we investigate a new task of crowd counting in this paper, termed Lifelong Crowd Counting, which can sustainably learn with the new domain data and concurrently alleviate the catastrophic forgetting and performance drop among preceding domains under the domain-incremental training settings~(see Figure~\ref{figures: introduction} (d)). One thing to be claimed is that the goal of the proposed lifelong crowd counting task is different from that of previous cross-domain and multi-domain crowd counting tasks~\cite{chen2021variational, yan2021towards, ma2021towards}. During the whole lifelong learning process with incremental training data, the goal is to maximize the overall performance among all domains~(previously trained, newly arrived, and unseen) instead of only focusing on the target domain performance. We pay attention to the trade-off between the forgetting degree and the generalization ability of the models. More particularly, we develop a novel benchmark of domain-incremental lifelong crowd counting with the help of knowledge self-distillation techniques. The proposed benchmark has both {\bf strong generalization ability} on unseen domains and {\bf low forgetting degrees} among seen domains. It helps the model to be equipped with the sustainable counting capability with the new data arrived in the future. In our experiments, we utilize four fruitful crowd counting backbones, CSRNet~\cite{li2018csrnet}, SFANet~\cite{zhu2019dual}, DM-Count~\cite{wang2020distribution}, and DKPNet~\cite{chen2021variational} to illustrate the effectiveness and superiority of our proposed framework. Our \textbf{main contributions} can be summarized as follows. \begin{itemize} \item To the best of our knowledge, it is the first work to investigate lifelong crowd counting through considering the catastrophic forgetting and generalization ability issues. Our method may serve as a benchmark for further research in the lifelong crowd counting community. \item We design a \textbf{B}alanced \textbf{D}omain \textbf{F}orgetting loss function (BDFLoss) to prevent the model from forgetting the previous knowledge dramatically when being trained on the newly-arrived crowd counting dataset. \item We propose a new quantitative metric \textbf{n}ormalized \textbf{B}ack\textbf{w}ard \textbf{T}ransfer (nBwT) of the lifelong crowd counting, to measure the forgetting degree of trained models among seen data domains. Meanwhile, we treat the \textbf{M}ean \textbf{A}bsolute \textbf{E}rror (MAE) as the criteria for evaluating model generalization on the unseen data domain. \item Extensive experiments indicate that our proposed method has a lower degree of forgetting compared with sequential training, and outperforms the joint training strategy on the unseen domain with a much lower MAE score and time and space complexity. \end{itemize} \begin{table*}[ht] \caption{The MAE (mean absolute error) scores of our reproduced DM-Count~\cite{wang2020distribution} model separately trained in a single dataset and tested over other datasets. It shows the obvious performance drop due to the domain discrepancy.} \centering \resizebox{0.4\linewidth}{!}{ \begin{tabular}{l|c|c|c|c} \toprule[1pt] \textbf{\diagbox{Train}{Test}} & \textbf{SHA} & \textbf{SHB} & \textbf{QNRF} & \textbf{NWPU} \\ \midrule[0.5pt] SHA & \textbf{59.7} & 19.0 & 143.3 & 161.1 \\ SHB & 124.6 & \textbf{7.0} & 209.9 & 179.1 \\ QNRF & 69.6 & 14.0 & \textbf{85.6} & 124.8 \\ NWPU & 74.7 & 11.7 & 100.9 & \textbf{88.4} \\ \bottomrule[1pt] \end{tabular} } \label{results: singledomain} \end{table*} \section{Methodology} In this section, we will first introduce a concrete formalized definition between typical crowd counting and proposed lifelong crowd counting. After that, we will describe the details of our proposed domain-incremental self-distillation lifelong crowd counting benchmark including model architectures and the proposed loss function. \subsection{Problem Formulation} \subsubsection{\textbf{Typical Crowd Counting}} The typical crowd counting task can be regarded as a density map regression problem, training and validating in a single domain (See Figure~\ref{figures: introduction} (a)). Suppose one dataset $D_{\mathcal{M}} = <X_{\mathcal{M}}, Y_{\mathcal{M}}>$ contains $\mathcal{M}$ training images and the corresponding annotations. Then, a binary map $\textbf{B}$ is easy to obtain given the coordinates of pedestrians' heads per image. \begin{equation} \textbf{B}_{(i,j)} = \left\{ \begin{array}{ll} 1, & \text{head center } (i,j) \\ 0, & \text{otherwise} \\ \end{array} \right. \end{equation} The ground truth density map $Y$ is generated by employing the Gaussian kernel $G_\sigma$ to smooth the binary map. \begin{equation} Y = G_\sigma * \textbf{B}\;. \end{equation} Here, `*' represents the convolution operation. Then, the typical crowd counting is transformed to regress the generated density maps. The pixel-level $\mathcal{L}_2$ loss is the most commonly used one to optimize the model $\mathcal{F}(\cdot;\theta)$ with the parameter $\theta$ by minimizing the difference between predictions and ground truths. \begin{equation} \min_\theta \frac{1}{\mathcal{M}}\sum_{m=1}^{\mathcal{M}}\mathcal{L}_2(\mathcal{F}(X_m; \theta), Y_m)\;. \end{equation} \subsubsection{\textbf{Lifelong Crowd Counting}} We propose a new, challenging yet practical crowd counting task, {\textit{i.e.}}, lifelong crowd counting, for investigating the catastrophic forgetting and model generalization problems with training domain-incremental datasets. Different from previous work only keeping good performance in a single target domain, the lifelong crowd counting model could be sustainably optimized over the new-coming datasets to maximize the performance among all domains. For convenience, we first define some key notations as follows and introduce the details of the lifelong crowd counting process. A sequence of $\mathcal{N}$ domain datasets $\{\mathcal{D}_1, \mathcal{D}_2,...,\mathcal{D}_{\mathcal{N}}\}$ is prepared to train the lifelong crowd counter $\mathcal{G}^*(\cdot;\psi)$ with parameters $\psi$ one by one. $X_{\mathcal{M}_t}^{(t)}$ and $Y_{\mathcal{M}_t}^{(t)}$ are the training images and corresponding ground truth density maps with $\mathcal{M}_t$ samples from the $t$-th domain $\mathcal{D}_t$, respectively. Here, we assume different datasets are coming from different domains with their own distinct data distributions, {\textit{i.e.}} $p(X^{(i)}) \neq p(X^{(j)}), i \neq j$ because they are normally captured from different cameras or different scenarios like streets, museums, gymnasiums, etc. The model is initially trained from scratch over the first domain and then will be trained and optimized by the rest of the other datasets sequentially. The optimal object $\psi^{*}$ is defined as follows: \begin{equation} \mathop{\arg\min}\limits_{\psi} \sum_{t=1}^{\mathcal{N}} \mathbb{E}_{(X_{\mathcal{M}_t}^{(t)},Y_{\mathcal{M}_t}^{(t)})} [ \mathcal{L} (\mathcal{G}^{(t)}(X_{\mathcal{M}_t}^{(t)};\psi), Y_{\mathcal{M}_t}^{(t)}) ]\;, \end{equation} where $\mathcal{G}^{(t)}(\cdot;\psi)$ represents the $t$-th model for training $t$-th dataset $X_{\mathcal{M}_t}^{(t)}$ with $\mathcal{M}_t$ samples. The ultimate model is expected to achieve decent performance among seen and unseen domains. What deserves to be pointed out is that lifelong crowd counting is distinct from cross-domain tasks with different optimization objectives, as well as the training settings. In lifelong crowd counting, the goal is to maximize the performance on both seen and unseen domains instead of maximizing the target domain performance only. Especially when the training data from previous domains are absent or unavailable, lifelong crowd counters could still work efficiently because they are trained and updated only by the newly-arrived domain dataset one after another. \begin{figure*}[ht] \begin{center} \includegraphics[width=0.65\linewidth]{figs/model.pdf} \end{center} \caption{The overall architecture of our proposed domain-incremental self-distillation learning benchmark~(FLCB).} \label{figures: model} \end{figure*} \begin{algorithm*}[ht] \caption{Training Pipeline.}\label{training_pipeline} \SetKwInOut{Notation}{\hspace{20pt}Notation} \SetKwInOut{Input}{\hspace{20pt}Input} \SetKwInOut{Output}{\hspace{20pt}Output} \Indm\Indmm \Notation{\\\hspace{-30pt}$X^{(t)}_{\mathcal{M}_t}:$ The $t$-th training dataset with $\mathcal{M}_t$ samples.\\\hspace{-30pt} $Y^{(t)}_{\mathcal{M}_t}:$ The corresponding density maps of $X^{(t)}_{\mathcal{M}_t}$. \\\hspace{-30pt} $\mathcal{M}_1, \mathcal{M}_2, ..., \mathcal{M}_{\mathcal{N}}:$ Samples of each dataset.\\\hspace{-30pt} $P:$ A queue containing previously seen datasets. \\\hspace{-30pt} $Q:$ A queue containing future unseen datasets. \\\hspace{-30pt} $\mathcal{F}(\cdot;\theta):$ Teacher network with fixed parameters $\theta$. \\\hspace{-30pt} $\mathcal{G}(\cdot;\psi):$ Student network with updated parameters $\psi$. } \Input{$\{\mathcal{D}_1,\mathcal{D}_2,...,\mathcal{D_N}\}$: A sequence of $\mathcal{N}$ domain datasets, $\mathcal{D}_i = < X^{(i)}_{\mathcal{M}_i}, Y^{(i)}_{\mathcal{M}_i} > $.} \Output{The optimal model parameter $\psi^*$} \Indp\Indpp \BlankLine $Q \gets \{\mathcal{D}_1, \mathcal{D}_2, ..., \mathcal{D}_{\mathcal{N}}\}$; $P \gets \varnothing $; $<X^{(1)}_{\mathcal{M}_1},Y^{(1)}_{\mathcal{M}_1}> \gets Q.top()$; $Q.pop()$ \; \textbf{Train} $\mathcal{G}(X^{(1)}_{\mathcal{M}_1};\psi)$\; $\psi^* \gets \mathop{\arg\min}_{\psi} \frac{1}{\mathcal{M}_1} \sum_{i=1}^{\mathcal{M}_1} ||Y^{(1)}_i - \mathcal{G}(X^{(1)}_i;\psi)||^2$\; $P.push(X^{(1)})$\; \While{$! Q$.empty()}{ $\mathcal{F}(\cdot;\theta) \gets \mathcal{G}(\cdot;\psi^*)$\; $ <X^{(t)}_{\mathcal{M}_t},Y^{(t)}_{\mathcal{M}_t}> \gets Q.top() $\; \textbf{Train} $\mathcal{G}(X^{(t)}_{\mathcal{M}_t};\psi)$\; $\psi^* \gets \mathop{\arg\min}_{\psi} \mathcal{L}_{count}(\cdot;\psi) + \lambda \mathcal{L}_{distill}(\cdot;\theta,\psi) $\; $P.push(<X^{(t)}_{\mathcal{M}_t},Y^{(t)}_{\mathcal{M}_t}>)$\; $Q.pop()$\; \textbf{Test} all seen datasets in $P$ with $\mathcal{G}(\cdot;\psi^*)$\; } \Return $\psi^*$\; \tcp{Time Complexity: $O(\mathcal{N})$\\Space Complexity: $\Omega(\mathcal{M})$\\$\mathcal{M}=\max\{\mathcal{M}_i| i = 1,2,...,\mathcal{N}\}$} \BlankLine \Indm\Indmm \Indp\Indpp \end{algorithm*} \subsection{Overview of Our Proposed Framework} Our proposed framework focuses on tackling the catastrophic forgetting and generalization issues under the circumstances of domain-incremental training settings. To be more specific, we propose a novel domain-incremental self-distillation lifelong crowd counting benchmark for sustainable learning with newly-arrived data and without obvious performance drop among previous domains. The key factor is how to effectively leverage the previously-learned meaningful knowledge when training over the data from a new domain for better crowd counting. Inspired by the knowledge distillation technique, we expect to use the model well-trained among old domains~(teacher model) to guide the model currently-optimized with new domain data~(student model) to mitigate performance drop among previous domains, considering that the old data may be unavailable. We design a self-distillation mechanism plugged into both feature-level and output-level layers of the network to constrain the output distribution similarities between the teacher and student model, which can reuse the learned knowledge when facing the new domain data without storing and training the old data repeatedly. More details will be discussed in Section~\ref{section: bdfloss}. The ultimate model is expected to be deployed to an arbitrary domain to estimate the people counts. For better understanding, the overall training pipeline is described in detail as shown in Algorithm~\ref{training_pipeline}. A queue $Q$ collects $\mathcal{N}$ increasingly-arrived datasets from different domains to be trained one by one. First, we initialize the first model $\mathcal{G}^{(1)}(\cdot;\psi)$ by training the first available dataset $D_1$ in the queue $Q$. Another queue $P$ is prepared for future evaluation which receives the test set popped from $Q$. After that, the model will be trained and optimized by the subsequent datasets from $D_2$ to $D_N$, repeating the following main steps until the queue $Q$ is empty: \begin{itemize} \setlength\itemsep{0em} \item[1)] Pop the $t$-th dataset $D_t$ from the queue $Q$ for training. \item[2)] Deep-copy the last well-trained model $\mathcal{G}^{(t-1)}$ to the model $\mathcal{F}(\cdot;\theta)$ as a teacher network for distillation. \item[3)] Train the current $t$-th model $\mathcal{G}^{(t)}(\cdot;\psi)$ over the $t$-th dataset $D_{t}$ via the self-distillation loss we proposed. \item[4)] Push the $t$-th dataset $D_{t}$ into the queue $P$ for evaluation when the model converges. \end{itemize} Note that the parameters $\theta$ of the model $\mathcal{F}(\cdot;\theta)$ are fixed~(stop gradient) during the lifelong training process, which is regarded as a teacher network to guide the current student network $\mathcal{G}^{(t)}(\cdot;\psi)$ with learnable parameters $\psi$ to remember old meaningful knowledge for better crowd counting. Eventually, we obtain the final model with the best parameters $\psi^*$, which can continue to be trained by using our proposed framework when the new labeled data are ready in the future. Since we needn't store any previously-seen training data to be replayed to train our model, the time and space complexity is approximately $O(\mathcal{N})$ and $\Omega(\mathcal{M})$ which is superior to $O(\mathcal{N}^2)$ and $\Omega(\mathcal{N}\times \mathcal{M})$ of joint training. $\mathcal{M}$ is the maximum of $\mathcal{M}_i$. Although the distillation mechanism is required to save an additional model, its storage overhead is negligible compared to storing the entire dataset for retraining. \subsection{Balanced Domain Forgetting Loss}\label{section: bdfloss} To balance the model plasticity (the ability to learn new data) and stability (the ability to remember previous knowledge), we propose a novel balanced domain forgetting loss function, {\textit{i.e.}}, BDFLoss, mainly consisting of counting loss and self-distillation loss. We integrate the optimal transport loss to our basic $\mathcal{L}_1$ counting loss in this paper because it has tighter generalization error bounds~\cite{wang2020distribution}. \begin{equation} \mathcal{L}_1(\text{Y}, \hat{\text{Y}}) = \frac{1}{\mathcal{M}} \sum_{i=1}^{\mathcal{M}}|\text{Y}_i - \hat{\text{Y}}_i| \;, \end{equation} where $\mathcal{L}_1(\cdot, \cdot)$ loss computes the difference between the predictions and actual counts. The optimal transport loss $\mathcal{L}_{\text{OT}}$ is used to minimize the distribution discrepancy between the predicted density maps and the point-annotated binary maps. \begin{equation} \mathcal{L}_{\text{OT}}(\text{Y}, \hat{\text{Y}}) = \mathcal{W}_c\left(\frac{\text{Y}}{||\text{Y}||_1}, \frac{\hat{\text{Y}}}{||\hat{\text{Y}}||_1}; \mathcal{C}\right) = \left \langle \alpha^{*}, \frac{\text{Y}}{||\text{Y}||_1} \right\rangle + \left \langle \beta^{*}, \frac{\hat{\text{Y}}}{||\hat{\text{Y}}||_1} \right\rangle \;, \end{equation} where $\mathcal{W}_{c}(\mu, v;\mathcal{C})$ is the optimal transport loss with the transport cost $\mathcal{C}$. It aims at minimizing the cost to transform one probability distribution $\mu$ to another $v$. $\mathcal{C}$ is defined as the quadratic transport cost here. $\alpha^{*}$ and $\beta^{*}$ are the optimal solutions of its dual problem as follows. \begin{equation} \max_{\alpha, \beta} \left \langle \alpha, \mu \right \rangle + \left \langle \beta, v \right \rangle \quad \text{s.t.} \quad \alpha_i + \beta_j \leq \mathcal{C}_{ij}, \forall i,j \;. \end{equation} To improve the approximation for the low-density regions of images, we also embed a normalized regularization item $\mathcal{L}_{\text{r}}$. \begin{equation} \mathcal{L}_{\text{r}}(\text{Y}, \hat{\text{Y}}) = \frac{1}{\mathcal{M}} \sum_{i=1}^{\mathcal{M}}\frac{1}{2}\left\|\frac{\text{Y}_i}{||\text{Y}_i||_1}-\frac{\hat{\text{Y}}_i}{||\hat{\text{Y}}_i||_1}\right\|_1 \;. \end{equation} Thus, the total count loss is made up of the three aforementioned loss functions with two hyper-parameters $\eta$ and $\gamma$ which are set to 0.1 and 0.01 respectively in our experiments. \begin{equation} \mathcal{L}_\text{count}=\mathcal{L}_1 + \eta \mathcal{L}_{\text{OT}} + \gamma \mathcal{L}_{\text{r}} \;, \end{equation} When training to the $t$-th domain, the performance among previous domains may degrade dramatically, {\textit{i.e.}, catastrophic forgetting} if no constraints are imposed. The self-distillation loss $\mathcal{L}_{\text{distill}}$ is designed to help the model forget less and count better during the lifelong learning process. To be more specific, we regard the current training model $\mathcal{G}^{(t)}(\cdot)$ as the student model, which can be guided by the teacher model $\mathcal{G}^{(t-1)}(\cdot)$ well-trained at the previous step, as shown in Figure~\ref{figures: model}. The student model is not expected to forget some previously-learned knowledge when training in the new domain. Normally, the deep layers of CNN with a large receptive field contain task-specific and high-level semantic information while the intermediate layers include general visual knowledge. They are mutually beneficial and complementary to assist the model to remember the helpful knowledge learned before during the lifelong crowd counting process. Thus, we deploy the self-distillation loss at both the feature level and the output level when the $t$-th new domain dataset arrives for training. \begin{equation} \mathcal{L}^{(t)}_\text{distill} = \frac{1}{\mathcal{M}_t}\sum_{i=1}^{\mathcal{M}_t} \Big( \underbrace{||\mathcal{G}^{(t-1)}(X^{(t)}_i) - \mathcal{G}^{(t)}(X^{(t)}_i)||^2}_{\text{output-level distillation}} + \underbrace{||\mathcal{H}^{(t-1)}(X^{(t)}_i) - \mathcal{H}^{(t)}(X^{(t)}_i) ||^2}_{\text{feature-level distillation}} \Big),\notag \end{equation} where $\mathcal{H(\cdot)}$ denotes the feature extractor of the model $\mathcal{G}(\cdot)$. Since the similarity metric is not our crucial research point in this paper, we just choose the $L_2$ loss for simplicity. To sum up, the BDFLoss is made up of these two components within the hyper-parameter $\lambda$. \begin{equation} \mathcal{L}_\text{BDF} = \mathcal{L}_\text{count} + \lambda \mathcal{L}_\text{distill} \;, \end{equation} where the hyper-parameter $\lambda$ is applicable to be a trade-off between model plasticity and stability. It is the same as vanilla sequential fine-tuning when $\lambda$ is equal to 0. \subsection{Model Architectures} Our proposed domain-incremental self-distillation lifelong crowd counting benchmark is model-agnostic. Therefore, to testify to its effectiveness, we integrate it into several state-of-the-art crowd counting backbone models without the bells and whistles, CSRNet~\cite{li2018csrnet}, SFANet~\cite{zhu2019dual}, DM-Count~\cite{wang2020distribution}, DKPNet~\cite{chen2021variational}. Because the attention map supervision of SFANet may introduce some biases in the experimental comparisons and the source code of DKPNet is not released, we make the following modifications in our experiments. A small improvement of SFANet is that we enable the network to learn the attention map adaptively based on training images without generating additional attention maps for supervision. We modify the DKPNet-baseline in our experiments since we only focus on investigating the effectiveness of our proposed framework on forgetting and generalization under different model capacities. \section{Experiment Settings} In this section, we will have a brief introduction of four datasets we experimented with, the training settings, and some hyper-parameter selections. \subsection{Datasets} We train and evaluate our model in the public crowd counting datasets, {\textit{i.e.}}, ShanghaiTech PartA~\cite{zhang2016single}, ShanghaiTech PartB~\cite{zhang2016single}, UCF-QNRF~\cite{idrees2018composition}, NWPU-Crowd~\cite{wang2020nwpu}, and JHU-Crowd++~\cite{sindagi2019jhucrowd}, as shown in Table \ref{table: datasets}. In our experiments, we take the JHU-Crowd++ dataset as an unseen one for evaluating the generalization ability of different paradigms only. Therefore, the images in the JHU-Crowd dataset will never be trained in the whole training process. \begin{table*}[ht] \caption{The number of images used to train models on different datasets. The last three columns illustrated the minimum, the maximum, and the average number of people per image.} \centering \resizebox{0.6\linewidth}{!}{ \begin{tabular}{l|c|c|c|c|c|c} \toprule[1pt] \textbf{Dataset} & \textbf{Training} & \textbf{Validation} & \textbf{Test}& \textbf{Min}& \textbf{Max} & \textbf{Avg} \\ \midrule[0.5pt] ShanghaiTech PartA & 270 & 30 & 182 &33 &3,139 & 501\\ ShanghaiTech PartB & 360 & 40 & 316 &9 &578 &123\\ UCF-QNRF & 1,081 & 120 & 334 &49 &12,865 & 815 \\ NWPU-Crowd & 3,109 & 500 & 1,500 &0 &20,033 &418 \\ JHU-Crowd++ & 2,272 & 500 & 1,600 &0 &25,791 &346 \\ \bottomrule[1pt] \end{tabular}} \label{table: datasets} \end{table*} \section{Experimental Results and Analysis} In this section, we evaluate the performance of our proposed learning framework and other three learning strategies by analyzing their respective forgetting degrees among the trained datasets (SHA, SHB, QNRF, and NWPU), as shown in Tables~\ref{table: catastrophic forgetting} and~\ref{results: length}, and their generalization abilities on the unseen dataset (JHU-Crowd++), as shown in Tables~\ref{table: generalization} and~\ref{table: generalizationpromotion}. The synthetic-to-real experiments are also conducted considering the data privacy issues and some ethical policies in Tables~\ref{gccforgetting} and~\ref{gccgeneralization}. We propose a new metric, named \textbf{n}ormalized \textbf{B}ack\textbf{w}ard \textbf{T}ransfer (nBwT), to measure the total forgetfulness of the entire lifelong learning process over $t$ incremental domains. It could compare sustainable learning ability among distinct backbones or training strategies. \begin{equation} \text{nBwT}_t = \frac{1}{t-1} \sum_{s=1}^{t-1} \frac{e_{t,s} - e_{s,s}}{e_{s,s}}\;,\; t \in \{2,3,...,\mathcal{N}\}\;, \end{equation} where $e_{t,s}$ is the test MAE score of the model on the previously trained $s$-th dataset after obtaining the optimal model on the $t$-th dataset. The non-zero divisor $e_{s,s}$ is a normalization factor. The larger the nBwT value is, the greater the model forgetting degree is. If the value is less than 0, it indicates that the model attains a positive performance improvement among previously trained datasets. The theoretical lower bound of $\text{nBwT}_t$ is $-\frac{1}{t-1}$ when $e_{t,s}$ equals zero. Furthermore, we propose two reasonable and impartial criteria, {\textit{i.e.}}, mMAE and mRMSE~(the respective means of MAE and RMSE in $\mathcal{N}$ datasets) to evaluate the counting precision of the lifelong crowd counting task as follows. \begin{align} \text{mMAE}=\frac{1}{\mathcal{N}} \sum_{i=1}^\mathcal{N} \frac{1}{\mathcal{M}_i} \sum_{j=1}^{\mathcal{M}_i} | \hat{Y_j} - Y_j | , \end{align} \begin{align} \text{mRMSE}=\frac{1}{\mathcal{N}} \sum_{i=1}^\mathcal{N} \sqrt{\frac{1}{\mathcal{M}_i} \sum_{j=1}^{\mathcal{M}_i} || \hat{Y_j} - Y_j ||^2}, \end{align} where $\mathcal{M}_i$ denotes the number of images from the $i$-th test set. $\hat{Y_j}$ and $Y_j$ are the predicted counts and actual counts of the $j$-th image, respectively. The mMAE and mRMSE reduce to standard MAE and RMSE when $\mathcal{N}$ is equal to 1. In addition, we still utilize the standard MAE score on the unseen JHU-Crowd++ dataset to compare the model generalization within different training strategies. \subsection{Implementation Details} We strictly follow the same basic image preprocessing settings in most recent literature~\cite{wang2020distribution, ma2019bayesian, li2018csrnet, zhu2019dual}. To generate the density map as ground truth, we just adopt the fixed Gaussian kernel whose variance $\sigma$ is set to 15 for all datasets. Several useful augmentations like random horizontal flipping with a probability of $0.5$ and normalization are also applied to those images before training. The hyper-parameter $\lambda$ in the loss function is set to 0.5 to be a trade-off between model plasticity and stability. We use the fixed learning rate of 1e-5, a simple weight decay of 5e-4, and an Adam optimizer in all of our experiments. \begin{table*}[ht] \caption{The quantitative results with different paradigms to compare the forgetting degree and overall performance. We take the sequential training as our BASELINE and take the joint training as JOINT for reference. FLCB is our proposed method.} \label{table: catastrophic forgetting} \resizebox{\linewidth}{!}{ \begin{tabular}{l|l|cc|cc|cc|cc|c|c|c|c} \toprule[1pt] \multirow{2}{*}{\textbf{Model}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Method}}} & \multicolumn{2}{c|}{\textbf{SHA}} & \multicolumn{2}{c|}{\textbf{QNRF}} & \multicolumn{2}{c|}{\textbf{SHB}} & \multicolumn{2}{c|}{\textbf{NWPU}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{mMAE}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{mRMSE}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{nBwT}}}& \multicolumn{1}{c}{\multirow{2}{*}{\textbf{\# params.}}} \\ \cmidrule{3-10} & \multicolumn{1}{c|}{} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c}{} \\ \midrule[0.5pt] \multirow{4}{*}{CSRNet~\cite{li2018csrnet}} & BASELINE & 98.4 & 168.1 & 123.9 & 225.3 & 13.4 & 19.1 & 114.5 & 456.5 & 87.6 & 217.3 & 0.424 & \multirow{4}{*}{16.26M} \\ & LwF~\cite{li2017learning} & 71.5 & 122.4 & 107.4 & 198.9 & 11.3 & 16.7 & 123.3 & 520.3 & \textbf{78.4} & 214.6 &-0.042 & \\ & FLCB & 66.6 & 100.4 & 112.5 & 198.6 & 13.0 & 22.0 & 121.4 & 473.2 & \textbf{78.4} & \textbf{198.6} &\textbf{-0.102} & \\ & JOINT & 64.0 & 100.6 & 109.0 & 199.7 & 14.0 & 18.6 & 124.8 & 499.4 & \textit{78.0} & \textit{204.6} & - & \\\midrule[0.5pt] \multirow{4}{*}{SFANet~\cite{zhu2019dual}} & BASELINE & 85.4 & 141.3 & 112.6 & 200.7 & 14.8 & 18.1 & 106.9 & 463.7 & 79.9 & 206.0 & 0.545 & \multirow{4}{*}{17.02M} \\ & LwF~\cite{li2017learning} & 75.0 & 128.5 & 101.3 & 177.2 & 11.5 & 19.0 & 108.3 & 450.0 & 74.0 & 193.7 &-0.002 & \\ & FLCB & 69.4 & 110.9 & 103.7 & 176.6 & 12.7 & 20.9 & 108.8 & 445.0 & \textbf{73.7} & \textbf{188.4} &\textbf{-0.097} & \\ & JOINT & 77.7 & 124.0 & 136.8 & 236.3 &14.0 &17.3 & 127.8 & 458.5 & \textit{89.1} & \textit{209.0} & - &\\\midrule[0.5pt] \multirow{4}{*}{DM-Count~\cite{wang2020distribution}} & BASELINE & 76.0 & 122.2 & 94.1 & 154.1 & 9.6 & 17.5 & 108.3 & 481.4 & 72.0 & 193.8 & 0.176 & \multirow{4}{*}{21.50M} \\ & LwF~\cite{li2017learning} & 74.6 & 124.1 & 90.2 & 164.9 & 9.4 & 14.9 & 86.9 & 375.4 & 65.3 & 169.8 & 0.049 & \\ & FLCB & 69.2 & 113.2 & 95.4 & 166.0 & 9.7 & 15.6 & 83.6 & 370.8 & \textbf{64.5} & \textbf{166.4} & \textbf{-0.013} & \\ & JOINT & 78.2 & 129.3 & 86.7 & 153.3 &7.9 &13.0 & 88.5 & 393.8 & \textit{65.3} & \textit{172.4} & - &\\ \midrule[0.5pt] \multirow{4}{*}{DKPNet~\cite{chen2021variational}} & BASELINE & 92.9 & 157.8 & 100.1 & 179.4 & 7.7 & 12.4 & 90.0 & 393.6 & 72.7 & 185.8 & 0.371 & \multirow{4}{*}{13.28M} \\ & LwF~\cite{li2017learning} & 62.3 & 104.4 & 81.4 & 133.4 & 11.5 & 18.2 & 90.8 & 395.2 & 61.5 & 162.8 & -0.009 & \\ & FLCB & 68.8 & 113.9 & 84.3 & 160.1 & 7.8 & 12.2 & 76.6 & 364.2 & \textbf{59.4} & \textbf{162.6} & \textbf{-0.010} & \\ & JOINT & 65.0 & 108.5 & 86.0 & 163.3 &8.4 &13.2 & 81.2 & 357.7 & \textit{60.2} & \textit{160.7} & - &\\\bottomrule[1pt] \end{tabular}} \end{table*} \begin{table*}[ht] \caption{The forgetting performance in the intermediate process of lifelong crowd counting among four models with FLCB. The data underlined are all less than zero, which has a positive effect on the overall performance of among past domains.} \resizebox{\linewidth}{!}{ \begin{tabular}{l|c|cc|cc|cc|cc|c|c|c} \toprule[1pt] \multirow{2}{*}{\textbf{Method~(FLCB)}} & \multirow{2}{*}{\textbf{Model}} & \multicolumn{2}{c|}{\textbf{SHA}} & \multicolumn{2}{c|}{\textbf{QNRF}} & \multicolumn{2}{c|}{\textbf{SHB}} & \multicolumn{2}{c|}{\textbf{NWPU}} & \multirow{2}{*}{\textbf{mMAE}} & \multirow{2}{*}{\textbf{mRMSE}} &\multirow{2}{*}{\textbf{nBwT}}\\ \cmidrule{3-10} & &\textbf{MAE} & \textbf{RMSE} &\textbf{MAE} & \textbf{RMSE} &\textbf{MAE} & \textbf{RMSE} &\textbf{MAE} & \textbf{RMSE} & & &\\ \midrule[0.5pt] SHA$\rightarrow$QNRF & CSRNet & 73.9 & 111.7 & 121.8 & 225.3 &-&-&-&-&97.9&168.5 & 0.068 \\ SHA$\rightarrow$QNRF & SFANet & {73.4} & {114.4} & 111.3 & 200.4 &-&-&-&-& 92.4 &157.4 & {0.225} \\ SHA$\rightarrow$QNRF & DM-Count & {65.2} & {117.2} & 84.8 &149.0 & - & - & - & - &75.0 &133.1 & {\textbf{0.058}} \\ SHA$\rightarrow$QNRF & DKPNet & 62.1 & {103.9} & 82.9 & 149.7 & - & - & - & - &\textbf{72.5} & \textbf{126.8}& 0.078 \\\midrule[0.5pt] SHA$\rightarrow$QNRF$\rightarrow$SHB & CSRNet &73.9 & 111.7 & 121.8 & 225.3 & 16.1 & 29.9&-&-&70.6 &122.3 &0.034 \\ SHA$\rightarrow$QNRF$\rightarrow$SHB & SFANet & {73.4} & {114.4} & {111.3} & {200.4} & 20.5 & 31.5 &-&-&68.4 & 115.4& {0.113} \\ SHA$\rightarrow$QNRF$\rightarrow$SHB & DM-Count & {65.2} & {117.2} & {84.8} & {149.0} & 13.6 & 25.6 & - & - &54.3 & 97.3& {0.029} \\ SHA$\rightarrow$QNRF$\rightarrow$SHB & DKPNet & {63.5} & {109.6} & {86.4} & {147.5} & 10.3 & 17.3 & - & - &\textbf{53.4} &\textbf{91.5} & \underline{\textbf{-0.014}} \\ \midrule[0.5pt] SHA$\rightarrow$QNRF$\rightarrow$SHB$\rightarrow$NWPU & CSRNet &66.6 &{100.4} &{112.5} & {198.6} &{13.0} &22.0 &121.4 &473.2&78.4 & 198.6&\underline{\textbf{-0.102}} \\ SHA$\rightarrow$QNRF$\rightarrow$SHB$\rightarrow$NWPU & SFANet &{69.4} &{110.9} &{103.7} &{176.6} &{12.7} &20.9 & 108.8 & {445.0}&73.7 &188.4 & \underline{-0.097} \\ SHA$\rightarrow$QNRF$\rightarrow$SHB$\rightarrow$NWPU & DM-Count & {69.2} &{113.2} &95.4 &166.0 &9.7 &{15.6} &{83.6} &{370.8} &64.5 &166.4 &\underline{-0.013} \\ SHA$\rightarrow$QNRF$\rightarrow$SHB$\rightarrow$NWPU & DKPNet &{68.8} &{113.9} &{84.3} &{160.1} &7.8 &{12.2} &{76.6} &{364.2} &\textbf{59.4} &\textbf{162.6} &\underline{-0.010} \\ \bottomrule[1pt] \end{tabular}} \label{results: length} \end{table*} \subsection{Analysis of Catastrophic Forgetting} We compare the quantitative results between the baselines and our proposed method based on four benchmark models. The results in Table~\ref{table: catastrophic forgetting} clearly demonstrate that our method can remarkably alleviate the catastrophic forgetting phenomenon on all models with the lowest mMAE, mRMSE, and nBwT~(i.e., forgetting degree) under the domain-incremental training settings. The forgetting degree in the intermediate process is also delved into in Table~\ref{results: length}. The results imply the model will forget less and count better when more labeled datasets are involved in the lifelong learning process. This indicates that our framework can remember the old yet meaningful knowledge from the last well-trained model when handling the new domain dataset. \begin{table*}[ht] \caption{Generalization comparison of different training strategies on the unseen JHU-Crowd++ dataset. } \label{table: generalization} \centering \begin{subtable}[t]{0.2\linewidth} \centering \resizebox{\linewidth}{!}{ \begin{tabular}{l | c c } \toprule[1pt] \textbf{Method} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] JOINT & 103.2 & 320.0\\ LwF & 101.6 & 322.3\\ FLCB & \textbf{92.9} & \textbf{305.1}\\\bottomrule[1pt] \end{tabular}} \caption{CSRNet} \label{tab:csrnet} \end{subtable} \hfill \begin{subtable}[t]{0.2\linewidth} \centering \resizebox{\linewidth}{!}{ \begin{tabular}{l | c c } \toprule[1pt] \textbf{Method} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] JOINT & 115.5 & 347.6\\ LwF & 107.7 & 312.3\\ FLCB & \textbf{102.2} & \textbf{311.3}\\\bottomrule[1pt] \end{tabular}} \caption{SFANet} \label{tab:sfanet} \end{subtable} \hfill \begin{subtable}[t]{0.2\linewidth} \centering \resizebox{\linewidth}{!}{ \begin{tabular}{l | c c } \toprule[1pt] \textbf{Method} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] JOINT & 96.3 & 320.3\\ LwF & 94.6 & \textbf{296.0}\\ FLCB & \textbf{82.5} & 298.5\\\bottomrule[1pt] \end{tabular}} \caption{DM-Count} \label{tab:dmcount} \end{subtable} \hfill \begin{subtable}[t]{0.2\linewidth} \centering \resizebox{\linewidth}{!}{ \begin{tabular}{l | c c } \toprule[1pt] \textbf{Method} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] JOINT & 89.8 & 318.7\\ LwF & 90.4 & 298.2\\ FLCB & \textbf{84.8 }& \textbf{264.8}\\\bottomrule[1pt] \end{tabular}} \caption{DKPNet} \label{tab:dkpnet} \end{subtable} \end{table*} \begin{table*}[ht] \caption{Generalization comparison on the unseen JHU-Crowd++ dataset with self-distillation in different levels during the entire lifelong learning process. Here A, Q, B and N are the abbreviations for the name of four datasets.} \label{table: generalizationpromotion} \centering \resizebox{0.6\linewidth}{!}{ \begin{tabular}{cc|cc|cc|cc} \toprule[1pt] \multicolumn{2}{c|}{\textbf{Distillation}} & \multicolumn{2}{c|}{\textbf{A$\rightarrow$Q}} & \multicolumn{2}{c|}{\textbf{A$\rightarrow$Q$\rightarrow$B}} & \multicolumn{2}{c}{\textbf{A$\rightarrow$Q$\rightarrow$B$\rightarrow$N}} \\ \cmidrule{1-8} \textbf{feature}&\textbf{output}& \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] &\checkmark &106.7 &345.9 &102.3 &354.8 &90.4 &298.2 \\ \checkmark &\checkmark &\textbf{96.2} &\textbf{327.8} &\textbf{90.5} &\textbf{313.0} &\textbf{84.8} &\textbf{264.8} \\ \bottomrule[1pt] \end{tabular}} \end{table*} \subsection{Analysis of Model Generalization} \subsubsection{\textbf{Real-to-Real Generalization}}To build a robust model for better crowd counting, we also expect the model can obtain acceptable performance among unseen domains since labeling crowd images are extremely expensive and time-consuming in the real world. After the ultimate models converge, we test them directly on the unseen JHU-Crowd++ dataset in Table~\ref{table: generalization}. Note that the images from JHU-Crowd++ are never trained during the process of lifelong learning. Our proposed FLCB can achieve lower prediction errors~(MAE and RMSE) over the unseen dataset, indicating a stronger generalization ability compared with the joint training strategy. Furthermore, taking the DKPNet as an example, we delve into the ablation study of different layers for distillation in the intermediate lifelong learning process. Every time a new-coming dataset is finished training, the model will be evaluated on the unseen dataset. The results, shown in Table~\ref{table: generalizationpromotion}, illustrate that its performance is boosted progressively with incremental data from different domains. Meanwhile, it also indicates that the model can count better on the unseen domain under the mutually complementary interaction of both feature-level and output-level distillation. \subsubsection{\textbf{Synthetic-to-Real Generalization}} Considering the data privacy and some ethical policies~(\textit{i.e.}, the real-world training images may be unobtainable), we conduct the same lifelong training settings training on the synthetic crowd dataset (GCC)~\cite{wang2019learning} and investigate the generalization on the unseen real-world dataset~(ShanghaiTech PartB). We split the GCC synthetic dataset into four subsets to mock the same lifelong training settings. The forgetting phenomenon among incremental synthetic subsets is still analyzed~(See Table~\ref{gccforgetting}), as well as the generalization performance on the unseen dataset~(See Table~\ref{gccgeneralization}). After obtaining the ultimate model, our FLCB benchmark achieves the lowest mMAE, mRMSE, and nBwT among previously seen datasets and decent performance on the unseen real-world dataset. Furthermore, the results of Table~\ref{gccgeneralization} verify the superiority of our proposed benchmark. To put it in a nutshell, our proposed lifelong crowd counting benchmark~(FLCB) can help the crowd counters forget less and count better to sustainably handle the multiple-domain crowd counting using a single model, which indicates it has a promising potential to tackle the more complicated scenes in the future. \begin{table*}[ht] \caption{The experimental results of DKPNet with the synthetic-to-real training settings.} \label{gccforgetting} \centering \resizebox{0.9\linewidth}{!}{ \begin{tabular}{l|cc|cc|cc|cc|c|c|c} \toprule[1pt] \multirow{2}{*}{\textbf{Method}} & \multicolumn{2}{c|}{\textbf{GCC-1}} & \multicolumn{2}{c|}{\textbf{GCC-2}} & \multicolumn{2}{c|}{\textbf{GCC-3}} & \multicolumn{2}{c|}{\textbf{GCC-4}} & \multirow{2}{*}{\textbf{mMAE}} & \multirow{2}{*}{\textbf{mRMSE}} & \multirow{2}{*}{\textbf{nBwT}}\\ \cmidrule{2-9} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & \textbf{MAE} & \textbf{RMSE} & & \\ \midrule[0.5pt] BASELINE &55.4 &131.3 &34.7 &82.8 &18.5 &53.3 &35.6 &74.9 &36.1 &85.6 &1.130\\ LwF~\cite{li2017learning} &42.8 &104.5 &37.7 &108.5 &16.5 &43.1 &35.1 &70.6 &33.0 &81.7 & 0.378 \\ FLCB &40.0 &95.4 &35.1 &100.5 &14.6 &34.5 &41.7 &82.5 &\textbf{32.8} &\textbf{78.2} & \textbf{0.192} \\ \bottomrule[1pt] \end{tabular}} \end{table*} \begin{table*}[ht] \caption{The test MAE and RMSE scores on the unseen ShanghaiTech PartB dataset after training synthetic GCC subsets.} \centering \label{gccgeneralization} \centering \resizebox{0.3\linewidth}{!}{ \begin{tabular}{l | c c } \toprule[1pt] \textbf{Method} & \textbf{MAE} & \textbf{RMSE} \\ \midrule[0.5pt] JOINT & 22.8 & 30.6 \\ CycleGAN~\cite{zhu2017unpaired} & 25.4 & 39.7\\ SE CycleGAN~\cite{wang2019learning} & 19.9 & 28.3\\ FLCB & \textbf{16.1} & \textbf{25.0}\\\bottomrule[1pt] \end{tabular}} \end{table*} \subsection{Visualization Results} To make a more qualitative comparison, we visualize the prediction density maps under different training strategies. As illustrated in Figure~\ref{figures: visualization}, we can discover that the sequential training methods will achieve terrible performance among old domains after training images from a new domain. Our proposed lifelong crowd counting benchmark can estimate more accurately on both seen and unseen datasets which outperforms other training paradigms. \begin{figure*}[ht] \begin{center} \includegraphics[width=\linewidth]{figs/visualization_v2.pdf} \end{center} \caption{The visualization results of different training paradigms. The columns from left to right represent the original images, the corresponding ground truths, and the outputs with different training paradigms. The first row shows the predictions on the first training dataset (SHA), while the second row illustrates the predictions on the unseen dataset (JHU). } \label{figures: visualization} \end{figure*} \section{Related Work} \textbf{Crowd Counting.}\quad Traditional detection-based and regression-based methods extract the handcrafted features such as SIFT and HoG to detect the individual heads~\cite{dalal2005histograms, leibe2005pedestrian, tuzel2008pedestrian, dollar2011pedestrian} or directly regress the count number~\cite{chan2009bayesian}. Nevertheless, these models cannot learn the spatial information of people distribution to make accurate predictions in highly congested scenes. Most of the latest crowd counting approaches are built upon deep learning methods to estimate a density map for a given image. Many researchers design various architectures like fully convolutional networks~\cite{zhang2015cross,wang2015deep}, multi-column networks~\cite{zhang2016single,babu2017switching,sindagi2017generating,boominathan2016crowdnet}, scale aggregation or scale pyramid networks~\cite{jiang2019learning, cao2018scale, chen2019scale,song2021choose,liu2019crowd}, and attention mechanisms~\cite{jiang2020attention,guo2019dadnet,sindagi2019ha,liu2019adcrowdnet,zhu2019dual} to extract the multi-scale feature representations to resolve scale variation and non-uniform distribution issues. CSRNet~\cite{li2018csrnet} points out the multi-scale feature redundancies among multi-branch architectures and proposes a new deeper single-column CNN with dilated convolutions to capture different receptive fields. Moreover, ADCNet~\cite{bai2020adaptive} extends the discrete dilated ratio (integer value) into a continuous value to match the large scale variation and self-correct the density map by EM algorithm. \noindent\textbf{Cross-domain / Multi-domain} Learning.\quad Many researchers exploit the cross-domain problems~\cite{wu2021dynamic,zou2021coarse,liu2021leveraging,wang2021neuron,wang2019learning} in crowd counting, including cross-scene~\cite{zhang2015cross}, cross-view~\cite{zhang2021cross}, cross-modal~\cite{liu2021cross}, etc. Adversarial Scoring Network~\cite{zou2021coarse} is applied to adapt to the target domain from coarse to fine granularity. Besides, cross-domain features can be extracted by the message-passing mechanisms based on a graph neural network~\cite{luo2020hybrid}. A semantic extractor~\cite{han2020focus} is designed to capture the semantic consistency between the source domain and target domain to enhance the adapted model. A large synthetic dataset (GCC)~\cite{wang2019learning} has been released to study the transferability from synthetic data to real-world data. Quite a few researchers~\cite{yang2020reverse, xiong2019open, shi2019counting} also investigated similar tasks like vehicle counting based on the same architectures of crowd counting. Learning with multiple domains simultaneously~\cite{ma2021towards, yan2021towards, chen2021variational} has also been preliminarily explored, which is required to mix all the data for training at the same time. DCANet~\cite{yan2021towards} proposed a channel attention-guided multi-dilation module to assist the model to learn a domain-invariant representation while DKPNet~\cite{chen2021variational} propagated the domain-specific knowledge with the help of variational attention techniques. Ma~\textit{et al.}~\cite{ma2021towards} developed a scale alignment component to learn an adaptive rescaling factor for each image patch for better crowd counting. In reality, such cross-domain approaches needed a careful alignment module design and laid more emphasis on the target domain performance only while the multi-domain learning methods required more storage overheads to save old domain data. Different from both two methods, lifelong crowd counting is built upon training the domains incrementally~(one by one) using a single model. The lifelong crowd counting system can mimic the biological brain to learn sustainably in its lifetime inspired by the learning mechanisms of mammals, i.e., integrating the new knowledge increasingly while maintaining previous memories. \noindent\textbf{Lifelong Learning.}\quad Lifelong learning attempts to alleviate the catastrophic forgetting issues and enhance the model generalization ability when a system faces non-stationary data increasingly. The mainstream strategies are applied to image classification~\cite{kirkpatrick2017overcoming, rebuffi2017icarl, li2017learning, lopez2017gradient, belouadah2019il2m} and numerical prediction tasks~\cite{he2021clear}, which can be categorized into four parts: model-growth approaches~\cite{rusu2016progressive}, rehearsal-based techniques~\cite{lopez2017gradient, rebuffi2017icarl}, regularization~\cite{kirkpatrick2017overcoming, rebuffi2017icarl} and distillation mechanisms~\cite{li2017learning}. Specifically speaking, the model-growth (\text{e.g.} PNN~\cite{rusu2016progressive}) and rehearsal-based methods (\text{e.g.} GEM~\cite{lopez2017gradient}) require more computational and memory costs because they either instantiate a new network or replay old data when learning the new classes or tasks. LwF~\cite{li2017learning} is a combination of the distillation networks and fine-tuning to boost the overall performance. However, the aforementioned classification-based lifelong learning approaches can not migrate to the crowd counting task directly because counting is an open-set problem~\cite{xiong2019open} by nature whose value ranges from zero to positive infinity in theory. Latent feature representations with general visual knowledge together with high-level semantic information at the output layer play a crucial role in such dense prediction tasks. Therefore, we propose a simple yet effective self-distillation loss at both feature-level and output-level for lifelong crowd counting to alleviate the catastrophic forgetting with a low time and space complexity in this paper. \section{Conclusion} Our work proposed a domain-incremental self-distillation learning benchmark for lifelong crowd counting to try to resolve the catastrophic forgetting and model generalization issues using a single model when training new datasets from different domains one after another. With the help of BDFLoss we designed, the model can effectively forget less and count better during the whole lifelong crowd counting process. Additionally, our proposed metric nBwT can be used to measure forgetting degree in future lifelong crowd counting models. Extensive experiments demonstrate that our proposed benchmark has a lower forgetting degree over the sequential training baseline and a stronger generalization ability compared with the joint training strategy. Our proposed method is a simple yet effective way to sustainably handle the crowd counting problem among multiple domains using a single model with limited storage overhead when the newly available domain data arrive. It can be incorporated into any existing backbone as a plug-and-play training strategy for better crowd counting in the real world. Although this paper pays attention to crowd counting, further, the proposed framework has the potential to be applied in other regression-related image or video tasks. \bibliographystyle{unsrt}
\section{Introduction} Fifth Generation New Radio (5G NR) has been introduced by 3GPP with Release 15~\cite{38300}, promising to offer low-latency, high-reliable, and high-speed communications, as well as extended coverage. Among other features, NR supports operation in both sub-6 GHz (FR1) and millimeter-wave (FR2) bands~\cite{parkvall:17}, with the latter enabling the support of high data rates with the usage of advanced beamforming techniques and wide-bandwidth operations~\cite{pi:11}. 5G networks are designed in such a way so that they would employ novel and evolved architectures and technologies~\cite{Peng16}. As such, rapid evaluation, implementation, and standardization of these architectures and technologies can play a key role in order to fulfil the challenges 5G networks face and meet the demands imposed by the users in terms of quality of service and performance. In order to evaluate and improve already existing features or deploy new ones, it is of great importance for the research community to have the means to perform testing and validations. Simulation environments are the enablers for such steps to be carried out, with final target the actual deployment. In contrast to the industrial proprietary simulators (even those used by companies in 3GPP) that are not available for public usage, and whose results are thus not reproducible, open-source 5G simulators are available to the public. The open access to the source code allows the development of new features, the modification of already available ones, and the testing and evaluation of them. Examples of open-source 5G simulators are given in Table~\ref{table:5GSimulators}~\cite{electronics9030468}. \begin{table}[!t] \small \centering \caption{5G open-source simulators~\cite{electronics9030468}} \begin{tabular}{|p{4cm}|p{7cm}|} \hline \textbf{Simulator} & \textbf{Main Characteristics} \\ \hline NYUSIM~\cite{NYUSIM} & Link-level simulator for statistical channel modeling, simulation code with an easy-to-use interface and carrier frequencies from 2 to 73 GHz \\ \hline Vienna 5G Simulators~\cite{vienna5g} & Link-level and system-level simulators, for large scale simulations (including hundreds of nodes) and supporting parallelization \\ \hline WISE~\cite{wiseSim} & System-level simulator for multi-tier orientations \\ \hline GTEC 5G Simulator~\cite{GTECsim} & Link-level simulator \\ \hline 5G Toolbox by Matlab~\cite{matlab5g} & Link-level simulator, focused on channel modeling and signal generation \\ \hline Simu5G~\cite{simu5G} & OMNeT++-based System-level, end-to-end simulator \\ \hline 5G-air-simulator~\cite{5GairSim} & System-level, end-to-end simulator for modeling the 5G air interface \\ \hline ns–3 mmWave~\cite{nyummwave} & System-level, full protocol stack, end-to-end simulator of 3GPP NR at millimeter-wave bands \\ \hline 5G-LENA~\cite{PATRICIELLO2019101933} & System-level, full protocol stack, end-to-end simulator of 3GPP NR, supporting 0.5-100 GHz frequency bands \\ \hline \end{tabular} \label{table:5GSimulators} \end{table} Moreover, there is the necessity for the research community to perform evaluations and obtain results that are analogous to that of the 3GPP standardization and the industrial simulators. Notably, simulators used by companies in 3GPP are required to pass through a calibration procedure, so that, even if they are not public, at least they are aligned with similar deployments, propagation conditions, and performances. On that respect, ITU-R has defined in the IMT-2020 report~\cite{IMT-2020} certain specifications and technical performance requirements to be fulfilled by the candidate radio interface technologies. All in all, it is essential that any simulation tool, before exploiting it for evaluation and validation, is calibrated to the reference results in IMT-2020 and 3GPP simple reference scenarios, guaranteeing the validity of the results with respect to the 3GPP specifications. For the calibration process, it can also result helpful to exploit \glspl{rem}, if available, in order to verify the deployment and propagation conditions and eventually find the proper configuration. The \gls{rem} tool can provide information related to the network interference and the signal quality, providing better knowledge of the radio environment~\cite{rem3, rem2}. This information can be very useful for the study and analysis of the radio propagation environment, and eventually can be used for the calibration process. In this work, we focus on the 5G-LENA module of the ns-3~\cite{ns3} discrete-event network simulator. 5G-LENA~\cite{PATRICIELLO2019101933} is an NR system-level simulator openly available to the research community~\cite{5gLena}, that derives from the ns-3 LENA~\cite{BaldoLena} and ns-3 mmWave~\cite{nyummwave} modules. 5G-LENA implements a high-fidelity full protocol stack and allows cross-layer evaluations and the study of end-to-end (E2E) performances. The ns-3 LENA simulator of Fourth Generation Long Term Evolution (4G LTE) technology was calibrated in~\cite{marinescu} to a set of 3GPP reference scenarios defined in 3GPP TR 36.814, including Urban Macro (UMa) and Rural Macro (RMa) setups, in terms of downlink per user average Signal-to-Interference-plus-Noise ratio (SINR) and normalized user throughput. In~\cite{PATRICIELLO2019101933}, we calibrated the ns-3 5G-LENA simulator in Indoor Hotspot scenario setups, according to 3GPP TR 38.802, in terms of SINR and Signal-to-Noise ratio (SNR). However, as of today, the calibration of ns-3 5G-LENA simulator in outdoor (and mixed outdoor/indoor) deployments is missing. In this respect, this paper is focused on the calibration of the 5G-LENA simulator based on the 3GPP reference results for outdoor deployments. In addition, since the 5G-LENA accounts with the REM feature \cite{rem3}, the calibration process followed here has been carried out by exploiting these maps, proving their importance in the network design and analysis. Based on the above, the main contribution of this paper is to give to the community an open source tool that allows the testing, evaluation, validation, and experimentation of existing and/or new features, guaranteeing the resemblance of the results to that of an industrial private product or of a real network. The rest of the paper is organized as follows. Section~\ref{sec:TestEnvironments} describes the different test environments defined for calibration by ITU, while the detailed simulation settings and the parameters for the selected subset of scenarios under which we have calibrated the 5G-LENA simulator, are presented in Section~\ref{sec:Scenarios}. In Section~\ref{sec:5gLena} we give a brief description of the required changes and extensions performed in the 5G-LENA module in order to achieve the calibration of it according to the IMT-2020 Report~\cite{IMT-2020}. The performance evaluation against the 3GPP considered industrial simulators, as well as the REM evaluation are given in Section~\ref{sec:Results}. Finally, the most important conclusions are drawn in Section~\ref{sec:Conclusions}. \section{Calibration Test Environments for 5G NR} \label{sec:TestEnvironments} ITU has defined in Report ITU-R IMT-2020 \cite{IMT-2020} a number of test environments and evaluation configurations for the calibration of the candidate system-level simulators. Also, it provides the reference results to calibrate with. In particular, it defines three different usage scenarios (enhanced mobile broadband (eMBB), massive machine type communications (mMTC) and ultra-reliable and low latency communications (URLLC)) and combines each of them with one or several geographic environment(s), leading to five different test environments \cite{IMT-2020}, namely: \begin{itemize} \item Indoor Hotspot-eMBB \item Dense Urban-eMBB \item Rural-eMBB \item Urban Macro–mMTC \item Urban Macro–URLLC \end{itemize} Furthermore, for each test environment, different evaluation configurations are defined \cite{IMT-2020}. These different evaluation configurations basically vary some parameters (like the carrier frequency, the total transmit power, the simulation bandwidth, the number of antenna elements per gNB/UE, and the gNB/UE noise figure) for a given test environment. Indoor Hotspot-eMBB and Rural-eMBB include three configurations (Configuration A, Configuration B, and configuration C), while Dense Urban-eMBB, Urban Macro–mMTC and Urban Macro–mMTC consider just two different configurations (Configuration A and Configuration B). Further details with respect to the technical performance requirements, the service and spectrum aspect requirements, and the evaluation guidelines can be found in~\cite{M.2410, M.2411, M.2412}, respectively. The results obtained by companies in 3GPP for the scenarios defined in~\cite{M.2412}, have been summarized and compiled in~\cite{RP180524}. \section{Considered Reference Scenarios} \label{sec:Scenarios} Indoor scenarios have already been used for the system-level calibration of the 5G-LENA simulator in previous work~\cite{PATRICIELLO2019101933}. However, outdoor scenarios have not been considered up to this point. As such, in this work we focus on the outdoor scenarios with eMBB, i.e., Rural-eMBB and Dense Urban-eMBB test environment scenarios, defined in~\cite{IMT-2020}. For the Rural-eMBB, we have focused on Configuration A and Configuration B, while for the Dense Urban-eMBB we have focused on Configuration A. Other non-eMBB scenarios and configurations are left for future work, because calibration is a time consuming process and requires big efforts for each configuration. Depending on the scenario under evaluation, UEs might be indoor/outdoor, while the antenna configuration and height, among other parameters, of both gNBs and UEs, are also varied. Moreover, let us notice that all scenarios have been evaluated under full buffer traffic, as indicated by 3GPP reference results. The specific details related to the calibration settings of these scenarios are given in Sections~\ref{sec:Rural} and~\ref{sec:Um}, respectively. \subsection{Rural-eMBB} \label{sec:Rural} Rural Configuration A and Rural Configuration B are defined with carrier frequencies of 700 MHz and 4 GHz, respectively, focusing on FR1 band. The test environment follows a tri-sectorial hexagonal topology as described in Section~\ref{sec:NetTop}. 10 UEs per sector are randomly deployed following a uniform distribution, where 50\% are considered as indoor and 50\% as outdoor. UE applications are configured to start at the same time in order to achieve full buffer traffic since the beginning of the applications start time. However, note that the moment at which a UE enters the network (UE connection) is random because of the random access procedure and RRC, but applications are configured to start after the RRC connection is established. The detailed calibration parameters for the Rural configurations A and B are given in~\cite{RP180524}. We present a summary of them, according to which we have also configured 5G-LENA simulator for calibration, in Table~\ref{table:Ruraltable}. \begin{table}[!t] \small \centering \caption{Rural-eMBB Configuration A and B Parameters} \begin{tabular}{|p{4.0cm}|p{2.7cm}|p{2.7cm}|} \hline \textbf{Parameter} & \textbf{Configuration A} & \textbf{Configuration B} \\ \hline Carrier frequency & 700 MHz & 4 GHz \\ \hline & \multicolumn{2}{|c|}{\textbf{Common Parameters}} \\ \hline Bandwidth & \multicolumn{2}{|c|}{10MHz} \\ \hline Inter-site distance & \multicolumn{2}{|c|}{1732 m} \\ \hline Sectors & \multicolumn{2}{|c|}{30/150/270 degrees} \\ \hline BS antenna height & \multicolumn{2}{|c|}{35 m} \\ \hline UE antenna height & \multicolumn{2}{|c|}{1.5 m} \\ \hline BS transmit power & \multicolumn{2}{|c|}{46 dBm/sector} \\ \hline UE transmit power & \multicolumn{2}{|c|}{23 dBm} \\ \hline UEs deployment & \multicolumn{2}{|c|}{10 UEs per sector, randomly dropped} \\ \hline Propagation model & \multicolumn{2}{|c|}{3GPP RMa TR 38.901} \\ \hline BS antenna array & \multicolumn{2}{|c|}{1 TXRU: 8x1 (3GPP elements)} \\ \hline BS horizontal/vertical antenna separation & \multicolumn{2}{|c|}{0.5/0.8} \\ \hline BS antenna element gain & \multicolumn{2}{|c|}{8 dBi} \\ \hline UE antenna array & \multicolumn{2}{|c|}{1 TXRU: 1x1 (isotropic element)} \\ \hline UE antenna element gain & \multicolumn{2}{|c|}{0 dBi} \\ \hline BS noise figure & \multicolumn{2}{|c|}{5 dB} \\ \hline UE noise figure & \multicolumn{2}{|c|}{7 dB} \\ \hline Noise power spectral density & \multicolumn{2}{|c|}{-174 dBm/Hz} \\ \hline Percentage of high/low loss building type & \multicolumn{2}{|c|}{100\% low loss (channel model B)} \\ \hline Device deployment & \multicolumn{2}{|c|}{50\% indoor, 50\% outdoor } \\ \hline UE Mobility Model & \multicolumn{2}{|c|}{Fixed speed 3 km/h for all UEs} \\ \hline Minimum BS-UE distance & \multicolumn{2}{|c|}{10 m} \\ \hline Inter-Site Interference Modelling & \multicolumn{2}{|c|}{Explicitly modelled} \\ \hline Downtilt angle & \multicolumn{2}{|c|}{90\si{\degree}} \\ \hline Traffic Model & \multicolumn{2}{|c|}{Full Buffer} \\ \hline \end{tabular} \label{table:Ruraltable} \end{table} For the calculation of Pathloss, the TR 38.901 model \cite{TR38901} is used as given in the following equation: \begin{equation} \text{PL} = \text{PL}_{b} + \text{PL}_{tw} + \text{PL}_{in} + N(0, \sigma^2_\text{P}), \label{Pathloss} \end{equation} where $\text{PL}_{b}$ is the basic outdoor Pathloss given in Table 7.4.1-1 of TR 38.901 \cite{TR38901} according to the LOS and NLOS conditions, $\text{PL}_{tw}$ is the \gls{o2i} building penetration loss, $\text{PL}_{in}$ is the inside loss dependent on the depth into the building, and $\sigma_\text{P}$ is the standard deviation for the penetration loss. $\text{PL}_{tw}$, $\text{PL}_{in}$ and $\sigma_{P}$ are given in Table 7.4.3-2 of TR 38.901~\cite{TR38901}. As indicated also in Table~\ref{table:Ruraltable}, for both Configuration scenarios of the Rural-eMBB, the Outdoor-To-Indoor penetration losses are defined as 100\% low loss, meaning that all the indoor UEs will experience low penetration losses. For the \gls{scm} and antenna model focusing on wireless channels between 0.5 and 100 GHz, we follow the TR 38.901~\cite{TR38901} specifications, as described in~\cite{tommaso:20}, where the implemented channel model for the ns-3 simulator is presented in detail. However, we needed to extend the 3GPP \gls{scm} implemented in~\cite{tommaso:20} to account for the \gls{o2i} penetration losses and dual-polarized antennas (more details are given in Section~\ref{sec:5gLena}). \subsection{Dense Urban-eMBB} \label{sec:Um} The Dense Urban-eMBB scenario consists of a macro and a micro layer. However, in 3GPP for the calibration purpose, only the macro layer is considered. As such, the considered topology here is focused on the macro layer. The network deployment follows the same tri-sectorial hexagonal topology as described in Section~\ref{sec:NetTop}, where 10 UEs per sector are randomly and uniformly deployed. The Pathloss model, the SCM and the antenna model used for the calibration process are as described in Section~\ref{sec:Rural}. Notice that in this scenario, the deployed UEs are 20\% outdoor and 80\% indoor, while the percentage of high loss and low loss building type is set to 20\% high loss and 80\% low loss. This means that the experienced penetration losses for an indoor UE in this scenario can be 20\% high and 80\% low. Moreover, let us point out that in the Dense Urban-eMBB, the antenna height of the UEs follows a 3D deployment option: i.e., it is varied depending on the type; outdoor UEs have $h_\text{UT}$ = 1.5 m, while $h_\text{UT}$ (in m) of indoor UEs is assigned randomly based on the following formula: \begin{equation} h_\text{UT} = 3(\text{nfl} - 1) + 1.5, \label{randomHUt} \end{equation} where nfl $\sim$ uniform(1, Nfl) and Nfl $\sim$ uniform(4, 8). The rest of the calibration parameters, as also used to calibrate 5G-LENA simulator, are given in Table~\ref{table:DenseTable}. \begin{table}[!t] \small \centering \caption{Dense Urban-eMBB Configuration A Parameters} \begin{tabular}{|p{4cm}|p{6cm}|} \hline \textbf{Parameter} & \textbf{Configuration A} \\ \hline Carrier frequency & 4 GHz \\ \hline Bandwidth & 10MHz \\ \hline Inter-site distance & 200 m \\ \hline Sectors & 30/150/270 degrees \\ \hline BS antenna height & 25 m \\ \hline UE antenna height & outdoor UEs: 1.5 m, indoor UEs: random based on equation~\eqref{randomHUt} \\ \hline BS transmit power & 41 dBm/sector \\ \hline UE transmit power & 23 dBm \\ \hline UEs deployment & 10 UEs per sector, randomly dropped \\ \hline Propagation model & 3GPP RMa TR 38.901 \\ \hline BS antenna array & 1 TXRU: 4x8 (3GPP elements) \\ \hline BS horizontal/vertical antenna separation & 0.5/0.8 \\ \hline BS antenna element gain & 8 dBi \\ \hline UE antenna array & 1 TXRU: 1x1 (isotropic element) \\ \hline UE antenna element gain & 0 dBi \\ \hline BS noise figure & 5 dB \\ \hline UE noise figure & 7 dB \\ \hline Noise power spectral density & -174 dBm/Hz \\ \hline Percentage of high/low loss building type & 80\% low loss - 20\% high loss \\ \hline Device deployment & 80\% indoor, 20\% outdoor \\ \hline UE Mobility Model & Fixed speed 3 km/h for all UEs \\ \hline Minimum BS-UE distance & 10 m \\ \hline Inter-Site Interference Modelling & Explicitly modelled \\ \hline Downtilt angle & 90\si{\degree} \\ \hline BeamForming Method & BeamSearch with specific azimuth/zenith direction angles for analog beam steering\\ \hline Traffic Model & Full Buffer \\ \hline \end{tabular} \label{table:DenseTable} \end{table} \subsection{Network Topology} \label{sec:NetTop} The network layout consists in a hexagonal topology with 37 sites of 3 sectors each, thus leading to 111 Base Stations (BS), as shown in Figure \ref{fig:wrap-around}. However, in the measurements we consider only the 21 inner BSs, while the 111 BSs are simulated to account for the wrap-around effect~\cite{M.2412}, as described in detail in Section~\ref{sec:5gLena}. Moreover, let us point out that in order to speed up the simulations, we ignore channel realizations and interferences between nodes located at a distance larger than 2 times the inter-site distance. \begin{figure*}[t!] \includegraphics[width=1.0 \columnwidth]{Figures/hexagonal-wrap-around-colorfull.png} \centering \caption{Wrap-around hexagonal deployment. The rings are colored in the following way: 0th in yellow, 1st in light purple, 2nd in orange, 3rd in green, 4th in light blue, and 5th in dark blue.} \label{fig:wrap-around} \end{figure*} \subsection{Evaluation - KPIs} The \glspl{kpi} used for the evaluation of the candidate radio interface technologies are the Coupling Gain and the Downlink Geometry. According to \cite{Nomor}, the Coupling Gain includes the pathloss, the antenna gains and the average fast fading, while it excludes processing gains such as the ones obtained by beamforming techniques, except for analog beamforming gains of the transmission/reception units (TXRUs) where applicable. In particular, the Coupling Gain can be computed as follows: \begin{equation} \text{Coupling Gain [dB]}= P^T - P^R \end{equation} where $P^T$ is the transmitted power and $P^R$ is the received power. The Downlink Geometry on the other hand, is described in \cite{Nomor} as the ratio of received signal power to the sum of interference and noise power where all signals are averaged individually over the used bandwidth. Similarly, to the Coupling Gain, the Downlink Geometry does not include any processing gain at transmitter or receiver except with analog beamforming where applicable. As such, the Downlink Geometry can be considered as a wideband SINR, and it is measured per TXRU using the following equation: \begin{equation} \text{SINR}= \frac{P^R}{I+N} \label{sinr} \end{equation} where $P^R$ is the received power, $I$ is the sum of interference powers and $N$ is the noise power. \section{5G-LENA Implementation} \label{sec:5gLena} The main key features of the 5G-LENA simulator are: 1) Flexible to work from 400 MHz to 100 GHz, using the 3GPP spatial channel model TR 38.901, 2) Non-standalone architecture: 5G RAN and 4G EPC, 3) Flexible and automatic configuration of the NR frame structure through multiple numerologies, 4) Orthogonal Frequency-Division Multiple Access (OFDMA)-based access with variable TTIs and Time-Division Multiple Access (TDMA)-based access, 5) Restructuring and redesign of the MAC layer, including new flexible MACs schedulers that simultaneously consider time-and frequency-domain resources (resource blocks and symbols) both for TDMA and OFDMA-based access schemes with variable TTI, 6) Uplink grant-based access scheme with scheduling request and 3GPP-compliant buffer status reporting, 7) \gls{fdd} and \gls{tdd} supported, with flexible and configurable TDD patterns, 8) NR-compliant processing timings (K1, K2), 9) New Bandwidth Part (BWP) managers and the architecture to support operation through multiple BWPs and multiple Component Carriers (CCs), 10) New NR-compliant physical layer abstraction, considering LDPC codes for data channels, and MCS tables 1 and 2 (including up to 256-QAM), 11) Compatibility with 3GPP uniform planar arrays, with directional and isotropic radiation, 12) Beamforming support, with various analog beamforming methods, ideal and realistic beamforming with SRS-based channel estimates, 13) Dual-polarized MIMO support with rank adaptation algorithms. For the calibration process, we have further extended the 5G-LENA simulator with some additional specific features that were not supported previously and are needed for calibration. These features are described briefly in the following: \begin{itemize} \item \textbf{3GPP SCM O2I Losses.} We have extended the SCM to include the possibility to add low and high penetration losses for a O2I channel condition, based on the TR 38.901 model \cite{TR38901} and as described in Section~\ref{sec:Rural}. For this, the \texttt{ChannelConditionModel} has been extended to calculate the O2I/O2O channel condition based on either the UE antenna height, or a random uniform variable set through the tested example. For the former case, the O2I condition is considered only for UEs with random antenna heights, while for the latter, O2I condition is assigned randomly based on the result of the random uniform variable. Moreover, in case the channel condition results to be O2I, low or high penetration losses are applied (as defined in Table 7.4.3-2 of TR 38.901~\cite{TR38901}) based on a threshold set in the user example. For this, the \texttt{ThreeGppPropagationLossModel} has also been extended to calculate and account for the O2I low/high penetration losses when calculating the final Pathloss. The O2I channel condition and low/high condition period updates are set equal to the LOS/NLOS channel condition update period. \item \textbf{Wrap-around}. To reproduce correctly the behavior of the network without introducing some network edge effects, it is necessary to simulate an ``infinite`` cellular network. A famous technique to achieve that, is known as wrap-around. To support the wrap-around technique in this calibration study, we have extended the \texttt{HexagonalGridScenarioHelper} to allow the creation of the 4th and the 5th ring (previously, the maximum number of rings was 3). In this way, it is possible to simulate 5 rings. However, in the calibration results we consider only the measurements of the inner rings, i.e. those who are fully interfered, such as rings 0 and 1. In Figure~\ref{fig:wrap-around}, we illustrate the full simulation deployment. Each hexagon represents a single cell, and 3 hexagons with collocated transmitters form 1 site. Various definitions of what is a ring in a hexagonal deployment exist in the literature. In 5G-LENA, we adopted the definition according to which each ring is composed of the sites that are on the same distance from the center site (or 0th ring, shown in yellow in Figure~\ref{fig:wrap-around}). The different rings are denoted with different colors in Figure~\ref{fig:wrap-around}. \item \textbf{Support of 3D user deployment}. The \texttt{HexagonalGridScenarioHelper} has been further extended to create a deployment with UEs with mobility and UEs with 3D antenna height, where the speed and the percentage of UEs with random antenna height are specified through the tested example script. \item \textbf{Dual-polarized antennas and beam sets}. We have extended the SCM to allow the simulation of dual-polarized antennas, at gNBs and UEs, based on the polarized antenna Model-2 in TR 38.901~\cite{TR38901}. Also, for the Dense Urban-eMBB scenario, we have implemented the beam sets at gNB/UEs according to~\cite{RP180524}, which specifies the directions for analog beam steering including specific azimuth and zenith angles. \item \textbf{Filter CQI=0.} Since 5G-LENA currently does not support Handover, and therefore due to the user mobility, there is the chance that users can be located in out-of-coverage areas, we omit from the SINR results calculations associated to a CQI (Channel Quality Indicator)=0. \end{itemize} Notice that all these changes have been included in the 5G-LENA (nr module available at~\cite{ns3devCttc}), except the extension of the SCM to include O2I losses and the support of dual-polarized antennas that we implemented in the antenna and propagation modules of the ns-3-dev simulator (available at~\cite{ns3Calibration}), used by 5G-LENA. Moreover, for the calibration purpose we have created a new example where we have defined the test environment scenarios. For each scenario, we have added a set of pre-defined parameters, meaning parameters that will not be changed during the simulations, such as the frequency or the bandwidth, while we have included some other parameters to be defined through the command line, in case we want to study variations in the KPIs based on different configurations. Examples include the gNB and UE polarization and slant angles, the beamforming method used, and the activation/deactivation of fading and shadowing. Finally, for the Coupling Gain and SINR statistics, we have used the 5G-LENA traces already included in the module. We measure the SINR from the downlink data, assuming wideband-transmissions, no HARQ retransmissions, and single TXRU, as per its definition. \section{Calibration Results} \label{sec:Results} In this section we present the simulation results, as obtained from the REM helper and from end-to-end (E2E) simulations. \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralA/SinrRemRuralA.png} \centering \caption{Rural Configuration A - REM SINR CDF} \label{fig:RuralARemSinr} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralA/REMmapRuralASinr.png} \centering \caption{Rural Configuration A - REM SINR map} \label{fig:RuralARemMap} \end{figure} \subsection{Usage of REM for Validation} 5G-LENA's REM feature has been presented in~\cite{rem3}, implemented in the \texttt{NrRadioEnvironmentMapHelper} class. It allows the network status visualization, so that the phases of network design and analysis can be facilitated and accelerated. We have used the 5G-LENA REM feature as a means to understand the network conditions and find the proper configuration for the first studied case, the Rural-eMBB Configuration A and B test scenarios. Notice that REM implementation in 5G-LENA considers the best serving cell, but with worst-case interference conditions. The fact of considering the best serving cell is perfectly suited with 3GPP reference simulators and reference results, which assume an ideal handover with 0~dB handover margin (i.e., the strongest cell is selected) and UE attachment based on the best received power. The REM feature has been used in conjunction with the above mentioned implemented example. Results presented here are extracted from the SINR as measured at each REM point (each point of the map) and compared against the 3GPP reference simulators. Therefore, calibration results, focusing here on the SINR extracted using the 5G-LENA REM, are shown in Figures~\ref{fig:RuralARemSinr} and ~\ref{fig:RuralARemMap} for Configuration A and Figures~\ref{fig:RuralBRemSinr} and ~\ref{fig:RuralBRemMap} for Configuration B, respectively. Notice that Figures~\ref{fig:RuralARemSinr} and Figures~\ref{fig:RuralBRemSinr} depict the CDF for all the REM points, while Figures~\ref{fig:RuralARemMap} and ~\ref{fig:RuralBRemMap} depict the Beam Shape SINR REM map (Beam-Shape map is used to visualize the configuration of beamforming vectors, i.e., it shows the actual/effective coverage map in the tested scenario~\cite{rem3}). \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralB/SinrRemRuralB.png} \centering \caption{Rural Configuration B - REM SINR CDF} \label{fig:RuralBRemSinr} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralB/REMmapRuralB.png} \centering \caption{Rural Configuration B - REM SINR map} \label{fig:RuralBRemMap} \end{figure} Finally, let us point out that for the case of Dense Urban-eMBB scenario, we could not exploit the REM feature due to the fact that the random antenna UE height and consequently the penetration losses cannot be modeled since the \texttt{NrRadioEnvironmentMapHelper} is a tool that illustrates the network deployment in a 2D plane, and so cannot include the 3D UE deployment and its random antenna heights, rather a single REM point at a specific height is considered to show a 2D map. For this reason, we do not evaluate the Dense Urban-eMBB scenario with REM. Let us also note that we have also extracted simulation results with 5 rings, under the Rural-eMBB scenarios, with both configurations (A and B). The results are not included here for the sake of brevity, but we obtained similar SINR CDFs with 5 simulated rings and filtering of the inner 0-1 rings, as the results that we show in this paper for 1 simulated ring. Based on the above, we can conclude that in the Rural scenarios, the SINR is well calibrated to 3GPP reference curves, which validates the configured deployment and propagation environment in the 5G-LENA example, as well as the implemented models in the 5G-LENA module. \subsection{E2E Simulations} Although REM SINR results are really useful for the calibration process, E2E simulations are necessary to confirm and validate the performance of the 5G-LENA simulator for both KPIs defined by 3GPP, i.e. Downlink Geometry and Coupling Gain. For this reason, we have performed system-level E2E simulations for both Rural-eMBB and Dense Urban-eMBB scenarios using the example described in Section~\ref{sec:5gLena}. \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralA/CouplGainRuralA.png} \centering \caption{Rural Configuration A - Coupling Gain} \label{fig:CgRuralA} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralA/SinrRuralA.png} \centering \caption{Rural Configuration A - Downlink Geometry} \label{fig:SinrRuralA} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralB/CouplGainRuralB.png} \centering \caption{Rural Configuration B - Coupling Gain} \label{fig:CgRuralB} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/RuralB/SinrRuralB.png} \centering \caption{Rural Configuration B - Downlink Geometry} \label{fig:SinrRuralB} \end{figure} The first evaluated scenario is the Rural-eMBB under the two possible configurations (A and B), as described in Section~\ref{sec:Rural}. Results for the Coupling Gain are presented in Figure~\ref{fig:CgRuralA} for Configuration A, while for Configuration B are given in Figure~\ref{fig:CgRuralB}. Moreover, Figures~\ref{fig:SinrRuralA} and ~\ref{fig:SinrRuralB} depict the Downlink Geometry (Wide-band SINR) for Configurations A and B, respectively. Notice that the obtained results are compared against of that of various 3GPP industrial simulators provided in~\cite{RP180524}. As it can be observed from the figures, for both Rural configurations, the 5G-LENA simulator achieves very similar performance as the benchmark simulators with respect to both KPIs, with a slight difference only in the lower part of the Coupling Gain CDF and the SINR lower tail for Configuration B. Overall, it can be seen clearly that it meets the key technical performance requirements as defined in~\cite{M.2410}. Moreover, let us notice that even though 5G-LENA does not support (currently) handover and RSRP (Reference Signal Received Power) based attachment, these two features are modelled very well thanks to the assumptions we have taken under consideration, i.e., CQI0 filtering as described in Section~\ref{sec:5gLena} and attachment based on the closest cell. However, it would be of great interest to perform again the calibration of 5G-LENA once these two features are supported and compare the results against the 3GPP references and also against the current ones. \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/DenseA/CouplGainDenseA.png} \centering \caption{Dense Urban Configuration A - Coupling Gain} \label{fig:CgDenseA} \end{figure} \begin{figure}[!t] \includegraphics[width=1\columnwidth]{Figures/DenseA/SinrSortedDenseA.png} \centering \caption{Dense Urban Configuration A - Downlink Geometry} \label{fig:SinrDenseA} \end{figure} Furthermore, results for Dense Urban-eMBB are shown in Figures~\ref{fig:CgDenseA} and~\ref{fig:SinrDenseA}, for the Coupling Gain and Downlink Geometry (SINR), respectively. In this case, the 5G-LENA simulator calibrates quite well with respect to the SINR compared to the results of the benchmark radio interface technologies. However, there is a small difference in the Coupling Gain due to the fact that the 5G-LENA traces for the Coupling Gain do not include the analog beamforming gains. So, the difference is justified because of the missing beamforming gain in our Coupling Gain computation in 5G-LENA (note that the Urban scenarios do not include beamforming gain as per their definition, see Table~\ref{table:Ruraltable}). Despite this difference, it can be seen that the 5G-LENA simulator calibrates well with respect to the 3GPP SINR specifications, since for the SINR trace we properly account for all the factors. Based on the above results, it is proven that the open-source 5G-LENA system-level simulator can be exploited by the research community for the study and testing of existing and/or new features providing reliable results that are analogous to that of the 3GPP industrial simulators. \section{Conclusions} \label{sec:Conclusions} In this paper, we have confirmed the validity and correct functionality of the open-source 5G-LENA (NR) simulator through the performance evaluation against 3GPP industrial simulators. Test environments are defined in the ITU-R IMT-2020 Report, as well as the minimum technical performance requirements. The calibration process followed in this paper has been carried out in two steps. First, 5G-LENA REM feature has been used as tool to understand the radio environment, such as the signal propagation, the antenna configuration and the network interference, proving the importance of having available such a tool in system-level simulators. Second, end-to-end simulations have been performed and results have been compared against the reference industrial simulators based on the 3GPP defined KPIs. The resemblance of the results with that provided by 3GPP proves that the simulator is analogous to industrial or private ones and can be used by the research community for the development, study and evaluation of existing and/or new features. \section*{Acknowledgment} This work was partially funded by Meta-Facebook and Spanish MINECO grant TSI-063000-2021-56/TSI-063000-2021-57 (6G-BLUR). The authors would like to thank Xiaodi Zhang for the fruitful discussions and help.
\section{Introduction} Controlling stochastic dynamic systems is a research activity that transcends all engineering disciplines. Particularly for systems that are high dimensional, nonlinear and continuous in the system state-space, finding good controllers remains one of the most challenging problems faced by their respective research communities. Formally the goal is to find a policy, mapping system outputs to inputs, so that the closed-loop system is both stable, and, often, exhibits rich and complex behaviour or dynamic skills such as locomotion or manipulation \cite{mordatch2012trajopt,toussaint2015lgp,posa2014trajopt}. A well known paradigm to synthesize such policies is Optimal Control. The policy is determined such that when applied to the system it is expected to accumulate a minimized cost over a finite (or infinite) time horizon. By design of the cost it is possible to encode abstract behavioural and dynamic features into the policy. Finding such optimal policies is an elegant and appealing theoretical concept but is met by significant difficulties in practice and explicit expressions for the optimal policy exist only for a handful of problem statements. In an effort to address these issues, some researchers have turned to probabilistic methods, attempting to rephrase the problem of deterministic optimization as one of probabilistic inference. It is possible to view these endeavours as part of a larger movement referred to as probabilistic numerics \cite{oates2019probnum,hennig2015probabilistic}. Algorithms for numerical problems, such as optimization, proceed iteratively and typically maintain a deterministic running estimate of the correct solution. With every iteration that estimate is improved based on new information. Contrastingly, probabilistic numerics pursues methods that, in place of such point estimates, update probability measures over the space of possible solutions. Note that the manifestation and interpretation of probability is here in the first place epistemic and representative for missing information in a computation that itself is otherwise entirely deterministic. When pursued in the context of (optimal) control, these attempts are usually referred to with the umbrella term Control as Inference (CaI) \cite{levine2018reinforcement}. In part, they consolidate dualities and connections between control and estimation that have captivated researchers for decades and which have resurfaced in recent theoretical work contributed by the Reinforcement Learning (RL) community. From the practical point of view, they give rise to new theoretical paradigms that hopefully will bring forth original algorithms that can draw from the mature (approximate) inference machinery developed by the Machine Learning community. \subsection{Background}\label{sec:historical-run-up} Since the conception of modern system theory, the history of control and estimation has been vividly intertwined, cultivating cautious aspirations to pursue dualities and equivalences early on. In the tradition of other summaries of this kind, reminiscing about the historical roots of optimal control and estimation, we honour the seminal work of Rudolf Kalman \cite{kalman1960,ho1964bayesian} and the duality between the Linear Quadratic Regulator and the Kalman Filter. Unfortunately it proofed difficult to generalise such duality beyond a linear setting and not for a lack of trying \cite{pearson1966duality,pavon1982duality,todorov2008general}. It is fairly safe to state that a serious system-theoretic interest in inferring the optimal policy traces back to the discovery of Linearly Solvable Optimal Control (LSOC) by Kappen \cite{kappen2005linear}, followed by that of Linearly Solvable Markov Decision Processes by Todorov \cite{todorov2007linearly}, later extended by \cite{dvijotham2012linearly} and \cite{lefebvre2020elsoc}. These frameworks refer to a peculiar subclass of stochastic optimal control where the optimal policy can be expressed as a path integral over future \textit{passive} or uncontrolled trajectories, in the sense of Feynman and Kac \cite{kac1951some,feynman2005space}. Put more explicitly, the optimal policy can be expressed in terms of a conditional expectation over the uncontrolled path distribution. Contemporary the framework is often referred to as Path Integral Control (PIC) and derived methods as PIC methods. Soon it was explored how these results could be leveraged to design actual policies by evaluating the integral \cite{kappen2007path} or by solving an eigenvalue problem \cite{todorov2009eigenfunction}. Following earlier work from about the same period as LSOC \cite{toussaint2006probabilistic}, in 2009 Toussaint \cite{toussaint2009pros,toussaint2009robot} pioneered the idea to formulate a probabilistic graphical model whose most likely instance coincided approximately with the optimal one and used it as a theoretical basis to derive a gradient based trajectory optimization algorithm based on the concept of \textit{message passing} \cite{bishop2006pattern}. Toussaint was therefore the first to exploit the similarity between the graphical models underlying the Bayesian estimation framework and optimal control. This approach is one instance of CaI, often denoted as Inference for Control or Inference to Control (I2C). Another field that clearly showcases interest in both control and inference is Reinforcement Learning (RL). Contemporary the problem of RL is cast as a stochastic optimal control problem. The main ambition in RL is to learn the optimal policy simply by eliciting and observing system-environment interactions. As noted by Peters the use of \textit{data} as a means to learn or extract the optimal policy then relies on \textit{tricks} rather than a factual build-in inference mechanism \cite{janpetersyoutube}. Put differently, \textit{learning} is possible only due to the fact that the cost we try to minimize contains an expectation but not necessarily expresses the policy itself in terms of one (e.g. policy search). Until now LSOC is the only framework that expresses the policy itself as an expectation and that does not require any tricks to do so. In an attempt to address this principle shortcoming, the RL community proposed (indirectly) information-theoretic connections regularizing stochastic optimal control problems with information-theoretic measures such as the relative and differential entropy. Peters \cite{peters2010relative} explored regularizing the objective with a {relative entropy} term inspired by the superior performance of \textit{natural} over \textit{vanilla} gradients in policy search methods \cite{kakade2001natural,bagnell2003covariant}. The work on relative entropic RL culminated into the state-of-the-art trust region policy optimization method \cite{schulman2015trust} and closely related proximal policy algorithm \cite{schulman2017proximal}. Second, say that we try to infer a cost model from (human) demonstrations, then the standard stochastic optimal control framework makes for a poor model, as it can not explain the (minor) suboptimalities that might be present in demonstrations. To address this issue, Ziebart \cite{ziebart2008maximum} introduced a differential {entropy} term in the control objective and described the solution of the Entropy Regularized Linear Quadratic Gaussian Regulator. Interestingly enough, the variational solution to these regularized problems are \textit{stochastic} policies, or to be more precise, the optimal policy is given by a distribution rather than a deterministic function. One quickly argued that these ideas might offer an answer to the problem of \textit{exploration} in RL. This stimulated the development of Maximum Entropy or \textit{soft} RL algorithms \cite{levine2013guided,haarnoja2017reinforcement,haarnoja2018soft}. Meanwhile work was done attempting to unify the ideas of Toussaint with the relative entropy framework and LSOC \cite{rawlik2013stochastic}. In parallel the work on LSOC and PIC also proceeded. In 2010, Theodorou devised the first RL policy search algorithm from the theory of LSOC \cite{theodorou2010generalized,theodorou2010reinforcement}. The work of \cite{stulp2012path} hinted at a deeper connection with stochastic optimization techniques inspiring the first theoretical investigations on dualities between information theory and stochastic optimal control \cite{theodorou2013information,theodorou2015nonlinear} and refuelling work on combining LSOC with the ideas from RL on entropy regularization \cite{gomez2014policy,pan2015sample,kappen2016adaptive,thalmeier2020adaptive}. Finally during the second part of the previous decade a series of model based algorithms were proposed that make use of the fact that in the context of LSOC the policy can be expressed as a path integral to update the control based on sampled trajectories \cite{williams2017model,williams2018information,rajamaki2016sampled,lefebvre2019path}. Common applications are trajectory optimization \cite{summers2020lyceum,nagabandi2020deep}, Model Predictive Control \cite{williams2016agressive,kahn2021land,kahn2021badgr} and Reinforcement Learning \cite{chebotar2017path}. More recently a generalised PIC problem was proposed that unified LSOC with the Relative Entropy framework \cite{lefebvre2020elsoc}. Noteworthy is the underlying principle of \textit{Entropic Optimization} and the first mentioning of the Entropic Optimal Control (EOC) framework. In \cite{lefebvre2021deoc} this view was generalised showing that for deterministic systems, the EOC framework also gives rise to path integral expressions for the optimal policy completing the unification between PIC and EOC. Finally we mention a series of work that directly derive from the view on optimization pioneered by Toussaint \cite{toussaint2009robot}, here referred to as I2C. This idea was embraced by a number of works in Reinforcement Learning to derive a series of RL approaches such as the work of \cite{neumann2011variational,levine2013variational,levine2013guided} amongst others. The latest RL algorithm that is inspired by the inference for control paradigm is Maximum a posteriori Policy Optimization (MPO) \cite{abdolmaleki2018maximum,lee2021beyond,liu2021motor}. Finally we can mention the work of Watson et al. who recently revived the pioneering work by Toussaint on I2C and message passing algorithms \cite{imohiosen2020active,watson2021advtrajopt,watson2021stochastic} and attempted unifications with LSOC \cite{watson2021control}. \subsection{Contribution} By now the probabilistic inference view on optimization and trajectory optimization for motion planning in particular has been well accepted by the robotics community. Consider for example the papers by \cite{kalakrishnan2011stomp,dong2016motion,mukadam2018continuous} and \cite{mukadam2019steap} where Gaussian processes were used as a probabilistic motion prior. We mention these papers not because they are essential to the work presented here but because they illustrate why probabilistic inference approaches to control and planning should be recognized as a promising research direction. They all aim to exploit the probabilistic view for its computational ease and flexibility. Despite these successes, one must recognize that the probabilistic model that is used to motivate theoretical derivations is only a proxy for the optimal control problem that truly motivates the work. In this work therefore we explore the relation between the governing principles associated to CaI and the actual optimal control problems that lie underneath. To summarize we first cast stochastic and risk sensitive optimal control probabilistically. Second we show that either problem can be decomposed and solved using principles from variational inference which allows to iterate for the deterministic solution of the associated optimal control problems. In conclusion we discuss in depth several directions to derive practical algorithms. \section{Preliminaries}\label{sec:preliminaries} In this section we introduce the two optimal control problems (OCPs) that enjoy our interest. Second we introduce the probabilistic machinery that we will use to tackle these problems in section \ref{sec:solving-control-problems-with-the-em-algorithm}. The presentation of the problems is in line of with the principle motivation of this work, which is to lay bear the machinery underlying CaI. \subsection{Optimal Control}\label{sec:optimal-control} The mathematical stage where the events of this work will unfold is set by controlled Markov Models. To specify the associated probabilistic state-space model we characterise the following set of conditional probability distributions describing the probabilistic dynamics of the system. An initial state distribution $p(x_0)$, a transition probability $p(x_{t+1}|x_t,u_t)$ and {a} policy distribution $\pi_t(u_t|x_t)$. State and controls are defined as $x_t\in\mathcal{X}_t$ and $u_t\in\mathcal{U}_t$. The policy distributions determine the probability of applying $u_t$ given $x_t$ at some time $t$. Throughout we assume that the state $x_t$ can be measured exactly. For notational convenience we further define the variable tuple $\xi=(x,u)$ and the notation formats $\underline{X}_t = \{x_0,\dots,x_t\}$ and $\overline{X}_t = \{x_t,\dots,x_T\}$ which we use to refer concisely to a leading or trailing part of a sequence with $t$ referring to the end or start of the corresponding subsequence respectively. We silently assume that any complete sequence starts at time $t=0$ and ends at time $t=T$ . The distribution of some trajectory $\underline{\Xi}_t = \{\xi_0,\dots,\xi_T\}$ \textit{conditioned} on a sequence of policy distributions $\underline{\pi}_T$ is then defined below. \begin{equation*} p(\underline{\Xi}_T;\underline{\pi}_T) = p(x_0) \prod\nolimits_{t=0}^{T-1} p(x_{t+1}|x_t,u_t)\pi_t(u_t|x_t) \end{equation*} \subsubsection{Stochastic Optimal Control} The first problem considered in this work is Stochastic Optimal Control (SOC) where we aim to render some cost function $R$ extreme by administering a sequence of carefully selected control distributions $\underline{\pi}_T\in\mathcal{P}$. Throughout we use notation $\mathcal{P}$ to refer to \textit{any} probability distribution space; which one is implied by the context. This mathematical problem formalises the setting for many methodologies tailored to control applications amongst. \begin{equation} \label{eq:ROC} \min_{\underline{\pi}_T\in\mathcal{P}} \int p(\underline{\Xi}_T;\underline{\pi}_T) R(\underline{\Xi}_T)\text{d} \underline{\Xi}_T \end{equation} where \begin{equation*} R(\underline{\Xi}_T) = r_T(x_T) + \sum\nolimits_{t=0}^{T-1} r_t(x_t,u_t) \end{equation*} The cost function $R$ denotes an accumulated cost or cost-to-go. The functions $r_t$ and $r_T$ represents the cost rate and final cost and can be used to \textit{encode} abstract behavioural and dynamical features into the control problem. \subsubsection{Risk Sensitive Optimal Control} Following the observation that for affine system models the solution to either the deterministic or stochastic version of this problem are equivalent, a risk sensitive version has been proposed where instead of minimizing the cumulative performance criteria $R$, the exponential of that objective, $\exp(-\sigma R)$, is maximized \cite{jacobson1973optimal}. Thinking of the trajectory distribution as a collection of alternative histories, using such an exponential \textit{utility function} puts less (or more) emphasis on the successful histories. We refer to the work of Whittle \cite{whittle1981risk,whittle1996optimal,whittle2002risk} for an excellent exhibition on risk sensitive optimal control and the use of utility functions in decision making in general. This generalised problem is referred to as Risk Sensitive Optimal Control (RSOC). The solution is referred to as risk seeking or averse for $\sigma < 0$ either $\sigma > 0$. \begin{equation} \label{eq:RSOC} \min_{\underline{\pi}_T\in\mathcal{P}} -\frac{1}{\sigma}\log\int p(\underline{\Xi}_T;\underline{\pi}_T) e^{-\sigma R(\underline{\Xi}_T)}\text{d} \underline{\Xi}_T \end{equation} In this work we focus on the risk averse version but note that the risk seeking version can generally be treated in the same way as will be presented here. More important to the developments to come is the observation that for the limit $\sigma\rightarrow0$, the RSOC collapses onto the SOC problem. For conciseness we further absorb $\sigma$ into $R$ which can be achieved by appropriate scaling. In conclusion we note that the the logarithm is a monotonically increasing function so that minimization of (\ref{eq:RSOC}) is equivalent to maximization of the expectation without the negative $log$-transform. \subsubsection{Some remarks}\label{sec:some-remarks} Although we have introduced an expression for the trajectory distribution $p(\underline{\Xi}_T;\underline{\pi}_T)$ using some arbitrary control or policy \textit{distributions} $\underline{\pi}_T$, we emphasize that neither problem is in fact rendered extreme by a control distribution sequence. In either case the solution is given by a sequence of optimal deterministic policy functions, $\pi_t^*:\mathcal{X}\mapsto\mathcal{U}$. This property can be proven rigorously but also follows from the intuition that the objective function can not be rendered extreme by gambling on the outcome of a control $u_t$ given a state $x_t$. We further note that regardless both problems can be treated \textit{probabilistically}, in the sense that we substitute a policy distribution, with the optimal solution \textit{collapsing} onto a Dirac delta distribution. More formally we have that the set of all deterministic policies is contained in the set of all policy distributions so that we only extend the optimization space. This representation will proof useful to our purpose later on. Second, both problems provide us with the same solution when the underlying dynamics are also deterministic. One easily verifies that the way of thinking of the trajectory distribution as a collection of alternative histories then collapses onto a single history, rendering the influence of the utility function irrelevant. In that same line of thought it follows that the solution of a deterministic optimal control problem is uniquely defined by the optimal control sequence $\underline{U}_T^*$ and associated optimal state sequence $\underline{X}_T^*$. As such the optimal trajectory is defined as an instantiation of the underlying optimal policy given the initial state $x_0$ so that $u_t^* =\pi_t^*(x_t^*)$. For stochastic systems the solution cannot be a unique trajectory but must be a policy given that the state transitions differently for every history so that we should adapt our control policy progressively accordingly. In conclusion we may want to note that both problems can be treated analytically using the principle of Dynamic Programming provided that either problem exhibits a so called optimal substructure, which allows to decompose the problem into a number of $T$ smaller optimization subproblems that are backward recursive dependent. As such it is possible to construct backward recursive equations that govern the optimal policy. For the purpose of conciseness we have not included these governing equations here. They are included in Appendix \ref{sec:lqr-and-lqer}. We do note that these backward recursive sequence of optimization subproblems cannot be solved for general OCPs. Only a small subset of OCP formulation can be treated in this way. For (discrete-time) continuous state-spaces this problem can not be solved analytically but for the Linear-Quadratic-Regulator (LQR). Again we refer to Appendix \ref{sec:lqr-and-lqer}. In order to treat nonlinear optimal control problems a wide variety of iterative numerical procedures have been developed better known as trajectory optimization algorithms. Amongst them are the iterative LQR (iLQR) \cite{todorov2005ilqr}, Differential Dynamic Programming (DDP) \cite{mayne1966ddp,tassa2014control,howell2019ddp,theodorou2010stochastic}, Direct Multiple Shooting (DMS) \cite{bock1984multiple,diehl2006fast} and hybrids between the DDP and DMS \cite{giftthaler2018family,mastalli2020crocoddyl,mastalli2020direct}. At the heart of all of these algorithms lies the LQR solution. The dynamics are linearised\footnote{With the exception of the DDP algorithm where also second order derivative of the dynamics are used.} and a quadratic approximation of the cost is constructed about some reference trajectory $\underline{\Xi}_T^i$. The iterative LQR policy is then calculated about the reference $\underline{\Xi}_T^i$ and a closed-loop simulation of the dynamics is performed to determine the next iterate trajectory $\underline{\Xi}_T^{i+1}$. \subsection{A Primer on Probabilistic Inference}\label{sec:a-prior-on-probabilistic-inference} Probability theory offers a mathematical setting to model systems where the uncertainties of the system are taken into account \cite{sarkka2013bayesian}. Probabilistic inference then refers to the process of reasoning with incomplete information according to rational principles \cite{jaynes2003}. Thus whereas the theory of mathematical logic formalises reasoning with absolute truths, in this view probability theory formalises the practice of common sense. In this setting probability distributions can be used to quantify both aleatoric as well as epistemic uncertainty. In this section we review two principle inference techniques known as Bayesian and Entropic Inference that distinguish themselves in that they allow to make precise revisions of our uncertainty in light of new evidence \cite{bishop2006pattern}. More formally prior distributions, modelling our previous state of belief, are updated into posterior distributions, modelling our new state of belief\footnote{As we distance ourselves from the classic or frequentist interpretation of probability, we may refer to our state of uncertainty as belief and to probability distributions as belief functions}. In a third paragraph we review the main ideas behind Variational Inference which will serve as our principle inference engine. \subsubsection{Bayesian Inference} Generally speaking Bayesian Inference (BI) may refer to the practice of computing conditional probabilities according to the rules of probability. As such Bayes' rule is used to convert a prior probability, $p(X)$, capturing our assumptions about the hidden random variable $X$, into a posterior probability, $p(X|Z)$, by incorporating the evidence provided by the observations $Z$. The first term in the most right-hand side is called the likelihood function expressing the probability of $Z$ for different values of $X$ \begin{equation*} p(X|Z) = \frac{p(Z|X)p(X)}{p(Z)} \propto p(Z|X)p(X) \end{equation*} A simplifying and therefore key feature is the existence of conditional independence which often makes it possible to make inferences in arbitrarily complex probabilistic models. Applications in estimation are filtering and smoothing. We refer to \cite{sarkka2013bayesian} for excellent coverage of the material. A summary of useful results is also given in Appendix \ref{sec:bayesian-filtering--smoothing}. \subsubsection{Entropic Inference} As was described in the previous paragraph the BI procedure allows to process information that is represented by data and in particular by the outcome of experiments. We can arguably refer to such information as \textit{empirical evidence}. Entropic Inference (EI) \cite{caticha2011entropic,caticha2013entropic} is an information-theoretic concept that allows to treat information represented by constraints that affect our hypothesis space, ergo our belief space. Correspondingly we can refer to such information as \textit{structural evidence}. The principle that facilitates EI is that of minimum relative entropy or discrimination information \cite{kullback1951information,kullback1997information} which in turn are extensions of Laplace’s or Jaynes’s principle of insufficient reason \cite{jaynes1986background}. In words it states that the unique posterior, $\pi$, living in the constrained distribution space, $\mathcal{P}^\bullet\subseteq\mathcal{P}$, describing events in some space $\mathcal{X}$, is the one that is \textit{hardest} to discriminate from the prior, $\rho$. The measure used here to discriminate between two distributions is the relative entropy. \begin{equation*} \kullbacks{\pi}{\rho} = \int \pi(X) \log \frac{\pi(X)}{\rho(X)} \text{d}X \end{equation*} The posterior $\pi$ can then be determined by minimizing the relative entropy whilst constraining the search space to $\mathcal{P}^\bullet$. In information-theory this operation is sometimes referred to as the information or I-projection of the prior $\rho$ onto the constrained distribution space $\mathcal{P}^\bullet$ \cite{thomas2006elements,murphy2012machine,nielsen2018information}. \begin{STDdescription \item[\textbf{I-projection}] The I-projection of $\rho$ onto the constrained distribution space $\mathcal{P}^\bullet$ is defined by the following optimization problem \begin{equation} \begin{aligned} \pi^\bullet = \arg\min_{\pi\in\mathcal{P}^\bullet} \kullbacks{\pi}{\rho} \end{aligned} \end{equation} \end{STDdescription} The relative entropy therefore provides a measure of the inefficiency of assuming that the distribution is $\rho$ when the true distribution is $\pi$\footnote{ A more elaborate way of viewing this is that the relative entropy quantifies the average additional amount of information required to decode the message $X$ and using some optimal decoding scheme assuming $X$ is distributed according to $\rho$ whilst instead $X$ is distributed according to $\pi$ \cite{thomas2006elements}.}. The relative entropy is asymmetric in its arguments, always positive and zero if and only if $\pi \equiv \rho$. This last property implies that if $\rho\in\mathcal{P}^\bullet$, the posterior is also given by $\rho$. When the prior is a uniform distribution, modelling a lack of a priori information, the concept collapses onto the Maximum Entropy principle \cite{jaynes1982rationale}. A common constraint is the following \begin{equation*} \mathcal{P}^\bullet = \left\{\pi\in\mathcal{P}\left|\int \pi(X) f(X) \text{d}X = \bullet \right.\right\} \end{equation*} and then the corresponding posterior is known as the Maximum-Entropy distribution. Note that the posterior is here proportional to the prior multiplied with a likelihood similar to the Bayesian update. The parameter $\lambda$ is a Lagrangian multiplier which value is so that the constraint is satisfied. \begin{equation*} \pi(X)^\bullet \propto \rho(X)e^{-\lambda f(X)} \end{equation*} Further it can be shown that a consistent inference procedure follows only from the I-projection not by flipping the arguments in the objective \cite{caticha2011entropic,caticha2013entropic,caticha2015belief}. The reciprocal projection is known as the Moment or M-projection of the prior $\rho$ onto the distribution space $\mathcal{P}^\star$ \cite{murphy2012machine,nielsen2018information}. \begin{STDdescription} \item[M-projection] The reciprocal M-projection of $\rho$ onto the constrained distribution space $\mathcal{P}^\star$ is defined by the following optimization problem \begin{equation} \begin{aligned} \pi^\star = \arg\min_{\pi\in\mathcal{P}^\star} \kullbacks{\rho}{\pi} \end{aligned} \end{equation} \end{STDdescription} Since the relative entropy is asymmetric in its arguments, the I-projection and the M-projection exhibit different behaviour. For the I-projection, $\pi$ typically under-estimates the support of $\rho$ and locks onto its principle modes because $\pi$ should equal zero when $\rho$ does to ensure the relative entropy stays finite. For the M-projection, $\pi$ typically overestimates the support of $\rho$. That is because $\pi(X)>0$ when $\rho(X)>0$. \subsubsection{Variational Inference}\label{sec:expectation-maximization-algorithm} In this final paragraph we cover the main ideas from Variational Inference (VI). In essence VI is a problem decomposition technique for finding Maximum Likelihood Estimates (MLE) of probabilistic models with latent variables \cite{bishop2006pattern,murphy2012machine}. So as opposed to the inference techniques discussed so far VI is used to find a point estimate of probabilistic model parameters not so much a posterior belief. Consider a probabilistic models with latent variables $X$ and observations $Z$. Further suppose that the joint distribution $p(Z,X;\theta)$ is characterised by a set of parameters $\theta$. The goal of MLE is then to identify that probabilistic model that explains the given observations best by identifying probability distributions $p(Z|X;\theta)$ and $p(X;\theta)$. \begin{equation} \max_\theta \mathcal{J}(\theta) \end{equation} where \begin{equation*} \mathcal{J}(\theta) = \log p(Z;\theta) = \log \int p(Z|X;\theta)p(X;\theta)\text{d}X \end{equation*} \begin{figure*}[t] \begin{equation} \label{eq:decomp1} \begin{aligned} \int p(\underline{\Xi}_T;\underline{\pi}_T) R(\underline{\Xi}_T)\text{d}\underline{\Xi}_T& = \int p(\underline{\Xi}_T;\underline{\pi}_T) \log \frac{1}{e^{-R(\underline{\Xi}_T)}} \text{d}\underline{\Xi}_T \\ &= \int p(\underline{\Xi}_T;\underline{\pi}_T) \log \frac{p(\underline{\Xi}_T;\underline{\pi}_T') }{p(\underline{\Xi}_T;\underline{\pi}_T)} \text{d}\underline{\Xi}_T + \int p(\underline{\Xi}_T;\underline{\pi}_T) \log \frac{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}} \text{d}\underline{\Xi}_T \\ &= -\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')} + \kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}} \\ &= \mathcal{A}[\underline{\pi}_T';\underline{\pi}_T] + \mathcal{B}[\underline{\pi}_T;\underline{\pi}_T'] \end{aligned} \end{equation} \hrulefill \end{figure*} It is well-known that this objective is hard to optimize on account of the integral expression, provided that $X$ is unobserved and the distribution $p(X)$ is unknown before attaining a value for the parameter $\theta$. To circumvent the intractable inference, an \textit{inference distribution} $q(X)$ is introduced. The inference distribution allows to decompose $\mathcal{J}$ into another surrogate objective $\mathcal{L}$ which is often referred to as the evidence lower bound (ELBO) and a relative entropy \textit{error} term. Note that since the relative entropy term is always positive the ELBO constraints $\mathcal{J}$ from below. \begin{equation*} \begin{multlined} \log p(Z|\theta) \\ \begin{aligned} &= \int q(X) \log \frac{p(Z,X;\theta)}{q(X)}\text{d}X + \int q(X) \log \frac{q(X)}{p(X|Z;\theta)} \text{d}X \\ &= \mathcal{L}[q|Z;\theta] + \kullbacks{q(X)}{p(X|Z;\theta)} \geq \mathcal{L}[q|Z;\theta] \end{aligned} \end{multlined} \end{equation*} This problem decomposition now allows to tackle the original optimization problem in two consecutive and iterated steps. This two step procedure is, amongst others, at the basis of the Expectation-Maximization algorithm. First the error term is minimized to find the optimal inference distribution $q$ fixing parameters $\theta$, second the surrogate objective $\mathcal{L}$ is maximized to find the optimal parameter values $\theta$ fixing the inference distribution $q$, and so on. Suppose then that the current value of the parameter vector is $\theta^\text{old}$. It is easily seen that the E-step is solved for the posterior distribution $p(X|Z;\theta^\text{old})$. Then in the M-step the inference distribution is fixed and the ELBO is maximized with respect to $\theta$ rendering some new value $\theta^\text{new}$. By definition, choosing $\theta$ to maximize $\mathcal{L}$ improves $\mathcal{J}$ at least as much as $\mathcal{L}$ improved. For many practical applications $p(X|Z;\theta^\text{old})$ cannot be evaluated explicitly so that the expectation is approximated using e.g. Monte Carlo sampling. The E-step then boils down to sampling the posterior so that the M-step can be evaluated. From a technical perspective the inference distribution is chosen so that it generate samples near the observed data $Z$. In the M-step we then optimize the ELBO objective which is now better behaved as a function of $\theta$. \begin{STDdescription} \item[Expectation-step] Minimize the error w.r.t. $q$ fixing $\theta$. \item[Maximization-step] Maximize the ELBO w.r.t. $\theta$ fixing $q$. \end{STDdescription} Note that the E-step can also be understood as maximizing the ELBO for fixed $\theta$ provided the decomposition below. As such the EM algorithm can also be viewed as an example of coordinate ascent. Furthermore we can recognize the E-step as performing an I-projection of $q$ onto the distribution space spanned by $p(X|Z;\theta)$ and the M-step as performing an M-projection of $p(X|Z;\theta)$ onto the space spanned by $q$. \begin{equation*} \mathcal{L}[q|Z;\theta] = - \kullbacks{q(X)}{p(X|Z;\theta)} + \log p(Z;\theta) \end{equation*} \section{Optimal Control as Variational Inference}\label{sec:solving-control-problems-with-the-em-algorithm} In this section we demonstrate that either of the optimal control problems introduced in section \ref{sec:optimal-control} can be addressed using VI. We detail our approach in two separate subsections, addressing one problem at a time. In a third subsection we make a comparison between both results and discuss in detail various connections with other fields. \subsection{Regularized Stochastic Optimal Control} Let us first retake from the SOC problem in (\ref{eq:ROC}). We start our analysis with the problem decomposition in (\ref{eq:decomp1}). Although lacking any straightforward probabilistic motivation, this decomposition matches a VI structure. The optimal control framework imposes the structure of a controlled trajectory distribution $p(\underline{\Xi}_T;\underline{\pi}_T)$ onto the inference distribution so that we do not need to adopt the conventional form prescribed by \ref{sec:expectation-maximization-algorithm}. For ease of reference we renamed the two subproblems $\mathcal{A}$ and $\mathcal{B}$. Application of the EM algorithm then boils down to the following steps. \begin{STDdescription} \item[E-step] Minimize $\mathcal{B}$ for $\underline{\pi}_T$ keeping $\underline{\pi}_T'$ fixed. \item[M-step] Maximize $\mathcal{A}$ for $\underline{\pi}_T'$ keeping $\underline{\pi}_T$ fixed. \end{STDdescription} Solution of the M-step is here of course trivial. The distribution that renders the relative entropy minimal is $\underline{\pi}_T' \equiv \underline{\pi}_T$. On a side-note we remark that this amounts to the M-projection of $p(\underline{\Xi}_T;\underline{\pi}_T')$ onto the structure of $p(\underline{\Xi}_T;\underline{\pi}_T)$. We must emphasize that although the solution of the M-step is trivial, exploitation of the EM algorithm does induce an iterative mechanism to treat the underlying optimal control problem. The real question here reduces to solving the E-step. Note that this is equivalent to the I-projection of $p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}$ onto the probability distribution space defined by controlled trajectory distributions $p(\underline{\Xi}_T;\underline{\pi}_T)$ \begin{equation} \label{eq:ROC_iter} \min_{\underline{\pi}_T\in\mathcal{P}}\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}} \end{equation} Versions of this particular problem have popped up and were treated in many earlier works with varying probabilistic motivation depending on the associated reference. For later comparison it will proof convenient to include a derivation. Derivations and associated motivations can also be found in the works of \cite{rawlik2013stochastic,levine2013variational} and \cite{levine2018reinforcement}. Though we note that the iterative aspect has only been recognized by \cite{rawlik2013stochastic}. \subsubsection{Explicit solution of the E-step}\label{sec:explicit-solution-of-the-e-step} First verify that problem (\ref{eq:ROC_iter}) can be recast as \begin{equation*} \min_{\underline{\pi}_T \in \mathcal{P}} \expect{p(\underline{\Xi}_T;\underline{\pi}_T)} \left[R(\underline{\Xi}_T)+\log\tfrac{\underline{\pi}_T}{\underline{\pi}_T'}\right] \end{equation*} We can treat this problem as a variational OCP as it too exhibits an optimal substructure which we may exploit to solve it. Let us therefore define the following $V$-function \begin{equation*} V^\bullet_t(x_t) = \min_{\overline{\pi}_t \in \mathcal{P}} \expect{p(\overline{\Xi}_t|x_t;\overline{\pi}_t)} \left[R(\overline{\Xi}_t)+\log\tfrac{\overline{\pi}_t}{\overline{\pi}_t'}\right] \end{equation*} which satisfies the recursion \begin{equation*} V^\bullet_t(x_t) = \min_{\pi_t \in \mathcal{P}} \expect{\pi_t(u_t|x_t)} \left[ Q^\bullet_t(\xi_t) + \log \tfrac{\pi_t(x_t|u_t)}{\pi_t'(u_t|x_t)} \right] \end{equation*} where \begin{equation*} Q^\bullet_t(\xi_t) = r_t(\xi_t) + \expect{p(x_{t+1}|\xi_t)}[V^\bullet_{t+1}(x_{t+1})] \label{eq:Qbullet} \end{equation*} Variational optimization of the problem definition of $V^\bullet_t$ then yields \begin{equation*} \pi^\bullet_t(x_t|u_t) = \pi_t'(u_t|x_t) \frac{\exp(-Q^\bullet_t(\xi_t))}{\exp(-V^\bullet_t(x_t))} \end{equation*} and \begin{equation*} V^\bullet_t(x_t) = - \log \expect{\pi_t'(u_t|x_t)}\left[\exp(-Q^\bullet_t(\xi_t))\right] \end{equation*} It is easily verified that these expressions establish a backward recursive procedure to derive a sequence of policy distributions $\underline{\pi}_T^\bullet$ initialising $V_T^\bullet(x_T)$ with $\exp(-r_T(x_T))$. Explicit evaluation of the backward recursion is however restricted to a limited class of well-behaved optimal control problems. We come back to this in section \ref{sec:regularized-linear-quadratic-regulator}. Nevertheless it is already remarkable that as opposed to the underlying regular optimal control problem, the regularized version can be solved explicitly, replacing the minimization operators with $log$-transformed expectations. See Appendix \ref{sec:lqr-and-lqer}. \subsubsection{Alternative motivation}\label{sec:alternative-motivation} We can arrive at the same result from the previous paragraph using a different line of thought. It serves our development right to include such an alternative argument as it provides a principled probabilistic motivation for problem (\ref{eq:ROC_iter}) where we lacked one earlier on. Furthermore it attributes new significance to the principle of EI as a technical instrument. Consider therefore the problem of minimizing the function $f:\mathcal{X}\mapsto \mathbb{R}$ which we assume to posses a single global minimum for ease of exposition. We initiate our argument with the observation that classic numerical optimization methods iterate a point estimate, say $x^{(g)}$, of the solution $x^*$. Then with every iteration new information is retrieved upon which the point estimate is updated. Now instead of focussing on a point estimate of the isolated solution, we could also model this iterative search procedure with a sequence of beliefs $\{\pi^{(0)},\pi^{(1)},\dots,\pi^{(g)},\dots\}$ (over iterations, not time) with every $\pi^{(g)}$ expressing our uncertainty about any possible solutions. This is in agreement with the ideas from probabilistic numerics. The more information that is gathered over the iterations, the more certain we should get about the true solution. It can be anticipated that, to have any use in optimization, the expected cost must decrease with every iteration, ergo $\expect{\pi^{(g+1)}}[f] \leq \expect{\pi^{(g)}}[f]$. To establish such as sequence, we require a consistent inference procedure that facilitates an update of the form $\pi^{(g+1)} \leftarrow \pi^{(g)}$. To construct such an inference procedure we will make use of the principle of minimal relative entropy. Since a priori no or little information about the possible solutions is available, this situation can be represented mathematically by encoding uncertainty about the solution in a prior probability density $\pi^{(0)}$ which support covers the feasible solution space $\mathcal{X}$ but attributed equal probability to each solution. Then in order to gradually decrease the uncertainty over iterations, a posterior belief $\pi^{(g+1)}$ is desired that discriminates least from the prior belief $\pi^{(g)}$ but so that the expected objective function value produces a lower estimate on the expected cost. Then following the interpretation of the relative entropy as a measure of the inefficiency of assuming that the distribution is $\pi^{(g)}$ when the true distribution is $\pi^{(g+1)}$ [9], we could use the I-projection to project $\pi^{(g)}$ onto the distribution space defined by the constraint $\expect{\pi}[f] \leq \expect{\pi^{(g)}}[f] - \Delta$. The problem that we solve is thus defined as $\min_\pi \kullbacks{\pi}{\rho} \text{ s.t. } \expect{\pi}[f] \leq \expect{\rho}[f] -\Delta$. Using the method of Lagrangian multipliers it is easily verified that $\pi \propto \rho\cdot e^{-\lambda f}$ where $\lambda$ must be determined so that the constraint is satisfied. It can be shown that $\lambda>0 \Leftrightarrow \Delta >0$ so that we can choose $\lambda>0$ instead of $\Delta$ and attain the same goal \cite{luo2019minima,lefebvre2020elsoc}. In other words a belief space containing distributions that perform slightly better on $f$ than the prior. By definition this update mechanism produces a monotonically decreasing sequence implying that any derived algorithm is potentially also monotonically decreasing. Note that in practice we can not desire to keep on subtracting an amount $\Delta$ from the expected cost every iteration but this is an issue that we treat later on by parametrising the problem differently. In any case it follows that when the sequence converges, that is when it reaches the minimal expected cost attainable, it must coincide with the Dirac delta centered at the true solution $x^*$. The exact same argument can now be repeated for the regular OCP (\ref{eq:ROC}). As such we need to solve the following variational optimization problem\footnote{Note that this is an alternative formulation of the relative entropy constrained problem defined by for example \cite{peters2010relative} and \cite{schulman2015trust} amongst others. However here we flip the objective and constraint so to reveal the connection with Entropic Inference which we argue is the underlying principle. On account of the method of Lagrangian multipliers either problem formulation ultimately amounts to the same mathematical problem after appropriate scaling of the Lagrangian multipliers or cost function.} \begin{equation*} \label{eq:RSOC_iter_2} \begin{multlined} \min_\pi\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')} \end{multlined} \end{equation*} subject to \begin{equation*} \int p(\underline{\Xi}_T;\underline{\pi}_T) R(\underline{\Xi}_T) \text{d}\underline{\Xi}_T \leq \int p(\underline{\Xi}_T;\underline{\pi}_T') R(\underline{\Xi}_T) \text{d}\underline{\Xi}_T - \Delta \end{equation*} Invoking the method of Lagrangian multipliers and assuming appropriate scaling of $R$ and $\Delta$ so that the Lagrangian multiplier has value $1$ we retrieve the familiar problem (\ref{eq:ROC_iter}) \begin{equation*} \begin{multlined} \kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')} + \int p(\underline{\Xi}_T;\underline{\pi}_T) R(\underline{\Xi}_T) \text{d}\underline{\Xi}_T\\ \begin{aligned} &= \int p(\underline{\Xi}_T;\underline{\pi}_T) \log \frac{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}} \text{d}\underline{\Xi}_T \\ &= \kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T')e^{-R(\underline{\Xi}_T)}} \end{aligned} \end{multlined} \end{equation*} As long as the Lagrangian multiplier is larger than zero the posterior expected cost will be smaller than the prior expected cost so that instead of choosing $\Delta>0$ we can choose a value for the Lagrangian multiplier. For ease of exposition we chose $1$. The larger we choose the value of the multiplier the faster the implied sequence will converge to the underlying deterministic solution. This observation solves the issue that we can not keep on subtracting an amount $\Delta$. Instead we can keep on iterating the distributions using the procedure described in section \ref{sec:explicit-solution-of-the-e-step}. The reduction in expected cost is then determined by the cost functional and the value of the multiplier and converges to zero for $g\rightarrow \infty$. Based on the present argument, we refer to this treatment of stochastic optimal control as Entropic Optimal Control suggesting that a generalised view has been reached. \subsubsection{Entropic LQR}\label{sec:regularized-linear-quadratic-regulator} As noted we can solve the expression from the previous paragraph for a limited class of OCPs. Problems with a discrete state-space for one. The second class of problems for which we can solve the regularized OCP are Linear-Quadratic-Regulators (LQR). Consider the OCP defined by the linear Gaussian transition probability $p(x_{t+1}|\xi_t) = \mathcal{N}(x_{t+1}|\matrixstyle{F}_{\xi,t} \xi_t + f_t,\matrixstyle{P}_t) $, cost rate $r_t(\xi_t) = \tfrac{1}{2} \xi_t^\top \matrixstyle{R}_{\xi\xi,t} \xi_t + \xi_t^\top \matrixstyle{R}_{\xi,t} + \dots$ and terminal cost $r_T(x_T) = \tfrac{1}{2} \xi_T^\top \matrixstyle{R}_{xx,T} x_T + x_T^\top \matrixstyle{R}_{x,T} + \dots$. In the context of the LQR it is reasonable to require that the inference policy distribution is linear Gaussian $q_t = \mathcal{N}({u}_t|\matrixstyle{K}_t{x}_t +{k}_t,\Sigma_t)$. It can then be anticipated that both $Q_t^\bullet$ and $V_t^\bullet$ will be quadratic in their arguments and that the solution $\pi_t^\bullet = \mathcal{N}({u}_t|\matrixstyle{K}_t^\bullet{x}_t +{k}_t^\bullet,\Sigma_t^\bullet)$ is also linear Gaussian in the state. \begin{equation*} \begin{aligned} V^\bullet_t({x}_t) &= \tfrac{1}{2}\begin{bmatrix} 1 \\ {x}_{t} \end{bmatrix}^\top \begin{bmatrix} \times & V_{x,t}^{\bullet,\top} \\ \cdot & V_{xx,t}^\bullet \end{bmatrix}\begin{bmatrix} 1 \\ {x}_{t} \end{bmatrix}\\ Q^\bullet_t({\xi}_t) &= \tfrac{1}{2}\begin{bmatrix} 1 \\ {\xi}_{t} \end{bmatrix}^\top \begin{bmatrix} \times & Q_{\xi,t}^{\bullet,\top} \\ \cdot & Q_{\xi\xi,t}^\bullet \\ \end{bmatrix}\begin{bmatrix} 1 \\ {\xi}_{t} \end{bmatrix}\\ \end{aligned} \end{equation*} Here $\times$ indicates unspecified (or redundant) information and $\cdot$ symmetric matrix entries. Since $\pi_t^\bullet(u_t|x_t) \propto q_t(u_t|x_t) \exp(-Q^\bullet_t(\xi_t))$ one verifies that \begin{equation*} \begin{aligned} {k}_t^\bullet &= \Sigma_t^\bullet(\Sigma_t^{-1}{k}_t - Q^\bullet_{u,t}) \\ \matrixstyle{K}_t^\bullet &= \Sigma_t^\bullet(\Sigma_t^{-1}\matrixstyle{K}_t - Q^\bullet_{ux,t}) \\ \Sigma_t^\bullet &= ( \Sigma_t^{-1} + Q^\bullet_{uu,t})^{-1} \end{aligned} \end{equation*} As $\exp(-V^\bullet_t(x_t)) \pi_t^\bullet(u_t|x_t) = q_t(u_t|x_t) \exp(-Q^\bullet_t(\xi_t))$ for any $u_t$ including $0$ we have \begin{equation} \label{eq:V-ELQR} \begin{aligned} V_{x,t}^\bullet &= Q_{x,t}^\bullet + \matrixstyle{K}_t^{\top} \Sigma_t^{-1} {k}_t - \matrixstyle{K}_t^{\bullet,\top} \Sigma_t^{\bullet,-1} {k}_t^\bullet \\ V_{xx,t}^\bullet &= Q_{xx,t}^\bullet + \matrixstyle{K}_t^{\top} \Sigma_t^{-1} \matrixstyle{K}_t - \matrixstyle{K}_t^{\bullet,\top} \Sigma_t^{\bullet,-1} \matrixstyle{K}_t^\bullet \end{aligned} \end{equation} Finally we can evaluate the expression for the $Q$-function \begin{equation*} \begin{aligned} Q^\bullet_{\xi,t} &= \matrixstyle{R}_{\xi,t} + \matrixstyle{F}_{\xi,t}^\top \left(V_{xx,t+1}^\bullet{f}_t+ V_{x,t}^\bullet\right) \\ Q_{\xi\xi,t}^\bullet &= \matrixstyle{R}_{\xi\xi,t} + \matrixstyle{F}_{\xi,t}^\top V_{xx,t+1}^\bullet \matrixstyle{F}_{\xi,t} \end{aligned} \end{equation*} As is the case for the regular LQR, the stochasticity of the dynamics ($\matrixstyle{P}_t$) only affects the constant terms of the quadratic value and $Q$-functions (not given here) whilst the solution of interest is only affected by the linear and quadratic terms. It follows that the solution is equivalent for stochastic as well as for deterministic systems. \begin{figure*}[t] \begin{equation} \label{eq:decomp2} \begin{aligned} \log p(\underline{Z}_T;\underline{\pi}_T)&=\int q(\underline{\Xi}_T) \log \frac{p(\underline{Z}_T|\underline{\Xi}_T)p(\underline{\Xi}_T;\underline{\pi}_T)}{q(\underline{\Xi}_T)}\text{d}\underline{\Xi}_T + \int q(\underline{\Xi}_T) \log \frac{q(\underline{\Xi}_T)}{p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T)}\text{d}\underline{\Xi}_T \\ &= -\kullbacks{q(\underline{\Xi}_T)}{p(\underline{\Xi}_T,\underline{Z}_T;\underline{\pi}_T)} + \kullbacks{q(\underline{\Xi}_T)}{p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T)} \\ &= \mathcal{A}[\underline{\pi}_T;q] + \mathcal{B}[q;\underline{\pi}_T] \end{aligned} \end{equation} \hrulefill \end{figure*} \subsection{Regularized Risk Sensitive Optimal Control}\label{sec:regularized-risk-sensitive-optimal-control} In this section we retake from problem (\ref{eq:RSOC}). Before we submit it to a similar analysis as was conducted above, we seek out analogies with Bayesian estimation. For a prior on Bayesian estimation we may refer to \cite{sarkka2013bayesian} and \cite{barfoot2017state} and Appendix \ref{sec:bayesian-filtering--smoothing}. \subsubsection{Equivalent Bayesian estimation problem}\label{sec:equivalent-bayesian-estimation-problem} To establish a rigorous connection with the Bayesian estimation framework the probabilistic state-space model introduced in section \ref{sec:optimal-control} can be extended with a probabilistic measurement model or so called emission probability $p(z_t|x_t,u_t)$, see Figure \ref{fig:CHMM}. The measurements are considered independent of any history of the trajectory apart from the present state and action. This probabilistic state-space model is known as a controlled Hidden Markov Model (HMM). The distribution of a measurement sequence $\underline{Z}_t = \{z_0,\dots,z_T\}$ conditioned on a trajectory $\underline{\Xi}_T$ is defined as \begin{equation*} p(\underline{Z}_T|\underline{\Xi}_t) = \prod\nolimits_{t=0}^{T} p(z_t|\xi_t) \end{equation*} The joint distribution parametrised by a policy sequence $\underline{\pi}_T$ is then defined as \begin{equation*} \begin{multlined} p(\underline{\Xi}_t,\underline{Z}_T;\underline{\pi}_T) = \\ p(x_0)p(z_T|x_T)\prod\nolimits_{t=0}^{T-1} p(z_t|\xi_t)p(x_{t+1}|x_t,u_t)\pi_t(u_t|x_t) \end{multlined} \end{equation*} The probabilistic model sketched here is well studied and can be used to treat complex inference problems, see Appendix \ref{sec:bayesian-filtering--smoothing}. Two important examples are the Bayesian filtering problem where we seek the distribution $p(\xi_t|\underline{Z}_t;\underline{\pi}_t)$ and the Bayesian smoothing problem where we seek the marginal a posterior distribution $p(\xi_t|\underline{Z}_T;\underline{\pi}_T)$. Both of these problems are well studied in the literature (see \cite{sarkka2013bayesian} and \cite{barfoot2017state} again). From these general concepts one can derive practical algorithms such as the Kalman Filter and Rauch-Tung-Striebel (RTS) smoother that operate on linear Gaussian state-space models. The presence of a policy distribution is usually not considered however the governing equation are trivially extended to treat controlled HMMs. To establish a connection with control the following artificial emission model is proposed \cite{toussaint2009robot,levine2018reinforcement,watson2021control}. We introduce an auxiliary variable $z_t$ that we assume to have adopted a value $1$ with probability proportional to $ e^{-r_t(\xi_t)}$ \begin{equation*} \begin{aligned} &p(z_t=1|\xi_t) \propto e^{-r_t(\xi_t)} \\ &p(\underline{Z}_T= 1|\underline{\Xi}_T) \propto e^{-R(\underline{\Xi}_T)} \end{aligned} \end{equation*} Now let us reconsider the MLE problem \begin{equation*} \max_\pi \log p(\underline{Z}_T;\underline{\pi}_T) \end{equation*} Then using the substitutions proposed above one easily verifies that this problem is equivalent to the risk sensitive optimal control problem in (\ref{eq:RSOC}) \begin{equation*} \begin{aligned} p(\underline{Z}_T;\underline{\pi}_T) &= \int p(\underline{Z}_T|\underline{\Xi}_T) p(\underline{\Xi}_T;\underline{\pi}_T) \text{d}\underline{\Xi}_T \\ &= \int p(\underline{\Xi}_T;\underline{\pi}_T) e^{-R(\underline{\Xi}_T)} \text{d}\underline{\Xi}_T + C \end{aligned} \end{equation*} This observation is fundamental in that it establishes that there is no technical difference between the Bayesian interpretation and the underlying RSOC problem. So we may treat this problem further by addressing it as a Bayesian estimation problem rather than an optimal control problem. This proofs to be a crucial insight that will allow us to treat the risk sensitive case in exactly the same way as we have treated the regular optimal control problem. We continue our analysis by decomposing the problem into two subproblems (\ref{eq:decomp2}). As opposed to the strategy followed before here we must introduce a generic inference distribution $q(\underline{\Xi}_T) $ similar to that in section \ref{sec:expectation-maximization-algorithm}. Application of the EM algorithm then boils down to the following steps. \begin{STDdescription} \item[E-step] Minimize $\mathcal{B}$ for $q$ keeping $\underline{\pi}_T$ fixed. \item[M-step] Maximize $\mathcal{A}$ for $\underline{\pi}_T$ keeping $q$ fixed. \end{STDdescription} In this case the solution of the E-step is trivial. Specifically the error is rendered minimal for $q(\underline{\Xi}_T) \equiv p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T)$. Since we will iterate this solution it is better to replace $q(\underline{\Xi}_T)$ with the more familiar expression $p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T')$ where $\underline{\pi}_T'$ is substituted for the now old or previous control belief sequence. On a side-note remark that this amounts to the I-projection of $p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T)$ onto the trajectory distribution space. The question here thus reduces to solving the M-step. The substitution proposed earlier now makes it less confusing that in the M-step we are trying to find an updated version of $\pi$ than the version that is contained in the expression for the inference distribution $q(\underline{\Xi}_T)$. Finally one observes that the emission probability $p(\underline{Z}_T|\underline{\Xi}_T)$ can be removed from the objective $\mathcal{A}$ without altering its solution. Therefore solution of the M-step reduces to the M-projection of $p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T')$ onto the space of controlled trajectory distributions $p(\underline{\Xi}_T;\underline{\pi}_T)$ \begin{equation} \label{eq:RSOC_iter} \min_{\underline{\pi}_T\in\mathcal{P}}\kullbacks{p(\underline{\Xi}_T|\underline{Z}_T;\underline{q}_T)}{p(\underline{\Xi}_T;\underline{\pi}_T)} \end{equation} As far as we are aware of this problem has not been treated by \cite{toussaint2009robot}, \cite{levine2018reinforcement} or \cite{watson2021control} nor did the authors draw a similar connection between the proposed probabilistic inference model, the underlying RSOC problem and the EM algorithm. \subsubsection{Explicit solution of the M-step}\label{sec:explicit-solution-of-the-m-step} First we show how to further reduce problem (\ref{eq:RSOC_iter}) \begin{equation*} \begin{multlined} \min_\pi\kullbacks{p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T')}{p(\underline{\Xi}_T;\underline{\pi}_T)} \\ \begin{aligned} &= \arg\min_\pi \int p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T') \log \frac{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T')}\text{d}\underline{\Xi}_T \\ &= \arg\min_\pi \int p(\underline{\Xi}_T|\underline{Z}_T;\underline{\pi}_T') \sum\nolimits_t \log \pi_t(u_t|x_t) \text{d}\underline{\Xi}_T \\ &= \arg\min_\pi \sum\nolimits_t \int p(\xi_t|\underline{Z}_T;\underline{\pi}_T') \log \pi_t(u_t|x_t) \text{d}\xi_t \end{aligned} \end{multlined} \end{equation*} This decomposition illustrates that as opposed to problem (\ref{eq:ROC_iter}), the optimization problem is not subject to an optimal substructure and can be treated independently for each separate policy distribution. Further taking into account the normalization condition it follows that \begin{equation*} \pi^\star_t(u_t|x_t) = \frac{p(\xi_t|\underline{Z}_T;\underline{\pi}_T')}{p(x_t|\underline{Z}_T;\underline{\pi}_T')} = p(u_t|x_t,\underline{Z}_T;\underline{\pi}_T') \end{equation*} So remarkably the solution of $(\ref{eq:RSOC_iter})$ is equivalent to the probability of $u_t$ parametrised by the prior policy sequence $\underline{\pi}_T'$ and conditioned onto the measurements $\underline{Z}_T$. Then before we venture into further technicalities we can submit distribution $\pi^\star_t$ to a preliminary assessment. Since we conditioned on the state ${x}_t$, it follows that this distribution must be equivalent to $p({u}_t|{x}_t,\overline{Z}_t;\overline{\pi}_t')$ rather than $p({u}_t|{x}_t,\underline{Z}_T;\underline{\pi}_T')$. This is a direct result of the Markov property since no more information about the input at time instant $t$ can be contained in the older measurements $\underline{Z}_{t-1}$ than is already contained by the state ${x}_t$ itself. Again we refer to Appendix \ref{sec:bayesian-filtering--smoothing}. Put differently this means that once we have arrived at some state ${x}_t$, we can only hope to reproduce the measurements $\overline{Z}_t$ but can no longer affect any of the preceding measurements $\underline{Z}_{t-1}$. So again some form of optimal substructure is present although here it is not a property of the optimization problem but rather a property of the distribution $p({u}_t|{x}_t,\underline{Z}_T;\underline{\pi}_T')$. As will be shown shortly the distribution $\pi^\star_t$ therefore leads to very similar structures as the ones encountered whilst treating (\ref{eq:ROC}). Using Bayes' rule $\pi^\star_t$ can be decomposed as \begin{equation*} p({u}_t|{x}_t,\overline{Z}_t;\overline{\pi}'_t) = \pi'_t(u_t|x_t) \frac{p(\overline{Z}_t|\xi_t;\overline{\pi}'_{t+1})}{p(\overline{Z}_t|x_t;\overline{\pi}'_t)} \end{equation*} which reduces the problem to finding efficient expressions for the probabilities $p(\overline{Z}_t|x_t;\overline{\pi}'_t)$ and $p(\overline{Z}_t|\xi_t;\overline{\pi}'_{t+1})$. The latter is a generalisation of the backward filtering distribution, a lesser known concept in Bayesian estimation, to the controlled probabilistic state-space model assumed here. The former can be easily derived from there. \begin{equation*} \begin{aligned} p(\overline{Z}_t|x_t;\overline{\pi}'_t) &= \int \pi'_t(u_t|x_t) p(\overline{Z}_t|\xi_t;\overline{\pi}'_{t+1})\text{d}u_t \\ &= \expect{\pi'_t(u_t|x_t)}\left[p(\overline{Z}_t|\xi_t;\overline{\pi}'_{t+1})\right] \end{aligned} \end{equation*} As semantically implied the backward filtering distribution adheres to a backward recursive expression. \begin{multline*} p(\overline{Z}_t|\xi_t;\overline{\pi}'_{t+1}) \\ \begin{aligned} &= p(z_t|\xi_t) \int p(x_{t+1}|\xi_t) p(\overline{Z}_{t+1}|x_{t+1};\overline{q}_{t+1})\text{d}x_{t+1} \\ &= p(z_t|\xi_t) \expect{p(x_{t+1}|\xi_t)}\left[p(\overline{Z}_{t+1}|x_{t+1};\overline{\pi}'_{t+1})\right] \end{aligned} \end{multline*} For fixed $\underline{\pi}'_T$ and $\underline{Z}_T$ we can recycle the definition of $\pi^\star_t(\vectorstyle{x}_t)$ and define the functions \begin{equation*} \begin{aligned} Q_t^\star(\xi_t) &= -\log p(\overline{Z}_{t}|\xi_t;\overline{\pi}'_{t+1}) \\ V^\star_t(\vectorstyle{x}_{t}) &= -\log p(\overline{Z}_{t}|\vectorstyle{x}_{t};\overline{\pi}'_{t}) \end{aligned} \end{equation*} By definition then it follows that \begin{equation*} \begin{aligned} Q^\star_{t}(\xi_t) &= r_t(\vectorstyle{\xi}_t)-\log \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V^\star_{t+1}(\vectorstyle{x}'))\right] \\ V^\star_{t}(\vectorstyle{x}_t) &= -\log \expect{p(\vectorstyle{u}_t|\vectorstyle{x}_t)}\left[\exp(-{Q}^\star_t(\xi_t))\right] \label{eq:Vstar} \end{aligned} \end{equation*} whereas \begin{equation*} \label{eq:Pstar} \pi_t^\star(\vectorstyle{u}_t|\vectorstyle{x}_t) = \pi'_t(\vectorstyle{u}_t|\vectorstyle{x}_t) \frac{\exp(-{Q}^\star_t(\xi_t))}{\exp(-{V}^\star_t(\vectorstyle{x}_t))} \end{equation*} On first notice the solutions of the problems (\ref{eq:ROC_iter}) and (\ref{eq:RSOC_iter}) are equivalent. Again we have found a backward recursive procedure to derive a sequence of policy distributions $\underline{\pi}_T^\star$ which is apparently equivalent to that of $\underline{\pi}_T^\bullet$. The subtle difference lies in the definition of the $Q$-functions. We will discuss the difference in more detail later on. At the moment it suffices to remark that the difference can be motivated by the difference in the underlying optimal control problems. Based on similarities with the treatment of stochastic optimal control problems we may refer to this inference procedure as another instance of Entropic Optimal Control tailored to the risk sensitive counterpart. \subsubsection{A note on conditioning}\label{sec:a-note-on-conditioning} As a tangent to our investigation we may briefly elaborate on the exposed connection between Bayesian estimation and risk sensitive optimal control that follows from the technical discussion above. In essence now there exists no difference between computing the \textit{simulated} marginal distribution $p(\xi_t;\underline{\pi}_T^\star)$ and the \textit{conditional or smoothed} marginal distribution $p(\xi_t|\underline{Z}_T;\underline{\pi}'_T)$\footnote{This is not entirely true since this would require to determine the simulated distribution using the informed transition probability $p(x_{t}|\xi_{t-1},\overline{Z}_t)$. However the effect on the policy is irrelevant given that afterwards we condition on the state. This nuance is rendered irrelevant altogether when we consider deterministic systems in which case $p(x_{t}|\xi_{t-1},\overline{Z}_t)\equiv p(x_{t}|\xi_{t-1})\equiv\delta(x_t-f(\xi_{t-1}))$.}. Anticipating the substitution $\underline{\pi}'_T\leftarrow \underline{\pi}_T^{(g)}$ and $\underline{\pi}_T^\star \leftarrow \underline{\pi}_T^{(g+1)}$ (see sec. \ref{sec:iterating-in-belief-space}) used to install an inference procedure, $\underline{\pi}_T^{(g+1)} \leftarrow \underline{\pi}_T^{(g)}$; this observation implies that in fact each time we execute said inference, this is equivalent to conditioning on \textit{a new set} of observations $\overline{Z}_T^{(g)}$. We may refer to these observations as the \textit{posterior observations} and any older observations as the collection of \textit{prior observations} $\overline{Z}_T^{(0:g-1)}$. Conditioning on prior observations then simply means that we parametrise the simulated marginal distribution on the prior policy sequence $\underline{\pi}_T^{(g-1)}$. Second this also means that it is possible to calculate the filtered distribution $p(\xi_t|\underline{Z}_t;\underline{\pi}_T^{(g-1)})$. That is we can condition on the running posterior measurements $\underline{Z}_T^{(g)}$ whilst parametrising on $\underline{\pi}'_T$. In general this distribution is only an intermediate result that can be used to calculate $p(\xi_t|\underline{Z}_T;\underline{\pi}_T^{(g)})$ from which we can calculate $p(u_t|x_t,\overline{Z}_t;\overline{\pi}_t^{(g)})$ or thus $\pi_t^{(g)}(u_t|x_t)$\footnote{On a side note we remark that the use of both the filtering and smoothing distributions is what is usually referred to as so-called forward and backward message passing as described by \cite{toussaint2009robot} and \cite{watson2021stochastic,watson2021control}. Provided our discussion in section \ref{sec:explicit-solution-of-the-m-step}, in general, this is strictly unnecessary and only a backward message is required to calculate $\pi_t^{(g)}(u_t|x_t)$. This backward message is equivalent to the value function $V_t^{(g)}$ which is indeed computed through a backward recursion.}. These observations have limited value from a generic point of view apart from that they deepen the understanding of the equivalence. Though they proof to have interesting consequences for practical methods (see sec. \ref{sec:applications}). \subsubsection{Entropic LQER}\label{sec:entropic-linear-quadratic-exponential-regulator} The backward recursive expressions retrieved above can be solved explicitly for discrete state-spaces. Here we consider the entropic counterpart of the risk sensitive reciprocal problem of the regular LQR from section \ref{sec:regularized-linear-quadratic-regulator}, better known as the Linear-Quadratic-Exponential-Regulator (LQER). Because the expressions for $\pi_t^\star$ and $V_t^\star$ are equivalent to those of $\pi_t^\bullet$ and $V_t^\bullet$ we can recycle expressions. The backward recursion for $Q^\star_t$ satisfied \begin{equation*} \begin{aligned} Q^\star_{\xi,t} &= R_{\xi,t} + \matrixstyle{F}_{\xi,t}^\top(V_{xx,t+1}^{\star,-1}+\matrixstyle{P}_t)^{-1}\left(V_{xx,t+1}^{\star,-1} V_{x,t}^\star+\vectorstyle{f}_t\right) \\ Q_{\xi\xi,t}^\star &= R_{\xi\xi,t} + \matrixstyle{F}_{\xi,t}^\top(V_{xx,t+1}^{\star,-1}+\matrixstyle{P}_t)^{-1}\matrixstyle{F}_{\xi,t} \end{aligned} \end{equation*} Note that as opposed to the solution detailed in \ref{sec:regularized-linear-quadratic-regulator}, here the updates do depend on the problem stochasticity through presence of $\matrixstyle{P}_t$. On first notice this agrees with the underlying theory of risk sensitive optimal control developed by Jacobson specifically because the regular LQR does not posses this property. Despite appearing misleadingly benign this property also exposes another far more critical difference with the result from \ref{sec:regularized-linear-quadratic-regulator}. It imposes a proportionality between the value function $V_t^\star$ and the stochasticity of the system. It follows that by scaling the cost function $r_t$ here in fact we alter the proportionality between $V_t^\star$ and $\matrixstyle{P}_t$ and as such also influence the underlying risk sensitive OCP. This was not the case with the Entropic LQR problem. Following our discussion in section \ref{sec:alternative-motivation} here scaling of the cost function $r_t$ is equivalent to scaling of the corresponding Lagrangian multiplier. So once more anticipating the iterative aspect hinted at above, we would directly influence the convergence behaviour of the iteration not the properties of the underlying OCP. Therefore, as opposed to the convergence behaviour of the entropic LQR, unfortunately the convergence behaviour of the entropic LQER can not be influenced. \subsection{Discussion} In the previous two subsections we developed a general treatment of the standard stochastic and risk sensitive optimal control problems based on the principle idea underlying the EM algorithm. We limited the derivation to a single iteration of the algorithm. In this final subsection we discuss how repeated application of these procedures can be used to find the true solution of the underlying optimal control problems. We further discuss the relation between either solution and establish explicit connections with related fields such as Path Integral Control and optimal estimation. \subsubsection{Iterating in policy belief space}\label{sec:iterating-in-belief-space} We summarized the iterative backward recursive update procedures in Table \ref{tab:overview}. Comparing them with the recursive expressions that govern the standard stochastic and risk sensitive optimal control problems (see appendix \ref{sec:lqr-and-lqer}), they look amusingly similar. The expectation operator, $\expect{\pi_t^{(g)}}[\cdot]$, over controls given the prior probability distribution, needs simply to be substituted for the minimization operator, $\min_{u_t} [\cdot]$, in the equations that govern the regular problems, to recover the equations that govern their entropy regularized counterparts. In this case they describe a mapping in policy belief space. By iterating this mapping we hope to converge to an equilibrium point coinciding with the deterministic solution. \begin{equation} \underline{\pi}_T^{(g+1)} \leftarrow \underline{\pi}_T^{(g)} \end{equation} We can further develop this interpretation by arguing that none of the control probabilities are stochastic in nature or capture aleatoric uncertainty. Instead we argue that each control distribution must be interpreted as a belief function expressing our uncertainty about the underlying deterministic solution, hence expressing epistemic uncertainty. The entropic treatment of control can therefore be viewed as a form of probabilistic regularization. By embedding the optimal control paradigm in the EM framework we induce an inference procedure that allows us to derive the exact and deterministic solution of either standard stochastic and risk sensitive optimal control problems by iterating a belief function that expresses our uncertainty about the true solution. This point of view corresponds with the line of thought developed in section \ref{sec:alternative-motivation}, where we provided an alternative derivation of the results tailored to the standard stochastic optimal control problem. We argue here that a similar interpretation can be given to the results tailored to its risk sensitive case. So far however we have voiced little concern whether these iterative methods will truly converge. That is, will the \textit{limit distribution} $\lim_{g\rightarrow \infty}\underline{\pi}_T^{(g)}$ coincide with the true solution? The answer is suggested by the theoretical properties of the EM algorithm. As has been argued repeatedly \cite{bishop2006pattern,murphy2012machine}, in theory the EM algorithm converges to a saddle point of the likelihood function and so to the solution off the original inference problem if the problem is \textit{sufficiently well-behaved}\footnote{In practice this usually boils down to a local minimum which is satisfactory for many applications}. Hence this property translates to the iterative schemes studied here. That is provided that the the initial policy distribution sequence $\underline{\pi}_T^{(0)}$ covers the support of the true solution, which we might denote with $\underline{\pi}_T^\infty$. Whether any practical algorithm will also converge to the true solution depends entirely on the characteristics of said algorithm and the additional approximations that are made. Furthermore, recalling the discussion in section \ref{sec:entropic-linear-quadratic-exponential-regulator}, the converge behaviour of the entropic regular OCP can be affected by changing the value of the Lagrangian multiplier without affecting the underlying OCP problem, that whilst we cannot influence the convergence behaviour of the entropic risk sensitive OCP. The situation is similar to their standard counterparts without entropic regularization where we could scale the cost function in the standard stochastic setting but not in the risk sensitive setting. \subsubsection{Preventing distributional collapse}\label{sec:preventing-distributional-collapse} Although the theoretical convergence of these inference procedures can be guaranteed on account of the characteristics of the EM algorithm, in practice it could occur that the procedure converges prematurely. With this we mean that the iterated policy beliefs collapse onto a Dirac-delta distribution that does not coincide with the underlying deterministic solution. In order to remedy this characteristic we can try to adapt the inference procedure so that the limit distribution does not become deterministic and retains a level of uncertainty. \begin{figure*} \begin{center} \begin{tabular}{ l|cc } & SOCP & RSQOCP \\ \hline $\pi_t^{(g+1)}$ & $\pi_t^{(g)}(u_t|x_t) \dfrac{\exp(-Q^{(g+1)}_t(\xi_t))}{\exp(-V^{(g+1)}_t(x_t))}$ & $\cdot$ \\ $V_t^{(g+1)}$ & $- \log \expect{\pi_t^{(g)}(u_t|x_t)}\left[\exp(-Q^{(g+1)}(\xi_t))\right]$ & $\cdot$ \\ $Q_t^{(g+1)}$ & $r_t(\vectorstyle{\xi}_t) + \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V^{(g+1)}_{t+1}(\vectorstyle{x}'))\right]$& $r_t(\vectorstyle{\xi}_t)-\log \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V^{(g+1)}_{t+1}(\vectorstyle{x}'))\right]$ \end{tabular} \end{center} \caption{Overview of governing inference mechanism for regular and risk sensitive OCPs.} \label{tab:overview} \end{figure*} We treat the stochastic optimal control problem first. Then assuming that we initialize the policy belief sequence with the uniform distribution, modelling the situation where we are completely uncertain about the true solution, the idea is to slightly reset the solution every iteration, solving a superposition of the iterate and initial problem. The degree with which the solution is reset is governed by the parameter $0 < \alpha \leq 1$. \begin{equation} \begin{multlined} \min_\pi \alpha\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\pi}'_T)e^{-R(\underline{\Xi}_T)}} \\ + (1-\alpha)\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\mathcal{U}}_T)} \end{multlined} \end{equation} Note that $1-\alpha$ can also be interpreted as a Lagrangian multiplier associated to the inequality constraint $\kullbacks{p(\underline{\Xi}_T;\underline{\pi}_T)}{p(\underline{\Xi}_T;\underline{\mathcal{U}}_T)} > \Delta$ imposed on optimization problem (\ref{eq:RSOC_iter_2}). This idea is closely related to the works of \cite{abdolmaleki2015model,abdolmaleki2017deriving}. However by settling for the Lagrangian multipliers instead of meeting hard constraints, the influence of this procedure manifests more clearly in the associated policy update. To see this one can verify that similar to the previous derivation the solution is now governed by the following two equations. The definition of the $Q$-function remains the same. One observes that this amounts to a \textit{diffused} version of the standard entropy regularized solution where the previous belief is diffused with a factor $0 < \alpha \leq 1$ effectively keeping it from collapsing onto the Dirac-delta distribution. \begin{equation*} \begin{aligned} \pi_t^\bullet(u_t|x_t) &\propto \pi'_t(u_t|x_t)^\alpha \exp(-Q_t^\bullet(\xi_t)) \\ V_t^\bullet &= -\log \int \pi'_t(u_t|x_t)^\alpha \exp(-Q_t^\bullet(\xi_t)) \text{d}u_t \end{aligned} \end{equation*} Reconsidering the definition of the $Q$-function one easily confirms that the same effect can be achieved by substituting the cost rate $r_t^\bullet$ whilst retaining the updates for $\pi_t^\bullet$ and $V_t^\bullet$. \begin{equation} \label{eq:r_anti_collapse} r_t^\bullet(\xi_t) = r_t(\xi_t) + (1-\alpha) \log \pi'_t(u_t|x_t) \end{equation} For example, for the entropy regularize LQR problem from section \ref{sec:regularized-linear-quadratic-regulator}, this yields \begin{equation*} \begin{aligned} R_{\xi,t}^\bullet &= R_{\xi,t} + (1-\alpha)\begin{bmatrix} \matrixstyle{K}_t^\top \Sigma_t^{-1} k_t \\ \Sigma_t^{-1} k_t \end{bmatrix}\\ R_{\xi\xi,t}^\bullet &= R_{\xi\xi,t} - (1-\alpha)\begin{bmatrix} \matrixstyle{K}_t^\top \Sigma_t^{-1} \matrixstyle{K}_t & -\matrixstyle{K}_t^\top \Sigma_t^{-1} \\ -\Sigma_t^{-1} \matrixstyle{K}_t & \Sigma_t^{-1} \end{bmatrix} \end{aligned} \end{equation*} A similar treatment of the entropy regularized risk sensitive OCP can not be achieved from first principles because of the mechanics of the problem. Recall that here the development builds on the Bayesian estimation paradigm. However a similar result is trivially achieved by substituting $\underline{q}_T^\alpha$ for $\underline{\pi}'_T$ into (\ref{eq:RSOC_iter}) or by substituting the cost model introduced above. So although we then lack a motivation founded on first principles we can in fact adopt the same diffused updates for the entropy regularised counterpart of the risk sensitive optimal control. \subsubsection{Deterministic dynamics} Since the original regular and risk sensitive optimal control problems are equivalent for deterministic dynamics, we would like to see this property translated to the probabilistic inference methods developed here. Given results in section \ref{sec:regularized-linear-quadratic-regulator} and \ref{sec:entropic-linear-quadratic-exponential-regulator}, this property holds for the LQR problem formulation. As we have already commented on earlier the inference mechanism are equivalent except for the definition of the associated $Q$-functions. So we have but to verify that either $Q_t^\bullet$ and $Q_t^\star$ are equivalent when the dynamics become deterministic. One easily verifies this is indeed the case by considering that for deterministic dynamics the following identity holds \begin{equation*} Q_t^\bullet(\xi_t) = Q_t^\star(\xi_t) = Q_t(\xi_t) = r_t(\xi_t) + V_{t+1}(f_t(\xi_t)) \end{equation*} As anticipated the problems amount to the same solution. This observation also implies that the discussion in section \ref{sec:a-note-on-conditioning} extends to the standard deterministic optimal control framework. \subsubsection{Path Integral Control}\label{sec:path-integral-control} Another interesting observation can be made regarding the expression for the value function $V^\star_t$. When we reconsider the reciprocal Bayesian estimation we may observe the following \begin{equation*} \begin{aligned} p(\overline{Z}_{t}|\vectorstyle{x}_t) &= \expect{\pi'_t(\vectorstyle{u}_t|\vectorstyle{x}_t)}\left[p(\vectorstyle{z}_t|\xi_t) \expect{p(\vectorstyle{x}'|\xi_t)}\left[p(\overline{Z}_{t+1}|\vectorstyle{x}';\overline{\pi}'_{t+1})\right]\right]\\ &= \expect{p(\overline{U}_{t}|\overline{X}_t;\overline{\pi}'_t)}\left[\expect{p(\overline{X}_{t+1}|\vectorstyle{x}_t,\overline{U}_t)}\left[p(\overline{Z}_{t}|\overline{\Xi}_{t})\right] \right] \\ &= \expect{p(\overline{\Xi}_{t}|\vectorstyle{x}_t;\overline{\pi}'_t)}\left[p(\overline{Z}_{t}|\overline{\Xi}_{t})\right] \end{aligned} \label{eq:path} \end{equation*} Then reintroducing its control analogue we find that \begin{equation} V_t^\star(x_t) = - \log \expect{p(\overline{\Xi}_{t}|\vectorstyle{x}_t;\overline{\pi}'_t)}\left[e^{-R(\overline{\Xi}_{t})}\right] \end{equation} and therefore \begin{equation} \pi_t^*(u_t|x_t) \propto \pi'_t(u_t|x_t) \expect{p(\overline{\Xi}_{t+1}|\xi_t;\overline{\pi}'_t)}\left[e^{-R(\overline{\Xi}_{t})}\right] \end{equation} This observation is extremely valuable. It illustrates that the value function can be computed as a Path Integral over the prior trajectory distribution. That is we could estimate $V_t^\star$ by sampling from $p(\overline{\Xi}_{t}|\vectorstyle{x}_t;\overline{\pi}'_t)$. This property holds only for the risk sensitive case. But since the stochastic and risk sensitive OCP are equivalent for deterministic dynamics, the property above also holds for the deterministic regular case. The existence of a path integral solution in the context of deterministic entropic optimal control was also described by \cite{lefebvre2021deoc}. Now to elaborate on the claimed value of this odd property. There is another optimal control framework that amounts to such conditions, better known as Linearly Solvable Optimal Control or Kullback-Leibler control. As detailed in the introduction the origins of this framework root back to continuous time optimal control however this is out of scope here. We will discuss the framework briefly in discrete time \cite{todorov2007linearly,todorov2009efficient,dvijotham2012linearly}. In discrete time the LSOC framework is achieved by \textit{lifting} the regular OCP entirely to the state space \cite{lefebvre2019path}. As such we are no longer interested in state-action trajectories $\underline{\Xi}_T$ but in state trajectories $\underline{X}_T$. To link this to control we assume that we can directly control the transition probability $p(x'|x)$. This condition could for example be achieved by considering \begin{equation*} p(x'|x;\pi) = \int p(x'|x,u) \pi(u|x) \text{d}x \end{equation*} and assuming that whatever $p(x'|x)$ turns out to be we can find some $\pi$ that achieves it. The LSOC problem in discrete time can then be stated as \begin{equation*} \min_\pi \expect{p(\underline{X}_T;\underline{\pi}_T)} \left[R(\underline{X}_T) + \log \frac{p(\underline{X}_T;\underline{\pi}_T)}{{p(\underline{X}_T;\underline{\pi}'_T)}}\right] \end{equation*} where usually $\pi'_t(u_t|x_t) \equiv 0$. Provided with the theory developed in this section it is easily verified that \begin{equation*} p(x_{t+1}|x_t;\pi_t) \propto p(x_{t+1}|x_t;\pi'_t) e^{-V_{t+1}(x_{t+1})} \\ \end{equation*} and \begin{equation*} \begin{aligned} V_{t}(x_{t}) &= r_t(x_t) - \log \expect{p(x_{t+1}|x_t;\pi'_t)}\left[\exp(-V_{t+1}(x_{t+1}))\right]\\ &=-\log \expect{p(\underline{X}_{t+1}|x_{t};\underline{\pi}'_t)}\left[e^{-R(\underline{X}_t)}\right] \end{aligned} \end{equation*} Clearly this result is generalised by the entropic risk sensitive optimal control problem, providing a theoretical basis to the wide variety of algorithms based on Path Integral Control amongst which most notably the collection of Model Based Path Integral control methods described in section \ref{sec:historical-run-up}. Furthermore this also formulates an answer posed by \cite{watson2021control} who investigated the relation between Linearly Solvable Optimal Control and \textit{message passing} in control as inference. We refer to the footnote in section \ref{sec:a-note-on-conditioning} for further reading on message passing. \section{Towards Algorithms}\label{sec:applications} Building on the theoretical results featured in the previous section, here we discuss a number of possibilities how to exploit these ideas in order to derive new or improved practical algorithms. As noted in the introductory section, algorithmic development within the context of Control as Inference has remained an activity endeavoured mostly by the computer science and specifically the RL community, and less so by the control and robotics community. The efforts of the RL community usually focusses on global solution methods\footnote{This means solving the stochastic optimal control problem for a global policy that can be used for any given initial state. We refer to section \ref{sec:reinforcement-learning} for further exposition.} and has produced a variety of RL algorithms -- that derive from similar ideas -- tailored to global policy optimization. As was briefly covered in the introduction, the control and robotics community exhibit particular interest in trajectory optimization methods (or thus local methods). That is why we emphasize here how the theoretical foundations reviewed in the previous sections may inspire development of improved algorithms tailored to trajectory optimization. This in an effort to contribute to the credibility of the CaI paradigm. In that setting this means controlled trajectory distribution optimization conditioned on some deterministic initial state $x_0$ or some narrow initial state distribution $p(x_0)$. In two remaining paragraphs we sketch additional insights and ideas tailored to RL and representation and imitation learning. \subsection{Trajectory Optimization}\label{sec:trajectory-optimization} We treat here trajectory optimization in settings where the iLQR algorithm would apply. Readers unfamiliar with that setting we refer to some of the standard works \cite{mayne1966ddp,todorov2005ilqr,tassa2012synthesis,tassa2014control,mastalli2020crocoddyl}. We further limit our exposition to deterministic system dynamics, in part because then the stochastic and risk sensitive regularizations are equivalent. Second this allows us to narrow down the scope to sketching the main ideas, omitting all too technical details that would apply to stochastic system dynamics. Finally in all of the algorithms described here we can use the auxiliary control cost $r_t^\bullet$ defined in (\ref{eq:r_anti_collapse}) to prevent the issue of premature distribution collapse as was detailed in section \ref{sec:preventing-distributional-collapse}. This aspect will not be emphasized throughout and can be considered as a silent feature of all documented approaches. \begin{algorithm} \caption{Basic iLQR} \begin{algorithmic}[1] \While{not converged} \State apply $\tilde{\underline{\pi}}_T^i$ to system to find $\underline{\Xi}_T^{i+1}$ \Comment{\textit{forward pass}} \State solve a local problem approximation about $\underline{\Xi}_T^{i+1}$ to find $\tilde{\underline{\pi}}_T^{i+1}$ \Comment{\textit{backward pass}} \EndWhile \end{algorithmic} \label{alg:LQR} \end{algorithm} As discussed in \ref{sec:some-remarks}, the main idea of the iLQR algorithm is to iterate a local approximation of the true optimal policy sequence, $\tilde{\underline{\pi}}_T^i$, in proximity of some reference trajectory, $\underline{\Xi}_T^i$. An essential characteristic of the algorithm is that it alternates a \textit{forward} and a \textit{backward} pass. First the iterate policy is applied closed-loop to the system in order to spawn the new reference trajectory, $\underline{\Xi}_T^{i+1}$. In other words the present policy is evaluated. Second the new policy approximation, $\tilde{\underline{\pi}}_T^{i+1}$, is determined according to some local approximation of the true optimal control problem about the new reference trajectory. In other words now the policy is updated or optimized. And so on until some convergence conditions are met. The idea that we alternate between an evaluation and an optimization step is an important characteristic of the iLQR algorithm. It is also implied that information about the \textit{cost} landscape is only \textit{encoded} in the solution during the backward pass and not during the forward pass. This is an another important characteristic of the iLQR algorithm. The main idea is then summarized in Algorithm \ref{alg:LQR}. As the name suggests a linear-quadratic approximation is used about the reference trajectory $\underline{\Xi}_T^{i+1}$ so that the local policy approximation, $\tilde{\pi}_t^i = k_t^i + \matrixstyle{K}_t^i x_t$, can be determined using the LQR solution. Typically this algorithm requires many numerical heuristics to regularize the computations. In that same spirit we limit ourselves to methods to finding local approximations of the global policy belief sequence $\underline{\pi}_T^{(g)}$, in particular local Gaussian policies. Next we set out directions for two major algorithmic families, respectively (ensemble) gradient based and sample based approaches. \begin{equation} \tilde{\pi}_t^{(g)}(u_t|x_t) = \mathcal{N}(u_t;k_t^{(g)} + \matrixstyle{K}_t^{(g)} x_t,\Sigma_t^{(g)}) \label{eq:LG-policy} \end{equation} \subsubsection{Gradient based trajectory optimization} This section focusses on methods that are gradient based or gradient related. We make a further distinction between two secondary algorithmic branches. One branch is directly inspired by the iLQR algorithm. The second branch explicitly exploits the connection between entropy regularized risk sensitive optimal control problem and Bayesian estimation. \paragraph{ Entropy regularized iLQR}\label{sec:-entropy-regularized-ilqr} The idea is fairly simple. We propose to extend the iLQR algorithm with a hyper iteration. In the hyper iterations we update the posterior policy $\underline{\pi}_T^{(g+1)}$ whilst in the main iterations we iterate the local approximation in the exact same way as the iLQR algorithm. Except here we use the LQER updates that \textit{condition} the policy update onto the prior policy belief sequence $\underline{\pi}_T^{(g)}$. The main idea is summarized in Algorithm \ref{alg:ELQR}. Here $j$ denotes the iteration counter for which the main procedure has converged or for which we choose to interrupt it. Some remarks are in place. Regardless whether the system itself is stochastic or deterministic, during the forward pass a \textit{path distribution} is spawned on account of the policy beliefs. This means that we can not propagate the system in the same way as is done in the fully deterministic setting of the iLQR algorithm. Instead we will need to use a forward uncertainty propagation procedure. A straightforward choice is to propagate the uncertainty by means of a Taylor approximation similar to the Extended Kalman Filter (EKF, see Appendix \ref{sec:bayesian-filtering--smoothing}) but without the \textit{update step}. Although here there is no \textit{update step}, the closed-loop policy belief will stabilize the system about the local reference trajectory induced by that policy. Second we can also use a more sophisticated uncertainty propagation procedures such as the unscented transform used by the Unscented Kalman Filter (UKF, see Appendix \ref{sec:bayesian-filtering--smoothing}) \cite{manchester2016derivative}. As a by product either method produces locally linearised system dynamics as are later required by the backward pass. For the extended Kalman filter, ergo a Taylor approximation, this boils down eventually to exact gradients; when the unscented transform is used we practice an ensemble gradient approach. The hypothesis is that the local optimization landscape will be probed superiorly when using the unscented transform rather than the Taylor approximation. The use of the unscented transform to compute locally linear dynamics has already been used in the context of DDP\footnote{The Differential Dynamic Programming or DDP algorithm is an extension of the iLQR algorithm. The algorithm is equivalent up to slightly more complex updates in the backward pass that take into account second order derivatives of the dynamics as opposed to the iLQR algorithm that only used the first order derivates \cite{theodorou2010stochastic,tassa2012synthesis,tassa2014control,mastalli2020crocoddyl}} \cite{mayne1966ddp}. Further comparison of the backward pass resulting from the implied iELQR (see section \ref{sec:regularized-linear-quadratic-regulator}) with that of the iLQR algorithm (see Appendix \ref{sec:lqr-and-lqer}) illustrates that the inference based approaches eventually boil down to regularized versions of the standard algorithms. It is emphasized that, 1) as opposed to iLQR, the iELQR algorithm is inherently iterative, and, 2) any regularization is entirely intrinsic to the problem formulation and does not rely on numerical heuristics. We argue that, because the induced numerical regularization now directly relates to a solution belief induced by the policy beliefs, it is more principled, interpretable and explainable. \begin{algorithm}[t] \caption{Entropy regularized iLQR} \begin{algorithmic}[1] \While{not converged} \Comment{\textit{hyper iterations}} \While{not converged} \Comment{\textit{main iterations}} \State apply $\tilde{\underline{\pi}}_T^i$ to system to find $\underline{\Xi}_T^{i+1}$ \Comment{\textit{forward pass}} \State solve the LQER about $\underline{\Xi}_T^{i+1}$ to find $\tilde{\underline{\pi}}_T^{i+1}$ {\textit{conditioned} on $\tilde{\underline{\pi}}_T^{(g)}$} \Comment{\textit{backward pass}} \EndWhile \State hyper update $\tilde{\underline{\pi}}_T^{(g+1)} \leftarrow \tilde{\underline{\pi}}_T^{j}$ \EndWhile \end{algorithmic} \label{alg:ELQR} \end{algorithm} \paragraph{ Hyper iterated RTS smoother} The second idea is a bit more sophisticated. Following a similar line of though as above, we can install a hyper iterative procedure and a secondary main iterative procedure. The hyper iteration has the same function as in the iELQR algorithm. Contrastingly in the main iterative procedure we now propose to exploit the equivalence between the entropy regularized risk sensitive optimal control problem and Bayesian estimation. In the technical exposition accompanying section \ref{sec:regularized-risk-sensitive-optimal-control}, we demonstrated that the optimal policy $\pi_t^{(g+1)}$ was given by the input conditioned on the state and artificial measurements $\underline{Z}_T$ and parametrised by the prior policy belief sequence $\underline{\pi}_T^{(g)}$. So equivalently we can calculate the smoothing distribution $p(\xi_t|\underline{Z}_T;\underline{\pi}'_T)$ using standard tools from Bayesian estimation. For nonlinear problems these algorithms will iterate a local approximation of the exact smoothing distribution $p(\xi_t|\underline{Z}_T;\underline{\pi}'_T)$ about some reference trajectory $\underline{\Xi}_T^i$. There exist several numerical strategies to execute this procedure amongst which the iEKS and iUKS. We refer to \cite{sarkka2013bayesian} and \cite{barfoot2017state} and Appendix \ref{sec:bayesian-filtering--smoothing} for details and refer to the collection of possible algorithms as iterated RTS smoothers. The main idea is summarized in Algorithm \ref{alg:I2C}. \begin{algorithm}[t] \caption{Hyper iterated RTS smoother} \begin{algorithmic}[1] \While{not converged} \Comment{\textit{hyper iterations}} \State run the iRTS smoother \textit{conditioned} on $\tilde{\underline{\pi}}_T^{(g)}$ \Comment{\textit{main iterations}} \State hyper update $\underline{\pi}_T^{(g+1)} \leftarrow \{p(u_t|x_t;\tilde{\underline{\pi}}_T^{j})\}$ \EndWhile \end{algorithmic} \label{alg:I2C} \end{algorithm} Again some remarks are in place. First we emphasize that if we would be able to calculate all probabilities exactly, there is no difference between this approach and the one described in the previous paragraph (this has also been noted in section \ref{sec:a-note-on-conditioning}). Nevertheless there will be differences once we use approximate inference methods such as the collection of iRTS smoothers proposed above. These iterated smoothers alternate between a \textit{filtering} and \textit{smoothing} pass which roughly correspond to the forward and backward passes described for the iELQR. However in the forward pass of the iELQR algorithm we only evaluate the current policy, we do not yet condition on the running posterior measurement sequence $\underline{Z}_t^{(g)}$ (again recall section \ref{sec:a-note-on-conditioning}). This trajectory \textit{innovation} concept (conditioning on the running posterior measurement sequence) is therefore unique to the present context and is equivalent to the Kalman update. The hypothesis is that now not only the policy and hence the control trajectory is optimized in the backward pass, but here also the state trajectory is attracted to more advantageous regions of the state space during the forward pass. The idea of using iRTS smoothers to perform inference in control was also described ambiguously by \cite{watson2021stochastic}. In conclusion we emphasize that in order to implement the Kalman update (see Appendix \ref{sec:bayesian-filtering--smoothing}), an actual probabilistic emission model is required. We need a model in the likes of \begin{equation*} z_t = h_t(x_t,u_t) + \zeta_t, ~\zeta_t = \mathcal{N}(0,\Sigma_{\zeta\zeta,t}) \end{equation*} Further note that by using an iterated RTS smoother we can only encode information about the cost rate function as well as the systems dynamics in the forward pass \textit{but not} in the backward smoothing pass. Ideally our measurement model should therefore also incorporate first and second order gradient information about the cost function. We propose \begin{equation*}\begin{aligned} p(z_t|x_t,u_t) &\propto \exp(- r_t(x_t,u_t)) \\ &\approx \exp\left(-\tfrac{1}{2} \begin{bmatrix} 1 \\ \Delta \tau \end{bmatrix}^\top\begin{bmatrix} \times & R_{\xi,t}^\top \\ \cdot & R_{\xi\xi,t} \end{bmatrix}\begin{bmatrix} 1 \\ \Delta \tau \end{bmatrix}\right)\\ &= \exp\left(-\tfrac{\lambda}{2}\|\Delta \tau - R_{\xi\xi,t}^{-1} R_{\xi,t} \|^2_{R_{\xi\xi,t}}\right) \end{aligned} \end{equation*} Setting $z_t=0$, $h_t(x_n,u_n) \approx \Delta \xi_t - R_{\xi\xi,t}^{-1} R_{\xi,t}$ and $ \Sigma_{\zeta\zeta,t}^{-1} = R_{\xi\xi,t}$ yields the required relations. Note this model is not unique since any other decomposition would also do the job. \subsubsection{Sample based trajectory optimization} In this paragraph we focus on algorithms that are closer related to RL algorithms but that are still tailored to trajectory optimization problems. Again we will describe a number of procedures to update the linear Gaussian policy in (\ref{eq:LG-policy}). Though as opposed to the gradient based strategies described in the previous paragraph, here we desire to probe the problem locally not by relying on gradient information but by relying on stochasticity. This involves reinterpreting and executing the policy belief functions stochastically. A sufficiently rich set of $M$ sample paths, $\mathcal{D}^{(g)}$, is spawned by sampling from the policy belief sequence $\underline{\pi}_T^{(g)}$. We initialize each sample path from a given fixed initial state $x_0$ or a sample from the narrow distribution $p(x_0)$. A major benefit of using trajectory samples over gradient related approaches is that we do not need a dynamic system model or at least not a model that is differentiable. Furthermore the computation of the different sample paths can be distributed. Then relying on the theory of section \ref{sec:solving-control-problems-with-the-em-algorithm}, we can derive a number of strategies to update the parametric policies. \begin{equation} \label{eq:alg:sampling} \begin{aligned} \mathcal{D}^{(g)} &= \{\underline{\Xi}_T^m \}_m \\ x_0^m &\sim p(x_0) \\ u_{t}^m &\sim \mathcal{N}(u_t|k_t^{(g)} + \matrixstyle{K}_t^{(g)} x_{t}^m,\Sigma_t^{(g)})\\ x_{t+1}^m &= f_t(x_{t}^m,u_{t}^m) \end{aligned} \end{equation} To put it differently, we execute the forward uncertainty propagation associated to the forward pass of the iELQR algorithm using a Monte Carlo approach and will then exploit the theory from section \ref{sec:solving-control-problems-with-the-em-algorithm} to derive associated update procedures to perform an appropriate backward pass based on those samples. Therefore the idea is closely related to particle filtering methods where a set of particles is used to represent the state belief\footnote{So in this section we focus on sample based implementations of the iELQR algorithm, Algorithm \ref{alg:ELQR}. Extending the idea from Algorithm \ref{alg:I2C} is trivial based on the connection with Bayesian estimation and the use of iterated RTS smoothers. The main iteration can then simply be replaced by any particle based iterated RTS smoother.}. Likewise here we use a set of trajectories to represent the path belief. Superscripting a function with $m$ implies evaluation of the $m$\textsuperscript{th} path, e.g. $f_t(x_{t}^m,u_{t}^m) = f_t^m$. For ease of exposition we limit our discussion to the hyper iterations, which would boil down to interrupting the main iterations after one update. \begin{algorithm}[t] \caption{Sample based iELQR} \begin{algorithmic}[1] \While{not converged} \Comment{\textit{(hyper) iterations}} \State determine sample set $\mathcal{D}^{(g)}$ according to (\ref{eq:alg:sampling}) \Comment{\textit{forward pass}} \State (hyper) update $\tilde{\underline{\pi}}_T^{(g+1)} $ according to (\ref{eq:derivationA}) or (\ref{eq:alg4:1}), (\ref{eq:alg4:2}) and (\ref{eq:V-ELQR}). \Comment{\textit{backward pass}} \EndWhile \end{algorithmic} \label{alg:sELQR} \end{algorithm} \paragraph{Path Integral Control} The first idea is directly inspired by recent work on PIC control methods \cite{lefebvre2021deoc}. Where historically this line of algorithms derived from the LSOC framework, the discovery of path integral expressions for the optimal policy in the setting of entropy regularized risk sensitive optimal control (see section \ref{sec:path-integral-control}) allows to generalise these methods overcoming restrictions that root back to the LSOC framework. Technically the strategy boils down to a likelihood estimation procedure. At each time instant $t$ we infer parameters $\theta_{t}^{(g)} = \{k_t^{(g)},\matrixstyle{K}_t^{(g)},\Sigma^{(g)}_t\}_t$ calculating the expected I-projection of a parametric policy $\pi_t(u_t|_t;{\theta}_t)$ onto the theoretical policy $\pi_t^{(g)}$. We define $p(x_t|x_0;\tilde{\underline{\pi}}_T^{(g)})$ as the state distribution at time $t$ under the given approximate policy belief sequence $\tilde{\underline{\pi}}_T^{(g)}$. There is no theoretical motivation for this choice apart from that such data is available. \begin{equation*} \arg\min_{\theta_{t}} \expect{p(x_t|x_0;\tilde{\underline{\pi}}_T^{(g)})}\left.\left[\mathbb{D}\left[\pi^{(g+1)}_{t}(u_t|x_t)\right\| \pi_t(u_t|x_t;\theta_{t})\right]\right]\\ \end{equation*} which is equivalent to \begin{equation*} \arg\max_{\theta_{t}} \expect{p(x_t|x_0;\tilde{\underline{\pi}}_T^{(g)})}\left[\expect{\pi^{(g+1)}_{t}(u_t|x_t)}\left[\log \pi_t(u_t|x_t;\theta_{t}) \right]\right] \end{equation*} Second we make use explicitly of the path integral expressions derived in section \ref{sec:path-integral-control}. Substitute the path integral expression for $\pi_{t}^{(g+1)}$ yields the following explicit update. \begin{equation} \label{eq:derivationA} \begin{aligned} \theta_{t}^{(g+1)} &=\arg \max_{\theta_{t}} \expect{p(\overline{\Xi}_t|x_0;\underline{\pi}_T^{(g)})}\left[ e^{-R (\overline{\Xi}_{t})}\log \pi_t(u_t|x_t;\theta_{t}) \right]\\ &\approx \arg\max_{\theta_{N-n}} \sum\nolimits_m \frac{ w_{t}^m }{\sum_m w_{t}^m } \log \pi\left(u_t^m \left|x_t^m;\theta_t \right)\right. \end{aligned} \end{equation} where $- \log w_{t}^m \propto R(\overline{\Xi}_t^m)$. The updates can be estimated accordingly\footnote{An alternative strategy would involve parametrizing the entire path probability distribution, $p(\underline{\Xi}_T|x_0;\underline{\pi}_T^{(g)})$, by substituting a parametrized policy series $\{{\pi}_t({u_t|x_t;\theta}_t)\}$ and use the I-projection strategy on the entire posterior path probability $p(\underline{\Xi}_T|x_0;\underline{\pi}_T^{(g+1)})$. It is easily verified that this strategy ultimately results into the strategy above except for the likelihood weights $w_{t}^m$ that are now time invariant and thus equivalent for every temporal policy update.}. For conciseness we refer to Appendix \ref{sec:exact-path-integral-control-update} for details. \paragraph{Backward pass through quadratic approximations} Our second approach makes use of the observation that if the $Q$-function is quadratic, by definition the associated posterior policy is of the local Gaussian form (\ref{eq:LG-policy}). Hence the idea is here to extract a quadratic approximation of the $(g+1)$\textsuperscript{th} $Q$-function from the sample set $\mathcal{D}^{(g)}$ instead of using gradient information. Similar ideas were first described by \cite{akrour2016model,akrour2018model}. Ergo we require a second order approximation of the $Q$-function with $\phi = \{\hat{Q}_{\xi} , \hat{\matrixstyle{Q}}_{\xi\xi}\}$. \begin{equation*} Q(\xi;\phi) = \tfrac{1}{2} \begin{bmatrix} 1 \\ \xi \end{bmatrix}^\top \begin{bmatrix} \times & \hat{Q}_{\xi}^\top \\ \cdot & \hat{\matrixstyle{Q}}_{\xi\xi} \end{bmatrix} \begin{bmatrix} 1 \\ \xi \end{bmatrix} \end{equation*} To estimate parameters $\{\phi_{t}^{(g)}\}_t$ a second order least squares approach can be used. Thus now we require estimates for $Q_t^{(g),m}$. \begin{equation} \label{eq:alg4:1} \phi_t^{(g)} = \arg\min_{\phi_t} \sum\nolimits_m \left({Q}(\xi_t^m;\phi_t)- Q_t^{{g},k} \right)^2 \end{equation} Therefore we can make use of the recursive equations for the regularized value and $Q$-functions. Furthermore we will make explicit use of the fact that for deterministic dynamics the expression for the $Q$-function is related exactly to the expression of the $V$-function. The following procedures are feasible in practice since the policy at time $t$ dependents on an estimate of the value function at time $t+1$ which on its turn depends on estimates of the policy and $Q$-function at time $t+1$. Rolling out a backward recursive strategy, all variables will be available when we need them. As mentioned a quadratic surrogate of $Q_{t}^{(g+1)}$ can be obtained from samples $\{Q_{t}^{(g+1),k}\}_m$. Then recall that \begin{equation} \label{eq:alg4:2} Q_{t}^{(g+1),k} = r_{t}^m + V_{t+1}^{(g+1),m} \end{equation} Thus the problem is reduces to finding an estimate of $V_{t}^{(g+1),m}$. Given that we already have access to estimates $\pi_{t}^{(g+1)}$ and $Q_{t}^{(g+1)}$ at this point, we can exploit the quadratic expressions described in section \ref{sec:regularized-linear-quadratic-regulator} to evaluate $V_{t+1}^{(g+1)}$ and evaluate it at $x_{t+1}^m$. It follows that this procedure, in combination with the LQER expressions for the local Gaussian policy, implements a sample based approximation of the iELQR method described in the previous paragraph. The benefit is that here we do not limit the expressiveness of the forward uncertainty propagation to some approximate mechanism such as the EKF of UKF. Instead we make use of a full Monte Carlo method. Then because we rely on the linear-quadratic updates from the ELQR to determine the policy and to evaluate the value function, we indirectly compute ensemble gradient approximations of the local dynamics and cost model. \subsection{Reinforcement Learning}\label{sec:reinforcement-learning} In the following sections we will now sketch two more ideas tailored to Reinforcement Learning and representation learning that may benefit from the class of trajectory optimization strategies described in this section. We treat the RL problem first. As opposed to trajectory optimization where we are satisfied with a local approximation of $\underline{\pi}_T$, in RL we are interested in solving the stochastic optimal control problem globally. Therefore the trajectory optimization problem is generalised with an expectation over the initial state distribution $p(x_0)$ where now the distribution needs not be narrow or deterministic. Further, instead of solving for $T$ different policies we substitute a global time independent parametrized policy $\pi_\theta$ represented using e.g. a Neural Network or any other universal function approximator such as the radial basis function framework or even a polynomial series expansion. Further, as is common practice in RL, we can approximate the expectation over the initial state distribution using $N$ samples. \begin{equation*} \begin{multlined} \min_\pi \int p(x_0) \int p(\underline{\Xi}_T|x_0;\pi_\theta) R(\underline{\Xi}_T)\text{d} \underline{\Xi}_T \text{d}x_0 \\ \approx \sum\nolimits_n \int p(\underline{\Xi}_T|x_0^n;\underline{\pi}_T^n) R(\underline{\Xi}_T)\text{d} \underline{\Xi}_T \end{multlined} \end{equation*} Then recycling the approach proposed in \ref{sec:explicit-solution-of-the-e-step} we can decompose the problem as follows \begin{multline*} \underbrace{\sum\nolimits_n \int p(\underline{\Xi}_T;\underline{\pi}_T) \log \frac{p(\underline{\Xi}_T|x_0^n;\pi_\theta) }{p(\underline{\Xi}_T|x_0^n;\underline{\pi}_T)} \text{d}\underline{\Xi}_T}_{\mathcal{A}} \\ + \sum\nolimits_n \underbrace{ \kullbacks{p(\underline{\Xi}_T|x_0^n;\underline{\pi}_T)}{p(\underline{\Xi}_T|x_0^n;\pi_\theta)e^{-R(\underline{\Xi}_T)}}}_{\mathcal{B}_n} \end{multline*} The decomposition is slightly different from before given that we introduce $N$ independent trajectory optimization problems. If instead we would introduce a global inference problem the error term would not be fine-tuned to each individual measurement sequence. The sub-optimality induced by this condition is referred to as the \textit{amortization} gap. By individualising the inference distribution to each initial state the amortization gap is minimized. Once again we can apply the EM algorithm where instead of finding a single inference distribution for subproblem $\mathcal{B}$ we thus propose to solve each individual trajectory optimization problem separately. The E-step then reduces to solving $N$ trajectory optimization problems whilst now the M-step amounts to the M-projection of the Monte Carlo distribution $\sum_n\delta(x_0 - x_0^n)p(\underline{\Xi}_T|x_0^n;\underline{\pi}_T^n)$ onto the probability space spanned by $p(\underline{\Xi}_T;\pi_\theta)$. \begin{STDdescription} \item[E-step] Minimize $\mathcal{B}_n$ locally for $\underline{\pi}_T^n$ fixing $\pi_\theta$. \item[M-step] Maximize $\mathcal{A}$ globally for $\pi_\theta$ fixing $\{\underline{\pi}_T^n\}$. \end{STDdescription} The E-step is used to find local controllers $\underline{\pi}_T^n$ starting from a random seed $\{x_0^n\}$ and sampling $\pi_\theta$. The M-step can then be used to fit $\pi_\theta$ on the local controllers $\underline{\pi}_T^n$ and so on. To solve the E-step one can use any of the local solution strategies as described in section 4.1. Some of them generate samples $\underline{\Xi}_T^m$ if not they can be created after the local solution has been found. Note that such an RL algorithm would then share certain characteristics with the Guided Policy Search (GPS) algorithms by \cite{levine2013guided,levine2013variational}. For model based RL we might assume that we have access to $p(x'|x,u)$. If we only have access to a simulator then the local model parameters can be estimated from the local sample trajectories. In conclusion we note that the stochastic gradient direction in the M-step can be calculated using the following gradient direction. \begin{equation} \label{eq:RL} \nabla_\theta \mathcal{A}(\theta) \approx \sum_n \sum_m \sum_t \frac{\nabla_\theta \pi_\theta(u_t^{n,m}|x_t^{n,m})}{\pi_\theta(u_t^{n,m}|x_t^{n,m})} \end{equation} Note that all information with regard to the optimal policy is therefore contained in the trajectory samples $\{\underline{\Xi}_T^{n,m}\}_{n,m}$. Instead we could also directly fit $\pi_\theta$ onto the local solutions $\underline{\pi}_t^n$ similar to \cite{mordatch2014combining}. Though in contrast to \cite{mordatch2014combining} we also gradually update policy $\pi_\theta$ instead of solving the trajectory optimization problems once without regularising on $\pi_{\theta^{(g)}}$. \section{CONCLUSION} In this paper we have tried to lay bear the probabilistic inference mechanism underlying existing inference principles in optimal control. Our investigation has lead to the conclusion that the stochastic and risk sensitive optimal control problems can be addressed using variational inference therewith retrieving the two existing, closely related but nevertheless different Control as Inference approaches as described respectively by \cite{rawlik2013stochastic,lefebvre2020elsoc,lefebvre2021deoc} and \cite{toussaint2009robot,watson2021stochastic,watson2021control}. The governing update rules are shown to constitute a consistent inference mechanism to recover the deterministic policy in a finite amount of iterations. In other words our analysis points out that by iterating the derived updates we may infer the actual deterministic optimal policy that renders extreme the two underlying optimal control problems. It is our contention that these observations re-establish the Control as Inference paradigm as has been reviewed by e.g. \cite{levine2018reinforcement}. Therefore we argue that the exposed mechanism can be interpreted as an extension of the traditional optimal control paradigm and identify it as an instance of probabilistic numerics, in the sense that policy belief functions are generated that express our uncertainty about an underlying deterministic solution. Therefore we propose to refer to the ensemble paradigm as entropy regularized optimal control. Remarkably the entropy regularized reciprocal of the risk-sensitive optimal control problem allows to express the iterate policy as a path integral in the sense of Feynman and Kac. This is a characteristic that was reserved to the Linearly Solvable Optimal Control framework until now or entropy regularized trajectory optimization problems that are lifted entirely to the state-space \cite{lefebvre2020elsoc}. Furthermore this observation solves the question raised by \cite{watson2021control} who seeked a connection between Path Integral Control and message passing based on the problem that we would now refer to as the entropy regularized reciprocal of the risk sensitive optimal control problem. Based on our theoretical investigation an outlook was given for application of the paradigm in trajectory optimization and reinforcement learning. We hope this outlook may inspire a new family of algorithms with improved numerical characteristics that benefit from the insights provided by this work. In conclusion we note that our investigation has been limited to optimal control problems in discrete time. Attempting a generalisation to continuous-time problems seems worthwhile both from a theoretical as well as a practical point of view. However it appears challenging to generalise the use of the variational inference principle to continuous time optimal control problems. Though future work may draw inspiration from the rich literature on stochastic calculus. \appendices \section{Recursive solution of SOC \& RSOC}\label{sec:lqr-and-lqer} In this appendix we give some additional details on the standard stochastic and risk sensitive optimal control problems that were introduced in section \ref{sec:optimal-control}. \subsection{Backward recursive expressions} It can be shown that the solution of the stochastic and risk sensitive OCP are governed by the following equations. Here $\pi_t$ denotes the \textit{deterministic} policy and $V_t(x_t)$ denotes the value function. The definition of the value function is of lesser importance. \begin{equation*} \begin{aligned} \pi_t(x_t) &= \arg\min_{u_t} Q_t(\xi_t) \\ V_t(x_t) &= \min_{u_t} Q_t(\xi_t) \end{aligned} \end{equation*} Either function are governed by the $Q$-function. The definition of the $Q$-function determines the distinction between whether we are treating a stochastic or risk sensitive OCP. \begin{description} \item[Stochastic OCP] \begin{equation*} Q_t(\xi_t) = r_t(\xi_t) + \expect{p(x'|\xi_t)}\left[V_{t+1}(x')\right] \end{equation*} \item[Risk Sensitive OCP] \begin{equation*} Q_t(\xi_t) = r_t(\xi_t) - \log \expect{p(x'|\xi_t)}\left[\exp(-V_{t+1}(x'))\right] \end{equation*} \end{description} For completeness and ease of comparison we can summarize these results in a similar table as was provided in \ref{tab:overview}. \begin{figure*} \begin{center} \begin{tabular}{ l|cc } & stochastic OCP & risk sensitive OCP \\ \hline $\pi_t$ & $\arg\min_{u_t} Q_t(\xi_t) $ & $\cdot$ \\ $V_t$ & $\min_{u_t} Q_t(\xi_t) $ & $\cdot$ \\ $Q_t$ & $r_t(\vectorstyle{\xi}_t) + \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V_{t+1}(\vectorstyle{x}'))\right]$& $r_t(\vectorstyle{\xi}_t)-\log \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V_{t+1}(\vectorstyle{x}'))\right]$ \end{tabular} \end{center} \caption{Overview of governing equations for stochastic and risk sensitive OCPs.} \label{tab:overview1} \end{figure*} \begin{figure*} \begin{center} \begin{tabular}{ l|cc } & stochastic OCP & risk sensitive OCP \\ \hline $\pi_t^{(g+1)}$ & $\pi_t^{(g)}(u_t|x_t) \dfrac{\exp(-Q^{(g+1)}_t(\xi_t))}{\exp(-V^{(g+1)}_t(x_t))}$ & $\cdot$ \\ $V_t^{(g+1)}$ & $- \log \expect{\pi_t^{(g)}(u_t|x_t)}\left[\exp(-Q^{(g+1)}(\xi_t))\right]$ & $\cdot$ \\ $Q_t^{(g+1)}$ & $r_t(\vectorstyle{\xi}_t) + \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V^{(g+1)}_{t+1}(\vectorstyle{x}'))\right]$& $r_t(\vectorstyle{\xi}_t)-\log \expect{p(\vectorstyle{x}'|\vectorstyle{\xi}_t)}\left[\exp(-V^{(g+1)}_{t+1}(\vectorstyle{x}'))\right]$ \end{tabular} \end{center} \caption{Overview of governing inference mechanism for stochastic and risk sensitive OCPs.} \label{tab:overview2} \end{figure*} \subsection{LQR \& LQER} The general governing equations can be practised to solve the standard versions of the Linear-Quadratic-Regulator (LQR) and Linear-Quadratic-Exponential-Regulator (LQER) problem. Similar to the entropy regularized counterparts the policy is linear affine in the state and both the $V$- and $Q$-function are quadratic in their arguments. Using the same notation as before one easily verifies the following solution \begin{STDdescription} \item[policy $\pi$] \begin{equation*} \begin{aligned} k_t &= -Q_{uu,t}^{-1} Q_{u,t} \\ \matrixstyle{K}_t &= -Q_{uu,t}^{-1} Q_{ux,t} \end{aligned} \end{equation*} \item[$V$-function] \begin{equation*} \begin{aligned} V_{x,t} &= Q_{x,t} + Q_{xu,t} k_t + \matrixstyle{K}_t^\top Q_{u,t} + \matrixstyle{K}_t^\top Q_{uu,t} k_t \\ V_{xx,t} &= Q_{xx,t} + \matrixstyle{K}_t^\top Q_{ux,t} + Q_{xu,t}\matrixstyle{K}_t + \matrixstyle{K}_t^\top Q_{uu,t} \matrixstyle{K}_t \end{aligned} \end{equation*} \end{STDdescription} As noted the policy and value function are equivalent irrespective of the OC framework. The $Q$-function determines whether we treat the one or the other. \begin{STDdescription} \item[LQR] \begin{equation*} \begin{aligned} Q_{\xi,t} &= \matrixstyle{R}_{\xi,t} + \matrixstyle{F}_{\xi,t}^\top \left(V_{xx,t+1}\vectorstyle{f}_t+ V_{x,t}\right) \\ Q_{\xi\xi,t} &= \matrixstyle{R}_{\xi\xi,t} + \matrixstyle{F}_{\xi,t}^\top V_{xx,t+1} \matrixstyle{F}_{\xi,t} \end{aligned} \end{equation*} \item[LQER] \begin{equation*} \begin{aligned} Q_{\xi,t} &= R_{\xi,t} + \matrixstyle{F}_{\xi,t}^\top(V_{xx,t+1}^{-1}+\matrixstyle{P}_t)^{-1}\left(V_{xx,t+1}^{-1} V_{x,t}+\vectorstyle{f}_t\right) \\ Q_{\xi\xi,t} &= R_{\xi\xi,t} + \matrixstyle{F}_{\xi,t}^\top(V_{xx,t+1}^{-1}+\matrixstyle{P}_t)^{-1}\matrixstyle{F}_{\xi,t} \end{aligned} \end{equation*} \end{STDdescription} \section{Bayesian filtering \& smoothing}\label{sec:bayesian-filtering--smoothing} In this Appendix we provide some background on Bayesian estimation and sketch computational details associated to two key problems. We refer the reader to the standard work of \cite{thrun2002probabilistic,bishop2006pattern,sarkka2013bayesian,murphy2012machine} and \cite{barfoot2017state} for further details. This holds for all the derivations throughout. Note that the work in these references is limited to HMMs. \subsection{Controlled Hidden Markov Models} \begin{figure}[t] \centering \includegraphics[width=.8\columnwidth]{CHMM.pdf} \caption{Graphical representation of the dynamic Bayesian network corresponding a generic controlled Hidden Markov model.} \label{fig:CHMM} \end{figure} We consider a \textit{controlled} Hidden Markov model (HMM) which is an extension of the standard HMM where we introduce a probabilistic control variable $u_t$\footnote{Note that this model is not equivalent to a Partially Observable Markov Decision Processes.}. See figure \ref{fig:CHMM}. To further specify the probabilistic state-space model we characterise the following set of conditional probability distributions describing the probabilistic dynamics of the system. The model is Markovian which implies that past measurements can not contain more information about the transition, control and emission probabilities than the present state-action itself. Mathematically this property manifests as conditional independence on historical measurements (not necessarily future measurements). We have that $p(x_t|\xi_{t-1},\underline{Z}_{t-1}) \equiv p(x_t|\xi_{t-1})$, $p(u_t|x_t,\underline{Z}_{t-1}) \equiv p(u_t|x_t)$ and $p(z_t|\xi_t,\underline{Z}_t) \equiv p(z_t|\xi_t)$. As a result, when the system manifests into a path $\{\underline{\Xi}_t,\underline{Z}_t\}$, it does so according to the probabilities determined by the controlled HMM $\mathcal{M}$ since no more information is available to influence its behaviour. \begin{equation*} \mathcal{M} = \left\lbrace\begin{aligned} &p(x_0) && \text{(initial state distribution)}\\ &p(x_{t}|\xi_{t-1}) && \text{(controlled transition probability)}\\ &p(u_t|x_t) && \text{(control policy distribution)}\\ &p(z_t|\xi_t) && \text{(emission probability)} \end{aligned}\right. \end{equation*} Two key problems in Bayesian estimation are then determined by the calculation of the marginal joint probability distributions conditioned on the leading, $\underline{Z}_t$, and full, $\underline{Z}_T$, measurement sequences. These distributions are better known as the filtering, $p(\xi_t|\underline{Z}_t)$, and smoothing, $p(\xi_t|\underline{Z}_T)$, distributions respectively. The exposition in most reference works is limited to regular HMMs, excluding the control variable and probabilistic policy. In the following we treat filtering and smoothing in the more general setting of controlled Hidden Markov Models. \subsection{Filtering} The purpose of Bayesian filtering is to compute the joint marginal posterior distribution (or so-called filtering distribution) of the joint state-action, $\xi_t$, at each time step, $t$, given the history of the measurements up to the time step $t$, i.e. $p(\xi_t|\underline{Z}_t)$. \subsubsection{Exact filtering} There exists a well known and exact forward recursion to compute the filtering distributions. The general procedure is described next for controlled HMMs. An important intermediate result of the computation is the so-called predictive joint distribution which is defined as $p(\xi_t|\underline{Z}_{t-1})$. By definition we have that $p(\xi_0|\underline{Z}_{-1}) = p(\xi_0)$. \begin{STDdescription} \item[initialization] The recursion is initialised from the initial predictive joint distribution $p(\xi_0)$. \begin{equation*} p(\xi_0) = p(u_0|x_0) p(x_0) \end{equation*} \item[update step] Given a measurement $z_{t}$ and the predictive joint distribution $p(\xi_t|\underline{Z}_{t-1})$, the present marginal joint posterior, $p(\xi_{t}|\underline{Z}_{t})$, can be computed using Bayes' rule. \begin{equation*} p(\xi_{t}|\underline{Z}_{t}) \propto p(z_{t}|\xi_{t}) p(\xi_{t}|\underline{Z}_{t-1}) \end{equation*} \item[forward prediction step] Finally a two step computation can be used to determine the next predictive joint distribution provided with the current marginal joint posterior. First the predictive state distribution $x_{t+1}$ is determined using the Chapman-Kolmogorov equation. Second the predictive joint distribution can be computed. \begin{equation*} \begin{aligned} p(x_{t+1}|\underline{Z}_t) &= \int p(x_{t+1}|\xi_t) p(\xi_t|\underline{Z}_t) \text{d}\xi_t \\ p(\xi_{t+1}|\underline{Z}_t) &= p(u_{t+1}|x_{t+1}) p(x_{t+1}|\underline{Z}_t) \end{aligned} \end{equation*} \end{STDdescription} It follows that the general filtering distributions can be determined in a single forward recursive calculation. In a linear-Gaussian this procedure can be evaluated explicitly. This result is known as the Kalman filter. For brevity we omit explicit equations. \subsubsection{Approximate filtering} It often happens in practical applications that the dynamic and measurement models are not linear so that the Kalman filter simply does not apply. However, often the filtering distributions of this kind of model can still be approximated by Gaussian distributions. Within the literature there are two main strategies to approximate such Gaussian distributions. Either strategy roots back to the practice of a different uncertainty quantification strategy to locally approximate the forward probabilities $p(x_t|\xi_{t-1})$, $p(u_t|x_t)$ and $p(z_t|\xi_t)$. Extended Kalman Filters (EKF) practice a Taylor approximation to linearise the the forward probabilities. Unscented Kalman Filters practice the unscented transform to propagate the uncertainty. Essentially these algorithms compute a(n) (ensemble) gradient based linear approximation about some reference trajectory, similar to how the LQR algorithm can be used to solve generic nonlinear OCPs. Interestingly here the reference trajectory is determined on the fly, coinciding with the expected value of the joint marginal posterior. Hence there is not iterative aspect to these procedures except for the update step, where in some implementations of the EKF or UKF this procedure is iterated to obtain a better approximation of the marginal joint posterior. In that sense these iterations are local and do not reconsider the entire trajectory, only updating the local estimate of $p(\xi_t|\underline{Z}_t)$. See \cite{sarkka2013bayesian,barfoot2017state} for details on approximate filtering. \subsection{Smoothing} The purpose of Bayesian smoothing is to compute the marginal joint posterior distribution (or so-called smoothing distribution) of the state, $\xi_t$, at the time step, $t$, after receiving the measurements up to a time step $T$ where $T>t$, i.e. $p(\xi_t|\underline{Z}_T)$. \subsubsection{Exact smoothing} There exists a well known and exact forward-backward recursive procedure to compute the smoothing distributions. The general procedure is described next for controlled HMMs. An important intermediate result of the computation are the filtering distributions, which determines the forward recursion, and the associated predicted state distributions $p(x_{t+1}|\underline{Z}_t)$. In a backward recursion the filtering distribution $p(\xi_t|\underline{Z}_t)$ is then corrected additionally conditioning onto the future measurements $\overline{Z}_{t+1}$ not considered in filtering. By definition we have that $p(\xi_T|\underline{Z}_{T})$ qualifies both as a filtering and smoothing distribution. \begin{STDdescription} \item[initialization] The recursion is initialised from the filtering distribution $pp(\xi_T|\underline{Z}_T)$. \item[backward correction step] Next the present future measurements are encoded into the present filtering distribution, $p(\xi_t|\underline{Z}_t)$, computing the present smoothing distribution, $p(\xi_t|\underline{Z}_T)$. Note that the correction step makes use of the trailing smoothing marginalised distribution $p(x_{t+1}|\underline{Z}_T)$ and the predicted state distribution, $p(x_{t+1}|\underline{Z}_t)$. \begin{equation*} p(\xi_t|\underline{Z}_T) = p(\xi_t|\underline{Z}_t) \int \frac{p(x_{t+1}|\underline{Z}_T)}{p(x_{t+1}|\underline{Z}_t)} p(x_{t+1}|\xi_t) \text{d}x_{t+1} \end{equation*} \end{STDdescription} It follows that the general smoothing distributions can be determined in a single forward recursive calculation, determining the filtering distributions, and, a single backward recursive calculation. In a linear-Gaussian setting this procedure can be evaluated explicitly. This result is known as the Rauch-Tung-Striebel (RTS) smoother. \subsubsection{Approximate smoothing} Similar to the filtering problem, it often happens in practical applications that the dynamic and measurement models are not linear so that the RTS smoother simply does not apply. Again often the smoothing distributions can be approximated by Gaussian distributions. The same uncertainty quantifications procedure can be used as described for the filtering problem which establishes an approximate calculation for the forward recursion. Provided with the local linearisation of the problem, the linear backward smoothing procedure can now readily be applied. This idea characterised the standard Extended (EKS) and Unscented Kalman Smoother (UKS). Interestingly here an iterative procedure can be established since in general the smoothed trajectory will not coincide with the filtered trajectory so that the linearisation conditions change. In that sense the linear forward and backward recursive procedure can be alternated to improve the local approximation. This idea characterised the iterated EKF (iEKF) and iterated iKF (iUKF). See \cite{sarkka2013bayesian,barfoot2017state}. \section{Exact Path Integral Control update}\label{sec:exact-path-integral-control-update} For completeness we give here the explicit solution of the optimization problem in (\ref{eq:derivationA}). The parameters are given by \begin{equation*} \label{eq:lhwupdate} \begin{aligned} k_{t}^{(g+1)} &= \hat{\mu}_{u,t}^{(g+1)} - \matrixstyle{K}_{t}^{(g+1)} \hat{\mu}_{x,t}^{(g+1)}\\ \matrixstyle{K}_{t}^{(g+1)} &= {\Sigma}_{ux,t}^{(g+1)} \hat{\Sigma}_{xx,t}^{(g+1),-1}\\ \Sigma_{t}^{(g+1)} &= \hat{\Sigma}_{uu,t}^{(g+1)} - \matrixstyle{K}_{t}^{(g+1)}\hat{\Sigma}_{xx,t}^{(g+1)}\matrixstyle{K}_{t}^{(g+1),\top} \end{aligned} \end{equation*} where $\langle (\cdot) \rangle = \sum_k \frac{w_{t}^k}{\sum_k w_{t}^k} (\cdot) $ and \begin{equation*} \begin{aligned} \hat{\mu}_{x,t}^{(g+1)} &= \left\langle x_t \right\rangle \\ \hat{\mu}_{x,t}^{(g+1)} &= \left\langle u_t \right\rangle \\ \hat{\Sigma}_{xx,t}^{(g+1)} &= \left\langle \left(x_t-\hat{\mu}_{x,t}^{(g+1)}\right)\left(x_t-\hat{\mu}_{x,t}^{(g+1)}\right)^\top \right\rangle \\ \hat{\Sigma}_{ux,t}^{(g+1)} &= \left\langle \left(u_t-\hat{\mu}_{u,t}^{(g+1)}\right)\left(x_t-\hat{\mu}_{x,t}^{(g+1)}\right)^\top \right\rangle \\ \hat{\Sigma}_{uu,t}^{(g+1)} &= \left\langle \left(u_t-\hat{\mu}_{u,t}^{(g+1})\right)\left(u_t-\hat{\mu}_{u,t}^{(g+1)}\right)^\top \right\rangle \\ \end{aligned} \end{equation*} Based on the structural properties of the updates we can conclude that this strategy uses a likelihood weighted strategy to estimate a Gaussian approximation of the marginal distributions $p(\xi_t|x_0;\underline{\pi}_T^{(g+1)})$ and then conditions this estimate on $x_t$ to obtain an estimate of the updated policy $\pi_{t}^{(g+1)}$. This is actually similar to the procedure proposed by the iELQR. In addition we note that this approach extends to stochastic system dynamics, in which case we have to adopt a stochastic simulation of the system according to $x_{t+1}^k \sim p(x_{t+1}|x_t^k,u_t^k)$. As discussed in section \ref{sec:path-integral-control}, then this approach works only for the risk sensitive setting. \bibliographystyle{unsrt}
\section{Introduction} The Frank free energy density $\omega$ of liquid crystal (LC) is given by \cite{degennes:book:1993}: \[ \omega[\mathbf{n}]=\frac12\bigg[K_1(\Div\mathbf{n})^2 + K_2(\mathbf{n}\cdot\Rot\mathbf{n}+q_0)^2 + K_3(\mathbf{n}\times\Rot\mathbf{n})^2-\Delta\chi(\mathbf{n}\cdot \mathbf{H})^2\bigg], \] where $K_1$, $K_2$, $K_3$ are Frank constants, $q_0=2\pi/P$ is the wavenumber, $P$ is the pitch of the cholesteric helix, $\mathbf{H}$ is the external magnetic field and $\Delta\chi=\chi_{\parallel}-\chi_{\perp}$ is the difference of the magnetic susceptibility $\Delta_{\parallel}$ in the direction of $\mathbf{n}$ and the one $\Delta_{\perp}$ in the perpendicular direction \cite{knyazev:lc:2013}. Typical values of the Frank constants are \cite{hakemi:jcp:1983,bogi:lc:2001,bradshaw:mclc:1981,hara:mclc:1985,srivastava:jpcm:2004} \[ 0.5<\frac{K_2}{K_1}<0.8,\quad 0.5<\frac{K_3}{K_1}<3.0. \] We assume $K_1,K_2,K_3$ to be fixed. The wavenumber $q_0$ can be of positive, negative or zero and it is a function of $\mathbf{x}$. The value $\Delta\chi$ depends on the properties of the LC and can be positive and negative. The expression of the energy density can be significantly simplified, if all Frank constants are equal. It is convenient to have the one constant approximation energy density as explicit addendum interpreting other contributions as perturbations. The goal can be achieved applying a sequence of transforms. The first one \[ (\Div\mathbf{n})^2+(\Rot\mathbf{n})^2+\nabla\cdot((\nabla\cdot \mathbf{n})\mathbf{n}-\mathbf{n}(\nabla\cdot\mathbf{n})) = (\Grad\mathbf{n})^2\forall x. \] The last addendum on the left hand side describes surface interaction, and can be eliminated by application of the divergence theorem and rigid boundary conditions. The remaining part is read as follows using explicit indices and denoting $n_{i,j}=\partial n_i/\partial x_j$: \[ \bigg(\sum_{i} n_{i,i}\bigg)^2+\sum_i\bigg(\sum_{j,k} \epsilon_{ijk}n_{k,j}\bigg)^2=\sum_{i,j}(n_{i,j})^2. \] The second identity is Pythagorean theorem for the rotor: \[ \mathbf{n}^2(\nabla\times\mathbf{n})^2=(\mathbf{n}\cdot(\nabla\times\mathbf{n}))^2+(\mathbf{n}\times(\nabla\times\mathbf{n}))^2\forall x, \] where the addenda on the right hand side are squares of projections of rotor on $\mathbf{n}(x)$ and $\mathbf{n}(x)^\perp$. Taking into account the two identities and constrains $\mathbf{n}(x)^2=1$, we write energy density in the following form: \[ \omega=\frac12\bigg[K_1(\nabla\mathbf{n})^2-K_1(\nabla\times\mathbf{n})^2+K_2(\mathbf{n}\cdot\nabla\times\mathbf{n})^2+2K_2q_0(\mathbf{n}\cdot\nabla\times\mathbf{n}) +K_2q_0^2 +K_3(\nabla\times\mathbf{n})^2-K_3(\mathbf{n}\cdot(\nabla\times\mathbf{n}))^2 -\Delta\chi(\mathbf{n}\cdot \mathbf{H})^2 \bigg]. \] The constant term is of little interest and can be neglected doing relaxation of the director, then collecting similar terms the energy density is expressed as follows: \[ \omega=\frac12\bigg[ K_1(\nabla\mathbf{n})^2+(K_3-K_1)(\nabla\times\mathbf{n})^2+(K_2-K_3)(\mathbf{n}\cdot\nabla\times\mathbf{n})^2 +2K_2q_0(\mathbf{n}\cdot\nabla\times\mathbf{n})-\Delta\chi(\mathbf{n}\cdot \mathbf{H})^2 \bigg]. \] The last addendum appears if LC subjected to the external magnetic field \cite{deuling:mclc:1972deformation, cheng:jap:1981}. The penultimate term describes chiral liquid. The first term represents energy in one constant approximation, and the next two terms are non zero only if all three Frank constants are different. It is worth noting that the expression is quadratic with respect to $\mathbf{n}$ except of the third term $(\mathbf{n}\cdot\nabla\times\mathbf{n})^2$. If we are only interested in shrinking of cholesteric fingers \cite{oswald:pr:2000,rybakov:prl:2015, tai:pre:2020:smalyukh}, which is controlled by $K_3$, then we can simplify our life setting $K_2=K_3$ and avoid analysis of non-quadratic energy functional. \section{Energy variation} The Frank free energy is just an integral of the density $\omega$ over the volume $V$ of the considered LC: \[ E[\mathbf{n}]=\int_V\omega[\mathbf{n}]\,d\mathbf{x}. \] The variation $\delta E/\delta\mathbf{n}$ of the free energy gives direction of relaxation of LC and plays crucial part in dynamics of LC: \[ E[\mathbf{n}+\epsilon\delta\mathbf{n}]=E[\mathbf{n}]+\epsilon\int_V \delta E[\mathbf{n}]\cdot\delta\mathbf{n}\,d\mathbf{x}+o(\epsilon),\text{ as }\epsilon\to0. \] Below we assume implicit dependence of all values on $\mathbf{x}$, the notation $a_i$ is used for $i$-th coordinate of a vector $\mathbf{a}=(a_1,a_2,a_3)$, and the partial derivatives with respect to components of $\mathbf{x}=(x_1,x_2,x_3)$ are denoted by comma in the sub-indices: \[ a_{i,j}=\frac{\partial a_i}{\partial x_j}. \] The energy $E$ consist of the several contributions of the form: \[ F[\mathbf{n}]=\int_V f(\mathbf{n},\Grad\mathbf{n})\,d\mathbf{x}, \] for the corresponding contributions $f$ to the energy density $\omega$. First we derive general rule for variation of a functional $F$ of the given form: \[ F[\mathbf{n}+\epsilon\delta\mathbf{n}] =\int_V f(\mathbf{n}+\epsilon\delta\mathbf{n},\Grad\mathbf{n}+\epsilon\Grad\delta\mathbf{n})\,d\mathbf{x} =F[\mathbf{n}]+\epsilon\sum_i\int_V \bigg[ \frac{\partial f}{\partial n_i}\delta n_i+\sum_j \frac{\partial f}{\partial n_{i,j}}\delta n_{i,j} \bigg]d\mathbf{x}+o(\epsilon). \] Further on we drop the sums from the notation, assuming summation over repeating indices (regardless of the index position), unless the position of the sum is unclear. Integrating by parts and discarding integrals over boundary (the appropriate \emph{boundary conditions} should be \emph{assumed}), we can allocate the common multiplier $\delta\mathbf{n}$ under the integral: \[ F[\mathbf{n}+\epsilon\delta\mathbf{n}]-F[\mathbf{n}]=\epsilon\int_V\bigg[ \frac{\partial f}{\partial n_i}-\frac{\partial}{\partial x_j}\frac{\partial f}{\partial n_{i,j}} \bigg]\delta n_i\,d\mathbf{x}+o(\epsilon). \] We derived the following formula for the variation of $F$: \[ \delta F_i=\delta\int_V f dx =\frac{\partial f}{\partial n_i} -\sum_j \frac{\partial}{\partial x_j}\frac{\partial f}{\partial n_{i,j}}. \] Now we proceed as follows: we separate the addenda in $E$ and compute variation for each of them. Next we restore constant multipliers and write down the result summing all the contributions. Strictly speaking we are interested in variation of $\mathbf{n}$ under constrains $\mathbf{n}(x)^2=1$, which translates to constrains on variations of $\delta\mathbf{n}$: \[ 1=(\mathbf{n}+\epsilon\delta\mathbf{n})^2=\mathbf{n}^2+2\epsilon\mathbf{n}\cdot \delta\mathbf{n}+\epsilon^2\delta\mathbf{n}^2=1+2\epsilon\mathbf{n}\cdot \delta\mathbf{n}+O(\epsilon^2). \] Since variations are small, $\epsilon\to 0$, the perturbations of $\mathbf{n}$ should belong to tangent space to the constrain manifold: \[ \mathbf{n}(x)\cdot\delta\mathbf{n}(x)=0\forall x. \] That means that total parallel to $\mathbf{n}$ component of variation $\delta E$ is never used and can be neglected. Moreover, dynamics of LC is defined by relaxation, that is $d\mathbf{n}/dt=\dot\mathbf{n}$ should be anti-parallel to $\delta E[\mathbf{n}]$ in the tangent to the configuration space. Since the normalization $\mathbf{n}^2(x)=1$ should be always preserved, doing dynamics we have to project $\delta E$ to the tangent space: \[ \const \dot\mathbf{n} = \delta E - (\delta E\cdot\mathbf{n})\mathbf{n}\;\forall x. \] The energy of the system is defined everywhere, but it has physical meaning only on the constrain manifold $\mathbf{n}(x)^2=1$. If the problem is well posed, the dynamics should be independent of definition of energy outside of the manifold. To check the assumption we consider addendum $\tilde E=(1-\mathbf{n}^2)G(\mathbf{n},\nabla\mathbf{n})$ to the energy, where the square over $\mathbf{n}$ is taken pointwise $\mathbf{n}^2(x)=\mathbf{n}(x)^2$ and the function $G$ is smooth. The addition of the perturbation $\tilde E$ to the energy describes all sufficiently smooth transformation of the energy, preserving energy on the constrain manifold. The variation of the perturbation \[ \delta \tilde E = -2\mathbf{n} G+(1-\mathbf{n}^2)\delta G, \] consists of two contributions, the first one vanishes doing projection to the tangent space, and the second one is zero on the constrain manifold, therefore the dynamics is unaffected by alteration of the energy outside of the configuration space as expected. Therefore, the expression of the energy can be simplified using arbitrary formulas preserving the values for $\mathbf{n}(x)^2=1$. Several contributions are squares of simpler quantities. Let us derive variation for the squares $f(\mathbf{n},\nabla\mathbf{n})=g(\mathbf{n},\nabla\mathbf{n})^2$, where $g$ can be vector valued: \[ f=g_pg_p,\quad \frac{\partial f}{\partial n_i}=2g_p\frac{\partial g_p}{\partial n_i},\quad \frac{\partial f}{\partial n_{i,j}}=2g_p\frac{\partial g_p}{\partial n_{i,j}},\quad \frac{\partial}{\partial x_j}\frac{\partial f}{\partial n_{i,j}} =2\frac{d g_p}{d x_j}\frac{\partial g_p}{\partial n_{i,j}} +2g_p\frac{\partial }{\partial x_j}\frac{\partial g_p}{\partial n_{i,j}}. \] \[ \frac{d g_p}{d x_j}=\sum_i \frac{\partial g_p}{\partial n_i}n_{i,j} +\sum_{i,k}\frac{\partial g_p}{\partial n_{i,k}}n_{i,kj}. \] Hence the variation of the square can be expressed in terms of variation of the function it self: \[ \delta_i \int_V g^2\,dx = 2g_p\,\delta_i \int_V g_p\,dx - 2\sum_j\frac{d g_p}{d x_j}\frac{\partial g_p}{\partial n_{i,j}}. \] (I) Let $f=\|\nabla\mathbf{n}\|^2=\sum_{ij} n_{i,j}^2$. Then \[ \frac{\partial f}{\partial n_i}=0,\quad \frac{\partial f}{\partial n_{k,j}}=2n_{k,j},\quad \sum_j \frac{\partial}{\partial x_j}\frac{\partial f}{\partial n_{k,j}} =2\sum_j n_{k,jj}. \] Hence \[ \delta_k \int_V \|\nabla\mathbf{n}\|^2\,dx = -2\sum_j n_{k,jj}, \] or in vector calculus notations \[ \delta \int_V \|\nabla\mathbf{n}\|^2\,dx = -2\Delta \mathbf{n}. \] (II) Let $g=\nabla\times\mathbf{n}$. The coordinates of vector product and rotor can be written using Levi-Civita symbol $\epsilon_{ijk}$: \[ (a\times b)_k = \epsilon_{ijk}a_ib_j = \epsilon_{kij}a_ib_j,\quad (\nabla\times a)_k = \epsilon_{klm}\frac{\partial}{\partial x_l}a_m = \epsilon_{klm} a_{m,l}. \] Also recall the following rule for convolution of the symbols: \[ \epsilon_{ijk}\epsilon_{imn}=\delta_{jm}\delta_{kn}-\delta_{jn}\delta_{km}. \] The first derivatives of the rotor are constant, hence its variation is zero: \[ \frac{\partial g_p}{\partial n_k} = 0,\quad \frac{\partial g_p}{\partial n_{i,j}} = \epsilon_{pji},\quad \frac{d}{dx_j}\frac{\partial g_p}{\partial n_{i,j}} = 0,\quad \Rightarrow\quad \delta\int_V (\nabla\times\mathbf{n})dx = 0. \] The variation of its square does not vanish: \[ \frac{dg_p}{d x_j} = \frac{\partial g_p}{\partial n_{i,k}}n_{i,kj} = \epsilon_{pkl}n_{l,kj}, \] \[ \delta_i \int_V (\nabla\times\mathbf{n})^2\,dx = - 2\frac{d g_p}{d x_j}\frac{\partial g_p}{\partial n_{i,j}} = -2\epsilon_{pkl}n_{l,kj}\epsilon_{pji} = -2(\delta_{kj}\delta_{li}-\delta_{ki}\delta_{lj})n_{l,kj} = -2\big( n_{i,kk}-n_{j,ij} \big). \] The answer in vector calculus notations takes form: \[ \delta\int_V (\nabla\times\mathbf{n})^2dx = -2(\Delta\mathbf{n}-\Grad\Div\mathbf{n}). \] (III) Let $g=\mathbf{n}\cdot\nabla\times \mathbf{n}$ or in coordinate form: \[ g=n_p\epsilon_{plm}n_{m,l}. \] This time we deal with quadratic form $g$ of $\mathbf{n}$, hence the partial derivatives do not vanish: \[ \frac{\partial g}{\partial n_i} = \epsilon_{ilm}n_{m,l},\quad \frac{\partial g}{\partial n_{i,j}} = n_p\epsilon_{pji},\quad \frac{d}{dx_j}\frac{\partial g}{\partial n_{i,j}} = n_{p,j}\epsilon_{pji}. \] Hence the variation of $g$ itself is the following linear transform of $\mathbf{n}$: \[ \delta_i\int_V(\mathbf{n}\cdot\nabla\times\mathbf{n})dx = \frac{\partial g}{\partial n_i} - \frac{\partial}{\partial x_j}\frac{\partial g}{\partial n_{i,j}} = \epsilon_{ilm}n_{m,l} - n_{p,j}\epsilon_{pji} = \epsilon_{ilm}n_{m,l} - n_{m,l}\epsilon_{mli} = 2\epsilon_{ilm}n_{m,l}, \] or in vector calculus notation: \[ \delta\int_V(\mathbf{n}\cdot\nabla\times\mathbf{n})dx = 2 \Rot \mathbf{n}. \] Now we are in a position to derive variation of the square of $g$. Recall that \[ \delta_i \int_V (\mathbf{n}\cdot\nabla\times\mathbf{n})^2\,dx = 2g\,\delta_i \int_V g\,dx - 2\frac{d g}{d x_j}\frac{\partial g}{\partial n_{i,j}}. \] Using derived above identity, the second addendum can be transformed as follows: \[ \frac{d g}{d x_j}\frac{\partial g}{\partial n_{i,j}} = g_{,j}n_p\epsilon_{pji} = (\mathbf{n}\times\nabla g)_i. \] Hence \[ \delta \int_V (\mathbf{n}\cdot\nabla\times\mathbf{n})^2\,dx = 4(\mathbf{n}\cdot\nabla\times\mathbf{n})(\nabla\times\mathbf{n}) -2\mathbf{n}\times\nabla(\mathbf{n}\cdot\nabla\times\mathbf{n}). \] (IV) Let $f=q g$, $g=\mathbf{n}\cdot\nabla\times\mathbf{n}$ and $q$ is a function of $x$ only. Then \[ \frac{\partial f}{\partial n_i} = q\frac{\partial g}{\partial n_i},\quad \frac{\partial f}{\partial n_{i,j}} = q\frac{\partial g}{\partial n_{i,j}},\quad \frac{d}{d x_j}\frac{\partial f}{\partial n_{i,j}} = q_{,j}\frac{\partial g}{\partial n_{i,j}}+q\frac{d}{d x_j}\frac{\partial g}{\partial n_{i,j}}. \] Hence \[ \delta_i\int_V f dx =\frac{\partial f}{\partial n_i}-\sum_j \frac{\partial}{\partial x_j}\frac{\partial f}{\partial n_{i,j}} =q\delta_i\frac12\int_V g dx-q_{,j}\frac{\partial g}{\partial n_{i,j}}. \] Using \[ \frac{\partial g}{\partial n_{i,j}} = n_p\epsilon_{pji}\quad\Rightarrow\quad q_{,j}\frac{\partial g}{\partial n_{i,j}}=q_{j,}n_p\epsilon_{pji}=(\mathbf{n}\times\nabla q)_i, \] we conclude that \[ \delta\int_V (\mathbf{n}\cdot\nabla\times\mathbf{n})q\,dx =q\delta\int_V (\mathbf{n}\cdot\nabla\times\mathbf{n})\,dx -\mathbf{n}\times\nabla q =2q\Rot \mathbf{n} -\mathbf{n}\times\nabla q. \] Finally, variation of energy is as follows: \[ \delta E = -K_1\Delta \mathbf{n} -(K_3-K_1)[\Delta\mathbf{n}-\nabla(\nabla\cdot\mathbf{n})] +(K_2-K_3)[2(\mathbf{n}\cdot\nabla\times\mathbf{n})(\nabla\times\mathbf{n})-\mathbf{n}\times\nabla(\mathbf{n}\cdot\nabla\times\mathbf{n})] +K_2(2q\Rot \mathbf{n}-\mathbf{n}\times\nabla q) \] \[ = -K_1\nabla(\nabla\cdot\mathbf{n}) -K_3[\Delta\mathbf{n}-\nabla(\nabla\cdot\mathbf{n})] +(K_2-K_3)[2(\mathbf{n}\cdot\nabla\times\mathbf{n})(\nabla\times\mathbf{n})-\mathbf{n}\times\nabla(\mathbf{n}\cdot\nabla\times\mathbf{n})] +K_2(2q\nabla\times\mathbf{n}-\mathbf{n}\times\nabla q) \] \section{Staggered grid discretization} We assume the discrete square lattice for the numerical calculations with the energy given by the summation over all nodes: \begin{multline}\label{eq:energy_lattice} E=\frac12\sum_{i,j,k}C^{\{ijk\}}\bigg[ K_1(\nabla\mathbf{n}^{\{ijk\}})^2+(K_3-K_1)(\nabla\times\mathbf{n}^{\{ijk\}})^2+(K_2-K_3)(\mathbf{n}^{\{ijk\}}\cdot\nabla\times\mathbf{n}^{\{ijk\}})^2 +\\+ 2K_2q_0(\mathbf{n}^{\{ijk\}}\cdot\nabla\times\mathbf{n}^{\{ijk\}})-\Delta\chi(\mathbf{n}^{\{ijk\}}\cdot \mathbf{H}^{\{ijk\}})^2, \end{multline} $\{ijk\}$ indices corresponds to the cell position at $x,y,z$ axis respectively. To introduce the differential operations one might need to use the internal indexing inside the cube $\{ijk\}$ (Fig.~\ref{fig:my_label}). \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{diff.pdf} \caption{Cross indexing} \label{fig:my_label} \end{figure} For the convenience of the numerical calculations we introduce the following indexing: \[ n_x^{i+.5jk}=n_x^{\{ijk\}}, \quad n_y^{ij+.5k}=n_y^{\{ijk\}},\quad n_z^{ijk+.5}=n_z^{\{ijk\}}, \] \[ n_x^{0.5.5} = (n_x^{.500}+n_x^{.510}+n_x^{.501}+n_x^{.511}+n_x^{-.500}+n_x^{-.510}+n_x^{-.501}+n_x^{-.511})/8, \] as well as the differential notation: \[ \partial_y^{0.5.5}n_z=n^{01.5}_z-n^{00.5}_z, \] the remaining components are obtained by similar transformations. The volume of the system is presented as \[ V= [0, l_xN_x]\times [0, l_yN_y] \times [0, l_zN_z]. \] Here is a detailed analysis of the error associated with the spacing of lattices $\mathbf{n}$ at different points for each of its components. Consider replacing the integral along the x-axis with the corresponding finite sum with coefficients, corresponding to the trapezoid method: \[ \int_0^{l_xN_x} f(x)dx = \sum_{i=0}^{N_x} C^i_t f(il_x)l_x+O(l_x^2),\quad l_x\to0, l_xN_x=L_x=\mathrm{const},\quad C^0_t=C^N_t=\frac12,\quad C^j_t=1,j\neq0,N. \] Similarly for the rectangle method: \[ \int_0^{l_xN_x} f(x)dx = \sum_{i=0}^{N_x-1} C^i_r f((i+\frac12)l_x)l_x+O(l_x), \quad C^i_r=1. \] We repeat the operation for integration over three-dimensional space: \begin{multline*} \iiint_V f(x,y,z)dx\,dy\,dz = \int_0^{l_xN_x}dx \int_0^{l_yN_y}dy \int_0^{l_zN_z}dz f(x,y,z) = \int_0^{l_xN_x}dx \int_0^{l_yN_y}dy \left[ \sum_{k=0}^{N_z} f(x,y,kl_z)C^k_tl_z +O(l_z^2) \right]\\ = \int_0^{l_xN_x}dx \left[ \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} f(x,jl_y,kl_z) C^j_tC^k_tl_yl_z +O(l_y^2) +O(l_z^2) \right] \\ = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} f(il_x,jl_y,kl_z) C^i_tC^j_tC^k_tl_xl_yl_z + O(l_x^2)+O(l_y^2) +O(l_z^2). \end{multline*} Thus, the error of this replacement does not exceed the square of the smallness of the partition along each of the axes. Let us make sure that the differentiation operations do not worsen the accuracy of the approximation: \[ (\partial_x n_x)^{ijk}=\frac{n_x^{i+0.5,j,k}-n_x^{i-0.5,j,k}}{l_x}+O(l_x^2), \] \begin{multline*} \iiint_V (\partial_x n_x)^2 dx\,dy\,dz = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} \left( (\partial_x n_x)^{ijk} \right)^2 C^i_tC^j_tC^k_t l_xl_yl_z +O(l_x^2) +O(l_y^2) +O(l_z^2) \\ = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} \left( \frac{n_x^{i+0.5,j,k}-n_x^{i-0.5,j,k}}{l_x}+O(l_x^2) \right)^2 C^i_tC^j_tC^k_t l_xl_yl_z +O(l_x^2) +O(l_y^2) +O(l_z^2) \\ = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} l_x^{-2}(n_x^{i+0.5,j,k}-n_x^{i-0.5,j,k})^2 C^i_tC^j_tC^k_tl_xl_yl_z +\left( \sum_{i=0}^{N_x}O(l_x^2)=O(l_x) \right) +O(l_x^2) + O(l_y^2) + O(l_z^2). \end{multline*} Similarly, one can show that this order of error is preserved for all such replacements. Such a procedure wad made for all of the energy components. (V.1) $(\nabla \mathbf{n})^2$ component can be written as the sum: \begin{multline*} \int_V (\nabla \mathbf{n})^2 = \int_V \left[ (\partial_x n_x)^2+(\partial_y n_y)^2+(\partial_z n_z)^2 \right] + \int_V \left[ (\partial_x n_y)^2+ (\partial_y n_x)^2 \right] +\\+ \int_V \left[ (\partial_x n_z)^2+ (\partial_z n_x)^2 \right] +\int_V \left[ (\partial_y n_z)^2+ (\partial_z n_y)^2 \right] , \end{multline*} and all of them can be rewritten in a new form: \[ \int_V \left[ (\partial_x n_x)^2+(\partial_y n_y)^2+(\partial_z n_z)^2 \right] = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} C_t^iC_t^jC_t^k \left[ (\partial_x n_x)^2+(\partial_y n_y)^2+(\partial_z n_z)^2 \right]^{ijk} , \] \[ \int_V \left[ (\partial_x n_y)^2+ (\partial_y n_x)^2 \right] = \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ (\partial_x n_y)^2+ (\partial_y n_x)^2 \right]^{i+.5j+.5k} , \] \[ \int_V \left[ (\partial_x n_z)^2+ (\partial_z n_x)^2 \right] = \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ (\partial_x n_z)^2+ (\partial_z n_x)^2 \right]^{i+.5jk+.5} , \] \[ \int_V \left[ (\partial_y n_z)^2+ (\partial_z n_y)^2 \right] = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \left[ (\partial_y n_z)^2+ (\partial_z n_y)^2 \right]^{ij+.5k+.5} . \] The resulting expressions can be written in terms of the values of $\mathbf{n}$ on the lattice: \[ \left[ (\partial_x n_x)^2+(\partial_y n_y)^2+(\partial_z n_z)^2 \right]^{ijk} = \left[ \left(n_x^{\{ijk\}}-n_x^{\{i-1jk\}}\right)^2+ \left(n_y^{\{ijk\}}-n_y^{\{ij-1k\}}\right)^2+ \left(n_z^{\{ijk\}}-n_z^{\{ijk-1\}}\right)^2 \right] , \] \[ \left[ (\partial_x n_y)^2+ (\partial_y n_x)^2 \right]^{i+.5j+.5k} = (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})^2 + (n_x^{\{ij+1k\}}-n_x^{\{ijk\}})^2 , \] \[ \left[ (\partial_x n_z)^2+ (\partial_z n_x)^2 \right]^{i+.5jk+.5} = (n_z^{\{i+1jk\}}-n_z^{\{ijk\}})^2 + (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})^2 , \] \[ \left[ (\partial_y n_z)^2+ (\partial_z n_y)^2 \right]^{ij+.5k+.5} = (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})^2 + (n_y^{\{ijk+1\}}n_y^{\{ijk\}})^2 . \] (V.2) Operation $(\nabla \times \mathbf{n})^2$ can be written in each grid cell as: \[ \nabla \times \mathbf{n} = \begin{bmatrix} \partial_y^{0.5.5}n_z-\partial_z^{0.5.5}n_y\\ \partial_z^{.50.5}n_x-\partial_x^{.50.5}n_z\\ \partial_x^{.5.50}n_y-\partial_y^{.5.50}n_x \end{bmatrix} . \] Then, the $(\nabla \times \mathbf{n})^2$ term of the energy may be written as sum: \begin{multline*} \int_V(\nabla \times \mathbf{n})^2 = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \left[ (\partial_y n_z-\partial_z n_y)^2 \right]^{ij+.5k+.5} +\\+ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ (\partial_z n_x-\partial_x n_z)^2 \right]^{i+.5jk+.5} + \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ (\partial_x n_y-\partial_y n_x)^2 \right]^{i+.5j+.5k} , \end{multline*} and the resulting expressions can be written in terms of the values of $\mathbf{n}$ on the lattice: \[ \left[ (\partial_y n_z-\partial_z n_y)^2 \right]^{ij+.5k+.5}= \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right]^2 , \] \[ \left[ (\partial_z n_x-\partial_x n_z)^2 \right]^{i+.5jk+.5} = \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}})-n_z^{\{ijk\}}) \right]^2, \] \[ \left[ (\partial_x n_y-\partial_y n_x)^2 \right]^{i+.5j+.5k} = \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})- (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right]^2 . \] (V.3) Operation $\mathbf{n} \cdot (\nabla \times \mathbf{n})$ can be written in each grid cell as: \[ \mathbf{n} \cdot (\nabla \times \mathbf{n}) = \begin{bmatrix} n_x^{0.5.5} \\ n_y^{.50.5} \\ n_z^{.5.50} \end{bmatrix} \begin{bmatrix} \partial_y^{0.5.5}n_z-\partial_y^{0.5.5}n_z \\ \partial_z^{.50.5}n_x-\partial_x^{.50.5}n_z \\ \partial_x^{.5.50}n_y-\partial_y^{.5.50}n_x \end{bmatrix} \] Then, the $\mathbf{n} \cdot (\nabla \times \mathbf{n})$ term of the energy may be written as sum: \begin{multline*} \int_V \mathbf{n} \cdot (\nabla \times \mathbf{n}) = \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \left[ n_x(\partial_y n_z-\partial_y n_z) \right]^{ij+.5k+.5} +\\+ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ n_y (\partial_z n_x-\partial_x n_z) \right]^{i+.5jk+.5} + \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ n_z (\partial_x n_y-\partial_y n_x) \right]^{i+.5j+.5z} , \end{multline*} and the resulting expressions can be written in terms of the values of $\mathbf{n}$ on the lattice: \begin{multline*} \left[ n_x(\partial_y n_z-\partial_y n_z) \right]^{ij+.5k+.5} = \frac{1}{8} \Big[ n_x^{\{ijk\}}+n_x^{\{ij+1k\}}+n_x^{\{ijk+1\}}+n_x^{\{ij+1k+1\}} +\\+ n_x^{\{i-1jk\}}+n_x^{\{i-1j+1k\}}+n_x^{\{i-1jk+1\}}+n_x^{\{i-1j+1k+1\}} \Big] \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] , \end{multline*} \begin{multline*} \left[ n_y (\partial_z n_x-\partial_x n_z) \right]^{i+.5jk+.5} = \frac{1}{8} \Big[ n_y^{\{ijk\}}+n_y^{\{i+1jk\}}+n_y^{\{ijk+1\}}+n_y^{\{i+1jk+1\}} +\\+ n_y^{\{ij-1k\}}+n_y^{\{i+1j-1k\}}+n_y^{\{ij-1k+1\}}+n_y^{\{i+1j-1k+1\}} \Big] \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right] , \end{multline*} \begin{multline*} \left[ n_z (\partial_x n_y-\partial_y n_x) \right]^{i+.5j+.5z} = \frac{1}{8} \Big[ n_z^{\{ijk\}}+n_z^{\{ij+1k\}}+n_z^{\{i+1jk\}}+n_z^{\{i+1j+1k\}} +\\+ n_z^{\{ijk-1\}}+n_z^{\{ij+1k-1\}}+n_z^{\{i+1jk-1\}}+n_z^{\{i+1j+1k-1\}} \Big] \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})-(n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] . \end{multline*} (V.4) The $(\mathbf{n}\cdot \mathbf{H})^2$ term of the energy may be written as sum: \begin{multline*} \int_V(\mathbf{n}\cdot \mathbf{H})^2 = \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} C_r^i C_t^j C_t^k \left[ (n_x H_x)^2 \right]^{i+.5jk} +\\+ \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_t^i C_r^j C_t^k \left[ (n_yH_y)^2 \right]^{ij+.5k} + \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_t^i C_t^j C_r^k \left[ (n_z H_z)^2 \right]^{ijk+.5} , \end{multline*} and the resulting expressions can be written in terms of the values of $\mathbf{n}$ on the lattice: \[ \left[ (n_x H_x)^2 \right]^{i+.5jk} = \left( n_x^{\{ijk\}} H_x^{\{ijk\}} \right)^2, \] \[ \left[ (n_y H_y)^2 \right]^{ij+.5k} = \left( n_y^{\{ijk\}} H_y^{\{ijk\}} \right)^2 , \] \[ \left[ (n_z H_z)^2 \right]^{ijk+.5} = \left( n_z^{\{ijk\}} H_z^{\{ijk\}} \right)^2 . \] \subsection{Gradient of energy} Consider the gradient in $\mathbf{n}$ in the lattice model as an analogue of the energy variation in the continuous model. To write such an expression, we take the gradient from each of the energy components in the lattice model in the direction $\mathbf{n}$. (VI.1) Consider the gradient of each component $(\nabla \mathbf{n})^2$ at a lattice site $\{ijk\}$: \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{j=0}^{N_y} \sum_{k=0}^{N_z} C_t^iC_t^jC_t^k \left[ (n_x^{\{ijk\}}-n_x^{\{i-1jk\}})^2+ (n_y^{\{ijk\}}-n_y^{\{ij-1k\}})^2+ (n_z^{\{ijk\}}-n_z^{\{ijk-1\}})^2 \right] \right] =\\= 2 \begin{bmatrix} C_t^i C_t^{j} C_t^k (n_x^{\{ijk\}}-n_x^{\{i-1jk\}}) - C_r^{i+1} C_r^j C_t^k (n_x^{\{i+1jk\}}-n_x^{\{ijk\}}) \\ C_t^i C_t^{j} C_t^k (n_y^{\{ijk\}}-n_y^{\{ij-1k\}}) - C_r^i C_r^{j+1} C_t^k (n_y^{\{ij+1k\}}-n_y^{\{ijk\}}) \\ C_t^i C_t^{j} C_t^k (n_z^{\{ijk\}}-n_z^{\{ijk-1\}}) - C_r^i C_r^j C_t^{k+1} (n_z^{\{ijk+1\}}-n_z^{\{ijk\}}) \end{bmatrix}, \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})^2 + (n_x^{\{ij+1k\}}-n_x^{\{ijk\}})^2 \right] \right] =\\= 2 \begin{bmatrix} C_r^i C_r^{j-1} C_t^k (n_x^{\{ijk\}}-n_x^{\{ij-1k\}}) - C_r^i C_r^j C_t^k (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \\ C_r^{i-1} C_r^{j} C_t^k (n_y^{\{ijk\}}-n_y^{\{i-1jk\}}) - C_r^i C_r^j C_t^k (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) \\ 0 \end{bmatrix}, \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ (n_z^{\{i+1jk\}}-n_z^{\{ijk\}})^2+ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})^2 \right] \right] =\\= 2 \begin{bmatrix} C_r^i C_t^{j} C_r^{k-1} (n_x^{\{ijk\}}-n_x^{\{ijk-1\}}) - C_r^i C_t^j C_r^k (n_x^{\{ijk+1\}}-n_x^{\{ijk\}}) \\ 0 \\ C_r^{i-1} C_t^{j} C_r^k (n_z^{\{ijk\}}-n_z^{\{i-1jk\}}) - C_r^i C_t^j C_r^k (n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \end{bmatrix} , \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}}\left[\sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1}C_t^i C_r^j C_r^k[(n_z^{\{ij+1k\}}-n_z^{\{ijk\}})^2+ (n_y^{\{ijk+1\}}n_y^{\{ijk\}})^2]\right] =\\= 2 \begin{bmatrix} 0 \\ C_t^i C_r^{j} C_r^{k-1} (n_y^{\{ijk\}}-n_y^{\{ijk-1\}}) - C_t^i C_r^j C_r^k (n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \\ C_t^{i} C_r^{j-1} C_r^k (n_z^{\{ijk\}}-n_z^{\{ij-1k\}}) - C_t^i C_r^j C_r^k (n_z^{\{ij+1k\}}-n_z^{\{ijk\}}) \end{bmatrix}. \end{multline*} (VI.2) Consider the gradient of each component $(\nabla \times \mathbf{n})^2$ at a lattice site $\{ijk\}$: \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right]^2 \right] =\\= 2 \begin{bmatrix} 0 \\ C_t^i C_r^j C_r^k \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] - C_t^i C_r^j C_r^{k-1} \left[ (n_z^{\{ij+1k-1\}}-n_z^{\{ijk-1\}})-(n_y^{\{ijk\}}-n_y^{\{ijk-1\}}) \right] \\ - C_t^i C_r^j C_r^k \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] + C_t^i C_r^{j-1} C_r^k \left[ (n_z^{\{ijk\}}-n_z^{\{ij-1k\}})-(n_y^{\{ij-1k+1\}}-n_y^{\{ij-1k\}}) \right] \end{bmatrix}, \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right]^2 \right] =\\= 2 \begin{bmatrix} - C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right] + C_r^i C_t^j C_r^{k-1} \left[ (n_x^{\{ijk\}}-n_x^{\{ijk-1\}})-(n_z^{\{i+1jk-1\}}-n_z^{\{ijk-1\}}) \right] \\ 0 \\ C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right] + C_r^{i-1} C_t^j C_r^k \left[ (n_x^{\{i-1jk+1\}}-n_x^{\{i-1jk\}})-(n_z^{\{ijk\}}-n_z^{\{i-1jk\}}) \right] \end{bmatrix}, \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right]^2 \right] =\\= 2 \begin{bmatrix} C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] - C_r^i C_r^{j-1} C_t^k \left[ (n_y^{\{i+1j-1k\}}-n_y^{\{ij-1k\}})- (n_x^{\{ijk\}}-n_x^{\{ij-1k\}}) \right] \\ - C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})- (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] + C_r^{i-1} C_r^j C_t^k \left[ (n_y^{\{ijk\}}-n_y^{\{i-1jk\}})- (n_x^{\{i-1j+1k\}}-n_x^{\{i-1jk\}}) \right] \\ 0 \end{bmatrix}. \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right]^2 \right] =\\= 2 \begin{bmatrix} - C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right] + C_r^i C_t^j C_r^{k-1} \left[ (n_x^{\{ijk\}}-n_x^{\{ijk-1\}})-(n_z^{\{i+1jk-1\}}-n_z^{\{ijk-1\}}) \right] \\ 0 \\ C_r^i C_t^j C_r^k \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}}-n_z^{\{ijk\}}) \right] + C_r^{i-1} C_t^j C_r^k \left[ (n_x^{\{i-1jk+1\}}-n_x^{\{i-1jk\}})-(n_z^{\{ijk\}}-n_z^{\{i-1jk\}}) \right] \end{bmatrix}, \end{multline*} \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \left[ \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right]^2 \right] =\\= 2 \begin{bmatrix} C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] - C_r^i C_r^{j-1} C_t^k \left[ (n_y^{\{i+1j-1k\}}-n_y^{\{ij-1k\}}) - (n_x^{\{ijk\}}-n_x^{\{ij-1k\}}) \right] \\ - C_r^i C_r^j C_t^k \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})- (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] + C_r^{i-1} C_r^j C_t^k \left[ (n_y^{\{ijk\}}-n_y^{\{i-1jk\}})- (n_x^{\{i-1j+1k\}}-n_x^{\{i-1jk\}}) \right] \\ 0 \end{bmatrix}. \end{multline*} (VI.3) Consider each of the components of the gradient of each component $\mathbf{n} \cdot (\nabla \times \mathbf{n})$ at a lattice site $\{ijk\}$: \begin{multline*} \partial_{n^{\{ijk\}}_x} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \Big[ n_x^{\{ijk\}}+ n_x^{\{ij+1k\}}+ n_x^{\{ijk+1\}}+ n_x^{\{ij+1k+1\}} +\\+ n_x^{\{i-1jk\}}+ n_x^{\{i-1j+1k\}}+ n_x^{\{i-1jk+1\}}+ n_x^{\{i-1j+1k+1\}} \Big] \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] \Bigg] =\\= \frac{1}{8} \bigg[ C_t^i C_r^j C_r^k \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] +\\+ C_t^i C_r^{j-1} C_r^k \left[ (n_z^{\{ijk\}}-n_z^{\{ij-1k\}})-(n_y^{\{ij-1k+1\}}-n_y^{\{ij-1k\}}) \right] +\\+ C_t^i C_r^j C_r^{k-1} \left[ (n_z^{\{ij+1k-1\}}-n_z^{\{ijk-1\}})-(n_y^{\{ijk\}}-n_y^{\{ijk-1\}}) \right] +\\+ C_t^i C_r^{j-1} C_r^{k-1} \left[ (n_z^{\{ijk-1\}}-n_z^{\{ij-1k-1\}})-(n_y^{\{ij-1k\}}-n_y^{\{ij-1k-1\}}) \right] +\\+ C_t^{i+1} C_r^j C_r^k \left[ (n_z^{\{i+1j+1k\}}-n_z^{\{i+1jk\}})-(n_y^{\{i+1jk+1\}}-n_y^{\{i+1jk\}}) \right] +\\+ C_t^{i+1} C_r^{j-1} C_r^k \left[ (n_z^{\{i+1jk\}}-n_z^{\{i+1j-1k\}})-(n_y^{\{i+1j-1k+1\}}-n_y^{\{i+1j-1k\}}) \right] +\\+ C_t^{i+1} C_r^j C_r^{k-1} \left[ (n_z^{\{i+1j+1k-1\}}-n_z^{\{i+1jk-1\}})-(n_y^{\{i+1jk\}}-n_y^{\{i+1jk-1\}}) \right] +\\+ C_t^{i+1} C_r^{j-1} C_r^{k-1} \left[ (n_z^{\{i+1jk-1\}}-n_z^{\{i+1j-1k-1\}})-(n_y^{\{i+1j-1k\}}-n_y^{\{i+1j-1k-1\}}) \right] \bigg ] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_y} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \Big[ n_x^{\{ijk\}}+n_x^{\{ij+1k\}}+n_x^{\{ijk+1\}}+n_x^{\{ij+1k+1\}} +\\+ n_x^{\{i-1jk\}}+n_x^{\{i-1j+1k\}}+n_x^{\{i-1jk+1\}}+n_x^{\{i-1j+1k+1\}} \Big] \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] \Bigg] =\\= -\frac{1}{8} \bigg[ C_t^i C_r^j C_r^{k-1} \left[ n_x^{\{ijk-1\}}+ n_x^{\{ij+1k-1\}}+ n_x^{\{ijk\}}+ n_x^{\{ij+1k\}}+ n_x^{\{i-1jk-1\}}+ n_x^{\{i-1j+1k-1\}}+ n_x^{\{i-1jk\}}+ n_x^{\{i-1j+1k\}} \right] -\\- C_t^i C_r^j C_r^k \left[ n_x^{\{ijk\}}+ n_x^{\{ij+1k\}}+ n_x^{\{ijk+1\}}+ n_x^{\{ij+1k+1\}}+ n_x^{\{i-1jk\}}+ n_x^{\{i-1j+1k\}}+ n_x^{\{i-1jk+1\}}+ n_x^{\{i-1j+1k+1\}} \right] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_z} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z-1} C_t^i C_r^j C_r^k \Big[ n_x^{\{ijk\}}+n_x^{\{ij+1k\}}+n_x^{\{ijk+1\}}+n_x^{\{ij+1k+1\}} +\\+ n_x^{\{i-1jk\}}+n_x^{\{i-1j+1k\}}+n_x^{\{i-1jk+1\}}+n_x^{\{i-1j+1k+1\}} \Big] \left[ (n_z^{\{ij+1k\}}-n_z^{\{ijk\}})-(n_y^{\{ijk+1\}}-n_y^{\{ijk\}}) \right] \Bigg] =\\= \frac{1}{8} \bigg[ C_t^i C_r^{j-1} C_r^k \Big[ n_x^{\{ij-1k\}}+ n_x^{\{ijk\}}+ n_x^{\{ij-1k+1\}}+ n_x^{\{ijk+1\}}+ n_x^{\{i-1j-1k\}}+ n_x^{\{i-1j-1k\}}+ n_x^{\{i-1j-1k+1\}}+ n_x^{\{i-1jk+1\}} \Big] -\\- C_t^i C_r^j C_r^k \Big[ n_x^{\{ijk\}}+ n_x^{\{ij+1k\}}+ n_x^{\{ijk+1\}}+ n_x^{\{ij+1k+1\}}+ n_x^{\{i-1jk\}}+ n_x^{\{i-1j+1k\}}+ n_x^{\{i-1jk+1\}}+ n_x^{\{i-1j+1k+1\}} \Big] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_x} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \Big[ n_y^{\{ijk\}}+n_y^{\{i+1jk\}}+n_y^{\{ijk+1\}}+n_y^{\{i+1jk+1\}} +\\+ n_y^{\{ij-1k\}}+n_y^{\{i+1j-1k\}}+n_y^{\{ij-1k+1\}}+n_y^{\{i+1j-1k+1\}} \Big] \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}})-n_z^{\{ijk\}}) \right] \Bigg] =\\= \frac{1}{8} \bigg[ C_r^i C_t^j C_r^{k-1} \left[ n_y^{\{ijk-1\}}+ n_y^{\{i+1jk-1\}}+ n_y^{\{ijk\}}+ n_y^{\{i+1jk\}}+ n_y^{\{ij-1k-1\}}+ n_y^{\{i+1j-1k-1\}}+ n_y^{\{ij-1k\}}+ n_y^{\{i+1j-1k\}} \right] -\\- C_r^i C_t^j C_r^k \left[ n_y^{\{ijk\}}+ n_y^{\{i+1jk\}}+ n_y^{\{ijk+1\}}+ n_y^{\{i+1jk+1\}}+ n_y^{\{ij-1k\}}+ n_y^{\{i+1j-1k\}}+ n_y^{\{ij-1k+1\}}+ n_y^{\{i+1j-1k+1\}} \right] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_y} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^{i} C_t^{j} C_r^{k} \Big[ n_y^{\{ijk\}}+n_y^{\{i+1jk\}}+n_y^{\{ijk+1\}}+n_y^{\{i+1jk+1\}} +\\+ n_y^{\{ij-1k\}}+n_y^{\{i+1j-1k\}}+n_y^{\{ij-1k+1\}}+n_y^{\{i+1j-1k+1\}} \Big] \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}})-n_z^{\{ijk\}}) \right] \Bigg] =\\= \frac{1}{8} \bigg[ C_r^{i} C_t^{j} C_r^{k} \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}})-n_z^{\{ijk\}}) \right] +\\+ C_r^{i-1} C_t^{j} C_r^{k} \left[ (n_x^{\{i-1jk+1\}}-n_x^{\{i-1jk\}})-(n_z^{\{ijk\}})-n_z^{\{i-1jk\}}) \right] +\\+ C_r^{i} C_t^{j} C_r^{k-1} \left[ (n_x^{\{ijk\}}-n_x^{\{ijk-1\}})-(n_z^{\{i+1jk-1\}})-n_z^{\{ijk-1\}}) \right] +\\+ C_r^{i-1} C_t^{j} C_r^{k-1} \left[ (n_x^{\{i-1jk\}}-n_x^{\{i-1jk-1\}})-(n_z^{\{ijk-1\}})-n_z^{\{i-1jk-1\}}) \right] +\\+ C_r^{i} C_t^{j+1} C_r^{k} \left[ (n_x^{\{ij+1k+1\}}-n_x^{\{ij+1k\}})-(n_z^{\{i+1j+1k\}})-n_z^{\{ij+1k\}}) \right] +\\+ C_r^{i-1} C_t^{j+1} C_r^{k} \left[ (n_x^{\{i-1j+1k+1\}}-n_x^{\{i-1j+1k\}})-(n_z^{\{ij+1k\}})-n_z^{\{i-1j+1k\}}) \right] +\\+ C_r^{i} C_t^{j+1} C_r^{k-1} \left[ (n_x^{\{ij+1k-1\}}-n_x^{\{ij+1k-1\}})-(n_z^{\{i+1j+1k-1\}})-n_z^{\{ij+1k-1\}}) \right] +\\+ C_r^{i-1} C_t^{j+1} C_r^{k-1} \left[ (n_x^{\{i-1j+1k\}}-n_x^{\{i-1j+1k-1\}})-(n_z^{\{ij+1k-1\}}-n_z^{\{i-1j+1k-1\}}) \right] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_z} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_r^i C_t^j C_r^k \Big[ n_y^{\{ijk\}}+n_y^{\{i+1jk\}}+n_y^{\{ijk+1\}}+n_y^{\{i+1jk+1\}} +\\+ n_y^{\{ij-1k\}}+n_y^{\{i+1j-1k\}}+n_y^{\{ij-1k+1\}}+n_y^{\{i+1j-1k+1\}} \Big] \left[ (n_x^{\{ijk+1\}}-n_x^{\{ijk\}})-(n_z^{\{i+1jk\}})-n_z^{\{ijk\}}) \right] \Bigg] =\\= - \frac{1}{8} \bigg[ C_r^{i-1} C_t^j C_r^k \left[ n_y^{\{i-1jk\}}+n_y^{\{ijk\}}+n_y^{\{i-1jk+1\}}+n_y^{\{ijk+1\}}+n_y^{\{i-1j-1k\}}+n_y^{\{ij-1k\}}+n_y^{\{i-1j-1k+1\}}+n_y^{\{ij-1k+1\}} \right] -\\- C_r^i C_t^j C_r^k \left[ n_y^{\{ijk\}}+ n_y^{\{i+1jk\}}+ n_y^{\{ijk+1\}}+ n_y^{\{i+1jk+1\}}+ n_y^{\{ij-1k\}}+ n_y^{\{i+1j-1k\}}+ n_y^{\{ij-1k+1\}}+ n_y^{\{i+1j-1k+1\}} \right] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_x} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \Big[ n_z^{\{ijk\}}+n_z^{\{ij+1k\}}+n_z^{\{i+1jk\}}+n_z^{\{i+1j+1k\}} +\\+ n_z^{\{ijk-1\}}+n_z^{\{ij+1k-1\}}+n_z^{\{i+1jk-1\}}+n_z^{\{i+1j+1k-1\}} \Big] \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] \Bigg] =\\= - \frac{1}{8} \bigg[ C_r^i C_r^{j-1} C_t^k \Big[ n_z^{\{ij-1k\}}+ n_z^{\{ijk\}}+ n_z^{\{i+1j-1k\}}+ n_z^{\{i+1jk\}}+ n_z^{\{ij-1k-1\}}+ n_z^{\{ijk-1\}}+ n_z^{\{i+1j-1k-1\}}+ n_z^{\{i+1jk-1\}} \Big] -\\- C_r^i C_r^j C_t^k \Big[ n_z^{\{ijk\}}+n_z^{\{ij+1k\}}+n_z^{\{i+1jk\}}+n_z^{\{i+1j+1k\}}+n_z^{\{ijk-1\}}+n_z^{\{ij+1k-1\}}+n_z^{\{i+1jk-1\}}+n_z^{\{i+1j+1k-1\}} \Big] \bigg] , \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_y} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \Big[ n_z^{\{ijk\}}+ n_z^{\{ij+1k\}}+ n_z^{\{i+1jk\}}+ n_z^{\{i+1j+1k\}} +\\+ n_z^{\{ijk-1\}}+ n_z^{\{ij+1k-1\}}+ n_z^{\{i+1jk-1\}}+ n_z^{\{i+1j+1k-1\}} \Big] \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] \Bigg] =\\= \frac{1}{8} \bigg[ C_r^{i-1} C_r^j C_t^k \Big[ n_z^{\{i-1jk\}}+ n_z^{\{i-1j+1k\}}+ n_z^{\{ijk\}}+ n_z^{\{ij+1k\}}+ n_z^{\{i-1jk-1\}}+ n_z^{\{i-1j+1k-1\}}+ n_z^{\{ijk-1\}}+ n_z^{\{ij+1k-1\}} \Big] -\\- C_r^i C_r^j C_t^k \left[ n_z^{\{ijk\}}+ n_z^{\{ij+1k\}}+ n_z^{\{i+1jk\}}+ n_z^{\{i+1j+1k\}}+ n_z^{\{ijk-1\}}+ n_z^{\{ij+1k-1\}}+ n_z^{\{i+1jk-1\}}+ n_z^{\{i+1j+1k-1\}} \right] \bigg], \end{multline*} \begin{multline*} \partial_{n^{\{ijk\}}_z} \Bigg[ \frac{1}{8} \sum_{i=0}^{N_x-1} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_r^i C_r^j C_t^k \Big[ n_z^{\{ijk\}}+n_z^{\{ij+1k\}}+n_z^{\{i+1jk\}}+n_z^{\{i+1j+1k\}} +\\+ n_z^{\{ijk-1\}}+n_z^{\{ij+1k-1\}}+n_z^{\{i+1jk-1\}}+n_z^{\{i+1j+1k-1\}} \Big] \Big[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}})- (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \Big] \Bigg] =\\= \frac{1}{8} \bigg[ C_r^{i} C_r^{j} C_t^{k} \left[ (n_y^{\{i+1jk\}}-n_y^{\{ijk\}}) - (n_x^{\{ij+1k\}}-n_x^{\{ijk\}}) \right] +\\+ C_r^{i} C_r^{j-1} C_t^{k} \left[ (n_y^{\{i+1j-1k\}}-n_y^{\{ij-1k\}}) - (n_x^{\{ijk\}}-n_x^{\{ij-1k\}}) \right] +\\+ C_r^{i-1} C_r^{j} C_t^{k} \left[ (n_y^{\{ijk\}}-n_y^{\{i-1jk\}}) - (n_x^{\{i-1j+1k\}}-n_x^{\{i-1jk\}}) \right] +\\+ C_r^{i-1} C_r^{j-1} C_t^{k} \left[ (n_y^{\{ij-1k\}}-n_y^{\{i-1j-1k\}}) - (n_x^{\{i-1jk\}}-n_x^{\{i-1j-1k\}}) \right] +\\+ C_r^{i} C_r^{j} C_t^{k+1} \left[ (n_y^{\{i+1jk+1\}}-n_y^{\{ijk+1\}}) - (n_x^{\{ij+1k+1\}}-n_x^{\{ijk+1\}}) \right] +\\+ C_r^{i} C_r^{j-1} C_t^{k+1} \left[ (n_y^{\{i+1j-1k+1\}}-n_y^{\{ij-1k+1\}}) - (n_x^{\{ijk+1\}}-n_x^{\{ij-1k+1\}}) \right] +\\+ C_r^{i-1} C_r^{j} C_t^{k+1} \left[ (n_y^{\{ijk+1\}}-n_y^{\{i-1jk+1\}}) - (n_x^{\{i-1j+1k+1\}}-n_x^{\{i-1jk+1\}}) \right] +\\+ C_r^{i-1} C_r^{j-1} C_t^{k+1} \left[ (n_y^{\{ij-1k+1\}}-n_y^{\{i-1j-1k+1\}}) - (n_x^{\{i-1jk+1\}}-n_x^{\{i-1j-1k+1\}}) \right] \bigg] . \end{multline*} (VI.4) Consider the gradient of $(\mathbf{n}\cdot \mathbf{H})^2$ at a lattice site $\{ijk\}$: \begin{multline*} \partial_{\mathbf{n}^{\{ijk\}}} \Bigg[ \sum_{k=0}^{N_z} C_r^i C_t^j C_t^k \left( n_x^{\{ijk\}} H_x^{\{ijk\}} \right)^2 + \sum_{i=0}^{N_x} \sum_{j=0}^{N_y-1} \sum_{k=0}^{N_z} C_t^i C_r^j C_t^k \left( n_y^{\{ijk\}} H_y^{\{ijk\}} \right)^2 + \\ \sum_{i=0}^{N_x} \sum_{j=0}^{N_y} \sum_{k=0}^{N_z-1} C_t^i C_t^j C_r^k \left( n_z^{\{ijk\}} H_z^{\{ijk\}} \right)^2 \Bigg] = 2\begin{bmatrix} C_r^i C_t^j C_t^k \left( n_x^{\{ijk\}} H_x^{\{ijk\}} \right) \\ C_t^i C_r^j C_t^k \left( n_y^{\{ijk\}} H_y^{\{ijk\}} \right) \\ C_t^i C_t^j C_r^k \left( n_z^{\{ijk\}} H_z^{\{ijk\}} \right) \end{bmatrix} . \end{multline*} After substituting the expressions (V.1-V.4) into the equation \eqref{eq:energy_lattice}, one can find the expression for the liquid crystal energy in the lattice approximation with a shift of the director components. Using the same equation and expressions (VI.1-VI.4) one can obtain an equation for the energy variation. \section*{Acknowledgements} This work was supported by the Foundation for the Advancement of Theoretical Physics and Mathematics ‘BASIS’ under Grant No. 19-1-1-12-5. \bibliographystyle{plain}
\section*{Introduction} The \textit{region select game} that was produced in 2010 \cite{Shi2, Shi} and later released as a game app for Android \cite{And}, is a game played on knot diagrams. The region select game begins with a knot diagram that is initially endowed with two colors, either by $0$ or $1$, at its crossings, and played by selecting a number of regions (an area enclosed by the arcs of the diagram) of the knot diagram. Each choice of a region of the diagram results in the crossing colors which lie on the boundary of the region to be increased by $1$ modulo $2$. The aim of the game is to turn the color of each crossing of the knot diagram to $0$ (or to $1$) by selecting a number of regions. Shimizu showed \cite{Shi} that the region select game is always solvable, that is, for any initial color configuration of crossings there exists a choice of regions which turns the color of each crossing to $0$. In \cite{Shi} a \textit{region crossing change} move is defined to be a local transformation of the knot diagram that is applied on a region and changes the type of each crossing that lie on the boundary of the region. By encoding an over-crossing with $1$ and an under-crossing with $0$, it is clear that any knot diagram corresponds to a knot diagram given with an initial color configuration at its crossings. The solvability of the region select game follows from the result of Shimuzi that any knot diagram can be turned into an unknot diagram by a sequence of region crossing change moves \cite{Shi}. In \cite{Che}, Cheng and Gao showed that the result holds for two-component link diagrams if and only if their linking numbers are even. Soon after in 2012, Ahara and Suzuki \cite{AhSu} extended the region select game to an integral setting by introducing the \textit{integral region choice problem}. In the integral choice problem, one starts the game with a knot diagram that is endowed with colors labeled by integers at its crossings. Then, an integer is assigned to a region of the knot diagram. The assigned integer on the region changes the integer label on the crossings that lie in the boundary of the region according to two counting rules. In the first counting rule, named as \textit{the single counting rule}, the integer label on each crossing of the boundary of the integer-labeled region is increased by $n$, where $n$ is the integer assigned to the region. In the second counting rule, named as \textit{the double counting rule}, when an integer is assigned to a region, the integer labels on the crossings of the boundary that meet with the region once are increased by $n$, and the integer labels on the crossings of the boundary that meet with the region twice are increased by $2n$. In \cite{AhSu}, the authors showed that the integral region choice problem considered with respect to both of these rules is always solvable. In \cite{Kaw}, Kawamura gave a necessary and sufficient condition for the solvability of two-component links diagrams. In this paper, we introduce the $k$-color region select game that is the modulo $k$ extension of Shimizu's region select game, when $k$ is an integer greater than $2$. In this game, crossings of a knot diagram are initially colored by integers $0,1,...,k-1$. The game is played by pushing (selecting) a number of regions of the knot diagram. Each push of a region increases the color of the crossings at the boundary of the region by $1$ modulo $k$. The aim of the game is to make the color of every crossing $0$ by applying a push pattern to the regions. See Figure \ref{fig:example} for a knot diagram given with an initial coloring configuration. The integers on the regions of the knot diagram denote the required number of pushes on them to turn each vertex color to $0$ modulo $3$. Similar to the integral region choice problem of Ahara and Suzuki, we also define versions of the game for the cases $2 \leq k< \infty$ and $k=\infty$ with modified rules of counting. \begin{figure}[H] \centering \includegraphics[scale=.2]{examplegame1.pdf} \caption{A solution of a 3-color region select game played on a diagram of the knot $6_2$ \cite{Rotable}} \label{fig:example} \end{figure} Let us now give an outline of our paper. In Section \ref{sec:prem}, we review fundamental notions from knot theory and graph theory that are required throughout the paper. In Section \ref{sec:game}, we introduce the $k$-color region select game both for an integer $k$ that is greater than or equal to $2$ and for $k=\infty$. In Section \ref{sec:solvable} we prove that any version of the $k$-color region select game introduced in this paper, is always solvable on knot diagrams. In Sections \ref{sec:reduced} and \ref{sec:assertions} we examine the number of solving patterns for a given initial coloring configuration that are obtained without pushing certain regions of a knot diagram. We note here that the always solvability of the $k$-color region select game with the versions corresponding to the single and double counting rule, can be directly deduced from the always solvability of the integral region choice problem. However this does not make our proof redundant. In fact, the proofs of the always solvability of the integral region choice problem and the original ($2$-color) region select game are mostly knot theoretic where Reidemeister moves and checkerboard shadings of knot diagrams are used. On the other hand, our proof utilizes mostly linear algebra and few fundamental facts on regular curves (indeed we almost only utilize the fact that a knot diagram is an orientable closed curve). This enables us to prove the always solvability of the other versions of the region select game that are introduced in this paper that cannot be drawn directly from the arguments in \cite{AhSu}. In particular, with our proof method we also prove the always solvability of the integral region choice problem, not only for the single and double counting rule, but also for any arbitrary counting rule. With the arguments in our paper, the following questions are also answered. \begin{enumerate} \item How many solutions are there for a given initial color configuration? \item How many initial color configuration can we solve without pushing certain regions? \item Do there exist certain regions such that any initial color configuration can be solved without pushing them? \item Do the answers of the above questions depend on the value of $k$, the version of the game, and the type of the knot diagram? If so, how? \end{enumerate} \section{Preliminaries}\label{sec:prem} We shall begin by presenting basic definitions that we will be using throughout the paper. \begin{definition}\normalfont A \textit{link} with $n$ components is a smooth embedding of a union of $n$ unit circles, $S^1$ into $\mathbb{R}^3$, where $n \geq 1$. In particular, a link with one component is called a \textit{knot}. \end{definition} \begin{definition}\normalfont A \textit{link diagram} (or a \textit{knot diagram}) $D$ is a regular projection of a link (or a knot) into the $2$-sphere, $S^2$ with a finite number of transversal self-intersection points. Each self-intersection point of the projection curve is endowed either with over or under passage information to represent the weaving of the link in $\mathbb{R}^3$, and is called a \textit{crossing} of $D$. \end{definition} \begin{definition}\normalfont A crossing of a link diagram is called \textit{reducible} if there exists a circle in the plane of the diagram that meets the diagram transversely only at that crossing. A crossing is called \textit{irreducible} if it is not reducible. \end{definition} \begin{definition} \normalfont We call a component of a \textit{link diagram} without any crossing on it a \textit{loop}. \end{definition} It is clear that a loopless link diagram with $n$ crossings overlies a unique planar graph with $n$ four-valent vertices that is obtained by ignoring the weaving information at the crossings. By abusing the terminology, we extend this association to any link diagram by considering each loop component as a graph with one edge and no vertices. We also call the underlying graph of a link or a knot diagram a \textit{link diagram} or a \textit{knot diagram}, respectively. By a simple application of the Jordan curve theorem and Euler's formula, one can see that any knot diagram with $n$ vertices divides $S^2$ into $n+2$ regions for $n \geq 0$. \begin{definition} \normalfont For a link diagram $D$ on $S^2$, \textit{regions} of $D$ are defined as the connected components of $S^2 \backslash D$. A vertex $v$ (an edge $e$) is said to be \textit{incident} to a region $r$ and vice versa if $v$ ($e$, respectively) is in the boundary of $r$. Two regions of $D$ are called \textit{adjacent} if they are incident to the same edge. Similarly, two edges of $D$ are called \textit{adjacent} if they are incident to the same vertex. \end{definition} \begin{definition}\normalfont Let $D$ be a link diagram. The \textit{dual graph} of $D$ is the graph obtained by adding a vertex to each region of $D$ and an edge between each pair of vertices that lie on adjacent regions. \end{definition} \begin{figure}[H] \centering \includegraphics[scale=.2]{dualgraph.pdf} \caption{The dual graph of a diagram of the knot $6_2$} \label{fig:example} \end{figure} \section{$k$-color region select game}\label{sec:game} In this section, we introduce \textit{$k$-color region select game} as well as its modified versions that are all played on a knot diagram $D$, both for the cases $2 \leq k < \infty$ and $k=\infty$.\\ \textit{The $k$-color region select game when $2 \leq k < \infty$} :\\ We select $k$ colors and give a labeling to these colors as $color\,0,\, color \,1, ..., \\ color\, k-1$. Then we take an initial color configuration of vertices of $D$ by using these colors. The game is played by pushing regions of $D$. When a region is pushed, every vertex incident to the region changes its color by the following rule. The $color \,i$ changes to the $color \,i+1$ for $i\neq k-1$ and the $color\, k-1$ changes to the $color\, 0$. The aim of the game is to reach to the \textit{off color} configuration, in which every vertex is in $color \,0$ state, by applying a push pattern on regions for a given initial color configuration. \\ \textit{The $k$-color region select game when $k=\infty$}:\\ In this game, we have infinitely many colors labeled as $...,color\,-2,\, color \,-1,\, color \,0,\, color \,1,\,color \,2,...$. An initial color configuration of vertices of $D$ is obtained by a finite choice of these colors. Each push of a region is assigned to either to $1$ or $-1$, and is called a \textit{positive} or \textit{negative} push, respectively. When a positive (negative, respectively) push is applied to a region, color label of every vertex incident to the region increases (decreases, respectively) by $1$. The aim of the game is the same as in the finite case, to reach to the off color configuration by applying a signed push pattern for a given initial color configuration. \begin{definition}\normalfont Let $C$ denote an initial color configuration of a link diagram $D$. If there exists a push pattern $P$ of regions of $D$ which brings $C$ to the off color configuration then $C$ is called \textit{solvable} and $P$ is a solving pattern for $C$. \end{definition} \begin{definition}\normalfont If every initial color configuration of vertices of $D$ is solvable then $D$ is called \textit{always solvable} in the $k$-color region select game. \end{definition} Let $D$ have $n$ vertices and $m$ regions and let us enumerate the vertices and regions of $D$ as $\{v_1,...,v_n\}$, $\{r_1,...,r_m\}$, respectively. It is easy to observe that the order of the pushes has no importance. Moreover, for $k<\infty$, pushing a region $k$ times is equivalent to not to push it. For $k=\infty$, the net number of pushes, that is equal to the sum of signs of the pushes made, is important. Precisely, the color label of the vertices that are incident to the regions pushed change by the net number of pushes. Let $\mathbb{Z}_k$ denote the quotient ring ${\mathbb{Z}} /{ k \mathbb{Z}}$ when $k<\infty$, and it denotes $\mathbb{Z}$ when $k=\infty$. We identify a push pattern of regions by a column vector $\mathbf{p}=(p_1,..., p_m)^t \in \mathbb{Z}_k^m$ such that $\mathbf{p}(r_i):=p_i$ is the number of times the region $r_i$ is pushed modulo $k$ if $k<\infty$, and the net number of pushes of $r_i$ if $k=\infty$. Similarly, we identify a color configuration of vertices by a column vector $\mathbf{c}=(c_1,..., c_n)^t \in \mathbb{Z}_k^n$ such that $\mathbf{c}(v_i)=c_i$ is the label number of the color of the vertex $v_i$ in the configuration. The $n \times m$ \textit{vertex-region incidence matrix} $M_0=M_0(D)$ of $D$ is constructed as follows \cite{Che} \begin{align} (M_0)_{ij}= \left\{ \begin{array}{cc} 1 & \;\;\text{if}\;\;\;\; v_i\; \text{is incident to}\; r_j \\ 0 & \;\;\text{otherwise} \\ \end{array} \right\}. \end{align} Let $\mathbf{c}_{in}$ be an initial color configuration of vertices of $D$ and $\mathbf{c}_{fin}$ be the final state configuration obtained after applying a push pattern $\mathbf{p}$. One can observe that the following equation characterizes the relation among $\mathbf{c}_{in}$,$\mathbf{c}_{fin}$, and $\mathbf{p}$ over $\mathbb{Z}_k$ in a simple algebraic way. \begin{equation} \label{maineqn} \mathbf{c}_{in}+M_0(D)\mathbf{p}=\mathbf{c}_{fin}. \end{equation} We now introduce the modified versions of the game that are played with the rules explained below. \\ \emph{Modified rules of the game for $k<\infty$}: Take a link diagram $D$ and fix some $k<\infty$. Let $v$ be a vertex of $D$. \begin{enumerate} \item If $v$ is irreducible choose a number $a\in \mathbb{Z}_k$ which is not a zero divisor. Then define the new rule for this vertex such that a push on a region incident to $v$ increases the color label of $v$ by $a$ modulo $k$. \item If $v$ is reducible, choose three numbers $a_0, a_1, a_2 \in \mathbb{Z}_k$ such that $a_1$ and $a_2$ are not zero divisors. Let $r_0$, $r_1$, and $r_2$ be the regions incident to $v$ where $r_0$ is the region which touches $v$ from two sides. Then define the rule for this vertex such that a push on the incident region $r_i$ increases the color label of $v$ by $a_i$ modulo $k$ for $i=0,1, 2$. Let us call these numbers we choose for each vertex region pair $v$-$r$, \emph{the increment number of} $v$\emph{ with respect to the region} $r$ or \emph{the increment number of} $v$-$r$ \emph{pair}. Note that the increment number of $v$ is the same with respect to each incident region of $v$ if $v$ is irreducible, but it can be chosen differently for each incident region of $v$ if $v$ is reducible. \\ \end{enumerate} \emph{Modified rules of the game for $k=\infty$}: \begin{enumerate} \item The increment number of the incident vertex-region pairs $v$-$r$ is taken $1$ as in the original game if $v$ is irreducible, or if $v$ is reducible and $r$ is a region which touches $v$ from one side. \item If $v$ is a reducible vertex and $r$ is the region which touches $v$ from two sides, then the increment number of $v$-$r$ pair is allowed to be any number. \end{enumerate} The rules mentioned above and every choice of increment numbers induce different versions of the $k$-color region select game for $2 \leq k\leq\infty$. The game where all increment numbers are taken as $1$ corresponds to the original game, hence the modified versions are generalizations of the original game for $2 \leq k\leq\infty$. Although the complexity of the game is increased by these modifications, it will turn out that always solvability of the game is not affected as we show in Section \ref{sec:solvable}. Therefore, in the sequel, we consider the modified versions of the game. Note also that in the case of $k=\infty$, we allow the increment number of $v$-$r$ pair where $v$ is a reducible vertex and $r$ is the region which touches $v$ from two sides to be any number. When this number taken as $1$ or $2$ for all reducible vertices, the version corresponds to the integral choice problem for single or double counting rule \cite{AhSu}, respectively. \begin{definition}\normalfont Let $D$ be a link diagram with vertices labeled as $\{v_1,...,v_n\}$ and regions $\{r_1,...,r_{m}\}$ and $G$ be a version of the $k$-color region select game on $D$ induced by the choice of $k$ and the set of increment numbers. We define the \textit{game matrix} $M=M(D,G)$ \emph{over} $\mathbb{Z}_k$ \emph{corresponding to the diagram} $D$ and \emph{the game} $G$ such that $(M)_{ij}$ is equal to the increment number of the vertex $v_i$ with respect to the region $r_j$ if $v_i$ and $r_j$ are incident, and zero otherwise. \end{definition} Similar to the original game, in the game $G$, a final state color configuration $\mathbf{c}_{fin}$ is obtained after applying a push pattern ${\bf p}$ to an initial color configuration $\mathbf{c}_{in}$ if and only if \begin{equation} \label{maineqn2} \mathbf{c}_{in}+M(D,G)\mathbf{p}=\mathbf{c}_{fin} \;\;\text{over} \;\; \mathbb{Z}_k. \end{equation} Let us denote the kernel and column space of a matrix $A$ over the ring $\mathbb{Z}_k$ by $Ker_k(A)$ and $Col_k(A)$, respectively. Then, from the above algebraic formulation we immediately obtain the following facts. \begin{fact} An initial color configuration $\mathbf{c}$ of the vertices of $D$ is solvable in the game $G$ if and only if $\mathbf{c}\in Col_k(M)$. Indeed, $\mathbf{p}$ is a solving pattern for $\mathbf{c}$ if and only if \begin{equation} M\mathbf{p}=-\mathbf{c}. \end{equation} \end{fact} \begin{fact} \label{fact2} $D$ is always solvable in $G$ if and only if $Col_k(M)=\mathbb{Z}_k^n$. \end{fact} \begin{fact} \label{fact3} In the case $k<\infty$, for every solvable configuration $\mathbf{c}$, there exist exactly $s$ solving patterns where $s= |Ker_k(M)|$. \end{fact} We also have the following proposition. \begin{prop} \label{propker} In the case $k<\infty$, $D$ is always solvable in $G$ if and only if $|Ker_k(M)|=k^{m-n}$. \end{prop} \begin{proof} Since the matrix multiplication is a homomorphism of modules, by the fundamental theorem of homomorphisms we have\\ $$|Col_k(M)||Ker_k(M)|=|\mathbb{Z}_k^m|=k^m.$$ Then the result follows by Fact \ref{fact2}. \end{proof} \begin{definition}\normalfont Let $A$ be a matrix over $\mathbb{Z}_k$, where $k\leq \infty$. A pattern is called a \emph{null pattern} of $A$ if it belongs to $Ker_k(A)$. \end{definition} We have the following proposition. \begin{prop} \label{propmn} Let $D$ be a link diagram with $n$ vertices and $m$ regions on which we play a version of the $k$-color region select game $G$ where $k< \infty $. Let $M$ be the corresponding game matrix. Fix $i \geq 0$ regions of $D$. Let $j$ be the number of null patterns of $M$ where these regions are not pushed. Then, there are $k^{m-i}/ j$ initial color configurations that can be solved without pushing these regions. If there are $m-n$ regions where the only null pattern of $M$ these regions are not pushed is the trivial pattern $\mathbf{0}$, then, $D$ is always solvable in $G$. Moreover, any initial color configuration can be solved uniquely without pushing these regions. \end{prop} \begin{proof} Take an enumeration of the regions of $D$ such that the regions we fix are $r_{m-i+1},..., r_m$. For a vector $\mathbf{p}=(p_1,...,p_{m-i})^t\in\mathbb{Z}^{m-i}_k$, define the zero extension vector $\mathbf{p_e}=(p_1,...,p_{m-i},0,...,0)^t\in\mathbb{Z}^m_k$. Let $\widetilde{M}$ be the $n\times (m-i)$ matrix obtained from $M$ by deleting the last $i$ columns. Then, $\widetilde{M}\mathbf{p}=M\mathbf{p_e}$. Therefore $\mathbf{p}\in Ker_k(\widetilde{M})$ if and only if $\mathbf{p_e}\in Ker_k(M)$. Hence, $j=|Ker_k(\widetilde{M})|$. Moreover, if an initial color configuration can be solved without pushing the regions $r_{m-i+1},..., r_m$, it must belong to $Col_k(\widetilde{M})$. On the other hand, $|Col_k(\widetilde{M})|= k^{m-i} / |Ker_k(\widetilde{M})|$ by the fundamental theorem of homomorphisms. Hence, there are $k^{m-i}/ j$ number of initial color configurations that can be solved without pushing these regions. If there are $m-n$ regions where the only null pattern these regions are not pushed is the trivial pattern $\mathbf{0}$, then $i=m-n$ and $j=1$. Hence, $Ker_k(\widetilde{M})=\{\mathbf{0}\}$, and $ |Col_k(\widetilde{M})|= k^n $. Since $k^n$ is the number of all possible initial color configurations, this implies that any initial color configuration can be solved uniquely without pushing these regions. In particular, $D$ is always solvable. \end{proof} \section{Knot Diagrams are always solvable}\label{sec:solvable} In this section, we show that knot diagrams are always solvable with respect to any version of the $k$-color region select game for any $k \leq \infty$. \begin{definition}\normalfont For a fixed $k\leq \infty$, a vertex $v$ is said to be \emph{balanced} with respect to a push pattern $\mathbf{p}$ if the sum of the pushes of regions incident to $v$ is zero modulo $k$ in $\mathbf{p}$. \end{definition} \begin{lem} \label{lem:bal} Let $M$ be a game matrix of a link diagram $D$ over $\mathbb{Z}_k$, where $k\leq\infty$, and $\boldsymbol{\ell}$ be a null pattern of $M$. Then, any irreducible vertex of $D$ is balanced with respect to $\boldsymbol{\ell}$. \end{lem} \begin{proof} Let $v$ be an irreducible vertex of $D$ and let $a$ be the increment number of $v$ with respect to all its incident regions in the version of the $k$-color region select game corresponding to $M$. Let $r_1,...,r_4$ be the regions incident to $v$. Then, $(M\boldsymbol{\ell})(v)= a(\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)+\boldsymbol{\ell}(r_3)+\boldsymbol{\ell}(r_4))$. On the other hand, since $\boldsymbol{\ell}$ is a null pattern of $M$, $M\boldsymbol{\ell}=0$. Hence $a(\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)+\boldsymbol{\ell}(r_3)+\boldsymbol{\ell}(r_4))=0$. By the rules of the game $a=1$ if $k=\infty$ and $a$ is not a zero divisor of $\mathbb{Z}_k$ for $k<\infty$. Hence, $\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)+\boldsymbol{\ell}(r_3)+\boldsymbol{\ell}(r_4)=0$, which means $v$ is balanced. \end{proof} \begin{definition}\normalfont The \emph{push number} $\sigma_{\bf p}(e)$ \emph{of an edge} $e$ \emph{with respect to a push pattern} ${\bf p}$ is the sum of the pushes of the regions incident to $e$ in ${\bf p}$ modulo $k$. More precisely, if $e$ is incident to the regions $r_1$ and $r_2$, then $\sigma_{\bf p}(e)= {\bf p}(r_1)+ {\bf p}(r_2)$ $\mod$ $k$. \end{definition} We have the following lemma. \begin{lem} \label{lempush} Let $D$ be an oriented reduced knot diagram and $\boldsymbol{\ell}$ be a null pattern of a game matrix $M$ of $D$ over $\mathbb{Z}_k$, where $k\leq \infty$. Then, there exists $s\in \mathbb{Z}_k$ such that $\sigma_{\boldsymbol{\ell}}(e)=s$ or $-s$ for every edge $e$ of $D$. Moreover, for any pair of adjacent edges $e_1$ and $e_2$ which are not incident to the same region, $\sigma_{\boldsymbol{\ell}}(e_1)=s$ if and only if $\sigma_{\boldsymbol{\ell}}(e_2)=-s$. \end{lem} \begin{proof} Let $e_1$ and $e_2$ be two adjacent edges that meet at a vertex $v$ and are not incident to the same region. Let $r_1,...,r_4$ be the regions incident to $v$ such that $r_1$ and $r_2$ are incident to $e_1$, $r_3$ and $r_4$ are incident to $e_2$. Let $\sigma_{\boldsymbol{\ell}}(e_1)=s$, for some $s\in\mathbb{Z}_k $. This means $\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)=s$. On the other hand, since $D$ is a reduced knot diagram, $v$ is an irreducible vertex. Hence by Lemma \ref{lem:bal}, it is balanced with respect to $\boldsymbol{\ell}$, i.e; $\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)+\boldsymbol{\ell}(r_3)+\boldsymbol{\ell}(r_4)=0$. This implies $\sigma_{\boldsymbol{\ell}}(e_2)=\boldsymbol{\ell}(r_3)+\boldsymbol{\ell}(r_4)=-s$. Let us start to travel along $D$ starting from a point on $e_1$ by following the orientation on $D$. Using the above argument inductively, we see that the push number of any edge with respect to $\boldsymbol{\ell}$ on our path cannot assume any value other than $s$ or $-s$. Since $D$ is a closed curve this means every edge of $D$ has a push number which is either $s$ or $-s$. \end{proof} \begin{lem} \label{mainlemma} Let $D$ be a knot diagram, $v$ be an irreducible vertex of $D$, and $\boldsymbol{\ell}$ be a null pattern of a game matrix $M$ of $D$ over $\mathbb{Z}_k$ where $k\leq \infty$. Then, two non-adjacent regions incident to $v$ are pushed by the same number of times in $\boldsymbol{\ell}$. \end{lem} \begin{proof} First assume that $D$ is a reduced knot diagram. Let $e_1,...,e_4$ and $r_1,...,r_4$ be the edges and regions incident to $v$, respectively, which are oriented as in Figure \ref{fig:edges}. Without loss of generality we can assume that $\sigma_{\boldsymbol{\ell}}(e_1)=\sigma_{\boldsymbol{\ell}}(e_2)=s$, and $\sigma_{\boldsymbol{\ell}}(e_3)=\sigma_{\boldsymbol{\ell}}(e_4)=-s$ for some $s\in\mathbb{Z}_k$ by Lemma \ref{lempush}. Then, $\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_4)=\sigma_{\boldsymbol{\ell}}(e_1)=\sigma_{\boldsymbol{\ell}}(e_2)=\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r_2)$. Hence, $\boldsymbol{\ell}(r_4)=\boldsymbol{\ell}(r_2)$. \begin{figure}[H] \centering \includegraphics[scale=.25]{Fig2.pdf} \caption{Edges and regions that are incident to a vertex} \label{fig:edges} \end{figure} Let now $D$ be any knot diagram which contains reducible crossings. We first endow it with an orientation and construct the link diagram $D'$ obtained from $D$ by applying oriented smoothing operation simultaneously to every reducible vertex of $D$. We illustrate an example of this procedure in Figure \ref{fig:reducible}. Note that the oriented smoothing operation when applied to a reducible vertex preserves the vertex-region structure of irreducible crossings of the diagram. This means that a game matrix $M'$ of $D'$ can be constructed from $M$ by deleting the rows corresponding to the reducible vertices. Therefore, regions of $D$ and $D'$ can be identified and any null pattern of $M$ is also a null pattern of $M'$, in particular $\boldsymbol{\ell}$. Moreover $D'$ is the union of disjoint components. Let $D''$ be the component of $D'$ which contains $v$. We can construct a game matrix $M''$ of $D''$ by deleting the columns of $M'$ corresponding to the regions whose boundary does not intersect $D''$. Then the restriction $\boldsymbol{\ell}_{res}$ of $\boldsymbol{\ell}$ to the regions of $D''$ is a null pattern of $M''$. Since $D''$ is a reduced knot diagram, by the first part of the proof, two non-adjacent regions incident to $v$ are pushed by the same number of times in $\boldsymbol{\ell}_{res}$, hence in $\boldsymbol{\ell}$. \begin{figure}[H] \centering \includegraphics[scale=.25]{Fig1.pdf} \caption{A knot diagram containing reducible crossings} \label{fig:reducible} \end{figure} \end{proof} \begin{prop} \label{prop0} Let $D$ be a knot diagram, $M$ be a game matrix of $D$ over $\mathbb{Z}_k$, where $k\leq \infty$. Then, the only null pattern of $M$ where two adjacent regions of $D$ are not pushed is the trivial pattern $\mathbf{0}$. \end{prop} \begin{proof} Let $\boldsymbol{\boldsymbol{\ell}}$ be a null pattern where two adjacent regions $r_1$ and $r_2$ are not pushed. Let $v$ be a vertex incident to both $r_1$ and $r_2$. First assume that $v$ is an irreducible vertex. Let $r_3$, $r_4$ be the other two regions incident to $v$. Since $r_1$ and $r_2$ are not pushed in $\boldsymbol{\ell}$, one of the regions $r_3$ or $r_4$ should not be pushed either by Lemma \ref{mainlemma}. Assume without loss of generality that $r_3$ is not pushed. On the other hand $v$ must be balanced with respect to $\boldsymbol{\ell}$ by Lemma \ref{lem:bal}. Since $r_1,r_2,r_3$ are not pushed, this implies $r_4$ is not pushed either. Now assume that $v$ is a reducible vertex. Then, there is only one more region, call it $r$, which is incident to $v$ other than $r_1$ and $r_2$. Note that the regions which touch $v$ from one side cannot be adjacent to each other, so either $r_1$ or $r_2$ is the region which touches $v$ from both sides. Hence, $r$ touches $v$ from one side. Therefore the increment number $a$ of $v$ with respect to $r$ is not a zero divisor. Since $r_1$ and $r_2$ are not pushed $(M\boldsymbol{\ell})(v)=a\boldsymbol{\ell}(r)$. On the other hand, since $\boldsymbol{\ell}$ is a null pattern $M\boldsymbol{\ell}=0$. Hence $a\boldsymbol{\ell}(r)=0$. Since $a$ is not a zero divisor we conclude that $\boldsymbol{\ell}(r)=0$, i.e, $r$ is not pushed. Using induction on the number of vertices, this argument shows us, by traveling the underlying curve of $D$, starting from the edge incident to $r_1$ and $r_2$ we can never reach a pushed region. Since $D$ is a closed curve, this means that there is no pushed region in $D$, hence $\boldsymbol{\boldsymbol{\ell}}$ is the trivial null pattern $\mathbf{0}$. \end{proof} Now we are ready to state our main result. \begin{thm} \label{propadj} Every knot diagram is always solvable in any version of the $k$-color region select game for all $k\leq\infty$. Moreover, any initial color configuration can be solved uniquely without pushing any two adjacent regions. \end{thm} \begin{proof} Since the difference between the number of regions and number of vertices of a knot diagram is $2$, in the case $k<\infty$, the result follows by Proposition \ref{propmn} and Proposition \ref{prop0}. In the case $k=\infty$, Let $D$ be a knot diagram with $n$ vertices, $\{r_1,...,r_{n+2}\}$ be an enumeration of the regions of $D$ so that $r_{n+1}$ and $r_{n+2}$ are adjacent. Then take a game matrix $M$ of $D$ over $\mathbb{Z}$. Let $\widetilde{M}$ be the $n\times n$ matrix obtained from $M$ by deleting its last two columns. Then, Proposition \ref{prop0} implies that $ Ker_\infty(\widetilde{M})=\{\mathbf{0}\}$ (See the proof of Proposition \ref{propmn} for a more detailed explanation). This is equivalent to say that the column vectors of $\widetilde{M}$ (equivalently first $n$ column vectors of $M$) are linearly independent in the $\mathbb{Z}$-module $\mathbb{Z}^n$. Let us denote these column vectors by $\mathbf{c}_1,...,\mathbf{c}_n$. Let $\mathbf{c}$ be an arbitrary vector in $\mathbb{Z}^n$ corresponding to an initial color configuration. It is an elementary fact that $\mathbb{Z}^n$ has rank $n$. Therefore, any set of vectors which has more than $n$ elements is linearly dependent in $\mathbb{Z}^n$. Hence, there are integers $q_1,...,q_n$, and $q$, some of which are nonzero, such that \begin{equation} \label{eqnlin} q_1\mathbf{c}_1+...+q_n\mathbf{c}_n + q \mathbf{c}=\mathbf{0}. \end{equation} Note that $q$ cannot be zero, otherwise $\mathbf{c}_1,...,\mathbf{c}_n$ would be linearly dependent. Equation \eqref{eqnlin} is equivalent to the following matrix equation \begin{equation} \label{eqnmat} M \begin{bmatrix} q_{1} \\ \vdots \\ q_{n}\\ 0\\ 0 \end{bmatrix}= - q \mathbf{c}. \end{equation} Multiplying \eqref{eqnlin} by $-1$ if necessary, we can assume that $q > 0$. Our aim is to show that $q_i$ is divisible by $q$ for $i=1,...,n$. Since this is trivially true if $q=1$, assume further that $q$ is greater than $1$. Then, we can consider the above equation in modulo $q$ and obtain \begin{equation} \label{eqnmod} \overline{M} \begin{bmatrix} \overline{q_{1}} \\ \vdots \\ \overline{q_{n}}\\ 0\\ 0 \end{bmatrix}= \mathbf{0}, \end{equation} where $\overline{q_{i}}= q_i$ mod $q$ for $i=1,...,n$ and $\overline{M}$ is the matrix whose entries are given by $(\overline{M})_{ij}= (M)_{ij}$ mod $q$. It is easy to observe that $\overline{M}$ is a game matrix of $D$ over $\mathbb{Z}_q$. This observation, together with Proposition \ref{prop0}, immediately implies that $\overline{q_{i}}=0$ for $i=1,...,n$. So all $q_i$'s are divisible by $q$. Then, there exist numbers $p_1,..., p_n$ such that $q_i=q p_i$ for $i=1,...,n$, and by equation \eqref{eqnmat} we obtain \begin{equation} \label{eqnmat2} M \begin{bmatrix} p_{1} \\ \vdots \\ p_{n}\\ 0\\ 0 \end{bmatrix}= - \mathbf{c}. \end{equation} Since $M$ is an arbitrary game matrix over $\mathbb{Z}$, and $\mathbf{c}$ is an arbitrary initial color configuration, the above equation means that $D$ is always solvable in any version of the $\infty$-color region select game and any initial color configuration can be solved without pushing any two adjacent regions. Uniqueness follows from the fact that $ Ker_\infty(\widetilde{M})=\{\mathbf{0}\}$. \end{proof} \begin{thm} \label{thmker} Let $D$ be a knot diagram, $M$ be a game matrix of $D$ over $\mathbb{Z}_k$ where $k< \infty$. Then, $|Ker_k(M)|=k^2$ . \end{thm} \begin{proof} This follows from Proposition \ref{propker} and Theorem \ref{propadj}. \end{proof} \begin{prop} \label{thmker} For any knot diagram $D$, there are $k^2$ number of solving push patterns for each initial color configuration in any version of the $k$-color region select game for $k<\infty$. \end{prop} \begin{proof} This follows directly from Fact \ref{fact3} and Theorem \ref{propadj}. \end{proof} We also have the following proposition. \begin{prop} \label{propab} Let $D$ be a knot diagram on which we play a version of the $k$-color region select game, where $k\leq\infty$. Let $a, b \in \mathbb{Z}_k$. Fix two regions adjacent to each other. Then, for any initial color configuration, there is a unique solving pattern where one of the regions is pushed $a$ times and the other is pushed $b$ times. In particular, any null pattern of any game matrix of $D$ over $\mathbb{Z}_k$ is uniquely determined by its value on two adjacent regions. \end{prop} \begin{proof} Let $M$ be a game matrix of $D$ over $\mathbb{Z}_k$, $\mathbf{c}$ be an initial color configuration of vertices of $D$. Assume that the adjacent regions we fix corresponds to the last two columns of $M$. Then, consider the color configuration \begin{equation} \mathbf{\widetilde{c}}:= \mathbf{c}+ M\begin{bmatrix} 0 \\ \vdots \\ 0\\ a\\ b \end{bmatrix}. \end{equation} By Theorem \ref{propadj}, there is a unique solving push pattern $(p_1,...,p_n,0,0)^t$ for $\mathbf{\widetilde{c}}$, where $n$ is the number of vertices of $D$. Hence, \begin{equation} M\begin{bmatrix} p_1 \\ \vdots \\ p_n\\ 0\\ 0 \end{bmatrix}= -\mathbf{c}- M\begin{bmatrix} 0 \\ \vdots \\ 0\\ a\\ b \end{bmatrix}, \end{equation} which implies $M\mathbf{p}=-\mathbf{c}$, where $\mathbf{p}= (p_1,...,p_n,a,b)^t$. Hence $\mathbf{p}$ is a desired solving pattern for $\mathbf{c}$. For uniqueness, assume that there is another solving pattern $\mathbf{q}:=(q_1,...,q_n,a,b)^t$ for $\mathbf{c}$. Then, $\mathbf{p}-\mathbf{q}$ would be a null pattern of $M$ where two adjacent regions are not pushed. By Proposition \ref{prop0}, $\mathbf{p}=\mathbf{q}$. \end{proof} \section{Game on reduced knot diagrams}\label{sec:reduced} In this section, we examine the $k$-color region select game further for reduced knot diagrams. \begin{definition}\normalfont A shading of the regions of a link diagram $D$ is called a \textit{checkerboard shading} if for any pair of adjacent regions of $D$, one of the regions is shaded and the other one is unshaded. It is well-known that all link diagrams admit a checkerboard shading \cite{Ka}. \end{definition} \begin{thm} \label{thm2} Let $D$ be a reduced knot diagram with $n$ vertices on which we play the $2$-color region select game. Fix a checkerboard shading on $D$. Then, any initial color configuration can be solved uniquely without pushing one shaded and one unshaded region. In general, there are $2^{n+2-i}$ number of initial color configurations which can be solved without pushing $i$ number of regions which contains one shaded and one unshaded region. Moreover, there are $2^{n+1-i}$ number of initial color configurations which can be solved without pushing $i$ number of shaded regions or $i$ number of unshaded regions. \end{thm} \begin{proof} Take a checkerboard shading of $D$. Consider the following push patterns $\boldsymbol{\ell}_0$, $\boldsymbol{\ell}_1$, $\boldsymbol{\ell}_2$, and $\boldsymbol{\ell}_3$, where $\boldsymbol{\ell}_0$ is the zero pattern; $\boldsymbol{\ell}_1$ is the pattern where only shaded regions are pushed; $\boldsymbol{\ell}_2$ is the pattern where only unshaded regions are pushed; and $\boldsymbol{\ell}_3$ is the pattern where all regions are pushed. It is easy to see that all of these are null patterns of the incidence matrix $M_0(D)$ which corresponds to the $2$-color region select game matrix of $D$. Moreover, they form the set of all nonzero null patterns since $Ker_2(M_0)=4$ by Theorem \ref{thmker}. Note that the only null pattern where at least one shaded and one unshaded region are not pushed is the zero pattern $\boldsymbol{\ell}_0$. The null patterns where any number of unshaded regions are not pushed are $\boldsymbol{\ell}_0$ and $\boldsymbol{\ell}_1$. And lastly, the null patterns where any number of shaded regions are not pushed are $\boldsymbol{\ell}_0$ and $\boldsymbol{\ell}_2$. Hence, the result follows by Proposition \ref{propmn} . \end{proof} \begin{definition}\normalfont The \textit{distance} $d(r_1,r_2)$ between two regions $r_1$ and $r_2$ of a link diagram $D$ is defined to be the distance between the vertices corresponding to $r_1$ and $r_2$ in the dual graph of $D$. \end{definition} \begin{lem} \label{lemdis} Let $D$ be a reduced knot diagram and $\boldsymbol{\ell}$ be a null pattern of a game matrix $M$ of $D$ over $\mathbb{Z}_k$ where $k\leq \infty$. Let $s\in \mathbb{Z}_k$ be the push number of some edge $e$ of $D$ with respect to $\boldsymbol{\ell}$. Fix a checkerboard shading on $D$. Let $r_1$ and $r_2$ be two shaded or two unshaded regions. Then $\boldsymbol{\ell}(r_1)= \boldsymbol{\ell}(r_2) +2is$ mod $k$, where $i$ is an integer satisfying $|2i|\leq d(r_1,r_2)$. \end{lem} \begin{proof} Consider the case where $d(r_1,r_2)=2$. So there is a region, call it $r$, which is adjacent to both $r_1$ and $r_2$. Let $e_1$ and $e_2$ be the edges incident to $r_1$, $r$ and $r_2$, $r$, respectively. Then, $\boldsymbol{\ell}(r_1)- \boldsymbol{\ell}(r_2)=\boldsymbol{\ell}(r_1)+\boldsymbol{\ell}(r)- \boldsymbol{\ell}(r)- \boldsymbol{\ell}(r_2)=\sigma_{\ell}(e_1)-\sigma_{\ell}(e_2)$. On the other hand, $\sigma_{\ell}(e_1)= s$ or $-s$, similarly $\sigma_{\ell}(e_2)= s$ or $-s$ by Lemma \ref{lempush}. Considering every possible case, we obtain $\boldsymbol{\ell}(r_1)- \boldsymbol{\ell}(r_2)=0$, $-2s$, or $2s$. The general case follows by applying induction on the distance of $r_1$ and $r_2$. \end{proof} \begin{thm} \label{thmp} Let $D$ be a reduced knot diagram on which we play a version of the $k$-color region select game, where $k< \infty$. Fix a checkerboard shading on $D$. Then, for $k=2^n$, $n\in \mathbb{N}$, any initial color configuration can be solved uniquely without pushing one shaded and one unshaded region. For other values of $k$, let $p$ be the smallest odd prime factor of $k$. Then, any initial color configuration can be solved uniquely without pushing one shaded and one unshaded region if the distance between the regions is less than $p$. \end{thm} \begin{proof} Let $r_1$ be a shaded and $r_2$ be an unshaded region. Let $M$ be the game matrix of $D$ over $\mathbb{Z}_k$ corresponding to the version of the game we play on $D$. Let $\boldsymbol{\ell}$ be a null pattern of $M$, on which $r_1$ and $r_2$ are not pushed. Let $r$ be a shaded region, adjacent to $r_2$, such that $d(r_1,r_2)=d(r_1,r)+1$. Note that, if $e$ is an edge between $r_2$ and $r$, then $\sigma_{\boldsymbol{\ell}}(e)=\boldsymbol{\ell}(r)$ since $\boldsymbol{\ell}(r_2)=0$. Hence, by Lemma \ref{lemdis}, we have \begin{equation} \label{eqn2i} 0=\boldsymbol{\ell}(r_1)= (2i+1)\boldsymbol{\ell}(r) \mod k, \end{equation} where $|2i|\leq d(r_1,r)$. If $k=2^n$ for some $n\in \mathbb{N}$, then $2i+1$ mod $k$ cannot be a zero divisor of $\mathbb{Z}_k$, hence (\ref{eqn2i}) implies $\boldsymbol{\ell}(r)=0$. For other values of $k$, assume further that $d(r_1,r_2) < p$. Note that $|2i+1|\leq |2i|+1 \leq d(r_1,r_2)< p $. Hence, $2i+1$ mod $k$ cannot be a zero divisor of $\mathbb{Z}_k$, and therefore $\boldsymbol{\ell}(r)=0$ for this case as well. Since $r_2$ and $r$ are adjacent, and $\boldsymbol{\ell}(r)=\boldsymbol{\ell}(r_2)=0$, we have $\boldsymbol{\ell}=\boldsymbol{0}$ by Proposition \ref{prop0}. Then the result follows by Proposition \ref{propmn}. \end{proof} \subsection{Game on reduced alternating sign diagrams}\label{sec:reducedalternating} Take a checkerboard shading of a link diagram $L$. Assume that one of the subsets of regions, shaded or unshaded ones, admits an alternating $``+, -"$ signing where every vertex is incident to two regions with opposite signs, as exemplified in Figure \ref{fig:alternating}. Then, the subset of regions which admits such signing is called an \textit{alternating subset of regions}. \begin{definition}\normalfont A link diagram that has an alternating subset of its regions is called an \textit{alternating sign diagram}. \end{definition} We have the following proposition. \begin{figure}[H] \centering \includegraphics[scale=.25]{Fig3.pdf} \caption{An alternating sign diagram} \label{fig:alternating} \end{figure} \begin{prop} Take a checkerboard shading of a link diagram $L$. Then, the unshaded regions are alternating if and only if each connected component of the boundary of each shaded region, except the simple loop ones, have all even number of edges, and vice versa. \end{prop} \begin{proof} $(\Rightarrow)$ Let $\Gamma$ be a connected component of the boundary of a shaded region other than a loop. Take an alternating signing of unshaded regions and sign each edge of $\Gamma$ by the sign of its incident unshaded region. Then the signs of successive edges must be different while we travel along $\Gamma$ in one direction. Otherwise, the vertex between two successive edges would be incident to two unshaded regions with the same sign, which contradicts with the definition of the alternating signing. Hence, the signs of edges alternate while we travel along $\Gamma$ in one direction. Since $\Gamma$ is connected this is only possible if $\Gamma$ has even number of edges. $(\Leftarrow)$ Note that the claim holds true for the link diagrams with zero and one vertex. Suppose the claim holds true for all links with $n-1$ vertices. Now let $L$ be a link with $n$ vertices which satisfies the assumption of the claim. If $L$ does not have any irreducible vertex then it has a vertex on a curl. Removing this vertex with an oriented smoothing as in Figure \ref{fig:orientedsmooth} gives us a link $L'$ with $n-1$ vertices which also satisfies the assumption of the claim. By the induction hypothesis unshaded regions of $L'$ admits an alternating signing. Changing the sign of the region $r$, shown in Figure \ref{fig:orientedsmooth}, if necessary, we see that an alternating signing of unshaded regions of $L'$ induces an alternating signing of unshaded regions of $L$ by reversing the oriented smoothing operation while keeping the sings of the regions. If $L$ has an irreducible vertex $u$, apply a smoothing to $u$ so that the shaded regions incident to $u$ are connected, as shown in Figure \ref{fig:smoothing}. Then the resulting link $L''$ has $n-1$ vertices and it also satisfies the assumption of the claim. By induction hypothesis the unshaded regions of $L''$ admit an alternating signing. Note that the regions $r_1$ and $r_2$, shown in Figure \ref{fig:smoothing} must have opposite signs. Therefore by reversing the smoothing operation while keeping the signs of the unshaded regions of $L''$, we obtain an alternating signing of the unshaded regions of $L$. \end{proof} \begin{figure}[H] \centering \includegraphics[scale=.15]{Fig5.pdf} \caption{Oriented smoothing of a vertex on a curl} \label{fig:orientedsmooth} \end{figure} \begin{figure}[H] \centering \includegraphics[scale=.3]{Fig4.pdf} \caption{A smoothing of an irreducible vertex} \label{fig:smoothing} \end{figure} \begin{cor} Take a checkerboard shading of a knot diagram $D$. Then, the unshaded regions are alternating if and only if all shaded regions are incident to even number of edges, and vice versa. \end{cor} \begin{thm} \label{thmk} Let $D$ be a reduced knot diagram with $n$ vertices on which we play a version of the $k$-color region select game, where $k\leq \infty$. Assume that $D$ admits an alternating signing of its unshaded regions in a checkerboard shading of $D$. Then the followings hold. 1) Any initial color configuration can be solved uniquely without pushing one shaded and one unshaded region. 2) If $k$ is an odd number, then any initial color configuration can be solved uniquely without pushing two unshaded regions with opposite signs. 3) In general, let $S$ be a set of $i$ number of regions, and $q$ be the number of initial color configurations which can be solved without pushing the regions in $S$. Then, $q=k^{n+2-i}$ if $S$ contains one shaded and one unshaded region. $q=k^{n+1-i}$ if $S$ consists of shaded regions or unshaded regions with the same sign. $q=k^{n+2-i}$ for $k$ is odd, and $q=k^{n+2-i}/2$ for $k$ is even if $S$ consists of unshaded regions not all of which have the same sign. \end{thm} \begin{proof} We start by proving claim (3). Fix a version of the $k$-color region select game and let $M$ be the corresponding game matrix of $D$ over $\mathbb{Z}_k$. By Proposition \ref{propmn}, $q=k^{n+2-i}/j$ where $j$ is the number of null patterns of $M$ where the regions in $S$ are not pushed. Hence we just need to determine what $j$ is for each case. To do that let us investigate the form of null patterns. Let $a,b\in \mathbb{Z}_k$, and consider the push pattern $\boldsymbol{\ell}_{a,b}$ where $\boldsymbol{\ell}_{a,b}(r)=a$ if $r$ is a shaded region, $\boldsymbol{\ell}_{a,b}(r)=b$ if $r$ is an unshaded region with a plus sign, and $\boldsymbol{\ell}_{a,b}(r)=-b-2a$ (mod $k$) if $r$ is an unshaded region with a minus sign. Then $\boldsymbol{\ell}_{a,b}$ is a null pattern of $M$ for every choice of $a$ and $b$ because $D$ is a reduced knot diagram. Moreover, by Proposition \ref{propab}, all null patterns of $M$ must be in the form of $\boldsymbol{\ell}_{a,b}$. If one shaded and one unshaded region are not pushed in a null pattern $\boldsymbol{\ell}_{a,b}$, then $a$ and $b$ must be zero which corresponds to the zero null pattern. Hence $j=1$ and $q=q=k^{n+2-i}$. If a set of shaded regions are not pushed in a null pattern $\boldsymbol{\ell}_{a,b}$, then $a=0$ and $b$ can take any value in $\mathbb{Z}_k$. So there are $k$ number of such null patterns. Hence, $j=k$ and $q=k^{n+1-i}$. If a set of unshaded regions with the same signs are not pushed in a null pattern $\boldsymbol{\ell}_{a,b}$, then either $b=0$ or $b+2a=0$. In both cases, value of $a$ determines all possible null patterns. So there are $k$ number of such null patterns. Hence, $j=k$ and $q=k^{n+1-i}$. If a set of unshaded regions are not pushed in a null pattern $\boldsymbol{\ell}_{a,b}$ and at least two regions have opposite signs, then $b=0$ and $2a=0$. If $k$ is odd, then $2$ cannot be a zero divisor of $\mathbb{Z}_k$, hence $a=0$ as well. Then $\boldsymbol{\ell}_{a,b}$ corresponds to the zero null pattern, i.e., $j=1$. On the other hand, if $k$ is even, then $2a=0$ has two solutions $a=0$ and $a=k/2$, which correspond to two null patterns, i.e., $j=2$. Hence, $q=k^{n+2-i}$ if $k$ is odd, and $q=k^{n+2-i}/2$ if $k$ is even. This completes the proof of claim (3). Claim (3) implies claim (2) and claim (1) in the case $k<\infty$. Hence it remains to prove claim (1) in the case $k=\infty$. Note that the patterns $\boldsymbol{\ell}_{a,b}$ when $a,b\in \mathbb{Z}$ form the set of all null patterns of any game matrix of $D$ over $\mathbb{Z}$, as well. Hence, for all $k\leq \infty$ the only null pattern of any game matrix of $D$ over $\mathbb{Z}_k$ where one shaded and one unshaded region are not pushed is the trivial pattern $\mathbf{0}$. In other words, Proposition \ref{prop0} still holds true when we replace two adjacent region by one shaded and one unshaded region in the case $D$ is an alternating sign diagram. Therefore, we can repeat the proof of Theorem \ref{propadj} replacing two adjacent regions by one shaded and one unshaded region. Hence, the result follows. \end{proof} \section{Game on knot diagrams}\label{sec:assertions} Recall that in the proof of Lemma \ref{mainlemma}, for a knot diagram $D$ we constructed the link diagram $D'$ by applying the oriented smoothing operation simultaneously to every reducible vertex of $D$. Let us call this operation the \emph{reducing operation} on a knot diagram. \begin{definition}\normalfont We call a sub-diagram $P$ of $D$ a \emph{connectedly reducible part} of $D$ if it satisfies the following two conditions: 1) It stays connected after applying the reducing operation to $D$. 2) No sub-diagram containing it stays connected after the reducing operation. \end{definition} Equivalently, $P$ is a connectedly reducible part of $D$ if and only if it corresponds to a reduced (disjoint) component of $D'$ after the reducing operation. See Figure \ref{fig:six} for an illustration. \begin{figure}[H] \centering \includegraphics[scale=.2]{Fig6.pdf} \caption{A connectedly reducible part of a knot diagram (in red)} \label{fig:six} \end{figure} Now let $P$ be a connectedly reducible part of $D$ and denote the reduced component of $D'$ corresponding to $P$ by $P'$. Then $P$ and $P'$ have the same irreducible vertex-region incidence structure and we can identify their regions as we identify the regions of $D$ and $D'$. Let $M$ be a game matrix of $D$ over $\mathbb{Z}_k$, $k\leq \infty$. Delete all rows of $M$ corresponding to reducible vertices and columns corresponding to the regions whose boundary does not intersect $P$. The resulting matrix, call it $M'$ is a game matrix of $P'$. Note that if $\boldsymbol{\ell}$ is a null pattern of $M$, then its restriction $\boldsymbol{\ell}_{res}$ to the regions of $P$ is a null pattern of $M'$. Moreover, two different null patterns $\boldsymbol{\ell}$ and $\boldsymbol{\kappa}$ of $M$ cannot have the same restriction. Indeed, if $\boldsymbol{\ell}_{res}=\boldsymbol{\kappa}_{res}$, then $\boldsymbol{\ell}-\boldsymbol{\kappa}$ would be a null pattern of $M$ which is zero on the regions of $P'$, equivalently on the regions of $P$. But $P$ contains at least two adjacent regions of $D$. $\boldsymbol{\ell}=\boldsymbol{\kappa}$ by Proposition \ref{prop0}. So the restriction map of the null patterns of $M$ to the null patterns of $M'$ is injective. Moreover, it is also surjective. Indeed, let $\boldsymbol{\alpha}$ be a null pattern of $M'$, $r_1$ and $r_2$ be two adjacent regions of $P'$ (equivalently $P$ and $D$). Then, by Proposition \ref{propab}, there is a null pattern $\boldsymbol{\beta}$ of $M$ which agrees with $\boldsymbol{\alpha}$ on $r_1$ and $r_2$. However, then both $\boldsymbol{\alpha}$ and $\boldsymbol{\beta}_{res}$ are null patterns of $M'$ which agree on two adjacent regions. Again by Proposition \ref{propab}, $\boldsymbol{\alpha}=\boldsymbol{\beta}_{res}$. From this one to one correspondence we obtain the following observation. \emph{Observation}: Let $S$ be a subset of regions of $P'$. Then, the number of null patterns of $M'$ where the regions of $S$ are not pushed is equal to the number of null patterns of $M$ where the regions of $S$ are not pushed. Theorem \ref{thm2}, \ref{thmp}, and \ref{thmk} determine how many initial color configurations there are which can be solved without pushing certain regions in any version of the $k$-color region select game when played on reduced knot diagrams with some conditions on $k$ or on the diagram. When we look at the proofs we see that this number is determined by the number of null patterns of the corresponding game matrix where these regions are not pushed. Therefore, by the above observation, and together with the fact that $P'$ is a reduced diagram whose regions can be identified by the regions of $P$, the proofs of Theorem \ref{thm2}, \ref{thmp} and \ref{thmk} imply the following result for general knot diagrams. \begin{thm} Let $D$ be a knot diagram on which we play a version of the $k$-color region select game. Fix a checkerboard shading on $D$. Let $P$ be a connectedly reducible part of $D$. Then all the assertions of Theorem \ref{thm2} for $k=2$ and Theorem \ref{thmp} for $k<\infty$, hold true if the regions in the assertions belong to $P$. Assume further that $P$ admits an alternating signing of its unshaded regions. Then all the assertions of Theorem \ref{thmk} for $k\leq\infty$ hold true if the regions in the assertions belong to $P$. \end{thm} \bibliographystyle{plain}
\section{Introduction} The LHCb experiment\,\cite{LHCb-DP-2008-001} at CERN, originally designed for heavy flavour physics studies in proton-proton (\ensuremath{pp}\xspace) collisions, is a single-arm spectrometer instrumenting the pseudorapidity region $\eta \in [2,5]$. Leveraging on the forward acceptance, complementary to the other experiments operating at the CERN LHC, and on the excellent particle reconstruction and identification performance, the LHCb physics reach has progressively evolved and also embraces now a heavy-ion and a fixed-target programme. Figure~\ref{fig:samples} summarises the ion samples that have been collected in the LHC Run2, from 2015 to 2018. In collider mode, proton-lead (\ensuremath{p\text{Pb}}\xspace) collisions in the forward (backward) configuration, \textit{i.e.}\xspace with the proton (the lead) beam entering from the vertex detector, give access to \textit{x} values down to $\mathcal{O}(10^{-6})$ (up to $\mathcal{O}(10^{-1})$). Lead-lead (\ensuremath{\text{PbPb}}\xspace) data were also acquired in the 60 - 100\% centrality range, limited because of the hardware saturation due to the high track density in the forward region. Such a limitation will be reduced by half already with the ongoing upgrade of the experiment and is expected to be completely removed in the future thanks to the installation of more granular tracking detectors.\\\\ By injecting gases in the LHC beam-pipe, LHCb has also operated since 2015 in fixed-target mode~\cite{CERN-THESIS-2021-313}, collecting samples with proton and lead beams impinging on gaseous targets. The high-\textit{x} and moderate $Q^2$ regime, poorly explored by previous experiments, can now be precisely probed in different collision systems. From 2022, the physics opportunities accessible to the fixed-target programme will be further extended\,\cite{LHCb-PUB-2018-015} by confining the gas in a 20-cm-long cell upstream of the LHCb nominal interaction point\,\cite{LHCb-TDR-020}. The gas pressure will be increased by up to two orders of magnitude for the same gas flow as in Run2 and heavier noble gases like krypton and xenon or non-noble species such as hydrogen, deuterium or oxygen could be injected. Owing to the separation between the beam-beam and beam-gas interaction regions, LHCb could be the only experiment operating at the same time in collider and fixed-target modes at two energy scales. \begin{figure}[tb] \centering \includegraphics[width=0.51\textwidth]{samples_ions.png} \includegraphics[width=0.47\textwidth]{samples_fixed-target.png} \caption{Heavy-ion samples collected by LHCb in its (left) collider and (right) fixed-target mode.} \label{fig:samples} \end{figure} \section{The LHCb heavy-ion programme} \begin{figure} \centering \includegraphics[width = \textwidth]{B_figs.png} \caption{Measurement of the {\ensuremath{\B^0_s}}\xspace-to-{\ensuremath{\B^0}}\xspace production ratio in \ensuremath{pp}\xspace collisions. The left and middle plots show the invariant mass distributions for the {\ensuremath{{\mathrm{J}\mskip -3mu/\mskip -2mu\mathrm{\psi}}}}\xspace{\ensuremath{\pion^+}}\xspace{\ensuremath{\pion^-}}\xspace candidates in two intervals of the number of reconstructed tracks in the VELO detector and an evident enhancement of the strangeness production can be seen. The right plot presents the result of the measurement for the cross-section ratio as a function of the multiplicity.} \label{fig:Bhadron} \end{figure} Leveraging on its unique characteristics, LHCb is carrying out a rich programme of heavy-ion interest. Among the most recent results, one example for collision system is discussed here.\\ The possible \textit{b} quark hadronization via coalescence is probed in \ensuremath{pp}\xspace collisions at $\sqrt{s} = 13$~TeV by measuring the {\ensuremath{\B^0_s}}\xspace-to-{\ensuremath{\B^0}}\xspace production ratio\,\cite{LHCb-PAPER-2022-001} as a function of the detector multiplicity. Coalescence is expected to increase with the density of the produced particles, maximum at low transverse momentum, and can be thus efficiently addressed by LHCb. Both hadrons are reconstructed in their common decay mode \decay{{\ensuremath{\B^0_{(s)}}}\xspace}{ (\decay{{\ensuremath{{\mathrm{J}\mskip -3mu/\mskip -2mu\mathrm{\psi}}}}\xspace}{{\ensuremath{\muon^+}}\xspace\mun}){\ensuremath{\pion^+}}\xspace{\ensuremath{\pion^-}}\xspace}. Left and middle Figure~\ref{fig:Bhadron} show the final-state invariant mass distributions in two intervals of the number of tracks reconstructed in the vertex detector (VELO) and, by eye, an increase in the strangeness production is observed. The production ratio, obtained by correcting the fitted {\ensuremath{\B^0_s}}\xspace and {\ensuremath{\B^0}}\xspace yields by the respective efficiencies, is illustrated in the right. The measurement is found to be consistent with previous estimations from {\ensuremath{\electron^+}}\xspace\en colliders at low multiplicity and increases at larger values. Being the production ratio only dependent on the \textit{b}-quark hadronization, such a result qualitatively hints at the occurrence of hadronization mechanisms other than fragmentation.\\\\ \begin{figure} \centering \includegraphics[width = 0.48\textwidth]{LcD0_models} \includegraphics[width = 0.48\textwidth]{LcD0_pPb} \caption{Measurement of the {\ensuremath{\Lambda_c}}\xspace-to-{\ensuremath{\mathrm{D}^0}}\xspace ratio as a function of the transverse momentum compared to (left) theoretical models and to (right) a previous LHCb measurement with \ensuremath{p\text{Pb}}\xspace data.} \label{fig:LcD0_results} \end{figure} Hadronization of the \textit{c}-quark has been recently probed by measuring the {\ensuremath{\Lambda_c}}\xspace-to-{\ensuremath{\mathrm{D}^0}}\xspace ratio in peripheral \ensuremath{\text{PbPb}}\xspace collisions\,\cite{LHCb-PAPER-2021-046} at \ensuremath{\sqrt{s_\text{NN}}}\xspace = 5.02~TeV. The results, obtained considering the \decay{{\ensuremath{\Lambda_c}}\xspace}{p{\ensuremath{\kaon^-}}\xspace{\ensuremath{\pion^+}}\xspace} and \decay{{\ensuremath{\mathrm{D}^0}}\xspace}{{\ensuremath{\kaon^-}}\xspace{\ensuremath{\pion^+}}\xspace} final states, are shown as a function of the transverse momentum in Figure~\ref{fig:LcD0_results} compared (left) to theoretical models and (right) to a previous \ensuremath{p\text{Pb}}\xspace LHCb measurement~\cite{LHCb-PAPER-2018-021}. While the model including the color reconnection mechanism is found to well describe the data for $\ensuremath{p_\text{T}}\xspace > 3$~GeV/c, a disagreement with the statistical hadronization one is found. The measurement with \ensuremath{\text{PbPb}}\xspace data, flat as a function of the number of participants, confirms the previous LHCb findings and the difference with respect to the results from mid-rapidity experiments. This supports the evidence of a dependence of the {\ensuremath{\Lambda_c}}\xspace-to-{\ensuremath{\mathrm{D}^0}}\xspace ratio on the rapidity.\\\\ LHCb is also providing unique inputs to the study of cold nuclear matter effects, for example with the recent measurement of the nuclear modification factor of neutral pions in forward and backward \ensuremath{p\text{Pb}}\xspace collisions\,\cite{LHCb-PAPER-2021-053}. The \decay{{\ensuremath{\pion^0}}\xspace}{\gamma\gamma} yields are measured in \ensuremath{p\text{Pb}}\xspace collisions in the (left) backward and (right) forward configurations and in reference \ensuremath{pp}\xspace samples. The resulting nuclear modification factor, $R_{\ensuremath{p\text{Pb}}\xspace} = \dfrac{1}{208} \cdot \dfrac{\text{d}\sigma_{\ensuremath{p\text{Pb}}\xspace}/\text{d}\ensuremath{p_\text{T}}\xspace}{\text{d}\sigma_{\ensuremath{pp}\xspace}/\text{d}\ensuremath{p_\text{T}}\xspace}$, is shown as a function of the transverse momentum in Figure~\ref{fig:RpPb} compared to nuclear PDF (nPDF) theoretical models. The results, affected by an uncertainty below 6\%, will significantly contribute to constrain the models. Forward results are found to be well described by nPDF models but overestimated from the color glass condensate one; the backward measurement indicates a small excess over nPDF expectations. \begin{figure} \centering \includegraphics[width = \textwidth]{RpPb_results} \caption{Measurement of the neutral pions nuclear modification factor as a function of the transverse momentum with (left) backward and (right) forward \ensuremath{p\text{Pb}}\xspace collisions compared to theoretical models.} \label{fig:RpPb} \end{figure} \section{The LHCb fixed-target programme} \begin{figure} \centering \includegraphics[width = 0.48\textwidth]{Incl_Result_1D_Y_GeV} \includegraphics[width = 0.48\textwidth]{CompareApproaches_Y} \caption{Measurement of (left) the $R_{{\ensuremath{\overline{H}}}\xspace}$ ratio as a function of the transverse momentum compared to the predictions of the most widely used theoretical models, all found to largely underestimate the quantity. The right plot compares the $R_{{\ensuremath{\offsetoverline{\Lambda}}}\xspace}/R_{{\ensuremath{\overline{H}}}\xspace}$ measurement with the EPOS-LHC prediction, expected to be more reliable since only related to the \textit{s}-quark hadronization, and an overall consistency is observed.} \label{fig:pHe_results} \end{figure} A measurement motivated by cosmic rays physics has also been recently performed by fixed-target LHCb. By injecting helium, the antiproton production in \ensuremath{p\text{He}}\xspace collisions is measured, providing a crucial ingredient to constrain the flux of antiprotons in space originating in cosmic rays spallation on the interstellar medium, mainly composed of hydrogen and helium. The description of this process, background to dark matter decay or annihilation searches, currently limits the interpretation of the antiproton flux data collected by orbital experiments. After the first measurement ever of prompt antiproton production in \ensuremath{p\text{He}}\xspace performed by LHCb in 2018\,\cite{LHCb-PAPER-2018-031}, the antihyperon decay contributions are addressed in a new analysis\,\cite{LHCb-PAPER-2022-006} with two complementary approaches. The dominant term, \decay{{\ensuremath{\offsetoverline{\Lambda}}}\xspace_{\text{prompt}}}{{\ensuremath{\overline{p}}}\xspace{\ensuremath{\pion^+}}\xspace}, is reconstructed in the detector with no use of particle identification (PID) information. The ratio of the measured cross-section with the previous LHCb result gives $R_{{\ensuremath{\offsetoverline{\Lambda}}}\xspace} = \sigma{(\decay{\ensuremath{p\text{He}}\xspace}{(\decay{{\ensuremath{\offsetoverline{\Lambda}}}\xspace_{\text{prompt}}}{{\ensuremath{\overline{p}}}\xspace{\ensuremath{\pion^+}}\xspace})X)}}/\sigma(\decay{\ensuremath{p\text{He}}\xspace}{\bar{p}_{\text{prompt}}X})$. An inclusive approach is also followed exploiting the LHCb excellent PID performance and impact parameter resolution. All antiprotons are reconstructed, selected and distinguished between promptly and decay-produced with a template fit to the \ensuremath{p\text{He}}\xspace data impact parameter distribution. The ratio $R_{{\ensuremath{\overline{H}}}\xspace} = \sigma{(\decay{\ensuremath{p\text{He}}\xspace}{\decay{{\ensuremath{\overline{H}}}\xspace X}{{\ensuremath{\overline{p}}}\xspace X})}}/\sigma(\decay{\ensuremath{p\text{He}}\xspace}{\bar{p}_{\text{prompt}}X})$, with ${\ensuremath{\overline{H}}}\xspace = \{{\ensuremath{\offsetoverline{\Lambda}}}\xspace, {\ensuremath{\offsetoverline{\Sigma}^-}}\xspace, {\ensuremath{\offsetoverline{\Xi}^+}}\xspace, {\ensuremath{\offsetoverline{\Xi}^0}}\xspace, {\ensuremath{\offsetoverline{\Omega}^+}}\xspace\}$, is obtained by correcting the two antiproton yields by the respective efficiencies. Figure~\ref{fig:pHe_results} illustrates the $R_{\ensuremath{\overline{H}}}\xspace$ result as a function of the transverse momentum, in excess with respect to the predictions from all theoretical models. The $R_{\ensuremath{\offsetoverline{\Lambda}}}\xspace/R_{\ensuremath{\overline{H}}}\xspace$ ratio is also compared to the EPOS-LHC\,\cite{EPOS-LHC} prediction, expected to be much more reliable for this quantity since it only depends on the \textit{s}-quark hadronization. The observed consistency confirms the validity of the two approaches. \section{Conclusions} In parallel to the study of \ensuremath{pp}\xspace collisions, LHCb is developing a full and unique heavy-ion programme, constraining theoretical models in poorly explored kinematic regions. Since 2015, LHCb is also pioneering fixed-target physics at LHC, addressing several fields of interest beyond those of its conception. In this document, four measurements exemplifying the LHCb unique contributions in different collision systems are presented. With the ongoing and the future upgrades of the experiment, the programmes will be boosted, further widening the LHCb physics reach. LHCb is evolving more and more to a general purpose forward experiment. \section*{References}
\section{Introduction} \label{sec:Intro} In astrophysical events like core-collapse supernovae (CCSN) \cite{Janka_PhysRep_2007,Mezzacappa2015,Schneider_PRC_2017,Connor2018ApJ,Burrows2020MNRAS} and binary neutron star (BNS) mergers \cite{Shibata_11,Rosswog_15,Baiotti_2017,Endrizzi_PRD_2018,Ruiz2020,Prakash_PRD_2021,Most_2022} as well as in the evolution of proto-neutron stars (PNS) \cite{Pons_ApJ_1999,Pascal_MNRAS_2022} and formation of stellar black holes (BH) \cite{Sumiyoshi_2007,Fischer_2009,OConnor_2011,hempel12} high density and high temperature states of matter are populated. Under these circumstances the appearance of non-nucleonic degrees of freedom (d.o.f.) - such as hyperons, meson condensates and quarks - is highly probable. From the energetic view point these exotic phases are the natural consequence of the Pauli principle and are expected to nucleate whenever the chemical potential of neutrons exceeds a certain threshold. Limited current information on the equation of state (EoS) does nevertheless not allow to ascertain the occurrence of any of these species and even less to identify the thermodynamic conditions and astrophysical environments where one species or another will dominate over nucleonic matter. Signatures of exotic matter are typically sought after by comparing results of numerical simulations obtained by accounting for various extra particle d.o.f. with those obtained when only nucleons are considered. As such hyperons and hadrons to quark phase transitions have been found to affect the dynamics, neutrino signals and gravitational wave (GW) emissions. Sekiguchi et al.~\cite{Sekiguchi_PRL_2011} has shown that the onset of $\Lambda$-hyperons modifies the GWs emitted by the hypermassive neutron star (HMNS) formed after BNS as well as the surrounding torus. GW were found to be modified in two respects. Firstly, the amplitude of quasiperiodic GW at the black hole formation is damped. Second, the characteristic GW frequency increases with time. According to Radice et al.~\cite{Radice_ApJL_2017} the production of hyperons makes waveforms louder and alter the amplitude modulation and phase evolution; other modifications concern the compactness and binding energy of the merger remnant, higher when hyperons are present. Bauswein et al.~\cite{Bauswein_PRL_2019,Blacker_PRD_2020} showed that hadron-quark phase transitions occurring during the post-merger phase modify the relation between the frequency of dominant gravitational-waves and the tidal deformability during the inspiral. Patterns of inspiral and postmerger GW signals have been confronted by Most et al. \cite{Most_PRL_2019}, who shown that the latter has the potential to bare clear signatures of phase transitions. Weith et al.~\cite{Weih_PRL_2020} demonstrated that the postmerger GW signal exhibits two distinct fundamental frequencies before and after the phase transition. More precisely, if the collapse into a BH is triggered by the phase transition, the frequencies of GW emitted by the HMHS increase as the collapse proceeds; if, at variance, the phase transition develops after the merger and a metastable object with a quark-matter core is formed, the transition to a signal at higher frequencies is more smooth and the largest values smaller than in the first scenario. Modification of post-merger GW frequencies by the quark deconfinement phase transition is confirmed also by Prakash et al. \cite{Prakash_PRD_2021} who have additionally studied modifications of dynamical ejecta, remnant accretion disk masses, $r$-process nucleosynthesis yields and electromagnetic counterparts. Effects of pions, hyperons and hadron-quark phase transition in stellar core collapse have been identified as well. According to Sagert et al. \cite{Sagert_PRL_2009}, phase transitions occurring during the early postbounce evolution might produce a second shock wave. If this is strong enough a delayed supernova explosion is triggered and an additional neutrino-peak generated. Zha et al. \cite{Zha_PRL_2020} has proved that if, due to the QCD phase transition, the PNS collapses following the core-collapse, a loud burst of GW is formed. Its properties - amplitude, frequency range, duration, energy - are different than those of normally found postbounce GW. According to Lin et al. \cite{Lin_2022} the neutrino signal emitted by these failed CCSN is oscillatory. Effects of pions and $\Lambda$-hyperons, including a possible strangeness-driven phase transition on the evolution of core collapse and formation of stellar BH have been considered in Peres et al.~\cite{Peres_PRD_2013}. It was found that the EoS softening results in reduced (increased) values of central density (temperature) at bounce; increased radii of the homologous core and PNS; steeper increase of central density during postbounce; faster collapse into BH. The magnitude of modifications increases with abundances of exotic species. Phase transitions additionally induce core oscillations. The consequences of phase transitions, non-monotonic density-dependence of the sound speed and numerical accidents in the surface of thermodynamic potentials have been discussed by Aloy et al.~\cite{Aloy_MNRAS_2019}. Among their results we remind the supersonic behavior of the infalling matter in connection with a phase transition. Numerical simulations of these phenomena require detailed information on composition, thermodynamic and, preferably also, microscopic properties of matter over wide domains of baryonic density $10^{-14}~{\rm fm}^{-3} \leq n_B \leq 1.5~{\rm fm}^{-3}$, electron fraction $0 \leq Y_e=n_e/n_B \leq 0.6$ and temperature $0 \leq T \leq 100~{\rm MeV}$. The first so-called general purpose EoS tables for astrophysical use have been made available by Lattimer and Swesty~\cite{LS_NPA_1991} and Shen et al. \cite{STOS_PTP_1998,STOS_NPA_1998} and accounted only for nucleonic d.o.f. For almost two decades they were the only ones to exist. As such more "finite-temperature" EoS have been built heuristically by the so-called $\Gamma$-law, which consists in supplementing cold EoS with ideal-gas thermal contributions - a method still in use, see Sec. \ref{sec:FiniteT}. Starting with 2010 the situation improved significantly and today almost one hundred such EoS exist. Out of them 36 account also for one or several exotic particles. These EoS tables have been obtained within different theoretical frameworks; rely on various baryon-baryon interactions; implement different constraints derived from nuclear physics, astrophysics and {\em ab initio} calculations; for a review, see \cite{Oertel_RMP_2017,Burgio_PPNP_2021}. Though the collection of existing models is still far from exhausting the huge parameter space associated with the uncertainties in effective baryonic interactions at high densities and isospin asymmetries, it allowed to identify how particle abundances depend on thermodynamic conditions; the extend in which exotic d.o.f. impact on thermodynamic state variables or derived quantities like adiabatic index or speed of sound; whether correlations exist with EoS of nuclear matter; investigate properties of isentropic PNS and the relation with their nucleonic counterparts~\cite{Oertel_PRC_2012,Peres_PRD_2013,Oertel_EPJA_2016,Malfatti_PRC_2019,Raduta_MNRAS_2020,Khadkikar_PRC_2021,Wei_PRC_2021,Sedrakian_EPJA_2022}. The first aim of this work is to present three general purpose EoS models that account for the baryonic octet and $\Delta(1232)$-resonances. They are derived in the framework of the covariant density functional theory (CDFT), are available on the \textsc{CompOSE} site~\footnote{\url{https://compose.obspm.fr/}}~\cite{Typel_2013,Typel_2022} and - to our knowledge - are the first publicly available EoS models which account for $\Delta$s. Accounting for $\Delta$s, in principle, one may face first order phase transition(s) in thermodynamic conditions relevant for astrophysics \cite{Raduta_PLB_2021}. Our EoS models are built by giving to the coupling constants to meson fields values in accord with present constraints. When the contribution of the neutralizing electron gas is accounted for none of these models manifests instabilities. Though, when only baryonic matter is considered, one of the models shows $\Delta$-driven instabilities. The second motivation is to provide a better understanding of finite-$T$ behavior of EoS models with exotic d.o.f. To this end we review general purpose EoS tables with exotica presently available on the \textsc{CompOSE} site. Then, for a collection of EoS models which allow for different exotic d.o.f. and have the property that general purpose EoS tables for purely nucleonic matter exist as well a comparative study is performed for a series of thermal properties. These two aspects make present work be the follow-up of our previous paper devoted to EoS with nucleonic d.o.f. \cite{Raduta_EPJA_2021}, called in the following Paper I. The paper in organized as follows. General purpose EoS with exotica presently available on the \textsc{CompOSE} site are reviewed in Sec. \ref{sec:Models}. Sec. \ref{sec:CDFT} offers an overview of CDFT models with density-dependent couplings. The role of hyperons and $\Delta$-resonances at finite-T is analyzed in Sec. \ref{sec:ND} by considering simplified mixtures of nucleons and the $\Lambda$-hyperons and, respectively, $\Delta$s. Thermodynamic stability of cold $\Delta$-admixed nucleonic matter at $T=0$ is investigated in Sec. \ref{sec:ND}. Thermal properties of a large collection of models, including the newly proposed ones, are addressed in Sec. \ref{sec:FiniteT}. In order to better highlight the role of various particle d.o.f. or the way in which the hadron to quark phase transition is implemented none of the currently used constraints on parameters of nuclear matter at saturation or properties of NS is used as a filter. Throughout this paper we use the natural units with $c=\hslash=k_B=G=1$. \section{General purpose EoS models with exotic particle degrees of freedom on \textsc{CompOSE} } \label{sec:Models} In this section we provide an overview of models with exotic particle degrees of freedom for which general purpose EoS tables are available on the \textsc{CompOSE} site. General purpose tables cover large ranges of baryon number densities $n_B$, temperatures $T$, and electron fractions $Y_e$ and are ready to use in numerical simulations of CCSN, PNS and BNS mergers. Contributions of electron-positron and photon gases, treated as ideal Fermi and Bose gases, are included in all tables assuming that the net electron fraction equals the baryon charge fraction, $Y_e=Y_Q$, and that the different sectors are in thermal equilibrium. For some models tables corresponding to pure baryonic matter are also provided. The standard format for the name of a particular EoS table takes the form XXX(YYY)zzz. XXX thereby indicates the initials of the authors in the original publication(s) proposing the corresponding model. YYY represents the name of the interaction and provides information on effective nucleon potential and non-nucleonic particle degrees of freedom. zzz offers extra information on coupling constants in the exotic sector, if tables are provided for more than one XXX(YYY) model. \begin{table*} \caption{List of general purpose EoS tables with exotic degrees of freedom, available on \textsc{Compose}. For each EoS model we provide information on: considered degrees of freedom; maximum mass of cold $\beta$-equilibrated NS ($M_G^{\mathit{max}}$); radius of canonical $1.4M_{\odot}$ NS ($R_{14}$); radius of a $2.072M_{\odot}$ NS ($R_{2.072}$); limits of combined tidal deformability $\tilde \Lambda=16\left[ \left( M_1+12 M_2\right) M_1^4 \Lambda_1 + \left( M_2+12 M_1\right) M_2^4 \Lambda_2 \right]/13 \left(M_1 +M_2\right)^5$ corresponding to the GW170817 event with an estimated total mass $M_T=2.73^{+0.04}_{-0.01} M_{\odot}$ and a mass ratio range $0.73\leq q=M_2/M_1 \leq 1$. Present astrophysical constraints on EoS regard: i) the lower limit of maximum gravitational mass \cite{Demorest_Nature_2010,Antoniadis2013,Arzoumanian_ApJSS_2018,Cromartie2020,Fonseca_2021}; ii) radii of canonical mass NS \cite{Miller_2019,Riley_2019}; iii) radii of a massive NS \cite{Miller_may2021,Riley_may2021}; iv) range for the tidal deformability obtained from the GW170817 event \cite{Abbott_PRL119_161101,Abbott_ApJ2017ApJ_L12,Abbott_2019}. As in Paper I models in tension with constraint i) $M \geq 2.01 - 0.04 M_{\odot}$ \cite{Antoniadis2013} are marked in bold. Values outside the ranges ii) $11.80 \leq R(1.4M_{\odot}) \leq 13.10$ km \cite{Miller_may2021}, iii) $11.41~{\rm km} \leq R(2.072M_{\odot})\leq 13.69~{\rm km}$ \cite{Riley_may2021}, iv) $110 \leq \tilde \Lambda \leq 800$ \cite{Abbott_2019} are also marked in bold. For $M_G^{\mathit{max}}$ and $R_{14}$ provided are the values on \textsc{CompOSE} or the original publications. As in Paper I $R_{2.072}$, $\tilde \Lambda(q=0.73)$ and $\tilde \Lambda(q=1)$ are calculated by using for the crust the EoS models by \cite{NV_1973} and \cite{HDZ_1989}. n.a. (not available) means that quantities could not be calculated from the table, the reason being that, for baryonic densities exceeding a certain value, $Y_e$ of $\beta$-equilibrated matter is lower than the lowest value in the table. Other notations are: $q$ stands for $u$, $d$, $s$ quarks; $\Lambda$ denotes the $\Lambda$-hyperon; $\Delta$ is the $\Delta(1232)$ resonance; $Y$ generically denotes the $\Lambda$, $\Sigma$ and $\Xi$ hyperons; $\pi$ and $K$ respectively stand for pions and kaons. } \label{tab:models} \begin{tabular}{lccccccl} \hline\noalign{\smallskip} model & non-nucleonic & $M_G^{\mathit{max}}$ & $R_{14}$ & $R_{2.072}$ & $\tilde \Lambda$ & $\tilde \Lambda$ & Ref. \\ & d.o.f & ($M_{\odot}$) & (km) & (km) & q=0.73 & q=1 \\ \noalign{\smallskip}\hline\noalign{\smallskip} {\bf GROM(LS220L) no low densities} & $\Lambda$ & {\bf 1.91} & 12.4 & - & 576 & 498 & \cite{LS_NPA_1991,Oertel_PRC_2012}\\ {\bf GROM(LS220L) with low densities} & $\Lambda$ & {\bf 1.91} & 12.4 & - & 576 & 498 & \cite{LS_NPA_1991,Oertel_PRC_2012}\\ {\bf STOS(TM1L)} & $\Lambda$ & {\bf 1.90} & {\bf 14.4} & - & {\bf 1366} & {\bf 1283} & \cite{STOS_PTP_1998,STOS_NPA_1998,STOS_ApJSS_2011} \\ {\bf IOTSY(TM1Y-30)} & Y & {\bf 1.63} & {\bf 14.3} & - & - & {\bf 1258} & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Y0)} & Y & {\bf 1.64} & {\bf 14.3} & - & {\bf 1361} & {\bf 1286} & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Y30)} & Y & {\bf 1.64} & {\bf 14.3} & - & {\bf 1362} & {\bf 1286} & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Y90)} & Y & {\bf 1.64} & {\bf 14.3} & - & {\bf 1362} & {\bf 1286} & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Ypi-30)} & $Y, \pi$ & {\bf 1.66} & {\bf 13.6} & - & {\bf 844} & 781 & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Ypi0)} & $Y, \pi$ & {\bf 1.66} & {\bf 13.6} & - & {\bf 858} & 778 & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Ypi30)} & $Y, \pi$ & {\bf 1.66} & {\bf 13.6} & - & {\bf 858} & 778 & \cite{Ishizuka_JPG_2008} \\ {\bf IOTSY(TM1Ypi90)} & $Y, \pi$ & {\bf 1.66} & {\bf 13.6} & - & {\bf 858} & 778 & \cite{Ishizuka_JPG_2008} \\ SFHPST(TM1B139) & q & 2.08 & 12.6 & - & n.a. & n.a. & \cite{STOS_PTP_1998,STOS_NPA_1998,Sagert_PRL_2009,Sagert_JPG_2010,Fischer_ApJ_2011}\\ SFHPST(TM1B145) & q & 2.01 & 13.0 & - & n.a. & n.a. & \cite{STOS_PTP_1998,STOS_NPA_1998,Sagert_PRL_2009,Sagert_JPG_2010,Fischer_ApJ_2011}\\ {\bf SFHPST(TM1B155)} & q & {\bf 1.70} & {\bf 10.7} & - & n.a. & n.a. & \cite{STOS_PTP_1998,STOS_NPA_1998,Sagert_PRL_2009,Sagert_JPG_2010,Fischer_ApJ_2011}\\ {\bf SFHPST(TM1B165)} & q & {\bf 1.51} & {\bf 9.1} & - & n.a. & n.a. & \cite{STOS_PTP_1998,STOS_NPA_1998,Sagert_PRL_2009,Sagert_JPG_2010,Fischer_ApJ_2011}\\ FOP(SFHoY) & Y & 1.99 & 11.9 & - & 401 & 366 & \cite{Hempel_NPA_2010,SHF_ApJ_2013,FOP_2017} \\ {\bf BHB(DD2L)} & $\Lambda$ & {\bf 1.95} & {\bf 13.2} & - & 787 & 757 & \cite{Hempel_NPA_2010,BHB_2014} \\ BHB(DD2Lphi) & $\Lambda$ & 2.10 & {\bf 13.2} & 12.2 & 790 & 757 & \cite{Hempel_NPA_2010,BHB_2014} \\ OMHN(DD2Y) & Y & 2.03 & {\bf 13.2} & - & 787 & 756 & \cite{Hempel_NPA_2010,Marques_PRC_2017} \\ MBB(DD2K) & $K^-$ & 2.19 & {\bf 13.2} & 13.0 & 798 & 758 & \cite{Hempel_NPA_2010,Malik_EPJA_2021}\\ MBB(BHBLphiK) & $\Lambda$, $K^-$ & 2.05 & {\bf 13.2} & - & 788 & 755 & \cite{Hempel_NPA_2010,Malik_ApJ_2021}\\ SDGTT(QMC-A) & Y & 2.08 & 13.0 & n.a. & n.a. & n.a. & \cite{Guichon_PLB_1988,Guichon_PPNP_2018,Stone_MNRAS_2021} \\ R(DD2YDelta)(1.1;1.1;1.0) & Y$\Delta$ & 2.04 & 12.97 & - & 697 & 643 & \cite{Hempel_NPA_2010}, this work \\ R(DD2YDelta)(1.2;1.1;1.0) & Y$\Delta$ & 2.05 & 12.30 & - & 470 & 434 & \cite{Hempel_NPA_2010}, this work \\ R(DD2YDelta)(1.2;1.3;1.0) & Y$\Delta$ & 2.03 & {\bf 13.25} & - & 786 & 757 & \cite{Hempel_NPA_2010}, this work \\ DNS(CMF) & Y, q & 2.1 & {\bf 14.0} & 12.6 & {\bf 1114} & {\bf 1043} & \cite{DNS_PRC_2015,Dexheimer_PASA_2017} \\ BBKF(DD2F-SF)1.1 & q & 2.13 & 12.2 & {\bf 10.7} & 507 & 467 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.2 & q & 2.15 & 12.2 & 11.4 & 501 & 473 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.3 & q & 2.02 & 12.2 & - & 512 & 467 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.4 & q & 2.02 & 12.2 & - & 516 & 467 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.5 & q & 2.03 & 12.2 & - & 488 & 467 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.6 & q & 2.00 & 12.2 & - & 513 & 467 & \cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \\ BBKF(DD2F-SF)1.7 & q & 2.11 & 12.2 & {\bf 11.2} & 514 & 467 & \cite{Bastian_PRC_2017,Bastian_PRD_2021} \\ BBKF(DD2-SF)1.8 & q & 2.06 & {\bf 11.0} & - & 218 & 180 & \cite{Bastian_PRC_2017,Bastian_PRD_2021} \\ BBKF(DD2-SF)1.9 & q & 2.17 & {\bf 11.3} & {\bf 11.2} & 228 & 196 & \cite{Bastian_PRC_2017,Bastian_PRD_2021} \\ \noalign{\smallskip}\hline \end{tabular} \end{table*} \begin{table*} \caption{List of nucleonic effective interactions on which general purpose EoS tables in Table \ref{tab:models} are built. For each interaction we specify the properties of symmetric nuclear matter at saturation density ($n_{\mathit{sat}}$): energy per nucleon ($E_{\mathit{sat}}$); compression modulus ($K_{\mathit{sat}}$); skewness ($Q_{\mathit{sat}}$); symmetry energy ($J_{sym}$); slope ($L_{sym}$); curvature ($K_{sym}$) and skewness ($Q_{sym}$) of the symmetry energy.} \label{tab:effint} \begin{tabular}{lccccccccl} \hline\noalign{\smallskip} int. & $n_{\mathit{sat}}$ & $E_{\mathit{sat}}$ & $K_{\mathit{sat}}$ & $Q_{\mathit{sat}}$ & $J_{sym}$ & $L_{sym}$ & $K_{sym}$ & $Q_{sym}$ & Ref. \\ & (fm$^{-3}$) & (MeV) & (MeV) & (MeV) & (MeV) & (MeV) & (MeV) & (MeV) \\ \noalign{\smallskip}\hline\noalign{\smallskip} LS220 & 0.155 & -16.64 & 219.85 & -410.80 & 28.61 & 73.81 & -24.04 & 96.17 & \cite{LS_NPA_1991} \\ TM1 & 0.145 & -16.26 & 281.16 &-285.22 & 36.89 & 110.79 & 33.63 & -66.54 & \cite{TM1} \\ SFHo & 0.158 & -16.19 & 245.4 &-467.8 & 31.57 & 47.10 & -205.5 & n.a. & \cite{SHF_ApJ_2013} \\ DD2 & 0.149 & -16.02 & 242.72 & 168.65 & 31.67 & 55.04 & -93.23 & 598.14 & \cite{DD2} \\ DD2F & 0.149 & -16.02 & 242.72 & 168.65 & 31.67 & 55.04 & -93.23 & 598.14 & \cite{DD2F} \\ CMF & 0.15 & -16.0 & 300 & 281 & 30 & 88 & 27 & n.a. & \cite{DS_ApJ_2008,DNS_PRC_2015} \\ QMC-A & 0.156 & -16.2 & 292 & n.a. & 28.5 & 54.0 & n.a. & n.a. & \cite{Stone_MNRAS_2021}\\ \noalign{\smallskip}\hline \end{tabular} \end{table*} Table \ref{tab:models} lists the presently available tables, along with information on the exotic particles and properties of corresponding cold $\beta$-equilibrated NS. With the exception of GROM(LS220L), which relies on a non-relativistic Skyrme-like effective interaction, all the models belong to CDFT. The nuclear matter (NM) parameters of underlying nucleonic effective interactions are provided in Table \ref{tab:effint}. As with the exception of DNS(CMF)~\cite{DNS_PRC_2015,Dexheimer_PASA_2017} and BBKF(DD2F-SF)~\cite{Bastian_PRC_2017,Bauswein_PRL_2019,Bastian_PRD_2021} \textsc{CompOSE} provides also general purpose EoS for purely nucleonic matter and these have been discussed at length in Paper I here we shall focus only on exotic d.o.f. and the supra-saturation regime. \begin{table*} \caption{Details on CDFT models on which EoS tables have been built: list of meson couplings and/or their type (col. 6); list of hidden strangeness mesons (if any) (col. 7); quark flavor symmetry group on which vertices of vector mesons to exotica have been fixed (col. 8). DD stays for density-dependent. For FOP(SFHoY) $i=1,...,6$; $j=1,...,3$. $U_X^{(N)}\left(n_{sat}\right)$, eq. (\ref{eq:Ujk}), stays for the well depth of the particle $X$ at rest in symmetric saturated nuclear matter. } \label{tab:UYN} \begin{tabular}{lccccccccl} \hline\noalign{\smallskip} model & $U_{\Lambda}^{(N)}\left(n_{sat}\right)$ & $U_{\Sigma}^{(N)}\left(n_{sat}\right)$ & $U_{\Xi}^{(N)}\left(n_{sat}\right)$ & $U_{\Delta}^{(N)}\left(n_{sat}\right)$ & meson & hidden str. & flavor sym. & Ref. \\ & [MeV] & [MeV] & [MeV] & [MeV] & couplings & mesons & \\ \noalign{\smallskip}\hline\noalign{\smallskip} STOS(TM1L) & -30 & - & - & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & - & SU(6) &\cite{STOS_ApJSS_2011}\\ IOTSY(TM1Y-30) & -30 & -30 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Y0) & -30 & 0 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Y30) & -30 & 30 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Y90) & -30 & 90 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Ypi-30)& -30 & -30 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Ypi0) & -30 & 0 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Ypi30) & -30 & 30 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ IOTSY(TM1Ypi90) & -30 & 90 & -15 & - & $\sigma^3$, $\sigma^4$, $\omega^4$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Ishizuka_JPG_2008} \\ FOP(SFHoY) & -30 & 30 & -14 & - & $\sigma^3$, $\sigma^4$, $\omega^4$, $\sigma^i \rho^2$, $\omega^{2j} \rho^2$ & $\phi$ & SU(6) & \cite{FOP_2017} \\ BHB(DD2L) & -30 & - & - & - & DD & - & SU(6) & \cite{BHB_2014}\\ BHB(DD2Lphi) & -30 & - & - & - & DD & $\phi$ & SU(6) & \cite{BHB_2014}\\ OMHN(DD2Y) & -30 & 30 & -18 & - & DD & $\sigma^*$, $\phi$ & SU(6) & \cite{Marques_PRC_2017}\\ SDGTT(QMC-A) & -28 & -0.96 & -12.7 & - & QMC & - & - & \cite{Stone_MNRAS_2021} \\ R(DD2YDelta)(1.1;1.1;1.0) & -28 & 30 & -20 & -83 & DD & $\phi$ & SU(6) & this work\\ R(DD2YDelta)(1.2;1.1;1.0) & -28 & 30 & -20 & -124 & DD & $\phi$ & SU(6) & this work \\ R(DD2YDelta)(1.2;1.3;1.0) & -28 & 30 & -20 & -57 & DD & $\phi$ & SU(6) & this work \\ DNS(CMF) & -28 & 5 & -18 & - & $\sigma^4$, $\delta^4$, $\omega^4$, $\sigma^2 \delta^2$ & $\sigma^*$, $\phi$ & SU(3) & \cite{Dexheimer_PASA_2017} \\ \noalign{\smallskip}\hline \end{tabular} \end{table*} In the absence of scattering data information on the $YN$ and $YY$ interactions can be extracted from the study of hypernuclei, bound systems composed of nucleons and one or more hyperons. So far more than 40 single-$\Lambda$ nuclei and a few double-$\Lambda$ and single-$\Xi$ nuclei have been produced and studied. The first estimation of the well depth of the $\Lambda$-hyperon in nuclear matter, $U_{\Lambda}^{(N)}(n_{sat}) \approx -30~{\rm MeV}$, has been obtained from the extrapolation at $A \to \infty$, where $A$ is the hypernucleus mass number, of the experimental binding energy of single-$\Lambda$ hypernuclei \cite{Millener1988}. Calibration of $\sigma \Lambda$ and $\omega \Lambda$ vertices on experimental data of binding energies of nuclei with a variable number of nucleons and one $\Lambda$, realized by solving the Dirac equations of the nucleons and the hyperon, confirm this value \cite{Fortin_PRC_2017}. \cite{Fortin_PRC_2017} also shows that $U_{\Lambda}^{(N)}$ is little affected by the assumed nucleonic effective interaction and flavor symmetry arguments used for the vector mesons. The method in \cite{Fortin_PRC_2017} was further employed in \cite{Fortin_PRD_2020} to calibrate the coupling constants of the $\Xi$-hyperon to the experimental binding energy of the single-$\Xi$ nuclei $_{\Xi^-}^{15}$C and $_{\Xi^-}^{12}$Be. The thus obtained values $-18.8~{\rm MeV} \lesssim U_{\Xi}^{(N)}(n_{sat}) \lesssim -14.6~{\rm MeV}$, which depend on the nucleon effective interaction, are in fair agreement with the value deduced from inclusive $\left(K^-, K^+ \right)$ spectra, $U_{\Xi}^{(N)}(n_{sat}) \approx -15~{\rm MeV}$ \cite{Gal_RMP_2016} and underestimate the more attractive $U_{\Xi}^{(N)}(n_{sat}) \lesssim -20~{\rm MeV}$ obtained from $\Xi^-p \to \Lambda \Lambda$ two body capture events in $^{12}$C and $^{14}$N \cite{Friedman_PLB_2021}. Experimental data on strong-interaction level shifts, widths and yields collected from $\Sigma^-$ atoms and inclusive $\left(\pi^-, K^+ \right)$ spectra on medium to heavy targets indicate a repulsive but loosely constrained $\Sigma N$ potential $U_{\Sigma}^{(N)}(n_{sat}) \approx 30\pm 20~{\rm MeV}$~\cite{Millener1988,Gal_RMP_2016}. $-U_{\Lambda}^{(\Lambda)}(n_{sat})$ is extracted by identification with the $\Lambda \Lambda$ bond energy, $\Delta B_{\Lambda \Lambda}=B_{\Lambda \Lambda}\left(_{\Lambda \Lambda}^AZ\right)-2B_{\Lambda}\left(_{\Lambda}^{A-1}Z \right)$, where $B\left( ^A Z\right)$ stays for the binding energy of the nucleus $^AZ$, in double $\Lambda$ hypernuclei. The initial value, $\Delta B_{\Lambda \Lambda}=1.01 \pm 0.2^{+0.18}_{-0.11}~{\rm MeV}$ obtained in the KEK event \cite{Takahashi_PRL_2001} was revised to $0.67 \pm 0.17~{\rm MeV}$ \cite{Ahn_PRC_2013} due to a change in the value of the $\Xi^-$ mass. The small value of this attractive potential makes it that it is overlooked in most EoS model calculations. For EoS models which account for hyperons, Table \ref{tab:UYN} lists the values of well depths in symmetric saturated matter on which the coupling constant to the $\sigma$ meson has been fixed, the meson couplings and the flavor symmetry group assumed for deciding the strengths of vector mesons. One can see that all models are in fair agreement with present constraints on $U_{\Lambda}^{(N)}$ and $U_{\Xi}^{(N)}$. The wide range explored by $U_{\Sigma}^{(N)}$ allows one to inspect the consequences entailed by uncertainties in the $N\Sigma$ interaction. So far this aspect was systematically addressed only for cold $\beta$-equilibrated NS~\cite{Fortin_PRD_2020,Fortin_PRD_2021}. Out of the considered models only IOTSY models \cite{Ishizuka_JPG_2008} account for $YY$ potentials. The assumed values are: $U_{\Sigma}^{(\Sigma)} \approx U_{\Lambda}^{(\Sigma)} \approx U_{\Sigma}^{(\Lambda)}\approx 2 U_{\Lambda}^{(\Lambda)} \approx -40~{\rm MeV}$. Some of IOTSY models \cite{Ishizuka_JPG_2008} also account for free thermal pions. Modification of pion masses due to the interaction is disregarded. $\pi^{-,0,+}$ number densities account for $s$-wave pion condensation. This holds when the absolute value of pion chemical potentials equal the pion mass. Pion chemical potentials are calculated as $\mu_{\pi^+}=\mu_Q$, $\mu_{\pi^0}=0$, $\mu_{\pi^-}=-\mu_Q$, where $\mu_Q=\mu_p-\mu_n$ is the charge fraction. MBB(DD2K) \cite{Malik_EPJA_2021} accounts for thermal (anti)kaons and a Bose–Einstein condensate of $K^-$ mesons. The phase transition from the nuclear to antikaon condensed phase is second-order. Nucleons in the antikaon condensed phase behave differently than those in the hadronic phase. Kaon-nucleon interaction is considered in the same footing as the nucleon–nucleon interaction. Kaon-vector meson coupling constants are fixed by flavor symmetry arguments. The scalar coupling constant is determined from the real part of $K^-$ optical potential at the saturation density, $U_{K^-}^{(N)}=-120~{\rm MeV}$. MBB(BHBLphiK) \cite{Malik_ApJ_2021} additionally accounts for $\Lambda$-hyperons. BBKF(DD2-SF) and BBKF(DD2F-SF) models \cite{Bastian_PRD_2021} rely on a two-phase approach for quark-hadron phase transitions, which leads by construction to a first-order phase transition. In the hadron sector only nucleonic d.o.f. are considered; in the quark sector only up and down quarks are allowed. The quark confinement is modeled within the string-flip model~\cite{Bastian_PRC_2017}. The fact that hadrons are composite particles made of quarks is not considered in this description. As frequently done in astrophysics, each phase is derived independently and the two phases are then merged through a Gibbs construction. The latter one is performed in an approximate way, by imposing only thermal, mechanical and baryonic chemical equilibrium between hadron and quark phases. Charge/lepton chemical equilibrium is disregarded for convenience. Because of the close values of charge fraction in the coexisting phases, which is a peculiarity of this model, it is argued that this simplification has only little effect on thermodynamics. The quark model is much more affected by temperature than the hadron model, which can be explained by the lower masses of quarks. With rising temperature the model features a monotonic decrease of transition pressure and (baryon) chemical potential. For more, see Sec. \ref{sec:FiniteT}. In the hadronic-quark SFHPST-models \cite{Sagert_PRL_2009,Sagert_JPG_2010} the hadronic sector is treated within CDFT while for the quark sector the MIT bag model is employed. In the hadron sector only nucleonic d.o.f. are considered; up, down and strange quarks are considered in the quark sector. The onset of the hadron-quark phase transition and the width of the phase coexistence domain are governed by the model parameters, i.e. strange quark mass, bag constant and strong coupling constant. By increasing the temperature the phase coexistence domain shifts to lower densities without significant modification of width. The phase transition is implemented based on a Glendenning construction~\cite{Glendenning_PRD_1992}, which differs from the standard Gibbs construction. The Glendenning phase coexistence is done by imposing mechanical equilibrium between the phases and calculating baryon and charge densities of the mixed phase as linear combinations of corresponding quantities in pure phases. Characteristic features of SFHPST-models, different from those of BBKF-models, will be discussed in Sec. \ref{sec:FiniteT}. The SU(3) Chiral Mean Field (CMF) model \cite{Dexheimer_PASA_2017} is another example of EoS model which allows for hadrons and quarks. For the hadronic phase, which accounts for the whole baryonic octet, a non-linear realization of the SU(3) sigma model with an explicit chiral symmetry breaking term is used. The particle d.o.f. populated under various thermodynamic conditions change from hadrons to quarks and vice-versa through the introduction of an extra field $\Phi$ in the effective masses of baryons and quarks. Hadrons are included as quasi-particle d.o.f. in a chemically equilibrated mixture with quarks, which results in full miscibility of hadrons and quarks. The microscopic SDGTT(QMC-A) model \cite{Stone_MNRAS_2021} is based on the effective relativistic mean field quark-meson-coupling (QMC) model \cite{Guichon_PPNP_2018}. At variance with CDFT models, in QMC the interaction between baryons takes place self-consistently between valence quarks, confined in non-overlapping baryons. The effect of dense medium surrounding the baryons is modeled by dynamics of the quarks inside the individual particles. The parameters of the quark bag model, representing baryons, are adjusted to reproduce the masses of the baryon octet in free space. The meson fields are coupled to the quarks. The three R(DD2YDelta)-models in Table \ref{tab:models} are proposed in this paper and are the first publicly available general purpose EoS models accounting for the baryonic octet and $\Delta$-resonances. These EoS tables have been obtained in the framework of CDFT assuming that $\Delta$s preserve their vacuum masses and have vanishing widths. The numbers in parenthesis correspond to the coupling constants of the $\Delta$ to $\sigma$, $\omega$ and $\rho$-mesonic fields, expressed as ratios with respect to couplings of nucleons. These values span a certain range in the parameter space associated to the nucleon-$\Delta$ interaction; for a discussion on present constraints, see Sec. \ref{sec:ND}. For the inhomogeneous matter at sub-saturation densities the HS(DD2) data on \textsc{CompOSE} are used. They have been obtained in the framework of the extended Nuclear Statistical Equilibrium (NSE) model by Hempel and Schaffner-Bielich \cite{Hempel_NPA_2010}. The transition from inhomogeneous to homogeneous matter is done for fixed values of $T$ and $Y_e$ by minimizing the free energy. Data in Table \ref{tab:models} show that models R(DD2YDelta)(1.1;1.1;1.0) and R(DD2YDelta)(1.2;1.1;1.0) are consistent with available constraints from observation of compact stars, specifically, massive NS; radii and masses inferences by NICER; range of tidal deformability derived from GW170817. R(DD2YDelta)(1.2;1.3;1.0) has a more modest performance when confronted with astrophysics data as it provides for $R_{14}$ a value exceeding the maximum value extracted from observations on PSR J0030+0451 \cite{Miller_2019,Riley_2019}. Compliance with constraints from nuclear physics experiments and ab initio calculations of nuclear matter is warranted by the use of DD2 effective interaction \cite{Fortin_PRC_2016}; compliance with hyper-nuclear physics data is met by the values of $U_Y^{(N)}$ on which meson coupling constants have been tuned. Also available are tables for purely nucleonic matter. The domains of temperature, baryonic number density and charge fraction covered by these EoS tables and the corresponding numbers of mash points are provided in Table \ref{tab:grids} in the Appendix A. The table corresponding to $\left(1.2, 1.1, 1.0 \right)$ is unique in the sense that pure baryonic matter manifests a small $\Delta$-driven instability domain, see Sec. \ref{sec:ND}. This instabilities are suppressed by the electron gas, which means that numerical simulations of astrophysics phenomena should not present signals typically associated with phase transitions. Provided that the values of coupling constants comply with experimental constraints, this collection of models can be extended such as to include also models that present instabilities. \section{Covariant density functional models for baryonic matter} \label{sec:CDFT} Covariant density functional or, equivalently, relativistic mean field (RMF) models have been successfully used to describe infinite nuclear matter, finite nuclei and stellar matter. They rely on the Walecka model \cite{Walecka_1974}, which treats nucleons as fundamental particle d. o. f. that interact with each other through the exchange of scalar and vector mesons. The scalar iso-scalar $\sigma$ and vector iso-scalar $\omega$ fields correspond to these mesons and account for the attractive and repulsive parts of the nuclear interaction. With the aim of better describing an ever increasing amount of data the original model was further developed by accounting for other mesons, e.g. the vector iso-vector $\rho$, scalar-isovector $\delta$ and, if strange baryons are considered, also strangeness hidden scalar $\sigma^*$ and vector $\phi$ mesons. Models with mixed interaction terms and density dependent coupling constants have been proposed as well. For a review, see \cite{Dutra_RMF_PRC_2014}. As the data generated for this paper and discussed in Sec. \ref{sec:HeavyBaryons}, \ref{sec:ND} and partially \ref{sec:FiniteT}, have been obtained in the framework of density dependent models in the following we shall review equations pertaining to this class of models. For the sake of brevity we shall limit ourselves to $\sigma$, $\omega$, $\rho$, $\phi$ mesonic fields. These are the only mesons considered in Sec. \ref{sec:HeavyBaryons}, \ref{sec:ND} as well as the new general purpose EoS with hyperons and $\Delta$s that we present here and made available on the \textsc{CompOSE} database. At finite temperature, $T$, the scalar and number densities of a baryon $i$ are given by \begin{align} n_i^s&= \frac{1}{\pi^2} \int_o^{\infty} \frac{k^2 m^*_i}{E_i(k)} \left[f_{\mathrm{FD}}(E_i(k)-\mu^*_i)+ f_{\mathrm{FD}}(E_i(k)+\mu^*_i) \right] dk~, \label{eq:ns}\\ n_i&= \frac{1}{\pi^2} \int_o^{\infty} k^2\left[f_{\mathrm{FD}}(E_i(k)-\mu^*_i)- f_{\mathrm{FD}}(E_i(k)+\mu^*_i) \right] dk~, \label{eq:n} \end{align} where $k$, $E_i(k)=\sqrt{k^2+m^{*,2}_i}$, $m^*_i$ and $\mu^*_i$ respectively stand for the wave number, kinetic part of the single particle energy, Dirac effective mass and effective chemical potential and $f_{FD}\left(\epsilon\right)=1/\left[ 1+\exp\left(\epsilon/T\right)\right]$ represents the Fermi-Dirac distribution function. The latter two quantities are linked to bare mass and chemical potential by \begin{align} m^*_i=m_i+\Sigma_{S;i}~, \label{eq:meffD} \\ \mu^*_i=\mu_i-\Sigma_{V;i}-\Sigma_R~. \label{eq:mueff} \end{align} with the scalar $\Sigma_{S;i}$ and vector $\Sigma_{V;i}$ self-energies and rearrangement term $\Sigma_R$ expressed by \begin{eqnarray} \Sigma_{S;i} &=&-g_{\sigma i} \bar \sigma~, \label{eq:Ss}\\ \Sigma_{V;i}&=&g_{\omega i} \bar \omega + g_{\rho i} t_{3i} \bar \rho +g_{\phi i} \bar \phi~, \label{eq:Sv}\\ \Sigma_R&=&\sum_j \left( \frac{\partial g_{\omega j}}{\partial n_j} \bar \omega n_j + t_{3 j} \frac{\partial g_{\rho j}}{\partial n_j} \bar \rho n_j + \frac{\partial g_{\phi j}}{\partial n_j} \bar \phi n_j - \frac{\partial g_{\sigma j}}{\partial n_j} \bar \sigma n_j^s \right)~.\nonumber \label{eq:SR}\\ \end{eqnarray} $t_{3i}$ represents the third component of isospin of baryon $i$ with the convention that $t_{3p}=1/2$. As non-linear interaction terms are disregarded, the mean-field expectation values of meson fields are given by \begin{subequations} \begin{eqnarray} m_{\sigma}^2 \bar \sigma=\sum_{i} g_{\sigma i} n_i^s, \label{eq:sigma}\\ m_{\omega}^2 \bar \omega=\sum_{i} g_{\omega i} n_i, \label{eq:omega}\\ m_{\phi}^2 \bar \phi=\sum_{i} g_{\phi i} n_i, \label{eq:phi}\\ m_{\rho}^2 \bar \rho=\sum_{i} g_{\rho i} t_{3i} n_i, \label{eq:rho} \end{eqnarray} \end{subequations} where $m_m$ with $m=\sigma, \omega, \rho, \phi$, stays for the meson masses. Baryonic energy density and pressure can be cast as sums between a kinetic and an interaction term, \begin{eqnarray} e_{baryon}=e_{kin}+e_{meson}~,\label{eq:ebar}\\ p_{baryon}=p_{kin}+p_{meson}+p_{rearrang} \label{eq:pbar}~. \end{eqnarray} In eq. (\ref{eq:pbar}) an additional "rearrangement" term exists, \begin{equation} p_{rearrang}=n_B \Sigma_R~, \end{equation} due to the couplings' density-dependence. The kinetic terms in eqs. (\ref{eq:ebar}) and (\ref{eq:pbar}) account for kinetic contributions of every species, \begin{eqnarray} e_{kin}&=&\sum_i \frac{2 J_i+1}{2 \pi^2} \int_0^{\infty} \frac{dk k^2}{E_i(k)} \left[f_{FD}\left(E_i(k)-\mu^*_i \right) + f_{FD}\left(E_i(k)+\mu^*_i \right) \right]~, \label{eq:ekin} \nonumber\\ \\ p_{kin}&=&\frac 13 \sum_i \frac{2 J_i+1}{2 \pi^2} \int_0^{\infty} \frac{dk k^4}{E_i(k)} \left[f_{FD}\left(E_i(k)-\mu^*_i \right) + f_{FD}\left(E_i(k)+\mu^*_i \right) \right]~, \label{eq:pkin} \nonumber \\ \end{eqnarray} where $\left(2 J_i+1 \right)$ represents the spin degeneracy factor of the $i$ baryon. Interaction terms exclusively depend on average values of mesonic fields \begin{eqnarray} e_{meson}&=&\frac{m_{\sigma}^2}{2}\bar\sigma^2+ \frac{m_{\omega}^2}{2}\bar\omega^2+ \frac{m_{\phi}^2}{2}\bar\phi^2+ \frac{m_{\rho}^2}{2}\bar\rho^2~, \label{eq:emeson} \\ p_{meson}&=&-\frac{m_{\sigma}^2}{2}\bar\sigma^2+ \frac{m_{\omega}^2}{2}\bar\omega^2+ \frac{m_{\phi}^2}{2}\bar\phi^2+ \frac{m_{\rho}^2}{2}\bar\rho^2~. \label{eq:pmeson} \end{eqnarray} The entropy density of baryonic matter writes \begin{eqnarray} s_{baryon}&=&-\sum_i \frac{2 J_i+1}{2 \pi^2} \int_0^{\infty} dk k^2 \Bigg\{\Bigl[ f_{FD}\left(E_i(k)-\mu^*_i \right) \ln f_{FD}\left(E_i(k)-\mu^*_i \right) \nonumber\\ &+&\bar f_{FD}\left(E_i(k)-\mu^*_i \right) \ln \bar f_{FD} \left(E_i(k)-\mu^*_i \right) \Bigr] + \left(\mu^*_i \rightarrow -\mu^*_i \right) \Biggr\}~. \end{eqnarray} Together with other thermodynamic quantities it verifies the thermodynamic identity \begin{equation} e_{baryon}=T s_{baryon}-p+\sum_i \mu_i n_i~. \end{equation} Matter composition is determined, at arbitrary thermodynamic conditions, by conservation of mass and charge, \begin{eqnarray} n_B=\sum_i n_i,\\ n_Q=\sum_i q_i n_i, \end{eqnarray} along with chemical equilibrium. For the case of hyperon and $\Delta$-admixed nucler matter chemical equilibrium conditions write, \begin{eqnarray} \mu_n=\mu_{\Lambda}=\mu_{\Xi^0}=\mu_{\Sigma^0}=\mu_{\Delta^0}=\mu_B,\\ \mu_{\Sigma^-}=\mu_{\Xi^-}=\mu_{\Delta^-}=\mu_B-\mu_Q,\\ \mu_p=\mu_{\Sigma^+}=\mu_{\Delta^+}=\mu_B+\mu_Q,\\ \mu_{\Delta^{++}}=\mu_B+2\mu_Q, \end{eqnarray} where $\mu_B$ and $\mu_Q$ stand for baryon and charge chemical potentials. Note that $\beta$-equilibrium is not assumed. Non-conservation of strangeness assumes $\mu_S=0$. Finally the interaction potential of particle $j$ in $k$-particle matter is given by, \begin{eqnarray} U_j^{(k)}&=&m^*_j-m_j+\mu_j-\mu^*_j,\label{eq:Ujk}\\ &=&\Sigma_{S;j} + \Sigma_{V;j} + \Sigma_R. \label{eq:U} \end{eqnarray} As customarily in the literature throughout this paper couplings of heavy baryons to mesonic fields will be expressed as ratios to the corresponding couplings of nucleons. We shall also assume that the density dependencies of couplings of heavy baryons to mesonic fields are identical the ones of nucleons. \section{Heavy Baryons at finite-$T$: the cases of $\Lambda$- and $\Delta$-admixed nuclear matter} \label{sec:HeavyBaryons} In the following we shall analyze the $T$- and $n_B$-dependence of various thermodynamic and microscopic quantities along with matter composition. The study will be performed for temperatures in the range $0.5 \leq T \leq 40~{\rm MeV}$, neutron rich matter with $Y_Q=0.3$ and two values of baryonic particle number density, $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. The role of strange baryons and nucleonic resonances will be highlighted by confronting results of $\Lambda$- and $\Delta$-admixed nuclear matter to results of purely nucleonic matter $\left(N \right)$. For brevity in some circumstances only the characteristics of dominant species will be illustrated. The employed nucleonic interaction is DD2~\cite{DD2}. \begin{figure*} \includegraphics[width=0.5\columnwidth]{figs/Xn.eps} \includegraphics[width=0.5\columnwidth]{figs/Xp.eps} \includegraphics[width=0.5\columnwidth]{figs/XL.eps} \includegraphics[width=0.5\columnwidth]{figs/XD.eps} \caption{$T$-dependence of relative particle abundances. Results corresponding to $N \Lambda$ and $N \Delta$-matter are confronted with those of nuclear matter ($N$) with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:Xi} \end{figure*} The $n_B$ and $T$-dependence of neutron, proton, $\Lambda$ and $\Delta$s relative abundances is depicted in Fig. \ref{fig:Xi}. Abundances of exotic species strongly depend on thermodynamic conditions and as a rule of thumb increase with $T$. At low (high) densities the abundances of $\Lambda$ and $\Delta^-$, which is the dominant member of the $J=3/2$ quadruplet, show significant (negligible) dependence on $T$. Mass conservation and chemical equilibrium condition $\mu_n=\mu_{\Lambda}$ make that nucleation of $\Lambda$ entails a certain diminish of neutron particle number densities, while no modification is seen in what regards $X_p$. The situation of $\Delta$-admixed nuclear matter is more complex. The onset of $\Delta^-$ reduces $X_n$ and enhances $X_p$. The first effect comes from mass conservation, while the latter is due to charge conservation and opposite charges of the dominant charged species, $p$ and $\Delta^-$. For the simple situations considered here one notices that abundances of exotic particles also increase with $n_B$. \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/sigmaomega_T.eps} \includegraphics[width=0.49\columnwidth]{figs/rhophi_T.eps} \caption{$T$-dependence of mesonic fields. Results corresponding to $N$, $N \Lambda$ and $N \Delta$-matter with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:fields} \end{figure} The $n_B$ and $T$-dependence of mesonic fields is addressed in Fig. \ref{fig:fields}. The following remarks are in order: {\em (a) $N$-matter:} Being defined in terms of number densities of different particle degrees of freedom the average values of vector iso-scalar $\omega$ and vector iso-vector $\rho$ mesonic fields do not depend on temperature. The decrease of $\bar \sigma$ with $T$ is due to the fact that, for any species $i$, the maximum contribution to the integrals in eq. (\ref{eq:sigma}) is given by the $k$-values close to the solution of $\sqrt{k_i^2+m_{i}^{*2}}=\mu^{*}_{i}$ and that neutron and proton effective chemical potentials decrease with $T$, see Fig. \ref{fig:mus}. {\em (b) $N \Lambda$-matter:} As already discussed, high $T$-values favor the production of $\Lambda$s at the cost of neutrons, which explains that $|\bar \phi|$ augments with $T$ and $|\bar \rho|$ diminishes with $T$. The latter feature suggests that, for fixed $Y_Q$, hot matter is more isospin symmetric than cold matter, in agreement with Fig. \ref{fig:Xi}. Similarly to the case of $\bar \sigma(T)$ in $N$-matter and for the same reason $\bar \sigma$ and $\bar \omega$ decrease with $T$. {\em (c) $N \Delta$-matter:} Similarly to $\Lambda$s, also the production of $\Delta$s is favored by high temperatures and densities. Under the considered conditions, $\Delta^-$ is by far the most abundant species as its chemical potential, $\mu_{\Delta^-}=\mu_B-\mu_Q$, with $\mu_Q<0$ is the largest. As $X_{\Delta} \ll X_{\Lambda}$, the average values of all mesonic fields in $N \Delta$ matter differ less with respect to their values in pure nucleonic matter than it was the case with $N \Lambda$. Qualitative differences of $\bar \sigma(T)$ and $\bar \omega (T)$ in $N \Delta$ with respect to $N \Lambda$ stem from opposite modifications of $X_n$ and $X_p$, with the latter prevailing over the first. $\bar \sigma$ and $\bar \omega$ augment with density as both scalar and vector number densities do so; the $n_B$-decrease of $g_{\rho B}$ explains the $n_B$-decrease of $|\bar \rho|$, the negative values being due to the fact that matter is neutron rich. As the $\phi$ meson couples only to hyperons, $\bar \phi \neq 0$ only in $\left(N \Lambda \right)$ matter. Its absolute value increases with $n_B$ as high densities favor production of strange particles. \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/vecselfenn_T.eps} \includegraphics[width=0.49\columnwidth]{figs/vecselfenp_T.eps} \caption{Vector self energies of neutrons and protons, eq. (\ref{eq:Sv}), as function of $T$ in nuclear matter $\left(N \right)$ as well as $N \Lambda$ and $N \Delta$-matter with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:vecselfen} \end{figure} The $T$-dependence of vector self-energies, eq. (\ref{eq:Sv}), at constant density is represented in Fig. \ref{fig:vecselfen}; only the behavior of dominant species is illustrated. One notes that $-\Sigma^V_{n,p}$ strictly follow the $T$-evolution of dominant mesonic fields, $\omega$ and $\sigma$, see Fig. \ref{fig:fields}. The strongest $T$-dependence is obtained for $N \Lambda$ matter at the lowest considered density, where chemical composition changes steeply. \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/mun_T.eps} \includegraphics[width=0.49\columnwidth]{figs/mup_T.eps} \caption{Neutron and proton chemical potentials as function of $T$ in nuclear matter $\left(N \right)$ as well as $N \Lambda$ and $N \Delta$-matter with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:mus} \end{figure} The $T$-evolution of neutron and proton chemical potentials and effective chemical potentials is illustrated in Figs. \ref{fig:mus} and, respectively, \ref{fig:mueff}. With the exception of relatively abundant particles whose abundances augment with $T$, as is the case of protons in $N\Delta$-matter at $n_B=0.4~{\rm fm}^{-3}$, (effective) chemical potentials diminish with temperature. For neutrons, which represent the dominant species, a strong correlation exists between abundances and effective chemical potential. As in all cases considered here matter is neutron rich, $\mu_n>\mu_p$. \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/mueffn_T.eps} \includegraphics[width=0.49\columnwidth]{figs/mueffp_T.eps} \caption{The same as in Fig. \ref{fig:mus} for neutron and proton effective chemical potentials, eq.(\ref{eq:mueff}). } \label{fig:mueff} \end{figure} \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/mDn_T.eps} \caption{$T$-dependence of nucleon Dirac effective mass, eq.(\ref{eq:meffD}), for the cases considered in Fig. \ref{fig:Xi}. } \label{fig:Diracmass} \end{figure} Eq. (\ref{eq:meffD}) states that the $T$- and $n_B$-dependence of the Dirac effective mass of any baryon is governed by the corresponding dependencies of $\bar \sigma$. $m^*_{n/p}(T,n_B)$ are illustrated in Fig. \ref{fig:Diracmass}. Fig. \ref{fig:fields} shows that $\Delta$-admixed matter singles out by $\bar \sigma$ increasing both with temperature and density. As such, contrary to what happens in nucleonic matter and $\Lambda$-admixed nuclear matter, in $\Delta$-admixed nuclear matter the Dirac effective mass of nucleons decreases with density and, under specific thermodynamic conditions, also with temperature. The validity limit of the model is reached when nucleon effective Dirac masses vanish. For a parameter study of the maximum baryonic densities reachable in $N\Delta$-matter, see Sec. \ref{sec:ND}. \begin{figure*} \begin{center} \includegraphics[width=0.5\columnwidth]{figs/ekinn_T.eps} \includegraphics[width=0.5\columnwidth]{figs/ekinp_T.eps} \includegraphics[width=0.5\columnwidth]{figs/emesons_T.eps} \end{center} \caption{$T$-dependence of different terms in eq. (\ref{eq:ebar}). Results corresponding to $N$-, $N\Lambda$- and $N \Delta$-matter with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:suppl_en} \end{figure*} \begin{figure*} \includegraphics[width=0.5\columnwidth]{figs/pkinn_T.eps} \includegraphics[width=0.5\columnwidth]{figs/pkinp_T.eps} \includegraphics[width=0.5\columnwidth]{figs/pmesons_T.eps} \includegraphics[width=0.5\columnwidth]{figs/prearrang_T.eps} \caption{The same as in Fig. \ref{fig:suppl_en} for different terms in eq. (\ref{eq:pbar}). } \label{fig:suppl_p} \end{figure*} Contributions of different terms in eqs. (\ref{eq:ebar}) and (\ref{eq:pbar}) are illustrated in Figs. \ref{fig:suppl_en} and, respectively, \ref{fig:suppl_p} as function of $T$ for different values of baryonic density and matter compositions. In some cases, neutron and proton kinetic energy densities and pressures increase with $T$. These situations correspond to contributions of high momentum states in eqs. (\ref{eq:ekin}) and (\ref{eq:pkin}) that underscore the $T$-reduction of effective chemical potentials. For $N\Lambda$-matter at $n_B=0.4~{\rm fm}^{-3}$ and $N\Delta$-matter the kinetic contribution of neutrons manifests an opposite behavior. These situations correspond to the cases where $\mu^*_{n}(T)$ shows a steep decrease, see Fig. \ref{fig:mueff}. Quite remarkably, the qualitative patterns of $e_{kin;n/p}(T)$ and $p_{kin;n/p}(T)$ as well as the relative arrangement of curves corresponding to different mixtures and/or baryonic densities is the same. The $T$-dependence of $p_{meson}$ shows a complex behavior: at high densities where mesonic fields show small variation with $T$, a tiny increase with $T$ is obtained; for $N$- and $N\Delta$-matter with $n_B=0.4~{\rm fm}^{-3}$, $p_{meson}$ increases with $T$; in the first (second) case this is mainly due to the decrease (increase) with $T$ of $\bar \sigma$ ($\bar \omega$), see Fig. \ref{fig:fields}; for $N\Lambda$ matter with $n_B=0.4~{\rm fm}^{-3}$, $p_{meson}$ has a non-monotonic behavior due to the interplay between $\bar \sigma$ and $\bar \omega$, both decreasing with $T$. Similarly to $p_{meson}$ at $n_B=0.6~{\rm fm}^{-3}$ and for the same reasons also $e_{meson}$ shows a weak sensitivity to $T$. In what regards the behavior at $n_B=0.4~{\rm fm}^{-3}$, one notes that $e_{meson}(T)$ increases (decreases) in $N\Delta$ ($N$ and $N\Lambda$) matter. Fig. \ref{fig:fields} shows that this is the direct consequence of $T$-dependence of dominant $\bar \sigma$ and $\bar \omega$ fields. For fixed densities, the $T$-dependence of the rearrangement pressure depends on the $T$-evolution of average mesonic fields. Little (strong) $T$-dependence of these fields at high (low) densities, see Fig. \ref{fig:fields}, explain the behavior shown in the right panel. For the thermodynamic conditions under consideration here meson terms overshoot all other terms in $e_{baryon}$ and $p_{baryon}$. Out of the different terms in eq. (\ref{eq:pbar}) the highest $T$-dependence is shown by $p_{meson}$. This means that, to a large extend, $p_{baryon}(T)$ will reflect the $T$-dependence of $p_{meson}$. The confirmation is provided by the right panel in Fig. \ref{fig:enp}. For $n_B=0.4~{\rm fm}^{-3}$ $p_{baryon}^{(N\Lambda)}(T)$ has a $U$-shape, while in all other cases $p_{baryon}$ increases with $T$. The left panels in Fig. \ref{fig:enp} show that, in spite of the complex $T$-dependence of various terms entering eq. (\ref{eq:ebar}), $e_{baryon}$ increases with $T$. \begin{figure} \includegraphics[width=0.49\columnwidth]{figs/ebaryon_T.eps} \includegraphics[width=0.49\columnwidth]{figs/pbaryon_T.eps} \caption{$T$-dependence of energy density and pressure. Results corresponding to $N$-, $N\Lambda$- and $\Delta N$-matter with $Y_Q=0.3$ at $n_B=0.4~{\rm fm}^{-3}$ and $0.6~{\rm fm}^{-3}$. } \label{fig:enp} \end{figure} \section{Thermodynamic stability of $\Delta$-admixed nuclear matter: the case of $T=0$} \label{sec:ND} Within QCD the Delta-resonance is explained as a spin-isospin excitation of the nucleon into a $\left(J,I \right)=\left(3/2, 3/2\right)$ configuration. Its strong coupling with the continuum of pion-nucleon $p$-wave scattering states explains its rapid decay in vacuum, within a half-life of about $t_{1/2}\approx 10^{-23}~{\rm s}$. Due to the Pauli blocking, the $\Delta$s are nevertheless considered to be stabilized when embedded in a medium. The fact that, contrary to other baryons, $\Delta$-resonances are excited in various types of reactions ~\cite{Lenske_PPNP_2018}, can in principle be exploited to constrain the interaction potential with nucleons. The data are nevertheless scarce such that the consequences of the onset of $\Delta$s in neutron stars are typically evaluated by allowing to the coupling constants of $\Delta$ to various mesonic fields to span wide ranges \cite{Drago_PRC_2014,Kolomeitsev_NPA_2017}. Herein the same modus operandi will be adopted. Refs. \cite{Cai_PRC_2015,Zhu_PRC_2016} show that, if no other exotic degree of freedom is considered, nucleation of $\Delta$s reduces the maximum mass of NS by up to $\approx 0.5M_{\odot}$ and radii of intermediate mass NS by up to $\approx 2~{\rm km}$. Both effects are due to the pressure decrease that accompanies the onset of any extra particle degree of freedom. The reduction of maximum mass reflects the reduction of pressure at baryonic densities equal to the values of the maximum mass configurations. The reduction of radii of intermediate mass NS reflects the evolution of pressure at the power $1/4$ at lower densities, typically $n_{sat} \leq n_B \leq 2n_{sat}$ \cite{Lattimer_PhysRep_2007}. If also hyperons are accounted for the only notable effect is the reduction of NS radii \cite{Drago_PRC_2014,Kolomeitsev_NPA_2017,Li_PLB_2018,Ribes_2019,Li_ApJL_2019,Raduta_MNRAS_2020}. The explanation resides in that, due to their attractive potential, $\Delta$s start nucleating at lower densities than the hyperons. The magnitude of these modifications nevertheless depends on the underlying nucleon effective interaction, strength of $\Delta N$ potential and $\Delta$s effective mass. Most recently Ref. \cite{Raduta_PLB_2021} has highlighted a series of other modifications. The first consists in the fact that, if the $\Delta N$ interaction potential is attractive enough, $\Delta$-admixed nuclear matter becomes thermodynamically instable. These instabilities persist at finite temperatures and out of the $\beta$-equilibrium condition, which might in principle impact astrophysical scenarios like CCSN, collapse into a BH and BNS mergers \cite{Peres_PRD_2013,Aloy_MNRAS_2019}. The second finding regards the shift of the nucleonic dUrca threshold to low densities, with obvious impact on the thermal evolution of isolated and accreting NS. This modification arises because $\Delta^-$, which is the first $\Delta$ to be populated at $\beta$-equilibrium, partially supresses the neutralizing electron gas which, in turn, regulates the relative abundances of neutrons and protons. Though also these modifications depend on the strength of the $\Delta$ effective interaction they manifest over domains of the parameter space compatible with present astrophysical constraints. In this section we shall investigate the following aspects: i) the dependence of the $\Delta$-potential in nuclear matter and ii) the maximum value of baryonic particle number density on $\Delta$ couplings to mesonic fields, iii) thermodynamic instabilities of cold $N \Delta$ and $N \Delta e$ matter. For ii) and iii) the limiting values $Y_Q=0.01$ and 0.5 will be considered. As in Ref. \cite{Raduta_PLB_2021} hyperons and muons are disregarded for simplicity. As \cite{Drago_PRC_2014,Kolomeitsev_NPA_2017,Li_PLB_2018,Ribes_2019,Li_ApJL_2019} we shall allow the strength functions to cover wide domains of values, $0.90 \leq x_{\sigma \Delta} \leq 1.50$, $-0.20 \leq x_{\sigma \Delta}-x_{\omega \Delta} \leq 0.20$. For brevity $x_{\rho \Delta}=1$. For nucleons the DD2 \cite{DD2} effective interaction is employed; note that this interaction is different than the one used in \cite{Raduta_PLB_2021}. \begin{figure} \begin{center} \includegraphics[width=0.79\columnwidth]{figs/UDeltaN_SNM_nsat.eps} \end{center} \caption{Single-particle potential of $\Delta$ isobars in saturated symmetric nuclear matter, $U_{\Delta}^{(N)}(n_{sat})$, for $x_{\rho\Delta}=1$. The symbols correspond to the following sets of $(x_{\sigma\Delta},x_{\omega\Delta})$: (1.1,1.1), (1.2, 1.1), (1.2, 1.3) for which $U_{\Delta}^{(N)}=-83~{\rm MeV}$, -124 MeV and -57 MeV. } \label{fig:UDN} \end{figure} \begin{figure} \begin{center} \includegraphics[width=0.79\columnwidth]{figs/nBmax_Yq=001.eps} \includegraphics[width=0.79\columnwidth]{figs/nBmax_Yq=050.eps} \end{center} \caption{Maximum reachable value of $n_B$ (in ${\rm fm}^{-3}$) in cold $\Delta$-admixed nuclear matter with $Y_Q=0.01$ (top) and $Y_Q=0.5$ (bottom), determined by vanishing nucleon Dirac effective mass. } \label{fig:nbmax} \end{figure} \begin{figure} \begin{center} \includegraphics[width=0.79\columnwidth]{figs/InstabDom_Yq=001.eps} \includegraphics[width=0.79\columnwidth]{figs/InstabDom_Yq=05.eps} \end{center} \caption{Parameter sets which allow for $\Delta$-driven spinodal instabilities in cold $\left( N, \Delta \right)$ (red) and $\left( N, \Delta, e \right)$ (blue) matter with $Y_Q=0.01$ (top) and $Y_Q=0.5$ (bottom). } \label{fig:instab} \end{figure} \begin{figure} \begin{center} \includegraphics[width=0.49\columnwidth]{figs/CminXi_Yq=001.eps} \includegraphics[width=0.49\columnwidth]{figs/CminXi_Yq=05.eps} \end{center} \caption{ Top: Minimum value of the curvature matrix as function of $n_B$ in cold $\Delta$-admixed nuclear matter; results corresponding to pure baryonic matter (baryonic matter plus electrons) are illustrated with red (blue) lines. Bottom: Relative particle abundances as function of $n_B$. Left (right) panels correspond to $Y_Q=0.01$ ($Y_Q=0.5$). The values of coupling constants are mentioned on the figure. } \label{fig:Cmin} \end{figure} \subsection{$U_{\Delta}^{(N)}$ potentials} \label{ssec:UDN} The well depth of the $\Delta$-potential in nuclear matter writes~\footnote{Eq. (\ref{eq:UDN}) corrects eq. (1) in \cite{Raduta_PLB_2021}, where the rearrangement term has been omitted. The calculations in \cite{Raduta_PLB_2021} have been nevertheless performed with the correct expression.} \begin{equation} U_{\Delta}^{(N)}=-g_{\sigma \Delta} \bar \sigma+g_{\omega \Delta} \bar \omega + g_{\rho \Delta} t_{3} \bar \rho+\Sigma_R, \label{eq:UDN} \end{equation} where $t_3$ is the third component of the isospin, with the convention $t_{3\Delta^{++}}=3/2$. [Herein the baryonic particle number density dependence of the potential, coupling constants, rearrangement term and mesonic fields has been omitted.] Eq. (\ref{eq:UDN}) shows that large values of $g_{\sigma \Delta}$ and low values of $g_{\omega \Delta}$ entail more attractive potentials. It also shows that in neutron rich matter, where $\bar \rho<0$, the potential felt by positively charged isobars is larger in absolute values than the one felt by negative isobars. In symmetric nuclear matter, where $\bar \rho=0$, all isobars experience the same potential. Experimental data from pion-nucleus scattering and pion photo-production, electron scattering on nuclei and electromagnetic excitation of the $\Delta$-baryons, compiled by \cite{Drago_PRC_2014,Kolomeitsev_NPA_2017}, have been translated into a $\Delta$-potential at rest in nuclear matter slightly more attractive than the one of nucleons, $-30~{\rm MeV}+U_{N}^{(N)} \lesssim U_{\Delta}^{(N)} \lesssim U_{N}^{(N)}$. Recent analysis of inclusive quasi-elastic electron scattering data on nuclear targets \cite{Bodek_EPJC_2020} led to $U_{\Delta}^{(N)} \approx 1.5 U_{N}^{(N)}$, which corresponds to the maximum attraction boundary cited above. Comparison between experimental pion production data in energetic heavy ion collisions and results of a quantum molecular transport model have been exploited in order to extract, in addition to the isoscalar $\Delta$ potential, also the isovector component. The results reveal correlations of these two components with the value of Landau effective mass of $\Delta$ and slope of the symmetry energy. Fig. \ref{fig:UDN} illustrates the range of values spanned by $U_{\Delta}^{(N)}$ in saturated symmetric nuclear matter. It comes out that $U_{\Delta}^{(N)}(n_{\rm sat})$ is degenerate with respect to these two coupling constants and for all considered combinations $\left( x_{\sigma \Delta}, x_{\omega \Delta} \right)$ the potential is attractive. The values taken by $U_{\Delta}^{(N)}(n_{\rm sat})$ when the coupling constants take the values employed by the three new general purpose EoS models proposed in this paper, see Sec. \ref{sec:Models}, are signaled by symbols. For $(1.1,1.1,1.0)$ and $(1.2,1.3,1.0)$ $U_{\Delta}^{(N)}$ falls in the domain $-30~{\rm MeV}+U_{N}^{(N)} \lesssim U_{\Delta}^{(N)} \lesssim U_{N}^{(N)}$ \cite{Drago_PRC_2014,Kolomeitsev_NPA_2017}, while more attraction is obtained for $(1.2,1.1,1.0)$. \subsection{Maximum baryonic particle number density} Refs. \cite{Spinella-PhD,Lavagno_2019} showed that, for wide domains of the parameter set, the maximum mass of $\Delta$-admixed NS is much lower than the one corresponding to nucleonic NS built upon the same effective nucleonic interaction. \cite{Raduta_PLB_2021} showed that this does not stem from the softening of the $P(e)$ EoS upon nucleation of $\Delta^-$ but from the inability to reach baryon densities high enough to sustain massive NS, due vanishing nucleon Dirac effective masses. For the $\Delta$-induced modifications of $m^*_{n/p}$, see Sec. \ref{sec:HeavyBaryons}. EoS models falling in this situation will obviously not meet the lower bound on NS maximum mass \cite{Antoniadis2013} and should be ruled out. Maximum values of $n_B$ allowed by different combinations of $\left( x_{\sigma \Delta},x_{\omega \Delta}\right)$ but smaller than (the arbitrarily chosen value) $1.4~{\rm fm}^{-3}$ are depicted in Fig. \ref{fig:nbmax}. The panels corresponding to $Y_Q=0.5$ and 0.01 are very similar, as expected due to the weak sensitivity of the $\bar \sigma$ to the isospin asymmetry. The color levels show that high enough values of $n_{B;max}$ may be reached for any value of $x_{\sigma \Delta}$ provided that $x_{\omega \Delta}$ is tuned accordingly. Some of the thus selected sets of parameters will though not agree with constraints on $U_{\Delta}^{(N)}$, see Sec. \ref{ssec:UDN}. \subsection{Thermodynamic (in)stabilities} Sufficiently attractive interaction potentials are known to lead to thermodynamic instabilities. The best documented example in nuclear physics corresponds to sub-saturated nuclear matter where a liquid-gas like phase transition is predicted by a large variety of models, including phenomenological non-relativistic \cite{Ducoin_NPA_2006,Ducoin_NPA_2007,Rios_NPA_2010} and relativistic \cite{Ducoin_PRC_2008,Typel_EPJA_2014} mean field models and microscopic approaches \cite{Rios_PRC_2008,Carbone_PRC_2018}. This phase transition is nevertheless not expected to play a role in NS or core-collapse supernovae as it is suppressed by the neutralizing electron gas. According to \cite{Gulminelli_PRC_2012,Gulminelli_PRC_2013,Oertel_JPG_2015,Torres_PRC_2017} strangeness-driven instabilities may manifest in supra-saturated matter and, contrary to the case discussed above, are not significantly altered by electrons such that they might be explored along the $\beta$-equilibrium path as well as out of $\beta$-equilibrium in the neutrino transparent matter. In lack of sufficient knowledge of effective baryon interactions in strangeness $S=1$ and 2 channels this possibility nevertheless remains speculative. Ref. \cite{Lavagno_2019,Raduta_PLB_2021} proved that CDFT models allow for $\Delta$-driven instabilities in NS matter. These instabilities might occur for strength parameters in accord with available data and extend over a narrow density domain at densities slightly exceeding $n_{sat}$. Spinodal instabilities manifest as convexity anomalies of the thermodynamic potential and are mathematically signaled by negative values of the curvature matrix $C_{i,j}=\partial \mu_i/\partial n_j$, where $\mu$ and $n$ stand for the chemical potential and number density of the two conserved charges $i,j=B,Q$. We extend here the investigation performed in \cite{Raduta_PLB_2021} to matter with fixed charged fraction. Properties of purely baryonic matter and mixture of baryons and electrons with $Y_Q=Y_e$ are confronted in Fig. \ref{fig:instab}. The cases $Y_Q=0.01$ and 0.5 are considered. $\Delta$-driven instabilities exist for both systems; the parameter sets which allow for them are more numerous for $Y_Q=0.01$ than for $Y_Q=0.5$. This first result is counter-intuitive as the domain of thermodynamic instabilities in dilute nuclear matter shrinks as $Y_Q$ diminishes. It can nevertheless be understood considering that production of $\Delta$s, in particular $\Delta^-$, is favored by small $Y_Q$-values. Indeed, Fig. \ref{fig:Cmin} shows that the $\Delta$ onset occurs at $n_B \approx 0.2~{\rm fm}^{-3}$ ($n_B \approx 0.42~{\rm fm}^{-3}$) for $Y_Q=0.01$ ($Y_Q=0.5$). Moreover at large densities, $\Delta$s are relatively more important in matter with low $Y_Q$-values. Fig. \ref{fig:instab} also shows that the neutralizing electron gas has almost no consequence at $Y_Q=0.5$ while at $Y_Q=0.01$ it suppresses the instabilities for $0.05 \lesssim x_{\sigma\Delta}-x_{\omega\Delta} \lesssim 0.1$. Having in mind the behavior of dilute nuclear matter also this result is surprising. It can nevertheless be explained considering that the surface of the thermodynamic potential is altered more by the early and strong production of $\Delta$s in matter with low $Y_Q$, see bottom panels of Fig. \ref{fig:Cmin}. Finally the density domains affected by instabilities are wider in matter with low $Y_Q$. We note that, when the contribution of the electron gas is accounted for, none of the models of $Y\Delta$-admixed matter introduced in this paper manifests instabilities. At variance with this pure baryonic matter is stable [unstable] for $\left(1.1, 1.1, 1.0 \right)$ and $\left(1.2, 1.1, 1.0 \right)$ [$\left( 1.2, 1.3, 1.0 \right)$]. \section{Finite temperature behavior} \label{sec:FiniteT} In this section we shall analyze thermal properties of a bunch of selected models accounting for various particle d.o.f. The behavior of baryonic matter and/or stellar matter, which means with lepton and photon gases contributions included, will be considered. Properties of pure baryonic matter are inferred from the corresponding tables on \textsc{CompOSE} database or, when these are not available, by subtracting from the values corresponding to stellar matter the contribution of lepton and photon gases. For each quantity we shall start by commenting the behavior of purely nucleonic matter seen in Paper I. \subsection{Energy density and pressure} \label{ssec:ethpth} Thermal effects on thermodynamic state variables like energy density and pressure are conveniently highlighted by considering the difference between the finite temperature and the zero temperature quantity \begin{equation} X_{\mathit{th}}=X(n_B, Y_e, T)-X(n_B, Y_e, 0)~. \label{eq:Xth} \end{equation} In Paper I we have shown that in the limit of vanishing density the baryonic thermal energy density $e_{th}$ and pressure $p_{th}$ approach zero and have no EoS-dependence, which means that whenever the interactions are weak the system recovers the ideal gas behavior; beyond this limit a strong EoS-dependence exists; at $n_B\gtrsim 1~{\rm fm}^{-3}$ the dispersion between non-relativistic (relativistic) models is large (small); the relative significance of thermal effects is more important at low densities than at high densities; pressure is more sensitive to $T$ than energy; non-relativistic and relativistic models manifest different patters of the $n_B$-dependence of thermal energy density and pressure. The latter feature is attributable to the different expressions of single particle energies in the two classes of models together with the different density dependencies of the effective masses they depend on. In agreement with previous findings in \cite{Constantinou_PRC_2014,Constantinou_PRC_2015} Paper I showed that in non-relativistic models $e_{th}$ depends on the Landau effective mass while $p_{th}$ depends on both Landau effective mass and its density dependence. In relativistic models the correlation between $e_{th}$ and $p_{th}$ and Dirac effective mass appears in that models with similar (different) density dependencies of this quantity produce similar (different) thermal effects. This feature is visible also in Figs. \ref{fig:eth} and \ref{fig:pth}, where thermal effects in HS(DD2) are similar to those in STOS(TM1) and different from those in SFHo. \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/eth_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/eth_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/eth_T=50_Ye=01.eps} \end{center} \caption{Baryonic contribution to the thermal energy density $e_{\mathit{th}}$, eq.~(\ref{eq:Xth}), as function of baryon number density for ($Y_e=0.3$, $T$=5 MeV) (top), ($Y_e=0.3$, $T$=20 MeV) (middle) and ($Y_e=0.1$, $T$=50 MeV) (bottom). The results are depicted for various EoS models. The indices 1, 2 and 3 of R(DD2YDelta) models refer to the following sets of couplings of $\Delta$ to $\sigma$, $\omega$ and $\rho$ mesonic fields: (1.1, 1.1, 1.0), (1.2, 1.1, 1.0), (1.2, 1.3, 1.0). } \label{fig:eth} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/pth_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/pth_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/pth_T=50_Ye=01.eps} \end{center} \caption{Same as fig. \ref{fig:eth} for the baryonic contribution to the thermal pressure. } \label{fig:pth} \end{figure*} Figs. \ref{fig:eth} and \ref{fig:pth} further analyze the role of exotic particle d.o.f., hyperons, $\Delta$-resonances, $K^-$ and quarks, on baryonic thermal energy density $e_{th}(n_B)$ and pressure $p_{th}(n_B)$ at various thermodynamic conditions. Predictions of models allowing for exotica are confronted with those of purely nucleonic counterparts. Fig. \ref{fig:eth} shows that, similarly to what happens for purely nucleonic matter, also in matter which accounts for extra particle d.o.f. $e_{th}$ augments with $n_B$ and $T$. Nucleation of exotic particles makes $e_{th}$ increase with respect to its value in nucleonic matter and the larger the number of particle d.o.f. the more significant this increase is. Indeed, for whatever $T$ and $n_B$, $e_{th}$ is larger for R(DD2YDelta) than for OMHN(DD2Y), which in turn is larger than for BHB(DD2L), which in turn is larger than for HS(DD2); predictions of $e_{th}$ by MBB(DD2K) and HS(DD2); IOTSY(TM1Y30pi), IOTSY(TM1Y30), STOS(TM1L) and STOS(TM1); SFHPST(TM1b139) and STOS(TM1) obviously comply to the same rule. The steep (smooth) increase of exotic particle abundances at low (high) temperature results in an abrupt (smooth) variation of $e_{th}(n_B)$. Confrontation of predictions of MBB(DD2K)~\cite{Malik_EPJA_2021} with those of HS(DD2)~\cite{Hempel_NPA_2010} shows that significant effects related to $K^-$ are obtained only at temperatures of the order of several tens MeV. Confrontation of predictions of IOTSY(TM1Y30pi) and IOTSY(TM1Y30)~\cite{Ishizuka_JPG_2008} shows that even at high temperatures the pions play little role. According to BBKF(DD2-SF)1.8~\cite{Bastian_PRD_2021} $e_{th}$ in quark matter is very high and increases linearly with $n_B$. In BBKF(DD2-SF) models~\cite{Bastian_PRD_2021} the phase transition between hadron and quark phases is realized by an (approximate) Gibbs construction, which assumes that in the phase coexistence domain $e_{th}$ is calculated as a linear combination of values at the borders. This explains the linear behavior of $e_{th}(n_B)$ as well as its large values. In what regards the width and localization of the phase coexistence domain, no significant $T$-dependence is observed. In SFHPST models~\cite{Sagert_JPG_2010} the transition between hadrons and quarks is realized via a Glendenning construction \cite{Glendenning_PRD_1992}; as a consequence the curves corresponding to these models do not allow straightforward identification of density domains populated by different phases. In this respect predictions by SFHPST resemble predictions of models with heavy baryons, which feature no phase transition. Results of BBKF(DD2-SF)1.8 and SFHPST resemble only in the very high values of $e_{th}$ obtained at $T=50~{\rm MeV}$. We also note that the model with small value of the bag constant, which allows for an early transition to quark matter, manifests large thermal contributions. We have seen in Fig. \ref{fig:enp} that under specific thermodynamic conditions $p_{baryon}^{(N\Lambda)}$ and $p_{baryon}^{(N\Delta)}$ decrease with $T$, which translates into negative values for the baryonic component of $p_{th}$. Figs. \ref{fig:pth} confirms that nucleation of exotic species results in a strong reduction of the baryonic component of $p_{th}$ and that under specific conditions this quantity becomes negative. Competition with increasing values of baryonic chemical potential, which favor higher $p_{th}$-values, explains the strongly fluctuating behavior of this quantity over the considered density domain for all EoS models which account for heavy baryons and $K^-$. The quark phase in BBKF(DD2-SF)1.8~\cite{Bastian_PRD_2021} is characterized also by large values of $p_{th}$, in addition to the large values of $e_{th}$ discussed earlier and, with the exception of a narrow domain neighboring the hadron-quark coexistence, $p_{th}$ increases with $n_B$. Equality of temperature and pressure between the hadron and quark phases, assumed by the (approximate) Gibbs construction, explains that in the coexistence domain all $p_{th}(n_B)$ curves at constant-$T$ feature a plateau. The narrow peak at the border between phase coexistence and quark phase is likely a numerical artifact. In spite of the fact that, similarly to the Gibbs construction, also the Glendenning phase construction assumes pressure equality no plateau is obtained in SFHPST-models. The evolution with $n_B$ is smooth but not necessarily monotonic. As for $e_{th}$, models with small bag constants lead to large thermal effects on $p_{th}$. Overall $p_{th}$ manifests strong dependence on EoS, temperature and baryonic density. The only situation in which a particle is seen to play a little role corresponds to pions at temperatures of the order of a few tens MeV or lower. \subsection{Thermal index} \label{ssec:Gammath} The strong EoS- and density dependence of $e_{th}$ and $p_{th}$ seen in Paper I spurred us to further investigate the reliability of the so-called $\Gamma_{th}$-law, customarily employed in numerical simulations \cite{Hotokezaka_PRD_2013,Bauswein_PRD_2010,Endrizzi_PRD_2018,Camelio2019,Weih_PRL_2020} in order to supplement cold EoS with finite temperature contributions. The behavior of the $\Gamma$-factor defined as \begin{equation} \Gamma_{th}=1+\frac{p_{th}}{e_{th}}~, \label{eq:Gammath} \end{equation} was analyzed separately for baryonic and stellar matter. In each case values of realistic EoS models have been compared with limiting values of idealized systems as well as with the domain of values, $1.5 \leq \Gamma_{th} \leq 2$, employed in simulations. The conclusions of Paper I dealing with nucleonic models can be summarized as follows: i) at high temperatures and low densities, where the ideal gas behavior is recovered, $\Gamma_{th;baryon} \to 5/3$, where $5/3$ is the classical limit for a dilute gas, ii) relativistic models provide for high $n_B$-values, $\Gamma_{th;baryon} \approx 4/3$, where $4/3$ corresponds to ultra-relativistic gases, iii) at high densities predictions of relativistic and non-relativistic models differ qualitatively and quantitatively, iv) over wide but EoS-dependent domains of $(n_B,T)$, $\Gamma_{th;tot}>2$ or $\Gamma_{th;tot}<1.5$. \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/Gammathtot_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/Gammathtot_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/Gammathtot_T=50_Ye=01.eps} \end{center} \caption{$\Gamma_{\mathit{th}}$, eq.(\ref{eq:Gammath}), as function of baryon number density at ($T$=5 MeV, $Y_e=0.3$), ($T$=20 MeV, $Y_e=0.3$), ($T$=50 MeV, $Y_e=0.1$). Results corresponding to stellar matter (contributions of lepton and photon gases are included). Dashed horizontal lines mark the values $\Gamma_{\mathit{th}}=1.5$ and 2. } \label{fig:Gammathtot} \end{figure*} The behavior of the $\Gamma_{th}$ factor for stellar matter is investigated in Fig. \ref{fig:Gammathtot}. Predictions corresponding to different EoS models and various thermodynamic conditions are considered. As in Paper I, we obtain a strong EoS-, $T$- and $n_B$-dependence of $\Gamma_{th;tot}$. The minima in $p_{th}(n_B)$, see Fig. \ref{fig:pth}, lead to one or several minima in $\Gamma_{th;tot}(n_B)$; the negative values of $p_{th}$ lead, for the lowest considered temperature, to negative values of $\Gamma_{th;tot}$. The hadron-quark coexistence region of BBKF(DD2-SF)1.8 singles out by $\Gamma_{th}$-values significantly smaller than those obtained in pure hadron and quark phases. The SFHPST-models show rather smooth but non-monotonic $\Gamma_{th;tot}(n_B)$ curves. The upper value $\Gamma_{th}=2$ used in simulations is exceeded only over narrow density domains and only by some of the models allowing for $\Delta$, $K^-$ and quarks; at variance with this all models predict $\Gamma_{th}<1.5$ over broad ranges of densities, where 1.5 is the lower limit assumed in simulations. The departure from $1.5 \leq \Gamma_{th}$ is more significant for exotic matter than it was for nucleonic matter. \subsection{Chemical potentials} \label{ssec:mus} \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/muB_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/muB_T=50_Ye=01.eps} \end{center} \caption{Baryon chemical potential as function of baryon number density at ($T$=5 MeV, $Y_e=0.3$) and ($T$=50 MeV, $Y_e=0.1$). } \label{fig:muB} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/muQ_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/muQ_T=50_Ye=01.eps} \end{center} \caption{The same as in Fig. \ref{fig:muB} for charge chemical potential. } \label{fig:muQ} \end{figure*} The impact of composition changes on baryon and charge chemical potentials is addressed in Figs. \ref{fig:muB} and \ref{fig:muQ}. Fig. \ref{fig:muB} confirms what we have seen in Fig. \ref{fig:mus} (left panel) for the simpler cases of $N\Lambda$ and $N\Delta$ matter. Namely that exotic particles are created at the cost of neutrons, which make $\mu_B=\mu_n$ decrease. At low temperatures, predictions of OMHN(DD2Y) are identical to those of BHB(Lphi) and differ from those of BHB(L); this suggests that the repulsion mediated by the exchange of $\phi$ mesons dominates over modifications induced by $\Sigma$s and $\Xi$s. Predictions of other hyperonic models based on the same nucleonic EoS model are very similar (slightly different) at low (high) $T$. At both low and high temperatures the three models corresponding to $NY\Delta$-matter provide almost the same $\mu_B(n_B)$ in spite of notable differences in chemical composition. The equality of baryon chemical potentials in the hadron and quark phases imposed by the (approximate) Gibbs construction in BBKF(D2-SF)1.8 explains the plateau in the curves belonging to this model; by increasing $T$ this plateau gets wider and shifts to lower densities; the information thus extracted from $\mu_B(n_B)$ at constant $T$ corrects the one previously extracted from the less thermodynamically relevant $e_{th}$ and $p_{th}$ as function of $n_B$ at constant $T$, see Figs. \ref{fig:eth} and \ref{fig:pth}. As no chemical equilibrium condition is assumed in the Glendenning construction, no constant-$\mu_B$ domain is featured by curves of SFHPST-models. The partial replacement of neutrons by exotic particles also makes $|\mu_Q|$ decrease, see Fig. \ref{fig:muQ}. The most dramatic modifications are obtained for models with large-$L$ values. As with $\mu_B(n_B)$, at $T=5~{\rm MeV}$ the predictions of OMHN(DD2Y) coincide with those of BHB(Lphi) and differ from those of BHB(L). At $T=50~{\rm MeV}$ and $Y_Q=0.1$ the largest departure from the predictions of nucleonic models is obtained for the following models: OMHN(DD2Y), the three R(DD2YD)-models, the two IOTSY(TM1Y)-models, MBB(DD2K); the two SFHPST-models. For the first listed models the explanation relies in the presence of negatively charged exotic species. For SFHPST(TM1) the explanation relies in the negatively charged strange quark. The fact that in BBKF(D2-SF)1.8 the (approximate) Gibbs construction is performed at constant $Y_Q$ explains why $\mu_Q$ is not constant in the hadron-quark coexistence region. The similar charge fractions in the two phases~\cite{Bastian_PRD_2021} nevertheless makes that the slope of $\mu_Q(n_B)$ is small. For completeness we mention that a rigorous Gibbs construction in stellar matter requires equality of lepton chemical potentials. As for $\mu_B(n_B)$, $\mu_Q(n_B)$ of SFHPS-models feature no plateau. We also note that in warm $Y$-, $Y\Delta$- and $K^-$-admixed matter with densities exceeding a certain value $\mu_Q>0$, which means that $n_n<n_p$. According to SFHPST(TM1B139) in hot matter protons dominate over neutrons over a large density domain. Before leaving this section let us note that, for nucleonic models, EoS stiffness and density dependence of the symmetry energy impact the high density values of baryon and charge chemical potentials. Indeed, the highest (smallest) value of $\mu_B$ corresponds to DD2 (TM1), which provides the stiffest (softest) model. Similarly, for isospin asymmetric nuclear matter DD2 (TM1), with a low (high) $L$-value, provides small (large) values of $|\mu_Q|$. \subsection{Entropy, specific heats, adiabatic index, speed of sound} \label{ssec:entropy} \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/SperA_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/SperA_T=50_Ye=01.eps} \end{center} \caption{Baryonic contribution to the entropy per baryon as function of baryon number density for ($T$=5 MeV, $Y_e=0.3$) and ($T$=50 MeV, $Y_e=0.1$). } \label{fig:SperA} \end{figure*} Further insight into the impact of exotic particle d.o.f. on thermodynamic quantities is offered in Fig. \ref{fig:SperA}. It shows the baryonic entropy per baryon for ($T$=5 MeV, $Y_e=0.3$) and ($T$=50 MeV, $Y_e=0.1$). As already seen and commented at length in Paper I, at fixed $T$ in models with nucleonic d.o.f. $S/A$ decreases with $n_B$. The same holds true for models with heavy baryons and/or $K^-$ at high temperatures. At fixed $T$ and $n_B$, $S/A$ increases with the number of particle species. The steep increase in the abundance of newly populated species, as it happens with heavy baryons and $K^-$ at low $T$, results in bumps of $S/A(n_B)$. The non-monotonic $S/A(n_B)$ in BBKF(DD2-SF)1.8 results from the first order transition between the hadron and quark phases, the latter being characterized by much larger values of $S/A$. Curves belonging to SFHPST-models are qualitatively similar to those produced by models with heavy baryons. The dispersion between the different curves increases with $T$ as so does the dispersion between chemical compositions. At high-$T$ models accounting for quarks deviate the most from the predictions of the nucleonic counterparts. \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/Cv_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/Cv_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/Cv_T=50_Ye=01.eps} \end{center} \caption{Specific heat at constant volume, $C_V$, as function of baryon number density for baryonic matter for ($T$=5 MeV, $Y_e=0.3$), ($T$=20 MeV, $Y_e=0.3$), ($T$=50 MeV, $Y_e=0.1$). } \label{fig:Cv} \end{figure*} The specific heat at constant volume is defined as \begin{equation} C_V=T \frac{\partial \left( S/A \right)}{\partial T}|_{V,\{N_i\}}~. \label{eq:cv} \end{equation} Fig. \ref{fig:Cv} illustrates the evolution of $C_V$ as function of baryon number density for different thermodynamic conditions. As easy to anticipate based of the definition, eq. (\ref{eq:cv}), $C_V(n_B)$ replicates the behavior of $S/A(n_B)$. Under specific thermodynamic conditions models which employ for the sub-saturation density domain the extended NSE calculations in \cite{Hempel_NPA_2010} show discontinuities over $n_{sat}/2 \lesssim n_B \lesssim n_{sat}$. These are numerical artifacts of the way in which the transition from clusterized to homogeneous matter was dealt with and have no physical ground. \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/GammaS_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/GammaS_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/GammaS_T=50_Ye=01.eps} \end{center} \caption{$\Gamma_S$, eq.~(\ref{eq:GS}), as function of baryon number density for ($T$=5 MeV, $Y_e=0.3$), ($T$=20 MeV, $Y_e=0.3$) and ($T$=50 MeV, $Y_e=0.1$). Results corresponding to stellar matter, as predicted by various EoS models. } \label{fig:GammaS} \end{figure*} The behavior of the adiabatic index, defined as \begin{equation} \Gamma_{S}=\frac{\partial \ln P}{\partial \ln n_B}|_{S}= \frac{C_P}{C_V} \frac{n_B}{P} \frac{\partial P}{\partial n_B}|_T~, \label{eq:GS} \end{equation} is illustrated in Fig.~\ref{fig:GammaS} for stellar matter, \textit{i.e.} with the contributions of leptons and photons included. The predictions by various EoS models at different thermodynamic conditions are considered. $\Gamma_S$ gives an indication about the stiffness of the EoS in all processes occuring at constant entropy. With the exception of the transition density from clusterized to homogeneous matter $\Gamma_S(n_B)$ of nucleonic EoS models is a smooth function. As discussed in Paper I, nucleonic models manifest a strong dependence of $\Gamma_S$ on EoS-model and $n_B$. Fig.~\ref{fig:GammaS} shows that at low (high) $T$, where abundances of heavy baryons and $K^-$ increase steeply (slowly) with baryonic density, EoS models which account for these particles provide $\Gamma_S(n_B)$ with sudden (smooth) changes of slope. The EoS softening produced by hyperons, $\Delta$s and $K^-$ leads to $\Gamma_S^{exotic}<\Gamma_S^{nucleonic}$. Predictions of IOTSY(TM1Y30) and IOTSY(TM1Y30pi) are identical or, for the highest $T$, very similar to those of STOS(TM1L). Also similar are the predictions of the three models that account for $Y\Delta$ introduced in this work. This suggests that modifications in heat capacities, see Fig. \ref{fig:Cv}, are canceled out by modifications in $\left(\partial \ln P/\partial\ln n_B\right) |_T$. EoS-models with transitions to quark matter show different features depending on how the transition was dealt with. In the hadron-quark coexistence BBKF-models present a plateau. It stems from the mechanical equilibrium between phases in the Gibbs construction. The high peak at densities slightly exceeding the high density border of phase coexistence is due to the stiff behavior of $P(e)|_T$. At temperatures of the order of a few tens MeV or lower, $\Gamma_S(n_B)$ predicted by SFHPST-models resembles the one of models with heavy baryons and $K^-$. At temperatures of the order of a several tens MeV, $\Gamma_S(n_B)$ of SFHPST(TM1B139) has a high peak at $n_B \approx 1-2 n_{sat}$. Quite remarkably, at the highest densities the scattering between different models is limited. \begin{figure*} \begin{center} \includegraphics[width=0.99\textwidth]{figs/cs2_T=5_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/cs2_T=20_Ye=03.eps} \includegraphics[width=0.99\textwidth]{figs/cs2_T=50_Ye=01.eps} \end{center} \caption{Speed of sound squared, eq. (\ref{eq:cs2}), as function of baryon number density in stellar matter for various EoS models. The considered thermodynamic conditions are: ($T$=5 MeV, $Y_e=0.3$), ($T$=20 MeV, $Y_e=0.3$) and ($T$=50 MeV, $Y_e=0.1$). } \label{fig:cs2} \end{figure*} A key quantity in dynamical numerical simulations is the speed of sound $v_S$. In units of $c$, the speed of light, it is given by \begin{equation} v_S^2=\frac{dP}{de}|_{S,A,Y_e}=\Gamma_S \frac{P}{e+P}~. \label{eq:cs2} \end{equation} Fig. \ref{fig:cs2} illustrates its behavior as function of baryon number density within the different EoS models. Different thermodynamic conditions, indicated in the figures, are considered. The three nucleonic models show a strong increase of $v_S$ with $n_B$ and limited sensitivities to the other thermodynamic variables, $T$ and $Y_Q$. The behavior of $v_S(n_B)$ in DD2 and TM1 differs qualitatively from the one in SFHo: while in DD2 and TM1 the increase gets attenuated at $n \approx 4 n_{sat}$, no such effect is seen for SFHo. This situation is attributable to the mixed coupling terms in the latter model. At high densities DD2 provides for the speed of sound a value almost twice larger than the one provided by the softer TM1 model. The CDFT formulation prevents violation of causality. In all circumstances models allowing for hyperons, $\Delta$s and $K^-$ provide smaller $v_S(n_B)$-values than their nucleonic counterparts. As it was the case with previously considered quantities, sudden modifications in abundances of exotic species are translated into sudden modifications of the speed of sound. The $T$-dependence of $v_S$ remains small as in the considered cases hyperons, $\Delta$s and $K^-$ are sub-dominant. As for $\Gamma_S$ to which $v_S$ is related, chemical equilibrium among hadron and quark phases in BBKF-models leads to vanishing values of the speed of sound. Moreover, in the pure quark phase, BBKF predicts that $v_S$ decreases with $n_B$. The only other case where such a behavior is obtained corresponds to SFHPST(TM1B139) and SFHPST(TM1B145) at the highest considered temperature. Detailed investigation in \cite{Aloy_MNRAS_2019} probes that the same holds true if, instead of constant-$T$ curves, one considers constant $S/A$-curves. Predictions of IOTSY(TM1Y30) and IOTSY(TM1Y30pi) are identical or very close to those of STOS(TM1L). A very small dispersion is obtained also among the predictions of the three models with hyperons and $\Delta$s. \section{Conclusions} \label{sec:Concl} Within CDFT we have constructed three general purpose EoS models with hyperons and $\Delta$-resonances ready to use in astrophysical simulations and made them available on the \textsc{CompOSE} repository (\url{https://compose.obspm.fr/}); to our knowledge these are the first publicly available 3D EoS databases which account for the $\Delta$-quadruplet. The domains of temperature, $0.1~{\rm MeV} \leq T \leq 100 ~{\rm MeV}$, baryonic particle number density, $10^{-12} ~{\rm fm}^{-3} \leq n_B \leq 1.1 ~{\rm fm}^{-3}$ and charge fraction $0.01 \leq Y_Q \leq 0.6$ for which data are provided make them suitable for studies of CCSN and BNS. Also available are databases corresponding to purely baryonic matter, which may be used for heavy ion collision studies. Our models have been built such as comply with experimental data from nuclear and hyper-nuclear physics; ab initio calculations of neutron matter; astrophysical observations of cold compact stars and - at the same time - partially account for uncertainties related to the population of $\Delta$s. As previously discussed in \cite{Raduta_PLB_2021}, for certain combinations of coupling constants of the $\Delta$ to mesonic fields, the nucleation of $\Delta$s may result in thermodynamic instabilities or limit the validity domain of the model by preventing the baryonic number density to exceed values of the order of $2-3 n_{sat}$. The latter issue arises because the Dirac effective mass of nucleons vanishes. The present work complements the study performed in \cite{Raduta_PLB_2021}, and which focuses on cold $\beta$-equilibrated matter and persistence of $\Delta$-driven instabilities at finite-$T$, by considering cold $\Delta$-admixed nuclear matter with extreme values of charge fraction $Y_Q=0.01$ and 0.5. Present results show that the parameter space which allows for instabilities gets wider as $Y_Q$ diminishes and that, for matter with $Y_Q=0.5$, purely baryonic and stellar matter exhibit instabilities for the same values of $(x_{\sigma \Delta}, x_{\omega \Delta})$. Both findings are in contrast with the phenomenology of dilute nuclear matter and understandable considering the $\Delta$'s abundances. We have then reviewed the general purpose EoS models with exotic d.o.f. presently available on \textsc{CompOSE}. The information provided for each model includes the nucleonic effective interaction together with the values of the nuclear matter parameters; the exotic d.o.f.; for CDFT models, information on various mesonic fields and values of the hyperon and $\Delta$ well depth potentials in symmetric saturated matter on which some meson coupling constants have been tuned; properties of cold $\beta$-equilibrated NS and compliance with constraints from compact star observations. The role of hyperons, $\Delta$s, pions, kaons and quarks as well as the consequences of the way in which the hadron-quark phase transition was dealt with have been investigated by analyzing the thermal properties for a number of models; wide ranges of baryonic number density $n_{sat} \lesssim n_B \leq 1~{\rm fm}^{-3}$, temperature $5~{\rm MeV} \leq T \leq 50~{\rm MeV}$ have been considered for charge franctions $Y_Q=0.1$ and 0.3. In agreement with previous studies we show that extra d.o.f. modify the values of baryon and charge chemical potentials and the modification depends upon the employed nucleonic effective interaction; for fixed values of $T$, $Y_Q$ and $n_B$ the entropy per baryon increases with the number of species; the behavior of $C_V(n_B)$ replicates the one of $S/A(n_B)$; EoS softening upon nucleation of exotica results in decreased values of the speed of sound; $v_S^2$ decreasing with $n_B$ are obtained only in quark matter. Other results concern the thermal energy density and pressure and the thermal index. Specifically we show that exotic d.o.f. result in thermal energy densities enhanced with respect to what is obtained in purely nucleonic matter; a strongly oscillatory behavior of the thermal pressure and thermal index and, under specific conditions, negative values of $p_{th}$ and $\Gamma_{th;tot}<0$. The latter feature suggests that the use of the $\Gamma$-law for supplementing cold EoS with thermal components is even less advisable for exotic matter than for nucleonic matter. Last but not least we have shown that the way in which the transition from hadronic to quark matter is dealt with impacts on a series of quantities like $p_{th}$, $\Gamma_{th}$, $\mu_B$, $\Gamma_S$, $v_S^2$. (Approximate) Gibbs constructions lead - in the phase coexistence domain - to plateaus for all the above listed quantities while no such behavior is obtained in the case of Glendenning constructions. {\bf Data Availability Statement} his manuscript has no associated data or the data will not be deposited. [Authors’ comment: This manuscript has no associated data as that all data are already available on the \textsc{CompOSE} site {\url{https://compose.obspm.fr/}}]. \begin{acknowledgements} The author gratefully acknowledges discussions with M. Oertel, C. Providencia and A. Sedrakian. Support from a grant of the Ministry of Research, Innovation and Digitization, CNCS/CCCDI – UEFISCDI, Project No. PN-III-P4-ID-PCE-2020-0293 is also acknowledged. This work has been partially funded by the European COST Action CA16214 PHAROS ''The multi-messenger physics and astrophysics of neutron stars''. \end{acknowledgements} \begin{appendix}{Appendix A} See Table \ref{tab:grids}. \begin{table} \caption{Domains of temperature, baryonic number density and charge fraction covered by the six R(DD2YDelta) EoS tables proposed in this work and the corresponding numbers of mash points.} \label{tab:grids} \begin{tabular}{llll} \hline\noalign{\smallskip} & $T$ & $n_B$ & $Y_Q$ \\ & [MeV] & [${\rm fm}^{-3}$] & \\ \noalign{\smallskip}\hline\noalign{\smallskip} Number of points & 76 & 302 & 60 \\ Minimum & 0.1 & $10^{-12}$ & 0.01 \\ Maximum & 100 & 1.1 & 0.60 \\ \noalign{\smallskip}\hline\noalign{\smallskip} \end{tabular} \end{table} \end{appendix} \bibliographystyle{spphys}
\section{Approximation term with GANs} In this appendix, we present another path to control the approximation term with vanilla Generative Adversarial Network. This problem was recently studied in \cite{belomestny2021rates}. Their results require stronger assumptions than what is presented in the paper, in particular that the statistician knows the constant $A$ involved in condition (BC). What is more, \subsection{Regularity conditions} \paragraph{Bounding condition} Density estimation under Kullback-Leiber loss is known to be a challenging problem. One work by \cite{hall1987kullback} has studied the asymptotic convergence rates for kernel estimators in a one-dimensional setting. It was shown that the tails of the kernel must be chosen appropriately regarding the tails property of the proper density to have convergent estimators. Thought theoretically relevant, these results are of poor interest for the practitioner who does not have this kind of information about the true density. In this work, we choose to restrict our attention to densities that are lower and upper bounded by some positive quantities. This is done to avoid hardly tractable tail behavior issues. In the sequel we consider that the following bounding condition is true for all $S \in \mathrm{Set}_d^k$ : \begin{equation} \tag{BC} \left\{ \begin{array}{l} e^{-A |S|} \leq f_S \leq e^{A |S|} \ \forall S \in {\mathcal{P}_*} \\ \end{array} \right. \label{BC} \end{equation} Fulfilling the condition implying $\hat{f}$ requires that $A$ is known by the statistician and can be used in estimation procedure. Under \ref{BC} it can be shown that the Kullback-Leibler loss can be controlled by the Jensen-Shannon ($\mathrm{JS}$) loss defined as follows \begin{equation} \JS{f}{g} = \frac{1}{2}\KL{f}{\frac{f+g}{2}} + \frac{1}{2}\KL{g}{\frac{f+g}{2}}. \end{equation} \begin{myprop}{Control of KL by JS}{controlKLJS} Under \ref{BC}, for any $S \in {\mathcal{P}_*}$ : \begin{equation} \KL{f_S}{\hat{f}_S} \leq \frac{8(1 + A|S|)}{2 \log 2 - 1}\JS{f_S}{\hat{f}_S}. \end{equation} \end{myprop} \begin{proof} Lemma 7.23 in \cite{massart2007concentration} ensures that \begin{equation} \KL{f_S}{\hat{f}_S} \leq \frac{4(1 + A|S|)}{2 \log 2 - 1}\KL{f_S}{\frac{\hat{f}_S + f_S}{2}} \end{equation} Then, using the nonnegativeness of $\mathrm{KL}$, we obtain \begin{equation} \KL{f_S}{\hat{f}_S} \leq \frac{8(1 + A|S|)}{2 \log 2 - 1}\left( \frac{1}{2}\KL{f_S}{\frac{\hat{f}_S + f_S}{2}} + \frac{1}{2}\KL{\hat{f}_S}{\frac{\hat{f}_S + f_S}{2}} \right). \end{equation} \end{proof} \cite{belomestny2021rates} obtained result on the convergence rate for density estimation under JS loss. The lemma above demonstrates that their results could also be applied in our context under \ref{BC}. \paragraph{$A$-regular Hölder ball} Let $p$ and $q$ be a positive integer and $g : [0, 1]^p \rightarrow [0, 1]^q$ a function. Let $\gamma = (\gamma_1, \dots, \gamma_p) \in \mathbb{N}^d$ be a multiindex and let $|\gamma| = \sum_{i = 1}^p \gamma_i$ be its order. The partial differentiate operator $D^\gamma$ is defined as follows \begin{equation} \forall i \in \{1, \dots, q\}, \ D^\gamma g_i = \frac{\partial^{|\gamma|} g_i}{\partial^{\gamma_i}_{x_1} \dots \partial^{\gamma_d}_{x_d}}. \end{equation} For a positive number $\alpha$, if we denote by $s$ the larger integer strictly lower than $\alpha$ and let $\delta = \alpha - s \in (0, 1]$, $g$ belongs to the Hölder ball $\mathcal{H}^\alpha(p, q, H)$ where $H$ is a positive real number if both following conditions are fullfilled \begin{equation} \left\{ \begin{array}{l} \underset{|\gamma | \leq s}{\max}\ \ \underset{1 \leq i \leq q}{\max}\ \ \underset{x \in [0, 1]^p}{\sup} \ \Vert D^\gamma g_i(x) \Vert \leq H \\ \underset{|\gamma | = s}{\max}\ \ \underset{1 \leq i \leq q}{\max}\ \ \underset{x, y \in [0, 1]^p}{\sup} \ \frac{\left| D^\gamma g_i(x) - D^\gamma g_i(y) \right|}{\Vert x-y\Vert ^\delta} \leq H. \end{array} \right. \end{equation} Moreover, for $A > 0$, $g$ belongs to the $A$-regular Hölder ball $\mathcal{H}_A^\alpha(p, q, H)$ if $g \in \mathcal{H}^\alpha(p, q, H)$ and for all $x \in [0, 1]^p$ \begin{equation} e^{-2 A} I_q \preccurlyeq \nabla g(x)^{\mathrm{T}} \nabla g(x) \preccurlyeq e^{2 A} I_q \end{equation} where $\nabla g$ is the Jacobian and where for symmetric matrices $M$ and $N$, $N \preccurlyeq M$ means that $M-N$ is positive. This condition implies in particular that $g$ is invertible. \subsection{Assumptions on the true density}\label{AssumptionTrueDensity} We will consider regularity condition on the true density of a particular form. Let $g$ be a function from $[0, 1]^p$ to $[0, 1]^p$, invertible and such as for all $x \in [0, 1]^p$, $\det \nabla g(x) \neq 0$. It is possible to define a density $t$ over $[0, 1]^p$ as the density of the random variable $g(U)$ where $U$ is uniformly distributed over $[0, 1]^p$ with the following formula \begin{equation} \forall x \in [0, 1]^p, \ t(x) = \frac{1}{\left| \det \nabla g (g^{-1}(x)) \right|}. \end{equation} Let us now formulate the regularity condition for $(f_S)_{S \in {\mathcal{P}_*}}$. Let $A > 0, \beta > 0$ and $H > 0$, we assume that for all $S \in {\mathcal{P}_*}$, it exists $g_S \in \mathcal{H}_A^{1 + \beta}(|S|, |S|, H)$ such that for all $x_S \in [0, 1]^{|S|}$ \begin{equation} f_S(x_S) = \frac{1}{\left| \det \nabla g_S (g_S^{-1}(x_S)) \right|}. \end{equation} The assumption that $g_S$ is $A$-regular implies that for all $x_S \in [0, 1]^{|S|}$, $e^{-A|S|} \leq \det \nabla g_S(x_s) \leq e^{A|S|}$ and then that the formula above is well defined and that $e^{-A|S|} \leq f_S(x_s) \leq e^{A|S|}$, proving that \ref{BC} is satisfied for the true density. \subsection{Choice of multidimensional estimators} \paragraph{Neural Networks} Let $p$ and $q$ be two positive integer. A neural network (NN) is a function $\mathbb{R}^p \rightarrow \mathbb{R}^q$ enjoying a particular structure. Let $\sigma : \mathbb{R} \rightarrow \mathbb{R}$ be a nonlinear function called activation function. Famous examples are ReLu : $\sigma_\text{ReLu}(x) = x \mathbb{1}_{[0, + \infty]}(x)$ or ReQu : $\sigma_\text{ReQu}(x) = x^2 \mathbb{1}_{[0, + \infty]}(x)$. Different architectures of NNs exist, we focus here on densely connected networks. \begin{figure}[ht] \centering \includegraphics[scale=0.5]{relurequ.png} \caption{ReQu and ReLu activation functions} \label{fig:relurequ} \end{figure} A NN encodes a function $f_\text{NN}$ which is a composition of linear operation and nonlinear operations : \begin{equation} f_\text{NN} = W_{L+1} \circ \phi \circ W_L \circ \phi \circ \dots \circ \phi \circ W_1. \end{equation} $L$ is the number of hidden layer and the shape of the network is determined by a vector $\ell = (l_1, \dots, l_L)$ corresponding to the dimension of each hidden layer. Each $W_i$ represent an affine function $W_i = A_ix + b_i$ taking values in $\mathbb{R}^{l_i}$ with the convention that $l_{L+1} = q$ and $\phi$ as a multidimensional function with a slight abuse of notation. If $x \in \mathbb{R}^r$, $\phi(x) = \left(\phi(x_1), \dots, \phi(x_r)\right)^\mathrm{T}$. We denote by $\text{NN}_{(p, q)}$ the set of all neural nets with input dimension $p$ and output dimension $q$. It is natural to represent a neural net as an oriented graph, as in the figure below. \begin{figure}[ht] \centering \begin{neuralnetwork}[height=4] \newcommand{\x}[2]{$x_#2$} \newcommand{\y}[2]{$\hat{y}_#2$} \newcommand{\hfirst}[2]{\small $h^{(1)}_#2$} \newcommand{\hsecond}[2]{\small $h^{(2)}_#2$} \inputlayer[count=3, bias=false, title=Input\\layer] \hiddenlayer[count=4, bias=false, title=Hidden\\layer 1] \linklayers \hiddenlayer[count=3, bias=false, title=Hidden\\layer 2] \linklayers \outputlayer[count=2, title=Output\\layer] \linklayers \end{neuralnetwork} \label{GraphNN} \caption{Graphical representation of a NN with $p=3$, $q=2$, $L=2$, $\ell = (4, 3)$} \end{figure} We define a restricted class of NNs, where we impose the maximal coefficient involved in affine operations to be smaller than one, and we restrict the number of non-zero coefficients. \begin{equation} \begin{split} \text{NN}_{(p, q)}\left(L, \ell, s\right) = \{ f_{\text{NN}} \in \text{NN}_{(p, q)}\ \left| &\max_{i=1, \dots, L+1} \left\Vert A_i \right\Vert_\infty \vee \left\Vert b_i \right\Vert_\infty \leq 1 \\ &\text{and} \ \sum_{i=1, \dots L+1} \Vert A_i \Vert_0 + \Vert b_i \Vert_0 \leq s \right. \}. \end{split} \end{equation} \paragraph{GANs} Generative Adversarial Networks (GANs) were introduced in \cite{goodfellow2014generative}. The principle is to design an algorithm able to generate fake data hardly distinguishable from an input data sample and implicitly acquire knowledge about the underlying distribution. It has become a prevalent tool in artificial intelligence. Remarkable realizations based on the use of GANs include generating realistic photographs of human faces (\cite{karras2017progressive}), performing vector arithmetic in natural images space (\cite{radford2015unsupervised}) or video prediction (\cite{vondrick2016generating}). Assume that we have at our disposal a $n$-sample $A_1, \dots, A_n$ drawn independently from a probability density $t$ over $\mathcal{A} \subset \mathbb{R}^p$. A GAN is composed by two elements: a discriminator $D$ and a generator $G$. \begin{itemize} \item The discriminator $D$ is a function from $\mathcal{A}$ to $[0, 1]$ aimed to discriminate data coming from $t$ to other distribution. \item The generator $G$ is used to generate fake data. Given a probability density $\phi$ over $\mathbb{R}^{p'}$ where $p'$ can be any integer (we can restrict ourselves to the case where $\phi$ is uniform over $[0,1]^{p'}$) and a point $y$ drawn from $\phi$, $G(y)$ is a fake data point in $\mathcal{A}$. \end{itemize} The objective is to produce a generator that makes the discriminator unable to distinguish between real and fake samples. Given a family of discriminators $\mathcal{D}$ and a family of generators $\mathcal{G}$ the optimization problem introduced by \cite{goodfellow2014generative} and referred to as vanilla GAN is \begin{equation} \min_{G \in \mathcal{G}} \max_{D \in \mathcal{D}} \left\{ L(G, D) = \frac{1}{2} \mathbb{E}_{A \sim t} \left[ \log(D(A)) \right] + \frac{1}{2} \mathbb{E}_{Y \sim \phi} \left[ \log(1 -D(G(Y))) \right] \right\}. \end{equation} If $Y_1, \dots, Y_n$ is a $n$-sample drawn independently from $\phi$, the corresponding empirical optimization problem is \begin{equation} \min_{G \in \mathcal{G}} \max_{D \in \mathcal{D}} \left\{ L_n(G, D) = \frac{1}{2} \sum_{i=1}^n \log(D(A_i)) + \frac{1}{2} \sum_{i=1}^n \log(1 - D(G(Y_i)))\right\}. \label{eq:empiricalGANformulation} \end{equation} In what follows we will consider that take $\mathcal{D}$ and $\mathcal{G}$ as subsets of, respectively $\text{NN}_{(p, 1)}$ and $\text{NN}_{(p, p)}$. \paragraph{From neural network to density} GANs are tools to construct networks allowing to sample from an unknown distribution. In our context we need to be able to extract from the generator $G$ a density function $\hat{t}$ over $\mathcal{A}$. We assume here that $p' = p$ and that $\phi$ is the uniform distribution over $[0, 1]^p$. Then $G(Y)$ is a random variable admitting $\hat{t}$ as density function. Following what we have presented in \cref{AssumptionTrueDensity}, under suitable conditions on $G$, $\hat{t}$ can be written as follows \begin{equation} \forall x \in \mathcal{A}, \hat{t}(x) = \frac{1}{\left| \det \nabla G (G^{-1}(x)) \right|}. \label{fromNNtodensity} \end{equation} \paragraph{Choice of $\mathcal{D}$ and $\mathcal{G}$} In order to use ISDE, we need to define a family of marginal density estimators $(\hat{f}_S)_{S \in \mathrm{Set}_d^k}$. To do so we train a family of GANs $\left(\mathcal{G}_S, \mathcal{D}_S \right)_{S \in \mathrm{Set}_d^k}$, on data $W_1, \dots, W_m$ by solving \ref{eq:empiricalGANformulation}, and extract density estimators $\hat{f}$. We will impose the following conditions on $\mathcal{D}_S$ and $\mathcal{G}_S$. It exists $L_S^\mathcal{G}, l_S^\mathcal{G}, s^\mathcal{G}_S \text{ and } H_S^\mathcal{G}$ such that \begin{equation} \mathcal{G}_S = \text{NN}_{(|S|, |S|)}\left(L_S^\mathcal{G}, \ell_S^\mathcal{G}, s_S^\mathcal{G}\right) \cap \mathcal{H}^2_{2A}\left( |S|, |S|, H_S^{\mathcal{G}} \right). \end{equation} Similarly, it exists $L_S^\mathcal{D}, l_S^\mathcal{D}, s^\mathcal{D}_S \text{ and } H_S^\mathcal{D}$ such that \begin{equation} \mathcal{D}_S = \text{NN}_{(|S|, 1)}\left(L_S^\mathcal{D}, \ell_S^\mathcal{D}, s_S^\mathcal{D}\right) \cap \mathcal{H}^1\left( |S|, 1, H_S^{\mathcal{D}} \right). \end{equation} Moreover we assume that there exists $0 < D_\text{min} < D_\text{max} < 1$ such that for all $D_S \in \mathcal{D}_S$ and for all $x \in [0, 1]^{|S|}$, $D_S(x) \in [D_\text{min}, D_\text{max}]$. The condition that $\hat{f}_S$ must be $2A$-regular ensures that \cref{BC} is satisfied for $(\hat{f}_S)_{S \in Pdk}$, with the same reasoning as the one presented in \cref{AssumptionTrueDensity}. \subsection{Rate of convergence} With the previously introduced notations, we can state the following theorem, which is valid under a good choice of constants involved in the definitions of $\left(\mathcal{G}_S\right)_{S \in {\mathcal{P}_*}}$ and $\left(\mathcal{D}_S\right)_{S \in {\mathcal{P}_*}}$, and which is a direct application of Theorem 2 in \cite{belomestny2021rates}. \begin{mythm}{Convergence rate for the approximation term}{rateconvergenceapproximatio} \begin{equation} \esperance{\sum_{S_* \in {\mathcal{P}_*}} \KL{f_S}{\hat{f_S}}} \lesssim \left(\frac{\log m}{m}\right)^{\frac{2 \beta}{2 \beta + \underset{S \in {\mathcal{P}_*}}{\max} |S|}}. \end{equation} And, as $\underset{S \in {\mathcal{P}_*}}{\max} |S| \leq k$ \begin{equation} \esperance{\sum_{S_* \in {\mathcal{P}_*}} \KL{f_S}{\hat{f_S}}} \lesssim \left(\frac{\log m}{m}\right)^{\frac{2 \beta}{2 \beta + k}}. \end{equation} \end{mythm} The convergence rate depends on the regularity parameter $\beta$ and the parameter $k$. Its dependence in $k$ highlights how ISDE tackles the curse of dimensionality. Considering no independence structure would lead to a similar convergence speed, but where $k$ is replaced by $d$. Here the smaller $k$, the faster the approximation term converges. \section{Bias term in the multivariate Gaussian framework}\label{sec:appendixgaussian} In this appendix, we study the bias $\KL{f}{f_{\mathcal{P}_*}}$ in a multivariate Gaussian framework where exact computations are possibles. \subsection{Model and notations} \paragraph{Model} If $\Sigma$ denotes a $d \times d$ definite positive matrix, we denote by $f_\Sigma$ the density of a multivariate centered Gaussian random variable with covariance $\Sigma$ and by $\Sigma_{\mathcal{P}}$ the matrix defined as follows. \begin{equation} \Sigma_{{\mathcal{P}}}(i, j) = \left\{ \begin{array}{ll} \Sigma(i, j) & \mbox{if $i$ and $j$ belongs to the same bloc in ${\mathcal{P}}$}\\ 0 & \mbox{else.} \end{array} \right. \end{equation} If $S_1$ and $S_2$ are subsets of $\{1, \dots, d\}$, we denote by $\Sigma(S_1, S_2)$ the $|S_1| \times |S_2|$ submatrix matrix of $\Sigma$ where we keep the intersection of rows in $S_1$ and columns in $S_2$, to keep notations compact, we write $\Sigma(S)$ instead of $\Sigma(S, S)$ For a multivariate Gaussian random variable with covariance $\Sigma$, $f_\Sigma \in \mathcal{D}_d^k$ is equivalent to the fact that it exists a permutation $\sigma$ of $\{1, \dots, d\}$ such that $P_\sigma \Sigma P_\sigma^{-1}$ is block-diagonal with blocks of size smaller than $k \times k$. For clarity, in what follows, we will always consider that this property is met with $\sigma = \text{id}$, meaning that we restrict ourselves to partitions in which each block is made of consecutive features. This does not imply a loss of generality. We now consider that $f = f_{\Sigma}$ and \begin{equation} \Sigma = \Sigma_{\mathcal{P}} + \epsilon \label{smallperturb} \end{equation} where $\Sigma_{\mathcal{P}}$ is a block-diagonal covariance matrix corresponding to the independence structure ${\mathcal{P}}$ and $\epsilon$ is a ``small" (in a sense to be defined later) definite positive matrix. The question is how this perturbation influences the bias term. In order to answer it, we must control $\KL{f}{f_{\mathcal{P}}}$ for all ${\mathcal{P}}$ in $\mathrm{Part}_d^k$. \subsection{Some useful lemmas} \paragraph{Computation of KL losses} The first useful result is an explicit computation of $\KL{f_\Sigma}{f_{\Sigma_{{\mathcal{P}}}}}$ for any ${\mathcal{P}}$ in $\mathrm{Part}_d^k$. \begin{mylem}{Exact computation of KL between two centered multivariate Gaussian}{biasgaussian} For every ${\mathcal{P}} \in \mathrm{Part}_d^k$ \begin{equation} \KL{f_\Sigma}{f_{\Sigma_{\mathcal{P}}}} = \frac{1}{2}\left( \sum_{S \in {\mathcal{P}}} \log \det \Sigma(S) - \log \det \Sigma \right) \end{equation} Or if $\lambda_1 \leq \dots \leq \lambda_d$ are the eigenvalues of $\Sigma$ and $\lambda_1^{\mathcal{P}} \leq \dots \leq \lambda_d^{\mathcal{P}}$ the eigenvalues of $\Sigma_{\mathcal{P}}$ \begin{equation} \KL{f_\Sigma}{f_{\Sigma_{\mathcal{P}}}} = \frac{1}{2} \sum_{i = 1}^d \log\left(\frac{\lambda_i^{\mathcal{P}}}{\lambda_i}\right) \end{equation} \end{mylem} \begin{proof} The density $f_\Sigma$ has the following expression. \begin{equation} f_\Sigma(x) = \frac{1}{(2 \pi)^{d / 2} (\det \Sigma)^{1 / 2}} \exp\left( - \frac{1}{2} x^\mathrm{T}\Sigma^{-1}x \right). \end{equation} We compute the KL divergence between $f_\Sigma$ and $f_{\Sigma_{\mathcal{P}}}$ \begin{align} \KL{f_\Sigma}{f_{\Sigma_{\mathcal{P}}}} &= \int \log\left( \frac{f_\Sigma(x)}{f_{\Sigma_{\mathcal{P}}}(x)} \right) f_\Sigma(x) dx \\ &= \frac{1}{2} \log\frac{\det \Sigma_{\mathcal{P}}}{\det \Sigma} \underbrace{\int f_\Sigma(x)dx}_{=1} \notag\\ &\ \ +\frac{1}{2} \underbrace{\int x^\mathrm{T}\Sigma_{\mathcal{P}}^{-1}x f_\Sigma(x)dx}_{= \mathrm{Tr}(\Sigma_{\mathcal{P}}^{-1}\Sigma)} \notag\\ &\ \ + \frac{1}{2} \underbrace{\int x^\mathrm{T}\Sigma^{-1}x f_\Sigma(x)dx}_{= \mathrm{Tr}(\Sigma^{-1}\Sigma) = d} \\ &= \frac{1}{2}\left( \log \det \Sigma_{\mathcal{P}} - \log \det \Sigma + \mathrm{Tr}\left( \Sigma_{\mathcal{P}}^{-1} \Sigma \right) - d \right) \end{align} Now, we define a permutation $\sigma_{\mathcal{P}}$ of $\{1, \dots, d\}$ such that : \begin{equation} \Sigma_{\mathcal{P}} = P_{\sigma_{\mathcal{P}}} \begin{pmatrix} \Sigma(S_1) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \mbox{\normalfont\Large\bfseries 0} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \mbox{\normalfont\Large\bfseries 0} \\ \hline \mbox{\normalfont\Large\bfseries 0} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_2) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \vdots \\ \hline \vdots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \mbox{\normalfont\Large\bfseries 0} \\ \hline \mbox{\normalfont\Large\bfseries 0} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \mbox{\normalfont\Large\bfseries 0} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_M) \end{pmatrix} P_{\sigma_{\mathcal{P}}}^{-1} \end{equation} where $\{S_1, \dots, S_M\}$ denotes the blocks of ${\mathcal{P}}$. It is then clear that $\log \det \Sigma_{\mathcal{P}} = \sum_{S \in {\mathcal{P}}} \log \det \Sigma(S)$. We also have \begin{equation} \Sigma = P_{\sigma_{\mathcal{P}}} \begin{pmatrix} \Sigma(S_1) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_1, S_2) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_1, S_M) \\ \hline \Sigma(S_2, S_1) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_2) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \vdots \\ \hline \vdots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_{M-1}, S_M) \\ \hline \Sigma(S_M, S_1) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_{M}, S_{M-1}) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_M) \end{pmatrix} P_{\sigma_{\mathcal{P}}}^{-1}. \end{equation} Then \begin{equation} \Sigma_{\mathcal{P}}^{-1}\Sigma = P_{\sigma_{\mathcal{P}}} \begin{pmatrix} I_{|S_1|} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & X_{1, 2} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & X_{1, M} \\ \hline X_{2, 1} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & I_{|S_2|} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \vdots \\ \hline \vdots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \ddots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & X_{M-1, M} \\ \hline X_{M, 1} & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \dots & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & \Sigma(S_{M}, S_{M-1}) & \hspace*{-\arraycolsep}\vline\hspace*{-\arraycolsep} & I_{|S_M|} \end{pmatrix} P_{\sigma_{\mathcal{P}}}^{-1} \end{equation} where for $i \neq j$, $X_{i, j}$ is a $|S_i| \times |S_j|$ matrix. Then $\mathrm{Tr}\left( \Sigma_{\mathcal{P}}^{-1} \Sigma \right) = d$. The formulation of the result involving the eigenvalues comes from the fact that $\det \Sigma = \prod_{i=1}^d \lambda_i$ and $\det \Sigma_{\mathcal{P}} = \prod_{i=1}^d \lambda_i^{\mathcal{P}}$. \end{proof} \paragraph{Some computation of determinants} We define the $p\times p$ matrix \begin{equation} A^p_\sigma = \begin{pmatrix} 1 & \sigma & \dots & \sigma \\ \sigma & \ddots & \ddots & \vdots \\ \vdots & \ddots & \ddots & \sigma \\ \sigma & \dots & \sigma & 1 \end{pmatrix}. \end{equation} If $k$ divides $d$ we define \begin{equation} \Sigma^{(d, k)}_\sigma = \left(\begin{array}{ c | c | c | c } A^k_\sigma & \mathbf{0} & \dots & \mathbf{0} \\ \hline \mathbf{0} & \ddots & \ddots & \vdots \\ \hline \vdots & \ddots & \ddots & \mathbf{0} \\ \hline \mathbf{0} & \dots & \mathbf{0} & A^k_\sigma \end{array}\right) \end{equation} For $\epsilon > 0$ we define \begin{equation} \Sigma^{(d, k)}_{\sigma, \epsilon} = \left(\begin{array}{ c | c | c | c } A^k_\sigma & \mathbf{\epsilon} & \dots & \mathbf{\epsilon} \\ \hline \mathbf{\epsilon} & \ddots & \ddots & \vdots \\ \hline \vdots & \ddots & \ddots & \mathbf{\epsilon} \\ \hline \mathbf{\epsilon} & \dots & \mathbf{\epsilon} & A^k_\sigma \end{array}\right) \end{equation} \begin{mylem}{Property for block matrices}{propblockmat} \begin{enumerate}[i] \item $\det A^p_\sigma = [1 - \sigma]^{p - 1} \left[1 + (p - 1)\sigma \right]$ \item $\det \Sigma^{(d, k)}_{\sigma} = [1 - \sigma]^{\frac{d}{k}(k-1)}[1 + (k-1)\sigma]^{\frac{d}{k}}$ \item $\det \Sigma^{(d, k)}_{\sigma, \epsilon} = [1 - \sigma]^{\frac{d}{k}(k-1)}[1 + (k-1)\sigma + (d - k) \epsilon] [1 + (k-1)\sigma - k\epsilon]^{\frac{d}{k} - 1}$ \end{enumerate} \end{mylem} \begin{proof} (i) We start by computing the eigenvalues of $A^p_\sigma$. We remark that \begin{equation} A - (1 - \sigma) I = \begin{pmatrix} \sigma & \dots & \sigma \\ \vdots & & \vdots \\ \sigma & \dots & \sigma \end{pmatrix}. \end{equation} Then it is clear that $x \in \mathbb{R}^p \in \ker\left( A^p_\sigma - (1 - \sigma) I \right) \Leftrightarrow x \in \{ y \in \mathbb{R}^p: \sum_{i=1}^p y_i = 0 \}$, which is a linear subspace of $\mathbb{R}^p$ of dimension $p-1$. Then we remark that if $\mathbb{1}_p = \begin{pmatrix} 1 \\ \vdots \\ 1 \end{pmatrix}$ then \begin{equation} A^p_\sigma \mathbb{1}_p = \left(1 + (p - 1)\sigma\right) \mathbb{1}_p \end{equation} Then $1 + (p - 1)\sigma$ is an eigenvalue of $A$ and it could not be of multiplicity greater than $1$ as we have just proven than $(1 - \sigma)$ has a multiplicity of $p-1$. Using the fact that the determinant is the product of the eigenvalues, we obtain \begin{equation} \det A^p_\sigma = (1 - \sigma)^{p - 1} \left(1 + (p - 1)\sigma \right) \end{equation} The proof of (ii) follows immediately as the determinant of a block-diagonal matrix is the product of the derminants of the diagonal blocks. (iii) We determine the eigenvalues of $\Sigma^{(d, k)}_{\sigma, \epsilon}$. To this end we will find a set of $d$ linearly independent eigenvectors. We remark that \begin{equation} \Sigma^{(d, k)}_{\sigma, \epsilon} \mathbb{1}_d = (1 + (k-1) \sigma + (d - k) \epsilon) \mathbb{1}_d. \end{equation} Then $1 + (k-1) \sigma + (d - k) \epsilon$ is an eigenvalue of $\Sigma^{(d, k)}_{\sigma, \epsilon}$ with multiplicity at least $1$. Now, we remark that for all integer $0 \leq i \leq \frac{d}{k} - 1$ and $2 \leq j \leq k$ we have \begin{equation} \Sigma^{(d, k)}_{\sigma, \epsilon} (e_{ik+1} - e_{ik+j}) = (1 - \sigma) (e_{ik+1} - e_{ik+j}). \end{equation} Then $(1 - \sigma)$ is an eigenvalue of $\Sigma^{(d, k)}_{\sigma, \epsilon}$ with multiplicity at least $\frac{d}{k}(k - 1)$. Finally, if for $i<j$ we denote by $\mathbb{1}^i_j = \sum_{k = i}^j e_k$, we remark that for all integer $1 \leq i \leq \frac{d}{k} - 1$ \begin{equation} \Sigma^{(d, k)}_{\sigma, \epsilon} \left(\mathbb{1}^{0}_{k} - \mathbb{1}^{ik+1}_{(i+1)k}\right) = \left(1 + (k-1)\sigma - k \epsilon \right) \left(\mathbb{1}^{0}_{k} - \mathbb{1}^{ik+1}_{(i+1)k}\right). \end{equation} Then $1 + (k-1) \sigma + (d - k) \epsilon$ is an eigenvalue of $\Sigma^{(d, k)}_{\sigma, \epsilon}$ with multiplicity at least $\frac{d}{k} - 1$. As $1 + \frac{d}{k}(k - 1) + \left( \frac{d}{k} - 1 \right) = d$, we now that the eigenvalues of $\Sigma^{(d, k)}_{\sigma, \epsilon}$ are $1 + (k-1) \sigma + (d - k) \epsilon)$, $1 - \sigma$ and $1 + (k-1) \sigma + (d - k) \epsilon$ with multiplicity $1$, $\frac{d}{k}(k - 1)$ and $\frac{d}{k} - 1$. \end{proof} \subsection{Control of the bias} \paragraph{Almost independence structure} the following property precise the KL loss between $f_{\Sigma^{(d, k)}_{\sigma, \epsilon}}$ and $f_{\Sigma^{(d, k)}_{\sigma}}$, with a particular look at the situation where $\epsilon \rightarrow 0$. \begin{myprop}{Almost independence}{almostindep} \begin{align} \KL{f_{\Sigma^{(d, k)}_{\sigma, \epsilon}}}{f_{\Sigma^{(d, k)}_{\sigma}}} = &- \frac{1}{2}\log \left( 1 + \frac{d-k}{1 + (k-1) \sigma} \epsilon\right) \notag\\ &- \frac{1}{2} \left( \frac{d}{k} - 1 \right) \log \left( 1 - \frac{k}{1 + (k-1)\sigma} \epsilon \right) \end{align} At the limit $\epsilon \rightarrow 0$ \begin{equation} \KL{f_{\Sigma^{(d, k)}_{\sigma, \epsilon}}}{f_{\Sigma^{(d, k)}_{\sigma}}} \underset{\epsilon \rightarrow 0}{=} \frac{d(d-k)}{4(1 + (k-1)\sigma)^2} \epsilon^2 + o(\epsilon^2) \end{equation} \end{myprop} \begin{proof} As $\Sigma^{(d, k)}_{\sigma}$ is a block-diagonal submatrix of $\Sigma^{(d, k)}_{\sigma, \epsilon}$, using lemma \ref{lem:biasgaussian} we have \begin{equation} \KL{\Sigma^{(d, k)}_{\sigma, \epsilon}}{\Sigma^{(d, k)}_{\sigma}} = \frac{1}{2} \log\left( \frac{\det \Sigma^{(d, k)}_{\sigma}}{\det \Sigma^{(d, k)}_{\sigma, \epsilon}} \right) \end{equation} Let $\beta = 1 + (k-1)\sigma$ Now, using lemma \ref{lem:propblockmat}, we have \begin{align} \KL{\Sigma^{(d, k)}_{\sigma, \epsilon}}{\Sigma^{(d, k)}_{\sigma}} &= \frac{1}{2} \left[ \log\left(\frac{\beta^{\frac{d}{k}}}{[\beta + (d - k) \epsilon] [\beta - k\epsilon]^{\frac{d}{k} - 1}}\right)\right] \\ &= \frac{1}{2}\left[ \frac{d}{k} \log \beta - \log( \beta + (d-k)\epsilon) - \left( \frac{d}{k} - 1 \right) \log \left( \beta - k \epsilon \right) \right] \\ &= \frac{d}{2k} \log \beta - \frac{\log \beta}{2} - \frac{1}{2}\log\left(1 + \frac{d-k}{\beta}\epsilon\right) \notag\\ &\ - \frac{1}{2}\left( \frac{d}{k} - 1 \right) \log \beta - \frac{1}{2}\left( \frac{d}{k} - 1 \right) \log\left(1 - \frac{k}{\beta}\epsilon \right) \\ &= - \frac{1}{2}\log\left(1 + \frac{d-k}{\beta}\epsilon\right) - \frac{1}{2}\left( \frac{d}{k} - 1 \right) \log\left(1 - \frac{k}{\beta}\epsilon \right) \end{align} Now, we use that \begin{equation} \log(1 + \frac{d-k}{\beta} \epsilon) \underset{\epsilon \rightarrow 0}{=} \frac{d-k}{\beta} \epsilon - \frac{(d-k)^2}{2 \beta^2} \epsilon^2 + o(\epsilon^2) \end{equation} and \begin{equation} \log(1 - \frac{k}{\beta} \epsilon) \underset{\epsilon \rightarrow 0}{=} -\frac{k}{\beta} \epsilon - \frac{k^2}{2 \beta^2} \epsilon^2 + o(\epsilon^2). \end{equation} And we obtain \begin{align} \KL{\Sigma^{(d, k)}_{\sigma, \epsilon}}{\Sigma^{(d, k)}_{\sigma}} &\underset{\epsilon \rightarrow 0}{=} - \frac{d - k}{2 \beta} \epsilon + \frac{(d-k)^2}{4 \beta^2} \epsilon^2 \notag\\ &\ \ \ + \frac{\left(\frac{d}{k} - 1 \right)k}{2 \beta} \epsilon + \frac{\left( \frac{d}{k} - 1 \right) k^2}{4 \beta^2} \epsilon^2 + o(\epsilon^2) \\ &\underset{\epsilon \rightarrow 0}{=} \frac{(d-k)^2 + kd - k^2}{4 \beta^2} \epsilon^2 + o(\epsilon^2) \\ &\underset{\epsilon \rightarrow 0}{=} \frac{d^2 - 2kd + k^2 + kd - k^2}{4 \beta^2} \epsilon^2 + o(\epsilon^2) \\ &\underset{\epsilon \rightarrow 0}{=} \frac{d(d-k)}{4 \beta^2} \epsilon^2 + o(\epsilon^2) \end{align} \end{proof} \paragraph{Optimal structure for small $k$} The following proposition establish that if $\Sigma = A^d_\sigma$ and $k<d$, ${\mathcal{P}_*}$ is composed of a maximum number of blocks of size $k$. \begin{myprop}{Optimal Structure}{optimsrtruct} Suppose that $\Sigma = A^d_\sigma$. A structure $s = (s_i)_{i=1}^M$ is a list of positive integer with $\sum_{i=1}^M s_i = d$. To a structure is associated a partition with blocks of consecutive features with size $s_1, \dots, s_M$. For any structure $s$ we have \begin{equation} \KL{f_\Sigma}{f_{\Sigma_s}} = \frac{1}{2} \left( \sum_{i=1}^M \log\left(\frac{1 + (s_i - 1) \sigma}{1 - \sigma} \right) - \log\left(\frac{1 + (d-1) \sigma}{1- \sigma}\right) \right). \end{equation} If we denote by $p$ and $r$ the only integers such that $d = pk + r$ where $r < k$, we have \begin{equation} s^* = (\underbrace{k, \dots, k}_{p \text{ times}}, r) \end{equation} \end{myprop} \begin{proof} We combine lemma \ref{lem:biasgaussian} and lemma \ref{lem:propblockmat} to obtain \begin{align} \KL{f_\Sigma}{f_{\Sigma_s}} &= \frac{1}{2} \left( \sum_{S \in \mathcal{P}} \log \det A_\sigma^{s_i} - \log \det A_\sigma^d \right) \\ &= \frac{1}{2} [ \sum_{S \in \mathcal{P}} (s_i - 1) \log (1 - \sigma) + \log(1 + (s_i - 1) \sigma) \notag\\ &\ \ \ \ \ - (d - 1) \log (1 - \sigma) - \log(1 + (d - 1) \sigma) ] \\ &= \frac{1}{2} \left( \underbrace{\sum_{i = 1}^M (s_i - 1)}_{= d - M} - (d - 1) \right) \log(1 - \sigma) \notag\\ &\ \ + \frac{1}{2} \left( \sum_{i = 1}^M \log\left( 1 + (s_i - 1)\sigma \right) - \log(1 + (d-1) \sigma)\right)\\ &= \frac{1}{2} \left( \sum_{i = 1}^M \log\left( \frac{1 + (s_i - 1)\sigma}{1 - \sigma} \right) - \log\left(\frac{1 + (d-1) \sigma}{1 - \sigma}\right) \right) \end{align} Now we want to prove that the structure minimizing $\KL{f_\Sigma}{f_{\Sigma_s}}$ is $(\underbrace{k, \dots, k}_{p \text{ times}}, r)$. To do so we start by remarking that for any $s = (s_i)_{i=1}^M \neq (k, \dots, k, r)$ it exists $i \neq j$ such that $s_i \neq k$ and $s_j \neq k$. We will prove that, for our minimization problem it is always possible to find a better structure $\Tilde{s}$ with the following \begin{enumerate}[i] \item if $s_i + s_j \leq k$, $\Tilde{S} = (s_k)_{k \notin \{i, j\}} \cup (s_i + s_j)$ \item if $ \exists l > 0: s_i + s_j = k + l$, $\Tilde{S} = (s_k)_{k \notin \{i, j\}} \cup (k, l)$ \end{enumerate} To prove (i), we start from \begin{align} 2\KL{f_\Sigma}{f_{\Sigma_s}} &= \sum_{k=1}^M \log\left(\frac{1 + (s_k - 1) \sigma}{1 - \sigma} \right) - \log\left(\frac{1 + (d-1) \sigma}{1- \sigma}\right) \\ 2\KL{f_\Sigma}{f_{\Sigma_{\Tilde{s}}}} &= \sum_{k = 1, \dots,M, k \notin\{i, j\}} \log\left(\frac{1 + (s_k - 1) \sigma}{1 - \sigma} \right) + \log\left(\frac{1 + (s_i + s_j - 1) \sigma}{1 - \sigma} \right) \notag\\ &\ \ \ \ \ - \log\left(\frac{1 + (d-1) \sigma}{1- \sigma}\right). \end{align} Then to prove that $\KL{f_\Sigma}{f_{\Sigma_s}} > \KL{f_\Sigma}{f_{\Sigma_{\Tilde{s}}}}$ it is sufficient to prove that for all $a, b \geq 1$, $g(a, b) > 0$ where \begin{equation} g(a, b) = \log\left(\frac{1 + (a-1)\sigma}{1 - \sigma}\right) + \log\left(\frac{1 + (b-1)\sigma}{1 - \sigma}\right) - \log\left(\frac{1 + (a+b-1)\sigma}{1 - \sigma}\right). \end{equation} Let us start by computing $\partial_1 g(a, b)$ \begin{align} \partial_1 g(a, b) &= \frac{\sigma}{1 + (a-1)\sigma} - \frac{\sigma}{1 + (a+b-1)\sigma} \\ &= \frac{\sigma}{\left(1 + (a-1)\sigma\right) \left(1 + (a+b-1)\sigma\right)}(1 + (a+b-1)\sigma - 1 - (a-1)\sigma ) \\ &= \frac{b \sigma^2}{\left(1 + (a-1)\sigma\right) \left(1 + (a+b-1)\sigma\right)} \geq 0. \end{align} Then for any $b \geq 1$, $g(a, b)$ is nondecreasing in $a$. As $a$ and $b$ play similar roles in $g(a, b)$, we have that for any $a \geq 1$, $g(a, b)$ is nondecreasing in $b$. To prove that $g(a, b) \geq 0$ it is sufficient to show that $g(1, 1) > 0$. \begin{align} g(1, 1) &= \log\left(\frac{1}{1 - \sigma}\right) + \log\left(\frac{1}{1 - \sigma}\right) - \log\left(\frac{1 + \sigma}{1 - \sigma}\right) \\ &= - \log\left( (1 - \sigma)(1+ \sigma) \right). \end{align} Now, as $\sigma \in (0, 1)$, $(1-\sigma)(1+\sigma) \in (0, 1)$. Then $\log\left((1-\sigma)(1+\sigma) \right) < 0$, implying $g(1, 1) > 0$. To prove (ii) we start from \begin{align} 2\KL{f_\Sigma}{f_{\Sigma_s}} &= \sum_{k=1}^M \log\left(\frac{1 + (s_k - 1) \sigma}{1 - \sigma} \right) - \log\left(\frac{1 + (d-1) \sigma}{1- \sigma}\right) \\ 2\KL{f_\Sigma}{f_{\Sigma_{\Tilde{s}}}} &= \sum_{k = 1, \dots,M, k \notin\{i, j\}} \log\left(\frac{1 + (s_k - 1) \sigma}{1 - \sigma} \right) + \log\left(\frac{1 + (k - 1) \sigma}{1 - \sigma} \right) \notag\\ &\ \ \ + \log\left(\frac{1 + (l - 1) \sigma}{1 - \sigma} \right) - \log\left(\frac{1 + (d-1) \sigma}{1- \sigma}\right). \end{align} Then to prove that $\KL{f_\Sigma}{f_{\Sigma_s}} > \KL{f_\Sigma}{f_{\Sigma_{\Tilde{s}}}}$ it is sufficient to prove that for all $x \in [l, k]$, $h(x)$ attains its minimum at $l$ or $k$ where \begin{equation} h(x) = \log\left( 1 + (x-1)\sigma \right) + \log\left( 1 + ((k+l) - x-1)\sigma \right). \end{equation} Let us start by computing $h'(x)$ \begin{align} h'(x) &= \sigma \left( \frac{1}{1 + (x-1)\sigma} - \frac{1}{1 + ((k+l)-x-1)\sigma} \right) \\ &=\frac{\sigma\left( 1 + ((k+l)-x-1)\sigma - 1 - (x-1)\sigma \right)}{(1 + (x-1)\sigma)(1 + ((k+l)-x-1)\sigma)} \\ &= \frac{\sigma^2}{(1 + (x-1)\sigma)(1 + ((k+l)-x-1)\sigma)}((k+l) - 2x). \end{align} Then $h$ increases from $l$ to $(k+l) / 2$ and decreases from $(k+l) / 2$ to $k$ and $h(l) = h(k)$ the minimum of $h$ is attained on $l$ and $k$. \end{proof} \paragraph{Conclusion} We finish this appendix by establishing a general upper bound of $\KL{f_\Sigma}{f_{\mathcal{P}_*}}$ where $\Sigma = \Sigma_{\sigma, \epsilon}^{(d, k^*)}$. \begin{mythm}{Upper-bound for the bias in a multivariate Gaussian framework}{completegaussian} If $\Sigma = \Sigma_{\sigma, \epsilon}^{(d, k^*)}$ and if $k < k^*$. Let $(p, r)$ be the unique couple of integer with $0 \leq r < k$ such that $k^* = pk + r$, we have \begin{align} \KL{f_\Sigma}{f_{\mathcal{P}_*}} \leq\ &\KL{f_{\Sigma_{\sigma, \epsilon}^{(d, k^*)}}}{f_{\Sigma_{\sigma}^{(d, k^*)}}} + \frac{dp}{2k^*} \log \left( \frac{1 + (k-1)\sigma}{1 - \sigma}\right)\notag\\ &+ \frac{d}{2k^*} \log \left( \frac{1 + (r-1)\sigma}{1 - \sigma} \right) - \frac{d}{2k^*} \log \left( \frac{1 + (k^* - 1)\sigma}{1 - \sigma} \right) \end{align} with \begin{equation} \KL{f_{\Sigma^{(d, k)}_{\sigma, \epsilon}}}{f_{\Sigma^{(d, k)}_{\sigma}}} \underset{\epsilon \rightarrow 0}{=} \frac{d(d-k)}{4(1 + (k-1)\sigma)^2} \epsilon^2 + o(\epsilon^2) \end{equation} \end{mythm} \begin{proof} Let us consider \begin{itemize} \item the structure $\Tilde{s} = (\underbrace{k, \dots, k}_{p \text{ times}}, r)$, and ${\mathcal{P}}_{\Tilde{s}}$ the associated partition of $k^*$ features, \item the structure $s = (\underbrace{\Tilde{s}, \dots, \Tilde{s}}_{d/k^* \text{ times}})$, and ${\mathcal{P}}_s$ the associated partition of $d$ features, \item the structure $s_0 = (\underbrace{k^*, \dots, k^*}_{d/k^* \text{ times}})$ and ${\mathcal{P}}_{0}$ the associated partition of $d$ features. \end{itemize} We can upper-bound the bias term $\KL{f_\Sigma}{f_{\mathcal{P}_*}}$ as follows \begin{align} \KL{f_\Sigma}{f_{\mathcal{P}_*}} &\leq \KL{f_\Sigma}{f_{{\mathcal{P}}_s}} \\ &= \int \log\left( \frac{f_\Sigma}{f_{{\mathcal{P}}_s}} \right) f_\Sigma \\ &= \int \log\left( \frac{f_\Sigma}{f_{{\mathcal{P}}_0}} \right) f_\Sigma + \int \log\left( \frac{f_{{\mathcal{P}}_0}}{f_{{\mathcal{P}}_s}} \right) f_\Sigma \\ &= \KL{\Sigma_{\sigma, \epsilon}^{(d, k^*)}}{\Sigma_{\sigma}^{(d, k^*)}} + \int \log\left( \frac{f_{{\mathcal{P}}_0}}{f_{{\mathcal{P}}_s}} \right) f_\Sigma \end{align} The blocks of the partition ${\mathcal{P}}_s$ are subsets of blocks of the partition ${\mathcal{P}}_0$, then \begin{align} \int \log\left( \frac{f_{{\mathcal{P}}_0}}{f_{{\mathcal{P}}_s}} \right) f_\Sigma &= \int \log\left( \frac{\prod_{S \in {\mathcal{P}}_0} f_S}{\prod_{S \in {\mathcal{P}}_0} (f_{{\mathcal{P}}_s})_S} \right) f_\Sigma \\ &= \sum_{S \in {\mathcal{P}}_0} \int \log\left( \frac{f_S}{(f_{{\mathcal{P}}_s})_S} \right) f_S \\ &= \sum_{S \in {\mathcal{P}}_0} \KL{f_{A_\sigma^d}}{f_{(A_\sigma^d)_{{\mathcal{P}}_{\Tilde{s}}}}} \\ &= \frac{d}{k^*} \KL{f_{A_\sigma^d}}{f_{(A_\sigma^d)_{{\mathcal{P}}_{\Tilde{s}}}}} \end{align} Now, using proposition \ref{prop:almostindep} \begin{align} \KL{f_{A_\sigma^d}}{f_{(A_\sigma^d)_{{\mathcal{P}}_{\Tilde{s}}}}} &= \frac{1}{2} \bigg( p \log\left( \frac{1 + (k-1)\sigma}{1 - \sigma} \right) + \log\left( \frac{1 + (r-1)\sigma}{1 - \sigma} \right) \notag\\ &\quad \quad \quad - \log\left( \frac{1 + (k^*-1)\sigma}{1 - \sigma} \right) \bigg) \end{align} And, using proposition \ref{prop:optimsrtruct}, we have that \begin{equation} \KL{f_{\Sigma^{(d, k)}_{\sigma, \epsilon}}}{f_{\Sigma^{(d, k)}_{\sigma}}} \underset{\epsilon \rightarrow 0}{=} \frac{d(d-k)}{4(1 + (k-1)\sigma)^2} \epsilon^2 + o(\epsilon^2). \end{equation} Then we have proven the desired upper-bound. \end{proof} \section{NOTATIONS}\label{sec:notations} Let $f$ be a density function (a nonnegative real function whose integral is equal to $1$) over $\mathbb{R}^d$. If we think of $f$ from a statistical viewpoint, it is natural to refer to the indices $\{1, \dots, d\}$ as the features. Let $S \subset \left\{1, \dots, d\right\}$, we denote by $f_S$ the marginal density of $f$ over $S$. For all $x=(x_1, \dots, x_d) \in \mathbb{R}^d$ \begin{equation} f_S(x) = \int f(x) \prod_{i \notin S} dx_i. \end{equation} With a slight abuse of notation, to highlight the fact that $f_S(x)$ does not depend on $(x_i)_{i \notin S}$, we write $f_S(x_S)$ instead of $f_S(x)$. Let $k$ be an positive integer not greater than $d$. We denote by $\mathrm{Set}_d^k$ the set of all subsets of $\{1, \dots, d\}$ with cardinal not greater than $k$ and by $\mathrm{Part}_d^k$ the collection of all partitions of $\{1, \dots, d\}$ constructed with blocks in $\mathrm{Set}_d^k$. We also use the shortcuts $\mathrm{Set}_d = \mathrm{Set}_d^d$ and $\mathrm{Part}_d = \mathrm{Part}_d^d$. \section{INTRODUCTION}\label{sec:introduction} In a previous work (\cite{pujol2022isde}), we have introduced ISDE (Independence Structure Density Estimation). ISDE estimates a density $f$ from a set of iid realizations $X_1, \dots, X_N$ considering the Independence Structure (IS) hypothesis. This paper is devoted to a theoretical analysis of this algorithm. In this introduction, we review existing theory about IS, introduce ISDE, and set the goals of the present work. \subsection{Curse of dimensionality and independence Structure} \paragraph{Minimax Risk} Let $X_1, \dots, X_N$ be \emph{iid} realizations of a random variable in $\mathbb{R}^d$ admitting a density $f$. The goal of density estimation is to construct an estimator $\hat{f}$ of the density. We can measure the hardness of such an estimation task using the minimax framework. Assume that the true density belongs to some known model $\mathcal{F}$ and let $D$ be a (pseudo)distance on $\mathcal{F}$, the minimax risk is defined as follows: \begin{equation} \mathcal{R}(D, \mathcal{F}) := \inf_{\hat{f}} \sup_{f \in \mathcal{F}} \esperance{D(f, \hat{f})} \end{equation} where the inf is taken over all measurable functions from the data to $\mathcal{F}$. More specifically, a great part of the literature on the topic deals with the asymptotic regime of $\mathcal{R}(D, \mathcal{F})$ with respect to $N$. \paragraph{Hölder Balls} Let $\mathcal{U}$ be an open subset of $\mathbb{R}^d$ and $g : \mathcal{U} \rightarrow \mathbb{R}$ a function. Let $\gamma = (\gamma_1, \dots, \gamma_d) \in \mathbb{N}^d$ be a multiindex and let $|\gamma| = \sum_{i = 1}^d \gamma_i$ be its order. The partial differentiate operator $D^\gamma$ is defined as follows \begin{equation} \ D^\gamma g = \frac{\partial^{|\gamma|} g}{\partial^{\gamma_1}_{1} \dots \partial^{\gamma_d}_{d}}. \end{equation} For a positive number $\beta$, if we denote by $s$ the larger integer strictly lower than $\beta$ and let $\delta = \beta - s \in (0, 1]$, $g$ belongs to the Hölder ball $\mathcal{H}(\beta, L)$ where $L$ is a positive real number if both following conditions are fulfilled \begin{equation} \left\{ \begin{array}{l} \underset{|\gamma | \leq s}{\max}\ \ \underset{x \in \mathcal{U}}{\sup} \ \Vert D^\gamma g(x) \Vert \leq L \\ \underset{|\gamma | = s}{\max}\ \ \underset{x, y \in \mathcal{U}}{\sup} \ {\left| D^\gamma g(x) - D^\gamma g_i(y) \right|} \leq L{\Vert x-y\Vert ^\delta}. \end{array} \right. \end{equation} If $g$ is defined on a close subset $\mathcal{C}$ of $\mathbb{R}^d$, we say that $g \in \mathcal{H}(\beta, L)$ if the restriction of $g$ to the interior of $\mathcal{C}$. \paragraph{Minimax Risk over Hölder Balls} In \cite{hasminskii1990density}, the minimax rate of this family of functions was studied considering $L_p$ distances. In particular, the result with the squared $L_2$ distance is the following \begin{equation} \mathcal{R}\left( \Vert . \Vert_2^2, \mathcal{H}^\beta(d, H)\right) \sim N^{- \frac{2 \beta}{2 \beta + d}}. \end{equation} We can interpret this bound as a manifestation of the curse of dimensionality because of its dependence on $d$. A solution is to consider the IS model introduced in \cite{lepski2013multivariate}. \paragraph{Independence Structure} For $k \leq d$, we define a family of functions: \begin{equation} \mathcal{D}_d^k = \left\{ f: \mathbb{R}^d \rightarrow \mathbb{R}|\ \exists {\mathcal{P}} \in \mathrm{Part}_d^k: f(x) = \prod_{S \in {\mathcal{P}}} f_S(x_S) \right\}. \end{equation} In probabilistic terms, a density $f$ over $\mathbb{R}^d$ belongs to $\mathcal{D}_d^k$ if we can group these features into independent blocks. Another viewpoint is that the random variable characterized by $f$ admits a graphical model, a collection of disjoint fully connected cliques of size not greater than $k$. It was showed in \cite{rebelles2015mathbb} that \begin{equation} \mathrm{R}\left( \Vert. \Vert_2^2, \mathcal{H}^\beta(d, H) \cap \mathcal{D}_d^k \right) \sim N^{- \frac{2 \beta}{2 \beta + k}}. \end{equation} The striking fact here is that the hardness of the estimation problem is no longer related to the ambient dimension but instead to the size of the biggest block of the partition on which the density function is decomposable. \subsection{ISDE} As explained in \cite{pujol2022isde}, the density estimation problem under squared $L_2$ loss does not lead to a feasible algorithm. This is why we change the loss function to the Kullback-Leibler (KL) divergence. If $\hat{f}$ is an estimator of $f$, the KL loss between $f$ and $\hat{f}$ is defined as \begin{equation} \KL{f}{\hat{f}} = \int \log\left( \frac{f}{\hat{f}} \right) f. \end{equation} This formulation is well suited to IS as it involves $\log$-densities, and a $\log$ of a product of marginal densities is a sum of $\log$ of marginal densities. From an algorithmic viewpoint, this formulation allowed us to implement an algorithm with reasonable running time and memory usage (see \cite{pujol2022isde} for details). ISDE operates as follows. \begin{enumerate} \item Two independent datasets $W_1, \dots, W_m$ and $Z_1, \dots Z_n$ are extracted from $X_1, \dots, X_N$. \item $W_1, \dots, W_m$ is used to compute marginal density estimators $(\hat{f}_S)_{S \in \mathrm{Set}_d^k}$. Any multidimensional density estimation procedure can be used for this step. \item $Z_1, \dots, Z_n$ is used to compute $(\ell_n(S))_{S \in \mathrm{Set}_d^k}$ where \begin{equation} \ell_n(S) = \frac{1}{n} \sum_{i=1}^n \log \hat{f}_S((Z_i)_S). \end{equation} \item The optimization problem \begin{equation} \max_{{\mathcal{P}} \in \mathrm{Part}_d^k} \sum_{S \in {\mathcal{P}}} \ell_n(S) \end{equation} is solved with an exact integer programming optimization procedure (branch-and-bound). \end{enumerate} The output is a partition ${\hat{\mathcal{P}}}$ and an estimator of $f$ taking the form $\hat{f}_{\hat{\mathcal{P}}} = \prod_{S \in {\hat{\mathcal{P}}}} \hat{f}_S$. The formulation with $\log$-densities leads to a combinatorial complexity reduction. At first glance, the problem of density estimation under IS necessitates manipulating data structures of size $P_d^k$ while ISDE only lies on data structures of size $S_d^k$. \subsection{Goal of this work} This paper is intended to provide a theoretical analysis of ISDE by upper-bounding the quantity $\KL{f}{\hat{f}}$. In particular, we will show that the introduction of IS tackles the curse of dimensionality and that the constants in the upper-bound reflect the combinatorial complexity reduction implemented in ISDE. \subsection{Organization of the paper} In section \ref{sec:kldecomp} we establish a first decomposition on the risk involving oracle partitions. In section \ref{sec:conditionsobjective} we introduce the regularity conditions on the proper density and establish that an upper-bound for the uniform loss between marginal densities of $f$ and marginal estimators is sufficient to obtain a convergence result for ISDE. In section \ref{sec:unifdensity} we show that it is possible to obtain an upper-bound for uniform estimation of marginal densities for a particular estimator. Then in section \ref{sec:theorem} we state the desired upper-bound for the estimator outputted by ISDE. \section{KULLBACK-LEIBLER RISK DECOMPOSITION}\label{sec:kldecomp} In this section, we show that the KL loss between $f$ and $\hat{f}_{\hat{\mathcal{P}}}$, the estimator outputted by ISDE, decomposes as the sum of three terms with a clear interpretation. \subsection{Oracles partitions} We denote by ${\hat{\mathcal{P}}}$ the partition outputted by ISDE. Let $P_n[.]$ denotes the empirical measure associated with the sample $Z_1, \dots, Z_n$ and $P[.]$ the measure associated with the true density $f$. ${\hat{\mathcal{P}}}$ is solution of the following optimisation problem : \begin{equation} {\hat{\mathcal{P}}} \in \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} P_n\left( - \log (\hat{f}_\mathcal{P}) \right) \end{equation} The partition ${\hat{\mathcal{P}}}$ is random depending on both $W$ and $Z$. Let us define two other meaningful partitions. \begin{align} {\Tilde{\mathcal{P}}} &\in \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} P\left( - \log (\hat{f}_\mathcal{P}) \right) = \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} \KL{f}{\hat{f}_{\mathcal{P}}} \\ \intertext{and} {\mathcal{P}_*} &\in \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} P\left( - \log (f_\mathcal{P}) \right) = \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} \KL{f}{f_{\mathcal{P}}}. \end{align} ${\Tilde{\mathcal{P}}}$ is a random partition depending on $W$ but not on $Z$. it is the best combination of the estimators $(\hat{f}_S)_{S \in \mathrm{Set}_d^k}$ if we consider that the quantities $\left( P(- \log \hat{f}_S) \right)_{S \in \mathrm{Set}_d^k}$ are known. ${\mathcal{P}_*}$ is not random. It is only a function of $k$. $f_{\mathcal{P}_*}$ can be interpreted as the Kullback-Leibler projection of $f$ on the model $\mathcal{D}_d^k$ thanks to the following property. \begin{myprop}{}{fstardecomp}\label{fstardecomp} \begin{equation} f_{\mathcal{P}_*} \in \argmin{g \in \mathcal{D}_d^k} \KL{f}{g} \end{equation} \end{myprop} \begin{proof} Let $g \in \mathcal{D}_d^k$ and denote by ${\mathcal{P}}_g$ a partition such that $g = \prod_{S \in {{\mathcal{P}}_g}} g_S$. We have \begin{align} \KL{f}{g} &= \int \log\left( \frac{f}{g}\right) f \\ &= \int \log\left( \frac{f}{f_{{\mathcal{P}}_g}}\right) f + \int \log\left( \frac{f_{{\mathcal{P}}_g}}{g}\right) f \\ &= \KL{f}{f_{{\mathcal{P}}_g}} + \sum_{S \in {\mathcal{P}}_g} \KL{f_S}{g_S} \\ &\leq \KL{f}{f_{{\mathcal{P}}_g}} \end{align} with equality if $g = f_{{\mathcal{P}}_g}$. Then \begin{align} \argmin{g \in \mathcal{D}_d^k} \KL{f}{g} &= \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} \min_{g \in \mathcal{D}_d^k} \KL{f}{g} \\ &= \argmin{{\mathcal{P}} \in \mathrm{Part}_d^k} \KL{f}{f_{{\mathcal{P}}}} \end{align} \end{proof} \subsection{Kullback-Leibler risk upper-bound} We are now in a position to establish a control of the Kullback-Leibler risk for $\hat{f}_{\hat{P}}$ involving the oracles partitions. \begin{mylem}{Kullback-Leibler risk control}{riskbound} \begin{equation} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} \leq \KL{f}{f_{\mathcal{P}_*}} + \sum_{S_* \in {\mathcal{P}_*}} \KL{f_{S_*}}{\hat{f}_{S_*}} + (P - P_n)(\log \hat{f}_{\Tilde{\mathcal{P}}} - \log \hat{f}_{\hat{\mathcal{P}}}) \end{equation} \end{mylem} \begin{proof} We start by decomposing $\KL{f}{\hat{f}_{\hat{\mathcal{P}}}}$ as follows \begin{align} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} &= \KL{f}{f_{\mathcal{P}_*}} \\ &\ + \KL{f}{\hat{f}_{\mathcal{P}_*}} - \KL{f}{f_{\mathcal{P}_*}} \\ &\ + \KL{f}{\hat{f}_{\Tilde{\mathcal{P}}}} - \KL{f}{\hat{f}_{\mathcal{P}_*}}\\ &\ + \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{\hat{f}_{\Tilde{\mathcal{P}}}}. \intertext{Then, as $\KL{f}{\hat{f}_{\Tilde{\mathcal{P}}}} \leq \KL{f}{\hat{f}_{\mathcal{P}_*}}$,} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} &\leq \KL{f}{f_{\mathcal{P}_*}} \ \ \ \ \\ &\ + \KL{f}{\hat{f}_{\mathcal{P}_*}} - \KL{f}{f_{\mathcal{P}_*}} &&\text{(i)} \\ &\ + \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{\hat{f}_{\Tilde{\mathcal{P}}}} &&\text{(ii)}. \end{align} Now, we rewrite (i) \begin{align} \KL{f}{\hat{f}_{\mathcal{P}_*}} - \KL{f}{f_{\mathcal{P}_*}} &= \int \log\left( \frac{f(x)}{\hat{f}_{\mathcal{P}_*}(x)} \right) f(x) d x - \int \log\left( \frac{f(x)}{f_{\mathcal{P}_*}(x)} \right) f(x) d x \\ &= \int \log\left( \frac{f_{\mathcal{P}_*}(x)}{\hat{f}_{\mathcal{P}_*}(x)} \right) f(x) d x \\ &= \sum_{S_* \in {\mathcal{P}_*}} \int \log\left( \frac{f_{S_*}(x)}{\hat{f}_{S_*}(x)} \right) f_{S_*}(x) d x \\ &= \sum_{S_* \in {\mathcal{P}_*}} \KL{f_{S_*}}{\hat{f}_{S_*}}. \end{align} And we upper-bound (ii). As $P_n\left[ \log \hat{f}_{\hat{\mathcal{P}}} - \log \hat{f}_{\Tilde{\mathcal{P}}} \right] \geq 0$ : \begin{align} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{\hat{f}_{\Tilde{\mathcal{P}}}} &= P\left[ -\log \hat{f}_{\Tilde{\mathcal{P}}} \right] - P\left[ - \log \hat{f}_{\hat{\mathcal{P}}} \right] \\ &\leq P\left[ \log \hat{f}_{\Tilde{\mathcal{P}}} - \log \hat{f}_{\hat{\mathcal{P}}} \right] + P_n\left[ \log \hat{f}_{\hat{\mathcal{P}}} - \log \hat{f}_{\Tilde{\mathcal{P}}} \right] \\ &= (P - P_n)(\log \hat{f}_{\Tilde{\mathcal{P}}} - \log \hat{f}_{\hat{\mathcal{P}}}). \end{align} \end{proof} Three terms appear in the upper bound, and they can be easily interpreted. \begin{itemize} \item $\KL{f}{f_{\mathcal{P}_*}}$ is a bias term. It is the intrinsic error of the model $\mathcal{D}_d^k$ and can be thought of as a distance from $f$ to $\mathcal{D}_d^k$ thanks to proposition \ref{fstardecomp}. \item $\sum_{S_* \in {\mathcal{P}_*}} \KL{f_{S_*}}{\hat{f}_{S_*}}$ is an approximation term. It is a random quantity depending on the sample $W$ and represents the error made when $f_{\mathcal{P}_*}$ is estimated with $\hat{f}_{{\mathcal{P}_*}}$. Conditionally to $W$, it depends on how the estimation of $\log$-likelihoods made thanks to $Z$ is accurate and quantifies our ability to output the optimal partition. \end{itemize} In the sequel of the paper, we will focus on upper-bounding the approximation and selection terms as they are the random quantities of interest in our problem. We treat the bias term as a structural error, and we focus on upper-bounding the quantity \begin{equation} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{f_{\mathcal{P}_*}}. \end{equation} A study of the bias in a multivariate Gaussian framework can be found in appendix \ref{sec:appendixgaussian}. \section{CONDITIONS AND OBJECTIVE}\label{sec:conditionsobjective} \subsection{Regularity conditions} \paragraph{Bounding condition} Density estimation under Kullback-Leibler loss is known to be a challenging problem. One work by \cite{hall1987kullback} has studied the asymptotic convergence rates for kernel estimators in a one-dimensional setting. It was shown that the tails of the kernel must be chosen appropriately regarding the tails property of the proper density to have convergent estimators. In this work, we restrict our attention to densities that are lower and upper bounded by some positive quantities. This is done to avoid hardly tractable tail behavior issues. In the sequel, we consider that the following bounding condition is valid for all $S \in \mathrm{Set}_d^k$ \begin{equation} \tag{BC} e^{-A |S|} \leq f_S \leq e^{A |S|} \ \forall S \in {\mathcal{P}_*} \\ \label{BC} \end{equation} Note that if we impose a positive lower bound on the marginal densities, we must consider that $f$ is compactly supported. In the sequel, we will suppose that the support of $f$ is $[0, 1]^d$. \paragraph{Hölder Regularity} We will consider in the sequel that it exists $\beta \in (0, 2]$ and $L > 0$ such that $f_S \in \mathcal{H}(\beta, L)$ for all $S \in \mathrm{Set}_d^k$. We will use the following approximation property for functions in Hölder balls. \begin{mylem}{Approximation}{controlforholder2} Let us consider that $g \in \mathcal{H}(\beta, H)$ with $\beta \in (0, 2)$ and the domain of $g$ is $\mathcal{U} \subset \mathbb{R}^d$, then for all $x \in \mathcal{U}$ and $u$ such that $x + u \in \mathcal{U}$. If $\beta \in (0, 1]$ then \begin{equation} \left| g(x) - g(x+u) \right| \leq L\Vert u \Vert^\beta. \end{equation} If $\beta \in (1, 2]$ then \begin{equation} \left| g(x) - g(x+u) - \sum_{k=1}^d \partial_k u_k g(x)\right| \leq L\Vert u \Vert^\beta. \end{equation} \end{mylem} \subsection{Objective} Our goal is to propose an estimation procedure for the collection of marginal densities $(f_S)_{S \in \mathrm{Set}_d^k}$. If we are able to ensure, simultaneously for all $S \in \mathrm{Set}_d^k$ a uniform control \begin{equation} \tag{UC} \Vert \hat{f}_S - f_S \Vert_\infty \leq \epsilon_S < e^{-A |S|}(1 - e^{-A|S|}). \label{unifconvergence} \end{equation} Then we can upper-bound the approximation term and the selection term thanks to the following proposition. \begin{myprop}{Consequences of uniform control}{csqunifconvergence} If the uniform control \eqref{unifconvergence} is satisfied and \eqref{BC} is true, then \begin{enumerate} \item A bounding condition is satisfied by all the estimators $(\hat{f}_S)_{S \in \mathrm{Set}_d^k}$ \begin{equation} \tag{$\widehat{\text{BC}}$} e^{-2A|S|}\leq \hat{f}_S \leq e^{2A|S|}. \label{BCemp} \end{equation} \item For all $S \in \mathrm{Set}_d^k$, the Kullback-Leibler divergence between $f_S$ and $\hat{f}_S$ can be upper-bounded \begin{equation} \KL{f_S}{\hat{f}_{S}} \leq e^{2 A |S|} \epsilon_S \end{equation} \item Conditionnaly on $W$, the selection term can be upper-bounded with high probability. More precisely if $\delta_n \in (0, 1)$ we have \begin{equation} \proba{ \left. \left| (P - P_n)(\log \hat{f}_{\Tilde{\mathcal{P}}} - \log \hat{f}_{\hat{\mathcal{P}}}) \right| \geq 2d\sqrt{\frac{2Ak}{n}}\sqrt{\log\left(\frac{2 S_d^k}{\delta}\right)} \right| W} \leq \delta_n. \end{equation} \end{enumerate} \end{myprop} \begin{proof} \textit{Proof of 1}: Under \eqref{BC} we have \begin{equation} e^{-A|S|} - \Vert \hat{f}_S - f_S \Vert_\infty \leq \hat{f}_S \leq e^{A|S|} + \Vert \hat{f}_S - f_S \Vert_\infty. \end{equation} Now, under \eqref{unifconvergence} \begin{equation} e^{-A|S|} - \Vert \hat{f}_S - f_S \Vert_\infty \geq e^{-A|S|} - e^{-A|S|}(1 - e^{-A|S|}) = e^{-2A|S|} \end{equation} and \begin{align} e^{A|S|} + \Vert \hat{f}_S - f_S \Vert_\infty &\leq e^{A|S|} + e^{-A|S|}(1 - e^{-A|S|}) \\ &\leq e^{A|S|} + e^{3A|S|}\left( e^{-A|S|}(1 - e^{-A|S|}) \right) \\ &= e^{A|S|} + e^{2A|S|}(1 - e^{-A|S|}) = e^{2A|S|}. \end{align} \textit{Proof of 2}: Let us compute \begin{align} \KL{f_S}{\hat{f}_{S}} &= \int \log\left( \frac{f_S}{\hat{f}_{S}} \right) f_S \\ &\leq \int \left( \frac{f_S -\hat{f}_{S}}{\hat{f}_{S}} \right) f_S \\ \intertext{Using \eqref{BCemp}, 1 / $\hat{f}_S \leq e^{2A|S|}$} &\leq e^{2A|S|} \Vert f_S -\hat{f}_{S, h_m} \Vert_\infty \\ &\leq e^{2A|S|} \epsilon_S \end{align} \textit{Proof of 3}: Let $S \in \mathrm{Set}_d^k$, under \eqref{BCemp} we have $\log \hat{f}_S \in [-2A|S|, 2A|S|]$. Using Hoeffding inequality, we obtain \begin{equation} \proba{ \left| (P - P_n) \log \hat{f}_S \right| \geq \sqrt{\frac{2A|S|}{n}} \sqrt{\log \frac{2 S_d^k}{\delta}} | W} \leq \frac{\delta}{S_d^k}. \end{equation} Now, by union bound : \begin{equation} \proba{ \sup_{S \in \mathrm{Set}_d^k}\left| (P - P_n) \log \hat{f}_S \right| \geq \sqrt{\frac{2A|S|}{n}} \sqrt{\log \frac{2 S_d^k}{\delta}} | W} \leq \delta. \end{equation} This leads to : \begin{equation} \proba{ 2d \sup_{S \in \mathrm{Set}_d^k}\left| (P - P_n) \log \hat{f}_S \right| \leq 2d \sqrt{\frac{2Ak}{n}} \sqrt{\log \frac{2 S_d^k}{\delta}} | W} \geq 1 - \delta. \end{equation} Now, we remark that \begin{align} \label{decompsumselectionterm} |(P-P_n) \log \hat{f}_{{\Tilde{\mathcal{P}}}} - \log \hat{f}_{{\hat{\mathcal{P}}}}| &= \left| \sum_{S \in {\Tilde{\mathcal{P}}}} (P - P_n) \log \hat{f}_S - \sum_{S \in {\hat{\mathcal{P}}}} (P - P_n) \log \hat{f}_S \right| \\ &\leq \sum_{S \in {\Tilde{\mathcal{P}}}} \left| (P-P_n) \log \hat{f}_S \right| + \sum_{S \in {\hat{\mathcal{P}}}} \left| (P-P_n) \log \hat{f}_S \right| \\ &\leq 2d \sup_{S \in \mathrm{Set}_d^k}\left| (P - P_n) \log \hat{f}_S \right|. \end{align} Then, we have \begin{equation} \proba{ |(P-P_n) \log \hat{f}_{{\Tilde{\mathcal{P}}}} - \log \hat{f}_{{\hat{\mathcal{P}}}}| \geq 2d \sqrt{\frac{2Ak}{n}} \sqrt{\log \frac{2 S_d^k}{\delta}} | W} \leq \delta. \end{equation} \end{proof} \section{UNIFORM DENSITY ESTIMATION \\ FOR MARGINAL DENSITIES}\label{sec:unifdensity} \subsection{For a fixed $S$} In this subsection, we fix a subset of variables $S \in \mathrm{Set}_d^k$ and we study the problem of constructing an estimator $\hat{f}_S$ based on the sample $W_1, \dots, W_m$ giving a control of $\Vert f_S - \hat{f}_S \Vert_\infty$ in order to verify \eqref{unifconvergence}. We decompose the error as a sum of a bias and a variance term as follows \begin{equation} \Vert f_S - \hat{f}_S \Vert_\infty \leq \underbrace{\left\Vert f_S - \esperance{\hat{f}_S} \right\Vert_\infty}_{\text{Bias}} + \underbrace{\left\Vert \esperance{\hat{f}_S} - \hat{f}_S \right\Vert_\infty}_{\text{Variance}}. \end{equation} \subsubsection{Bias upper-bound} \paragraph{Choice of the kernel function} In the following we will use density estimator based on an ancillary function $K$ called kernel. $K$ is a nonnegative integrable function on $\mathbb{R}$ such that $\int K(x)dx = 1$, we consider the following assumptions on $K$: \begin{equation} \tag{A.K} \left\{ \begin{array}{l} \forall x \in \mathbb{R}, K(-x) = K(x) \\ \text{Supp}(K) \in [-1, 1] \\ \int x K(x) dx = 0 \\ \Vert K \Vert_\infty < \infty \end{array} \right. \label{assumptionKernel} \end{equation} We will also assume that, if $K^{S}_{h, x} : u \mapsto \frac{1}{h^{|S|}} \prod_{k \in S} K\left( \frac{x_k - u_k}{h} \right)$, the family of function \begin{equation} \mathcal{F}_S = \left\{ K^{S}_{h, x}, h > 0, x \in \mathbb{R}^{|S|} \right\} \end{equation} is a bounded VC class of functions. It means that it exists positive numbers $A$ and $\nu$ such that for any probability measure $P$ over $\mathbb{R}^{|S|}$ and any $\tau \in (0, 1)$ we have \begin{equation} \mathcal{N}\left( \mathcal{F}_S, L_2(P) , \tau \right) \leq \left( \frac{A \Vert K \Vert_\infty}{\tau} \right)^\nu \end{equation} where $\mathcal{N}\left( \mathcal{F}_S, L_2(P) , \tau \right)$ is the $\tau$-covering number of $\mathcal{F}_S$ for the $L_2(P)$ distance. As proved in \cite{gine2002rates} this condition is met for almost all classical kernels. An example of kernel function $K$ satisfying all the assumptions is the Epanechnikov kernel $K_\text{Epa}$ \begin{equation} K_\text{Epa}(x) = \frac{3}{4}(1-x^2) \mathbb{1}_{[-1, 1]}(x). \end{equation} \paragraph{Boundary issue} One must be aware of the issue induced by the fact that $f_S$ is supported on $[0, 1]^{|S|}$. We define the usual kernel density estimator (KDE) as follows. Let $h$ be a positive real number. The KDE for the marginal density $f_S$ associated with the kernel $K$, the bandwidth $h > 0$, and the sample $W$ is defined as \begin{equation} \hat{f}_{h ,S}^{\text{KDE}}(x) = \frac{1}{mh^{|S|}} \sum_{i=1}^m \prod_{k \in S} K\left( \frac{(W_i)_k - x_k}{h} \right) \end{equation} We remark that even in the samples $W_1, \dots, W_m$ belong to $[0, 1]^d$, there is no reason to have $\hat{f}_{h ,S}^{\text{KDE}}$ supported in $[0, 1]^{|S|}$. In this setting, the bias of the classical KDE does not go to zero as $h \rightarrow 0$, illustrating the boundary issue induced by estimating a compactly supported density. \begin{myprop}{Boundary issue}{boundaryissueforKDE} Let $f_S \in \mathcal{H}(2, L)$, the bias \begin{equation} \left\Vert \esperance{\hat{f}^{\text{KDE}}_{h, S}} - f_S \right\Vert_\infty \end{equation} does not tend to $0$ as $h \rightarrow 0$. \end{myprop} \begin{proof} \begin{align} \esperance{\hat{f}^{\text{KDE}}_{h, S}}(0) - f_S(0) &= \frac{1}{h^{|S|}} \int_{[0, 1]^{|S|}} f_S(t) \prod_{k \in S}K\left( \frac{t_k}{h}\right) dt - f_S(0)\\ &= \int_{[-1, 1]^{|S|}} [f_S(hu) - f_S(0)] \prod_{k \in S} K(u_k) du_k \\ \intertext{As $\int xK(x) = 0$} &= \int_{[-1, 1]^{|S|}} \left[f_S(hu) - f_S(0) - h \sum_{k \in S} u_k \partial_k f_S(0) \right] \prod_{k \in S} K(u_k) du_k \\ \intertext{Now as $f_S(x) = 0$ for $x \notin [0, 1]^{|S|}$} &= \int_{[0, 1]^{|S|}} \left[f_S(hu) - f_S(0) - h \sum_{k \in S} u_k \partial_k f_S(0) \right] \prod_{k \in S} K(u_k) du_k \notag \\ &\ \ - f_S(0) \int_{[-1, 1]^{|S|}\setminus[0, 1]^{|S|}} \prod_{k \in S} K(u_k) du_k \notag \\ &\ \ - h \sum_{k \in S} \partial_k f_S(0) \int_{[-1, 1]^{|S|}\setminus[0, 1]^{|S|}} u_k \prod_{k \in S} K(u_k) du_k \end{align} The third term in the final sum tends to $0$ with $h$. The same is true for the first term as \begin{align} \Big| \int_{[0, 1]^{|S|}} &\left[f_S(hu) - f_S(0) - h \sum_{k \in S} u_k \partial_k f_S(0) \right] \prod_{k \in S} K(u_k) du_k \Big| \notag\\ &\leq \int_{[0, 1]^{|S|}} \left|f_S(hu) - f_S(0) - h \sum_{k \in S} u_k \partial_k f_S(0) \right| \prod_{k \in S} K(u_k) du_k \\ &\leq L h^2 \sum_{k \in S} \int_{[0, 1]^{|S|}} u_K^2 \prod_{k \in S} K(u_k) du_k \\ &\leq L \sigma_K^2 h^2. \end{align} Now, as $\int_{[-1, 1]^{|S|}\setminus[0, 1]^{|S|}} \prod_{k \in S} K(u_k) du_k = \frac{2^{|S|} - 1}{2^{|S|}}$, we conclude that \begin{equation} \lim_{h \rightarrow 0} \esperance{\hat{f}^{\text{KDE}}_{h, S}}(0) = f_S(0) \frac{2^{|S|} - 1}{2^{|S|}} \geq e^{- A|S|} \frac{2^{|S|} - 1}{2^{|S|}} > 0. \end{equation} \end{proof} \paragraph{Mirror-Image KDE} To correct the boundary bias previously introduced, a solution is to add a correction to the estimator $\hat{f}_{h ,S}^{\text{KDE}}$ near the boundary of the domain of definition. Let us define three mirroring operations for a number $x \in [0, 1]$ \begin{equation} M^{-1}(x) = -x; \ M^{0}(x) = x; \ M^{1}(x) = 2 - x. \end{equation} We define the mirror-image KDE as a KDE constructed over the sample $W$ augmented with mirror reflections of each point over all axis. An illustration of this operation in dimension $2$ is given by \cref{figmirror}. \begin{figure} \centering \includegraphics[scale=0.5]{MI_augmentation.png} \caption{A datapoint in $[0, 1]^d$ (in orange) and his 8 mirror-images (in blue)} \label{figmirror} \end{figure} This estimator is an extension to every dimension of the one proposed in \cite{liu2012exponential}. The formal definition is \begin{equation} \hat{f}_{m ,S}^{\text{MI}}(x) = \mathbb{1}_{[0, 1]^{|S|}}(x) \frac{1}{mh^{|S|}} \sum_{i=1}^m \sum_{a \in \{-1, 0, 1\}^{|S|}} \prod_{k \in S} K\left( \frac{M^{a_k}(W_i)_k - x_k}{h} \right). \end{equation} It consists in summing multidimensional kernel over the points of the augmented samples and restrict the domain of the obtained function to $[0, 1]^{|S|}$ as illustrated in \cref{figmiprinciple}. Roughly speaking it consists in flipping the part of $\hat{f}_{h, S}^{\text{KDE}}$ that fall outside $[0, 1]^{|S|}$ inside it. $\hat{f}_{m ,S}^{\text{MI}}$ is supported on $[0, 1]^{|S|}$ and $\int_{[0, 1]^{|S|}} \hat{f}_{m ,S}^{\text{MI}}(x) dx = 1$. \begin{figure}% \centering \subfloat[\centering A kernel is fitted over all points of the augmented dataset]{{\includegraphics[width=7cm]{MI_allkernels.png} }}% \quad \subfloat[\centering Restriction to the unit hypercube]{{\includegraphics[width=7cm]{MI_flip.png} }}% \caption{Construction of the mirror-image KDE}% \label{figmiprinciple}% \end{figure} \paragraph{Bias for mirror-image KDE} Under an ad-hoc condition on the partial derivatives of $f_S$ at the boundary of $[0, 1]^{|S|}$ it is possible to bound the bias for the mirror-image KDE. Our result is an extension of the lemma 3.1 in \cite{liu2012exponential} to every dimension and every $\beta \in (0, 2]$ while the analysis in the original paper was restricted to bi-dimensional densities and $\beta = 2$. With our proof strategy, we find a better constant in the upper-bound for $|S| = 2$ and $\beta = 2$. \begin{myprop}{Bias for mirror-image KDE}{biasmikde} Let us assume that for all sequence $(x_n)_{n \in \mathbb{N}}$ in $[0, 1]^{|S|}$, if $x_n$ converges to a boundary point of $[0, 1]^{|S|}$, then for all $k \in S$ $\lim_{n \rightarrow \infty} \partial_kf_S(x_n) = 0$. Then \begin{equation} \left\Vert f_S - \esperance{\hat{f}^{\text{MI}}_{m, S}} \right\Vert_\infty \leq C_1 h^\beta \end{equation} where $C_1 = L |S|^{\beta / 2} \left( 2 \Vert K \Vert_\infty \right)^{|S|}$ if $\beta < 2$ and $C_1 = L|S|$ if $\beta = 2$ \end{myprop} \begin{proof} We define $f^{\text{MI}}_S$ as the function defined over $[-1, 2]^{|S|}$ such that for all $x \in [0, 1]^{|S|}$ and $a \in \{-1, 0, 1\}^{|S|}$ \begin{equation} f^{\text{MI}}_S(M^{a}(x)) = f_S(X) \end{equation} where $M^{a}(x) = \left( M^{a_k}(x_k) \right)_{k \in S}$. The property that the partial derivatives of $f_S$ vanish near the boundary of $[0, 1]^{|S|}$ ensures that $\partial_k f^\text{MI}_S$ is continuous on $(-1, 2)^{|S|}$ and so $f^\text{MI}_S \in \mathcal{H}(2, L)$. Let $x \in [0, 1]^{|S|}$, we want to bound $\left| f_S(x) - \esperance{\hat{f}^{\text{MI}}_{m, S}(x)} \right|$. Assume first that $x \in [0, 1/2]^{|S|}$ and denote by $\mathcal{A}$ the set $\{ k \in S : x_k < h \}$. We start by considering the situation where $|\mathcal{A}| \geq 1$. For all $k \in \mathcal{A}$ and all $t \in [0, 1]$, $K\left( \frac{t - (2 - x_k)}{h} \right) = 0$ because the support of $K$ is $[-1, 1]$, $h \leq 1/2$ and $x_k < h$. For all $k \in S \setminus \mathcal{A}$ and all $t \in [0, 1]$, $K\left( \frac{t - (2 - x_k)}{h} \right) = 0$ and $K\left( \frac{t - (- x_k)}{h} \right) = 0$. Then the expected value of $\hat{f}^{\text{MI}}_{m, S}$ at the point $x$ can be written as \begin{equation} \esperance{\hat{f}^{\text{MI}}_{m, S}}(x) = \sum_{\mathcal{B \subset A}} \frac{1}{h^{|S|}} \int_{[0, 1]^{|S|}} \prod_{k \in \mathcal{B}} K\left( \frac{t_k + x_k}{h} \right) \prod_{k \in S \setminus \mathcal{B}} K\left( \frac{t_k - x_k}{h} \right) f_S(t) dt \end{equation} Now, for $\mathcal{B} \in \mathcal{A}$, we denote $x_\mathcal{B}$ the vector such that $(x_\mathcal{B})_k = x_k$ if $k \notin \mathcal{B}$ and $(x_\mathcal{B})_k = - x_k$ if $k \in \mathcal{B}$. We have \begin{equation} \esperance{\hat{f}^{\text{MI}}_{m, S}}(x) = \sum_{\mathcal{B \subset A}} \int_{\chi^S_\mathcal{B}} \prod_{k \in S} K\left( u_k \right) f_S(x_\mathcal{B} + uh) du \end{equation} where $\chi^S_\mathcal{B} = \left\{ u \in [-1, 1)^{|S|} : x_\mathcal{B} + uh \in [0, 1] \right\}$. We see that $\chi^S_\mathcal{B} = \prod_{k \in S} [\underline{u}_k, \bar{u}_k)$ where $\underline{u}_k = - x_k / h$ if $k \in \mathcal{B}$, $-1$ otherwise and $\bar{u}_k = - x_k / h$ if $k \in \mathcal{A} \setminus \mathcal{B}$, $1$ otherwise. What is more, as $f^{\text{MI}}_S = f_S$ on $[0, 1]^{|S|}$ we have \begin{equation} \esperance{\hat{f}^{\text{MI}}_{m, S}}(x) = \sum_{\mathcal{B \subset A}} \int_{\chi^S_\mathcal{B}} \prod_{k \in S} K\left( u_k \right) f^{\text{MI}}_S(x_\mathcal{B} + uh) du. \end{equation} Now, as $(\chi^S_\mathcal{B})_{\mathcal{B} \subset \mathcal{A}}$ forms a partition of $[-1, 1)^{|S|}$, we have \begin{align} f_S(x) &= \sum_{\mathcal{B} \subset \mathcal{A}} \int_{\chi^S_\mathcal{B}} \prod_{k \in S} K\left( u_k \right) f_S(x) du \\ &= \sum_{\mathcal{B} \subset \mathcal{A}} \int_{\chi^S_\mathcal{B}} \prod_{k \in S} K\left( u_k \right) f^\text{MI}_S(x_\mathcal{B}) du \end{align} We denote by $\delta_\mathcal{B}(u, \beta)$ the quantity \begin{equation} \left\{ \begin{array}{ll} f^{\text{MI}}_S(x_\mathcal{B} + uh) - f^{\text{MI}}_S(x_\mathcal{B}) & \text{if $\beta \in (0, 1]$} \\ f^{\text{MI}}_S(x_\mathcal{B} + uh) - f^{\text{MI}}_S(x_\mathcal{B}) - h \sum_{k \in S} u_k \partial_k f^{\text{MI}}_S(x_\mathcal{B}) & \text{if $\beta \in (1, 2]$} \end{array} \right. \end{equation} From lemma \ref{lem:controlforholder2} we have \begin{equation} | \delta_\mathcal{B}(u, \beta) | \leq L h^\beta \Vert u \Vert^\beta \end{equation} And, as $\int xK(x) = 0$, we have \begin{align} \left| f_S(x) - \esperance{\hat{f}^{\text{MI}}_{m, S}}(x) \right| &= \left| \sum_{\mathcal{B} \subset \mathcal{A}} \int_{\chi^S_\mathcal{B}} \prod_{k \in S} K\left( u_k \right) \delta_\mathcal{B}(u) du \right| \\ &\leq Lh^\beta \int_{[-1, 1]^{|S|}} \prod_{k \in S} K(u_k) \Vert u \Vert^\beta du \end{align} If $\beta = 2$ \begin{align} \int_{[-1, 1]^{|S|}} \prod_{k \in S} K(u_k) \Vert u \Vert^\beta du &= \int_{[-1, 1]^{|S|}} \prod_{k \in S} K(u_k) \sum_{k \in S} u_k^2 du \\ &= \sum_{k \in S} \int_{-1}^1 K(u) u^2 du \\ &\leq \sum_{k \in S} \int_{-1}^1 K(u) du = |S|. \end{align} If $\beta < 2$ \begin{align} \int_{[-1, 1]^{|S|}} \prod_{k \in S} K(u_k) \Vert u \Vert^\beta du &\leq \Vert K \Vert_\infty^{|S|} \int_{[-1, 1]^{|S|}} \Vert u \Vert^\beta du \\ &\leq \Vert_\infty^{|S|} \sqrt{|S|}^\beta \int_{[-1, 1]^{|S|}} du \\ &= |S|^{\beta / 2} \left( 2 \Vert K \Vert_\infty \right)^{|S|}. \end{align} Then $\sup_{x \in [0, 1/2]^{|S|}} \left| f_S(x) - \esperance{\hat{f}^{\text{MI}}_{m, S}}(x) \right| \leq C_1 h^\beta$. By symmetry the same inequality is true when the sup is taken over $[0, 1]^{|S|}$. \end{proof} Then considering the mirror-image KDE leads to a correction of the boundary issue previously mentioned. \subsubsection{Variance upper-bound} To upper-bound the variance of the mirror-image KDE, we will use corollary 15 of \cite{kim2019uniform}. Our setting is not the same as in this paper as we deal with mirror-image KDE. Then in order to obtain the same result, we must ensure that the family of functions \begin{equation} \mathcal{F}_{S}^\text{MI} = \left\{ K_{x, h}^{\text{MI}} | x \in [0, 1]^{|S|}, h \in (0, 1/2) \right\} \end{equation} where \begin{equation} K_{x, h}^{\text{MI}} : u \mapsto \frac{1}{h^{|S|}} \mathbb{1}_{[0, 1]^{|S|}} \sum_{a \in \{-1, 0, 1\}^{|S|}} \prod_{k \in S} K\left( \frac{M^{a_k}(u_k) - x_k}{h} \right) \end{equation} is a bounded VC class of function. We know that $\mathcal{F}_S$ is a bounded VC class of function. The results of section 2.6 of \cite{van1996weak} indicate that a family of functions is a bounded VC class if and only if the associated collection of sublevels is a VC class of sets. Now, we remark that the sublevels of functions in $\mathcal{F}_{S}^\text{MI}$ can be written as intersections of sublevels of functions in $\mathcal{F}_S$ intersected with $[0, 1]^{|S|}$. Then, as intersections preserve the VC class property for collection of sets (see \cite{van2009note}), $\mathcal{F}_{S}^\text{MI}$ is a bounded VC class of functions, and the corollary 15 of \cite{kim2019uniform} applies, leading to the following result. \begin{myprop}{Variance}{variancenormeinf} Let $h_{m, S}$ be a bandwidth in $(0, 1/2)$ and $\delta_m \in (0, 1)$. With probability $1 - \delta_m$ \begin{equation} \left\Vert \hat{f}_{S, {h_{m, S}}} - \esperance{\hat{f}_{m, {h_{m, S}}}} \right\Vert_\infty \leq C_2 \sqrt{\frac{\log\left( 1 / h_{m, S}\right) + \log(2 / \delta_m)}{m h_{m, S}^{|S|}}}. \end{equation} The constant $C_2$ depends on $|S|$, on $\Vert K \Vert_\infty$ and on $\Vert K' \Vert_\infty$. \end{myprop} \subsubsection{Conclusion} Now, as we have for a control of the bias and the variance term for every bandwidth $h_{m, S} \in (0, 1/2)$, by choosing appropriately $h_{m, S}$ it is possible to bound $\Vert f_S - \hat{f}_{S, {h_{m, S}}} \Vert_\infty$. \begin{myprop}{Convergence}{uniformconvergece} Choosing $h_{m, S} \asymp \left(1 / m \right)^\frac{1}{2 \beta + |S|}$, it exists a constant $C_S$ such that with probability at least $1 - \delta_m$ \begin{equation} \Vert f_S - \hat{f}_{S, {h_{m, S}}} \Vert_\infty \leq C_S \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{\beta}{2 \beta + |S|}}. \end{equation} \end{myprop} \subsection{Uniformity over $\mathrm{Set}_d^k$} We have just established a control in high probability for the quantity $\Vert f_S - \hat{f}_{S, {h_{m, S}}} \Vert_\infty$ for a given $S$. Our objective is to have such a control uniformly over $\mathrm{Set}_d^k$. Applying a union-bound, we obtain the following result. \begin{myprop}{Uniform control of uniform error over all subsets}{uniformconvergenceoversets} Let us denote $C_k = \max_{S \in \mathrm{Set}_d^k} C_S$. We have, with probability at least $1 - S_d^k \delta_m$ \begin{equation} \sup_{S \in \mathrm{Set}_d^k} \left\Vert \hat{f}_{S, h^S_m} - f_S \right\Vert_\infty \leq C_k \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{2}{4 + k}}. \end{equation} In particular with the choice $\delta_m = \frac{2}{m S_d^k}$, we have that with probability $1 - \frac{2}{m}$ \begin{equation} \sup_{S \in \mathrm{Set}_d^k} \left\Vert \hat{f}_{S, h^S_m} - f_S \right\Vert_\infty \leq C_k \sqrt{3 \log m + 2\log S_d^k} \left( \frac{1}{m} \right)^{\frac{2}{4 + k}}. \end{equation} \end{myprop} \section{THEOREM}\label{sec:theorem} Let now $m_0$ be the smallest integer $m$ such that \begin{equation} C_k \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{2}{4 + k}} \leq e^{-A|S|}\left(1 - e^{-A|S|}\right). \end{equation} If $m \geq m_0$, we know that on an event $\mathcal{A}_m^k$ of probability at least $1 - S_d^k\delta_m$ \begin{equation} \Vert f_S - \hat{f}_{S, h_m} \Vert_\infty \leq C_k \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{\beta}{2\beta + k}}. \end{equation} Then, on $\mathcal{A}_m^k$ \eqref{unifconvergence} is satisfied with $\epsilon_S = C_k \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{\beta}{2 \beta + k}}$ for all $S \in \mathrm{Set}_d^k$. As a consequence, using proposition \ref{prop:csqunifconvergence}, we have \begin{equation} \sum_{S \in {\mathcal{P}_*}} \KL{f_S}{\hat{f}_{S, h_m^s}} \leq e^{2Ak} |{\mathcal{P}_*}| C_k \sqrt{\log m + 2\log\left( 2 / \delta_m \right)} \left( \frac{1}{m} \right)^{\frac{2}{4 + k}}. \end{equation} And, on $\mathcal{A}_m^k$, for $\delta_n \in (0, 1/S_d^k)$ with probability $1 - S_d^k\delta_n$ \begin{equation} (P - P_n)(\log \hat{f}_{\Tilde{\mathcal{P}}} - \log \hat{f}_{\hat{\mathcal{P}}}) \leq 2d \sqrt{\frac{Ak}{n}} \sqrt{\log(2 / \delta_n)}. \end{equation} Now, with the choice $\delta_m = 1 / (2 S_d^k m)$ and $\delta_n = 1 / (2 S_d^k n)$ we obtain the following result \begin{mythm}{Final bound}{final} If for all $S \in \mathrm{Set}_d^k$, $f \in \mathcal{H}(2, L)$, and for all sequence $(x_n)_{n \in \mathbb{N}}$ such that $\lim_{n \rightarrow \infty} x_n = x^*$ where $x^*$ belongs to the boundary of $[0, 1]^{|S|}$ and for all $k \in S$ $\lim_{n \rightarrow \infty} \partial_k f_S(x_n) = 0$. With the choice $\hat{f}_S = \hat{f}^{\text{MI}}_{h_{m, S}, S}$ where $h_{m, S} \approx \left( \frac{1}{m} \right)^{\frac{1}{2 + |S|}}$, we have with probability at least $(1-1/m)(1-1/n)$ \begin{align} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{f_{\mathcal{P}_*}} \leq &e^{2Ak} \sqrt{2} |{\mathcal{P}_*}| C_k \sqrt{ \log m + \log\left( S_d^k \right)} \left( \frac{1}{m} \right)^{\frac{\beta}{2 \beta + k}} \notag\\ &+ 2d \sqrt{\log n + \log\left( S_d^k \right)} \sqrt{\frac{Ak}{n}} \end{align} \end{mythm} Ignoring logarithmic factors, the rate of convergence of the approximation term is $\left( \frac{1}{m} \right)^{\frac{\beta}{2\beta + k}}$. The dependence of this quantity in $k$ illustrates that ISDE tackles the curse of dimensionality for the density estimation problem under KL loss in the same spirit that \cite{rebelles2015mathbb} showed that his estimator does for the squared $L_2$ loss. Ignoring logarithmic factors again, the rate of convergence of the selection term is $\frac{1}{\sqrt{n}}$. This is a classical rate of convergence for hold-out procedures with bounded loss (see corollary 8.8 in \cite{massart2007concentration}). The term $\log(S_d^k)$ in the upper-bound illustrates the combinatorial complexity reduction operated by ISDE. The presence of the $\log$ of the number of hypotheses is classical for hold-out procedures with bounded loss (see again corollary 8.8 in \cite{massart2007concentration}). In our context, we have reduced the combinatorial complexity from the number of partitions $P_d^k$ to the number of subsets $S_d^k$. \section{CONCLUSION}\label{sec:conclusion} In this paper, we have studied the convergence properties of ISDE. In particular, we have shown that under suitable assumptions on the true density and for the mirror-image KDE as marginal density estimator, we can provide an upper-bound valid with high-probability of the quantity \begin{equation} \KL{f}{\hat{f}_{\hat{\mathcal{P}}}} - \KL{f}{f_{\mathcal{P}_*}}. \end{equation} This bound highlights how ISDE tackles the curse of dimensionality and reduces the combinatorial complexity of the density estimation problem under IS compared to a brute-force approach. These results offer a theoretical validation of the empirical observations presented in \cite{pujol2022isde}. To complete the study, it let to study how the bias term $\KL{f}{f_{\mathcal{P}_*}}$ behaves. It is hard to give a precise statement on this quantity in a general setting. One simple situation is when $f \in \mathcal{D}_k^d$. In this case $\KL{f}{f_{\mathcal{P}_*}} = 0$. This bias can also be explicitly evaluated in some multivariate Gaussian frameworks, see appendix \ref{sec:appendixgaussian}. \paragraph{Acknowledgement} This work was supported by the program \href{https://www.iledefrance.fr/paris-region-phd-2021}{Paris Region Ph.D.} of \href{https://www.dim-mathinnov.fr/}{DIM Mathinnov} and was partly supported by the French ANR Chair in Artificial Intelligence TopAI - ANR-19-CHIA-0001. The author is thankful to Marc Glisse and Pascal Massart for their constructive remarks on this work. \bibliographystyle{plain}
\section{Introduction} The aim of vaccine attitude detection in social media is to extract people's opinions towards vaccines by analysing their online posts. This is closely related to aspect-based sentiment analysis in which both aspects and related sentiments need to be identified. Previous research has been largely focused on product reviews and relied on aspect-level sentiment annotations to train models~\cite{barnes-etal-2021-structured}, where aspect-opinions are extracted as triples~\cite{Peng_Xu_Bing_Huang_Lu_Si_2020}, polarized targets~\cite{AAAI1816541} or sentiment spans~\cite{he-etal-2019-interactive}. However, for the task of vaccine attitude detection on Twitter, such a volume of annotated data is barely available~\cite{kunneman2020monitoring,PAUL2021100012}. This scarcity of data is compounded by the diversity of attitudes, making it difficult for models to identify all aspects discussed in posts~\cite{morante-etal-2020-annotating}. \begin{figure}[tp] \centering \includegraphics[width=0.49\textwidth]{figs/tweet_aspects.pdf} \caption{\textbf{Top:} Expressions of aspects entangled with expressions of opinions. \textbf{Bottom:} Vaccine attitudes can be expressed towards a wide range of aspects/topics relating to vaccination, making it difficult to pre-define a set of aspect labels as opposed to corpora typically used for aspect-based sentiment analysis. } \vspace{-10pt} \label{fig:0} \end{figure} \lx{As representative examples, consider the two tweets about personal experiences for vaccination at the top of Figure~\ref{fig:0}. The two tweets, despite addressing a common aspect (vaccine side-effects), express opposite stances towards vaccines. However, the aspect and the stances are so fused together that the whole of the tweets need to be considered to derive the proper labels, making it difficult to disentangle them using existing methodologies. Additionally, in the case of vaccines attitude analysis, there is a wide variety of possible aspects discussed in posts, as shown in the bottom of Figure~\ref{fig:0}, where one tweet ironically addressed vaccine side-effects and the second one expressed instead specific political concerns. This is different from traditional aspect-based sentiment analysis on product reviews where only a small number of aspects need to be pre-defined.} \lx{The recently developed framework for integrating Variational Auto-Encoder (VAE)~\cite{kingma2014auto} and Independent Component Analysis (ICA)~\cite{pmlr-v108-khemakhem20a} sheds light on this problem. VAE is an unsupervised method that can be used to glean information that must be retained from the vaccine-related corpus. Meanwhile, a handful of annotations would induce the separation of independent factors following the ICA requirement for prior knowledge and inductive biases~\cite{pmlr-v89-hyvarinen19a,pmlr-v119-locatello20a,locatello2020disentangling}. To this end, we could disentangle the latent factors that are either specific to the aspect or to the stance, and improve the quality of the latent semantics learned from unannotated data.} We frame the problem of vaccine attitude detection as a joint aspect span detection and stance classification task, assuming that a tweet, which is limited to 280 characters, would usually only discuss one aspect. In particular, we extend a pre-trained language model (LM) by adding a topic layer, which aims to model the topical theme discussed in a tweet. In the absence of annotated data, the topic layer is trained to reconstruct the input message built on VAE. Given the annotated data, where each tweet is annotated with an aspect span and a stance label, the learned topic can be disentangled into a stance topic and an aspect topic. The stance topic is used to predict the stance label of the given tweet, while the aspect topic is used to predict the start and the ending positions of the aspect span. By doing so, we can effectively leverage both unannotated and annotated data for model training. To evaluate the effectiveness of our proposed model for vaccine attitude detection on Twitter, we have collected over 1.9 million tweets relating to COVID vaccines between \lx{February} and April 2021. We have further annotated 2,800 tweets with both aspect spans and stance labels. In addition, we have also used an existing Vaccination Corpus\footnote{https://github.com/cltl/VaccinationCorpus} in which 294 documents related to the online vaccination debate have been annotated with opinions towards vaccination. Our experimental results on both datasets show that the proposed model outperforms existing opinion triple extraction model and BERT QA model on both aspect span extraction and stance classification. Moreover, the learned latent aspect topics allow the clustering of user attitudes towards vaccines, facilitating easier discovery of positive and negative attitudes in social media. \lx{The contribution of this work can be summarised as follows\footnote{\lxCR{Source code and dataset are released on \url{http://github.com/something1202/VADet}.}}:} \begin{itemize \item We have proposed a novel semi-supervised approach for joint latent stance/aspect representation learning and aspect span detection; \item The developed disentangled representation learning facilitates better attitude detection and clustering; \item We have constructed an annotated dataset for vaccine attitude detection. \end{itemize} \section{Related Work} Our work is related to three lines of research: aspect-based sentiment analysis, disentangled representation learning, and vaccine attitude detection. \paragraph{Aspect-Based Sentiment Analysis} (ABSA) aims to identify the aspect terms and their polarities from text. \lxCR{Much work has been focusing on this task. The techniques used include Conditional Random Fields (CRFs)~\cite{10.1007/978-3-319-06028-6_23}, Bidirectional Long Short-Term Memory networks (BiLSTMs)~\cite{baziotis-etal-2017-datastories-semeval}, Convolutional Neural Networks (CNNs)~\cite{10.5555/2969239.2969312}, Attention Networks~\cite{yang-etal-2016-hierarchical,pergola21bem}, DenseLSTMs~\cite{wu-etal-2018-thu}, NestedLSTMs~\cite{pmlr-v77-moniz17a}, Graph Neural Networks~\cite{zhang-etal-2019-aspect} and their combinations~\cite{ijcai2018-617,zhu21topic,Wan_Yang_Du_Liu_Qi_Pan_2020}, to name a few.} \lx{\citet{zhang-etal-2015-neural} framed this task as text span detection, where they used text spans to denote aspects. The same annotation scheme was employed in~\cite{li-etal-2018-transformation}, where intra-word attentions were designed to enrich the representations of aspects and predict their polarities. \citet{ijcai2018-583} formalized the task as a sequence labeling problem under a unified tagging scheme. Their follow-up work~\cite{li-etal-2019-exploiting} explored BERT for end-to-end ABSA. \citet{Peng_Xu_Bing_Huang_Lu_Si_2020} modified this task by introducing opinion terms to shape the polarity. A similar modification was made in~\cite{zhao-etal-2020-spanmlt} to extract aspect-opinion pairs. Position-aware tagging was introduced to entrench the offset between the aspect span and opinion term~\cite{xu-etal-2020-position}. More recently, instead of using pipeline approaches or sequence tagging, \citet{barnes-etal-2021-structured} adapted syntactic dependency parsing to perform aspect and opinion expression extraction, and polarity classification, thus formalizing the task as structured sentiment analysis.} \paragraph{Disentangled representation learning} Deep generative models learn the hidden semantics of text, of which many attempt to capture the independent latent factor to steer the generation of text in the context of NLP~\cite{pmlr-v70-hu17e,li-etal-2018-delete,pergola19tdam,john-etal-2019-disentangled,li-etal-2020-optimus}. The majority of the aforementioned work employs VAE~\cite{10.5555/2969033.2969226} to learn controllable factors, leading to the abundance of VAE-based models in disentangled representation learning~\cite{DBLP:conf/iclr/HigginsMPBGBML17,burgess2018understanding,NEURIPS2018_1ee3dfcd}. However, previous studies show that unsupervised learning of disentanglement by optimising the marginal likelihood in a generative model is impossible~\cite{locatello2019challenging}. While it is also the case that non-linear ICA is unable to uncover the true independent factors, \citet{pmlr-v108-khemakhem20a} established a connection between those two strands of work, which is of particular interest to us since the proposed framework learns to approximate the true factorial prior given few examples, recovering a disentangled latent variable distribution \lxCR{on top of additionally observed variables}. \lxCR{In this paper, stance labels and aspect spans are additionally observed on a handful of data, which could be used as inductive biases that make disentanglement possible.} \paragraph{Vaccine attitude detection} Very little literature exists on attitude detection for vaccination. In contrast, there is growing interest in Covid-19 corpus construction~\cite{shuja2021covid}. Of particular interest to us, \citet{banda2021large} built an on-going tweet dataset that traces the development of Covid-19 by 3 keywords: ``coronavirus'', ``2019nCoV'' and ``corona virus''. \citet{info:doi/10.2196/26627} utilized hydrated tweets from the aforementioned corpus to analyze the sentiment towards vaccination. They used lexicon-based methods (i.e., VADER and TextBlob) and pre-trained BERT to classify the sentiment in order to gain insights into the temporal sentiment trends. A similar approach has been proposed in~\cite{info:doi/10.2196/30854}. \citet{lyu2021covid} employed a topic model to discover vaccine-related themes in twitter discussions and performed sentiment classification using lexicon-based methods. However, none of the work above constructed datasets about vaccine attitudes, nor did they train models to detect attitudes. \citet{morante-etal-2020-annotating} built the Vaccination Corpus (VC) with events, attributions and opinions annotated in the form of text spans, which is the only dataset available to us to perform attitude detection. \section{Methodology} \lx{The goal of our work is to detect the stance expressed in a tweet (i.e., `\emph{pro-vaccination}', `\emph{anti-vaccination}', or `\emph{neutral}'), identify a text span that indicates the concerning aspect of vaccination, and cluster tweets into groups that share similar aspects. To this end, we propose a novel latent representation learning model that jointly learns a stance classifier and disentangles the latent variables capturing stance and aspect respectively. Our proposed Vaccine Attitude Detection (\textsc{VADet}) model is firstly trained on a large amount of unannotated Twitter data to learn latent topics via masked Language Model (LM) learning. It is then fine-tuned on a small amount of Twitter data annotated with stance labels and aspect text spans for simultaneously stance classification and aspect span start/end position detection. The rationale is that the inductive bias imposed by the annotations would encourage the disentanglement of latent stance topics and aspect topics.} In what follows, we will present our proposed \textsc{VADet} model, first under the masked LM learning and later extended to the supervised setting for learning disentangled stance and aspect topics. \begin{figure}[htb] \centering \includegraphics[width=0.49\textwidth]{figs/VADet-unsupervised.pdf} \caption{\textsc{VADet} in masked language model learning. The latent variables are encoded via the topic layers incorporated into the masked language model. } \vspace{-10pt} \label{fig:VADet-unsupervised} \end{figure} \paragraph{\textsc{VADet} in the masked LM learning} \begin{figure*}[tb] \centering \includegraphics[width=0.9\textwidth]{figs/VADet-supervised.pdf} \caption{\textsc{VADet} in supervised learning. The text segment highlighted in blue is the annotated aspect span. The right part learns latent aspect topic $z_a$ from aspect text span $[w_a:w_b]$ only under masked LM learning. The left part learns jointly latent stance topic $z_s$ and latent aspect topic $z_w$ from the whole input text, and trained simultaneously for stance classification and aspect start/end position detection.} \vspace{-10pt} \label{fig:VADet-supervised} \end{figure*} We insert a topic layer into a pre-trained language model such as ALBERT, as shown in Figure \ref{fig:VADet-unsupervised}, allowing the network to leverage pre-trained information while fine-tuned on an in-domain corpus. We assume that there is a continuous latent variable $z$ involved in the language model to reconstruct the original text from the masked tokens. We retain the weights of a language model and learn the latent representation during the fine-tuning. More concretely, the topic layer partitions a language model into lower layers and higher layers denoted as $\psi$ and $\theta$, respectively. The lower layers constitute the Encoder that parameterizes the variational posterior distribution denoted as $q_\phi(z|\psi(\textbf{w}))$, while the higher layers reconstruct the input tokens, which is referred to as the Decoder. The objective of VAE is to minimize the KL-divergence between the variational posterior distribution and the approximated posterior. This is equivalent to maximizing the Evidence Lower BOund (ELBO) expressed as: \begin{equation}\small \label{eqs:1} \mathbb{E}_{q_\phi(z|\psi(\textbf{w}))}[\mathrm{log}\;p_\theta(\textbf{w}^H|z, \psi(\textbf{w}))] - \mathrm{KL}[q_\phi(z|\psi(\textbf{w}))||p(z)], \end{equation} where $q_\phi(z|\psi(\textbf{w}))$ is the encoder and $p_\theta(\textbf{w}^H|z, \psi(\textbf{w}))$ is the decoder. Here, $\textbf{w} = \lbrack w_{\texttt{CLS}}, w_{1:n} \rbrack$, since the special classification embedding $w_{\texttt{CLS}}$ is automatically prepended to the input sequence~\cite{devlin2019bert}, $\textbf{w}^H$ denotes the reconstructed input. Following~\cite{kingma2014auto}, we choose a standard Gaussian distribution as the prior, denoted as $p(z)$, and the diagonal Gaussian distribution $z \sim \mathcal{N}(\mu_{\phi}(\psi(\textbf{w})), \sigma^2_{\phi}(\psi(\textbf{w})))$ as the variational distribution. The decoder computes the probability of the original token given the latent variable sampled from the Encoder. We use the Memory Scheme~\cite{li-etal-2020-optimus} to concatenate $z$ and $\psi(\textbf{w})$, making the latent representation compatible for higher layers of the language model. Then the latent presentation $z$ is passed to $\theta$ to reconstruct the original text. \paragraph{\textsc{VADet} with disentanglement of aspect and stance} \lx{One of the training objectives of vaccine attitude detection is to detect the text span that indicates the aspect and to predict the associated stance label. Existing approaches rely on structured annotations to indicate the boundary and dependency between aspect span and opinion words~\cite{xu-etal-2020-position,barnes-etal-2021-structured}, or use a two-stage pipeline to detect the aspect span and the associated opinion separately~\cite{Peng_Xu_Bing_Huang_Lu_Si_2020}. The problem is that the opinion expressed in a tweet and the aspect span often overlap. To mitigate this issue, we instead separate the stance and aspect from their representations in the latent semantic space, that is, disentangling latent topics learned by \textsc{VADet} into latent stance topics and latent aspect topics.} A recent study in disentangled representation learning~\cite{locatello2019challenging} shows that unsupervised learning of disentangled representations is theoretically impossible from i.i.d. observations without inductive biases, such as grouping information \cite{bouchacourt2018multi} or access to labels \cite{locatello2020disentangling,trauble2021disentangled}. As such, we extend our model to a supervised setting in which disentanglement of the latent vectors can be trained on annotated data. Figure~\ref{fig:VADet-supervised} outlines the overall structure of \textsc{VADet} in the supervised setting. On the right hand side, we show \textsc{VADet} learned from the annotated aspect text span $[w_a:w_b]$ under masked LM learning. The latent variable $z_a$ encodes the hidden semantics of the aspect expression. We posit that the aspect span is generated from a latent representation with a standard Gaussian distribution being its prior. The ELBO for reconstructing the aspect text span is: \begin{equation}\smal \begin{aligned} \mathcal{L}_A = \mathbb{E}_{q_\phi(z_a|\psi(w_{a:b}))}[\mathrm{log}\;p_\theta(w_{a:b}^H|z_a, \psi(w_{a:b}))]\\ - \mathrm{KL}[q_\phi(z_a|\psi(w_{a:b}))||p(z_a)], \end{aligned} \end{equation} \noindent where $w_{a:b}^H$ denotes the reconstructed aspect span. Ideally, the latent variable $z_a$ does not encode any stance information and only captures the aspect mentioned in the sentence. \lxCR{Therefore, the $z_s$ for the language model on the right hand side is detached and the reconstruction loss for \texttt{[CLS]} is set free.} On the left hand side of Figure~\ref{fig:VADet-supervised}, we train \textsc{VADet} on the whole sentence. The input to \textsc{VADet} is formalized as: `\texttt{[CLS]} \textsf{text}'. Instead of mapping an input to a single latent variable $z$, as in masked LM learning of \textsc{VADet}, the input is now mapped to a latent variable decomposing into two components, $[z_s, z_w]$, one for the stance and another for the aspect. We use a conditionally factorized Gaussian prior over the latent variable $z_w \sim p_\theta(z_w|w_{a:b})$, which enables the separation of $z_s$ and $z_w$ since the diagonal Gaussian is factorized and the conditioning variable $w_{a:b}$ is observed. \lx{We establish an association between $z_w$ and $z_a$ by specifying $p_\theta(z_w|w_{a:b})$ to be the encoder network of $q_\phi(z_a|w_{a:b})$, since we want the latent semantics of aspect span to encourage the disentanglement of attitude in the latent space.} \lx{In other words,} the prior of $z_w$ is configured as the approximate posterior of $z_a$ to enforce the association between the disentangled aspect in sentence and the \textit{de facto} aspect. As a result, the ELBO for the original text is written as \begin{equation}\small\label{eqs:2} \begin{aligned} \mathbb{E}_{q_\phi(z_w|\psi(\textbf{w}))}&\lbrack\mathrm{log}\;p_\theta(\mathbf{w}^H|z_w, \psi(\textbf{w}))\rbrack \\ - &\mathrm{KL}[q_\phi(z_w|\psi(\textbf{w}))||q_\phi(z_w|\psi(w_{a:b}))], \end{aligned} \end{equation} where $\mathbf{w}^H$ denotes the reconstructed input text, $z_w|\textbf{w} \sim \mathcal{N}(\mu_\phi(\psi(\textbf{w})), \sigma^2_\phi(\psi(\textbf{w})))$. The KL-divergence allows for some variability since there might be some semantic drift from the original semantics when the aspect span is placed in a longer sequence. The annotation of the stance label provides an additional input. To exploit this \lx{inductive bias}, we enforce the constraint that $z_s$ participates in the generation of \texttt{[CLS]}, which follows an approximate posterior $q_\phi(z_s|\psi(\textbf{w}_{\texttt{[CLS]}})$. We place the standard Gaussian as the prior over $z_s \sim \mathcal{N}(\textbf{0}, \textbf{I})$ and obtain the ELBO {\begin{equation}\small\label{eqs:3} \begin{aligned} \mathbb{E}_{q_\phi(z_s|\psi(\mathbf{w}_{\texttt{[CLS]}})}[\mathrm{log}\;p_\theta(w_{\texttt{[CLS]}}^H|z_s, \psi(\textbf{w}_{\texttt{[CLS]}})]\\ - \mathrm{KL}[q_\phi(z_s|\psi(\mathbf{w}_{\texttt{[CLS]}}))||p(z_s)] \end{aligned} \end{equation} } Since the variational family in Eq.~\ref{eqs:1} are Gaussian distributions with diagonal covariance, the joint space of $[z_s, z_w]$ factorizes as $q_\phi(z_s,z_w|\psi(\textbf{w})) = q_\phi(z_s|\psi(\textbf{w}))q_\phi(z_w|\psi(\textbf{w}))$ \cite{nalisnick2016approximate}. Assuming $z_s$ to be solely dependent on $\psi(\textbf{w}_{\texttt{[CLS]}})$, we obtain the ELBO for the entire input sequence: \begin{equation}\small \begin{aligned} \mathcal{L}_S = & \ \mathbb{E}_{q_\phi(z_w)}\mathbb{E}_{q_\phi(z_s)}[\mathrm{log}\;p_\theta(\mathbf{w}^H|z, \psi(\mathbf{w}))]\\ & - \mathrm{KL}\left[ q_\phi(z_w|\psi(w_{1:n}))||q_\phi(z_w|\psi(w_{a:b}))\right]\\ & - \mathrm{KL}[q_\phi(z_s|\psi(\mathbf{w}_{\texttt{[CLS]}}))||p(z_s)]. \end{aligned} \end{equation} Note that the expectation term can be decomposed into the expectation term in Eq.~\ref{eqs:2} and Eq.~\ref{eqs:3} according to the decoder structure. \lx{For the full derivation, please refer to Appendix A.} Finally, \lx{we perform stance classification and classification for the starting and ending position over the aspect span of a tweet.} We use negative log-likelihood loss for \lx{both} the stance label and aspect span: \begin{equation}\small \begin{aligned} \mathcal{L}_s = &-\mathrm{log}\;p(y_s|w^H_{\texttt{[CLS]}}), \nonumber \\ \mathcal{L}_a = &- \mathrm{log}\;p(y_a|\mathrm{MLP}(w_{1:n}^H)) - \mathrm{log}\;p(y_b|\mathrm{MLP}(w_{1:n}^H)), \nonumber \end{aligned} \end{equation} where MLP is a fully-connected feed-forward network with tanh activation, $y_s$ is the predicted stance label, $y_a$ and $y_b$ are the starting and ending position of the aspect span. The \lx{overall} training objective \lx{in the supervised setting} is: \begin{equation}\small \mathcal{L} = \mathcal{L}_s + \mathcal{L}_a - \mathcal{L}_S - \mathcal{L}_A\nonumber \vspace{-10pt} \end{equation} \label{sec:3d1} \section{Experiments} We present below the experimental setup and evaluation results. \subsection{Experimental Setup} \label{sec:4d1} \begin{table} \centering \resizebox{0.4\textwidth}{!}{ \begin{tabular}{lrrrr} \toprule & \multicolumn{2}{c}{\multirow{1}{*}{VAD}} & \multicolumn{2}{c}{\multirow{1}{*}{VC}} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} Specification & \multicolumn{1}{c}{Train} & Test & Train & Test \\ \midrule \# tweets &2000& 800 & 1162 & 531 \\ \enskip \# anti-vac. & 638 & 240 & 822 & 394\\ \enskip \# neutral & 142 & 76 & 41& 27\\ \enskip \# pro-vac. & 1220 & 484 & 299 & 110\\ \midrule Avg. length & 33.5 & 34.13 & 29.6 & 30.24\\ \enskip len(aspect) &17.5 & 18.75 & 1.03 & 1.08\\ \enskip len(opinion) &27.97 & 28.96 & 3.25 & 3.15\\ \midrule \# tokens & 67k & 27.3k & 34.4k& 16.8k\\ \bottomrule \end{tabular}} \caption{Dataset Statistics. `\# tweets' denotes the number of tweets in VAD, and for VC it is the number of sentences. `anti-vac.' means \emph{anti-vaccination} while `pro-vac.' means \emph{pro-vaccination}. `Avg. length' and `\# token' measure the number of word tokens.} \label{tab:minus1} \end{table} \paragraph{Datasets} We evaluate our proposed \textsc{VADet} and compare it against baselines on two vaccine attitude datasets. \noindent\underline{VAD} is our constructed \textbf{V}accine \textbf{A}ttitude \textbf{D}ataset. Following~\cite{info:doi/10.2196/26627}, we crawl tweets using the Twitter streaming API with $60$ pre-defined keywords\footnote{The full keyword list and the details of dataset construction are presented in Appendix B.} relating to COVID-19 vaccines (e.g., \textit{Pfizer}, \textit{AstraZeneca}, and \textit{Moderna}). Our final dataset comprises $1.9$ million English tweets collected between \lx{February} 7th and April 3rd, 2021. We randomly sample a subset of tweets for annotation. Upon an initial inspection, we found that over $97\%$ of tweets mentioned only one aspect. As such, we annotate each tweet with a stance label and a text span characterizing the aspect. In total, 2,800 tweets have been annotated in which 2,000 are used for training and the remaining 800 are used for testing. \lx{The statistics of the dataset is listed in Table~\ref{tab:minus1}. The stance labels are imbalanced. On the other hand, the average opinion length is longer than the average aspect length, and is close to the average tweet length.} For the purpose of evaluation on tweet clustering and latent topic disentanglement, we \lx{further} annotate tweets with a categorical label indicating the aspect category. Inspired by~\cite{morante-etal-2020-annotating}, we identify $24$ aspect categories\footnote{The full list of aspect categories is shown in Table \ref{tab:aspectCat}.} and each tweet is annotated with one of these categories. It is worth mentioning that aspect category labels are not used for training. \noindent\underline{VC}~\cite{morante-etal-2020-annotating} is a vaccination corpus consisting of 294 Internet documents about online vaccine debate annotated with events, 210 of which are annotated with opinions (in the form of text spans) towards vaccines. The stance label is considered to be the stance for the whole sentence. Those sentences with conflicting stance labels are regarded as neutral. We split the dataset into a ratio of 2:1 for training and testing. This eventually left us with 1,162 sentences for training and 531 sentences for testing. \paragraph{Baselines} \label{ss:baselines} We compare the experimental results with the following baselines: \noindent\underline{BertQA} \cite{ijcai2018-583}: a pre-trained language model well-suited for span detection. \lx{With BertQA, attitude detection is performed by first classifying stance labels then predicting the answer queried by the stance label. The text span is configured as the ground-truth answer.} We rely on its HuggingFace\footnote{\url{https://huggingface.co/transformers/model_doc/albert.html\#albertforquestionanswering}}~\cite{wolf-etal-2020-transformers} implementation. We employ ALBERT~\cite{Lan2020ALBERT} as the backbone language model for both BertQA and \textsc{VADet}. \noindent\underline{ASTE} \cite{Peng_Xu_Bing_Huang_Lu_Si_2020}: a pipeline approach consisting of aspect extraction~\cite{ijcai2018-583} and sentiment labelling~\cite{li-etal-2018-transformation}. \paragraph{Evaluation Metrics} For stance classification, we use accuracy and Macro-averaged F1 score. For aspect span detection, we follow~\citet{rajpurkar-etal-2016-squad} in adopting exact match (EM) accuracy of the starting-ending position and Macro-averaged F1 score of the overlap between the prediction and ground truth aspect span. For tweet clustering, we follow~\citet{pmlr-v48-xieb16} and \citet{zhang-etal-2021-supporting} and use the Normalized Mutual Information (NMI) metric to measure \lx{how the clustered group aligns with ground-truth categories}. In addition, we also report the clustering accuracy. \subsection{Experimental Results} In all our experiments, \textsc{VADet} is firstly pre-trained in an unsupervised way on our collected 1.9 million tweets before fine-tuned on the annotated training set from the VAD or VC corpora. \paragraph{Stance Classification and Aspect Span Detection} \begin{table} \centering \resizebox{0.4\textwidth}{!}{ \begin{tabular}{lcccc} \toprule \multicolumn{1}{l}{\multirow{1}{*}{Model}} & \multicolumn{2}{c}{\multirow{1}{*}{VAD}} & \multicolumn{2}{c}{\multirow{1}{*}{VC}} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \textbf{\textit{Stance}} & \multicolumn{1}{c}{Acc.} & \multicolumn{1}{c}{F1} & Acc. & \multicolumn{1}{c}{F1} \\ \midrule BertQA & 0.754& 0.742 &0.719& 0.708\\ ASTE &0.723& 0.710 &0.704& 0.686\\ \textsc{VADet} & \textbf{0.763} & \textbf{0.756} & \textbf{0.727} & \textbf{0.713} \\ \midrule \textbf{\textit{Aspect Span}}& \multicolumn{1}{c}{Acc.} & \multicolumn{1}{c}{F1} & Acc. & \multicolumn{1}{c}{F1} \\ \midrule BertQA & 0.546& 0.722 &0.525& 0.670\\ ASTE &0.508& 0.684 &0.467& 0.652\\ \textsc{VADet} & \textbf{0.556} & \textbf{0.745} & \textbf{0.541} & \textbf{0.697} \\ \midrule \textbf{\textit{Cluster}} & Acc.& NMI & Acc. & NMI\\ \midrule DEC (BertQA) & 0.633 & 58.1 & 0.586 & 52.8\\ K-means (BERT) & 0.618 & 56.4 & 0.571 & 50.1\\ DEC (\textsc{VADet}) & \textbf{0.679} & \textbf{60.7} & \textbf{0.605} & \textbf{54.7} \\ \bottomrule \end{tabular}} \caption{Results for stance classification, aspect span extraction and aspect clustering on both VAD and VC corpora. } \vspace{-10pt} \label{tab:2} \end{table} In Table~\ref{tab:2}, \lx{we report the performance on attitude detection.} In stance classification, our model outperforms both baselines with more significant improvements on ASTE. On aspect span extraction, \textsc{VADet} yields even more noticeable improvements, with a $2.3\%$ increase in F1 over BertQA on VAD, and $2.7\%$ on VC. \lx{These results indicate that the successful prediction relies on the hidden representation learned in the unsupervised training. The disentanglement of stance and aspect may have also contributed to the improvement.} \paragraph{Clustering} To assess whether the learned latent aspect topics would allow meaningful categorization of documents into attitude clusters, we perform clustering using the disentangled representations that encode aspects, i.e., $z_w$. Deep Embedding Clustering (DEC)~\cite{pmlr-v48-xieb16} is employed as the backend. For comparison, we also run DEC on the aspect representations of documents returned by BertQA. For each document, its aspect representation is obtained by averageing over the fine-tuned ALBERT representations of the constituent words in its aspect span. To assess the quality of clusters, we need the annotated aspect categories for documents in the test set. In VAD, we use the annotated aspect labels as the ground-truth categories whereas in VC we use the annotated event types. Results are presented in the lower part of Table~\ref{tab:2}. We found a prominent increase in NMI score over the baselines. Using the learned latent aspect topics as features, DEC (\textsc{VADet}) outperforms DEC (BertQA) by $4.6\%$ and $1.9\%$ in accuracy on VAD and VC, respectively. We also notice that using K-means as the clustering approach directly on the BERT-encoded tweet representations gives worse results compared to DEC. A similar trend is observed on the NMI metric. The improvements are shown visually in Figure~\ref{fig:2} where the clustered groups produced by \textsc{VADet} are more identifiable. In the absence of categorical labels, the perspective expressed by each group can be inferred from the constituent tweets. For example, the tweet \textit{`@user Georgian nurse dies of allergic reaction after receiving AstraZeneca Covid19 vaccine'} lies in the centroid of the red group, which relates to safety concerns. \begin{figure}[ht] \centering \subfloat[VAD\textsc{et}]{\includegraphics[width=0.24\textwidth]{./figs/fig3_1.pdf}} \subfloat[BertQA]{\includegraphics[width=0.24\textwidth]{./figs/fig4.pdf}} \caption{Clustered groups of \textsc{VADet} and BertQA \lx{on the VAD dataset}. Each color indicates a ground truth aspect category. The clusters are dominated by: \textit{(1) Red: the (adverse) side effects of vaccines; (2) Green: explaining personal experiences with any aspect of vaccines; and (3) Cyan: the immunity level provided by vaccines}.} \label{fig:2} \end{figure} \paragraph{Cluster Semantic Coherence Evaluation} The semantic coherence is the extent to which tweets within a cluster belong to each other, which is employed as an evaluation metric for cluster quality evaluation in an unsupervised way. Recent work of \citet{bilal-etal-2021-evaluation} found that Text Generation Metrics (TGMs) align well with human judgement in evaluating clusters in the context of microblog posts. TGM by definition measures the similarity between the ground-truth and the generated text. The rationale is that a high TGM score means sentence pairs are semantically similar. Here, two metrics are used: \textit{BERTScore}, which calculates the similarity of two sentences as a sum of cosine similarities between their tokens’ embeddings~\cite{DBLP:conf/iclr/ZhangKWWA20}, and \textit{BLEURT}, a pre-trained adjudicator that fine-tunes BERT on an external dataset of human ratings~\cite{sellam-etal-2020-bleurt}. As in~\cite{bilal-etal-2021-evaluation}, we adopt the Exhaustive Approach that for a cluster $C$, its coherence score is the average TGM score of every possible tweet pair in the cluster: \begin{equation*} f(C) = \frac{1}{N^2}\sum_{i,j\in [1, N], i<j}\mathrm{TGM}(\mathrm{tweet}_i, \mathrm{tweet}_j). \end{equation*} Figure~\ref{fig:5} shows the BERTScore and the BLEURT score of VAD\textsc{et} and baselines on two datasets. The VAD\textsc{et} shows consistent improvements across the datasets. This indicates that tweets clustered using the latent aspect topics generated by VAD\textsc{et} are semantically more similar, thus validating the assumption that disentangled representations are more effective in bringing together tweets of a similar gist. \begin{figure}[ht] \centering \includegraphics[width=0.47\textwidth]{./figs/fig5.pdf} \caption{Semantic coherence evaluated in two metrics.} \label{fig:5} \end{figure} \paragraph{Conditional Perplexity} Few metrics have been proposed to evaluate the quality of disentangled representations~\cite{pergola-etal-2021-disentangled}. Therefore, we adopt the language model perplexity conditioned on $z_a$ to evaluate the extent to which the disentangled representation improves language generation on held-out data. Perplexity is widely used in the literature of text style transfer~\cite{john-etal-2019-disentangled,ijcai2020-526}, where the probability of the generated language is calculated conditioned on the controlled latent code. A lower perplexity score indicates better language generation performance. Following \citet{john-etal-2019-disentangled}, we compute an estimated aspect vector $\hat{z}_a^{(k)}$ of a cluster $k$ in the training set as \begin{equation*} \hat{z}_a^{(k)} = \frac{\sum_{i\in \mathrm{cluster}\;k} z_{a,i}^{(k)}}{\mathrm{\mypound\;tweets\;in\;cluster}\;k}, \end{equation*} where $z_{a,i}^{(k)}$ is the learned aspect vector of the $i$-th tweet in the $k$-th cluster. For the stance vector $z_s$, we sample one value per tweet. The stance vector is concatenated with the aspect vector $\hat{z}_a^{(k)}$ to calculate the probability of generating the held-out data, i.e., the testing set. For the baseline models, we choose $\beta$-VAE~\cite{DBLP:conf/iclr/HigginsMPBGBML17} and SCHOLAR~\cite{card-etal-2018-neural}. We train $\beta$-VAE on the same data with $\beta$ set to different values. SCHOLAR is trained on tweet content and stance labels. For both the baselines we use ELBO on the held-out data as an upper bound on perplexity. Figure~\ref{fig:6} plots the perplexity score achieved by all the methods. Our model achieves the lowest perplexity score on both datasets. It managed to decrease the perplexity value by roughly 200 compared to the baseline models. SCHOLAR outperforms $\beta$-VAE under three settings of $\beta$ value. We speculate that this might be due to the incorporation of the class labels in the training of SCHOLAR. Nevertheless, VAD\textsc{et} produces congenial sentences in aspect groups, with latent codes tweaked to proxy centroids, showing that the disentangled representation does capture the desired factor. \begin{figure}[ht] \centering \includegraphics[width=0.48\textwidth]{./figs/fig6.pdf} \caption{Conditional perplexity on two corpora.} \label{fig:6} \end{figure} \paragraph{Ablations} We conduct ablation studies to investigate the effect of semi-supervised learning that uses the variational latent representation learning approach and aspect-stance disentanglement on the latent semantics. We study their effects on stance classification and aspect span detection. The results are reported in Table~\ref{tab:3}. \begin{table}[h!] \centering \centering \resizebox{0.45\textwidth}{!}{ \begin{tabular}{lcccc} \toprule Model & \multicolumn{2}{c}{\multirow{1}{*}{VAD}} & \multicolumn{2}{c}{\multirow{1}{*}{VC}} \\ \cmidrule(lr){2-3} \cmidrule(lr){4-5} \textbf{\emph{Stance}} & \multicolumn{1}{c}{Acc.} & \multicolumn{1}{c}{F1} & Acc. & \multicolumn{1}{c}{F1} \\ \midrule VAD\textsc{et} & \textbf{0.763}& \textbf{0.756} &0.727& 0.713\\ VAD\textsc{et}-D & 0.751& 0.746 &\textbf{0.736}& \textbf{0.716}\\ VAD\textsc{et}-U &0.741& 0.734 &0.712& 0.698\\ \midrule \textbf{\emph{Aspect Span}} & \multicolumn{1}{c}{Acc.} & \multicolumn{1}{c}{F1} & Acc. & \multicolumn{1}{c}{F1} \\ \midrule VAD\textsc{et} & \textbf{0.556}& \textbf{0.745} & \textbf{0.541} & \textbf{0.697} \\ VAD\textsc{et}-D & 0.540& 0.728 &0.537& 0.684 \\ VAD\textsc{et}-U &0.528& 0.712 &0.525& 0.653 \\ \bottomrule \end{tabular}} \caption{Results of stance classification and aspect span detection of VAD\textsc{et} without disentanglement (-D) or unsupervised pre-training (-U). } \label{tab:3} \end{table} We can observe that on VAD without disentangled learning or unsupervised pre-training results in the degradation of the stance classification performance. However, on VC, we see a slight increase in classification accuracy without disentangled learning. We attribute this to the vagueness of the stance which might cause the model to disentangle more than it should be. On the aspect span detection task, we observe consistent performance drop across all metrics and on both datasets. In particular, without the pre-training module, the performance drops more significantly. These results indicate that semi-supervised learning is highly effective with VAE, and the disentanglement of stance and aspect serves as a useful component, which leads to noticeable improvements. \section{Conclusions} In this work, we presented a semi-supervised model to detect user attitudes and distinguish aspects of interest about vaccines on social media. We employed a Variational Auto-Encoder to encode the main topical information into the language model by unsupervised training on a massive, unannotated dataset. The model is then further trained under a semi-supervised setting that leverages annotated stance labels and aspect spans to induce the disentanglement between stances and aspects in a latent semantic space. We empirically showed the benefits of such an approach for attitude detection and aspect clustering over two vaccine corpora. Ablation studies show that disentangled learning and unsupervised pre-training are important to effective vaccine attitude detection. Further investigations on the quality of the disentangled representations verify the effectiveness of the disentangled factors. While our current work mainly focuses on short text of social media data where a sentence is assumed to discuss a single aspect, it would be interesting to extend our model to deal with longer text such as online debates in which multiple arguments or aspects may appear in a single sentence. \section*{Acknowledgements} \lxCR{This work was funded by the the UK Engineering and Physical Sciences Research Council (grant no. EP/T017112/1, EP/V048597/1). LZ is supported by a Chancellor's International Scholarship at the University of Warwick. YH is supported by a Turing AI Fellowship funded by the UK Research and Innovation (grant no. EP/V020579/1). }
\section{Introduction} \label{sec.introduction} Methanol (CH$_{3}$OH) is a molecule prone to population inversion under specific excitation conditions in the interstellar medium (ISM) \citep[e.g.][]{Cragg1992}, causing maser emission. In particular, methanol masers are unique tools for studying physical properties of dense gas associated with Young Stellar Objects (YSOs). Given their brightness and compactness \citep{Menten1991b}, their positions can be determined with high precision astrometry (i.e., at milli-arcsecond accuracy with very long baseline interferometry) and over vast distances. Thousands of such methanol masers have been detected in the Milky Way \citep[][]{Cotton2016,Green2017,Yang2019}. However, in nearby galaxies we can only account for a handful of successful detections \citep[e.g.][]{McCarthy2020}. In particular, the brightest Galactic CH$_3$OH maser transition at 6.7\,GHz \citep[][]{Breen2015}, remains elusive in extragalactic objects outside the Local Group \citep{Ellingsen1994,Darling2003}, with the only exception of NGC\,3079 \citep{Impellizzeri2008}, and possibly Arp220 \citep{Salter2008}, where this line is detected in absorption. The early discovery that CH$_{3}$OH masers can be divided into two classes, a collisionally-pumped Class\,I and a radiatively-pumped Class\,II \citep{Batrla1987,Menten1991b}, allows us to trace either stellar-induced outflows (Class\,I) or ultra-compact {H\,\sc{ii}} regions (Class\,II). Class\,I methanol masers have been observed toward high and low-mass stars \citep{Kalenskii2006,Kalenskii2010,Rodriguez2017}, while Class\,II masers have been observed only toward high-mass YSOs \citep{Breen2013}. Unlike H$_{2}$O and OH masers, Class\,II methanol masers seem to be exclusively correlated with star-forming regions \citep{Walsh2001,Breen2013}. Because Class\,II masers are usually brighter than Class\,I masers in our Galaxy, the former have been studied in great detail, leading to surveys targeting exclusively their relation with the surrounding conditions \citep{Yang2017,Billington2020}. However, outside our Galaxy Class\,II masers were only detected in the Magellanic Clouds \citep{Sinclair1992,Green2008,Ellingsen2010} and the Andromeda galaxy \citep{Sjouwerman2010}, with luminosities not surpassing those in our Galaxy. On the other hand, extragalactic Class\,I masers can be more luminous than those of Class\,II, and have been successfully observed beyond the Local Group, particularly in nearby barred spiral galaxies like NGC\,253, IC\,342, or NGC\,4945 \citep[e.g.][]{Ellingsen2014,McCarthy2017,Gorski2018}. There are two types of methanol. For E-type methanol, one of the protons in the hydrogen atoms of the methyl (CH$_{3}$) group has an anti-parallel nuclear spin with respect to the others, analogous to the case of para-NH$_{3}$. In the A-type methanol, the nuclear spins of the three protons in the methyl group are parallel, as in the case of ortho-NH$_{3}$. As the two methanol types have different transition frequencies and may arise in different physical environments, we decided to analyse them separately. Hereafter we use the conventional notation for A$^{+}$ and A$^{-}$ introduced by \citet{Lees1968}, related to a combination between the A--CH$_{3}$OH overall-parity and Mulliken symbols\footnote{\url{https://mathworld.wolfram.com/CharacterTable.html}} A$_{1}$ and A$_{2}$. This is done to discriminate between splitted $+K$ and $-K$ levels (doublets), with $K$ being the projection of the angular momentum along the molecular symmetry axis. $+K$ and $-K$ levels are torsionally degenerate for the case of A-type methanol, contrary to the case of E-type methanol (see also \citealt{Cragg1993}). As shown by \citet{Lees1973}, among E-type methanol transitions (E--CH$_{3}$OH) Class\,I population inversion is favoured in the $K=-$1 relative to the $K=0$ or $K=-$2 ladders. This leads to the prominence of the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ series \citep[see e.g.][their Fig.\,3]{Leurini2016}. Indeed, the $4_{-1}\rightarrow3_{0}-E$ (36.2\,GHz) and $5_{-1}\rightarrow4_{0}-E$ (84.5\,GHz) lines have been recently discovered to be masing in one extragalactic object, NGC\,253 \citep{Ellingsen2014,McCarthy2018}. For A-type methanol, population inversion in the $K=0$ relative to the $K=1$ ladder is favoured, playing out in the $J_{0}\rightarrow(J-$1)$_{1}-A^{+}$ series, of which the 44.1\,GHz line, at $J=$7, has been also detected in NGC\,253 \citep{Ellingsen2017}. The emission of Galactic Class\,II methanol masers are more compact than those of their Galactic Class\,I cousins \citep{Moscadelli2003,Matsumoto2014}, and that could make Class\,II methanol masers more difficult to detect at extragalactic distances. In addition, Class\,I masers require lower densities and temperatures than Class\,II masers \citep{Menten2012}, making them more numerous. Specifically for the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ series with $J=$ 4 and 5, their intensities were predicted to be of the order of 50\,mJy in the case of NGC\,253 \citep{Sobolev1993}. Class\,I methanol masers may be associated with a variety of phenomena, such as supernova remnants \citep{Plambeck1990,Pihlstrom2014}, massive protostellar induced outflows \citep{Cyganowski2018}, and interactions of expanding H\,{\sc ii} regions with surrounding molecular gas \citep{Voronkov2010}, namely regions where shocks compress and heat the gas. In the central molecular zone (CMZ) of our Galaxy (i.e., the inner $\sim$200\,pc in radius; \citealt{Morris1996}), cosmic ray interactions with molecular clouds have been claimed to be an additional source of methanol production. While a high methanol abundance alone is certainly not sufficient to trigger maser emission, there seems to be indeed a clear enhancement of Class\,I masers in this region \citep{Yusef-Zadeh2013,Cotton2016,Ladeyschikov2019}. In particular, extended strong emission showing characteristics of maser action had been found by \citet{HaschickBaan1993} and \citet{Salii2002} in the G1.6$-$0.025 region at the periphery of the CMZ and by \citet{Szczepanski1989} and \citet{LiechtiWilson1996} in a region in which the supernova remnant Sgr A East interacts with a Giant Molecular Cloud (GMC). Noteworthy, CMZ conditions in the Milky Way should provide some guidance to the central regions of starburst galaxies \citep{Belloche2013}. Class\,I methanol masers at 36, 44, and 84\,GHz have already been reported in NGC\,253 by \citet{Ellingsen2014}, \citet{Ellingsen2017}, and \citet{McCarthy2018}, respectively. The former, at 36\,GHz, has been also observed in NGC\,4945, IC\,342, NGC\,6946, and Maffei\,2 \citep{McCarthy2017,Gorski2018,Humire2020}. A 84\,GHz mega-maser ($\geq$10$^{6}$ times more luminous than typical Galactic masers; \citealt{Lo2005}) has been reported in NGC\,1068 \citep{Wang2014}, but a confirmation would be needed to put this onto a firm basis. Although a tentative detection of methanol mega-maser emission was claimed in Arp\,220 \citep{Chen2015}, later studies ruled it out \citep{Humire2020,McCarthy2020}. Making use of the unprecedented spectral coverage available by the Atacama Large Millimeter/sub-millimeter Array (ALMA) Large Program ALCHEMI \citep{Martin2021}, we have been able to make a comprehensive study toward one of the best candidates to search for extragalactic maser emission, the Sculptor galaxy NGC\,253. NGC\,253 is a nearby \citep[D $\sim$3.5\,Mpc,][]{Rekola2005} highly inclined ($i\sim70^{\circ}$--79$^\mathrm{\circ}$, \citealt{Pence1980,Iodice2014}) SAB(s)c galaxy \citep{deVaucouleurs1991} with a systemic heliocentric velocity ($v_{\rm sys}$) of $\sim$258.8\,km\,s$^{-1}$ \citep{Meyer2004}. Its large-scale bar feeds the nuclear region producing stars at an approximate rate of $\sim$1.7\,M$_{\odot}$\,yr$^{-1}$ \citep{Bendo2015} within the central 20\arcsec$\times$10\arcsec\,, where 1\arcsec\,corresponds to $\sim$17\,pc. The position angle (PA) of the large-scale bar is 51$^{\circ}$ \citep{Pence1980}. The PA continues till the central $\sim$170 parsecs. Further into the core, the isovelocity contours of the gas change their orientation by about 90$^{\circ}$ due to the existence of a nuclear bar \citep{Cohen2020}. Like our Galaxy, NGC\,253 is characterized by a particularly strong and diverse molecular emission in its central 500\,pc \citep{Sakamoto2006}, which we therefore identify as its CMZ. Previous studies do not suggest that an Active Galactic Nucleus (AGN) is important for the properties of the molecular gas in the CMZ of NGC\,253 \citep{MullerSanchez2010}. This paper is organized as follows: our observations are described in Sect.\,\ref{Sec.Observations}. In Sect.\,\ref{sec.selected_regions} we show the selected regions to be studied in the CMZ of NGC\,253. In Sect.\,\ref{sec.methanol_maser_emission_ID} we introduce the two methods used to identify methanol masers. In Sect.\,\ref{sec.discussion} we discuss the results and provide a number of conditions to explain maser emission. We finally draw the conclusions of our findings in Sect.\,\ref{sec.summary}. \section{Observations} \label{Sec.Observations} We use ALMA observations of NGC\,253 taken in Cycles~5 and 6 as part of the large program ALCHEMI (ALMA Comprehensive High-resolution Extragalactic Molecular Inventory, 2017.1.00161.L, followed up by program 2018.1.00162.S, see \citealt{Martin2021}). The central region of the galaxy ($50\arcsec \times 20\arcsec$ = $850\times340$~pc, with a position angle of $65^{\circ}$) was covered in bands~3 to 7 (84.2 -- 373.2\,GHz), with both the 12\,m and 7\,m antenna arrays, achieving a final homogeneous angular resolution of 1\farcs6. The mentioned region was covered with a single pointing in band\,3, with a primary beam ranging between 57$\arcsec$ and 68$\arcsec$, and Nyquist-sampled mosaic patterns of 5 up to 19 pointings for the remaining bands, ensuring a homogeneous sensitivity across the selected region\footnote{ALMA sets up by default a hexagonal Nyquist sampled pattern to ensure homogeneous sensitivity across the mapped region. Furthermore, mosaic images are primary beam corrected, in our case this includes the studied $850\times340$~pc region. For more information about mosaicing, we refer the reader to Sect\,7.7 in the ALMA technical Handbook (\url{https://almascience.eso.org/documents-and-tools/cycle9/alma-technical-handbook})}. The phase center of the observations is $\alpha=00^h47^m33^s.26$, $\delta=-25^\circ17'17\farcs7$ (ICRS\footnote{International Celestial Reference System, equivalent to J2000 within a few milli--arcseconds \citep{Ma1998}}). The absolute flux calibration accuracy is of the order of 15\% for all ALMA bands, since most percentages are lower across individual bands. The flux density RMS noise ranges from 0.18 to 5.0\,mJy beam$^{-1}$, and the averaged sensitivity is 14.8\,mK. For more details about the data reduction procedures and image processing, see \citet{Martin2021}. \section{Selected positions} \label{sec.selected_regions} In Fig.\,\ref{fig.integrated_intensity}, we show the integrated intensity map of the 6$_{-1}\rightarrow$5$_{0}-E$ methanol emission (132.9\,GHz rest frequency) using a 3$\sigma$ clip threshold and applying the formalism suggested by \citet[][their Appendix C]{Mangum2015} to obtain the uncertainties. The selection of this methanol line is motivated by its high signal-to-noise (S/N) ratio, the absence of notable blending candidates, and maser emission in some regions (see below). In NGC\,253, the inner Lindblad resonance (ILR) was found to be co-spatial with its circumnuclear ring (CNR) by \citet{Iodice2014}. The total ILR extension measured by them is 0.3$\pm$0.1--0.4$\pm$0.1\,kpc (deprojected size). We draw concentric ellipses at 0.2 and 0.5\,kpc to denote the ILR limits in Fig.\,\ref{fig.integrated_intensity} (dash-dotted grey ellipses) as well as its center at 0.35\,kpc (solid black ellipse). Along the text, we use the ILR position as a proxy to the x$_{2}$ orbit in NGC\,253 (see Sect.\,\ref{sec.discussion}). \begin{figure}[h] \includegraphics[width=\linewidth, trim={0 0 0 0},clip]{moment_0_132.pdf} \caption{Integrated intensity map for the $6_{-1}\rightarrow5_{0}-E$ methanol line at 132.9\,GHz (within a velocity interval of $v_{\rm sys}\lesssim\pm$200\,km\,s$^{-1}$). Selected positions for spectral extraction (Sect.\,\ref{sec.selected_regions}) are encircled in beam-sized apertures and numbered from 1 to 10. The center and edges of the inner Lindblad resonance from \citet{Iodice2014} are denoted with a black ellipse and dash-dotted grey ellipses, respectively. Superbubbles identified by \citet{Sakamoto2006} are indicated as orange circles. The ALMA beam (1\farcs6) is shown in blue in the bottom left corner.} \label{fig.integrated_intensity} \end{figure} \begin{table}[!htp] \caption{Selected regions.} \label{tab.positions} \begin{center} \begin{tabular}{llll} \hline \hline Region & $\alpha_{\rm ICRS}$ & $\delta_{\rm ICRS}$ & $v_{\rm LSR}$ \\ & \multicolumn{1}{c}{[00$^{h}$:47$^{m}$:--$^{s}$]} & \multicolumn{1}{c}{[-25$^{\circ}$:17':--"]} & \multicolumn{1}{c}{[km\,s$^{-1}$]} \\ \hline \\ R1 & 32.02 & 28.3 & 304\\ R2 & 32.28 & 20.2 & 330\\ R3 & 32.81 & 21.6 & 286\\ R4 & 32.97 & 20.0 & 252 \\ R5 & 33.21 & 17.4 & 231\\ R6 & 33.33 & 15.8 & 180\\ R7 & 33.64 & 13.3 & 174\\ R8 & 34.02 & 11.4 & 205 \\ R9 & 34.17 & 12.3 & 201\\ R10 & 34.24 & 7.8 & 144\\ \hline \end{tabular} \tablefoot{The Local Standard of Rest (LSR) velocities were obtained by fitting a local thermodynamic equilibrium model (LTE) to the spectra and averaging between the A-- and E--CH$_{3}$OH symmetry species. Our spectral resolution of $\sim$8--9\,km\,s$^{-1}$ dominates the velocity uncertainty.} \end{center} \end{table} The presence of methanol masers depends on the physical conditions prevailing across the CMZ of NGC\,253. We decided to select ten distinct positions within the CMZ (see Figure\,\ref{fig.integrated_intensity} and Table\,\ref{tab.positions}). These positions were established based on intensity peaks of the CS \textit{J}=2--1 and H$^{13}$CN \textit{J}=1--0 transitions, applying a GMC identification approach based on \citet{Leroy2015}, i.e., using the CPROPS software \citep{Rosolowsky2006}. Our region coordinates are not exactly the same as those used by \citet{Leroy2015}, even though our numbering is close to theirs. We preferred to use those GMC locations instead of the peak intensities of our CH$_{3}$OH lines at a given frequency, because the peak location varies depending on the chosen transition \citep[see also,][]{Zinchenko2017,McCarthy2018}. We list the coordinates and velocities of all these positions in Table\,\ref{tab.positions}. The velocities were obtained from preliminary LTE radiative transfer models, similar to the ones described in Sect.\,\ref{sec.models}, and averaged over each methanol symmetric type. For each region, we extracted the full spectrum (84--373\,GHz, see Sect.\,\ref{sec.models}) from the data convolved to a common circular beam of 1\farcs6 diameter, equivalent to the maximum angular resolution of the observations (see Sect.\,\ref{Sec.Observations}). At higher resolution, however, GMCs further divide into molecular clumps with a size range of 0\farcs07--0\farcs25 (1.2--4.3\,pc; \citealt{Leroy2018}). Contrary to the spectrum of the other nine studied regions, we have found a very complex spectrum in region\,5 located next to the dynamical center of the galaxy \citep{MullerSanchez2010}. Radio recombination line observations revealed an S-shaped pattern with complex kinematics including a counter-rotating core in the inner 2$\arcsec$ suggestive of a secondary bar \citep{Anantharamaiah1996} and evidencing a black hole mass of $\sim$10$^{7}$\,M$\odot$ \citep{Cohen2020}. This highly-perturbed environment is likely causing the crowded spectrum observed in Region\,5. In this position, the broad line emission, with a full width at half maximum (FWHM) above 100\,km\,s$^{-1}$, prevents an accurate Gaussian line fitting for the rotation diagram analysis in Sect.~\ref{Sec.rot_diags}, but can be used for the radiative transfer modelling in Sect.\,\ref{sec.models}. In addition, toward region\,5 and mostly in the low frequency range ($\sim$84--163\,GHz, ALMA bands\,3 and 4) we observe absorption components. Methanol lines in absorption or self-absorption (in the case of the line at 358.6\,GHz) along the entire ALCHEMI spectral coverage are observed in at least one region for the following four transitions: the 3$_{1}\rightarrow 4_{0}-A^{+}$ line at 107.0\,GHz, the 4$_{-2}\rightarrow 4_{-0}-E$ line at 190.1\,GHz, the 5$_{-2}\rightarrow 5_{-0}-E$ line at 190.3\,GHz (in absorption in region\,10 only), and the 4$_{1}\rightarrow 3_{0}-E$ line at 358.6\,GHz. They are shown in Figure\,\ref{fig.abs_lines}. \begin{figure}[!htp] \includegraphics[width=1.1\linewidth, trim={0cm 1cm 0cm 0cm},clip]{abs_lines.pdf} \caption{Methanol lines observed in absorption or self-absorption in one or more of the selected regions (Table\,\ref{tab.positions}). Red and blue lines are synthetic spectra for methanol A- and E- type, respectively (see\,Sect.\,\ref{sec.models}). Line frequencies are labeled in the top of the Figure, while the velocity range (in km\,s$^{-1}$, after applying the radio convention\protect\footnotemark \,and subtracting the $v_{\rm LSR}$ velocities from Table\,\ref{tab.positions}) is indicated in the bottom-left corner. Regions 1 to 10 are ordered from top to bottom as indicated in the leftmost panel (y-axis: R from "Region" plus the corresponding number). For the location of the regions, see Fig.\,\ref{fig.integrated_intensity} and Table\,\ref{tab.positions}.} \label{fig.abs_lines} \end{figure} \footnotetext{\url{https://web-archives.iram.fr/IRAMFR/ARN/may95/node4.html}} \section{Methanol maser emission identification} \label{sec.methanol_maser_emission_ID} In some cases, it can be difficult to assess whether a given line is excited under thermal or maser conditions. Methanol maser lines in Galactic star-forming regions are usually very bright (in the sense of brightness temperature) and narrow. However, in the case of extragalactic objects, beam dilution makes them apparently weaker and less distinguishable from thermal emission due to line blending from surrounding gas. In the spectral dimension this also complicates a proper line identification since the contribution of other species might affect the true brightness of the putative maser lines (see the last column of Table\,\ref{tab.methanol_lines}). In this section we explore two methods to identify methanol emission lines outside local thermodynamic equilibrium (LTE) as an indicator of potential maser emission, namely rotation diagram analysis and comparisons with synthetic spectra from radiative transfer modelling. For both methods, we constrained the upper energy above the ground level ($E_{\rm up}$/k) of the lines to $\leq$150\,K, since the entirety of lines above that limit are blended with other methanol transitions below that limit, and are likely not contributing significantly to the overall emission (see the analysis in Sect.\,\ref{sec.models}). In this study, we consider as LTE conditions those reached when a single excitation temperature, $T_{\rm ex}$, characterizing the energy level population according to the Boltzmann distribution, is sufficient to explain the line emission of methanol along all its observed transitions. Namely, an equivalency between kinetic ($T_{\rm kin}$) and excitation temperatures is not strictly required. \subsection{Rotation diagram} \label{Sec.rot_diags} As a first approach, we use the rotation diagram method to compare the relative intensities of methanol lines in NGC\,253. The details of this method can be found in \citet{Goldsmith1999} and are also summarized in our Appendix\,\ref{sect.apen.rot_diag}. Since this method assumes that the gas is under LTE conditions and that the lines are optically thin, any transition deviating from a straight-line fit in the rotation diagram indicates that, for values below the fitted line, opacities are not low and that, for values above the fitted line, maser emission may be a suitable explanation. If a given line is affected by blending, we could overestimate its integrated intensity, which would lead to a wrongly classified maser line. Therefore, after identifying all the methanol transitions in our observations and before performing the rotation diagrams, we have initially searched both in the CDMS \citep{Mueller2005} and JPL \citep{Pickett1998} databases for potentially contaminating lines from other molecular species (last column in Table\,\ref{tab.methanol_lines}). Special care was taken on previously reported molecules in NGC\,253 \citep[e.g.][]{Martin2006,Meier2015,Ando2017}, as well as preliminary line identification performed on the 1\farcs6 resolution ALCHEMI data (Mart\'in et al. in prep.). Blended non-methanol line candidates are required to fall inside the FWHM of the given methanol line, which varies for each symmetric type and region. To produce the rotation diagrams we have used the CASSIS\footnote{\url{http://cassis.irap.omp.eu}} software. In particular, we have used the spectroscopic VASTEL database, which comes from the JPL catalog\footnote{\url{http://cassis.irap.omp.eu/?page=catalogs-vastel}}, since it distinguishes between A and E methanol forms. Covering transitions with $E_{\rm up}$/k$<$150\,K, we did not consider methanol lines separated from each other by less than their FWHM. Because of that, we did not include in our analysis the $J_{K}\rightarrow (J-1)_{K}$ line series at $\sim$96.7\,GHz ($J=2$), $\sim$145.1\,GHz ($J=$3), $\sim$193.5\,GHz ($J=$4), $\sim$241.8\,GHz ($J=$5), and $\sim$290.1\,GHz ($J=$6). A summary of the considered transitions for each region is shown in Table\,\ref{tab.methanol_lines}, where line parameters were taken from the CDMS database (the same holds for the other tables throughout this work). For each of the selected lines, we have obtained the integrated line intensity $\int T_{\rm{mb}}$d$v$ by fitting a single Gaussian profile. The resulting rotation diagrams are presented in Figure\,\ref{fig.rotationdiagrams}, for A-- and E--CH$_{3}$OH symmetry species separately and for each studied region (Table\,\ref{tab.positions}), where we conservatively assumed a flux calibration uncertainty of 15\%, as recommended by \citet{Martin2021}. This uncertainty plus Gaussian fitting uncertainties were added in quadrature for each line. The rotation diagram method assumes the Rayleigh–Jeans (RJ) approximation (see Appendix\,\ref{sect.apen.rot_diag}). In our case, given the low $T_{\rm ex}$ measured by the rotation diagrams in certain regions (see Table\,\ref{tab.apen.RD_params}), the RJ approximation is not a good assumption for high-frequency transitions, leading to an overestimation of $\sim$40\% for the upper level population of some transitions in the worst case scenario. As explained in Appendix\,\ref{sect.apen.rot_diag}, applying a correction factor to all our transitions, as an attempt to go beyond the RJ approximation, we obtain slight changes in $T_{\rm ex}$ but total column densities decrease by up to $\sim$40\% in extreme cases. The value that would be derived from the Planck function for the corresponding transition assuming the same $T_{\rm ex}$ originally derived with the RJ approximation for each region and methanol symmetric type, is shown inside the error bars in Fig.\,\ref{fig.rotationdiagrams}. The application of the Planck formula increases the lower-limit uncertainty as a function of the $T_{\rm ex}$ (see Eq.\,\ref{eq.CF}) found for each region through RJ and the individual frequency of each transition and therefore mostly affects the regions where $T_{\rm ex}$ is lower than 12\,K, i.e., regions\,1, 2, and 8 to 10 in E--CH$_{3}$OH. The parameters derived after applying this correction are also included in the uncertainties presented in Table\,\ref{tab.apen.RD_params}. On Figure\,\ref{fig.rotationdiagrams} we also indicate the critical densities of the different transitions shown in the rotation diagrams. To this end, we have used the most recently available collisional rates (C$_{\rm{ij}}$), interpolating their values, given in steps of 10\,K by \citet{Rabli2010}, by the corresponding $T_{\rm ex}$ obtained through the rotation diagrams in each region and for each methanol symmetric type. The critical densities thus obtained, in units of cm$^{-3}$ are then indicated by colors in the rotation diagrams (Fig.\,\ref{fig.rotationdiagrams}; transitions with unavailable C$_{\rm{ij}}$ are in black). We started including all the considered transitions (Table\,\ref{tab.methanol_lines}) below a certain $E_{\rm up}$/k (see below) to perform our rotation diagrams and obtain the best linear fit. However, we soon realized that some transitions did not fall on the linear fit line derived from the ensemble of CH$_{3}$OH integrated intensities. We excluded these lines that do not follow LTE conditions but are not likely to correspond to masers, see Appendix\,\ref{sec.apen.rotdiag_outliers}, to perform, in a second iteration, a linear fit to the remaining data in order to estimate the column density and $T_{\rm ex}$. Our fit results are shown at the bottom of each rotation diagram in Fig.\,\ref{fig.rotationdiagrams} with outliers indicated in the legends when they correspond to maser candidates (see below). Column densities and $T_{\rm ex}$ with their uncertainties are listed in Table\,\ref{tab.apen.RD_params}. In general, the distribution of the data points can be well described by a single $T_{\rm ex}$. Without considering the outliers, the standard deviations (1$\sigma$) of the residuals of the data points from the fitted lines are of a difference (ln($N_{\rm {up,\,data\,points}}$) - ln($N_{\rm{up,\,best fit}})$) between 0.2 (E--CH$_3$OH in region\,10) and 0.5 (A--CH$_3$OH in region\,4). These values translate into a factor ($N_{\rm{up,\,data\,points}}/N_{\rm{up,\,best fit}}$) between $\exp(0.2)=$1.2 and $\exp(0.5)=$1.7. We conservatively rounded up the average standard deviation ($\sigma=$0.35 to 0.4) and obtained a factor of 3.3 scatter, in the exponential scale of our rotation diagrams (exp(3$\sigma$)). We then classify as outliers all methanol transitions surpassing by more than a factor of 3.3 the expected value from LTE conditions. These outliers are listed in Table\,\ref{tab.RD_outliers}, where their transitional quantum numbers, frequencies, symmetry types, maser classes, $E_{\rm up}$/k, A$_{\rm{ij}}$, and optical depths are indicated in columns 1 to 7, respectively. In this table we also provide information about possible line blending with other methanol transitions falling within the FWHM of the main transition; they possess higher $E_{\rm up}$/k and lower A$_{\rm{ij}}$, implying a lower contribution to the observed spectrum due to the need for more extreme conditions to be emitted. In Table\,\ref{tab.RD_outliers}, the information given for these lines is the transition, frequency, symmetric type, $E_{\rm up}$/k, and A$_{\rm{ij}}$ along columns 8 to 12, respectively. Deviations from LTE are expected in the ISM, in particular for complex level diagrams and if radiative and collisional excitation and de-excitation compete. But in general, given the success in the fitting, it can be inferred that potential blending lines in Table\,\ref{tab.methanol_lines} are, in most cases, not significantly contaminating. We wish to emphasize that a sophisticated model, including hundreds or thousands of transitions from many molecules, would be needed to determine methanol line blending with transitions of other species in a thorough way, providing a percentage of contamination to methanol made from other species. Since this is clearly beyond the scope of this paper (but we will sometimes quote initial results from region\,5, obtained from Martin et al., in preparation), we refer in the following to the case of blending of methanol with other methanol lines, unless contamination with other species is explicitly mentioned. Based on the line width, CASSIS is able to discriminate between unblended methanol lines and those which are contaminated by adjacent lines of CH$_{3}$OH. In Fig.\,\ref{fig.rotationdiagrams} we represent unblended lines with circles and blended lines with stars. Since line widths change per region, the same transition may be denoted by circles or stars depending on the region. Besides of that, we have found that some methanol lines presented in Fig.\,\ref{fig.rotationdiagrams} are blended with other highly energetic methanol lines ($E_{\rm up}$/k$\geq$1000\,K, see Table\,\ref{tab.RD_outliers}) and therefore significant blending is highly unlikely. However, we decided to show them also as blended lines (stars) in order to be impartial along all the regions and transitions. In addition, we note that lines with $E_{\rm up}$/k$\leq$150\,K, being blended with CH$_{3}$OH transitions with $E_{\rm up}$/k$>$150\,K, are plotted with the lower $E_{\rm up}$/k value in Fig.\,\ref{fig.rotationdiagrams}. Finally, the LTE slope is adjusted exclusively considering unblended and non-masing methanol lines (for a definition of the latter, see below). \begin{figure*}[!htp] \includegraphics[width=0.93\linewidth, trim={3cm 12cm 3cm 8.1cm},clip]{general_RD_ncrit_v5.pdf} \caption{Rotation diagrams based on our selected methanol transitions (Table\,\ref{tab.methanol_lines}) and separated by methanol symmetric type (E--CH$_{3}$OH and A--CH$_{3}$OH). Straight black lines represent our best fits to the data considering only methanol lines not blended with other methanol lines (see Sect.\,\ref{Sec.rot_diags}) and following LTE conditions. Dotted grey lines are the slopes of the complementary methanol symmetric type in the same region. Maser candidates (see Sect.\,\ref{Sec.rot_diags}) are labelled with symbols. Points are color-coded depending on their critical densities (in units of cm$^{-3}$), as indicated by the color bar to their right (transitions with unavailable critical densities are in black). In the bottom left corner of each panel, the column density ($N_{\rm E-CH_{3}OH}$ and $N_{\rm A-CH_{3}OH}$, in cm$^{-2}$) and the excitation temperature ($T_{\rm ex}$, in Kelvin) derived from the fit are indicated. Non-blended lines in LTE are marked by circles, while methanol lines blended with other methanol lines (at $E_{\rm up}$/k$>$150\,K) are assigned by stars. Shaded areas represent 1$\sigma$ uncertainties (see Sect.\,\ref{Sec.rot_diags}).} \label{fig.rotationdiagrams} \end{figure*} \begin{table*}[!t] \caption{Outliers in the rotation diagrams.} \label{tab.RD_outliers} \scriptsize \renewcommand{\tabcolsep}{0.1cm} \begin{center} \begin{tabular}{llllllrllllllll} \hline \hline \multicolumn{2}{l}{Maser candidate} & & & & & $\tau$\tablefootmark{a} & blended\tablefootmark{b} & & & & & maser\tablefootmark{c} & location\tablefootmark{d} \\ Transition & $\nu$ [GHz] & A/E & Class & $E_{\rm up}$/k[K] & A$_{ij}$[s$^{-1}$] & [$\times$10$^{-4}$] & Transition & $\nu$ [GHz] & A/E & $E_{\rm up}$/k[K] & A$_{ij}$[s$^{-1}$] & [K] & \\ \hline \\ 5$_{-1}\rightarrow$4$_{0}$ & 84.521172 & E & I & 32.49 & 1.97$\times$10$^{-6}$ &$-$236.6 & 12$_{10}\rightarrow$12$_{11}$ & 84.531123 & E & 1085.97 & 7.72$\times$10$^{-7}$ & yes & 1,2,7--10\\ 2$_{1}\rightarrow$1$_{1}$ & 95.914310 & A$^{+}$ & -- & 21.44 & 2.49$\times$10$^{-6}$ &12.5 &not-blended & -- & -- & -- & -- & no &\\ 2$_{1}\rightarrow$1$_{1}$ & 97.582798 & A$^{-}$ & -- & 21.56 & 2.63$\times$10$^{-6}$ &3.8 &not-blended & -- & -- & -- & -- & no &\\ 6$_{-1}\rightarrow$5$_{0}$ & 132.890759 & E & I & 46.41 & 7.74$\times$10$^{-6}$ &$-$67.7 &not-blended & -- & -- & -- & -- & yes & 1,2,7--10\\ 3$_{1}\rightarrow$2$_{1}$ & 143.865795 & A$^{+}$ & -- & 28.35 & 1.07$\times$10$^{-5}$ &7.8 &not-blended & -- & -- & -- & -- & no &\\ 3$_{1}\rightarrow$2$_{1}$ & 146.368328 & A$^{-}$ & -- & 28.59 & 1.13$\times$10$^{-5}$ &6.5 &not-blended & -- & -- & -- & -- & no &\\ 9$_{0}\rightarrow$8$_{1}$ & 146.618697 & A$^{+}$ & I & 104.41 & 8.03$\times$10$^{-6}$ &$-$0.1 &14$_{1}\rightarrow$13$_{2}$ & 146.617429 & A$^{+}$ & 256.02 & 6.6$\times$10$^{-6}$ & yes & 1,7--9\\ 2$_{1}\rightarrow$3$_{0}$ & 156.602395 & A$^{+}$ & -- & 21.44 & 1.78$\times$10$^{-5}$ &162.3 &not-blended & -- & -- & -- & -- & no &\\ 10$_{0}\rightarrow$9$_{1}$ & 198.403067 & A$^{+}$ & I & 127.60 & 4.10$\times$10$^{-5}$ &$-$0.01 &not-blended & -- & -- & -- & -- & yes & 3,6,7\\ 8$_{-1}\rightarrow$7$_{0}$ & 229.758756 & E & I & 81.20 & 4.19$\times$10$^{-5}$ &$-$2.1 &not-blended & -- & -- & -- & -- & yes & 2,7--9\\ 2$_{-1}\rightarrow$1$_{-0}$ & 261.805675 & E & -- & 28.01 & 5.57$\times$10$^{-5}$ &402.3 &20$_{5}\rightarrow$21$_{3}$ & 261.800288 & E & 611.06 & 9.85$\times$10$^{-9}$ & no &\\ 6$_{2}\rightarrow$5$_{1}$ & 315.266861 & E & -- & 63.10 & 1.18$\times$10$^{-4}$ &6.7 &37$_{-6}\rightarrow$36$_{-7}$ & 315.237555 & E & 1808.32 & 5.73$\times$10$^{-5}$ & no &\\ 8$_{1}\rightarrow$8$_{0}$ & 318.318919 & A$^{-+}$ & II\tablefootmark{e} & 98.82 & 1.79$\times$10$^{-4}$ &1.5 &not-blended & -- & -- & -- & -- & no &\\ 7$_{-0}\rightarrow$6$_{-0}$ & 338.124488 & E & -- & 78.08 & 1.70$\times$10$^{-4}$ &10.9 &38$_{12}\rightarrow$37$_{10}$ & 338.117653 & E & 2425.29 & 7.38$\times$10$^{-8}$ & no &\\ 4$_{-0}\rightarrow$3$_{1}$ & 350.687662 & E & -- & 36.33 & 8.67$\times$10$^{-5}$ &1205.0 &18$_{-3}\rightarrow$18$_{-2}$ & 350.723878 & E & 812.46 & 4.17$\times$10$^{-5}$ & no &\\ 4$_{1}\rightarrow$3$_{0}$ & 358.605799 & E & -- & 44.26 & 1.32$\times$10$^{-4}$ &224.1 &not-blended & -- & -- & -- & -- & no &\\ 7$_{2}\rightarrow$6$_{1}$ & 363.739868 & E & -- & 79.36 & 1.70$\times$10$^{-4}$ &1.7 & 23$_{6}\rightarrow$22$_{9}$ & 363.680652 & E & 1327.80 & 1.78$\times$10$^{-7}$ & no & \\ \hline \end{tabular} \tablefoot{\tablefoottext{a}{Optical depth according to our non-LTE model of region\,8 (see Appendix\,\ref{sec.apen.detailed_modelling}}). \tablefoottext{b}{Methanol lines next to the frequency given in column (2). Their frequency is given in column (9)}. \tablefoottext{c}{Maser candidates based on the discussion in Sect.\,\ref{sec.maser_line_candidates_RD}}. \tablefoottext{d}{Regions where the transition is masing}.\tablefoottext{e}{According to the classification of the $J_{1}-J_{0} A^{-+}$ line series in \citet{Zinchenko2017}. The dash (--) symbol indicates no information/detection. For more information about the columns see Sect.\,\ref{Sec.rot_diags}.}} \end{center} \end{table*} \subsubsection{Rotation diagram results} \label{sec.maser_line_candidates_RD} To distinguish maser candidates among outliers, that is, lines located beyond a 3$\sigma$ scatter; the respective line must belong to known methanol maser line series already discovered in NGC\,253 at lower frequencies. This is because maser action is more prominent at lower frequencies than the ones covered in this work: as A$_{\rm ij}$ is proportional to the cube of the frequency, lower A$_{\rm ij}$ leads to a longer time lapse to accumulate inverted populations. In addition, we also require that the candidate line shows maser behaviour in more than one region. In the following we measure the departure from LTE of the maser lines as the ratio between their nominal upper level column densities in the rotation diagrams ($N_{\rm up, maser}$) over the expected upper level column density in LTE ($N_{\rm up, LTE}$). In the computation of $N_{\rm up}$ one generally assumes a proportional relation with the integrated intensity (see Eq.\,\ref{eq.N_up}). For maser lines, however, intensities and abundances are not related, as their negative opacity amplifies radiation from the background. Therefore this $N_{\rm up, maser}$/$N_{\rm up, LTE}$ factor must be taken as an intensity difference instead of abundance difference. \subsubsection{E--type methanol masers} \label{subsec.Emasers} Among the E--CH$_{3}$OH maser line candidates belonging to the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ series (at 84.5, 132.9, and 229.8\,GHz), none of them were detected out of LTE in regions\,3 to 6 (see Table\,\ref{tab.RD_outliers}), which are therefore excluded from the following analysis. We present the spectra and velocity integrated intensity maps of the two transitions with the highest S/N ratios ($5_{-1}\rightarrow 4_{0}-E$ at 84.5\,GHz and $6_{-1}\rightarrow 5_{0}-E$ at 132.9\,GHz) in Figures\,\ref{fig.m0_and_spectra_84} and \ref{fig.m0_and_spectra_132}. \textbf{The} $\mathbf{5_{-1}\rightarrow 4_{0}-E}$ line at 84.5\,GHz departs from LTE by factors ($N_{\rm up, maser}$/$N_{\rm up, LTE}$) ranging from 4.2$\pm$1.3 to 13.2$\pm$1.2 in regions\,10 and 1, respectively (see Fig.\,\ref{fig.rotationdiagrams}). This is the first detection of the 84.5\,GHz maser line in more than one position, after its first discovery by \citet{McCarthy2018}. The higher $J$ masers in the $J_{-1}\rightarrow(J-1)_{0}-E$ series are usually observed to originate in the same regions, suggesting similar distributions and pumping mechanism. \textbf{The} $\mathbf{6_{-1}\rightarrow 5_{0}-E}$ line at 132.9\,GHz departs from its expected integrated intensity in LTE by factors ranging from 4.6$\pm$1.2 to 10.6$\pm$1.2, in regions\,2 and 1, respectively. Contrary to the previous transition at 84.5\,GHz, it is not blended with other methanol lines. \textbf{The} $\mathbf{8_{-1}\rightarrow 7_{0}-E}$ line at 229.8\,GHz is observed to mase in the same regions as the ones at 84.5 and 132.9\,GHz except in regions\,2 and 10, which display the lowest LTE fitted $T_{ex}$ in the E-type methanol species and also the lowest S/N ratios. In these couple of regions, the emission is too weak to be classified as a maser. The 8$_{-1}\rightarrow 7_{0}-E$ line is the highest frequency transition detected as a maser by the rotation diagram method; its intensity departs from LTE by 9.8$\pm$1.2, in region\,7 and up to 32.0$\pm$1.2 in region\,1. \begin{figure*}[!htp] \includegraphics[width=\linewidth, trim={0 0 0 3cm},clip]{moment_0_and_spec_84.pdf} \caption[]{Central panel: Velocity integrated intensity of the $5_{-1}\rightarrow4_{0}-E$ methanol line at 84.5\,GHz obtained by integrating the channels inside the colored areas shown in the side panels. Regions where we detect Class\,I maser emission in the $J_{-1}\rightarrow (J-1)_{0}-E$ series (see Sect.\,\ref{subsec.Emasers}) are labeled in red and with slightly larger numbers. Side panels: methanol spectra of the different regions as labeled in the top right corner of each panel (a $v_{\rm sys}$ of 258.8\,km\,s$^{-1}$ was subtracted). Vertical lines indicate the peak velocity of the $^{13}$CO $J=$1--0 line (110.2\,GHz) extracted in each region, as a reference for the systemic velocity at that position. Coordinate system, beam size and other parameters are the same as in Fig.\,\ref{fig.integrated_intensity}.} \label{fig.m0_and_spectra_84} \end{figure*} \begin{figure*} \includegraphics[width=\linewidth, trim={0 0 0 3cm},clip]{moment_0_and_spec_132.pdf} \caption{Same as for Figure\,\ref{fig.m0_and_spectra_84} but for the $6_{-1}\rightarrow5_{0}-E$ methanol line at 132.9\,GHz.} \label{fig.m0_and_spectra_132} \end{figure*} \subsubsection{A--type methanol masers} \label{subsec.Amasers} With respect to A--CH$_{3}$OH, maser line candidates are part of the $J_{0}\rightarrow (J-1)_{1}-A^{+}$ series (9$_{0}\rightarrow 8_{1}-A^{+}$ and 10$_{0}\rightarrow 9_{1}-A^{+}$ transitions). We note that a lower $J$ (and lower frequency) transition in this series is the 7$_{0}\rightarrow 6_{1}-A^{+}$ line at 44.1\,GHz, the strongest Galactic Class\,I maser. \textbf{The} $\mathbf{9_{0}\rightarrow 8_{1}-A^{+}}$ line at 146.618\,GHz departs from LTE by factors in the range of 8.4$\pm$1.2 (in region\,8) to 29.8$\pm$1.2 (in region\,1), excluding region\,4 because of line blending (see Appendix\,\ref{sec.apen.rotdiag_outliers}). This maser transition has been suggested to be part of the Class\,I family of methanol masers \citep[e.g.][and references therein]{Yang2020}. \textbf{The} $\mathbf{10_{0}\rightarrow 9_{1}-A^{+}}$ line at 198.4\,GHz departs from LTE in regions\,3, 6, and 7, being the only masing line candidate for regions\,3 and 6. In those regions, this line departs from LTE by factors of 4.3$\pm$1.3, 3.6$\pm$1.2, and 8.5$\pm$1.2, respectively. We have found that all our maser candidates, except the $10_{0}\rightarrow 9_{1}-A^{+}$ line at 198.4\,GHz, are masers at the outskirts of the CMZ of NGC\,253 (see Table\,\ref{tab.RD_outliers}). The physical conditions in the regions giving rise to those masers are characterized (see Fig.\,\ref{fig.delta}) by total column densities for A--CH$_{3}$OH lower than 6$\times$10$^{14}$\,cm$^{-2}$, an excitation temperature lower than 15\,K in E--CH$_{3}$OH, and differences between A-- and E--CH$_{3}$OH excitation temperatures larger than 5.0\,K. Conversely, we do not see a correlation between the presence of masers and total column densities in E-type methanol, the temperature described by A--CH$_{3}$OH, or differences between column densities of the two methanol types. With the exception of the line at 198.4\,GHz, it is worth noting that all the regions where we detect Class\,I maser emission lie inside the Lindblad resonances (see e.g. Fig.\,\ref{fig.m0_and_spectra_84}), with the only exception of region\,7. We will further explore this point in Sect.\,\ref{sec.maser_emission_distribution}. Based on LTE modelling, we have also found other transitions that are possibly experiencing maser activity. They will be described below. \subsection{Radiative transfer modelling} \label{sec.models} In comparison with the rotation diagram method, synthetic spectra offer a number of improvements, like the possibility to reproduce line profiles both in LTE and out of LTE, which may also subtly indicate the number of gas components present in the observed source (see e.g. Fig.\,\ref{fig.LTE_R4}). Also, as the lines are observed on a linear scale, the effect of slight changes in the assumed gas conditions are noticed in more detail compared with the logarithmic scale used in the rotation diagram method. Apart from those advantages, radiative transfer modelling allows us to fit not only single methanol lines, but also blended ones, as their spectra are summed up when trying to obtain the desired intensities. Alternatively, this provides an estimate for the degree of contamination caused by other species. This allows us to include many more lines, increasing the sample size. In fact, as we will see below, there are 57 lines used for the fitting in our radiative transfer models, in contrast to the 39 finally used in the rotation diagrams (see Sect.\,\ref{sec.maser_line_candidates_RD}). \begin{figure}[!t] \includegraphics[width=\linewidth, trim={1cm 1cm 2.2cm 3cm},clip]{sep_regions_wrt_LTE.pdf} \caption{Physical conditions for the methanol maser candidates (see Table\,\ref{tab.RD_outliers}) derived from our rotation diagrams. The x--axis indicates the number of the region. The y--axis represents, from top to bottom, (1) the ratio between the nominal upper level column densities of the lines $N_{\rm up, MASER}$ and the expected values from our best fit to LTE conditions $N_{\rm up}, LTE$, (2) the total column density, (3) the difference between total E-- and A--type column densities, (4) the LTE excitation temperatures and (5) the difference between the A-- and E--type excitation temperatures. Shaded areas highlight regions were maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series (at 84, 132, and 229\,GHz), and the $J_{0}\rightarrow (J-1)_{1}-A^{+}$ line series (at 146 and 198.4\,GHz), are observed, according to the first panel.} \label{fig.delta} \end{figure} The possibility to perform non-LTE modelling helps us to discard maser line candidates in case negative optical depths are not required to reproduce their emission. Finally, the nature of blended methanol lines with other methanol lines at known maser frequencies, such as the transitions at 95.169 and 278.305\,GHz, could not be unveiled through the rotation diagram method. As mentioned in Sect.\,\ref{Sec.rot_diags}, we use the term blending to refer to contamination of methanol lines with other methanol transitions, unless contamination by other species is explicitly mentioned. We have computed synthetic spectra for each of the 10 selected regions in NGC\,253, covering the entire ALCHEMI frequency range ($\sim$84--373\,GHz, see Sect.\,\ref{Sec.Observations}), by using the CASSIS software, capable of producing LTE and non-LTE spectral modelling. For the non-LTE case, CASSIS is used as a wrapper of RADEX \citep{vanderTak2007}, a one-dimensional non-LTE radiative transfer code based on the escape probability formulation. In CASSIS it is possible to create a physical model defined by 6 parameters: column density of the species ($N(Sp)$), excitation ($T_{ex}$, LTE case) or kinetic ($T_{kin}$, non-LTE case) temperature, full width at half maximum (FWHM) of the lines, velocity of the source in the Local Standard of Rest ($V_{\rm LSR}$) system, size of the source in arcseconds, and the H$_2$ volumetric density ($n_{\rm H2}$) in the case of non-LTE modelling. For simplicity, in this section we have considered that only a single physical component for each methanol type is responsible for the observed emission; for a more detailed analysis, see Appendix\,\ref{sec.apen.detailed_modelling}. CASSIS makes use of the Monte Carlo Markov Chain (MCMC) method \citep{Hastings1970} to explore a user-predefined range of values for each of the parameters previously mentioned. By means of the $\chi^{2}$ minimization method, CASSIS is able to find the best ensemble of solutions. Computing the synthetic spectra we assumed a beam filling factor of one, by selecting a source size of 1\farcs6 ($\sim$27\,pc), and a slab geometry \citep[appropriate for shocks, e.g.][]{Leurini2016}. Model solutions could be strongly influenced by the initial conditions. Therefore we start by selecting unblended methanol lines to be fitted and then add blended lines whose total line profile is successfully reproduced with the starting models. This was achieved by exploring the success of CASSIS in reproducing the lines throughout our selected regions. After our initial attempts to fit methanol lines along the entire ALCHEMI spectral coverage, assuming either LTE or non-LTE conditions, it became clear from our 10 regions that it is impossible to properly fit all the lines with a single physical set of parameters, even after separating between A-- and E--CH$_{3}$OH flavours. This is especially important at frequencies below $\sim$156\,GHz, and it is possibly due to a couple of factors: the presence of a series of lines out of LTE, and the higher number of maser candidates. Using our LTE model, we found that the $J_{K}\rightarrow (J-1)_{K}$ transitions (for both methanol symmetric types), which were avoided in Sect\,\ref{Sec.rot_diags} due to line blending, are not following LTE conditions. Within the ALCHEMI frequency coverage, these line series have the following frequencies: $\sim$96.7\,GHz ($J=$2), $\sim$145.1\,GHz ($J=$3), $\sim$193.5\,GHz ($J=$4), $\sim$241.8\,GHz ($J=$5), and $\sim$290.1\,GHz ($J=$6). Performing a non-LTE model in region\,8, they are satisfactorily reproduced, as can be seen in Fig.\,\ref{fig.apen.RADEX_R8} of Appendix\,\ref{sec.apen.detailed_modelling} without invoking the presence of masers. At frequencies below $\sim$156\,GHz we also cover four maser candidates, three of them reported in Subsect.\,\ref{subsec.Emasers} plus an additional one that we will see below (Subsect.\,\ref{sec.LTE_outliers}). Therefore, at lower frequencies our models fail to reproduce an important quantity of available, not blended, methanol lines. We discard possible software issues by doing a sanity check with another radiative-transfer code capable of producing LTE models, MADCUBA \citep{Martin2019b}. It shows similar results including convergence primarily toward lines above 156\,GHz. Having said the above, we do not include the mentioned $J_{K}\rightarrow (J-1)_{K}$ transition series nor the maser candidates in our LTE modelling. Even with this restriction, we observe that these series are well reproduced ($>$50\%) in region\,4 by merely fitting the other transitions, and this can be improved with a two-component LTE model (see Appendix\,\ref{sec.apen.detailed_modelling}). When inspecting and comparing the results for all regions between the LTE and non-LTE models, considering a single component for each methanol symmetric type, we observe that they are in agreement within an uncertainty of about 15\% (although this agreement is not observed when we consider a two-component non-LTE model, see Appendix\,\ref{sec.apen.detailed_modelling}). This is not surprising since high H$_{2}$ densities of $>$10$^{7}$\,cm$^{-3}$ are needed in the non-LTE models to reproduce most line profiles. At such densities collisions play a major role, tending to constrain the spread in excitation temperatures between different lines. Therefore, we conclude that the simpler LTE conditions are sufficient to represent the observed spectra in NGC\,253. From now on, we will therefore mainly refer to our LTE modelling, except in a few exceptional cases where this is explicitly mentioned. As described in Sect.\,\ref{sec.methanol_maser_emission_ID}, we set an upper $E_{\rm up}$/k threshold of 150\,K for the synthetic spectra. This was determined through comparing observations to model fits with and without the higher energy levels ($E_{\rm up}$/k$>$\,150\,K). A total of 600 LTE models for each individual spectrum, one per selected region (see Table\,\ref{sec.selected_regions}), were computed, reaching a convergence after 300--400 iterations. We find that we only require models that include $E_{\rm up}$/k$<$\,150\,K to fit the observed spectra. Thermal line emission with $E_{\rm up}$/k$>$\,150\,K may be there, but is too faint to affect model fits or to be separated from line blends. In the Galaxy, methanol masers with levels around 150\,K above the ground state are scarce. Within the ALCHEMI frequency coverage we can mention the case of the $11_{-1}\rightarrow 10_{-2}-E$ line at 104.3\,GHz \citep{Leurini2018}. However, this Class\,I maser is rarely seen \citep{Voronkov2012}. We do not obtain any strong emission at this frequency in NGC\,253. Best fit parameters determined from our LTE models for each region and methanol species are listed in Table\,\ref{tab.LTE_model_params}. Differences between A-- and E--CH$_{3}$OH symmetry species are present in terms of temperature and density. In velocity they differ by a few km\,s$^{-1}$, although this discrepancy never exceeds our spectral resolution of $\sim$8--9\,km\,s$^{-1}$. Thus, the averaged $V_{\rm LSR}$ of these two species is adopted as the velocity of the region, in the same way as it has been previously established in Table\,\ref{tab.positions}. \begin{table*}[!t] \caption{Best fit parameters from our LTE modelling.} \label{tab.LTE_model_params} \scriptsize \begin{center} \setlength\tabcolsep{4pt} \begin{tabular}{llllllllllll} \hline \hline & \multicolumn{4}{c}{E--CH$_{3}$OH} & \multicolumn{4}{|c}{A--CH$_{3}$OH} &\\ Region & $N$(Sp) & $T_{ex}$ & FWHM & V$\rm{_{LSR}}$ & \multicolumn{1}{|l}{$N$(Sp)} & $T_{ex}$ & FWHM & V$\rm{_{LSR}}$ & mean V$\rm{_{LSR}}$& \\ & \multicolumn{1}{l}{[$\times$10$^{14}$ cm$^{-3}$]} & \multicolumn{1}{l}{[K]} & \multicolumn{1}{l}{[km\,s$^{-1}$]} & \multicolumn{1}{l}{[km\,s$^{-1}$]} & \multicolumn{1}{|l}{[$\times$10$^{14}$ cm$^{-3}$]} & \multicolumn{1}{l}{[K]} & \multicolumn{1}{l}{[km\,s$^{-1}$]} & \multicolumn{1}{l}{[km\,s$^{-1}$]} & \multicolumn{1}{l}{[km\,s$^{-1}$]} \\ \hline \\ R1 & 3.7$_{-0.1}^{+0.1}$ & 14.8$_{-0.6}^{+0.4}$ & 59.7$_{-2.5}^{+1.0}$ &305.4$_{-1.0}^{+0.8}$ & 0.76$_{-0.04}^{+0.05}$ & 18.8$_{-0.7}^{+0.8}$ & 61.3$_{-0.4}^{+1.7}$ & 302.9$_{-0.8}^{+1.4}$ & 304$\pm$9 \\ R2 & 5.0$_{-0.2}^{+0.3}$ & 9.3$_{-0.4}^{+0.4}$ & 43.6$_{-1.5}^{+2.5}$ &328.1$_{-0.7}^{+0.2}$ & 1.0$_{-0.1}^{+0.1}$ & 14.8$_{-0.9}^{+0.5}$ & 37.4$_{-2.9}^{+2.6}$ & 327.2$_{-1.1}^{+1.6}$ & 328$\pm$9 \\ R3 & 19.5$_{-0.5}^{+0.6}$ & 21.4$_{-0.5}^{+0.4}$ & 53.8$_{-0.9}^{+0.6}$ &283.2$_{-0.4}^{+0.4}$ & 9.3$_{-0.2}^{+0.1}$ & 26.6$_{-0.6}^{+0.3}$ & 55.0$_{-0.3}^{+0.9}$ & 284.7$_{-0.5}^{+0.3}$ & 283$\pm$9 \\ R4 & 10.16$_{-0.03}^{+0.04}$ & 31.0$_{-1.2}^{+0.6}$ & 60.2$_{-1.5}^{+1.7}$ &252.0$_{-0.6}^{+0.5}$ & 9.0$_{-0.2}^{+0.2}$ & 34.2$_{-0.9}^{+0.8}$ & 60.1$_{-1.3}^{+0.7}$ & 251.5$_{-0.6}^{+0.2}$ & 252$\pm$9 \\ R5 & 6.2$_{-0.4}^{+0.5}$ & 32.2$_{-1.7}^{+1.8}$ & 136.0$_{-7.9}^{+8.4}$ &217.2$_{-3.3}^{+4.5}$ & 3.2$_{-0.2}^{+0.3}$ & 32.2$_{-1.7}^{+1.8}$ & 136.0$_{-7.9}^{+8.4}$ &217.2$_{-3.3}^{+4.5}$ & 217$\pm$10 \\ R6 & 22.32$_{-0.03}^{+0.07}$ & 24.8$_{-0.4}^{+0.5}$ & 65.3$_{-0.4}^{+0.9}$ &179.9$_{-0.5}^{+0.4}$ & 14.1$_{-0.2}^{+0.2}$& 31.0$_{-0.6}^{+0.4}$ & 66.0$_{-0.9}^{+0.7}$ & 182.1$_{-0.3}^{+0.7}$ & 181$\pm$9 \\ R7 & 17.4$_{-0.4}^{+0.6}$ & 19.5$_{-0.5}^{+0.4}$ & 82.8$_{-1.4}^{+1.3}$ &169.3$_{-0.9}^{+0.6}$ & 5.5$_{-0.1}^{+0.2}$ & 22.9$_{-0.5}^{+0.4}$ & 83.2$_{-2.9}^{+3.0}$ & 173.6$_{-1.0}^{+1.2}$ & 171$\pm$9 \\ R8 & 5.9$_{-0.1}^{+0.2}$ & 14.8$_{-0.4}^{+0.3}$ & 63.7$_{-1.8}^{+0.9}$ &204.2$_{-1.9}^{+1.3}$ & 1.2$_{-0.1}^{+0.1}$ & 19.5$_{-0.7}^{+0.4}$ & 59.1$_{-3.3}^{+3.7}$ & 205.2$_{-1.6}^{+1.3}$ & 205$\pm$9\\ R9 & 5.6$_{-0.1}^{+0.3}$ & 13.9$_{-0.4}^{+0.5}$ & 57.4$_{-1.3}^{+2.2}$ &202.7$_{-0.9}^{+1.1}$ & 1.5$_{-0.1}^{+0.1}$ & 19.2$_{-0.4}^{+0.6}$ & 56.3$_{-1.9}^{+2.6}$ & 201.4$_{-0.7}^{+1.1}$ & 202$\pm$9\\ R10 & 1.0$_{-0.1}^{+0.1}$ & 12.3$_{-1.1}^{+0.7}$ & 24.9$_{-1.3}^{+1.8}$ &143.9$_{-0.8}^{+1.0}$ & 0.27$_{-0.02}^{+0.03}$ & 27.36$_{-3.1}^{+3.1}$ & 22.8$_{-3.3}^{+3.9}$ & 146.4$_{-1.5}^{+1.1}$ & 145$\pm$9\\ \hline \\ \end{tabular} \tablefoot{From left to right columns are: Selected region of the CMZ of NGC\,253 (see Table\,\ref{sec.selected_regions}), E-type methanol parameters: column density of the species ($N$(Sp)), excitation temperature ($T_{\rm ex}$), FWHM of the modeled methanol lines, and the local standard of rest velocity of the region $V_{\rm LSR}$. Columns 6--9 provide the same gas parameters for A--CH$_{3}$OH. Uncertainties are 1$\sigma$. An extra uncertainty of 15\% should be added to $N$(Sp) (due to the flux calibration accuracy, see Sect.\,\ref{Sec.Observations}). In the last column we present the average velocity of the two methanol symmetric types. In this case our 1$\sigma$ uncertainty is summed in quadrature with our velocity resolution of $\sim$8--9\,km\,s$^{-1}$, which dominates.} \end{center} \end{table*} A comparison between synthetic and observed spectra allows us to perform a deep scan of the methanol lines, highlighting some lines that slightly deviate from LTE conditions in the rotation diagrams or that are blended with other methanol lines and that were previously not discussed. The result of this inspection is henceforth described. \subsubsection{LTE modelling results} \label{sec.LTE_outliers} As can be seen in our Fig.\,\ref{fig.fitted_lines}, our synthetic spectra fit reasonably well the observed spectra in most of the regions. Region\,5 is the most difficult to reproduce due to the large FWHM ($\sim$140\,km\,s$^{-1}$) of the lines, with its spectrum almost reaching the confusion limit. Fortunately, based on the remaining regions, we selected a large number of lines that are reproduced (see Tables\,\ref{tab.methanol_lines_model_E} and \ref{tab.methanol_lines_model_A}, and Figure\,\ref{fig.fitted_lines}). We attempted to fit the same lines in region\,5, preventing in this way false line identifications and subsequent erroneous fitting attempts. The best solution for Region\,5 was reached by fitting both methanol symmetric types simultaneously. When this is done in CASSIS, the whole set of parameters between A- and E-type methanol is forced to be equal, allowing to change only the ratio between their column densities. As can be seen in Table\,\ref{tab.LTE_model_params}, the column density of E--CH$_{3}$OH is 2.1 times higher than that of A--CH$_{3}$OH. A lower column density E/A ratio leads us always to a worse fitting and is therefore not attempted to reach. We have also discarded from the initial fit the A--CH$_{3}$OH transitions between 303.3 and 309.2\,GHz, as their inclusion always leads to an overestimation of a number of lines (e.g. transitions at 239.7, 241.9, 338.6, and 350.9 GHz, see Tables\,\ref{tab.methanol_lines_model_E} and \ref{tab.methanol_lines_model_A}). All the proposed maser candidates listed in Table\,\ref{tab.RD_outliers} that were initially unveiled through the rotation diagrams were confirmed by our models. In addition to the outliers previously detected (see Table\,\ref{tab.RD_outliers}), we found several transitions with intensities not reproduced by our synthetic spectra. Among those outliers, listed in Table\,\ref{tab.methanol_maser_candidates_LTE_model}, there are a couple of maser candidates. We describe them below. \subsubsection{Maser line candidates} \label{sec.maser_line_candidates_model} Contrary to the remaining outliers found through the radiative transfer modelling (shown in Fig.\,\ref{fig.unknown_maser_lines} and described at some level in Appendix\,\ref{sec.apen.modelling_outliers}), our maser candidates have negative optical depths, depart significantly from LTE (see below), and belong to the same transition series as the maser candidates detected previously through the rotation diagram method (Subsect.\,\ref{subsec.Amasers}), being Class\,I methanol masers. \textbf{The} $\mathbf{8_{0}\rightarrow 7_{1}-A^{+}}$ transition line at 95.2\,GHz shows intensities $>$12.8 times stronger than predicted by the LTE modelling in all the regions but region\,4, where it is three times stronger. This large departure in the inner regions of the CMZ remind us of the case of the $10_{0}\rightarrow 9_{1}-A^{+}$ methanol line at 198.4\,GHz, which shows emission 3.3 times larger than expected in regions\,3 and 6. \begin{table}[h] \caption{Outliers in the LTE model.} \label{tab.methanol_maser_candidates_LTE_model} \scriptsize \begin{center} \renewcommand{\tabcolsep}{0.03cm} \begin{tabular}{lllllll} \hline \hline Transition &$\nu$ [GHz] & A/E & $E_{\rm up}$/k[K] & A$_{ij}$[s$^{-1}$] & $\tau$\tablefootmark{d} [$\times$10$^{-5}$] &maser\tablefootmark{e} \\ \hline \\ 8$_{0}\rightarrow$7$_{1}$ & 95.169391 & A$^{+}$ & 83.54 & 2.13$\times$10$^{-6}$ & $-$6.5 & I\\ 3$_{1}\rightarrow$4$_{0}$ & 107.013831\tablefootmark{a} & A$^{+}$ & 28.35 & 3.06$\times$10$^{-6}$ & 1021 & no\\ 0$_{0}\rightarrow$1$_{-1}$ & 108.893945 & E & 13.21 & 1.47$\times$10$^{-6}$ & 16590 & no\\ 1$_{1}\rightarrow$1$_{0}$ & 165.050175 & E & 15.47 & 2.35$\times$10$^{-5}$ & 3423 & no\\ 2$_{1}\rightarrow$2$_{0}$ & 165.061130 & E & 20.11 & 2.35$\times$10$^{-5}$ & 3801 & no\\ 3$_{1}\rightarrow$3$_{0}$ & 165.099240 & E & 27.08 & 2.35$\times$10$^{-5}$ & 2579 & no\\ 5$_{3}\rightarrow$5$_{2}$ & 251.811956 & A$^{-+}$ & 37.96 & 1.65$\times$10$^{-4}$ & $-$0.1 & no\\ 2$_{0}\rightarrow$1$_{-1}$ & 254.015377 & E & 12.19 & 1.90$\times$10$^{-5}$ & 9522 & no\\ 9$_{-1}\rightarrow$8$_{0}$ & 278.304512\tablefootmark{b} & E & 102.07 & 7.67$\times$10$^{-5}$ & $-$2.5 & I\\ 7$_{-1}\rightarrow$6$_{-1}$ & 338.344588 & E & 62.65 & 1.66$\times$10$^{-4}$ & 1301 & no\\ $J_{K}\rightarrow (J-1)_{K}$\tablefootmark{c} & 97--290 & A,E & -- & -- & $>$0.0 & no \\ \hline \end{tabular} \tablefoot{List of lines with intensities that exceed our LTE model. Their line intensities cannot be reproduced without a non-LTE model and there are no other lines subject to produce an important contribution if blended. \tablefoottext{a}{Blended with the methanol 34$_{5}\rightarrow$35$_{3}-A^{-}$ transition at 107.015820\,GHz ($E_{\rm up}$/k$=$1515.904\,K, A$_{ij}=$1.00$\times$10$^{-9}$\,s$^{-1}$)}. \tablefoottext{b}{Blended with the methanol 2$_{-2}\rightarrow$3$_{-1}-E$ transition at 278.342261\,GHz ($E_{\rm up}$/k$=$24.96\,K, A$_{ij}=$1.65$\times$10$^{-5}$\,s$^{-1}$)}. \tablefoottext{c}{The $J_{K}\rightarrow (J-1)_{K}$ line series is described in Appendix\,\ref{sec.apen.detailed_modelling} and \ref{sec.apen.modelling_outliers}}. \tablefoottext{d}{Optical depth according to our non-LTE model in region\,8 (see Appendix\,\ref{sec.apen.detailed_modelling})}. \tablefoottext{e}{Maser candidates based on the discussion in Sect.\,\ref{sec.maser_line_candidates_model}. If it is a candidate, then we add the classification Class\,I or II, according to \citet{Menten1991b}.}} \end{center} \end{table} \begin{sidewaysfigure*} \begin{center} \includegraphics[width=0.95\linewidth, trim={3.5cm 1cm 1.5cm 1.9cm},clip]{sl_LTE_lines.pdf} \caption{Zoom into successfully fitted lines for each region, which can be considered to follow LTE conditions. Red and blue colors indicate methanol A- and E- type, respectively, while the superposition of the two types, the final fit, is indicated in green. Line frequencies (in GHz units) are labeled at the top of the figure and are also indicated as a green dashed vertical line inside panels, while the velocity range (in km\,s$^{-1}$ with respect to the systemic velocity of the individual regions, see Fig.\,\ref{fig.m0_and_spectra_84}) is indicated in the bottom-left corner. Regions 1 to 10 are ordered from top to bottom as indicated in the leftmost panel (R from "Region" plus the corresponding number).} \label{fig.fitted_lines} \end{center} \end{sidewaysfigure*} \begin{figure*}[h] \begin{center} \includegraphics[width=0.95\linewidth, trim={1.5cm 0.5cm 1.5cm 2cm},clip]{New_lines.pdf} \caption{Outliers to our LTE modelling (see Appendix\,\ref{sec.apen.modelling_outliers}) with positive optical depths. The only exceptions are the $J_{1}\rightarrow J_{0} A^{-+}$ line series, recently proposed to present methanol maser Class\,II activity by \citet{Zinchenko2017}. Line frequencies are labeled at the top of the Figure. Most of the lines are unclassified so far. Labels and colors are the same as for Figure\,\ref{fig.fitted_lines}.} \label{fig.unknown_maser_lines} \end{center} \end{figure*} \begin{figure*}[h] \begin{center} \includegraphics[width=0.9\linewidth, trim={1.2cm 0.7cm 1.5cm 0cm},clip]{All_masers.pdf} \caption{Our proposed methanol masers belonging to previously known maser transitions. Labels and colors are the same that for Figure\,\ref{fig.fitted_lines}.} \label{fig.known_maser_lines} \end{center} \end{figure*} \begin{figure*}[ht!] \begin{center} \includegraphics[width=0.9\textwidth]{fig-methanol-Ediag.pdf} \caption{Diagram of the energy levels for A-type (left) and E-type (right) methanol transitions covered by ALCHEMI. The x-axis gives the quantum number K, while the number for each level gives J. The transitions used in the analysis are indicated with a color code corresponding to ALMA bands, as given in the top right corner. The maser candidate lines are presented as dashed lines, with their frequency in GHz. Note the energy difference of 7.9~K between the ground state of A and E-type.} \label{fig.EnergyDiagram} \end{center} \end{figure*} \textbf{The} $\mathbf{9_{-1}\rightarrow 8_{0}-E}$ line at 278.305\,GHz is the last methanol transition in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series covered in this work. As previously mentioned in Sect.\,\ref{subsec.Emasers}, it is strongly contaminated by the 2$_{-2}\rightarrow 3_{-1}-E$ line at 278.342\,GHz and was therefore excluded from the analysis with rotation diagrams. In regions\,1, 7, 8, and 9, however, its line profile is clearly distinguished from the contaminating line when being checked by the synthetic models. According to our radiative transfer modelling, the companion line at 278.342\,GHz is the only one that should be observed (while the masing line intensity should be negligible under LTE, see Fig.\,\ref{fig.known_maser_lines}), with its peak velocity about 40 km\,s$^{-1}$ lower than the maser line in region\,9, a difference four times larger than our spectral resolution. In summary, all the outliers in the LTE models have intensities above the expected one under LTE conditions, but most of them are likely able to be reproduced under non-LTE conditions if the results obtained for region\,8 (Appendix\,\ref{sec.apen.detailed_modelling}) are maintained for the other regions. The only clear maser candidates are the lines at 95.2 and 278.3\,GHz. Given the spatial resolution and software limitations \citep[see][their Sect. 3.6]{vanderTak2007}, we cannot account for a proper model to our maser candidates. Instead, we reproduce their line profiles and check whether negative optical depths are required or not. When no other results are plausible, we can assure that the transitions are effectively experiencing a population inversion. Unfortunately, as Class\,I maser emission arises from spot sizes of the order of 10$^{-5}$--10$^{-3}$\,pc \citep{Voronkov2014,Matsumoto2014}, any attempt to model our observations will be devoid of a real physical meaning. Negative optical depths are determined in the lines belonging to the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ and $J_{0}\rightarrow(J-$ 1)$_{1}-A^{+}$ series (see Fig.\,\ref{fig.known_maser_lines}) and they constitute our maser candidates. All of them are Class\,I methanol masers and, for the case of those belonging to the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series, depart from LTE at the outskirts of the CMZ of NGC\,253. We summarize the observed methanol transitions along the entire ALCHEMI coverage in Fig.\,\ref{fig.EnergyDiagram}, where LTE lines are labeled in straight lines and maser candidates are in dashed lines. We indicate with colors the ALMA band for each transition. From Fig.\,\ref{fig.EnergyDiagram} it becomes clear that the 7$_{-1}\rightarrow6_{0}-E$ line at 181.295\,GHz should be pumped by the same conditions than the other maser candidates in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ series. Our non-LTE models performed in region\,8 yield a negative optical depth (-2.4) for this transition suggesting maser emission. Unfortunately, our spectral and angular resolution is not sufficient to discriminate between the 181.295\,GHz line and the $J=$2--1 HNC line at 181.324\,GHz. \section{Discussion} \label{sec.discussion} \subsection{Conditions for maser emission} \label{subsect.conditions_for_maser_emission} Among all the lines proposed to be masers, the ones detected initially by our rotation diagrams are the most plausible ones. Here we will focus on the Class\,I methanol masers in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ series (at 84, 132, 229, and 278\,GHz), as they describe a very clear difference in maser occurrence: a complete LTE behaviour in the central regions (3 to 6) and strong maser activity at the outskirts of the CMZ of NGC\,253, where important $T_{ex}$ differences between A- and E- type methanol take place (see\,Fig.\,\ref{fig.delta}), and also where Lindblad resonances are located (with the only exception of region\,7). Unfortunately, based on the rotation diagram method we do not have enough evidence to account for the presence of Class\,II masers. The only exception might be the 3$_{1}\rightarrow4_{0}-A^{+}$ transition line at 107\,GHz ($E_{\rm up}$/k$=$28\,K), that follows LTE conditions in regions\,2, 5, and 10 ($\sim$1.5, $\sim$1.5, and 2$\sigma$, respectively). It is slightly above the fit in regions\,3, 4, 6, and 7, and is present in absorption in regions\,1 and 9 (3 and 2$\sigma$, respectively), and maybe also in region\,8 (2$\sigma$); although in this region the line seems to exhibit emission in the middle of the absorption feature. Maser activity by the line at 107\,GHz was first discovered by \citet{Valtts1995}. They found this line either in absorption or showing quasi-thermal emission. In the first case, this line is spatially correlated with the 5$_{1}\rightarrow 6_{0}-A^{+}$ Class\,II maser line at 6.7\,GHz, that belongs to the same family of lines. Other lines in the $J_{1}\rightarrow (J+1)_{0}-A^{+}$ series are the transitions at 57\,GHz ($J=$4), 156.6\,GHz ($J=$2), and 205.8\,GHz ($J=$1). By means of the rotation diagram method, we note that the transition at 156.6\,GHz is above the LTE trend in the same regions where the line at 107\,GHz surpasses the LTE modelling (regions\,3, 4, 6, and 7). However, as indicated in Appendix\,\ref{sec.apen.rotdiag_outliers}, the line at 156.6\,GHz may also follow the LTE conditions of A--CH$_{3}$OH. In NGC\,253, absorption against the continuum in region\,5 is noticeably seen in the rotational ground state transitions of dense gas tracers such as the formyl cation (H$^{13}$CO$^{+}$; \citealt{Harada2021}). Absorption features are also very prominent in the $J$=2--1 (e.g. \citet{Meier2015}) and $J$=3--2 transitions of silicon monoxide (SiO). All those features are uniquely observed in region\,5, contrary to the case of the 3$_{1} \rightarrow 4_{0}-A^{+}$ transition line at 107\,GHz, that presents absorption mostly in regions\,1 and 9. Therefore, the edges of the CMZ, namely regions 1, 2, 7, 8, 9, and 10, appear to provide suitable conditions for Class\,I maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series. We are aware that these conclusions only refer to the average conditions in our selected regions, as our linear resolution is of the order of 27\,pc, larger than typical clump sizes by a factor of 6--23 \citep[see e.g.][for estimations of clump sizes in the CMZ of NGC\,253]{Leroy2018} but usually small enough to resolve GMCs. Although Lindblad resonances (e.g. ellipses in Fig.\,\ref{fig.SiO_HNCO}) have been claimed as a good candidate for shocks \citep{GarciaBurillo2000, Ellingsen2018}, for galaxies with a strong bar there is theoretical support against the existence of Lindblad resonances \citep{Regan2003} or their relationship with the circumnuclear ring (CNR) position, which is more accurately defined by x$_{2}$ orbits \citep{Kim2012,Li2015,Schmidt2019}. The interplay between the nuclear dust/gas lanes and the CNR looks as a more likely explanation for the production of bi-symmetric shock/active regions: at the outskirts of the CMZ, where we find higher levels of HNCO as compared to SiO (regions\,1,2, and 7 to 10; see Fig.\,\ref{fig.SiO_HNCO}), in a similar way as in M\,83 \citep{Harada2019}, leading to the appearance of methanol masers in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series. We should see maser action encircling the CMZ if they were caused by the ILR. As an attempt to account for gas disturbances in the CMZ of NGC\,253, we obtained line intensity ratios from two well-known shock tracers, SiO and HNCO. Their moment\,0 maps, along with data reduction and a thorough analysis will be described in a forthcoming paper by Huang et al. (in prep.). Here our only interest is to relate the presence of shocks to methanol maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series, which is mostly observed toward intersecting areas between the circumnuclear ring and leading-edge dust/gas lanes of the bar. We selected transitions in the same ALMA bands (3 and 6) in order to reduce instrumental uncertainties. Based on previous studies, here we consider SiO as a tracer of strong shocks and HNCO as a tracer of weak shocks \citep[e.g.][]{Meier2015,Yu2018}, and therefore the SiO/HNCO ratio may be used as an indicator of the shock strength \citep{Kelly2017}. We note that HNCO\,(4$_{0,4}$--3$_{0,3}$), at 87.9\,GHz, is enhanced in practically the same regions where we detect Class\,I maser activity in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series (at 84, 132, 229, and 278\,GHz); this is also true for the previously detected methanol transition in this series, at 36\,GHz, if we dismiss the weak maser candidate at the very center shown in \citet{Gorski2018}. The resulting SiO\,$J=$2--1/HNCO\,(4$_{0,4}$--3$_{0,3}$) ratios (see Fig.\,\ref{fig.SiO_HNCO}, left panel) are enhanced in the central regions, especially in regions\,4 and 6, where no maser activity, in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series, is detected. Considering the SiO and HNCO transitions at frequencies $\sim$220\,GHz (ALMA band\,6), the largest SiO\,$J=$5--4/HNCO\,(10$_{0,10}$--9$_{0,9}$) line ratios come from region\,1 (see Fig.\,\ref{fig.SiO_HNCO}, right panel), the region where we see the largest departure between maser Class\,I emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series (and also in the A-type methanol line at 146.6\,GHz) and LTE conditions (see Fig.\,\ref{fig.delta}). On the other hand, the lowest SiO\,$J=$5--4/HNCO\,(10$_{0,10}$--9$_{0,9}$) ratios are observed in region\,3 and this coincides with the lowest LTE departures of potential Class\,I masers in E--CH$_{3}$OH lines (see Fig.\,\ref{fig.delta}). One, however, also needs to take into consideration the varying gas properties likely causing the highly varying trend of these SiO/HNCO ratios. A more complete investigation and further discussion upon the gas properties traced by HNCO and SiO is covered in a forthcoming paper (Huang et al. in prep. ). In addition, there is something missing in describing the intermediate regions. For example, regions\,4 and 6, where we do not see Class\,I maser emission in E--CH$_{3}$OH, present SiO\,$J=$5--4/HNCO\,(10$_{0,10}$--9$_{0,9}$) ratios similar to regions\,1, 2, 7, 8, and 9, where we do observe Class\,I maser emission in E--CH$_{3}$OH. \begin{figure*}[!htp] \includegraphics[width=\linewidth, trim={0 0cm 0 0cm},clip]{SiO_over_HNCO_sc_3.0_B36.pdf} \caption{Strong over weak shock tracers as accounted by SiO\,$J$=2--1/HNCO\,(4$_{0,4}$--3$_{0,3}$) (left) and SiO\,$J$=5--4/HNCO\,(10$_{0,10}$--9$_{0,9}$) (right) line ratios obtained from ALCHEMI data \citep{Martin2021}. A sigma clip of 3.0 was applied for both SiO and HNCO before obtaining the line ratios. Regions where we detect Class\,I maser emission in the $J_{-1}\rightarrow (J-1)_{0}-E$ series (see Sect.\,\ref{subsec.Emasers}) are labeled in red and with slightly larger numbers. The center and edges of the inner Lindblad resonance from \citet{Iodice2014} are denoted with a black ellipse and dash-dotted grey ellipses, respectively. A square root stretch has been applied for an easy visualization.} \label{fig.SiO_HNCO} \end{figure*} \begin{figure*}[!htp] \includegraphics[width=1\linewidth, trim={0cm 0cm 0cm 0cm},clip]{CN_over_C17O_sc_3.0_B36.pdf} \caption{CN\,($N=$1--0)/C$^{17}$O\,($J=$1--0) (left) and CN\,($N=$2--1)/C$^{17}$O\,($J=$2--1) (right) line ratios obtained from ALCHEMI data \citep{Martin2021}, indicating the presence of photodissociation regions. A 3$\sigma$ clipping was applied. Red contours indicate the H$_{\alpha}$ emission in logarithmic scale from MUSE archival data (ID:0102.B-0078(A), PI:Laura Zschaechner). Regions where we detect Class\,I maser emission in the $J_{-1}\rightarrow (J-1)_{0}-E$ series (see Sect.\,\ref{subsec.Emasers}) are labeled in red and with slightly larger numbers. The center and edges of the inner Lindblad resonance from \citet{Iodice2014} are denoted with a black ellipse and dash-dotted grey ellipses, respectively. Higher ratios indicate a higher photodissociation level. A square root stretch has been applied for an easy visualization.} \label{fig.PDR_tracers} \end{figure*} The missing element to be considered for the presence or absence of methanol masers can be the occurrence of photodissociation regions (PDRs), since photodissociation is the main mechanism for methanol destruction \citep[see e.g.][]{Hartquist1995}. We can use PDR tracers such as CN, whose abundance is found to be high in PDR regions \citep[e.g.][]{Fuente1993,Kim2020}, to investigate whether PDRs may be dominant. As mentioned by \citet{Meier2015}, the high rate of star production in the central regions of NGC\,253 can be identified by means of e.g. CN/C$^{17}$O line ratios, where C$^{17}$O traces dense molecular gas \citep[e.g.][]{Thomas2008}. We obtained the CN/C$^{17}$O line ratios by taking the ratio of moment\,0 maps of the chosen molecules. A 3$\sigma$ clipping was applied in the creation of those moment\,0 and the resulting line ratio maps (see Fig.\,\ref{fig.PDR_tracers}). In Fig.\,\ref{fig.PDR_tracers} we also plot the H$\alpha$ emission from recent MUSE\footnote{Multi Unit Spectroscopic Explorer \citep[MUSE;][]{Bacon2017}} observations obtained from archival data (ID:0102.B-0078(A), PI:Laura Zschaechner) after continuum subtraction by means of the STATCONT software \citep{SanchezMonge2018}. The stronger H$\alpha$ emission is related to the starburst induced outflow emerging from the nuclear bar, its morphology resembles the inner parts of previously observed outflows in X-rays \citep{Strickland2000} as well as the OH plume to the north-west \citep{Turner1985b}. We created six red contours, on a linear scale, covering emission in the range (1--7)$\times$10$^{-14}$~erg\,s$^{-1}$\,cm$^{-2}$. The CN/C$^{17}$O line ratios were obtained from ALMA band\,3 and 6, namely CN\,($N=$1--0)/C$^{17}$O\,($J=$1--0) and CN\,($N=$2--1)/C$^{17}$O\,($J=$2--1) ratios, respectively. These ratios are plotted in Fig.\,\ref{fig.PDR_tracers}, where high values correspond to a high rate of photodissociation. It can be noted from Fig.\,\ref{fig.PDR_tracers} that high values of CN/C$^{17}$O line intensity ratios are closely following the root of the large-scale outflowing gas. Overall, we note the highest level of photodissociation at the central regions of the CMZ (regions 4, 5, and 6), coinciding with regions where we observe a lack of methanol masers in the $J_{-1}\rightarrow (J-1)_{0}-E$ line series, and also the A-type transition at 146.6\,GHz, belonging to the $J_{1}\rightarrow (J+1)_{0}-A^{+}$ line series. The only exception involves the comparison between regions\,3 and 7. Masers are observed in region\,7, even though the CN/C$^{17}$O ratio is slightly higher than in region\,3, where no maser emission is encountered. Although region\,7 is located away from the nuclear ring, it is associated with a hot core cluster indicating an active star formation activity, as deduced from an increment of Complex Organic Molecules (COMs) such as CH$_{3}$COOH \citep{Ando2017}. As tracers of YSO outflows, Class\,I methanol masers are expected to be detected in environments like our region\,7. Additionally, region\,7 is not showing a high level of photodissociation as compared to regions 4 or 5, where the star formation activity is further confirmed by the presence of the H40$\alpha$ line \citep{Bendo2015}. In conclusion, the PDRs at some level can destroy methanol molecules in the central regions of NGC\,253. This is one of the scenarios suggested by \citet{Ellingsen2017}. Either starburst induced outflows and/or shocks where the leading-edge dust/gas lanes on the bar are connected to the circumnuclear ring, are causing the prevalence of Class\,I methanol masers in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series (at 84, 132, 229, and 278\,GHz) to regions farther away from the core (regions 1, 2, 7, 8, 9, and 10). Region\,7, although away from the resonances, presents a strong star formation but a rather moderate photodissociation level, giving way to the formation of methanol masers both in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ and the $J_{0}\rightarrow (J-1)_{1}-A^{+}$ line series. \subsection{Maser emission distribution} \label{sec.maser_emission_distribution} Based on our rotation diagrams, we selected a couple of E--CH$_{3}$OH lines that follow LTE conditions in all the studied regions and compare their averaged integrated intensities with the ones observed in the maser line at 84.5\,GHz ($E_{\rm up}$/k$=$32.5\,K) in each spaxel. The selected lines in LTE are the 4$_{2}\rightarrow 3_{1}-E$ and 3$_{1}\rightarrow 2_{0}-E$ transitions at 218.4 ($E_{\rm up}$/k$=$37.6\,K) and 310.1\,GHz ($E_{\rm up}$/k$=$27.1\,K), respectively (see\,Table\,\ref{tab.methanol_lines}). They are not blended with other methanol transitions and do not appear to be significantly contaminated by blending lines from other species (Table\,\ref{tab.methanol_lines}), given their good fit in the rotation diagrams. Additionally, these two lines have $E_{\rm up}$/k values around the one of the maser line at 84.5\,GHz. The result of dividing the integrated intensity of the 84.5\,GHz maser line by the averaged intensity of the two lines proposed to be in LTE (at 218.4 and 310.2\,GHz) is presented in the left panel of Fig.\,\ref{fig.maser_distribution}. In this Figure the spaxels with higher intensity ratios are in line with regions where we previously identified maser emission through the rotation diagram method. The distribution of maser emission we found is also in good agreement with latest detections of methanol maser emission at 36.2\,GHz in NGC\,253 \citep[see][their Fig.\,2]{McCarthy2020}. We have further checked an equivalency between the intensity ratios and upper level column density ratios in our Appendix\,\ref{Sec.apen.equivalency}. We find that a line intensity ratio of >0.1244 corresponds to regions with maser emission in the $J_{1}\rightarrow (J-1)_{0}-E$ line series (upper level column density ratios >3.3 with respect to LTE (Fig.\,\ref{fig.delta}, first panel)). This intensity ratio may appear low, but it is only because the spatially widespread thermal lines have higher intensities than the likely much less widespread non-thermal methanol transition at 84.5\,GHz. Furthermore, it is important to emphasize that the maser's column densities are nominal and do not reflect column densities in a linear way due to amplification effects. Taking into account the previous subsection\,\ref{subsect.conditions_for_maser_emission}, we noticed that, in order to explain the lack of methanol maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series (Class\,I) in the central regions of NGC\,253, it is necessary to invoke a combination of strong photodissociation in region\,5 as well as strong rather than weak shocks in regions\,3, 4, and 6. In other words, suitable conditions of Class\,I maser emission in these line series are weak shocks and low rates of photodissociation, the latter preventing methanol destruction. In the right panel of Fig.\,\ref{fig.maser_distribution}, we empirically determine a threshold for the two conditions previously mentioned as SiO/HNCO ratios lower than 1.05 and CN/C$^{17}$O ratios lower than 60 in ALMA band\,3 data. In the right panel of Fig.\,\ref{fig.maser_distribution}, we also show the average values of the 10 selected regions (Table\,\ref{sec.selected_regions}) derived from band\,3 and they are distributed as expected: central regions fall where no maser emission is expected. We performed a similar diagram for ALMA band\,6 data (not shown); in this case region\,7 is difficult to separate from locations where LTE conditions are predominant, and regions\,1, 2, and 8 to 10, are located where SiO/HNCO ratios are in the 0.4 to 1.2 range and CN/C$^{17}$O ratios are lower than 4.75 (both ratios obtained from ALMA band\,6 data). A similar distribution for Class\,I methanol maser emission was previously found by \citet{Ellingsen2017} and \citet{Gorski2017,Gorski2019} for the 36.2\,GHz line, which also belongs to the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series. \begin{figure*}[!htp] \includegraphics[width=\linewidth, trim={0 0cm 0 0cm},clip]{no_banned_colors_v3_3.0_B3.pdf} \caption{Left: Maser emission distribution per spaxel as observed by dividing integrated intensities of the maser methanol line at 84.5\,GHz by the mean intensity value of the surrounding (in terms of $E_{\rm up}$/k) methanol lines in LTE at 218.4 and 310.1\,GHz (see Sect.\,\ref{sec.maser_emission_distribution}). A 3$\sigma$ clipping was applied in all the transitions involved to produce the figure. The center and edges of the inner Lindblad resonance from \citet{Iodice2014} are denoted with a black ellipse and dash-dotted grey ellipses, respectively. Regions where we observe methanol maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series are labeled in red. Right: Same spaxels (with their values as colors) as in the figure to the left, but this time distributed according to their ratios in the SiO/HNCO (y-axis) and CN/C$^{17}$O line ratio maps in ALMA band\,3. A logarithmic stretch has been applied in both panels for an easy visualization. Colors are in common for both panels. Our threshold of 3.3 above the rotation diagram fit given in Fig.\,\ref{fig.delta} (first panel) corresponds to an intensity ratio of >0.1244 (see Appendix\,\ref{Sec.apen.equivalency}).} \label{fig.maser_distribution} \end{figure*} \section{Summary and Conclusions} \label{sec.summary} Searching for methanol (CH$_{3}$OH) transitions, we have performed a spectral survey toward the archetypical starburst galaxy NGC\,253 with the ALMA interferometer covering a frequency range between 84--373\,GHz. We focus on ten regions inside the CMZ of this galaxy; those regions are centered at the position of giant molecular clouds. After limiting our search to methanol lines with $E_{\rm up}$/k$<$150\,K, since above that limit lines are too weak to be detected, we identified all the methanol transitions of each region separately and used the rotation diagram method in order to determine which transitions deviate from LTE conditions. Assuming LTE conditions, we found that E--CH$_{3}$OH is more abundant at lower $E_{\rm up}$/k and follows predominantly lower excitation temperatures than A--CH$_{3}$OH. We also find that including methanol lines with $E_{\rm up}$/k$<$150\,K is sufficient to fit the observed spectra. We also performed LTE and non-LTE model calculations with CASSIS-RADEX to find maser candidates. A moderate difference of only about 15\% in intensities between the LTE and non-LTE predictions is found in our data when we consider a single component for each methanol symmetric type (but this difference becomes important when we consider two components, see Appendix\,\ref{sec.apen.detailed_modelling}). Although most of the observed methanol lines can be reproduced by our LTE models, we found a number of outliers, of which 7 show maser properties. We have confidently identified a total of 3 A-type and 4 E-type methanol maser transitions, all of them classified as Class\,I. We have also performed a more detailed non-LTE model in region\,8 (Appendix\,\ref{sec.apen.detailed_modelling}), where the $J_{K}\rightarrow (J-1)_{K}$ line series is better reproduced. From this model we obtained optical depths for the covered methanol transitions and these support the presence of masers indicating negative opacities for our best candidates. Using rotation diagrams, we have confidently detected all but the last of the covered methanol lines in the $J_{-1}\rightarrow(J-1)_0-$E series to be masing, namely, methanol lines at 84.5, 132.9, and 229.8\,GHz. The last available line in this series, at 278.3\,GHz, is detected to depart from LTE when we compare the observed spectrum with the LTE synthetic spectrum, showing maser characteristics at the edges of the CMZ in NGC\,253. Maser action in the 84.5\,GHz line, previously reported by \citet{McCarthy2018}, is now detected in more than one location for the first time. An absorption line at 107\,GHz was identified in the spectra of regions\,1, 8 and 9, which are located at the outskirts of the CMZ of NGC\,253. Interestingly, the position of these regions coincides with the position of the circumnuclear ring (co-spatial with the Lindblad resonances according to \citet{Iodice2014}, but see Sect.\,\ref{sec.discussion}) and with Class\,I methanol maser emission in the $J_{-1}\rightarrow(J-$ 1)$_{0}-E$ line series. The increment of weak shocks in the interplay between dust/gas lanes and the circumnuclear ring is proposed to harbor favourable conditions to produce Class\,I masers in the $J_{-1}\rightarrow(J-1)_0-$E line series. This happens in regions 1, 2 and 8--10. These resonances are expected to create density waves and locally increase the amount of shocks where they are located, possibly creating favourable conditions to produce methanol masers. On the other hand, considering the Class\,I masers belonging to the $J_{0}\rightarrow(J-$ 1)$_{1}-A$ line series (at 95, 146, and 198\,GHz), we found the first of them ($J=$8, at 95\,GHz) departing at least by a factor of 3 (in region\,4) from LTE in all the regions, and above a factor of 12 without considering region\,4. The levels giving rise to the transition at 146\,GHz are less populated, showing maser emission in regions\,1, 7, 8 and 9. The last in the $J_{0}\rightarrow(J-$ 1)$_{1}-A$ series, at $J=$10, departs from LTE by a factor higher than 3.3 in regions\,3, 6, and 7, being the only one masing in the nuclear parts of the CMZ detected through the rotation diagram method. We computed the SiO\,$J=$5--4/HNCO\,(10$_{0,10}$--9$_{0,9}$) intensity ratios as a tracer of strong over weak shocks for all regions and found that region 1 and 3 have the highest and lowest values, respectively. When looking at the $J_{-1}\rightarrow(J-1)_{0}-E$ series for those particular regions, we find that in region 1 maser lines deviate the most from the expected LTE behaviour in the rotation diagram. This indicates that the transitions in region\,1 are likely masing due to collisional excitation by shocks. For region 3, the emission seems to be completely in LTE since the transitions align almost perfectly in the rotation diagrams. When considering the SiO\,$J=$2--1/HNCO\,(4$_{0,4}$--3$_{0,3}$) ratios, which cover much more spaxels and trace colder gas, we find an opposite picture, where HNCO is stronger than SiO at the outskirts of the CMZ, exactly where we observe methanol maser emission in the $J_{-1}\rightarrow(J-1)_{0}-E$ line series, with the only exception of region\,7, whose pumping mechanism might be dominated by star-forming processes, in agreement with latest findings in NGC\,253 targeting the methanol 4$_{-1}\rightarrow$3$_{0}-E$ transition at 36\,GHz \citep{Gorski2019} For the regions in the center of the CMZ of NGC\,253, we compared CN/C$^{17}$O ratios as a PDR tracer. We found out that regions 3, 4, and 5 show the highest levels of photodissociation. The implied strong ultraviolet radiation may lead to the destruction of methanol molecules in the central regions, preventing the appearance of methanol masers. Although several scenarios are proposed to explain the presence or absence of methanol masers in all the regions in NGC\,253, we cannot conclude which of them is dominant over all the regions along the CMZ. Higher angular resolution observations are needed to spatially resolve smaller regions and to differentiate between the proposed mechanisms that give place to the formation of methanol masers. \begin{acknowledgements} PH is a member of and received financial support for this research from the International Max Planck Research School (IMPRS) for Astronomy and Astrophysics at the Universities of Bonn and Cologne. PH is grateful to Arnaud Belloche, Dario Colombo, Yu Gao, and Sudeep Neupane, for their constructive advice and fruitful discussions along a variety of aspects covered in this work. VMR is funded by the Comunidad de Madrid through the Atracci\'on de Talento Investigador (Doctores con experiencia) Grant (COOL: Cosmic Origins Of Life; 2019--T1/TIC--15379), and from the Agencia Estatal de Investigaci\'on (AEI) through the Ram\'on y Cajal programme (grant RYC2020-029387-I). L.C. has received partial support from the Spanish State Research Agency (AEI; project number PID2019-105552RB-C41). KS thanks MOST grant 109-2112-M-001-020. N.H. acknowledges support from JSPS KAKENHI Grant Number JP21K03634. This work makes use of the following ALMA data: ADS/JAO.ALMA\#2017.1.00161.L and ADS/JAO.ALMA\#2018.1.00162.S. ALMA is a partnership of ESO (representing its member states), NSF (USA) and NINS (Japan), together with NRC (Canada), MOST and ASIAA (Taiwan), and KASI (Republic of Korea), in cooperation with the Republic of Chile. The Joint ALMA Observatory is operated by ESO, AUI/NRAO and NAOJ. \end{acknowledgements} \bibliographystyle{aa}
\section{Introduction} In urban areas, where Global Navigation Satellite Systems (GNSS) signals are only partially available and degraded by multipath, it is difficult to reach a satisfactory positioning performance for many important use cases. To address the difficulty and achieve an accurate position solution, expensive and professional sensors such as Inertial Measurement Units (IMUs), cameras or other Radio Frequency (RF) signals are required to assist the positioning solution. Radio signals enable the position estimation by different methods, such as fingerprinting and signal features \cite{klus2,5g-deep}, range measurement and multilateration \cite{rets}, and the combination of the ranging and Angle of Arrival (AoA) \cite{aoa}. In addition, known or estimated channel properties of signals which are known as Channel State Information (CSI) are able to characterize the environment by describing how a signal propagates from a transmitter to a receiver. Consequently, in dense urban areas the multi-path effect resulted from the environment, is embedded in the CSI data. Thus, CSI is a good candidate for positioning purposes, where one of the use cases is fingerprinting \cite{csi2,loss}. Fingerprinting is mainly made of two phases: offline and online. In the offline phase, a large data set of fingerprints for each known position is collected and fed to the system. Later in the online phase, the test data is compared with the data set and maps the collected data to the corresponding position \cite{g-book}. Compared to traditional ranging and angular based positioning methods, where Non-Line-of-Sight (NLOS) propagation can considerably decrease the accuracy \cite{ION}, fingerprinting can exploit the richer features in NLOS scenarios to obtain a better positioning solution. CSI fingerprints of \highl{Wi-Fi} systems have been frequently used for indoor positioning \cite{csi-wifi,loss,wifi_fp}. Nevertheless, in outdoor urban areas Wi-Fi signals are not always available, or they are of poor quality. On the other hand, in the emerging 5G networks, efficient communications require continuous exchange of CSI data between the BS and the User Equipment (UE) \cite{complex}, which makes 5G New Radio (NR) CSI a convenient fingerprint in the urban area. The new millimeter Wave (mmWave) frequency band, introduced in the 5G NR, can be used to reach sub-meter level positioning accuracy \cite{wym1}. However, due to the high frequencies, the mmWave signals suffer from high penetration and path loss as well as the rain fading, which typically limits the number of available BSs for positioning. On the other hand, the short wavelength in millimeter level allows implementation of larger antenna arrays compared to the previous technologies \cite{wym1}. Partly resulting from the increased array sizes, another supplement provided by 5G NR technology is the beam-based operation, which enables highly directional beamforming via Massive Multiple Input Multiple Output (MIMO) technology \cite{beamforming}. Therefore, in this work, the utilized CSI data is beamformed and the CSI observations are performed per beam. These beam-wise CSI measurements work as an input to the proposed Convolutional Neural Network (CNN) based positioning engine. \begin{table*}[ht] \caption{Neural Network-based Fingerprinting Methods} \begin{center} \begin{tabular}{|c|c|c|c|c|} \hline \textbf{Reference} & \textbf{Environment} & \textbf{Radio Signal} & \textbf{Fingerprint} & \textbf{\highl{Minimum Mean Error}} \\ \hline \cite{csi2} & indoor & Wi-Fi & CSI & 1.8 m \\ \hline \cite{csi-wifi2} & indoor & Wi-Fi & RTT & 0.91 m \\ \hline \cite{loss} & indoor & Wi-Fi & CSI & 1.16 m \\ \hline \cite{klus2} & outdoor & 5G and GNSS & radio signal strength & 1.75 m \\ \hline \cite{5g-deep} & outdoor & 5G & RSRP and beam IDs & 1.4 m \\ \hline \cite{5g_csi} & indoor & 5G & CSI from 4 BSs & 1.17 m\\ \hline Proposed Work & outdoor & 5G & CSI from 1 BSs with beamforming technology & 0.98 m \\ \hline \end{tabular} \label{fp} \end{center} \end{table*} The main contributions of this paper are as follows: \begin{enumerate} \item We introduce a novel utilization of 5G mmWave in position estimation. To the best of our knowledge, 5G NR CSI-based fingerprinting utilizing beamforming technology has not been reported in the literature. \item For obtaining the results, we utilize a realistic ray-tracing-based CSI data, considering a real-life city area with rich multipath propagation while following the guidelines of 5G NR specifications\cite{3GPPchannel}. \item We propose and analyze a neural network-based fingerprinting with CNN-architecture for positioning in urban area. This method requires low-power and low-memory \item We consider a single BS positioning scenario to reduce the system complexity, and avoid the demand of observing multiple BSs using mmWave signals under high path loss scenarios. In addition, wrapping up the neural network-based processing in a single BS enables efficient scalability of the proposed methods for various use cases, including cases with varying BS deployment. \end{enumerate} The remainder of the article is as follows. The related works are discussed in Section \RomanNumeralCaps{2}, the preliminaries are provided in Section \RomanNumeralCaps{3}. Our proposed CNN-based fingerprinting utilizing 5G NR CSI is presented in Section \RomanNumeralCaps{4}, the experiment and analysis are provided in Section \RomanNumeralCaps{5}, followed by conclusion and future work in Section \RomanNumeralCaps{6}. \section{Related Works} Fingerprints of radio signals for positioning have been frequently used in the literature. Wu et al. in \cite{csi2}, have utilized Wi-Fi-based CSI data collected by an Atheros CSI tool in an indoor environment. They have proposed a supervised Deep Neural Network (DNN) to estimate the position of the UE. Authors proved that their proposed network architecture outperforms its counterpart in terms of being fast in the online phase and saving memory for the storage of the weights and biases of the network. In \cite{csi-wifi2}, DeepNar was proposed as a neural network-based fingerprinting method. Authors have used Wi-Fi Round Trip Time (RTT) fingerprints from 7 BSs to localize a UE in an indoor scenario. There, the RTT measurements are first normalized to stay in the range between [0,1] and then fed to the neural network. By utilizing DeepNar, the authors have achieved a minimum mean positioning error of \highl{$91 \ cm$} with the test samples. \highl{This error is the minimum calculated average error in estimation of test points positions using the test CSI samples.} In \cite{loss}, a deep residual sharing learning based system was presented utilizing Wi-Fi CSI data collected in an indoor environment with the Intel 5300 NIC tool. To prepare the input data for the neural network, authors have constructed CSI tensors utilizing CSI amplitude and AoA measurements. Considering the two types of measurements, the authors feed the data to two different channels. Thus, the trained weights and biases are different in the output of the channels and they will be shared at the end of a residual block. Authors have tested their method in the indoor environment of a laboratory and a corridor, and they were able to achieve the minimum mean error of $1.16 \ m$, \highl{which is the least achieved average error among the estimations for the test samples}. In urban environments, Wi-Fi signals are not always available. \\ In \cite{klus2}, authors take advantage of the fingerprints including beamformed radio signal strength in a 5G NR network. They have also fused the position estimations with the available GNSS position data to achieve higher accuracy. The considered signals are transmitted by seven beamforming-capable BSs over $32$ beams for each. The results in their work show that $3.4 \ m$ mean positioning error is achieved by the proposed fingerprinting method. This error decreased to $1.75 \ m$ mean by fusing the radio signal strength based estimates with GNSS position data utilizing a neural network. In \cite{5g-deep}, authors exploit deep learning-based fingerprinting to localize a UE in an urban area. They have used the Reference Signal Received Power (RSRP) of 5G beams and the beams ID as the input data to their proposed neural network. For simulating the data, the authors have used WinProp ray-tracing simulation tool. They have utilized $8$ 5G radio nodes (gNBs) and achieved the minimum average error of $1.4 \ m$. Authors in \cite{5g_csi} have utilized 5G CSI fingerprints and Siamese CNN to find the position of a UE in an indoor area. They have achieved a minimum mean error of $1.17 \ m$ using $4$ BSs. In this work, despite the previous works, we are interested in beamformed CSI fingerprints. Furthermore, regarding the lack of Wi-Fi signals in outdoor environment, we take advantage of the beamforming technology of 5G signals to improve the results for an outdoor scenario. Besides, we utilize only one BS to evaluate the performance of the proposed method in an outdoor positioning scenario. \\ A summary of methods considered in the literature, which utilize neural networks is presented in Table \ref{fp}. Besides the literature references, the environment type, radio signal fingerprint, and the minimum mean error achieved by the method are provided in the table. \highl{The minimum mean error is the lowest error among the averaged errors achieved in position estimation by feeding the test CSI samples to the trained network.} \section{Preliminaries with data description} In this work, we take advantage of the 5G mmWave CSI fingerprints of a MIMO Orthogonal Frequency Devision Multiplexing (OFDM) system to train a CNN. The trained network will be then used for fingerprinting. \subsection{Neural network based fingerprinting} In traditional fingerprinting methods, a large amount of data is required during the real-time process to estimate the position of the UE. However, utilizing neural networks enables the system to eliminate the required memory and expense to carry the heavy database in the online phase. There are mainly two phases in the neural network-based fingerprinting method: 1) Offline phase: a large amount of CSI data are given as input to the system. The data are labeled with the position of each training point. The weights and biases of the neural network will be optimized based on the given labeled data. Finally, the trained network will be used in the online phase. 2) Online Phase: There will be no requirement of memorizing the training data set. The only necessity will be the weights and biases of the trained network. The test data which is not previously seen by the network will be provided as the input to the network. The network will then estimate the position of the UE. \subsection{Channel State Information (CSI)} While the radio signals propagate through the air, they experience different types of channel effects, such as diffractions, specular reflections, scattering, and path loss. The radio channel can be represented by CSI which is essentially a complex-valued frequency response of the channel in OFDM-based transmission. Assuming a single antenna UE, the received signal at the $m^\text{th}$ subcarrier of the $b^\text{th}$ beam can be represented as \begin{equation}\label{csi1} r_{m,b} = \mathbf{H}_{m,b} \mathbf{F}_b s_{m,b} + n_{m,b}, \end{equation} \\ where $s_{m,b}$ is the transmitted signal, $\mathbf{H}_{m,b}\in\mathbb{R}^{1 \times N_{\text{TX}}}$ is the channel matrix between the transmitter and the receiver including the effect of all multipaths, $\mathbf{F}_{b}\in\mathbb{R}^{N_{\text{TX}} \times 1}$ is the beamformer vector, and $n_{m,b} \sim \mathcal{N}(0,\sigma^{2})$ is Additive White Gaussian Noise (AWGN). From (\ref{csi1}), the effective beamformed CSI for the $m^\text{th}$ subcarrier and $b^\text{th}$ beam can be observed as $H^{\text{CSI}}_{m,b} = \mathbf{H}_{m,b} \mathbf{F}_b$. In practice, the CSI is estimated from the received signal assuming a known transmitted reference signal \cite{csi2}. To prepare the input data for the neural network, the available CSI data are received by $M$ number of subcarriers and $B$ number of beams. Considering that the CSI data involve complex numbers, to prepare the CSI data in a way that they are applicable to CNN, we have added the real and imaginary parts of the CSI data separately in two consecutive columns. Using this method prevents any probable data loss during the CNN classification \cite{complex}. Thus, finally, we have the data of $M \times 2B$ matrices as the input to the network. Assuming a fixed and static environment, separate CSI measurements collected at the same location differ only by measurement noise. In addition, the noise on the CSI data can be considered to vary according to changes in the environment, such as the movement of vehicles \cite{weather}. Thus, for each considered measurement location simulated in the ray-tracing tool, a large amount of data can be generated by obtaining different random noise realizations. The quality of the beam-wise CSI measurements is dependent on the signal SNR, which is defined as \begin{equation} SNR_{b} = 10\log_{10}\left(\frac{\sum_m \vert r_{m,b}\vert^2}{M\sigma^2}\right) \, \text{[dB]}, \end{equation} where $\sigma^2$ is the noise power. \subsection{CNN and data splitting} CNNs have the ability to extract the features of the given input and detect the important features in comparison with other traditional Machine Learning (ML) methods including random forests. The features extraction is performed by an element-wise product between the inputs and a small array of numbers, called a kernel. The kernel is applied to the input by sliding over all the locations to extract the features. Notice that the convolutional layer is linear. Thus, a nonlinear function such as a Rectifying Linear Unit (ReLU) is required to enable the back-propagation. Before feeding the data set as the input to the neural network, the data set is first split into the following categories: \begin{enumerate} \item Training data set: Some measurement points on the simulation area are considered as the reference points. A large amount of CSI data are collected at each reference point. Notice that the labels of the CSI data are the positions of each reference point. \item Validation data set: This data set is generated for each reference point. However, the validation data has been never seen previously by the network as it has different noise from the training data set. This data set is used to evaluate the robustness of the neural network. \item Test data set: In this data set, new points other than reference points are considered to evaluate the network performance and positioning accuracy. For this data set, there will not be any specific labels. Instead of finding only one label, the network will find the probabilities of the labels. The position will then be estimated based on the predicted probabilities. \end{enumerate} These data sets are then fed to the proposed CNN when considering the numerical evaluations shown in Section V. \section{Proposed CNN-Based Fingerprinting utilizing 5G NR CSI} The proposed system architecture is illustrated in Fig. \ref{architecture}, where the CNN is developed to extract the features in CSI data. The hyperparameter of number of layers is optimized by observing the generalization error while increasing the number of layers. The optimum number of layers is selected based on the lowest \highl{validation} error while avoiding overfitting. We have utilized 5 convolutional2D layers with a ReLU function at each layer to define non-linearity. As the downsampling strategy, 2D max-pooling is used in the first 4 layers \cite{maxpool}. Then, in the 5th layer, flattening is done to prepare the input for the output layer of the network, which is the classifier. \begin{figure}[t] \centerline{\includegraphics[width=3.2in]{method}} \caption{System architecture of the proposed positioning method.} \label{architecture} \end{figure} \subsection{Hyperparameters} To achieve the highest accuracy, the choice of hyperparameter of a network plays an important role. Furthermore, having optimal or close to optimal hyperparameters results in saving time, energy, computation, and money \cite{green}. Hyperparameters consist of two types of variables: a) the variables which determine the network structure like the number of hidden layers, and b) the variables which affect the training of the network, such as the learning rate, weight decay, and batch size. Moreover, the tuned hyperparameters for the developed CNN are listed in Table \ref{hp}. Regularization is one of the most essential hyperparameters. In this work, the techniques utilized for regularization are L2 norm and Batch Normalization (BatchNorm). L2 norm is applied with the weight decay and BatchNorm normalizes the input of the layer. It subtracts the input by mean value of the mini-batch and finally divides it by the mini-batch standard deviation. This technique solves the problem of internal covariate shift. This problem occurs due to the varying distribution of the input weights to the neurons at each epoch. Neurons must adapt to this change, which is solved by the BatchNorm technique \cite{covariate}. Another issue that DNNs might experience, is the vanishing or exploding gradient. Vanishing gradients occur due to the gradients getting smaller while the network is being trained. On the other hand, exploding gradients occur when big errors accumulate and represent large values to the network. This issue prevents the network to be trained and results in an unstable network. BatchNorm prevents the values to become very big or very small. In this work, we have used a 2D BatchNorm in the first main layer and a 1D BatchNorm in the last main layer after the output has been flattened to a 1D feature vector. \begin{table} \caption{Hyperparameters for Training the Network} \label{hp} \begin{center} \normalsize \begin{tabular}{|c|c|} \hline \textbf{Hyperparameter} & \textbf{Value} \\ \hline Activation Function & ReLU\\ \hline Regularization & BatchNorm and Weight Decay\\ \hline Decay Rate & 0.001\\ \hline Learning Rate & 0.000001\\ \hline Epochs Size & 150\\ \hline Batch Size & 20\\ \hline \end{tabular} \end{center} \end{table} \subsection{Loss Function} The parameters of the neural network are optimized using AdamW optimizer explained in detail in \cite{adamw}. AdamW is an adaptive optimizer which provides the optimization of weight decay and learning rate separately. The loss function is used to calculate the error in predictions while training the network. We have used two different error calculations during the training and the test phase. \subsubsection{Training and the robustness of test performance} For training the network, we aim to minimize the Negative Log Likelihood (NLL) loss function given as \begin{equation}\label{nll} loss = - \sum_{n=1}^{N}y_{n} \log \hat{y}_{n}, \end{equation} where $N$ is the number of labels (number of reference points in our work), $y_{n}$ is the true label of the $n^\text{th}$ training data and $\hat{y}_{n}$ represent the probabilities computed by the softmax layer as \begin{equation}\label{nll} \hat{y}_{n} = Softmax(z_{j}) = \frac{\exp{z_{j}}}{\sum_{k=1}^{K}\exp{z_{k}} }, \end{equation} where $z_j$ represents the neurons values in output layer. The values are calculated by the input to the neurons, weights and biases. We utilize NLL loss for both training and validation. The validation is done by CSI data which have never been seen by the network previously. However, this CSI data have the same labels with the reference points. \subsubsection{New Test Points} The final test is done for the CSI data collected at the points other than reference points. \highl{The loss/error in the predictions which are estimated positions for the test points is the Euclidean distance to the ground truth.} The predicted coordinates \highl{($x_{pred}$,$y_{pred}$)} for the corresponding CSI data are estimated using the softmax layer probabilities as \begin{align}\label{x_predict} \begin{split} x_{pred} &= \sum_{i=1}^{R} \frac{p_{i} }{\sum_{j=1}^{R}p_{j}} x_{i} \text{ and} \\ y_{pred} &= \sum_{i=1}^{R} \frac{p_{i} }{\sum_{j=1}^{R}p_{j}} y_{i}, \end{split} \end{align} where $(x_{i},y_{i})$ represents the position of the training points, $p_i$ is the probability calculated by the softmax layer, and $R$ is the number of selected training points, defined as $R=4$ in this work. The $R$ selected training points have the largest calculated probabilities $p_i$ among the others. \highl{The estimator is sensitive to the value of $R$. $R=4$ is selected considering the consistency it provides in the accuracy of calculated positions. Higher values of R result in lower accuracy and lower values of R provides inconsistent solutions.} \begin{figure} \centerline{\includegraphics[width=3.5in]{map}} \caption{Reference and test points in the simulated environment. The green circles are the reference points, and the red circles with unique label numbering are the test points. The BS location is shown with a magenta marker accompanied with a pointer vector to illustrate the antenna direction.} \label{map} \end{figure} \section{Numerical experiment and Analysis} The proposed method is tested by simulating CSI data in an urban environment in Helsinki metropolitan area called Punavuori. In order to obtain the CSI data, we utilize a proprietary ray-tracing software, following the map-based channel modeling principles proposed by the 3GPP in \cite{3GPPchannel}. In total of $30$ number of training point locations and $10$ number of test point locations are considered in the environment, as shown in Fig. \ref{map}. The carrier frequency is defined as $30$~GHz. At each location, the CSI is measured from a single BS based on a downlink transmitted Synchronization Signal Blocks (SSBs) consisting of 240 subcarriers with subcarrier spacing of $60$~kHz (bandwidth of $14.4$~MHz). Furthermore, the SSBs are beamformed over $B=32$ beams using a uniform rectangular array with dimensions of 16 azimuth and 8 elevation elements. For each reference point, $1000$ noisy CSI samples are obtained for training and validation, as discussed in Section III.B. The radio link budget is designed so that in Line-of-Sight (LOS) conditions, the SNR for the best beam is approximately $10$~dB at $100$~m distance from the BS. From the generated data 60\% is used for training and 40\% for validation \highl{using random splitting}. Similarly, for testing purposes, $100$ CSI samples are correspondingly generated for the test point locations. \begin{figure}[t] \centerline{\includegraphics[width=3.2in]{acc}} \caption{The accuracy of training and validation.} \label{acc} \end{figure} The training and validation accuracy are presented in Fig.~\ref{acc}. Considering the training accuracy, we can realize that the network has been appropriately trained. It shows that the proposed CNN is able to extract the features out of the CSI tensors. Furthermore, the validation accuracy, extracted from the validation set, has reached maximum $97.77 \%$. The high validation accuracy indicates that first the network is well-regularized due to regularization methods, and second, the network is robust against the unseen data. \begin{figure}[t] \centerline{\includegraphics[width=3.2in]{loss}} \caption{The loss of training and validation.} \label{loss} \end{figure} The training and validation loss are presented in Fig.~\ref{loss}. It is shown that the training loss values are decreasing to a point of stability and the optimized model fits well to the training data. Moreover, considering that also the validation loss is decreasing to a good extent, the model seems to perform adequately. However, it can be seen that the validation loss begins to slightly increase around the $80^\text{th}$ epoch. \highl{This can be a result of the data shuffling at each epoch. It could be the case that the random sampler has taken a more complex data at these epochs in comparison with the previous epochs. However, at this point} we expect the regularization method to modify the learning algorithm so that the model generalizes in the optimum way. \begin{figure}[t] \centerline{\includegraphics[width=3.2in]{errors}} \caption{The mean absolute error of positioning for the test points.} \label{errors} \end{figure} The mean absolute positioning error for the test point locations is presented in Fig.~\ref{errors}. \highl{The time required for our system to estimate the position of a test point by feeding one CSI sample to the network is $8 \ ms$.} It should be yet emphasized that the test data is collected at different locations compared to the training data, and thus, by enhancing the generalization of the network, it should be possible to reduce the positioning error. Although the network is able to consistently reduce the positioning error when increasing the number of epochs, it is seen that similarly as with the validation loss, the network struggles around the $80^\text{th}$ epoch. \highl{It seems that it took a few epochs for the regularization method to modify the learning algorithm and reduce the generalization error and achieve the consistent downward trend in test error.} In order to analyze the positioning errors at different map locations, the error distribution at each test point is illustrated in Fig. \ref{dist}. It is shown that in most of the points, the average error is below one meter. \highl{Considering that points number $1532$ and $1560$ are in NLOS conditions and the rest are in LOS conditions, one noticeable observation is that the proposed method works accurately also in NLOS conditions}. From the CSI perspective this is justified by the fact that the CSI is more unique per location in NLOS conditions compared to LOS-dominated scenarios, where nearby locations share similar multipath characteristics with only a slight power difference. Thus, on contrary to traditional positioning methods, machine learning based methods seem to naturally manage positioning in both LOS and NLOS conditions in the considered urban environment. \begin{figure}[h] \centerline{\includegraphics[width=3.2in]{dist}} \caption{\highl{The distribution of positioning errors at each test point.}} \label{dist} \end{figure} \section{Conclusion and Future Work} In this work, we have presented a deep learning-based position estimation method using 5G CSI fingerprints and beamforming technology for the first time in the literature. We have taken advantage of the neural networks to find the static single BS-based position of a UE in a specific outdoor area. The CSI fingerprints of 5G NR mmWave have been collected based on ray-tracing simulations. The results show that by using machine learning-based CSI fingerprinting with CNNs, it is possible to achieve a sub-meter positioning error regardless of the LOS condition of the channel. In the next steps of this research, \highl{ higher number of reference points in a wider area will be considered. Furthermore, }a mobile user positioning will be investigated by utilizing the time series and recurrent neural networks with measurements from several BSs.
\section{INTRODUCTION} Simulation is a crucial tool for accelerating the development of autonomous driving software because it can generate adversarial interactions for training autonomous driving policies, play out counterfactual scenarios of interest, and estimate safety-critical metrics. In this way, simulation reduces reliance on real-world data, which can be expensive and/or dangerous to collect. As autonomous vehicles share public roads with human drivers, cyclists, and pedestrians, the underlying simulation tools require realistic models of these human road users. Such models can be obtained by applying \emph{learning from demonstration} (LfD) \cite{Argall2009-um,Hussein2017-yk} to example trajectories of human road use collected using sensors (e.g., cameras and LIDAR) already mounted on cars on the road. Such demonstrations are ideally suited to learning the realistic road use behaviour needed for autonomous driving simulation. However, existing LfD methods such as behavioural cloning \cite{Pomerleau1989-kb,michie1990cognitive} and generative adversarial imitation learning \cite{Ho2016-zi} are typically insufficient for producing realistic models of human road users. Despite minimising their supervised or adversarial losses, the resulting policies frequently collide with other road users or drive off the road. To address this problem, we propose \emph{Symphony}, a new approach to LfD for autonomous driving simulation that can greatly improve the realism of the learned behaviour. A key idea behind Symphony is to combine conventional policies, represented as neural networks, with a \emph{parallel beam search} that refines these policies on the fly. As simulations are rolled out, Symphony prunes branches that are unfavourably evaluated by a \emph{discriminator} trained to distinguish agent behaviour from that in the data. Because the beam search is parallelised, promising branches are repeatedly forked, focusing computation on the most realistic rollouts. In addition, since the tree search is also performed during training, the pruning mechanism drives the agent towards more realistic states that increasingly challenge the discriminator. The results of each tree search can then be distilled back into the policy itself, yielding an adversarial algorithm. However, simply learning \emph{realistic} agents is not enough. They must also be \emph{diverse}, i.e., cover the entire distribution of realistic behaviour, in order to enable a full evaluation of autonomous driving software. Unfortunately, while the use of beam search improves realism, it tends to harm diversity: repeated pruning can encourage mode collapse, where only the easiest to simulate modes are represented. To address this issue, Symphony takes a hierarchical approach, factoring agent behaviour into \emph{goal generation} and \emph{goal conditioning}. For the former, we train a generative model that proposes goals in the form of routes, which capture high-level intent. For the latter, we train goal-conditional policies that modulate their behaviour based on a goal provided as input. Generating and conditioning on diverse goals ensures that agent diversity neither disappears during adversarial training nor is pruned away by the beam search. We evaluate Symphony agents with extensive experiments on run segments from the Waymo Open Motion Dataset \cite{DBLP:journals/corr/abs-2104-10133} and a proprietary Waymo dataset consisting of demonstration trajectories and their corresponding contexts, created by applying Waymo's perception tools to sensor data collected by Waymo vehicles driving on public roads. We report performance on several realism and diversity metrics, including a novel diversity metric called \emph{curvature Jensen-Shannon divergence} that indicates how well the high-level agent behaviour matches the empirical distribution. Our results confirm that combining beam search with hierarchy yields more realistic and diverse behaviour than several baselines. \section{Background} \subsection{Problem Setting} \label{sec:ps} The sequential process that generates the demonstration behaviour is multi-agent and general sum and can be modeled as a \emph{Markov game} \cite{littman1994markov} $\mathcal{G} = \{ \mathcal{S}, \mathcal{A}, P, \{r_i \} _{i=1}^N, \nu, \gamma \}$. $N$ is the number of agents; $\mathcal{S}$ is the state space; $\mathcal{A}$ is the action space of a given agent, (the same for all agents), such that the joint action and observation spaces are $\mathcal{A}^N$ and $\mathcal{Z}^N$; $\{r_i \} _{i=1}^N$ is the set of reward functions (one for each agent); $\nu$ is the initial state distribution; and $\gamma$ is a discount factor. The dynamics are described by a transition probability function $P(\boldsymbol{s}' | \boldsymbol{s}, \boldsymbol{a})$, where $\boldsymbol{a} \in \mathcal{A}^N$ is a joint action; $\boldsymbol{s} \in \mathcal{S}$ is also shown in bold because it factors similarly to $\boldsymbol{a}$. The agent's actions are determined by a joint policy $\boldsymbol{\pi}(\boldsymbol{a}_t | \boldsymbol{s}_{t})$ that is agent-wise factored, i.e., $\boldsymbol{\pi}(\boldsymbol{a}_t | \boldsymbol{s}_{t}) = \prod_{i=1}^N\pi^i(a^i_{t} | \boldsymbol{s}_t)$. To avoid superfluous formalism, we do not explicitly consider partial observability. However, this is easily modelled by masking certain state features in the encoders upon whose output the agents condition their actions. Because we have access to a simulator, the transition function is considered known. However, since we are learning from demonstration, the agents' reward functions are unknown. Furthermore, we do not even have access to sample rewards. Instead, we can merely observe the agents' behavior, yielding a dataset $\mathcal{D}_E = \{\tau_k\}_{k=1}^{K_E}$ of $K_E$ trajectories where $\tau_k = \{ (\boldsymbol{s}_{k,1}, \boldsymbol{a}_{k,1}), (\boldsymbol{s}_{k,2}, \boldsymbol{a}_{k,2}), \dots (\boldsymbol{s}_{k,T}, \boldsymbol{a}_{k,T}) \}$ is a trajectory generated by the `expert' joint policy $\boldsymbol{\pi}_E$. The goal of LfD is to set parameters $\theta$ such that a policy $\boldsymbol{\pi}_\theta$ matches $\boldsymbol{\pi}_E$ in some sense. In our case, the data consists of LIDAR and camera readings recorded from an \emph{ego vehicle} on public roads. It is partitioned into run segments and preprocessed by a perception system yielding the dataset $\mathcal{D}_E$. The states $\bs{s}_{k,t}$ and discrete actions $\bs{a}_{k,t}$ in each run segment are fit greedily to approximate the logged trajectory. Each state is a tuple containing three kinds of features. The first is static scene features $s^{SS}_k$ such as locations of lanes and sidewalks, including a \emph{roadgraph}, a set of interconnected lane regions with ancestor, descendant, and neighbour relationships that describes how agents can move, change lanes, and turn. The second is dynamic scene features $s^{DS}_{k,t}$ such as traffic light states. The third is features describing the position, velocity, and orientation of the $N$ agents. Together, these yield the tuple: $\boldsymbol{s}_{k,t} = \{ s^{SS}_k, s^{DS}_{k,t}, s^1_{k,t}, \ldots s^N_{k,t} \}$. By convention, $s^1_{k,t}$ is the state of the ego vehicle. Since agents can enter or leave the ego agent's field of view during a run segment, we zero-pad states for missing agents to maintain fixed dimensionality. To avoid the need to learn an explicit model of initial conditions, we couple each simulation to a \emph{reference trajectory}. Each agent $i$ is initialised to the corresponding $s^i_{k,1}$ after which it can either be a \emph{playback agent} that blindly replays the behaviour in the reference trajectory or an \emph{interactive agent} that responds dynamically to the unfolding simulation using a policy $\pi^i_\theta$ learned from demonstration. During a Symphony simulation, the state of an interactive agent is determined by sampling actions from its policy $\pi^i_\theta$ and propagating it through $P$. Given a reference trajectory $\tau$, this yields a new simulated trajectory $\tau'$ in which $s^{SS}_k$ and $s^{DS}_{k,t}$ remain as they were in the reference trajectory but the agent states $s^i_{k,t}$ of the $N_I$ interactive agents are altered. \subsection{Behavioural Cloning} \label{sec:bc} The simplest approach to LfD is \emph{behavioural cloning} (BC) \cite{Pomerleau1989-kb,michie1990cognitive}, which solves a supervised learning problem: $\mathcal{D}_E$ is interpreted as a labeled training set and $\boldsymbol{\pi}_\theta$ is trained to predict $\boldsymbol{a}_t$ given $\boldsymbol{s}_t$. If we take a maximum likelihood approach, then we can optimise $\theta$ as follows: \begin{equation} \label{eq:bc} \max_\theta \sum_{k=1}^{K_E}\sum_{t=1}^T\log\boldsymbol{\pi}_\theta(\boldsymbol{a}_{k,t}|\boldsymbol{s}_{k,t}). \end{equation} This approach is simple but limited. As it optimises only the conditional policy probabilities, it does not ensure that the underlying distribution of states visited by $\boldsymbol{\pi}_E$ and $\boldsymbol{\pi}_\theta$ match. Consequently it suffers from \emph{covariate shift} \cite{Ross2011-bp}, in which generalisation errors compound, leading $\boldsymbol{\pi}_\theta$ to states far from those visited by $\boldsymbol{\pi}_E$. \subsection{Generative Adversarial Imitation Learning} \label{sec:gail} BC is a \emph{strictly offline} method because it does not require interaction with an environment or simulator. Given $\mathcal{D}_E$, it simply estimates $\boldsymbol{\pi}_\theta$ offline using supervised learning. By contrast, most LfD methods are \emph{interactive}, repeatedly executing $\boldsymbol{\pi}_\theta$ in the environment and using the resulting trajectories to estimate a gradient with respect to $\theta$. Interactive methods include \emph{inverse reinforcement learning} \cite{Ng2000-wt,Abbeel2004-oi,ramachandran2007bayesian,Ziebart2008-ow} and adversarial methods such as \emph{generative adversarial imitation learning} (GAIL) \cite{Ho2016-zi}. GAIL borrows ideas from GANs \cite{Goodfellow2014-nm} and employs a \emph{discriminator} that is trained to distinguish between states and actions generated by the agents from those observed in $\mathcal{D}_E$. The discriminator is then used as a cost (i.e., negative reward) function by the agents, yielding increasingly log-like behaviour. In our multi-agent setting, the GAIL objective can be written as: \begin{equation} \label{eq:mgail} \min_{\boldsymbol{\theta}} \max_{\boldsymbol{\phi}} \Big[ \bb{E}_{\boldsymbol{s}\sim d_\theta}\log(D_\phi(\boldsymbol{s})) + \bb{E}_{\boldsymbol{s}^E\sim\mathcal{D}_E}\log(1-D_\phi(\boldsymbol{s}^E)) \Big], \end{equation} where $d_\theta$ is the distribution over states induced by $\boldsymbol{\pi}_\theta$ and $\mathcal{D}_E$ is here treated as an empirical distribution over states. Although the agents who generated $\mathcal{D}_E$ are not cooperative (as modelled by the different reward functions $\{r_i \} _{i=1}^N$ in $\mathcal{G}$), the learned agents controlled by $\boldsymbol{\pi}_\theta$ are cooperative because they all aim to minimise the same discriminator $D_\phi$, i.e., they share the goal of realistically imitating $\boldsymbol{\pi}_E$. Differentiating through $d_\theta$ is typically not possible because $P$ is unknown. Hence, updating $\theta$ requires using a score-function gradient estimator \cite{williams1992simple}, which suffers from high variance. However, in our setting, $P$ is both known and differentiable, so we can employ \emph{model-based GAIL} (MGAIL) \cite{baram2017end}, which exploits end-to-end differentiability by directly propagating gradients from $D_\phi$ to $\boldsymbol{\pi}_{\theta}$ through $P$. \section{SYMPHONY} Symphony is a new approach to LfD for autonomous driving simulation that builds upon a base method such as BC or MGAIL by adding a parallel beam search to improve realism and a hierarchical policy to ensure diversity. Figure \ref{fig:training} gives an overview of the training process for the case where the base method is BC. Training proceeds by sampling a batch of run segments from a training set $\mathcal{D}_{tr} \subset \mathcal{D}_E$ and using them as reference trajectories to perform new rollouts with the current policy. At the start of each rollout, a goal generating policy proposes a goal, based on initial conditions, that remains fixed for the rollout and is input to the goal-conditional policy that proposes actions. These actions are used to generate nodes in a parallel beam search (see Figure \ref{fig:tree_search}), which periodically prunes away branches deemed unfavourable by a discriminator and copies the rest to maintain a fixed-width beam. Unlike in model-predictive control \cite{garcia1989model} or reinforcement learning methods that employ online tree search, e.g., \cite{silver2016mastering,tesauro1996line}, in which an agent `imagines' various futures before selecting a single action, each rollout in Symphony is executed directly in the simulator. However, because simulations happen in parallel, promising branches can be duplicated during execution to replace unpromising ones, focusing computation on the most realistic rollouts. Finally, we use the resulting rollouts to compute losses and update the goal generating policy, the goal-conditional policy, and the discriminator. During inference at test time, the process is the same except that run segments are sampled from a test set $\mathcal{D}_{te}$ and no parameters are updated. In the rest of this section, we provide more details about the parallel beam search, hierarchical policy, network architectures, and learning rules. \begin{figure} \centering \includegraphics[width=1.03\columnwidth]{figs/training3.png} \caption{Interactive agent training when Symphony is based on BC (replay agents not shown).} \label{fig:training} \end{figure} \subsection{Parallel Beam Search} For each reference trajectory in the batch, we first sample $S$ actions from the joint policy, yielding $S$ branches that roll out in parallel. We then call the discriminator at each simulation step to score each of the $N_I$ interactive agents in each branch, yielding a tensor of dimension $[B, N_I, T_p, S]$ where $B$ is the batch size and $T_p$ is the number of time steps between pruning/resampling. After every $T_p$ simulation steps, we aggregate the discriminator scores across the time and interactive agent dimensions, yielding a tensor of shape $[B, S]$ containing a score for each sample in the batch. We aggregate by maximising across time and summing across agents. We then rank samples by aggregate score and prune away the top half (i.e., the least realistic). We tile the remaining samples such that $S$ remains constant throughout the simulation. We use $T_p=10$, i.e., pruning and resampling occurs every 2 seconds of simulation. During training, we use $S=4$ but during inference $S=16$. \begin{wrapfigure}{r}{0.55\columnwidth} \begin{center} \vspace{-6mm} \includegraphics[width=0.55\columnwidth]{figs/tree_search.png} \end{center} \caption{Beam search.} \vspace{-3mm} \label{fig:tree_search} \end{wrapfigure} Pruning based on aggregate scores means that the simulation at a given timestep can be subtly influenced by future events, i.e., actions are pruned away because they lead to unrealistic future states, and those states include observations of playback agents. In other problem settings, such as behaviour prediction \cite{lee2017desire,casas2018intentnet,DBLP:journals/corr/abs-1910-05449} such \emph{leakage} would be problematic because information about the future would not be available at inference time (the whole point is to predict the future given only the past). However, in our setting the reference trajectory is available even at inference time, i.e., the goal is simply to generate realistic and diverse simulations given the reference trajectory. While leakage can in principle yield useful hints, it can also be misleading as any leaked hints can become obsolete when interactive agents diverge from the reference trajectory. In practice, as we show in Section \ref{sec:main-res}, refining simulation on the fly through beam search can drastically improve realism but tends to harm diversity: repeated pruning can encourage mode collapse, where only the easiest to simulate modes are represented. Next we discuss a hierarchical approach to remedy this issue. \subsection{Hierarchical Policy} To mitigate mode collapse, we employ hierarchical agent policies. At the beginning of each rollout, a high-level \emph{goal generating policy} $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ proposes a goal $\bs{g}$, based on an initial state $\bs{s}_1$, that remains fixed throughout the rollouts and is provided to both the low-level \emph{goal-conditional} policy $\pi_{\bs{\theta}}(\bs{a}|\bs{s},\bs{g})$ and the discriminator $D_{\bs{\phi}}(\bs{s} | \bs{g})$. The goal generating policy is trained to match the distribution of goals in the training data: \begin{equation} \label{eq:goal_policy} \max_{\bs{\psi}} \mathbb{E}_{(\bs{s}^E_1, \bs{g}^E)\sim \mathcal{D}_E} \log h_{\bs{\psi}}(\bs{g}^E|\bs{s}^E_1). \end{equation} Because the same goal is used for all rollouts within the search tree, it cannot be biased by the discriminator. We use routes, represented as sequences of roadgraph lane segments, as goals because they capture high-level intent and are a primary source of multi-modality. A feasible set of routes is generated by following all roadgraph branches, beginning at the lane segment corresponding to the agent's initial state. From this set, routes with minimal displacement error from the observed trajectory are used as ground truth to train $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ and as input to $\pi_{\bs{\theta}}(\bs{a}|\bs{s}, \bs{g})$ during training. Hence, $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ and $\pi_{\bs{\theta}}(\bs{a}|\bs{s}$ can be seen as learned versions of the router and planner, respectively, in a conventional control stack. \subsection{Architecture and Learning} For each interactive agent, objects (such as other cars, pedestrians and cyclists), as well as static and dynamic features are all encoded individually using MLPs, followed by max-pooling across inputs of the same type. The resulting type-specific embeddings are, together with an encoding of features of the interactive agent, concatenated and provided to the policy head as input. Spatial information such as location or velocities of other objects are normalised with respect to the agent before being passed into the network. Furthermore, roads and lanes are represented as a set of points. In large scenes, only the nearest 16 objects and 1$K$ static and dynamic features are included. For BC, the goal-conditional policy head maps the concatenated embeddings to a $7\times 21$ action space of discretised accelerations and steering angles. For MGAIL, we use a continuous action space specifying $x$-$y$ displacement to facilitate end-to-end differentiation. The goal generating policy maps to softmax logits for each feasible route, up to a limit of 200 routes. The goal generating and goal-conditional policies use separate encoders. The discriminator uses a similar but simpler encoding by max-pooling across all objects and point features within 20 metres. We train both policies and the discriminator simultaneously. We train the goal generating policy using \cref{eq:goal_policy} and the discriminator using: \begin{equation*} \max_{\boldsymbol{\phi}} \Big[ \bb{E}_{\boldsymbol{s}\sim d_{TS}}\log(D_\phi(\boldsymbol{s})) + \bb{E}_{\boldsymbol{s}^E\sim\mathcal{D}_E}\log(1-D_\phi(\boldsymbol{s}^E)) \Big], \end{equation*} where $d_{TS}$ is generated by the tree search with $S$=4. We train the goal-conditional policy using either BC or MGAIL. In the case of BC, we increase its robustness to covariate shift by training not only on expert data, but also on additional data sampled from $d_{TS}$, i.e., the beam search is distilled back into the goal-conditional policy, yielding an adversarial method even without the use of MGAIL. Each training batch contains 16 run segments of 10 seconds each, for which actions are recomputed every 0.2 seconds. \section{RELATED WORK} \subsection{Coping with Covariate Shift} One way to address covariate shift in BC is to add actuator noise when demonstrations are performed, forcing the demonstrator to label a wider range of states \cite{laskey2017dart}. However, this requires intervening when demonstrations are collected, which is not possible in our setting. Another solution is DAgger \cite{Ross2011-bp}, where the demonstrator labels the states visited by the agent as it learns, which also requires access to the demonstrator that is not available in our setting. Adversarial methods such as GAIL and MGAIL avoid covariate shift by repeatedly trying policies in the environment and minimising a divergence between the resulting trajectories and the demonstrations. When the environment is not available, methods that match state distributions can retain BC's strictly offline feature while minimising covariate shift \cite{jarrett2020strictly}. However, in our setting, remaining strictly offline is not necessary as we have access to a high quality simulator that is itself the target environment for the learned agents. \subsection{Combining Planning and Learning} When a model of the environment dynamics $P(s’ | s, a)$ is available, deliberative \emph{planning} can help to predict the value of different actions. Model-based reinforcement learning typically uses planning during training to reduce the variance of value estimates. When the model is differentiable, this can also be exploited, as in MGAIL \cite{baram2017end,Baram2016-sq} to reduce the variance of gradient estimates \cite{Tamar2016-oq,lee2018gated,farquhar2018treeqn}. By contrast, online planning typically uses tree search to refine policies on the fly during inference by focusing computation on the most relevant states \cite{tesauro1996line, sutton2018reinforcement}. By distilling the results of the tree search back into the policy, online planning also serves as an extended policy improvement operation \cite{anthony2017thinking,silver2017mastering,silver2018general,brown2020combining,hamrick2020role,Schrittwieser_2020}. Recently, sequential decision making problems have been reformulated as auto-regressive models using transformer architectures \cite{chen2021decision}. Most related to Symphony is the Trajectory Transformer \cite{janner2021reinforcement}, which is fully differentiable and uses beam search but without a discriminator. \subsection{Autonomous Driving Applications} As early as 1989, ALVINN \cite{Pomerleau1989-kb}, a neural network trained with BC, autonomously controlled a vehicle on public roads. More recently, deep learning has been used to train autonomous driving software end-to-end with BC \cite{Bojarski-nvidia} and perturbation-based augmentations have been used to mitigate covariate shift \cite{chauffeurnet-bansal}. As simulation emerges as a crucial tool in autonomous driving, interest is turning to how to populate simulators with realistic agents. ViBe \cite{Behbahani2018-wu} learns such models from CCTV data collected at intersections, using GAIL but without the tree search or hierarchical components of Symphony. SimNet \cite{bergamini2021simnet} produces such models using only BC but uses GANs instead of reference trajectories to generate initial simulation conditions. TrafficSim \cite{suo2021trafficsim} also uses hierarchical control like Symphony but with a latent variable model and without a tree search for online refinement. AdvSim \cite{DBLP:journals/corr/abs-2101-06549} is similar but generates adversarial perturbations to challenge the full autonomous driving stack. Like Symphony, SMARTS \cite{zhou2020smarts} considers the realism and diversity of agents in a driving simulator, but employs only reinforcement learning, not LfD, to learn such agents. nuPlan \cite{DBLP:journals/corr/abs-2106-11810} is a planning benchmark that uses a set of reference trajectories but does not simulate agent observations, feeding the observations from the reference trajectory even if they diverge from the simulation. \section{EXPERIMENTS \& RESULTS} \subsection{Experimental Setup} \noindent {\bf Datasets.} We use two datasets. The first, a {\em proprietary dataset} created by applying Waymo’s perception tools to sensor data collected by Waymo vehicles driving on public roads, contains $1.1M$ run segments each with 30$s$ of features at 15$Hz$. The second dataset consists of $~64.5K$ run segments from the \emph{Waymo Open Motion Dataset} (WOMD) \cite{DBLP:journals/corr/abs-2104-10133}, which we extract to 10$s$ run segments sampled at 15$Hz$.\footnote{While we use the same run segments as the WOMD, states contain the features described in Section \ref{sec:ps}, not those in the WOMD.} Both datasets exclude run segments containing more than 256 playback agents, 10$K$ roadgraph points, or fewer than $N_I$ agents at the initial timestep. Unlike the proprietary dataset, WOMD's run segments were selected to contain pairwise interactions such as merges, lane changes, and intersection turns. Both datasets split the demonstration data $\mathcal{D}_E$ into disjoint sets $\mathcal{D}_{tr}$ and $\mathcal{D}_{te}$ with $K_{tr} = |\mathcal{D}_{tr}|$ and $K_{te} = |\mathcal{D}_{te}|$. For the proprietary dataset, $K_{tr}=1.1M$ and $K_{te}=10K$ and for the WOMD, $K_{tr}=58.1K$ and $K_{te}=6.4K$. \vspace{0.1cm}\noindent {\bf Simulation setup.} Unless stated otherwise, each simulation lasts for 10$s$, with initial conditions set by the reference trajectory and actions taken at 5$Hz$. Unless stated otherwise, the ego vehicle and one other vehicle are interactive, i.e., controlled by our learned policy, while the rest are playback agents. The interactive agent is chosen heuristically depending on the context, e.g., in merges it is the vehicle with which the ego vehicle is merging. If no such context applies, the nearest moving vehicle is chosen. \subsection{Metrics} We consider the following three realism metrics. {\bf Collision Rate} is the percent of run segments that contain at least one collision involving an interactive agent. A collision is detected when two bounding boxes overlap. {\bf Off-road Time} is the percent of time that an interactive agent spends off the road. {\bf ADE} is the average displacement error between each joint reference trajectory and the corresponding trajectory generated in simulation: \begin{equation*}\label{eq:minSADE} \textrm{ADE} = \frac{1}{K_{te}N_IT}\sum_{k=1}^{K_{te}} \Big[\sum_{i \in I} \sum^{T}_{t=1} \delta(s^i_{k,t}, s^{'i}_{k,t}) \Big], \end{equation*} where $I$ is the set of indices of the interactive agents, $s^{'i}_{k,t}$ and $s^i_{k,t}$ are the states of the $i$th interactive agents in the $k$th simulated and reference trajectories respectively, and $\delta$ is a Euclidean distance function. We also consider two diversity metrics. {\bf MinSADE} is the minimum scene-level average displacement error \cite{suo2021trafficsim}, which extends ADE to measure diversity instead of just realism. During evaluation, the simulator populates a set $\mathcal{R}_k$ by simulating $m$ trajectories for each reference trajectory $\tau_k$ in $\mathcal{D}_{te}$ and then computes minSADE as follows: \begin{equation*}\label{eq:minSADE} \textrm{minSADE} = \frac{1}{K_{te}N_IT}\sum_{k=1}^{K_{te}} \min_{\tau' \in \mathcal{R}_k} \Big[\sum_{i \in I} \sum^{T}_{t=1} \delta(s^i_{k,t}, s^{'i}_{k,t}) \Big], \end{equation*} When $m=1$, minSADE reduces to ADE; when $m>1$, minimising minSADE requires populating $\mathcal{R}_k$ with diverse but realistic trajectories. Our experiments use $m=16$. Low minSADE therefore implies good coverage of behaviour modes. However, it does not imply actually matching the empirical distribution of behaviours, e.g., low-probability modes may be over-represented. {\bf Curvature JSD} is a novel diversity metric that aims to measure how well the high-level behaviour matches the empirical distribution. It is computed using the roadgraph features in $s^{SS}_k$. Multiple lane regions that share a common ancestor are called \emph{branching regions} because they represent places where agents have multiple, branching choices, e.g., a lane approaching a four-way stop may branch into three descendant regions each going in a different direction at the intersection. For each branching region, we compute the average curvature across the region. The curvature JSD is then the Jensen-Shannon divergence between the distribution of average curvatures of the branching regions visited by the policy and reference trajectories. These distributions are approximated with histograms with bins of width $0.01$ in the range $[-1, 1]$, yielding $201$ bins. \begin{table*}[] \caption{Proprietary and Waymo Open Motion Dataset results and standard errors.} \label{tab:main} \renewcommand{\arraystretch}{1.2} \resizebox{\textwidth}{!}{ \begin{tabular}{l|ccccc|ccccc} \Xhline{2\arrayrulewidth} \multirow{3}{*}{Method} & \multicolumn{5}{c|}{Proprietary Dataset} & \multicolumn{5}{c}{Waymo Open Motion Dataset} \\ \cline{2-11} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} \\ \Xhline{2\arrayrulewidth} Playback & 0.99 & 0.40 & - & - & - & 3.04 & 0.96 & - & - & - \\ \hline BC & 16.65 {\scriptsize $\pm$0.41} & 2.16 {\scriptsize $\pm$0.08} & 5.80 {\scriptsize $\pm$0.07} & 2.16 {\scriptsize $\pm$0.04} & 2.82 {\scriptsize $\pm$0.26} & 24.65 {\scriptsize $\pm$0.32} & 2.75 {\scriptsize $\pm$0.12} & 4.81 {\scriptsize $\pm$0.10} & 1.76 {\scriptsize $\pm$0.04} & \bf 1.32 {\scriptsize $\pm$0.28} \\ BC + H & 17.25 {\scriptsize $\pm$1.07} & 1.69 {\scriptsize $\pm$0.12} & 5.18 {\scriptsize $\pm$0.09} & 2.01 {\scriptsize $\pm$0.03} & 1.38 {\scriptsize $\pm$0.11} & 23.27 {\scriptsize $\pm$0.38} & 2.40 {\scriptsize $\pm$0.05} & 4.38 {\scriptsize $\pm$0.04} & 1.67 {\scriptsize $\pm$0.03} & 3.50 {\scriptsize $\pm$1.25} \\ BC + TS & 1.84 {\scriptsize $\pm$0.13} & 0.35 {\scriptsize $\pm$0.03} & 4.83 {\scriptsize $\pm$0.09} & 2.07 {\scriptsize $\pm$0.04} & 5.28 {\scriptsize $\pm$1.14} & 4.94 {\scriptsize $\pm$0.65} & \bf 1.23 {\scriptsize $\pm$0.04} & 4.20 {\scriptsize $\pm$0.15} & 1.82 {\scriptsize $\pm$0.07} & 5.84 {\scriptsize $\pm$1.02} \\ BC + TS + H & \bf 1.80 {\scriptsize $\pm$0.07} & \bf 0.34 {\scriptsize $\pm$0.01} & \bf 4.30 {\scriptsize $\pm$0.05} & \bf 1.96 {\scriptsize $\pm$0.04} & \bf 1.24 {\scriptsize $\pm$0.14} & \bf 4.86 {\scriptsize $\pm$0.24} & 1.30 {\scriptsize $\pm$0.06} & \bf 3.70 {\scriptsize $\pm$0.09} & \bf 1.66 {\scriptsize $\pm$0.04} & 2.82 {\scriptsize $\pm$1.13} \\ \hline MGAIL & 5.34 {\scriptsize $\pm$0.32} & 0.83 {\scriptsize $\pm$0.08} & 7.32 {\scriptsize $\pm$0.52} & 3.95 {\scriptsize $\pm$0.42} & 1.88 {\scriptsize $\pm$0.18} & 9.48 {\scriptsize $\pm$0.91} & 1.62 {\scriptsize $\pm$0.15} & 5.70 {\scriptsize $\pm$0.44} & 3.13 {\scriptsize $\pm$0.26} & 4.14 {\scriptsize $\pm$1.36} \\ MGAIL + H & 4.16 {\scriptsize $\pm$0.18} & 0.76 {\scriptsize $\pm$0.03} & \bf 4.52 {\scriptsize $\pm$0.17} & \bf 2.48 {\scriptsize $\pm$0.09} & \bf 1.55 {\scriptsize $\pm$0.17} & 7.39 {\scriptsize $\pm$0.37} & 1.65 {\scriptsize $\pm$0.12} & \bf 3.82 {\scriptsize $\pm$0.12} & \bf 2.15 {\scriptsize $\pm$0.08} & 3.88 {\scriptsize $\pm$0.80} \\ MGAIL + TS & 2.97 {\scriptsize $\pm$0.16} & 0.72 {\scriptsize $\pm$0.20} & 6.83 {\scriptsize $\pm$0.48} & 3.80 {\scriptsize $\pm$0.39} & 4.14 {\scriptsize $\pm$1.08} & \bf 4.36 {\scriptsize $\pm$0.21} & \bf 1.22 {\scriptsize $\pm$0.02} & 4.26 {\scriptsize $\pm$0.19} & 2.51 {\scriptsize $\pm$0.11} & 5.42 {\scriptsize $\pm$1.26} \\ MGAIL + TS + H & \bf 2.40 {\scriptsize $\pm$0.19} & \bf 0.70 {\scriptsize $\pm$0.06} & 4.69 {\scriptsize $\pm$0.15} & 2.73 {\scriptsize $\pm$0.12} & 2.35 {\scriptsize $\pm$0.53} & 4.89 {\scriptsize $\pm$0.38} & 1.65 {\scriptsize $\pm$0.25} & 3.86 {\scriptsize $\pm$0.17} & 2.22 {\scriptsize $\pm$0.13} & \bf 2.80 {\scriptsize $\pm$0.60} \\ \Xhline{2\arrayrulewidth} \end{tabular}} \end{table*} \begin{table*}[] \caption{Proprietary dataset results and standard errors with 20 second rollouts and 8 interactive agents.} \label{tab:long-more} \renewcommand{\arraystretch}{1.2} \resizebox{\textwidth}{!}{ \begin{tabular}{l|ccccc|ccccc} \Xhline{2\arrayrulewidth} \multirow{3}{*}{Method} & \multicolumn{5}{c|}{Longer Rollouts (20 seconds)} & \multicolumn{5}{c}{More Interactive Agents ($N_I=8$)} \\ \cline{2-11} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} \\ \Xhline{2\arrayrulewidth} Playback & 2.38 & 0.47 & - & - & - & 2.37 & 0.22 & - & - & - \\ \hline BC & 25.56 {\scriptsize $\pm$0.69} & 2.99 {\scriptsize $\pm$0.09} & 11.60 {\scriptsize $\pm$0.21} & 4.08 {\scriptsize $\pm$0.05} & \bf 2.61 {\scriptsize $\pm$0.20} & 17.46 {\scriptsize $\pm$0.79} & 1.06 {\scriptsize $\pm$0.15} & 6.40 {\scriptsize $\pm$0.51} & 1.86 {\scriptsize $\pm$0.14} & 1.49 {\scriptsize $\pm$0.25} \\ BC + H & 30.33 {\scriptsize $\pm$0.56} & 3.14 {\scriptsize $\pm$0.22} & 9.83 {\scriptsize $\pm$0.18} & 3.83 {\scriptsize $\pm$0.05} & 4.17 {\scriptsize $\pm$0.37} & 18.60 {\scriptsize $\pm$0.81} & 0.95 {\scriptsize $\pm$0.06} & 5.85 {\scriptsize $\pm$0.08} & \bf 1.83 {\scriptsize $\pm$0.08} & 1.73 {\scriptsize $\pm$0.36} \\ BC + TS & \bf 6.05 {\scriptsize $\pm$0.31} & 0.72 {\scriptsize $\pm$0.10} & 8.92 {\scriptsize $\pm$0.30} & 3.97 {\scriptsize $\pm$0.11} & 4.90 {\scriptsize $\pm$0.59} & \bf 4.17 {\scriptsize $\pm$0.23} & 0.38 {\scriptsize $\pm$0.02} & 6.22 {\scriptsize $\pm$0.38} & 2.10 {\scriptsize $\pm$0.20} & 2.76 {\scriptsize $\pm$0.50} \\ BC + TS + H & 7.76 {\scriptsize $\pm$0.12} & \bf 0.66 {\scriptsize $\pm$0.02} & \bf 7.74 {\scriptsize $\pm$0.15} & \bf 3.72 {\scriptsize $\pm$0.09} & 2.69 {\scriptsize $\pm$0.22} & 5.18 {\scriptsize $\pm$0.24} & \bf 0.36 {\scriptsize $\pm$0.03} & \bf 5.68 {\scriptsize $\pm$0.16} & 2.03 {\scriptsize $\pm$0.05} & \bf 0.96 {\scriptsize $\pm$0.12} \\ \hline MGAIL & 14.15 {\scriptsize $\pm$0.83} & 1.03 {\scriptsize $\pm$0.19} & 14.18 {\scriptsize $\pm$0.97} & 9.34 {\scriptsize $\pm$0.45} & 6.79 {\scriptsize $\pm$1.70} & 11.08 {\scriptsize $\pm$1.29} & 0.47 {\scriptsize $\pm$0.02} & 12.30 {\scriptsize $\pm$0.62} & 6.55 {\scriptsize $\pm$0.65} & 4.14 {\scriptsize $\pm$1.06} \\ MGAIL + H & 14.73 {\scriptsize $\pm$1.93} & 1.72 {\scriptsize $\pm$0.24} & 10.52 {\scriptsize $\pm$1.17} & 6.58 {\scriptsize $\pm$0.60} & 3.09 {\scriptsize $\pm$0.62} & 6.79 {\scriptsize $\pm$0.11} & 0.37 {\scriptsize $\pm$0.03} & 5.74 {\scriptsize $\pm$0.34} & 2.80 {\scriptsize $\pm$0.26} & 1.61 {\scriptsize $\pm$0.40} \\ MGAIL + TS & 10.52 {\scriptsize $\pm$0.94} & 0.99 {\scriptsize $\pm$0.03} & 15.76 {\scriptsize $\pm$1.17} & 11.80 {\scriptsize $\pm$1.22} & 5.93 {\scriptsize $\pm$0.71} & 9.50 {\scriptsize $\pm$0.93} & 0.51 {\scriptsize $\pm$0.06} & 7.46 {\scriptsize $\pm$0.79} & 3.66 {\scriptsize $\pm$0.53} & 2.65 {\scriptsize $\pm$0.41} \\ MGAIL + TS + H & \bf 7.81 {\scriptsize $\pm$0.78} & \bf 0.88 {\scriptsize $\pm$0.03} & \bf 9.11 {\scriptsize $\pm$0.73} & \bf 6.39 {\scriptsize $\pm$0.64} & \bf 2.66 {\scriptsize $\pm$0.59} & \bf 5.80 {\scriptsize $\pm$0.47} & \bf 0.36 {\scriptsize $\pm$0.02} & \bf 5.47 {\scriptsize $\pm$0.07} & \bf 2.69 {\scriptsize $\pm$0.04} & \bf 1.24 {\scriptsize $\pm$0.15} \\ \Xhline{2\arrayrulewidth} \end{tabular}} \end{table*} \subsection{Results} \label{sec:main-res} \begin{figure}[t] \captionsetup[subfigure]{justification=centering} \begin{center} \subfloat[Proprietary Dataset.]{\label{fig:speed_dist} \includegraphics[width=0.47\columnwidth]{figs/plots/hist_main.png} } \subfloat[Waymo Open Motion Dataset.] {\label{fig:diversity} \includegraphics[width=0.429\columnwidth]{figs/plots/hist_open.png} } \end{center} \caption{Histograms for distribution of curvature metrics.} \label{fig:dist} \end{figure} We compare BC and MGAIL as is, with hierarchy (BC+H, MGAIL+H), with tree search (BC+TS, MGAIL+TS), and with both (BC+TS+H, MGAIL+TS+H). We train each method for $70K$ update steps with run segments sampled uniformly from $K_{tr}$ and save checkpoints every $2K$ steps. We then select the checkpoint with the lowest sum of collision rate and off-road time on a validation set of 200 run segments and test it using all of $K_{te}$. For each run segment in $K_{te}$, we generate 16 rollouts and report the average (or minimum for minSADE). We average all results over five independent seeds per method. For each metric, we indicate the best performing BC and MGAIL methods in bold. For collision rate and off-road time, we also report values for playing back the logs without interactive agents but computing these metrics for the agents that would have been interactive. These values are slightly positive due to, e.g., perception errors on objects far from the ego vehicle or the use of bounding boxes instead of contours. Table \ref{tab:main} shows our main results, comparing all methods across all metrics on both datasets. Comparing BC methods first, it is clear that tree search dramatically improves realism (especially with respect to collision rate and off-road time) but reduces diversity due to mode collapse. This loss is detected by curvature JSD, which measures distribution matching, but not by minSADE, which only requires coverage. However, the addition of hierarchy improves diversity in nearly all cases. In particular, hierarchy is crucial for addressing the mode collapse from tree search. BC+TS+H is the only BC method that gets the best of both worlds with strong performance on both realism and diversity metrics. Figure \ref{fig:dist} shows the histograms used to compute the curvature JSD values in Table \ref{tab:main} for three BC methods, with learned policies in orange and the log reference trajectories in blue. While BC matches distributions well, adding tree search leads to under-representation of positive curvature, i.e., right turns, a deficiency repaired with hierarchical policies. Turning now to MGAIL methods, similar trends emerge. Tree search improves realism, though the effect is less dramatic as MGAIL is already adversarial even without tree search. Similarly, while tree search also increases curvature JSD in MGAIL, the effect is smaller. This is also to be expected given that MGAIL is already adversarial and can thus experience mode collapse even without tree search. On both datasets, the addition of hierarchy substantially improves MGAIL's diversity metrics. Overall, the best BC methods perform better than the best MGAIL methods on nearly all metrics, though the differences are modest. To see if we can maintain realism for longer time horizons, we repeat our experiments on the proprietary dataset with the rollout length doubled to 20$s$ in both training and testing. The left side of Table \ref{tab:long-more} shows the results. As expected, all methods obtain higher values on nearly all metrics in this more challenging setup. However, the relative performance of the methods remains similar to that shown in Table \ref{tab:main}. Tree search methods perform much better with respect to realism than those without. While longer rollouts give more time to accumulate error, tree search repeatedly prunes problematic rollouts, greatly mitigating this effect. BC+TS has worse curvature JSD than BC but the use of hierarchy prevents mode collapse, enabling BC+TS+H to approach the best of both worlds. MGAIL shows less diversity loss from tree search than BC (only moderately worse minSADE) but also sees much better diversity when hierarchy is used. To assess whether we can maintain realism when more agents are replaced, we repeat our experiments on the proprietary dataset with eight interactive agents ($N_I=8$) in both training and testing. Two agents are selected as before and an additional six are selected that are nearest to the ego vehicle and whose distance traveled in the reference trajectory exceeds a threshold. Again, all methods obtain higher values on most metrics, as with the longer rollouts discussed above. Relative performance remains similar, with tree search improving realism but harming diversity and hierarchy improving diversity. In this case, MGAIL sees no loss of diversity from tree search, as any mode collapse already happens in MGAIL training, but still sees substantial diversity improvements when hierarchy is used. \section{CONCLUSIONS \& FUTURE WORK} This paper presented Symphony, which learns realistic and diverse simulated agents and performs parallel multi-agent simulations with them. Symphony is data driven and combines hierarchical policies with a parallel beam search. Experiments on both open and proprietary Waymo data confirmed that Symphony learns more realistic and diverse behaviour than a number of baselines. Future work will investigate alternative pruning rules to shape simulation to various ends, augmenting goals to model driver persona, and developing additional diversity metrics that capture distributional realism in, e.g., agents' aggregate pass/yield behaviour. \section{INTRODUCTION} Simulation is a crucial tool for accelerating the development of autonomous driving software because it can generate adversarial interactions for training autonomous driving policies, play out counterfactual scenarios of interest, and estimate safety-critical metrics. In this way, simulation reduces reliance on real-world data, which can be expensive and/or dangerous to collect. As autonomous vehicles share public roads with human drivers, cyclists, and pedestrians, the underlying simulation tools require realistic models of these human road users. Such models can be obtained by applying \emph{learning from demonstration} (LfD) \cite{Argall2009-um,Hussein2017-yk} to example trajectories of human road use collected using sensors (e.g., cameras and LIDAR) already mounted on cars on the road. Such demonstrations are ideally suited to learning the realistic road use behaviour needed for autonomous driving simulation. However, existing LfD methods such as behavioural cloning \cite{Pomerleau1989-kb,michie1990cognitive} and generative adversarial imitation learning \cite{Ho2016-zi} are typically insufficient for producing realistic models of human road users. Despite minimising their supervised or adversarial losses, the resulting policies frequently collide with other road users or drive off the road. To address this problem, we propose \emph{Symphony}, a new approach to LfD for autonomous driving simulation that can greatly improve the realism of the learned behaviour. A key idea behind Symphony is to combine conventional policies, represented as neural networks, with a \emph{parallel beam search} that refines these policies on the fly. As simulations are rolled out, Symphony prunes branches that are unfavourably evaluated by a \emph{discriminator} trained to distinguish agent behaviour from that in the data. Because the beam search is parallelised, promising branches are repeatedly forked, focusing computation on the most realistic rollouts. In addition, since the tree search is also performed during training, the pruning mechanism drives the agent towards more realistic states that increasingly challenge the discriminator. The results of each tree search can then be distilled back into the policy itself, yielding an adversarial algorithm. However, simply learning \emph{realistic} agents is not enough. They must also be \emph{diverse}, i.e., cover the entire distribution of realistic behaviour, in order to enable a full evaluation of autonomous driving software. Unfortunately, while the use of beam search improves realism, it tends to harm diversity: repeated pruning can encourage mode collapse, where only the easiest to simulate modes are represented. To address this issue, Symphony takes a hierarchical approach, factoring agent behaviour into \emph{goal generation} and \emph{goal conditioning}. For the former, we train a generative model that proposes goals in the form of routes, which capture high-level intent. For the latter, we train goal-conditional policies that modulate their behaviour based on a goal provided as input. Generating and conditioning on diverse goals ensures that agent diversity neither disappears during adversarial training nor is pruned away by the beam search. We evaluate Symphony agents with extensive experiments on run segments from the Waymo Open Motion Dataset \cite{DBLP:journals/corr/abs-2104-10133} and a proprietary Waymo dataset consisting of demonstration trajectories and their corresponding contexts, created by applying Waymo's perception tools to sensor data collected by Waymo vehicles driving on public roads. We report performance on several realism and diversity metrics, including a novel diversity metric called \emph{curvature Jensen-Shannon divergence} that indicates how well the high-level agent behaviour matches the empirical distribution. Our results confirm that combining beam search with hierarchy yields more realistic and diverse behaviour than several baselines. \section{Background} \subsection{Problem Setting} \label{sec:ps} The sequential process that generates the demonstration behaviour is multi-agent and general sum and can be modeled as a \emph{Markov game} \cite{littman1994markov} $\mathcal{G} = \{ \mathcal{S}, \mathcal{A}, P, \{r_i \} _{i=1}^N, \nu, \gamma \}$. $N$ is the number of agents; $\mathcal{S}$ is the state space; $\mathcal{A}$ is the action space of a given agent, (the same for all agents), such that the joint action and observation spaces are $\mathcal{A}^N$ and $\mathcal{Z}^N$; $\{r_i \} _{i=1}^N$ is the set of reward functions (one for each agent); $\nu$ is the initial state distribution; and $\gamma$ is a discount factor. The dynamics are described by a transition probability function $P(\boldsymbol{s}' | \boldsymbol{s}, \boldsymbol{a})$, where $\boldsymbol{a} \in \mathcal{A}^N$ is a joint action; $\boldsymbol{s} \in \mathcal{S}$ is also shown in bold because it factors similarly to $\boldsymbol{a}$. The agent's actions are determined by a joint policy $\boldsymbol{\pi}(\boldsymbol{a}_t | \boldsymbol{s}_{t})$ that is agent-wise factored, i.e., $\boldsymbol{\pi}(\boldsymbol{a}_t | \boldsymbol{s}_{t}) = \prod_{i=1}^N\pi^i(a^i_{t} | \boldsymbol{s}_t)$. To avoid superfluous formalism, we do not explicitly consider partial observability. However, this is easily modelled by masking certain state features in the encoders upon whose output the agents condition their actions. Because we have access to a simulator, the transition function is considered known. However, since we are learning from demonstration, the agents' reward functions are unknown. Furthermore, we do not even have access to sample rewards. Instead, we can merely observe the agents' behavior, yielding a dataset $\mathcal{D}_E = \{\tau_k\}_{k=1}^{K_E}$ of $K_E$ trajectories where $\tau_k = \{ (\boldsymbol{s}_{k,1}, \boldsymbol{a}_{k,1}), (\boldsymbol{s}_{k,2}, \boldsymbol{a}_{k,2}), \dots (\boldsymbol{s}_{k,T}, \boldsymbol{a}_{k,T}) \}$ is a trajectory generated by the `expert' joint policy $\boldsymbol{\pi}_E$. The goal of LfD is to set parameters $\theta$ such that a policy $\boldsymbol{\pi}_\theta$ matches $\boldsymbol{\pi}_E$ in some sense. In our case, the data consists of LIDAR and camera readings recorded from an \emph{ego vehicle} on public roads. It is partitioned into run segments and preprocessed by a perception system yielding the dataset $\mathcal{D}_E$. The states $\bs{s}_{k,t}$ and discrete actions $\bs{a}_{k,t}$ in each run segment are fit greedily to approximate the logged trajectory. Each state is a tuple containing three kinds of features. The first is static scene features $s^{SS}_k$ such as locations of lanes and sidewalks, including a \emph{roadgraph}, a set of interconnected lane regions with ancestor, descendant, and neighbour relationships that describes how agents can move, change lanes, and turn. The second is dynamic scene features $s^{DS}_{k,t}$ such as traffic light states. The third is features describing the position, velocity, and orientation of the $N$ agents. Together, these yield the tuple: $\boldsymbol{s}_{k,t} = \{ s^{SS}_k, s^{DS}_{k,t}, s^1_{k,t}, \ldots s^N_{k,t} \}$. By convention, $s^1_{k,t}$ is the state of the ego vehicle. Since agents can enter or leave the ego agent's field of view during a run segment, we zero-pad states for missing agents to maintain fixed dimensionality. To avoid the need to learn an explicit model of initial conditions, we couple each simulation to a \emph{reference trajectory}. Each agent $i$ is initialised to the corresponding $s^i_{k,1}$ after which it can either be a \emph{playback agent} that blindly replays the behaviour in the reference trajectory or an \emph{interactive agent} that responds dynamically to the unfolding simulation using a policy $\pi^i_\theta$ learned from demonstration. During a Symphony simulation, the state of an interactive agent is determined by sampling actions from its policy $\pi^i_\theta$ and propagating it through $P$. Given a reference trajectory $\tau$, this yields a new simulated trajectory $\tau'$ in which $s^{SS}_k$ and $s^{DS}_{k,t}$ remain as they were in the reference trajectory but the agent states $s^i_{k,t}$ of the $N_I$ interactive agents are altered. \subsection{Behavioural Cloning} \label{sec:bc} The simplest approach to LfD is \emph{behavioural cloning} (BC) \cite{Pomerleau1989-kb,michie1990cognitive}, which solves a supervised learning problem: $\mathcal{D}_E$ is interpreted as a labeled training set and $\boldsymbol{\pi}_\theta$ is trained to predict $\boldsymbol{a}_t$ given $\boldsymbol{s}_t$. If we take a maximum likelihood approach, then we can optimise $\theta$ as follows: \begin{equation} \label{eq:bc} \max_\theta \sum_{k=1}^{K_E}\sum_{t=1}^T\log\boldsymbol{\pi}_\theta(\boldsymbol{a}_{k,t}|\boldsymbol{s}_{k,t}). \end{equation} This approach is simple but limited. As it optimises only the conditional policy probabilities, it does not ensure that the underlying distribution of states visited by $\boldsymbol{\pi}_E$ and $\boldsymbol{\pi}_\theta$ match. Consequently it suffers from \emph{covariate shift} \cite{Ross2011-bp}, in which generalisation errors compound, leading $\boldsymbol{\pi}_\theta$ to states far from those visited by $\boldsymbol{\pi}_E$. \subsection{Generative Adversarial Imitation Learning} \label{sec:gail} BC is a \emph{strictly offline} method because it does not require interaction with an environment or simulator. Given $\mathcal{D}_E$, it simply estimates $\boldsymbol{\pi}_\theta$ offline using supervised learning. By contrast, most LfD methods are \emph{interactive}, repeatedly executing $\boldsymbol{\pi}_\theta$ in the environment and using the resulting trajectories to estimate a gradient with respect to $\theta$. Interactive methods include \emph{inverse reinforcement learning} \cite{Ng2000-wt,Abbeel2004-oi,ramachandran2007bayesian,Ziebart2008-ow} and adversarial methods such as \emph{generative adversarial imitation learning} (GAIL) \cite{Ho2016-zi}. GAIL borrows ideas from GANs \cite{Goodfellow2014-nm} and employs a \emph{discriminator} that is trained to distinguish between states and actions generated by the agents from those observed in $\mathcal{D}_E$. The discriminator is then used as a cost (i.e., negative reward) function by the agents, yielding increasingly log-like behaviour. In our multi-agent setting, the GAIL objective can be written as: \begin{equation} \label{eq:mgail} \min_{\boldsymbol{\theta}} \max_{\boldsymbol{\phi}} \Big[ \bb{E}_{\boldsymbol{s}\sim d_\theta}\log(D_\phi(\boldsymbol{s})) + \bb{E}_{\boldsymbol{s}^E\sim\mathcal{D}_E}\log(1-D_\phi(\boldsymbol{s}^E)) \Big], \end{equation} where $d_\theta$ is the distribution over states induced by $\boldsymbol{\pi}_\theta$ and $\mathcal{D}_E$ is here treated as an empirical distribution over states. Although the agents who generated $\mathcal{D}_E$ are not cooperative (as modelled by the different reward functions $\{r_i \} _{i=1}^N$ in $\mathcal{G}$), the learned agents controlled by $\boldsymbol{\pi}_\theta$ are cooperative because they all aim to minimise the same discriminator $D_\phi$, i.e., they share the goal of realistically imitating $\boldsymbol{\pi}_E$. Differentiating through $d_\theta$ is typically not possible because $P$ is unknown. Hence, updating $\theta$ requires using a score-function gradient estimator \cite{williams1992simple}, which suffers from high variance. However, in our setting, $P$ is both known and differentiable, so we can employ \emph{model-based GAIL} (MGAIL) \cite{baram2017end}, which exploits end-to-end differentiability by directly propagating gradients from $D_\phi$ to $\boldsymbol{\pi}_{\theta}$ through $P$. \section{SYMPHONY} Symphony is a new approach to LfD for autonomous driving simulation that builds upon a base method such as BC or MGAIL by adding a parallel beam search to improve realism and a hierarchical policy to ensure diversity. Figure \ref{fig:training} gives an overview of the training process for the case where the base method is BC. Training proceeds by sampling a batch of run segments from a training set $\mathcal{D}_{tr} \subset \mathcal{D}_E$ and using them as reference trajectories to perform new rollouts with the current policy. At the start of each rollout, a goal generating policy proposes a goal, based on initial conditions, that remains fixed for the rollout and is input to the goal-conditional policy that proposes actions. These actions are used to generate nodes in a parallel beam search (see Figure \ref{fig:tree_search}), which periodically prunes away branches deemed unfavourable by a discriminator and copies the rest to maintain a fixed-width beam. Unlike in model-predictive control \cite{garcia1989model} or reinforcement learning methods that employ online tree search, e.g., \cite{silver2016mastering,tesauro1996line}, in which an agent `imagines' various futures before selecting a single action, each rollout in Symphony is executed directly in the simulator. However, because simulations happen in parallel, promising branches can be duplicated during execution to replace unpromising ones, focusing computation on the most realistic rollouts. Finally, we use the resulting rollouts to compute losses and update the goal generating policy, the goal-conditional policy, and the discriminator. During inference at test time, the process is the same except that run segments are sampled from a test set $\mathcal{D}_{te}$ and no parameters are updated. In the rest of this section, we provide more details about the parallel beam search, hierarchical policy, network architectures, and learning rules. \begin{figure} \centering \includegraphics[width=1.03\columnwidth]{figs/training3.png} \caption{Interactive agent training when Symphony is based on BC (replay agents not shown).} \label{fig:training} \end{figure} \subsection{Parallel Beam Search} For each reference trajectory in the batch, we first sample $S$ actions from the joint policy, yielding $S$ branches that roll out in parallel. We then call the discriminator at each simulation step to score each of the $N_I$ interactive agents in each branch, yielding a tensor of dimension $[B, N_I, T_p, S]$ where $B$ is the batch size and $T_p$ is the number of time steps between pruning/resampling. After every $T_p$ simulation steps, we aggregate the discriminator scores across the time and interactive agent dimensions, yielding a tensor of shape $[B, S]$ containing a score for each sample in the batch. We aggregate by maximising across time and summing across agents. We then rank samples by aggregate score and prune away the top half (i.e., the least realistic). We tile the remaining samples such that $S$ remains constant throughout the simulation. We use $T_p=10$, i.e., pruning and resampling occurs every 2 seconds of simulation. During training, we use $S=4$ but during inference $S=16$. \begin{wrapfigure}{r}{0.55\columnwidth} \begin{center} \vspace{-6mm} \includegraphics[width=0.55\columnwidth]{figs/tree_search.png} \end{center} \caption{Beam search.} \vspace{-3mm} \label{fig:tree_search} \end{wrapfigure} Pruning based on aggregate scores means that the simulation at a given timestep can be subtly influenced by future events, i.e., actions are pruned away because they lead to unrealistic future states, and those states include observations of playback agents. In other problem settings, such as behaviour prediction \cite{lee2017desire,casas2018intentnet,DBLP:journals/corr/abs-1910-05449} such \emph{leakage} would be problematic because information about the future would not be available at inference time (the whole point is to predict the future given only the past). However, in our setting the reference trajectory is available even at inference time, i.e., the goal is simply to generate realistic and diverse simulations given the reference trajectory. While leakage can in principle yield useful hints, it can also be misleading as any leaked hints can become obsolete when interactive agents diverge from the reference trajectory. In practice, as we show in Section \ref{sec:main-res}, refining simulation on the fly through beam search can drastically improve realism but tends to harm diversity: repeated pruning can encourage mode collapse, where only the easiest to simulate modes are represented. Next we discuss a hierarchical approach to remedy this issue. \subsection{Hierarchical Policy} To mitigate mode collapse, we employ hierarchical agent policies. At the beginning of each rollout, a high-level \emph{goal generating policy} $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ proposes a goal $\bs{g}$, based on an initial state $\bs{s}_1$, that remains fixed throughout the rollouts and is provided to both the low-level \emph{goal-conditional} policy $\pi_{\bs{\theta}}(\bs{a}|\bs{s},\bs{g})$ and the discriminator $D_{\bs{\phi}}(\bs{s} | \bs{g})$. The goal generating policy is trained to match the distribution of goals in the training data: \begin{equation} \label{eq:goal_policy} \max_{\bs{\psi}} \mathbb{E}_{(\bs{s}^E_1, \bs{g}^E)\sim \mathcal{D}_E} \log h_{\bs{\psi}}(\bs{g}^E|\bs{s}^E_1). \end{equation} Because the same goal is used for all rollouts within the search tree, it cannot be biased by the discriminator. We use routes, represented as sequences of roadgraph lane segments, as goals because they capture high-level intent and are a primary source of multi-modality. A feasible set of routes is generated by following all roadgraph branches, beginning at the lane segment corresponding to the agent's initial state. From this set, routes with minimal displacement error from the observed trajectory are used as ground truth to train $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ and as input to $\pi_{\bs{\theta}}(\bs{a}|\bs{s}, \bs{g})$ during training. Hence, $h_{\bs{\psi}}(\bs{g}|\bs{s}_1)$ and $\pi_{\bs{\theta}}(\bs{a}|\bs{s}$ can be seen as learned versions of the router and planner, respectively, in a conventional control stack. \subsection{Architecture and Learning} For each interactive agent, objects (such as other cars, pedestrians and cyclists), as well as static and dynamic features are all encoded individually using MLPs, followed by max-pooling across inputs of the same type. The resulting type-specific embeddings are, together with an encoding of features of the interactive agent, concatenated and provided to the policy head as input. Spatial information such as location or velocities of other objects are normalised with respect to the agent before being passed into the network. Furthermore, roads and lanes are represented as a set of points. In large scenes, only the nearest 16 objects and 1$K$ static and dynamic features are included. For BC, the goal-conditional policy head maps the concatenated embeddings to a $7\times 21$ action space of discretised accelerations and steering angles. For MGAIL, we use a continuous action space specifying $x$-$y$ displacement to facilitate end-to-end differentiation. The goal generating policy maps to softmax logits for each feasible route, up to a limit of 200 routes. The goal generating and goal-conditional policies use separate encoders. The discriminator uses a similar but simpler encoding by max-pooling across all objects and point features within 20 metres. We train both policies and the discriminator simultaneously. We train the goal generating policy using \cref{eq:goal_policy} and the discriminator using: \begin{equation*} \max_{\boldsymbol{\phi}} \Big[ \bb{E}_{\boldsymbol{s}\sim d_{TS}}\log(D_\phi(\boldsymbol{s})) + \bb{E}_{\boldsymbol{s}^E\sim\mathcal{D}_E}\log(1-D_\phi(\boldsymbol{s}^E)) \Big], \end{equation*} where $d_{TS}$ is generated by the tree search with $S$=4. We train the goal-conditional policy using either BC or MGAIL. In the case of BC, we increase its robustness to covariate shift by training not only on expert data, but also on additional data sampled from $d_{TS}$, i.e., the beam search is distilled back into the goal-conditional policy, yielding an adversarial method even without the use of MGAIL. Each training batch contains 16 run segments of 10 seconds each, for which actions are recomputed every 0.2 seconds. \section{RELATED WORK} \subsection{Coping with Covariate Shift} One way to address covariate shift in BC is to add actuator noise when demonstrations are performed, forcing the demonstrator to label a wider range of states \cite{laskey2017dart}. However, this requires intervening when demonstrations are collected, which is not possible in our setting. Another solution is DAgger \cite{Ross2011-bp}, where the demonstrator labels the states visited by the agent as it learns, which also requires access to the demonstrator that is not available in our setting. Adversarial methods such as GAIL and MGAIL avoid covariate shift by repeatedly trying policies in the environment and minimising a divergence between the resulting trajectories and the demonstrations. When the environment is not available, methods that match state distributions can retain BC's strictly offline feature while minimising covariate shift \cite{jarrett2020strictly}. However, in our setting, remaining strictly offline is not necessary as we have access to a high quality simulator that is itself the target environment for the learned agents. \subsection{Combining Planning and Learning} When a model of the environment dynamics $P(s’ | s, a)$ is available, deliberative \emph{planning} can help to predict the value of different actions. Model-based reinforcement learning typically uses planning during training to reduce the variance of value estimates. When the model is differentiable, this can also be exploited, as in MGAIL \cite{baram2017end,Baram2016-sq} to reduce the variance of gradient estimates \cite{Tamar2016-oq,lee2018gated,farquhar2018treeqn}. By contrast, online planning typically uses tree search to refine policies on the fly during inference by focusing computation on the most relevant states \cite{tesauro1996line, sutton2018reinforcement}. By distilling the results of the tree search back into the policy, online planning also serves as an extended policy improvement operation \cite{anthony2017thinking,silver2017mastering,silver2018general,brown2020combining,hamrick2020role,Schrittwieser_2020}. Recently, sequential decision making problems have been reformulated as auto-regressive models using transformer architectures \cite{chen2021decision}. Most related to Symphony is the Trajectory Transformer \cite{janner2021reinforcement}, which is fully differentiable and uses beam search but without a discriminator. \subsection{Autonomous Driving Applications} As early as 1989, ALVINN \cite{Pomerleau1989-kb}, a neural network trained with BC, autonomously controlled a vehicle on public roads. More recently, deep learning has been used to train autonomous driving software end-to-end with BC \cite{Bojarski-nvidia} and perturbation-based augmentations have been used to mitigate covariate shift \cite{chauffeurnet-bansal}. As simulation emerges as a crucial tool in autonomous driving, interest is turning to how to populate simulators with realistic agents. ViBe \cite{Behbahani2018-wu} learns such models from CCTV data collected at intersections, using GAIL but without the tree search or hierarchical components of Symphony. SimNet \cite{bergamini2021simnet} produces such models using only BC but uses GANs instead of reference trajectories to generate initial simulation conditions. TrafficSim \cite{suo2021trafficsim} also uses hierarchical control like Symphony but with a latent variable model and without a tree search for online refinement. AdvSim \cite{DBLP:journals/corr/abs-2101-06549} is similar but generates adversarial perturbations to challenge the full autonomous driving stack. Like Symphony, SMARTS \cite{zhou2020smarts} considers the realism and diversity of agents in a driving simulator, but employs only reinforcement learning, not LfD, to learn such agents. nuPlan \cite{DBLP:journals/corr/abs-2106-11810} is a planning benchmark that uses a set of reference trajectories but does not simulate agent observations, feeding the observations from the reference trajectory even if they diverge from the simulation. \section{EXPERIMENTS \& RESULTS} \subsection{Experimental Setup} \noindent {\bf Datasets.} We use two datasets. The first, a {\em proprietary dataset} created by applying Waymo’s perception tools to sensor data collected by Waymo vehicles driving on public roads, contains $1.1M$ run segments each with 30$s$ of features at 15$Hz$. The second dataset consists of $~64.5K$ run segments from the \emph{Waymo Open Motion Dataset} (WOMD) \cite{DBLP:journals/corr/abs-2104-10133}, which we extract to 10$s$ run segments sampled at 15$Hz$.\footnote{While we use the same run segments as the WOMD, states contain the features described in Section \ref{sec:ps}, not those in the WOMD.} Both datasets exclude run segments containing more than 256 playback agents, 10$K$ roadgraph points, or fewer than $N_I$ agents at the initial timestep. Unlike the proprietary dataset, WOMD's run segments were selected to contain pairwise interactions such as merges, lane changes, and intersection turns. Both datasets split the demonstration data $\mathcal{D}_E$ into disjoint sets $\mathcal{D}_{tr}$ and $\mathcal{D}_{te}$ with $K_{tr} = |\mathcal{D}_{tr}|$ and $K_{te} = |\mathcal{D}_{te}|$. For the proprietary dataset, $K_{tr}=1.1M$ and $K_{te}=10K$ and for the WOMD, $K_{tr}=58.1K$ and $K_{te}=6.4K$. \vspace{0.1cm}\noindent {\bf Simulation setup.} Unless stated otherwise, each simulation lasts for 10$s$, with initial conditions set by the reference trajectory and actions taken at 5$Hz$. Unless stated otherwise, the ego vehicle and one other vehicle are interactive, i.e., controlled by our learned policy, while the rest are playback agents. The interactive agent is chosen heuristically depending on the context, e.g., in merges it is the vehicle with which the ego vehicle is merging. If no such context applies, the nearest moving vehicle is chosen. \subsection{Metrics} We consider the following three realism metrics. {\bf Collision Rate} is the percent of run segments that contain at least one collision involving an interactive agent. A collision is detected when two bounding boxes overlap. {\bf Off-road Time} is the percent of time that an interactive agent spends off the road. {\bf ADE} is the average displacement error between each joint reference trajectory and the corresponding trajectory generated in simulation: \begin{equation*}\label{eq:minSADE} \textrm{ADE} = \frac{1}{K_{te}N_IT}\sum_{k=1}^{K_{te}} \Big[\sum_{i \in I} \sum^{T}_{t=1} \delta(s^i_{k,t}, s^{'i}_{k,t}) \Big], \end{equation*} where $I$ is the set of indices of the interactive agents, $s^{'i}_{k,t}$ and $s^i_{k,t}$ are the states of the $i$th interactive agents in the $k$th simulated and reference trajectories respectively, and $\delta$ is a Euclidean distance function. We also consider two diversity metrics. {\bf MinSADE} is the minimum scene-level average displacement error \cite{suo2021trafficsim}, which extends ADE to measure diversity instead of just realism. During evaluation, the simulator populates a set $\mathcal{R}_k$ by simulating $m$ trajectories for each reference trajectory $\tau_k$ in $\mathcal{D}_{te}$ and then computes minSADE as follows: \begin{equation*}\label{eq:minSADE} \textrm{minSADE} = \frac{1}{K_{te}N_IT}\sum_{k=1}^{K_{te}} \min_{\tau' \in \mathcal{R}_k} \Big[\sum_{i \in I} \sum^{T}_{t=1} \delta(s^i_{k,t}, s^{'i}_{k,t}) \Big], \end{equation*} When $m=1$, minSADE reduces to ADE; when $m>1$, minimising minSADE requires populating $\mathcal{R}_k$ with diverse but realistic trajectories. Our experiments use $m=16$. Low minSADE therefore implies good coverage of behaviour modes. However, it does not imply actually matching the empirical distribution of behaviours, e.g., low-probability modes may be over-represented. {\bf Curvature JSD} is a novel diversity metric that aims to measure how well the high-level behaviour matches the empirical distribution. It is computed using the roadgraph features in $s^{SS}_k$. Multiple lane regions that share a common ancestor are called \emph{branching regions} because they represent places where agents have multiple, branching choices, e.g., a lane approaching a four-way stop may branch into three descendant regions each going in a different direction at the intersection. For each branching region, we compute the average curvature across the region. The curvature JSD is then the Jensen-Shannon divergence between the distribution of average curvatures of the branching regions visited by the policy and reference trajectories. These distributions are approximated with histograms with bins of width $0.01$ in the range $[-1, 1]$, yielding $201$ bins. \begin{table*}[] \caption{Proprietary and Waymo Open Motion Dataset results and standard errors.} \label{tab:main} \renewcommand{\arraystretch}{1.2} \resizebox{\textwidth}{!}{ \begin{tabular}{l|ccccc|ccccc} \Xhline{2\arrayrulewidth} \multirow{3}{*}{Method} & \multicolumn{5}{c|}{Proprietary Dataset} & \multicolumn{5}{c}{Waymo Open Motion Dataset} \\ \cline{2-11} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} \\ \Xhline{2\arrayrulewidth} Playback & 0.99 & 0.40 & - & - & - & 3.04 & 0.96 & - & - & - \\ \hline BC & 16.65 {\scriptsize $\pm$0.41} & 2.16 {\scriptsize $\pm$0.08} & 5.80 {\scriptsize $\pm$0.07} & 2.16 {\scriptsize $\pm$0.04} & 2.82 {\scriptsize $\pm$0.26} & 24.65 {\scriptsize $\pm$0.32} & 2.75 {\scriptsize $\pm$0.12} & 4.81 {\scriptsize $\pm$0.10} & 1.76 {\scriptsize $\pm$0.04} & \bf 1.32 {\scriptsize $\pm$0.28} \\ BC + H & 17.25 {\scriptsize $\pm$1.07} & 1.69 {\scriptsize $\pm$0.12} & 5.18 {\scriptsize $\pm$0.09} & 2.01 {\scriptsize $\pm$0.03} & 1.38 {\scriptsize $\pm$0.11} & 23.27 {\scriptsize $\pm$0.38} & 2.40 {\scriptsize $\pm$0.05} & 4.38 {\scriptsize $\pm$0.04} & 1.67 {\scriptsize $\pm$0.03} & 3.50 {\scriptsize $\pm$1.25} \\ BC + TS & 1.84 {\scriptsize $\pm$0.13} & 0.35 {\scriptsize $\pm$0.03} & 4.83 {\scriptsize $\pm$0.09} & 2.07 {\scriptsize $\pm$0.04} & 5.28 {\scriptsize $\pm$1.14} & 4.94 {\scriptsize $\pm$0.65} & \bf 1.23 {\scriptsize $\pm$0.04} & 4.20 {\scriptsize $\pm$0.15} & 1.82 {\scriptsize $\pm$0.07} & 5.84 {\scriptsize $\pm$1.02} \\ BC + TS + H & \bf 1.80 {\scriptsize $\pm$0.07} & \bf 0.34 {\scriptsize $\pm$0.01} & \bf 4.30 {\scriptsize $\pm$0.05} & \bf 1.96 {\scriptsize $\pm$0.04} & \bf 1.24 {\scriptsize $\pm$0.14} & \bf 4.86 {\scriptsize $\pm$0.24} & 1.30 {\scriptsize $\pm$0.06} & \bf 3.70 {\scriptsize $\pm$0.09} & \bf 1.66 {\scriptsize $\pm$0.04} & 2.82 {\scriptsize $\pm$1.13} \\ \hline MGAIL & 5.34 {\scriptsize $\pm$0.32} & 0.83 {\scriptsize $\pm$0.08} & 7.32 {\scriptsize $\pm$0.52} & 3.95 {\scriptsize $\pm$0.42} & 1.88 {\scriptsize $\pm$0.18} & 9.48 {\scriptsize $\pm$0.91} & 1.62 {\scriptsize $\pm$0.15} & 5.70 {\scriptsize $\pm$0.44} & 3.13 {\scriptsize $\pm$0.26} & 4.14 {\scriptsize $\pm$1.36} \\ MGAIL + H & 4.16 {\scriptsize $\pm$0.18} & 0.76 {\scriptsize $\pm$0.03} & \bf 4.52 {\scriptsize $\pm$0.17} & \bf 2.48 {\scriptsize $\pm$0.09} & \bf 1.55 {\scriptsize $\pm$0.17} & 7.39 {\scriptsize $\pm$0.37} & 1.65 {\scriptsize $\pm$0.12} & \bf 3.82 {\scriptsize $\pm$0.12} & \bf 2.15 {\scriptsize $\pm$0.08} & 3.88 {\scriptsize $\pm$0.80} \\ MGAIL + TS & 2.97 {\scriptsize $\pm$0.16} & 0.72 {\scriptsize $\pm$0.20} & 6.83 {\scriptsize $\pm$0.48} & 3.80 {\scriptsize $\pm$0.39} & 4.14 {\scriptsize $\pm$1.08} & \bf 4.36 {\scriptsize $\pm$0.21} & \bf 1.22 {\scriptsize $\pm$0.02} & 4.26 {\scriptsize $\pm$0.19} & 2.51 {\scriptsize $\pm$0.11} & 5.42 {\scriptsize $\pm$1.26} \\ MGAIL + TS + H & \bf 2.40 {\scriptsize $\pm$0.19} & \bf 0.70 {\scriptsize $\pm$0.06} & 4.69 {\scriptsize $\pm$0.15} & 2.73 {\scriptsize $\pm$0.12} & 2.35 {\scriptsize $\pm$0.53} & 4.89 {\scriptsize $\pm$0.38} & 1.65 {\scriptsize $\pm$0.25} & 3.86 {\scriptsize $\pm$0.17} & 2.22 {\scriptsize $\pm$0.13} & \bf 2.80 {\scriptsize $\pm$0.60} \\ \Xhline{2\arrayrulewidth} \end{tabular}} \end{table*} \begin{table*}[] \caption{Proprietary dataset results and standard errors with 20 second rollouts and 8 interactive agents.} \label{tab:long-more} \renewcommand{\arraystretch}{1.2} \resizebox{\textwidth}{!}{ \begin{tabular}{l|ccccc|ccccc} \Xhline{2\arrayrulewidth} \multirow{3}{*}{Method} & \multicolumn{5}{c|}{Longer Rollouts (20 seconds)} & \multicolumn{5}{c}{More Interactive Agents ($N_I=8$)} \\ \cline{2-11} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Collision\\ rate (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Off-road\\ time (\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}ADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}MinSADE\\ (m)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Curvature JSD\\($\times10^{-3}$)\end{tabular} \\ \Xhline{2\arrayrulewidth} Playback & 2.38 & 0.47 & - & - & - & 2.37 & 0.22 & - & - & - \\ \hline BC & 25.56 {\scriptsize $\pm$0.69} & 2.99 {\scriptsize $\pm$0.09} & 11.60 {\scriptsize $\pm$0.21} & 4.08 {\scriptsize $\pm$0.05} & \bf 2.61 {\scriptsize $\pm$0.20} & 17.46 {\scriptsize $\pm$0.79} & 1.06 {\scriptsize $\pm$0.15} & 6.40 {\scriptsize $\pm$0.51} & 1.86 {\scriptsize $\pm$0.14} & 1.49 {\scriptsize $\pm$0.25} \\ BC + H & 30.33 {\scriptsize $\pm$0.56} & 3.14 {\scriptsize $\pm$0.22} & 9.83 {\scriptsize $\pm$0.18} & 3.83 {\scriptsize $\pm$0.05} & 4.17 {\scriptsize $\pm$0.37} & 18.60 {\scriptsize $\pm$0.81} & 0.95 {\scriptsize $\pm$0.06} & 5.85 {\scriptsize $\pm$0.08} & \bf 1.83 {\scriptsize $\pm$0.08} & 1.73 {\scriptsize $\pm$0.36} \\ BC + TS & \bf 6.05 {\scriptsize $\pm$0.31} & 0.72 {\scriptsize $\pm$0.10} & 8.92 {\scriptsize $\pm$0.30} & 3.97 {\scriptsize $\pm$0.11} & 4.90 {\scriptsize $\pm$0.59} & \bf 4.17 {\scriptsize $\pm$0.23} & 0.38 {\scriptsize $\pm$0.02} & 6.22 {\scriptsize $\pm$0.38} & 2.10 {\scriptsize $\pm$0.20} & 2.76 {\scriptsize $\pm$0.50} \\ BC + TS + H & 7.76 {\scriptsize $\pm$0.12} & \bf 0.66 {\scriptsize $\pm$0.02} & \bf 7.74 {\scriptsize $\pm$0.15} & \bf 3.72 {\scriptsize $\pm$0.09} & 2.69 {\scriptsize $\pm$0.22} & 5.18 {\scriptsize $\pm$0.24} & \bf 0.36 {\scriptsize $\pm$0.03} & \bf 5.68 {\scriptsize $\pm$0.16} & 2.03 {\scriptsize $\pm$0.05} & \bf 0.96 {\scriptsize $\pm$0.12} \\ \hline MGAIL & 14.15 {\scriptsize $\pm$0.83} & 1.03 {\scriptsize $\pm$0.19} & 14.18 {\scriptsize $\pm$0.97} & 9.34 {\scriptsize $\pm$0.45} & 6.79 {\scriptsize $\pm$1.70} & 11.08 {\scriptsize $\pm$1.29} & 0.47 {\scriptsize $\pm$0.02} & 12.30 {\scriptsize $\pm$0.62} & 6.55 {\scriptsize $\pm$0.65} & 4.14 {\scriptsize $\pm$1.06} \\ MGAIL + H & 14.73 {\scriptsize $\pm$1.93} & 1.72 {\scriptsize $\pm$0.24} & 10.52 {\scriptsize $\pm$1.17} & 6.58 {\scriptsize $\pm$0.60} & 3.09 {\scriptsize $\pm$0.62} & 6.79 {\scriptsize $\pm$0.11} & 0.37 {\scriptsize $\pm$0.03} & 5.74 {\scriptsize $\pm$0.34} & 2.80 {\scriptsize $\pm$0.26} & 1.61 {\scriptsize $\pm$0.40} \\ MGAIL + TS & 10.52 {\scriptsize $\pm$0.94} & 0.99 {\scriptsize $\pm$0.03} & 15.76 {\scriptsize $\pm$1.17} & 11.80 {\scriptsize $\pm$1.22} & 5.93 {\scriptsize $\pm$0.71} & 9.50 {\scriptsize $\pm$0.93} & 0.51 {\scriptsize $\pm$0.06} & 7.46 {\scriptsize $\pm$0.79} & 3.66 {\scriptsize $\pm$0.53} & 2.65 {\scriptsize $\pm$0.41} \\ MGAIL + TS + H & \bf 7.81 {\scriptsize $\pm$0.78} & \bf 0.88 {\scriptsize $\pm$0.03} & \bf 9.11 {\scriptsize $\pm$0.73} & \bf 6.39 {\scriptsize $\pm$0.64} & \bf 2.66 {\scriptsize $\pm$0.59} & \bf 5.80 {\scriptsize $\pm$0.47} & \bf 0.36 {\scriptsize $\pm$0.02} & \bf 5.47 {\scriptsize $\pm$0.07} & \bf 2.69 {\scriptsize $\pm$0.04} & \bf 1.24 {\scriptsize $\pm$0.15} \\ \Xhline{2\arrayrulewidth} \end{tabular}} \end{table*} \subsection{Results} \label{sec:main-res} \begin{figure}[t] \captionsetup[subfigure]{justification=centering} \begin{center} \subfloat[Proprietary Dataset.]{\label{fig:speed_dist} \includegraphics[width=0.47\columnwidth]{figs/plots/hist_main.png} } \subfloat[Waymo Open Motion Dataset.] {\label{fig:diversity} \includegraphics[width=0.429\columnwidth]{figs/plots/hist_open.png} } \end{center} \caption{Histograms for distribution of curvature metrics.} \label{fig:dist} \end{figure} We compare BC and MGAIL as is, with hierarchy (BC+H, MGAIL+H), with tree search (BC+TS, MGAIL+TS), and with both (BC+TS+H, MGAIL+TS+H). We train each method for $70K$ update steps with run segments sampled uniformly from $K_{tr}$ and save checkpoints every $2K$ steps. We then select the checkpoint with the lowest sum of collision rate and off-road time on a validation set of 200 run segments and test it using all of $K_{te}$. For each run segment in $K_{te}$, we generate 16 rollouts and report the average (or minimum for minSADE). We average all results over five independent seeds per method. For each metric, we indicate the best performing BC and MGAIL methods in bold. For collision rate and off-road time, we also report values for playing back the logs without interactive agents but computing these metrics for the agents that would have been interactive. These values are slightly positive due to, e.g., perception errors on objects far from the ego vehicle or the use of bounding boxes instead of contours. Table \ref{tab:main} shows our main results, comparing all methods across all metrics on both datasets. Comparing BC methods first, it is clear that tree search dramatically improves realism (especially with respect to collision rate and off-road time) but reduces diversity due to mode collapse. This loss is detected by curvature JSD, which measures distribution matching, but not by minSADE, which only requires coverage. However, the addition of hierarchy improves diversity in nearly all cases. In particular, hierarchy is crucial for addressing the mode collapse from tree search. BC+TS+H is the only BC method that gets the best of both worlds with strong performance on both realism and diversity metrics. Figure \ref{fig:dist} shows the histograms used to compute the curvature JSD values in Table \ref{tab:main} for three BC methods, with learned policies in orange and the log reference trajectories in blue. While BC matches distributions well, adding tree search leads to under-representation of positive curvature, i.e., right turns, a deficiency repaired with hierarchical policies. Turning now to MGAIL methods, similar trends emerge. Tree search improves realism, though the effect is less dramatic as MGAIL is already adversarial even without tree search. Similarly, while tree search also increases curvature JSD in MGAIL, the effect is smaller. This is also to be expected given that MGAIL is already adversarial and can thus experience mode collapse even without tree search. On both datasets, the addition of hierarchy substantially improves MGAIL's diversity metrics. Overall, the best BC methods perform better than the best MGAIL methods on nearly all metrics, though the differences are modest. To see if we can maintain realism for longer time horizons, we repeat our experiments on the proprietary dataset with the rollout length doubled to 20$s$ in both training and testing. The left side of Table \ref{tab:long-more} shows the results. As expected, all methods obtain higher values on nearly all metrics in this more challenging setup. However, the relative performance of the methods remains similar to that shown in Table \ref{tab:main}. Tree search methods perform much better with respect to realism than those without. While longer rollouts give more time to accumulate error, tree search repeatedly prunes problematic rollouts, greatly mitigating this effect. BC+TS has worse curvature JSD than BC but the use of hierarchy prevents mode collapse, enabling BC+TS+H to approach the best of both worlds. MGAIL shows less diversity loss from tree search than BC (only moderately worse minSADE) but also sees much better diversity when hierarchy is used. To assess whether we can maintain realism when more agents are replaced, we repeat our experiments on the proprietary dataset with eight interactive agents ($N_I=8$) in both training and testing. Two agents are selected as before and an additional six are selected that are nearest to the ego vehicle and whose distance traveled in the reference trajectory exceeds a threshold. Again, all methods obtain higher values on most metrics, as with the longer rollouts discussed above. Relative performance remains similar, with tree search improving realism but harming diversity and hierarchy improving diversity. In this case, MGAIL sees no loss of diversity from tree search, as any mode collapse already happens in MGAIL training, but still sees substantial diversity improvements when hierarchy is used. \section{CONCLUSIONS \& FUTURE WORK} This paper presented Symphony, which learns realistic and diverse simulated agents and performs parallel multi-agent simulations with them. Symphony is data driven and combines hierarchical policies with a parallel beam search. Experiments on both open and proprietary Waymo data confirmed that Symphony learns more realistic and diverse behaviour than a number of baselines. Future work will investigate alternative pruning rules to shape simulation to various ends, augmenting goals to model driver persona, and developing additional diversity metrics that capture distributional realism in, e.g., agents' aggregate pass/yield behaviour.
\section{Introduction} \label{sec:intro} Differential algebra is concerned with structural properties of systems of ordinary and partial differential equations (ODEs and PDEs) and provides algorithms for their analysis \cite{Ob,bachler2012algorithmic}. The properties unveiled by these algorithms correspond to intrinsic properties of the solutions of the system via dictionaries. At the same time these algorithms isolate equations of interest via elimination, transform systems into normal forms \cite{gerdt2019maple}, describe singularities \cite{lange2021singularities}, allow to investigate control-theoretic properties \cite{lange2020thomas,lange2013thomas}, or detect the size of solution sets \cite{lange2018differential,lange2017differential,lange2014counting}. Usually, PDEs come with additional information on the evaluation of functions. For example in inverse problems, parameters in differential equations are being estimated from data points. Or in theoretical and numerical methods for PDEs, boundary conditions, i.e.\ evaluations of functions on manifolds, ensure well-posedness. Data points and boundary conditions have rarely been addressed by algebraic means, with the exception of modeling of boundary conditions by in\-te\-gro-diffe\-ren\-tial operators \cite{regensburger2009skew,rosenkranz2008solving}. Seemingly disconnected from these algebraic algorithms are \glspl!{gp} \cite{RW}, a general regression technique, which arise as limit of large neural networks \cite{neal1996priors} and generalize linear (ridge) regressio , Krigin , and many spline model . \glspl!{gp} describe probability distributions on function spaces. As such, \begin{enumerate}[label=(\arabic*)] \item\label{item:GPfeatures1} they can be conditioned on observations given as data points using Bayes' rule in closed form, which avoids overfitting, \item\label{item:GPfeatures2} they admit an extensive dictionary between their mathematical properties and their covariance function, which allows to prescribe intended behavior, \item\label{item:GPfeatures3} form the maximum entropy prior distribution under the assumption of a finite mean and variance in the unknown behavior, and \item\label{item:GPfeatures4} the class of \glspl!{gp} is closed under various operations like conditioning, marginalization, and linear operators. \end{enumerate} They are typically used in applications when data is rare or expensive to produce, e.g., in active learning \cite{zimmer2018safe}, biology \cite{LawrencePNAS2015}, anomaly detection \cite{BernsTowards2020} or engineering \cite{TLRB_gp}. The mean function of the posterior is used for regression and the variance quantifies uncertainty. In that sense, they allow to deal with data, noise, and uncertainty in a way algebraic algorithms usually cannot. The inclusion of algebraic methods for differential equations into covariance functions of \glspl!{gp} began by divergence-free and curl-free vector fields \cite{MacedoCastro2008,scheuerer2012covariance}, extended to electromagnetic fields \cite{Wahlstrom13modelingmagnetic,MagneticFieldGP} and strain fields \cite{jidling2018probabilistic}. These approaches were formalized in \cite{LinearlyConstrainedGP}, building on \cite{sarkka2011linear}. Then, \cite{LH_AlgorithmicLinearlyConstrainedGaussianProcesses} used Gr\"obner bases and worked out the necessity of systems being controllable. Boundary conditions were added to the setup in \cite{LH_AlgorithmicLinearlyConstrainedGaussianProcessesBoundaryConditions}, restricted to simple polynomial boundaries. In this paper, we develop algebraic algorithms suitable for this framework to deal with analytic boundary conditions. These algorithms might take \begin{enumerate}[label=(\roman*)] \item parametrizable linear systems of differential equations, \item assumptions on the solutions of the differential equations, e.g.\ smoothness, \item various forms of boundary conditions specified by analytic functions, and \item (noisy or noiseless) evaluations of functions at finitely many points \end{enumerate} as inputs. They yield a probability distribution on the solution space of the differential equation given by a \gls!{gp}, which has the above properties \ref{item:GPfeatures1}--\ref{item:GPfeatures4}. Our approach is as follows. We construct a first parametrization of the solution set of the system of differential equations by finding a matrix whose row nullspace is generated by the equations of the given system. We take a second parametrization of the boundary condition. Then, we construct a parametrization of the intersection of the images of these two parametrizations. Algorithmically, this requires Gr\"obner bases over a Weyl algebra enlarged by various analytic functions, for which we develop the necessary theory and algorithms. After this symbolic approach, numeric algorithms incorporate measurement data into the \gls!{gp}. In this setup, ODEs are trivial, both algebraically, as parametrizable linear systems of ODEs with constant or variable coefficients are isomorphic to free systems due to the Jacobson form \cite{TheoryOfRings}, and also from the stochastic point of view, as boundary conditions in ODEs can be modelled by conditioning on data points \cite{GOODE}. Hence, we focus on PDEs. From the point of view of machine learning, the results of this paper allow to incorporate information into the covariance structure of a \gls!{gp} prior. This prior is supported by solutions of the differential equation and the boundary conditions. In particular, rare measurement data can refine and improve this prior knowledge, instead of being necessary to learn this prior knowledge. The contributions of this paper can be summarized as follows: \begin{enumerate}[label=(\alph*)] \item we develop Gr\"obner basis algorithms for Weyl algebras over certain rings of analytic functions (cf.\ Sections~\ref{section_Ore} and \ref{section_modules}), \item we study boundary conditions parametrized by analytic functions, in particular how they constrain \glspl!{gp} (cf.\ Section~\ref{section_boundary}), and \item we construct \gls!{gp} priors for solution sets of PDEs including boundary conditions (cf.\ Section~\ref{section_examples}). \end{enumerate} \section{Gaussian processes}\label{section_GP} A \glsreset{gp}\emph{\gls!{gp}} $g=\GP(\mu,k)$ defines a probability distribution on the evaluations of functions $D\to{\mathbb{R}}^\ell$ where $D\subseteq{\mathbb{R}}^d\equiv{\mathbb{R}}^{1\times d}$ such that function values $g(x_1),\ldots,g(x_n)$ at points $x_1,\ldots,x_n\inD$ are jointly (multivariate) Gaussian. A \gls!{gp} $g$ is specified by a \emph{mean function} $\mu:D\to{\mathbb{R}}^\ell:x\mapsto E(g(x))$ and a positive semidefinite\footnote{The function $k$ is positive (semi)definite if and only if for any $x_1,\ldots,x_n\inD$ the matrix $K=(k(x_i,x_j))_{i,j}\in{\mathbb{R}}^{n\ell\times n\ell}$ is positive (semi)definite, i.e.\ $K \succeq 0$.} \emph{covariance function} \begin{align*} k: D\timesD \longrightarrow {\mathbb{R}}^{\ell\times\ell}_{\succeq0}: (x,x') \longmapsto E\left((g(x)-\mu(x))(g(x')-\mu(x'))^T\right)\mbox{.} \end{align*} Any finite set of evaluations of $g$ follows the multivariate Gaussian distribution \begin{align*} \begin{bmatrix}g(x_1)\\ \vdots \\ g(x_n)\end{bmatrix} \sim \mathcal{N}\left(\begin{bmatrix}\mu(x_1)\\ \vdots \\ \mu(x_n)\end{bmatrix},\begin{bmatrix} k(x_1,x_1) & \ldots & k(x_1,x_n) \\ \vdots & \ddots & \vdots \\ k(x_n,x_1) & \ldots & k(x_n,x_n) \end{bmatrix}\right). \end{align*} Now, one knows where a function value $g(x)$ is supposed to be (mean $\mu(x)$), which ignorance we have about $g(x)$ (variance $k(x,x)$), and how two function values $g(x_1)$ and $g(x_2)$ are related (covariance $k(x_1,x_2)$). \glspl!{gp} are popular functional priors in Bayesian inference due to their maximum entropy property \cite{jaynes2003probability}. Assume the probabilistic regression model $y=g(x)$ for a \gls!{gp} $g=\GP(0,k)$. Normalizing the data to mean zero justifies assuming a prior mean function zero. Conditioning the \gls!{gp} on training data points $(x_i,y_i)\in D\times{\mathbb{R}}^{1\times \ell}$ for $i=1,\ldots,n$ by Bayes' theorem yields the posterior \begin{align*} p(\;g(x)=y\;|\;g(x_i)=y_i\;)=\frac{p(\;g(x_i)=y_i\;|\;g(x)=y\;)}{p(\;g(x_i)=y_i\;)}\cdot p(\;g(x)=y\;)\mbox{,} \end{align*} where $i$ always runs from $1$ to $n$. All of these distributions are multivariate Gaussian. Hence, the posterior $p(\;g(x)=y\;|\;g(x_i)=y_i\;)$ is again a \gls!{gp} and can be computed in closed form via linear algebra: \begin{align}\label{eq_gp_posterior} \GP\Big( \quad \quad \quad x&\mapsto yk(X,X)^{-1}k(X,x), \\ (x,x')&\mapsto k(x,x')-k(x,X)k(X,X)^{-1}k(X,x')\quad \Big)\nonumber\mbox{,} \end{align} where $y\in {\mathbb{R}}^{1\times \ell n}$ denotes the row vector obtained by concatenating the $y_i$ and $k(x,X)\in {\mathbb{R}}^{\ell\times\ell n}$ resp.\ $k(X,x)\in {\mathbb{R}}^{\ell n\times\ell}$ resp.\ $k(X,X)\in {\mathbb{R}}^{\ell n\times\ell n}_{\succeq0}$ denote the (covariance) matrices obtained by concatenating the blocks $k(x,x_j)$ resp.\ $k(x_j,x)$ resp.\ $k(x_i,x_j)$ to a matrix. In case of a noisy data $(y_i)_j$, one adds the \emph{noise variance} $var((y_i)_j)$ to the $((i-1)\ell+j)$-th diagonal entry of $k(X,X)$. The Cholesky decomposition improves numerical stability regarding the inversion of the positive definite matrix $k(X,X)$ \cite{RW}. In the posterior \eqref{eq_gp_posterior}, the mean function can be used as regression model and its variance as model uncertainty. The class of \glspl!{gp} is closed under linear operators once mild assumptions hold, e.g.\ the derivative of a \gls!{gp} with differentiable realizations is again a \gls!{gp}. \begin{figure} \centering \begin{tikzpicture}[scale=0.4] \begin{axis}[ymin=-2, ymax=2,xmin=-3,xmax=3] \addplot[name path=upper,domain=-2.5:2.5,blue] {-.990427971851666*exp(-(1/2)*(x+2)^2)+.990427971851666*exp(-(1/2)*(x-2)^2)+2-1.98019823825307*exp(-(x+2)^2)+0.131541090052936e-2*exp(-x^2-4)-1.98019823825307*exp(-(x-2)^2)}; \addplot[name path=lower,domain=-2.5:2.5,blue] {-.990427971851666*exp(-(1/2)*(x+2)^2)+.990427971851666*exp(-(1/2)*(x-2)^2)-2+1.98019823825307*exp(-(x+2)^2)-0.131541090052936e-2*exp(-x^2-4)+1.98019823825307*exp(-(x-2)^2)}; \addplot [color=blue,fill=blue,fill opacity=0.05] fill between[of=lower and upper, soft clip={domain=-2.5:2.5} ]; \addplot[name path=mean,domain=-2.5:2.5,blue]{-.990427971851666*exp(-(1/2)*(x+2)^2)+.990427971851666*exp(-(1/2)*(x-2)^2)}; \addplot[mark=*] coordinates {(-2,-1)}; \addplot[mark=*] coordinates {(2,1)}; \end{axis} \end{tikzpicture} \begin{tikzpicture}[scale=0.4] \begin{axis}[ymin=-2, ymax=2,xmin=-3,xmax=3] \addplot[name path=upper,domain=-2.5:2.5,blue] {(0.907655997014386e-1-0.197316510985624e-1*x^2+0.526177478930923e-2*x)*exp(-x^2-4)+(-.995738707600120+.993745428529554*x)*exp(-(1/2)*(x-2)^2)+(1.00098648143689+.996367574180994*x)*exp(-(1/2)*(x+2)^2)+(-9.90122887197933+7.92100092363468*x-1.98024367721336*x^2)*exp(-(x-2)^2)+2.+(-9.90120090954602-7.92100441893886*x-1.98025066782170*x^2)*exp(-(x+2)^2)}; \addplot[name path=lower,domain=-2.5:2.5,blue] {(-0.907655997014386e-1+0.197316510985624e-1*x^2-0.526177478930923e-2*x)*exp(-x^2-4)+(-.995738707600120+.993745428529554*x)*exp(-(1/2)*(x-2)^2)+(1.00098648143689+.996367574180994*x)*exp(-(1/2)*(x+2)^2)+(9.90122887197933-7.92100092363468*x+1.98024367721336*x^2)*exp(-(x-2)^2)-2.+(9.90120090954602+7.92100441893886*x+1.98025066782170*x^2)*exp(-(x+2)^2)}; \addplot [color=blue,fill=blue,fill opacity=0.05] fill between[of=lower and upper, soft clip={domain=-2.5:2.5} ]; \addplot[name path=mean,domain=-2.5:2.5,blue]{-.991748666925102*exp(-(1/2)*(x+2)^2)+.991752149458988*exp(-(1/2)*(x-2)^2)+(.996367574180994*(x+2))*exp(-(1/2)*(x+2)^2)+(.993745428529554*(x-2))*exp(-(1/2)*(x-2)^2)}; \addplot[mark=*] coordinates {(-2,-1)}; \addplot[name path=d1,domain=-2.1:-1.9,black,line width=2]{x+1}; \addplot[mark=*] coordinates {(2,1)}; \addplot[name path=d2,domain=1.9:2.1,black,line width=2]{x-1}; \end{axis} \end{tikzpicture} \caption{Left: a regression plot (mean and the $2\sigma$ confidence bands) of a \gls!{gp} with mean zero and squared exponential covariance function conditioned on the points $(-2,-1)$ and $(2,1)$ with noise variance of $0.1^2$. Right: the \gls!{gp} is additionally conditioned on derivative $1$ with noise $0.1^2$ at both data points.} \label{figure_comparison_regression_derivative} \end{figure} \begin{wrapfigure}{r}{2.0cm} \vspace{-1.5em} \begin{tikzcd} D\arrow[rd, bend left, "b\circ g\in b_*G"]\arrow[d, "g\in G"] \\ Y\arrow[r,"b"] & Z \end{tikzcd} \!\!\!\!\!\! \end{wrapfigure} Given a set of functions $G\subseteq Y^D$ and $b:Y\to Z$, then the \emph{pushforward} is $ b_*G=\{b\circ f\mid f\in G\}\subseteq Z^D $. The \emph{pushforward} of a stochastic process $g:D\to Y$ by $b:Y\to Z$ is defined as \begin{align*} b_*g:D\longrightarrow Z: d\longmapsto(b\circ g)(d). \end{align*} \begin{lemma}[{\cite[Lemma~2.2]{LH_AlgorithmicLinearlyConstrainedGaussianProcessesBoundaryConditions}}]\label{lemma_pushforward_gaussian} Let $\ensuremath{\mathcal{F}}$ and ${\mathcal{G}}$ be spaces of functions defined on a set $D$ with product $\sigma$-algebra of the function evaluations. Let $g=\GP(\mu(x),k(x,x'))$ with realizations in $\ensuremath{\mathcal{F}}$ and $B:\ensuremath{\mathcal{F}}\to{\mathcal{G}}$ a linear, measurable operator which commutes with expectation w.r.t.\ the measure induced by $g$ on $\ensuremath{\mathcal{F}}$ and by $B_*g$ on ${\mathcal{G}}$. Then, the \glsreset{gp}\emph{pushforward \gls!{gp}} $B_*g$ of $g$ under $B$ is a \gls!{gp} with \begin{align* B_*g = \GP(B\mu(x),Bk(x,x')(B')^T)\mbox{ ,} \end{align*} where $B'$ denotes the operation of $B$ on functions with argument $x'$. \end{lemma} \begin{example}\label{example_derivative_GP} Let $g=\GP(0,k(x,x'))$ be a \gls!{gp} with realizations (a.s.) in the set $C^1({\mathbb{R}},{\mathbb{R}})$ of differentiable functions. The pushforward \gls!{gp} \begin{align*} \begin{bmatrix}\frac{\partial}{\partial x}\end{bmatrix}_*g := \GP\left(0,\frac{\partial^2}{\partial x\partial x'}k(x,x')\right)\mbox{} \end{align*} describes derivatives of the \gls!{gp} $g$ \cite[\textsection5.2]{StationaryAndRelatedStochasticProcesses}. The one-argument derivative $\frac{\partial}{\partial x}k(x,x')$ yields the cross-covariance between on the one hand a function evaluation $g(x')$ of $g$ at $x'\in{\mathbb{R}}$ and on the other hand its derivative $(\begin{bmatrix}\frac{\partial}{\partial x}\end{bmatrix}_*g)(x)$ evaluated at $x\in{\mathbb{R}}$. We use this to include data of derivatives into a model in Figure~\ref{figure_comparison_regression_derivative}. \end{example} \section{Solution sets of operator equations}\label{section_GPs_solutions} This section discusses how \glspl!{gp} describe the real vector space $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$, a candidate set of solutions for the linear differential equations, and how such \glspl!{gp} interplay with linear operators. Assume that $D\subset{\mathbb{R}}^d$ is compact and $\ensuremath{\mathcal{F}}$ is endowed with the usual Fr\'echet topology generated by the separating family \begin{align}\label{eq_frechet} \|f\|_{a}:= \sup_{\substack{i\in{\mathbb{Z}}_{\ge0}^d\\ |i|\le a}} \sup_{x\in D}\ \left|\frac{\partial^{|i|}}{\partial x^i}f(x)\right| \end{align} of seminorms for $a\in{\mathbb{Z}}_{\ge0}$% , where $i=(i_1,\ldots,i_d)\in{\mathbb{Z}}_{\ge0}^d$ is a multi-index with $|i|=i_1+\ldots+i_d$. The \emph{squared exponential covariance function} \begin{align}\label{eq_SE} k_\ensuremath{\mathcal{F}}:{\mathbb{R}}^d\times{\mathbb{R}}^d\longrightarrow{\mathbb{R}}:(x_i,x_j)\longmapsto\exp\left(-\frac{1}{2}\sum_{a=1}^d(x_{i,a}-x_{j,a})^2\right) \end{align} induces an adapted \gls!{gp} prior in $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$. \begin{proposition} The scalar \gls!{gp} $g_\ensuremath{\mathcal{F}}=\GP(0,k_\ensuremath{\mathcal{F}})$ has realizations dense (a.s.) in $\ensuremath{\mathcal{F}}$ with respect to the Fr\'echet topology defined by Equation \eqref{eq_frechet}. \end{proposition} \begin{proof} We show that the realizations of $g_\ensuremath{\mathcal{F}}$ are densely contained in $\ensuremath{\mathcal{F}}$ in three steps: first, the realizations are contained in $\ensuremath{\mathcal{F}}$; second, the elements of the reproducing kernel Hilbert space (RKHS)\footnote{% For $\GP(0,k)$, the set $\H^0(g)$ generated as a vector space by the $x\mapsto k(x_i,x)$ for $x_i\in D$ with scalar product $\left\langle k(x_i,-),k(x_j,-) \right\rangle := k(x_i,x_j)$ is a pre-Hilbert space. Its closure $\H(g)$ is the \emph{reproducing kernel Hilbert space} of the \gls!{gp} $g$ \cite{RKHSProbabilityStatistics}. } $\H(g_\ensuremath{\mathcal{F}})$ of the \gls!{gp} $g_\ensuremath{\mathcal{F}}$, are realizations; and third, the RKHS $\H(g_\ensuremath{\mathcal{F}})$ is dense in $\ensuremath{\mathcal{F}}$. First, show the smoothness of the realizations of $g_\ensuremath{\mathcal{F}}$ by induction. They are (a.s.) continuously differentiable, as $k_\ensuremath{\mathcal{F}}$ is twice continuously differentiable \cite[(9.2.2)]{StationaryAndRelatedStochasticProcesses}. By Example~\ref{example_derivative_GP} the covariance of the derivative of $g_\ensuremath{\mathcal{F}}$ is again smooth. For the second step, we note that $C^\infty(D,{\mathbb{R}})$ is Radon as $D$ is compact, hence $g_\ensuremath{\mathcal{F}}$ induces a Radon measure on $\ensuremath{\mathcal{F}}$. For any Radon measure, $\H(g_\ensuremath{\mathcal{F}})$ is contained in the topological support of the measure induced by $g_\ensuremath{\mathcal{F}}$ by \cite[Thm.~3.6.1]{bogachev1998gaussian}. For this, $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$ needs to be locally convex, which it is being Fr\'echet. For the third step, by \cite[Prop.~4]{SimSch16}, $\H(g_\ensuremath{\mathcal{F}})$ is continuously contained in $\ensuremath{\mathcal{F}}$ and dense by \cite[Thm.~12, Prop.~42]{SimSch16} or \cite[after proof of Cor.~38]{SimSch16}.\qed \end{proof} The following three ${\mathbb{R}}$-algebras $R$ model linear operator equations by making $\ensuremath{\mathcal{F}}$ a left $R$-module. Sections~\ref{section_Ore} and \ref{section_modules} introduce Gr\"obner bases for such rings. \begin{example}\label{example_linear_dgl} The polynomial ring $R={\mathbb{R}}[\partial_{x_1},\ldots,\partial_{x_d}]$ models linear PDEs with constant coefficients, where $\partial_{x_i}$ acts on $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$ via partial derivative with respect to $x_i$ \end{example} \begin{example}\label{example_polynomial_operator_ring} Let $f_1,\ldots,f_n\in \ensuremath{\mathcal{F}}$ be functions. The ring $R={\mathbb{R}}[f_1,\ldots,f_n]$ is commutative and models boundary conditions by multiplication, see Section~\ref{section_boundary}. \end{example} \begin{example}\label{example_Weyl} Let $F\subseteq \ensuremath{\mathcal{F}}$ be an ${\mathbb{R}}$-algebra closed under partial derivatives. To combine linear differential equations with boundary conditions, consider the Weyl algebra $R={\mathbb{R}}[F]\langle \partial_{x_1},\ldots,\partial_{x_d}\rangle$. The non-commutative relation $\partial_{x_i}f=f\partial_{x_i}+\frac{\partial f}{\partial x_i}$ represents the product rule of differentiation for $f\in F$ and $1\le i\le d$. \end{example} Operators defined over these three rings satisfy the assumptions of Lemma~\ref{lemma_pushforward_gaussian}: multiplication commutes with expectations and the dominated convergence theorem implies that expectation commutes with derivatives, as realizations of $g_\ensuremath{\mathcal{F}}$ are continuously differentiable. Furthermore, these rings act continuously on $\ensuremath{\mathcal{F}}$: the Fr\'echet topology makes derivation continuous by construction, and multiplication by elements in $\ensuremath{\mathcal{F}}$ is bounded as $D$ is compact, which implies continuity in the Fr\'echet space $\ensuremath{\mathcal{F}}$. In particular, we have the following: \begin{corollary} Let $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$ be the space of smooth functions defined on a compact set $D\subset{\mathbb{R}}^d$. Let $g=\GP(\mu(x),k(x,x'))$ with realizations in $\ensuremath{\mathcal{F}}^{\ell''}$ and $B:\ensuremath{\mathcal{F}}^{\ell''}\to\ensuremath{\mathcal{F}}^\ell$ a linear operator over one of the operator rings in Examples~\ref{example_linear_dgl}, \ref{example_polynomial_operator_ring}, or \ref{example_Weyl}. Then, the \emph{pushforward \gls!{gp}} $B_*g$ is again Gaussian with \begin{align*} B_*g = \GP(B\mu(x),Bk(x,x')(B')^T)\mbox{ ,} \end{align*} where $B'$ denotes the operation of $B$ on functions with argument $x'$. \end{corollary} \section{Parametrizations}\label{section_paramerization} We consider solution sets of linear differential equations and how they can be described by a \gls!{gp}. Let $R$ be one of the rings from the previous section, $\ensuremath{\mathcal{F}}$ the left $R$-module $C^{\infty}(D, {\mathbb{R}})$ and $A\in R^{\ell'\times\ell}$. Define the \emph{solution set} $\sol_\ensuremath{\mathcal{F}}(A):=\{f\in \ensuremath{\mathcal{F}}^{\ell\times1}\mid Af=0\}$ of $A$ as its right nullspace. We say that a \gls!{gp} is \emph{in} a function space, if its realizations are a.s.\ contained in said space. The interplay of \glspl!{gp} and solution sets of operators is described by the following lemma. \begin{lemma}[{\cite[Lemma~2.2]{LH_AlgorithmicLinearlyConstrainedGaussianProcesses}}]\label{lemma_gp_operator} Let $g=\GP(\mu,k)$ be a \gls!{gp} in $\ensuremath{\mathcal{F}}^{\ell\times1}$. Then $g$ is a \gls!{gp} in the solution set $\sol_\ensuremath{\mathcal{F}}(A)$ of $A\in R^{\ell'\times\ell}$ if and only if both $\mu$ is contained in $\sol_\ensuremath{\mathcal{F}}(A)$ and $A_*(g-\mu)$ is the constant zero process. \end{lemma} This lemma motivates how to construct \glspl!{gp} with realizations in $\sol_\ensuremath{\mathcal{F}}(A)$: find a $B\in R^{\ell\times\ell''}$ with $AB=0$ \cite{LinearlyConstrainedGP}. Then, taking any \gls!{gp} $g=\GP(0,k)$ in $\ensuremath{\mathcal{F}}^{\ell''\times 1}$, the realizations of $B_*g$ are (possibly strictly) contained in $\sol_\ensuremath{\mathcal{F}}(A)$, as $A_*(B_*g)=(AB)_*g=0_*g=0$. Now, one prefers to enlarge $B$ to approximate \emph{all} solutions in $\sol_\ensuremath{\mathcal{F}}(A)$ by $B_*g$, i.e., the realizations of $B_*g$ should be dense in $\sol_\ensuremath{\mathcal{F}}(A)$. Call $B\in R^{\ell\times\ell''}$ a \emph{parametrization} of $\sol_\ensuremath{\mathcal{F}}(A)$ if $\sol_\ensuremath{\mathcal{F}}(A)=B\ensuremath{\mathcal{F}}^{\ell''\times 1}$. A parametrization in this sense does not necessarily exist, e.g., for the matrix $A=\begin{bmatrix}\partial_{x_1}\end{bmatrix}$. \begin{proposition}[{\cite[Proposition~3.5]{LH_AlgorithmicLinearlyConstrainedGaussianProcessesBoundaryConditions}}]\label{proposition_denseparametrization} Let $B\in R^{\ell\times\ell''}$ be a parametrization of $\sol_\ensuremath{\mathcal{F}}(A)$. Let $g_\ensuremath{\mathcal{F}}^{\ell''\times 1}$ be the \gls!{gp} of $\ell''$ i.i.d.\ copies of $g_\ensuremath{\mathcal{F}}$, the \gls!{gp} with squared exponential covariance $k_\ensuremath{\mathcal{F}}$ \eqref{eq_SE}. Then, $B_*g_\ensuremath{\mathcal{F}}^{\ell''\times 1}$ has realizations dense in $\sol_\ensuremath{\mathcal{F}}(A)$. \end{proposition} We summarize how to algorithmically decide whether a parametrization exists and how to compute it in the positive case. Computations directly over the space of functions $\ensuremath{\mathcal{F}}$ are infeasible. Hence, we compute over $R$ instead. Inferring results over $\ensuremath{\mathcal{F}}$ is possible once $\ensuremath{\mathcal{F}}$ is an injective\footnote{% In algebraic system theory, one usually works with injective cogenerators $\ensuremath{\mathcal{F}}$ \cite{Q_habil}. Injective cogenerators allow to infer back from analysis in $\ensuremath{\mathcal{F}}$ to algebra over $R$. In our setting, this step back is superfluous, as the algebra cannot encode data points. } $R$-module, i.e.\ $\Hom_R(-,\ensuremath{\mathcal{F}})$ is exact. Luckily, for PDEs with constant coefficients we have the following: \begin{theorem}[{\cite{malgrange1956existence}, \cite{ehrenpreis1954solution}, \cite[\textsection2(54)]{Ob}}]\label{theorem_injective_module} Let $R={\mathbb{R}}[\partial_{x_1},\ldots,\partial_{x_d}]$ be as in Example~\ref{example_linear_dgl} and $D\subset{\mathbb{R}}^d$ convex. Then, $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$ is an injective $R$-module. \end{theorem} With this in mind, we recall the construction of parametrizations. \begin{theorem}[{% \cite[Thm.~2]{ZSHinverseSyzygies}, \cite[\S7.(24)]{Ob}, \cite{QGrade}, \cite{Q_habil}, \cite{CQR05_nonote}, \cite{RobRecentProgress}% }]\label{theorem_parametrizable} Let $R$ be a ring and $\ensuremath{\mathcal{F}}$ an injective left $R$-module. Let $A\in R^{\ell'\times\ell}$. Let $B$ be the right nullspace of $A$ and $A'$ the left nullspace of $B$. Then $\sol_\ensuremath{\mathcal{F}}(A')$ is the largest subset of $\sol_\ensuremath{\mathcal{F}}(A)$ that is parametrizable, $B$ parametrizes $\sol_\ensuremath{\mathcal{F}}(A')$, and $\sol_\ensuremath{\mathcal{F}}(A)$ is parametrizable if and only if the rows of $A$ and $A'$ generate the same row module, i.e.\ if all rows of $A'$ are contained in the row module generated by $A$. \end{theorem} Gr\"obner bases, as in Sections~\ref{section_Ore} and \ref{section_modules} make Theorem~\ref{theorem_parametrizable} algorithmic, as they allow to compute the right nullspace $B$ of $A$, the left nullspace $A'$ of $B$ and decide whether the rows of $A'$ are contained in the row space of $A$ over $R$. There also exists the following abstract criterion for parametrizability of systems. \begin{theorem}[{\cite[\S7.(21)]{Ob}}]\label{theorem_controllable_parametrizable} A system $\sol_\ensuremath{\mathcal{F}}(A)$ is parametrizable if and only if it is controllable. If $A$ is not parametrizable, then the solution set $\sol_\ensuremath{\mathcal{F}}(A')$ is the subset of controllable behaviors in $\sol_\ensuremath{\mathcal{F}}(A)$, where $A'$ is defined as in Theorem~\ref{theorem_parametrizable}. \end{theorem} \section{Rings of differential operators over differential algebras}\label{section_Ore} This section develops Gr\"obner and Janet basis algorithms for the rings of interest for this paper. The extension of the classical theory is non-trivial (cf.\ Assumption~\ref{assump:termorder}) Let $D\subset{\mathbb{R}}^d$ be connected and denote by $\delta_1, \ldots, \delta_d$ the commuting derivations in the coordinate directions of ${\mathbb{R}}^d$. Let $K$ be a differential algebra over the real numbers\footnote{% Of course, the constructions in this and the following section work over any sufficiently algorithmic differential field of characteristic zero, not only ${\mathbb{R}}$. In practice, we assume to work over a computable subfield of ${\mathbb{R}}$. } ${\mathbb{R}}$ generated by analytic function $f_1,\ldots,f_r\colon D\to{\mathbb{R}}$. For algorithmic reasons assume that $K$ is finitely presented as a differential algebra over ${\mathbb{R}}$ as \[ K \, = \, {\mathbb{R}}\{ f_1, \ldots, f_r \} \, \cong \, {\mathbb{R}}\{ F_1, \ldots, F_r \} / P, \] where $P$ is a prime differential ideal of ${\mathbb{R}}\{ F_1, \ldots, F_r \}$ and the above isomorphism is given by $f_i\mapsto F_i + P$. We assume that the prime differential ideal $P$ is generated as a differential ideal by a finite set of the form \begin{equation}\label{eq:Pgenset} \{ \, \delta_j F_i - g_{i,j} \mid i = 1, \ldots, r, \, j = 1, \ldots, d \, \}, \end{equation} where $g_{i,j} \in {\mathbb{R}}[F_1, \ldots, F_r]$ are (non-differential) polynomials in $F_1, \ldots, F_r$. In particular, the generators $f_1, \ldots, f_r$ of $K$ are algebraically independent over ${\mathbb{R}}$. Then $K$ is isomorphic to the polynomial ring ${\mathbb{R}}[f_1, \ldots, f_r]$ as an ${\mathbb{R}}$-algebra, and $K$ is Noetherian, factorial, and a GCD domain. \begin{example}\label{ex:funcderiv1} For the differential algebra $K = {\mathbb{Q}}\{ x, \exp(x) \}$ with $\delta_1 = \textrm{d}/\textrm{d}x$ we have $K \cong {\mathbb{Q}}\{ F_1, F_2 \} / P$, where $P$ is generated by $\delta_1 F_1 - 1$, $\delta_1 F_2 - F_2$, so that \begin{align*} {\mathbb{Q}}\{ F_1, F_2 \} \longrightarrow K: F_1 \longmapsto x, \, F_2 \longmapsto \exp(x) \end{align*} is an epimorphism of differential algebras over ${\mathbb{Q}}$ mapping precisely $P$ to zero. \end{example} \begin{example}\label{ex:funcderiv2} For the differential algebra $K = {\mathbb{Q}}\{ x, y, \exp(x^2+y^2-1) \}$ with derivations $\delta_1 = \partial/\partial x$, $\delta_2 = \partial/\partial y$ we have $K \cong {\mathbb{Q}}\{ F_1, F_2, F_3 \} / P$, where \begin{align*} \delta_1 F_1 - 1, && \delta_2 F_1, && \delta_1 F_2, && \delta_2 F_2 - 1, && \delta_1 F_3 - 2 F_1 F_3, && \delta_2 F_3 - 2 F_2 F_3, \end{align*} generate the prime differential ideal $P$ such that \begin{align*} {\mathbb{Q}}\{ F_1, F_2, F_3 \} \longrightarrow K: F_1 \longmapsto x, \, F_2 \longmapsto y, \, F_3 \longmapsto \exp(x^2+y^2-1) \end{align*} is an epimorphism of differential algebras over ${\mathbb{Q}}$ mapping precisely $P$ to zero. \end{example} \begin{definition}\label{de:R} Let the \emph{ring of differential operators} $R = K\langle \partial_1, \ldots, \partial_d \rangle$ be the iterated Ore extension of $K$ defined by \[ \begin{array}{rcll} \partial_i \, a & = & a \, \partial_i + \delta_i(a), & \quad a \in K, \quad i = 1, \ldots, d,\\[0.5em] \partial_i \, \partial_j & = & \partial_j \, \partial_i, & \quad i, j = 1, \ldots, d. \end{array} \] \end{definition} \begin{remark}\label{rem:Oreproperty} The ring $R$ is (left) Noetherian, because $K$ is Noetherian (cf., e.g., \cite[Thm.~1.2.9 (iv)]{McConnellRobson}). Moreover, $R$ has the left Ore property, i.e., every pair of non-zero elements of $R$ has a non-zero common left multiple \cite[Thm.~2.1.15]{McConnellRobson}, which, in particular, implies the existence of a ring of fractions of $R$. \end{remark} We define the set of \emph{monomials} of $R$ as \[ \Mon(R) = \{ \, f_1^{\alpha_1} \ldots f_r^{\alpha_r} \, \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \mid \alpha_1, \ldots, \alpha_r, \beta_1, \ldots, \beta_d \in {\mathbb{Z}}_{\ge 0} \, \}. \] It is a basis of $R$ as an ${\mathbb{R}}$-vector space: every $p \in R$ has a unique representation \begin{equation}\tag{$*$}\label{eq:repres_element} p \, = \, \sum_{m \in \Mon(R)} c_m \, m, \end{equation} where $c_m \in {\mathbb{R}}$ and only finitely many $c_m$ are non-zero. \medskip A \emph{monomial ordering} $<$ on $R$ is a total ordering on $\Mon(R)$ satisfying \[ \begin{array}{ll} f_1^0 \ldots f_r^0 \, \partial_1^0 \ldots \partial_d^0 = 1 < m & \quad \mbox{for all } 1 \neq m \in \Mon(R),\\[0.5em] m_1 < m_2 \quad \Rightarrow \quad f_i \, m_1 < f_i \, m_2 & \quad \mbox{for all } m_1, m_2 \in \Mon(R), \, i = 1, \ldots, r,\\[0.5em] m_1 < m_2 \quad \Rightarrow \quad m_1 \, \partial_j < m_2 \, \partial_j & \quad \mbox{for all } m_1, m_2 \in \Mon(R), \, j = 1, \ldots, d. \end{array} \] For every $0 \neq p \in R$ the $<$-greatest monomial $m$ occurring with non-zero coefficient $c_m$ in the representation \eqref{eq:repres_element} of $p$ is called the \emph{leading monomial} of $p$ and is denoted by $\lm(p)$. Its coefficient $c_m$ is called the \emph{leading coefficient} of $p$ and is denoted by $\lc(p)$. For a subset $S$ of $R$ we let $\lm(S) = \{ \, \lm(s) \mid 0 \neq s \in S \, \}$. \begin{example}\label{ex:degrevlex} The \emph{weighted degree-reverse-lexicographical ordering} $<$ with weights $w=(w_1, \ldots, w_{r+d})\in{\mathbb{Q}}_{>0}^{r+d}$ (weighted deg-rev-lex) is defined by \begin{align*} f_1^{\alpha_1} \ldots f_r^{\alpha_r} \partial_1^{\alpha_{r+1}} \ldots \partial_d^{\alpha_{r+d}} < f_1^{\alpha'_1} \ldots f_r^{\alpha'_r} \partial_1^{\alpha'_{r+1}} \ldots \partial_d^{\alpha'_{r+d}} \\ \iff \quad \Bigg(\sum_{j=i}^{r+d} w_i \alpha_i, \alpha_{r+d}, \ldots, \alpha_1\Bigg) >_{{\rm lex}} \Bigg(\sum_{j=i}^{r+d} w_i \alpha'_i, \alpha'_{r+d}, \ldots, \alpha'_1\Bigg), \end{align*} where $\alpha_i, \alpha'_i\in {\mathbb{Z}}_{\ge 0}$ and $>_{{\rm lex}}$ compares tuples lexicographically. \end{example} \begin{example}\label{ex:elimpartials} We let the \emph{elimination ordering} $<$ on $R$ (eliminating $\partial_1$, \ldots, $\partial_d$) be \[ \begin{array}{ll} & f_1^{\alpha_1} \ldots f_r^{\alpha_r} \, \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \, < \, f_1^{\alpha'_1} \ldots f_r^{\alpha'_r} \, \partial_1^{\beta'_1} \ldots \partial_d^{\beta'_d}\\[1em] \iff & \displaystyle \Big( \, \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \, \prec_{\partial} \, \partial_1^{\beta'_1} \ldots \partial_d^{\beta'_d} \qquad \mbox{or}\\[1em] & \displaystyle\quad \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \, = \, \partial_1^{\beta'_1} \ldots \partial_d^{\beta'_d} \quad \mbox{and} \quad f_1^{\alpha_1} \ldots f_r^{\alpha_r} \, \prec_f \, f_1^{\alpha'_1} \ldots f_r^{\alpha'_r} \, \Big), \end{array} \] where $\alpha_i$, $\alpha'_i$, $\beta_j$, $\beta'_j \in {\mathbb{Z}}_{\ge 0}$ and where $\prec_{\partial}$ and $\prec_f$ are the deg-rev-lex ordering on the polynomial algebras ${\mathbb{Q}}[\partial_1, \ldots, \partial_d]$ and ${\mathbb{Q}}[f_1, \ldots, f_r]$, respectively. \end{example} \begin{assumption}\label{assump:termorder} The monomial ordering $<$ on $R$ is chosen such that the leading monomial of \[ \partial_j \, f_i \, = \, f_i \, \partial_j + \delta_j(f_i) \, = \, f_i \, \partial_j + g_{i,j} \] with respect to $>$ is $f_i \, \partial_j$, for all $i = 1$, \ldots, $r$ and $j = 1, \ldots, d$. (Recall that $f_i \, \partial_j + g_{i,j}$ is the representation~\eqref{eq:repres_element} of $\partial_j \, f_i$ taking the generators (\ref{eq:Pgenset}) of the prime differential ideal $P$ into account.) \end{assumption} In what follows, we make Assumption~\ref{assump:termorder}, which is met if $>$ is a degree-reverse-lexicographical ordering with weights $(v_1, \ldots, v_r, w_1, \ldots, w_d)$ satisfying \[ w_j \, \ge \, \max_{i=1, \ldots, r} \left( \, \sum_{k=1}^r v_k \deg_{f_k}(g_{i,j}) - v_i \, \right) \qquad \mbox{for all } j = 1, \ldots, d, \] or if $>$ is an elimination ordering as in Example~\ref{ex:elimpartials}. \medskip Before introducing Janet bases for left ideals of $R$ we recall the concept of \emph{Janet division}, which we formulate for ideals of the free commutative semigroup $({\mathbb{Z}}_{\ge 0})^{r+d}$ in our context. Note that if $I$ is a non-zero left ideal of $R$, then the exponent vectors $(\alpha_1, \ldots, \alpha_r, \beta_1, \ldots, \beta_d)$ of all elements of $\lm(I)$ form an ideal of $({\mathbb{Z}}_{\ge 0})^{r+d}$ due to the definition of a monomial ordering and Assumption~\ref{assump:termorder}. The bijection between $\Mon(R)$ and $({\mathbb{Z}}_{\ge 0})^{r+d}$ may as well be chosen to be, e.g., \[ \varepsilon\colon \Mon(R) \longrightarrow ({\mathbb{Z}}_{\ge 0})^{r+d}: f_1^{\alpha_1} \ldots f_r^{\alpha_r} \, \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \longmapsto (\beta_1, \ldots, \beta_d, \alpha_1, \ldots, \alpha_r), \] which is the bijection we usually work with. \medskip Recall that every ideal of $({\mathbb{Z}}_{\ge 0})^{r+d}$ is finitely generated; moreover, it has a unique minimal generating set. For $k \in \{ 1, \ldots, r+d \}$ we denote by $\textbf{1}_k$ the multi-index with $1$ in position $k$ and $0$ elsewhere. Following M.~Janet (cf., e.g., \cite{Robertz6}) we make the following definition in terms of exponent vectors. \begin{definition} Let $A \subset ({\mathbb{Z}}_{\ge 0})^{r+d}$ be finite and $\alpha = (\alpha_1, \ldots, \alpha_{r+d}) \in A$. Then $\varepsilon^{-1}(\textbf{1}_k)$ is said to be \emph{multiplicative} for the monomial $\varepsilon^{-1}(\alpha)$ if and only if \[ \alpha_k \, = \, \max \{ \, \alpha'_k \mid (\alpha'_1, \ldots, \alpha'_{r+d}) \in A \mbox{ with } \alpha'_1 = \alpha_1, \, \ldots, \, \alpha'_{k-1} = \alpha_{k-1} \, \}. \] Let $M \subset \Mon(R)$ be finite. Then for every $m \in M$ we obtain a partition $\mu(m, M) \uplus \overline{\mu}(m, M)$ of $\{ f_1, \ldots, f_r, \partial_1, \ldots, \partial_d \}$, where each element of $\mu(m, M)$ is multiplicative for $m$ and each element of $\overline{\mu}(m, M)$ is non-mul\-ti\-pli\-ca\-tive for $m$. \end{definition} \begin{example}\label{ex:janetdivision} Let $r = 2$, $n = 1$, $M = \{ \, f_1 \, f_2^2, \, f_1^2 \, f_2, \, f_2 \, \partial_1^2, \, f_1 \, \partial_1^2 \, \}$. Using the above bijection $\varepsilon$ we obtain \[ \begin{array}{l} \mu(f_1 \, f_2^2, M) = \{ \, f_2 \, \}, \qquad \mu(f_1^2 \, f_2, M) = \{ \, f_1, f_2 \, \},\\[0.5em] \mu(f_2 \, \partial_1^2, M) = \{ \, \partial_1, f_2 \, \}, \qquad \mu(f_1 \, \partial_1^2, M) = \{ \, \partial_1, f_1, f_2 \, \}. \end{array} \] \end{example} \begin{definition}\label{de:Janetcomplete} Let $M \subset \Mon(R)$ be finite. We define two supersets of $M$ in $\Mon(R)$ as follows: \[ \begin{array}{rcl} \langle \, M \, \rangle & = & \displaystyle \bigcup_{m \in M} \{ \, f_1^{\phi_1} \ldots f_r^{\phi_r} \, m \, \partial_1^{\psi_1} \ldots \partial_d^{\psi_d} \mid \, \phi_i, \psi_j \in {\mathbb{Z}}_{\ge 0} \, \},\\[1.5em] [ \, M \, ] & = & \displaystyle \biguplus_{m \in M} \{ \, f_1^{\phi_1} \ldots f_r^{\phi_r} \, m \, \partial_1^{\psi_1} \ldots \partial_d^{\psi_d} \mid \, \phi_i, \psi_j \in {\mathbb{Z}}_{\ge 0},\\[1.5em] & & \qquad \qquad \quad \phi_i = 0 \mbox{ if } f_i \not\in \mu(m, M) \mbox{ and } \psi_j = 0 \mbox{ if } \partial_j \not\in \mu(m, M) \, \}, \end{array} \] where the latter union is disjoint by construction of Janet division. The set $M$ of monomials is said to be \emph{Janet complete} if $[ \, M \, ] = \langle \, M \, \rangle$. \end{definition} Any finite subset $M$ of $\Mon(R)$ has a unique smallest (finite) Janet complete superset of $M$, which we call the \emph{Janet completion} of $M$ \cite[Subsect.~2.1.1]{Robertz6}. \begin{definition}\label{de:GB} Let $I$ be a non-zero left ideal of $R$. Using the notation of Definition~\ref{de:Janetcomplete}, a finite generating set $G \subset R \setminus \{ 0 \}$ for $I$ is called a \emph{Gr\"obner basis} for $I$ with respect to the monomial ordering $<$ if $\langle \, \lm(G) \, \rangle = \lm(I)$. If moreover, $\lm(G)$ is Janet complete, i.e., $[ \, \lm(G) \, ] = \langle \, \lm(G) \, \rangle = \lm(I)$, then $G$ is called a \emph{Janet basis} for $I$ with respect to $<$. \end{definition} Assumption~\ref{assump:termorder} facilitates a multivariate polynomial division in $R$. \begin{remark}\label{rem:reduction} Suppose $L \subset R \setminus \{ 0 \}$ is finite and $\lm(L)$ is Janet complete. Let $p_1 \in R \setminus \{ 0 \}$. If $\lm(p_1) \in [ \, \lm(L) \, ]$, then there exists a unique $p_2 \in L$ such that \[ \lm(p_1) \, = \, f_1^{\phi_1} \ldots f_r^{\phi_r} \, \lm(p_2) \, \partial_1^{\psi_1} \ldots \partial_d^{\psi_d} \] for certain $\phi_i$, $\psi_j \in {\mathbb{Z}}_{\ge 0}$, where $\phi_i = 0$ if $f_i \not\in \mu(\lm(p_2), \lm(L))$ and $\psi_j = 0$ if $\partial_j \not\in \mu(\lm(p_2), \lm(L))$. Therefore, subtracting $\lc(p_1) \, f_1^{\phi_1} \ldots f_r^{\phi_r} \, \partial_1^{\psi_1} \ldots \partial_d^{\psi_d} \, p_2$ from $\lc(p_2) \, p_1$ yields either zero or an element of $R$ whose leading monomial is less than $\lm(p_1)$. Since a monomial ordering $<$ does not admit infinitely descending chains of monomials, this reduction procedure always terminates. \end{remark} Iterated reduction, as just defined, modulo a Gr\"obner basis or a Janet basis for the left ideal $I$ allows to decide membership to $I$. \begin{proposition}\label{prop:membership} Let $G$ be a Gr\"obner basis or a Janet basis for the left ideal $I$ of $R$ with respect to any monomial ordering $<$, and let $p \in R$. Then we have $p \in I$ if and only if the remainder of reduction of $p$ modulo $G$ is zero. \end{proposition} \begin{remark}\label{rem:computJB} Given a finite generating set $L$ for a non-zero left ideal $I$ of $R$ and given a monomial ordering $<$ as above, a Janet basis for $I$ with respect to $<$ can be computed in finitely many steps \cite{Robertz6}. After a preliminary pairwise reduction of elements of $L$ ensuring that the leading monomials of elements of $L$ are pairwise different and that $\varepsilon(\lm(L))$ is the unique minimal generating set of the ideal of $({\mathbb{Z}}_{\ge 0})^{r+d}$ it generates, multiplicative and non-mul\-ti\-pli\-ca\-tive variables are determined for each leading monomial (with respect to $\lm(L)$) and $L$ is replaced by its Janet completion. Reduction of left multiples of elements of $L$ by non-mul\-ti\-pli\-ca\-tive variables may yield non-zero remainders in $I$. Augmenting $L$ by such elements results in a larger ideal $\varepsilon(\lm(L))$ of $({\mathbb{Z}}_{\ge 0})^{r+d}$ than previously. Since every ascending chain of such ideals becomes stationary after finitely many steps, by iteration of these steps, one obtains a generating set $G$ for $I$ whose left multiples by non-mul\-ti\-pli\-ca\-tive variables reduce to zero modulo $G$, which is a Janet basis for $I$ with respect to $<$. \end{remark} \section{Module-theoretic constructions}\label{section_modules} The techniques of Section~\ref{section_Ore} can be extended to effectively deal with finitely presented left (and right) $R$-modules and module homomorphisms between them. \medskip Let $R$ be as in the previous section and $q \in {\mathbb{N}}$. We choose the standard basis $e_1$, \ldots, $e_q$ of the free left $R$-module $R^{1 \times q}$ and define the set of monomials \[ \Mon(R^{1 \times q}) = \{ \, f_1^{\alpha_1} \ldots f_r^{\alpha_r} \, \partial_1^{\beta_1} \ldots \partial_d^{\beta_d} \, e_k \mid \alpha_i, \beta_j \in {\mathbb{Z}}_{\ge 0}, \, k = 1, \ldots, q \, \}. \] Then every element of $R^{1 \times q}$ has a unique representation as in \eqref{eq:repres_element}, where $\Mon(R)$ is replaced by $\Mon(R^{1 \times q})$. By generalizing the notion of monomial ordering defined in Section~\ref{section_Ore} to total orderings on $\Mon(R^{1 \times q})$, one can extend the reduction procedure described in Remark~\ref{rem:reduction} and indeed any algorithm computing Gr\"obner or Janet bases for left ideals of $R$ to one that computes Gr\"obner or Janet bases for submodules $R^{1 \times p} A$ of $R^{1 \times q}$, where $A \in R^{p \times q}$. In particular, membership to such a submodule can be decided by reduction, and therefore, computations with residue classes in $R^{1 \times q} / R^{1 \times p} A$ can be performed effectively. \medskip We recall some relevant monomial orderings on $R^{1 \times q}$. \begin{example}\label{ex:TOPandPOT} A monomial ordering $\prec$ on $R$ can be extended to monomial orderings $<$ on $R^{1 \times q}$ in different ways, for example, by defining \[ m_1 \, e_k \, < \, m_2 \, e_l \quad \iff \quad \Big( \, m_1 \prec m_2 \quad \mbox{or} \quad \big( \, m_1 = m_2 \quad \mbox{and} \quad k > l \, \big) \, \Big) \] (``term-over-position''), or by defining \[ m_1 \, e_k \, < \, m_2 \, e_l \qquad \iff \qquad \Big( \, k > l \quad \mbox{or} \quad \big( \, k = l \quad \mbox{and} \quad m_1 \prec m_2 \, \big) \, \Big) \] (``position-over-term''), where $m_1$, $m_2 \in \Mon(R)$ and $k$, $l \in \{ 1, \ldots, q \}$. \end{example} \begin{example}\label{ex:elimtuples} Let $s \in \{ 1, \ldots, q-1 \}$ and $\prec_1$, $\prec_2$ be monomial orderings on $R^{1 \times s}$ and $R^{1 \times (q-s)}$, with standard bases $e_1$, \ldots, $e_s$ and $e_{s+1}$, \ldots, $e_q$, respectively. A \emph{monomial ordering $<$ on $R^{1 \times q}$ eliminating $e_1$, \ldots, $e_s$} is defined by \[ \begin{array}{rcl} m_1 \, e_k \, < \, m_2 \, e_l & \iff & \Big( \, l \le s < k \quad \, \mbox{or}\\[1em] & & \quad \big( \, k \le s \quad \mbox{and} \quad l \le s \quad \mbox{and} \quad m_1 \, e_k \, \prec_1 \, m_2 \, e_l \, \big) \quad \, \mbox{or}\\[1em] & & \quad \big( \, k > s \quad \mbox{and} \quad l > s \quad \mbox{and} \quad m_1 \, e_k \, \prec_2 \, m_2 \, e_l \, \big) \, \Big)\,, \end{array} \] where $m_1$, $m_2 \in \Mon(R)$ and $k$, $l \in \{ 1, \ldots, q \}$. \end{example} \begin{remark}\label{rem:kernel} Let $\varphi\colon R^{1 \times a} \to R^{1 \times b}$ be a homomorphism of left $R$-modules, represented by a matrix $A \in R^{a \times b}$. A Janet basis for the nullspace of $\varphi$ can be computed as follows. Join the two standard bases of $R^{1 \times a}$ and $R^{1 \times b}$ to obtain the basis $e_1$, \ldots, $e_a$, $e_{a+1}$, \ldots, $e_{a+b}$ of $R^{1 \times a} \oplus R^{1 \times b} \cong R^{1 \times (a+b)}$. Let $<$ be a monomial ordering on $R^{1 \times (a+b)}$ as defined in Example~\ref{ex:elimtuples} for $q = a+b$, $s = a$ and certain $\prec_1$ and $\prec_2$, i.e., eliminating $e_1$, \ldots, $e_a$. Then let $J_0$ be a Janet basis, with respect to $<$, for the submodule of $R^{1 \times (a+b)}$ generated by the rows of the matrix $(A \quad I_a) \in R^{a \times (b+a)}$, where $I_a$ is the identity matrix. Now $J := \{ \, w \in R^{1 \times a} \mid (0, w) \in J_0 \, \}$ is a a Janet basis for the nullspace of $\varphi$ with respect to $\prec_2$ (cf.\ also \cite[Ex.~3.10]{RobRecentProgress}, \cite[Ex.~3.1.27]{Robertz6}). \end{remark} \begin{remark}\label{rem:involution} An involution $\theta: R \to R$ of $R$ allows to reduce computations with right $R$-modules to computations with left $R$-modules. More precisely, if we have $\theta(r_1 + r_2) = \theta(r_1) + \theta(r_2)$ and $\theta(r_1 \, r_2) = \theta(r_2) \, \theta(r_1)$ and $\theta(\theta(r)) = r$ for all $r_1$, $r_2$, $r \in R$, then any right $R$-module $M$ is turned into a left $R$-module $\widetilde{M} := M$ (as abelian groups) via $r \, m := m \, \theta(r)$, where $r \in R$, $m \in \widetilde{M}$, and vice versa. The involution $\theta$ is extended to matrices by (cf.\ also \cite[Rem.~3.11]{RobRecentProgress}) \[ \theta(A) := (\theta((A^{tr})_{i,j}))_{1 \le i \le q, 1 \le j \le p} \in R^{q \times p}, \qquad \quad A \in R^{p \times q}. \] Since for $A \in R^{p \times q}$, $B \in R^{q \times r}$ we have $A \, B = 0$ if and only if $\theta(B) \, \theta(A) = 0$, the computation of nullspaces of homomorphisms of right $R$-modules is reduced to the situation described in Remark~\ref{rem:kernel}. For $R$ introduced in Definition~\ref{de:R} we choose \[ \theta: R \to R, \quad \theta|_{K} := {\rm id}_{K}, \quad \theta(\partial_j) := -\partial_j, \quad j = 1, \ldots, d. \] \end{remark} \section{Parametrizing boundary conditions}\label{section_boundary} This section constructs parametrizations of functions satisfying certain boundary conditions, independent of the parametrization of differential equations. We restrict ourselves to boundary conditions parametrized by analytic functions for two reasons. First, this allows algebraic algorithms. Second, due to the limiting behaviour of \glspl!{gp} when conditioning on more data points, closed sets of functions are preferable, see Theorem~\ref{thm_analytical_spectral}. For approximate resp.\ asymptotic resp.\ partially unknown boundary conditions for \glspl!{gp} see \cite{solin2019know} resp.\ \cite{tan2018gaussian} resp.\ \cite{gulian2020gaussian}. For a theoretic approach to endow RKHS with boundary information see \cite{nicholson2022kernel}. Let again $\ensuremath{\mathcal{F}}=C^\infty(D,{\mathbb{R}})$ with Fr\'echet topology from \eqref{eq_frechet} be the set of smooth functions on $D\subset{\mathbb{R}}^d$ compact, $K = {\mathbb{R}}\{ f_1, \ldots, f_r \}$ with analytic functions $f_i: D\to{\mathbb{R}}$, and let $R\supseteqK$ be the Ore extension of $K$. This section is based on two theorems. The first theorem describes closed modules satisfying a Nullstellensatz via their Taylor expansion. Denote by $T_p$ the Taylor series of a (vector of) smooth function(s) around a point $p\in D$. \begin{theorem}[{Whitney's Spectral Theorem; {\cite{whitney1948ideals}, \cite[V Theorem~1.3]{tougeron1972ideaux}}}]\label{thm_whitney_spectral} A module $M\le C^\infty(D,{\mathbb{R}})^\ell$ has topological closure $\overline{M}=\bigcap_{p\in D} T^{-1}_p(T_p(M))$. \end{theorem} The second theorem specifies that analytic functions generate closed ideals. \begin{theorem}[{\cite[Theorem 4]{malgrange1959division}, \cite[VI Theorem~1.1]{tougeron1972ideaux}}]\label{thm_analytical_spectral} Let $f_{ij}$ be finitely many analytic functions on $D\subset {\mathbb{R}}^d$ and $\phi_i\in C^\infty(D,{\mathbb{R}})$. Then there are $\psi_j\in C^\infty(D,{\mathbb{R}})$ with $\phi_i=\sum_jf_{ij}\psi_j$ if and only if for all $p\in D$ the Taylor series of each $\phi_i$ is an ${\mathbb{R}}[[x_i,\ldots,x_d]]$-linear combination of the Taylor series of the $f_{ij}$. \end{theorem} \subsection{Boundary conditions for function values of single functions} We begin parametrizing functions which are zero on an analytic set $M$, e.g.\ Dirichlet boundary conditions which prescribe values at the boundary $\partial D$. We define boundaries $M\subseteq D$ implicitly via \begin{align*} M={\mathcal{V}}(I):=\left\{m\in D\,\middle|\, b(m)=0\mbox{ for all }b\in I\right\}\subseteq D\mbox{,} \end{align*} where $I\trianglelefteq K$ is an ideal of equations. For any analytic set $M\subseteq D$ we have $M={\mathcal{V}}({\mathcal{I}}(M))$, where ${\mathcal{I}}(M)=\{b\in\ensuremath{\mathcal{F}}^\ell\mid b(m)=0\mbox{ for all }m\in M\}\subseteq \ensuremath{\mathcal{F}}$ is the (closed and radical) ideal of functions vanishing at $M$. If $I$ is radical (it is automatically closed by Theorem~\ref{thm_analytical_spectral}, as generated by analytic functions), then ${\mathcal{I}}({\mathcal{V}}(I))=I$. Hence, any set of analytic function defined on $D$ which generates a radical ideal parametrizes functions vanishing at its zero set. More formally: \begin{proposition}\label{proposition_boundary} Let $B'\in K^{1\times\ell}$ be a row of analytic functions whose entries generate a radical ideal $I=B'\ensuremath{\mathcal{F}}^{\ell}$ of smooth functions. Then, $I$ is the set $\left\{f\in\ensuremath{\mathcal{F}} \mid f_{|{\mathcal{V}}(I)}=0\right\}$ of smooth functions vanishing at ${\mathcal{V}}(I)$. \end{proposition} \begin{proof} The condition $f_{|{\mathcal{V}}(I)}=0$ restricts the zeroth order Taylor coefficients by homogeneous equations. All functions satisfying such restrictions are contained in a closed ideal of $\ensuremath{\mathcal{F}}$ by Whitney's Spectral Theorem~\ref{thm_whitney_spectral}. The $\ensuremath{\mathcal{F}}$-module parametrization given in this proposition uses analytic functions as generators, which generates the (closed by Theorem~\ref{thm_analytical_spectral}) ideal $I$.\qed \end{proof} We now compare constructions of rows $B'$ of functions in Proposition~\ref{proposition_boundary}. \begin{example}\label{example_dirichlet} Functions $\ensuremath{\mathcal{F}}=C^\infty([0,1]^d,{\mathbb{R}})$ with Dirichlet boundary conditions $f(\partial D)=0$ at the boundary of the domain $D=[0,1]^d$ are parametrized by \begin{align}\label{example_dirichlet_1} B_1'=\begin{bmatrix} \prod_{i=1}^dx_i(x_i-1) \end{bmatrix} \end{align} over $K={\mathbb{R}}\{x_1,\ldots,x_n\}={\mathbb{R}}[x_1,\ldots,x_n]$, by \begin{align}\label{example_dirichlet_2} B_2'=\begin{bmatrix} 1-\exp\left((-1)^{d+1}\cdot\frac{\prod_{i=1}^dx_i(x_i-1)}{\delta}\right) \end{bmatrix} \end{align} over $K={\mathbb{R}}\{\exp(x_1^2),\exp(x_1),x_1,\ldots,\exp(x_d^2),\exp(x_d),x_d\}$, or by\footnote{$B_3'$ is obtained as the product of the standard deviations obtained by conditioning $d$ one-dimensional squared exponential covariances to the data points $(0,0)$ and $(1,0)$.} \begin{align}\label{example_dirichlet_3} B_3'=\begin{bmatrix} \sqrt{\prod_{i=1}^d\left(1+\frac{\exp\left(-\frac{x_i^2}{\delta}\right)-2\exp\left(-\frac{x_i^2-x_i+1}{\delta}\right)+\exp\left(-\frac{(x_i-1)^2}{\delta}\right)}{\exp\left(-\frac{1}{\delta}\right)-1}\right)} \end{bmatrix} \end{align} for any $\delta>0$. See {\cite[Section~3]{NoisyLinearOperatorEquationsGP}} for the special case $d=2$ in \eqref{example_dirichlet_1}. For practical differences of these formalizations of boundary conditions see Remark~\ref{remark_comparison_boundaries}. \end{example} Block diagonal matrices parametrize boundaries of a vector of $\ell>1$ functions. Also, restrictions on sets with higher codimension can be defined. \begin{example} \sloppy The following three matrices $\begin{bmatrix} 1-\exp\left(-\frac{|x|}{\delta}\right) & 1-\exp\left(-\frac{|y|}{\delta}\right) \end{bmatrix}$, $\begin{bmatrix} 1-\exp\left(-\frac{\sqrt{x^2+y^2}}{\delta}\right) \end{bmatrix}$, and $\begin{bmatrix} 1-\exp\left(-\frac{x^2+y^2}{\delta}\right) \end{bmatrix}$ parametrize functions $f\in\ensuremath{\mathcal{F}}=C^\infty({\mathbb{R}}^3,{\mathbb{R}})$ with $f(0,0,z)=0$. The last parametrization is analytic. \end{example} \subsection{Boundary conditions for derivatives and vectors} Boundary conditions with vanishing derivatives can be constructed using multiplicities in the (no longer radical) ideal. The proof of the following proposition again follows from Theorems~\ref{thm_whitney_spectral} and \ref{thm_analytical_spectral}, in a similar way to Proposition~\ref{proposition_boundary}. \begin{proposition}\label{proposition_boundary_derivatives} Let $B'\in K^{\ell\times\ell'}$ be a matrix of analytic functions whose columns generate a module $M=B'\ensuremath{\mathcal{F}}^{\ell'}\le \ensuremath{\mathcal{F}}^\ell$ of smooth functions. Then, \begin{align*} \textstyle \left\{f\in\ensuremath{\mathcal{F}}^\ell\,\middle|\,\forall p\in D\ \exists a_i\in{\mathbb{R}}[[x_1,\ldots,x_d]]\ \forall 1\le i\le\ell: T_p(f_i)=\sum_{j=1}^{\ell'} T_p(b_{ij})a_j \right\} \end{align*} is the closed set of smooth functions sharing the same vanishing lower order Taylor coefficients as the columns of $B'$. \end{proposition} \begin{figure}[t] \centering \inputtikz{boundary_comparisons} \caption{% \glspl!{gp}, represented by their mean function and two standard deviations. Upper left: a \gls!{gp} $g$ with mean zero and square exponential covariance function. Upper middle: pushforward of the \gls!{gp} $g$ by $x\cdot(x-1)$ has a strong global influence. Upper right resp.\ lower left: pushforward of the \gls!{gp} $g$ by \eqref{example_dirichlet_2} resp.\ \eqref{example_dirichlet_3}. Lower middle resp.\ right: pushforward of the \gls!{gp} $g$ by \eqref{example_dirichlet_better_3} resp.\ \eqref{example_dirichlet_better_4} set the function and its derivative to zero at the boundary. Set $\delta:=\frac{1}{100}$. } \label{figure_comparison_boundaries} \end{figure} \begin{example}\label{example_boundary_derivative} Functions $\ensuremath{\mathcal{F}}=C^\infty([0,1]^d,{\mathbb{R}})$ with Dirichlet boundary conditions $f(\partial D)=0$ and Neumann boundary condition $\frac{\partial f}{\partial n}(\partial D)=0$ for $n$ the normal to the boundary $\partial D$ of the domain $D=[0,1]^d$ are parametrized by \begin{align}\label{example_dirichlet_better_3} B'= \begin{bmatrix} 1-\exp\left((-1)^{d+1}\cdot\frac{\prod_{i=1}^dx_i^2(x_i-1)^2}{\delta}\right) \end{bmatrix}\mbox{,} \end{align} constructed by squaring the exponent from the parametrization in \eqref{example_dirichlet_2}, or \begin{align}\label{example_dirichlet_better_4} B'=\begin{bmatrix} \prod_{i=1}^d\left(1+\frac{\exp\left(-\frac{x_i^2}{\delta}\right)-2\exp\left(-\frac{x_i^2-x_i+1}{\delta}\right)+\exp\left(-\frac{(x_i-1)^2}{\delta}\right)}{\exp\left(-\frac{1}{\delta}\right)-1}\right) \end{bmatrix}\mbox{,} \end{align} constructed by the squaring of the parametrization \eqref{example_dirichlet_3} for any $\delta>0$. \end{example} \begin{remark}\label{remark_comparison_boundaries} In applications, the non-polynomial parametrizations from Examples~\ref{example_dirichlet} and \ref{example_boundary_derivative} are more suitable. We demonstrate the effect by pushforward \glspl!{gp} obtained from these parametrizations in Figure~\ref{figure_comparison_boundaries}. The polynomial pushforward from Example~\ref{example_dirichlet} yields the variance $x^2\cdot(x-1)^2$, which strongly varies in the input interval $[0,1]$. The analytic pushforwards from Example~\ref{example_dirichlet} also set the variance to zero at the boundary, but quickly return to the original variance, and never exceed it. Even the speed of returning to the original variance can be controlled by changing the parameter $\delta$. \end{remark} \section{Examples}\label{section_examples} We summarize the construction from \cite{LH_AlgorithmicLinearlyConstrainedGaussianProcessesBoundaryConditions} to intersect boundary conditions with solution sets. At the same time, we extend this approach to the case of analytic boundary conditions using the Gr\"obner basis algorithms developed in this paper. \begin{theorem}[{\cite[Theorem~5.2]{LH_AlgorithmicLinearlyConstrainedGaussianProcessesBoundaryConditions}}]\label{theorem_combining_parametrizations} Let $B_1\in R^{\ell\times\ell_1''}$ and $B_2\in R^{\ell\times\ell_2'}$. Denote by $C:=\begin{bmatrix} C_1 \\ C_2\end{bmatrix}\in R^{(\ell_1'+\ell_2')\times m}$ the right-nullspace of the matrix $B:=\begin{bmatrix} B_1 & B_2\end{bmatrix}\in R^{\ell\times(\ell_1'+\ell_2')}$. Then $B_1C_1=-B_2C_2$ parametrizes solutions of $B_1\ensuremath{\mathcal{F}}^{\ell_1'}\cap B_2\ensuremath{\mathcal{F}}^{\ell_2'}$. \end{theorem} Intersecting images of parametrizations $B_1\in R^{\ell\times\ell_1'}$ and $B_2\in R^{\ell\times\ell_2'}$ needs a suitable common ring $R$. If e.g.\ $B_1$ is a matrix of differential operators and $B_2$ is a matrix of analytic functions, then both can be considered as matrices over a Weyl algebra. This necessitates the Gröbner basis algorithms developed earlier. \begin{figure}[t] \centering \includegraphics{tikz/double_drop_1.pdf} \includegraphics{tikz/double_drop_2.pdf} \caption{The mean fields of the \gls!{gp} for divergence-free fields in the interior of $y^2=\sin(x)^4$ from Example~\ref{example_double_drop}, which are conditioned on the data $(-1,0)$ at $(\frac{\pi}{2},0)$ (left) and on $(1,0)$ resp.\ $(0,1)$ at $(\frac{\pi}{4},0)$ resp.\ $(\frac{\pi}{2},0)$. The data is plotted artificially larger in red. The flow at the analytic boundary is zero.} \label{figure_double_drop} \end{figure} \begin{example}\label{example_double_drop} Consider divergence-free fields in the region in ${\mathbb{R}}^2$ bounded by $f:=y^2-\sin(x)^4$ for $x\in[0,\pi]$. Hence, consider $A=\begin{bmatrix} \partial_x & \partial_y \end{bmatrix}$, $B_1=\begin{bmatrix} \partial_y \\ -\partial_x \end{bmatrix}$ and $B_2=\begin{bmatrix} f & 0 \\ 0 & f \end{bmatrix}$. The Matrix $C=\begin{bmatrix} f^2 \\ \partial_y f \\ -\partial_x f \end{bmatrix}$ from Theorem~\ref{theorem_combining_parametrizations} yields the parametrization $\begin{bmatrix} \partial_yf^2 \\ -\partial_xf^2 \end{bmatrix}=\begin{bmatrix} f^2\partial_y+4\cdot f\cdot y \\ -f^2\partial_x+8\cdot f\cdot \sin(x)^3\cos(x) \end{bmatrix}$ and the push forward covariance \begin{align*} \tiny k\cdot f_1\cdot f_2\cdot \begin{bmatrix} f_1f_2+16y_1y_2+4\delta_y\cdot(f_1y_2-f_2y_1)-f_1f_2\delta_y^2 & (f_1y_1-f_1y_2+4y_1)\cdot(\delta_x\cdot f_2+\operatorname{sc}(x_2)) \\ (f_2y_1-f_2y_2-4y_2)\cdot(\delta_x\cdot f_1+\operatorname{sc}(x_1) & (\operatorname{sc}(x_1)-\delta_x\cdot f_1)\cdot (\operatorname{sc}(x_2)+\delta_x\cdot f_2) -f_1f_2\cdot(2\delta_x^2-1) \end{bmatrix} \end{align*} of the squared exponential covariance function $k=\exp(-\frac{1}{2}((x_1-x_2)^2+(y_1-y_2)^2))$, where $f_1=f(x_1,y_1)$, $f_2=f(x_2,y_2)$, $\delta_x=x_1-x_2$, $\delta_y=y_1-y_2$, and $\operatorname{sc}(x)=8\sin(x)^3\cos(x)$. For an illustration of this covariance see Figure~\ref{figure_double_drop}. \end{example} \begin{example}\label{example_compact_snake} \begin{figure}[t]\label{figure_compact_snake} \centering \inputtikz{compact_snake} \caption{ The mean fields of the \gls!{gp} for divergence-free fields from Example~\ref{example_compact_snake}, which are conditioned on $v=(0,-1)$ at $(0,1)$. The flow at the left and right boundary is zero, at the bottom resp.\ top there is flow into resp.\ out of the region. Both data point resp.\ inhomogeneous boundary conditions are plotted artificially larger in red resp.\ blue. } \end{figure} Consider divergence-free fields in the compact domain $D$ bounded by $-\frac{\pi}{2}\le y\le\frac{\pi}{2}$ and $3\sin(y)\le x\le3\sin(y)+2$. Hence, consider $A=\begin{bmatrix} \partial_x & \partial_y \end{bmatrix}$, $B_1=\begin{bmatrix} \partial_y \\ -\partial_x \end{bmatrix}$ and $B_2=\begin{bmatrix} f & 0 \\ 0 & f \end{bmatrix}$ for $f=(y-\frac{\pi}{2})\cdot(y+\frac{\pi}{2})\cdot(x-3\sin(y))\cdot(x-3\sin(y)-2)$. As the first entry in the column $C$ is $f^2$, such fields can be parametrized by $\begin{bmatrix} \partial_yf^2 \\ -\partial_xf^2 \end{bmatrix}$. Pushing forward the squared exponential covariance function yields a covariance too big to display. To encode non-zero boundary conditions we use a non-zero mean. Using the potential $p:=-\frac{1}{4}\cdot(3\sin(y)-x+3)\cdot(3\sin(y)-x)^2$ yields the divergence-free \begin{align*} \mu:= \begin{bmatrix} -\frac{9}{4} \cdot \cos(y) \cdot (3 \sin(y)-x+2) \cdot (3 \sin(y)-x)\\ -\frac{3}{4} \cdot (3 \sin(y)-x+2) \cdot (3 \sin(y)-x) \end{bmatrix} = \begin{bmatrix} \partial_y\\ -\partial_x \end{bmatrix} p \end{align*} satisfying the left and right boundaries and non-zero flow through at top and bottom. The \gls!{gp} $\GP(\mu,k)$ hence models of divergence-free fields in $D$ with no flow on the sinoidal boundary left or right, but flow into $D$ from the bottom and out of $D$ at the top of the region. See Figure~\ref{figure_compact_snake} for a demonstration. \end{example} \section*{Acknowledgements} The authors thank Andreas Besginow for discussions about this paper. \bibliographystyle{plain}
\section{Introduction} \label{sec:intro} Swarm robotics can be defined as ``the study of how a large number of relatively simple physically embodied agents can be designed such that a desired collective behaviour emerges from the local interactions among the agents and between the agents and the environment''~\cite{Sahin2008}. Robot swarms aim to be robust, flexible and scalable due to their decentralised nature and their large group size. Brambilla et al.\,\cite{Brambilla2013SwarmRoboticsAReviewFromTheSwarmEngineeringPerspective} and Schranz et al.\,\cite{Schranz2020SwarmRoboticBehaviorsAndCurrentApplications} give an overview of the basic collective behaviours that robot swarms can display in order to achieve complex tasks such as coordinated motion, task allocation, self-assembly or aggregation, which is studied in this paper. Aggregation is used to group the swarm in a location---for example, to initiate a collaborative task that requires physical proximity among the robots. Inspiration for self-organised aggregation can be found in animals such as bees~\cite{Szopek2013} or cockroaches~\cite{Jeanson2005}. Several approaches have been studied in swarm robotics to achieve aggregation. A popular method is to control the robots through probabilistic finite-state machines. Soysal and \c{S}ahin \cite{Soysal2005} analysed the performance of a three-state finite-state machine while varying different transitional probabilistic parameters. Variations of the controller yielded different aggregation behaviours highlighting the importance of the evaluation metrics used such as cluster sizes or total distances between robots. Cambier et al.\,\cite{Cambier2021CulturalEvolutionOfProbabilisticAggregation} studied the influence of cultural propagation in an aggregation scenario. Using a simple finite-state machine with two states, robots communicated with each other to modify the probabilistic parameters of their controllers. This behavioural plasticity has ensured adaptability to dynamic environments and performed better than classical approaches. Simpler methods have also been proposed to achieve self-organised aggregation as in~\cite{Gauci2014SelfOrganizedAggregationWithoutComputation} where the only sensor available to the robots is a binary sensor informing them on the presence of another robot in their line of sight. The controller did not require computation and the parameters were chosen via a grid search. This approach is validated with successful experiments with 1000 simulated robots and 40 physical robots. Francesca et al.\,\cite{Francesca2014AutoMoDeANovelApproachToTheAutomaticDesign} showed that self-organised aggregation can be achieved by robots controlled by probabilistic finite-state machines that are generated automatically. Artificial evolution has also been used to evolve controllers resulting in self-organised aggregation~\cite{Dorigo2004}. Francesca et al.\,\cite{Francesca2012AnalysingAnEvolvedRoboticBehaviourUsingABiologicalModelOfCollegialDecisionMaking} evolved a neural network controller to perform self-organised aggregation and showed that the dynamics of the resulting collective behavior closely matches the one of a biological model that describes how cockroaches select a resting shelter. Kengyel et al.~\cite{Kengyel2015PotentialOfHeterogeneityInCollectiveBehaviors} studied aggregation in heterogeneous robot swarms where each robot ran one among four distinct behaviours inspired from aggregation in honeybees. The number of robots running the alternative behaviours were varied using an evolutionary algorithm. The results of the simulations show that through the cooperation of different types of behaviours, the heterogeneous swarm performs better than its homogeneous equivalent. In this study, we revisit the methods illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} to steer self-organised aggregation responses with the use of informed robots. Generally speaking, the use of informed individuals to steer the dynamic process leading to the group response is a method to guide self-organisation in distributed systems inspired by behaviours observed in biology. In a seminal study, Couzin et al.\,\cite{CouzinEtAl2005} studied the influence of informed individuals in collective decision making in the context of collective animal motion. The informed individuals had a preferred direction of motion and biased the collective decision in that direction. The rest of the swarm did not have any preferred direction of motion, nor was able to recognise informed individuals as such. The study shows that the accuracy of the group motion towards the direction known by the informed agents increases asymptotically as the proportion of informed individuals increases, and that the larger the group, the smaller the proportion of informed individuals needed to guide the group with a given accuracy. A recent study on cockroaches~\cite{Martin2021ConsensusDrivenByAMinorityInHeterogeneousGroups} has shown that a minority of individuals preferring one shelter over the other can influence the population to reach a consensus for only one site. The technique of using informed individuals to steer the collective dynamics has already been used in artificial systems with various types of collective behaviours. For example, informed individuals have been used in flocking~\cite{Celikkanat-Sahin2010SteeringSelf-organizedRobotFlocksThroughExternallyGuidedIndividuals,Ferrante2012Self-organizedFlockingWithAMobileRobotSwarmANovelMotionControlMethod,Ferrante2014ASelf-adaptiveCommunicationStrategyForFlockingInStationaryAndNonStationaryEnvironments} to guide the robot swarm in the desired direction, in collective decision making~\cite{Prasetyo2019CollectiveDecisionMakingInDynamicEnvironments,Masi2021} to achieve adaptability, and in self-organised aggregation to differentiate between multiple sites~\cite{Firat2020OnSelf-OrganisedAggregationDynamics,Firat2020Group-sizeRegulationInSelf-OrganisedAggregation,Firat2018TPNC,Gillet2019GuidingAggregationDynamicsInASwarmOfAgentsViaInformedIndividuals}. In this paper, we replicate the experimental setup originally illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} by showing that equally effective aggregation dynamics can be obtained with a largely simplified approach. The aggregation response described in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} took place in a circular arena with two aggregation sites, the black and the white site (see Fig.~\ref{fig:methods}a). The goal of the swarm was to distribute the robots between the two sites in a desired proportion (e.g. 70\% of the robots on the white site and the remaining 30\% on the black one) while minimizing the total proportion of informed robots. Non-informed robots treated both sites in the same way while informed robots were designed to systematically avoid one of the sites and to rest on the other. The swarm comprised a certain proportion of informed robots, among which there were those that selectively rested on the black site and those that rested only on the white site. The study shows that the proportion of robots on black/white site at the end of an aggregation process matches the proportion of informed robots resting only on the black/white site relative to the number of informed robots in the swarm (see Sec.~\ref{sec:methods} for more details). These aggregation dynamics can be achieved using a relatively low percentage of informed robots in the swarm---roughly 30\% for a swarm of 100 robots. In~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, the robots were controlled by a probabilistic finite-state machine illustrated in details in Sec.~\ref{sec:methods} and depicted in Fig.~\ref{fig:methods}c. In this study, we question the nature of the mechanisms regulating the transition from state Stay ($\mathcal{S}$) to state Leave ($\mathcal{L}$), and the type of communication protocol involved in these mechanisms, by suggesting an alternative solution that largely simplifies the rule regulating the transition between these two states for non-informed robots. Following the ``Occam's razor'' principle, the solution we illustrate in this paper can represent a preferable alternative to the more complex solution proposed in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} and can help the porting of the control system to the physical robots. Moreover, we remove differences both in behaviour and in communication capabilities between informed and non-informed robots that, in our view, undermine the robustness of the aggregation process. For example, in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, non-informed robots rest on an aggregation site if this is already inhabited by at least one informed robot that signals its presence on the site. Thus, an aggregation process can only be initiated by informed robots. This can significantly delay the aggregation process, in particular in those operating conditions in which the probability that an informed robot finds and rests on an aggregation site is relatively low. Additionally, this makes the swarm less robust to the loss of informed robots. In the extreme case of a loss of all informed robots, there will be no aggregation at all. With our approach, aggregation dynamics can emerge independently of the presence of informed robots. This increases the range of group responses that the swarm can generate without interfering with the effectiveness of the aggregation dynamics. \section{Materials and Methods} \label{sec:methods} \begin{figure}[t] \centering \begin{tabular}{ccc} \includegraphics[width=0.3\textwidth]{aggregation.png}&~~ \includegraphics[width=0.165\textwidth]{fb-final.jpg}&~~ \includegraphics[width=0.35\textwidth]{PFSM.pdf}\\ (a) & (b) & (c) \end{tabular} \caption{(a) The simulated circular arena with the robots (blue dots) and the aggregation sites (black and white circles). (b) The Foot-bot robot \cite{bonani2010marxbot}; image from \url{www.swarmanoid.org}. (c) The probabilistic finite-state machine controlling the robot behaviour.} \label{fig:methods} \end{figure} The experiments are ran using ARGoS~\cite{Pinciroli2012ARGoSAModularParallelMulti}, which is one of the best-performing simulators to run physics-based simulations for large-scale robot swarms~\cite{Pitonakova2018}. The robots operate in a circular environment where the aggregation sites are circular areas located at equal distance between the center of the arena and its perimetric wall (Fig.~\ref{fig:methods}a). One site is painted in black, the other in white; the arena floor is grey. We perform our experiments with a simplified model of the Foot-bot \cite{bonani2010marxbot} (see Fig.~\ref{fig:methods}b), a mobile robot that we equip with three types sensors: a ground sensor, an array of proximity sensors, and the range-and-bearing sensor. The ground sensor is located on the robot's underside, to detect the colour of the ground; it returns 1, 0.5, and 0 when a robot is on a white, grey, and black floor, respectively. The proximity sensors use infrared (IR) signals to detect obstacles such as other robots or the arena walls. The range-and-bearing sensor is used by the robots to exchange simple communication signals when they are located at less than \unit[0.8]{m} from each other. A trial starts with the robots randomly placed in the arena following a uniform distribution, and it terminates after \unit[30,000]{s}. As in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, the swarm of size $N$ is composed of informed robots (in proportion $\rho_{I}$) and non-informed ones (in proportion $ 1-\rho_{I}$). During a trial, both informed and non-informed robots move randomly in the environment at \unitfrac[10]{cm}{s}. Non-informed robots can rest on any aggregation site as soon as they enter into one of them. Informed robots selectively avoid to rest on one site and rest only on the other one. There are informed robots for black---which avoid to rest on the white site, and rest on the black aggregation site only---and informed robots for white---which avoid to rest on the black site, and rest on the white site only. Let $N_{sb}$ be the number of informed robots for black, $N_{sw}$ the number of informed robots for white, $\rho_{sb} = \frac{N_{sb}}{N_{sb}+N_{sw}}$ the proportion of informed robots for black relative to the total number of informed robots, and $\rho_{sw} = 1 - \rho_{sb}$ the proportion of informed robots for white relative to the total number of informed robots. Firat et al.\,~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} demonstrated that, with a relatively small proportion of informed robots in the swarm ($\rho_{I} \approx 0.3$) and for different values of $\rho_{sb}$ and $\rho_{sw}$, the number of robots aggregated on the black site is approximately equal to $N \, \rho_{sb} $, while the number of those aggregated on the white site is approximately equal to $N \, \rho_{sw}$, for swarms of size $N=50$ and for $N=100$. Our objective is to replicate this aggregation dynamics with a largely simplified model illustrated below. The primary difference between our model and the one illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} resides in the way in which the robots communicate while within an aggregation site. In~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, communication is needed by the robots to count how many informed robots are resting on the aggregation site within the communication range. In our model, communication is needed by the robots to count how many robots (including both informed and non-informed) are resting on the aggregation site within the communication range. This small difference between the two models derives from a rather substantial modification of the robots' communication system which we apply to the original model as illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} to improve the robustness and flexibility of the swarm's behaviour. In~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, informed robots emits signals (i.e., one bit signal), while non-informed robots can only receive these signals, they can not emit them. Contrary to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, in our model, informed and non-informed robots are functionally identical with respect to communication; they can both send and receive signals. This implies that, contrary to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, in our model communication signals indicate only the presence of spatially proximal robots within a site without saying anything about the identity of the signal's sender (i.e., whether it is an informed or a non-informed robot). Therefore, the results of our study can generalise to application scenarios where the communication is indirect, i.e., the robots count the neighbours in its view range without the need of an exchange of messages and without the need of distinguishing between informed and non-informed robots. Both in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} and in our model, the robots are controlled by a probabilistic finite state-machine (hereafter PFSM, see Fig.~\ref{fig:methods}c), which is updated every 2 seconds and comprises three states: Random Walk ($\mathcal{RW}$), Stay ($\mathcal{S}$), and Leave ($\mathcal{L}$). However, in our model, the rules that regulate the transition between different states have been modified with respect to the original implementation as illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. In the following, we describe the PFSM and we illustrate the modifications we introduced with respect to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. At the beginning of a trial, the robots are in state $\mathcal{RW}$. They explore the environment while avoiding obstacles with an isotropic random walk with turning angles taken from a wrapped Cauchy distribution \cite{AnExtendedFamilyOfCircularDistributionsRelatedToWrappedCauchy}. The probability density function is the following : \begin{equation} f_{\omega}(\theta, \mu, \rho)=\frac{1}{2 \pi} \frac{1-\rho^{2}}{1+\rho^{2}-2 \rho \cos (\theta-\mu)}, \quad 0<\rho<1, \end{equation} where $\mu$ is the average value of the distribution and $\rho$ the skewness. With $\rho = 0$, the wrapped Cauchy distribution becomes uniform and there is no correlation between the turning angles of the robot. With $\rho = 1$, we have a Dirac distribution and the robot follows a straight line. Here we take $\rho =0.5$. We chose a fixed step length with a duration of \unit[5]{s} and a speed of \unitfrac[10]{cm}{s}. During this behaviour, when the proximity sensors detect an obstacle (the wall or other robots), the robot stops and turns of an angle chosen uniformly in the interval $[-\pi,\pi]$. After turning, if there is no obstruction ahead, the robot resumes its normal random walk otherwise, it repeats the manoeuvre. Both in our model and in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, informed robots systematically transition from state $\mathcal{RW}$ to the state $\mathcal{S}$ when they enter their preferred site, otherwise they move randomly. While in $\mathcal{S}$, informed robots rest on the aggregation site. The condition that triggers the transition from state $\mathcal{RW}$ to the state $\mathcal{S}$ for non-informed robots is different in our model with respect to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. In particular, in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, non-informed robots switch to state $\mathcal{S}$ if, while entering into an aggregation site, they perceive the presence of informed robots at the site. Contrary to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, in our approach, non-informed robots systematically transition from state $\mathcal{RW}$ to state $\mathcal{S}$ whenever they enter into an aggregation site regardless of the presence of any other type of robot at the site. In both studies, when a robot enters an aggregation site, it continues moving forward for 10 seconds to avoid a congestion of robots on the perimeter of the site that could eventually hinder other robots from entering. Then, it rests on the site. Both in our model and in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, informed robots never leave the state $\mathcal{S}$. That is, once an informed robot finds its preferred site, it never leaves the site. Non-informed robots transition from state $\mathcal{S}$ to state $\mathcal{L}$ with a probability that is computed differently with respect to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. In~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, non-informed robots transition from state $\mathcal{S}$ to state $\mathcal{L}$ with a probability $P_{Leave}$ computed as \begin{equation} P_{Leave} = \begin{cases} e^{-a(k-|n-x|)} & \text{if $n>0$,}\\ 1 & \text{if $n = 0$;}\\ \end{cases} \label{eq:oldPLeave} \end{equation} where $n$ and $x$ are the number of informed robots resting on the site within communication distance at this moment and at the moment of joining this site, respectively. Parameters $a$ and $k$ are fixed to $a = 2$ and $k = 18$. With Eq.~\eqref{eq:oldPLeave}, the transition from state $\mathcal{S}$ to state $\mathcal{L}$ is based on the temporal variation in the number of informed robots perceived at an aggregation site. Contrary to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, in our model the probability $P^{'}_{Leave}$ that regulates the transition from state $\mathcal{S}$ to state $\mathcal{L}$ for non-informed robots is computed as \begin{equation} P^{'}_{Leave} = \alpha e^{-\beta n} \;, \label{secondPleave} \end{equation} with $n$ the number of robots (including both informed and non-informed) within communication distance, $\alpha = 0.5$, and $\beta = 2.25$\footnote[1]{The parameters $\alpha$ and $\beta$ have been fine-tuned to achieve a symmetry-breaking behaviour in a homogeneous swarm of $N=100$ non-informed robots using the same arena setup illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}.}. Contrary to~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, $P^{'}_{Leave}$ relies on the fact that any type of robot in the swarm can broadcast and perceive communication signals while resting on a site. This transforms $P^{'}_{Leave}$ into something that depends on the estimated local density of (any type of) robots, while in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} $P_{Leave}$ depends on the variation in the number of informed robots in the neighbourhood. Hence, $P_{Leave}$ requires the robots to use memory and distinguish between types of robots, $P^{'}_{Leave}$ does not. Both in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} and in our approach a robot in state $\mathcal{L}$ exits an aggregation site by moving forward and avoiding obstacles. Once outside the site, it systematically transitions to state $\mathcal{RW}$. To summarise, the main differences between the model illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} and our model are the following: (i)~in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} informed robots only emit signals and non-informed robots only receive signals. In our models, both informed and non-informed robots send and receive communication signals. (ii)~In~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, non-informed robots rest on a site only if they perceive the presence of informed robots, and leave a site with a probability that depends on the variation in the number of perceived informed robots. Hence, it requires memory of the past and a comparison between the present and the past state. In our model, non-informed robots systematically rest on an aggregation site, and they leave it with a probability that is determined by the current local density of robots (regardless of whether they are informed or non-informed) at the site. Therefore, our model is reactive and does not require any form of memory. In the next section, we show that the above mentioned modifications improve the robustness and the behavioural flexibility of the swarm. \section{Results} \label{sec:results} \begin{table}[b] \caption{Parameters values} \label{fig:parameters} \begin{tabular}{|l|l|}\hline Experiment parameters & Values \\\hline Swarm size ($N$) & $\{ 50,100 \}$ \\ Proportion of informed robots ($\rho_{I}$) & $\{0.1,0.2,0.3,0.4,0.5\}$ \\ Proportion of black informed robots ($\rho_{sb}$) & $\{0.5,0.6,0.7,0.8,0.9,1\}$\\ Arena diameter & 12.9 m (for $N=50$), 19.2 m (for $N=100$)\\ Aggregation site diameter & 2.8 m (for $N=50$) , 4.0 m (for $N=100$)\\\hline \end{tabular} \end{table} In this section, we compare the performance of swarms of robots controlled by the PFSM as originally illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} and by our modified PFSM presented in Sec.~\ref{sec:methods}. We evaluate the two approaches in several different conditions given by all the possible combinations of the parameters' values listed in Table~\ref{fig:parameters}. In particular, we vary the swarm size ($N$), the proportion of informed robots in the swarm ($\rho_{I}$), and the proportion of black ($\rho_{sb}$) and white ($\rho_{sw}$) informed robots. As in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, while changing the swarm size, the swarm density has been kept constant by changing the diameter of the arena and of the aggregation sites (see Table~\ref{fig:parameters} for details). We recall that the task of the robots is to distribute themselves on each site in a way that the robots resting on the black and white sites should be equal to $N \, \rho_{sb} $ and $N \, \rho_{sw}$, respectively, with the proportion of informed robots $\rho_{I}$ being as small as possible. \begin{figure}[t] \centering \begin{tabular}{cccc} \includegraphics[width=0.25\textwidth]{MedianHeatMapBlackSiteNewP50size.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatmapWhiteSiteNewP50size.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatMapBlackSiteOldP50size.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatmapWhiteSiteOldP50size.pdf}\\ (a) & (b) & (c) & (d)\\ \includegraphics[width=0.25\textwidth]{MedianHeatMapBlackSiteNewP.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatmapWhiteSiteNewP.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatMapBlackSiteOldP.pdf}& \includegraphics[width=0.25\textwidth]{MedianHeatmapWhiteSiteOldP.pdf}\\ (e) & (f) & (g) & (h) \end{tabular} \caption{Graphs showing the median over 20 trials of the number of robots on each site at time \unit[$t = 30,000$]{s} (end of trials) for $N=50$ robots (top row) and $N=100$ robots (bottom row). For our approach the results are shown in (a) and (e) with reference to the black site, and in (b) and (f) with reference to the white site. For the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, the results are shown in (c) and (g) with reference to the black site, and in (d) and (h) with reference to the white site. On all graphs, the y-axis refers to the proportion of informed robots in the swarm ($\rho_{I}$) and the shades of grey refer to the number of robots at each aggregation site with white indicating zero robots, and black indicating 50 robots in graphs on top row, and 100 robots in graphs on bottom row. The x-axis refers to ($\rho_{sb}$) in (a), (c), (e), and (g) and to ($\rho_{sw}$) in (b), (d), (f), and (h).} \label{fig:median} \end{figure} For each testing condition, and for each approach, we have run 20 trials. Figure~\ref{fig:median} shows, for both approaches, the median over 20 trials of the number of robots resting on each site at the end of each trial (i.e., at time \unit[$t=30,000$]{s}) for a swarm of $N=50$ robots (see Fig.~\ref{fig:median}, graphs in top row) and for a swarm of $N=100$ robots (see Fig.~\ref{fig:median}, graphs in bottom row). For our approach the results are shown in Figs.~\ref{fig:median}a and~\ref{fig:median}e with reference to the black site, and in Figs.~\ref{fig:median}b and~\ref{fig:median}f with reference to the white site. For the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, the results are shown in Figs.~\ref{fig:median}c and~\ref{fig:median}g with reference to the black site, and in Figs.~\ref{fig:median}d and~\ref{fig:median}h with reference to the white site. With a swarm of $N=50$ robots, both approaches perform relatively well, with the median of the number of robots resting on the black site increasing for progressively higher values of $\rho_{sb}$ (see Figs.~\ref{fig:median}a, and~\ref{fig:median}c) and decreasing for progressively lower values of $\rho_{sw}$ (see Figs.~\ref{fig:median}b and~\ref{fig:median}d). These trends can be clearly observed, for both approaches, for any values of $\rho_{I}$, even for the smallest tested value $\rho_{I}=0.1$ (i.e, 10\% of informed robots in the swarm). However, our approach performs better than the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} for values of $\rho_{I} > 0.3$ and $\rho_{sb} > 0.8$. In these conditions, our approach approximates the target robot distributions between the two sites better than the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} (see Figs.~\ref{fig:median}a,~\ref{fig:median}b,~\ref{fig:median}c, and~\ref{fig:median}d, top right corners). With a larger swarm size $N=100$, our approach approximates better the target robot distributions for both $\rho_{I} < 0.3$ and $\rho_{sb} < 0.7$ (see Figs.~\ref{fig:median}e,~\ref{fig:median}f,~\ref{fig:median}g, and~\ref{fig:median}h, bottom left corners) and for $\rho_{I} > 0.3$ and $\rho_{sb} > 0.8$ (see Figs.~\ref{fig:median}e,~\ref{fig:median}f,~\ref{fig:median}g, and~\ref{fig:median}h, top right corners). \begin{figure}[t] \centering \begin{tabular}{cccc} \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsBlackSiteNewP50size.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsWhiteSiteNewP50size.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsBlackSiteOldP50size.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsWhiteSiteOldP50size.pdf}\\ (a) & (b) & (c) & (d)\\ \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsBlackSiteNewP.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsWhiteSiteNewP.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsBlackSiteOldP.pdf}& \includegraphics[width=0.25\textwidth]{VariabilityBetweenRunsWhiteSiteOldP.pdf}\\ (e) & (f) & (g) & (h) \end{tabular} \caption{Graphs showing the interquartile range over 20 trials of the number of robots on each site at $t=$ 30,000 s (end of trial). See the caption of Fig.~\ref{fig:median} for more details.} \label{fig:variabilityBetweenRuns} \end{figure} Figure~\ref{fig:variabilityBetweenRuns} shows the interquartile ranges of the number of robots on each site at \unit[$t=30,000$]{s} for both approaches for a swarm size of $N=50$ (graphs in top row) and $N=100$ (graphs in bottom row). For low proportions of informed robots ($\rho_{I}< 0.3$), our approach shows a slightly higher variability in the final distribution of the swarms (Figs.~\ref{fig:variabilityBetweenRuns}a,~\ref{fig:variabilityBetweenRuns}b,~\ref{fig:variabilityBetweenRuns}e, and~\ref{fig:variabilityBetweenRuns}f) than the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} (see Figs.~\ref{fig:variabilityBetweenRuns}c,~\ref{fig:variabilityBetweenRuns}d,~\ref{fig:variabilityBetweenRuns}g, and~\ref{fig:variabilityBetweenRuns}h). However, at higher proportions of informed robots($\rho_{I} > 0.3$), the variability is roughly the same for the two approaches in the majority of the parameter configurations. \begin{figure}[t] \centering \begin{minipage}[c]{0.4\textwidth} \includegraphics[width=\textwidth]{HistogramNonInformed.pdf} \end{minipage} \begin{minipage}[c]{0.4\textwidth} \caption{Graphs showing the frequency distribution of the number of robots on each aggregation site, at the end of 50 runs, with each trial lasting $t=$ 30,000 s, and without informed robots in the swarm ($\rho_{I} = 0$). The swarm size is $N=100$.} \label{fig:symmetry} \end{minipage} \end{figure} With our modified approach, we have run further tests with a swarm entirely made of non-informed robots (i.e., $\rho_{I}=0$). The removal of informed robots from the swarm prevents the model illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} from generating robots' aggregates, as the transition from state random walk $\mathcal{RW}$ to the state stay $\mathcal{S}$ (i.e., resting on the aggregation site) of non-informed robots is triggered by the perception of an aggregation site populated by informed robots. As shown in Fig.~\ref{fig:symmetry}, in our model, a swarm without informed robots can break the environmental symmetry by repeatedly forming a single aggregate on either the black or the white aggregation site. The median of the number of robots not resting on any site at the end of the experiment is 4 with an interquartile range of 5. This shows that the modifications we made to the system as originally illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} enlarges the swarm behavioural repertoire without loss of performance with respect to the results shown in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. The results of our tests show that our simplified model generates aggregates that match equally fine or even better than in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} the expected distributions of robots on each aggregation site for each tested combination of values of $\rho_{I}$, $\rho_{sb}$, and $\rho_{sw}$. We show, however, that our approach generates a slightly higher between-trials variability than the one in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. This is due to the fact that when every robot can start the formation of clusters in the sites, as it is in our approach, clusters composed exclusively of non-informed robots can also appear. When the proportion of informed robots is low, the disruptive effect of these types of aggregates on the desired aggregation dynamics increases as well as with the between trials variability. We also show that, in the absence of informed robots in the swarm, the robots break the environmental symmetry by repeatedly generating a single aggregate on either the black or the white site. Since this symmetry breaking behaviour is precluded to the swarm as modelled in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, we conclude that the modifications introduced by us improve the robustness and the behavioural flexibility of the swarm. \section{Conclusions} \label{sec:conclusion} We proposed a simplified version of an existing aggregation method using informed individuals in a swarm of robots. We have presented the results of a comparative study that quantitatively evaluates the effectiveness of two different algorithms in driving the aggregation dynamics in swarms of heterogeneous robots made of informed and non-informed robots. The original approach, illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, is based on a finite-state machine controller by which individual robots only transit from state random walk $\mathcal{RW}$ (corresponding to random diffusion in the environment) to state Stay $\mathcal{S}$ (corresponding to resting on an aggregation site) when they end up on an aggregation site populated by informed robots. Moreover, the robots transit from state Stay $\mathcal{S}$ to state Leave $\mathcal{L}$ (corresponding to leaving the aggregation site) with a probability that depends on the variation in the perceived number of informed robots at the site during resting, thus requiring memory, however limited. The functional characteristics of this finite-state machine are supported by a communication protocol in which only informed robots can send signals and non-informed robots can receive signals. We have replicated the study illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} with a simplified finite-state machine controller in which the robots rest on a site regardless of the presence of informed robots, and they leave the site with a memoryless probability that depends on the current perceived local density at the aggregation site of any type of robots. Moreover, we have re-established a functional equivalence in communication capabilities between informed and non-informed robots. That is, in our approach, there is no distinction in communication capabilities between the types of robots, both can send and receive messages that signal their presence at an aggregation site. This implementation choice allows the robots to estimate the robot density in their neighbourhood without any need of distinguishing between robot types. Our comparative tests show that the swarms controlled by our approach generate aggregation dynamics that are never less performing than~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, and in some experimental conditions they are closer to the target robot distributions than the one observed with the approach illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}. We showed that, our approach, contrary to the one illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, suffers from a slightly higher between-trials variability in the number of robots resting at each aggregation site at the end of a trial. We also show that our approach can generate a larger set of aggregation dynamics than in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation}, since in the absence of informed robots the swarm controlled with our simplified approach systematically forms a single aggregate in one of the aggregation sites, while the swarm controlled by the approach in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} never aggregates. Based on the ``Occam's razor'' principle of parsimony, we claim that due to its simplicity, effectiveness, and robustness to a larger set of operating conditions, our approach should be favoured over the one illustrated in~\cite{Firat2020Group-sizeRegulationInSelf-OrganisedAggregation} to control the aggregation dynamics using informed robots. Future research directions will consider setups with three or more aggregation sites to verify if, with our approach, the expected distributions of robots at the aggregation sites are attained in more complex environments. We also plan to validate the approach illustrated in this paper with the physical robot Kilobots~\cite{Rubenstein2014KilobotLowCostRobot} using the Kilogrid platform~\cite{Valentini2018KilogridANovelExperimentalEnvironment}. \subsubsection*{Acknowledgements.} This work was supported by Service Public de Wallonie Recherche under grant n° 2010235 - ARIAC by DIGITALWALLONIA4.AI; by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 681872); and by Belgium’s Wallonia-Brussels Federation through the ARC Advanced Project GbO (Guaranteed by Optimization). A.\,Reina and M.\,Birattari acknowledge the financial support from the Belgian F.R.S.-FNRS, of which they are Charg\'{e} de Recherches and Directeur de Recherches, respectively. \bibliographystyle{splncs04}
\section{Introduction} Long-haul and ultra-stable radio frequency (RF) distribution is essential for numerous scientific and technical applications involving fundamental physics, radio astronomy and very long baseline interferometry (VLBI) \cite{1,2,3,4}. Owing to the influence of atmospheric environment, the traditional satellite-based time-frequency transfer methods such as Global Positioning System (GPS) or two-way satellite frequency transfer (TWSFT) are not satisfying the requirements of the modern high-precision applications \cite{5,6}. Compared with the satellite-based ones, the optical fiber is considered as an ideal medium for breaking the existing technological bottleneck and realizing high-precision and long-distance frequency transfer due to the advantage of low attenuation, wide bandwidth, immunity to electromagnetic interference, etc \cite{7}. In the past two decades, various excellent fiber-optic RF transfer schemes have been successively proposed and demonstrated \cite{8,9,10,Wang,12,13,14,sup1,sup2}. To achieve ultra-stable fiber-optic RF transfer in quasi-national territories or even on a continental scale, the limitations of compensation bandwidth and signal-to-noise ratio (SNR) on the transfer system have to be resolved \cite{22}. Wang \textit{et al.} proposed a long-haul RF transfer scheme based on high-precision phase-locked loop (PLL) \cite{12}, demonstrating a 1007 km fiber-optic RF transfer in the single-span configuration by optimizing fiber link configurations such as the gain of erbium-doped fiber amplifiers (EDFAs), etc. Subsequently, Liu \textit{et al.} from the same group proposed a RF transfer scheme based on dual-PLLs, adopting PLL to improve the system’s SNR, which can effectively improve the short-term stability of the 1007 km fiber link \cite{13}. Although aforementioned single-span transfer schemes can obtain relatively low fractional frequency instability, the single-span transfer scheme deteriorates the noise suppression capability due to the decrease of the compensation bandwidth with the increase of the transfer distance. Furthermore, the optimization of the compensation system will become more difficult as the transfer distance increases \cite{22}. Thus, the cascaded transfer scheme with independent noise compensation for each fiber sub-link is more favourable for long-haul fiber-optic frequency transfer \cite{15}. Fujieda \textit{et al.} demonstrated the cascaded RF transfer scheme adopting two fiber sub-links over the total of the 204 km urban fiber link \cite{14}. Each fiber sub-link adopts an independent PLL-based active compensation technique, which can have the capability for stable operation. By adopting the similar technique, other research groups have also successively demonstrated a few cascaded RF transfer schemes for long-distance RF transfer applications \cite{14,15,16,17}. Unfortunately, the transfer stability degrades $\sqrt{N}$ times by cascading $N$ fiber sub-links \cite{16}. Additionally, more and more large-scale scientific and engineering facilities have an urgent demand for multiple-point RF access. However, the performance of existing multiple-point download schemes over the long-haul fiber link are mainly affected by the compensation bandwidth (depending on the length of the main link) and a large amount of attenuation introduced by the access nodes \cite{MA1,MA2, hu2021all, xue2021branching}. One intriguing question is how to design a multiple-access RF transfer scheme suitable for long-haul fiber link to improve the performance of the system in a cost-effective way. In this article, we propose a long-haul fiber-optic RF transfer scheme by adopting novel multiple-access relay stations (MARSs). The proposed scheme with independent link noise compensation for each fiber sub-link mitigates the limitation of the compensation bandwidth for long-haul transfer. This novel MARS shares the same modulated optical signal for the front and rear fiber sub-links, not only effectively simplifying the configuration of RF transfer but also providing the multiple-access capability. Experimentally, we demonstrate the scheme by transferring a 1 GHz RF signal to the remote site (RS) via 260+280 km two fiber sub-links with the assistance of one MARS. In this configuration, the MARS can simultaneously compensate the front and rear fiber sub-links. Our experimental results demonstrate the stable RF signals can be obtained at the MARS and RS with the fractional frequency instability less than $5.6\times10^{-14}$ at 1 s and $6.6\times10^{-17}$ at 10,000 s, and $5.9\times10^{-14}$ at 1 s and $8.5\times10^{-17}$ at 10,000 s, respectively. To further verify this configuration, we theoretically analyze the effect of the MARS position on the system's performance. Promisingly, the proposed scalable technique can arbitrarily add the same MARSs in the fiber link for ultra-long-haul RF transfer. \section{Principle} \begin{figure}[htbp] \captionsetup{labelfont=bf} \centering\includegraphics[width=13cm]{styles/Figure1.jpg} \caption{Schematic diagram of long-haul optical fiber RF transfer with the assistance of $N$ MARSs. FS: frequency standard, CWL: continuous wave laser, PD: photodetector, MZM: Mach-Zehnder modulator, WDM: wavelength division multiplexer, Bi-EDFA: bidirectional erbium-doped fiber amplifier, OC: optical coupler, PLL: phase-locked loop, DFM: dual frequency mixer, BPF: band-pass filter, PS: power splitter, MARS: multiple-access relay station.} \end{figure} Figure 1 illustrates a schematic diagram of our proposed scheme for long-haul fiber-optic RF transfer by using $N$ MARSs. The local site (LS), $N$ MARSs and RS are connected by the $N+1$ fiber sub-links. Each MARS simultaneously transmits probe signal to the front and rear fiber sub-links to obtain the corresponding fiber-induced noise. At the LS, the frequency standard to be transmitted can be denoted as a cosine function without considering its amplitude, $E_r\propto cos(\omega_{r}t+\varphi_r$), where $\omega_r$ and $\varphi_r$ are its angular frequency and initial phase, respectively. At the any MARS, the probe signal produced by a tunable voltage-controlled oscillator (VCO) in the PLL unit consisting of mixer, PID controller and VCO, which can be denoted as, \begin{equation} {E_1} \propto \cos ({\omega _{ck}}t + {\varphi _{ck}})\label{1}, \end{equation} where $\omega_c$ and $\varphi_c$ stand for the angular frequency and initial phase of the VCO, the subscript number $k$ is an arbitrary number, indicating the corresponding the $k$th MARS. The frequency standard signal to be distributed and the probe signal of each MARS satisfy the frequency relationship of $\omega_r \approx{2\omega_{ck}}$. Although all MARSs have the same structure in our proposed scheme, the MARSs in different locations implement different functions, especially the first and last MARSs. At the first MARS, the probe signal is split into two parts. One part is modulated onto the continuous wave laser (CWL) by a Mach-Zehnder intensity modulator (MZM) biased at the quadrature point. The optically carried RF signal is divided into two parts, which are respectively transmitted to the LS and second MARS via the front and rear fiber sub-links. At the LS, the probe signal recovered by the photodetector (PD) can be written as, \begin{equation} {E_2} \propto \cos ({\omega _{\rm{c1}}}t + {\varphi _{p0}} + {\varphi _{c1}})\label{2}, \end{equation} where $\varphi_{p0}$ represents the phase noise induced by the first fiber sub-link. By mixing $E_r$ with $E_2$ via dual frequency mixer (DFM) \cite{10}, the lower side-band signal is obtained and can be given by, \begin{equation} {E_3} \propto \cos \left[ {\left( {{\omega _r} - {\omega _{{c1}}}} \right)t + {\varphi _r} - {\varphi _{p0}} - {\varphi _{c1}}} \right]\label{3}. \end{equation} At the LS, the $E_3$ is modulated onto an optical carrier by another MZM biased at the $V_{\pi/2}$ point and transmitted to the first MARS via the first fiber sub-link. Due to the high reciprocity of the forward and backward signal path \cite{Wang}, it is assumed that the phase noise introduced by the forward transmission signal via the same fiber link is the same as that of the backward transmission signal. Thus, the forward transfer signal detected by the PD at the first MARS can be depicted as, \begin{equation} {E_4} \propto \cos \left[ {\left( {{\omega _r} - {\omega _{{c1}}}} \right)t + {\varphi _r} - {\varphi _{c1}}} \right]\label{4}. \end{equation} From the Eq. \ref{4}, it can be seen that the phase noise introduced by the first fiber sub-link is eliminated by passive compensation technique. At the first MARS, the backward probe signal from the second MARS recovered by the another PD can be denoted as, \begin{equation} {E_5} \propto \cos ({\omega _{{c2}}}t + {\varphi _{p1}} + {\varphi _{c2}})\label{5}. \end{equation} The $E_4$ and $E_5$ signals are fed into the PLL unit of the first MARS. In the PLL unit, the DC error signal carrying the fiber-induced noise is obtained by mixing $E_4$ and $E_5$, resulting in, \begin{equation} {V_{e1}} \propto \cos \left[ {\left( {{\omega _r} - {\omega _{c1}}- {\omega _{c2}}} \right)t + {\varphi _r} - {\varphi _{p1}} - {\varphi _{c1}}- {\varphi _{c2}}} \right]\label{6}. \end{equation} When the PLL unit is in-lock, the steady-state error is canceled by tuning VCO control voltage, i.e., $V_{e1}\rightarrow{0}$. Equation \ref {6} can be further written as, \begin{equation} {\omega _r} = {\omega _{c1}}+{\omega _{c2}},{\rm{ }}\quad{\varphi _{c1}} ={\varphi _{r}-{\varphi _{c2}-{\varphi _{p1}}}}\label{7}. \end{equation} By mixing $E_5$ and another part of probe signal with expression of $\omega_{c1}t+\varphi_{c1}$ via the DFM and taking the upper side-band, it can be seen that a stable RF signal with $\omega_{r}t+\varphi_r$ is obtained at the first MARS. For the second MARS, the forward probe signal with $\omega_{c1}t+\varphi_{c1}+\varphi_{p1}$ and the backward probe signal with $\omega_{c3}t+\varphi_{c3}+\varphi_{p2}$ are sent into the PLL unit. When the second compensation device is in-lock, the following relationship can be obtained, \begin{equation} {\omega _{c1}}={\omega _{c3}},{\rm{ }}\quad{\varphi _{c1}+{\varphi _{p1}-{\varphi _{p2}}-{\varphi _{c3}}}}=0\label{8}. \end{equation} By substituting Eq. \ref{7} into Eq. \ref{8}, the Eq. \ref{8} can be rewritten as, \begin{equation} {\omega _r} = {\omega _{c2}}+{\omega _{c3}},{\rm{ }}\quad{\varphi _{c2}} ={\varphi _{r}-{\varphi _{c3}-{\varphi _{p2}}}}\label{9}. \end{equation} In a similar way, an expression of $ {\omega _r} = {\omega _{ck}}+{\omega _{ck+1}},{\rm{ }}\ {\varphi _{ck}} ={\varphi _{r}-{\varphi _{ck+1}-{\varphi _{pk}}}}$ similar with Eq. \ref{7} and Eq. \ref{9} can be obtained at the arbitrary $k$th MARS through $k-1$ iterations, except for the last MARS. By performing a similar mixing operation via the DFM, a stable RF signal can be obtained at arbitrary MARS. When the PLL unit at the last MARS is activating, we can obtain the relationship of, \begin{equation} {\omega _r} = 2{\omega _{cN}},\quad{\rm{ }}{\varphi _{cN}} = \frac{\varphi _r}{2}- {\varphi _{pN}}\label{10}. \end{equation} Noted that Eq. \ref{10} is the result of multiple iterations of the expression obtained for the previous $N-1$ MARSs. When $N$ MARSs are operating normally, the VCO signal in each MARS has the following relationship of $\omega_r=2\omega_{c1}=2\omega_{c2} \cdots=2\omega_{cN}$. At the RS, by substituting Eq. \ref{10} into the recovered RF signal with $\omega_{cN} t+\varphi_{cN}+\varphi_{pN}$, we can obviously find that a stable RF signal can be recovered at the RS. \section{Experimental setup and results} \subsection{Experimental setup} We have demonstrated the proposed scheme with one MARS by adopting the experimental configuration as illustrated in Fig. 1. At the LS, the frequency standard (Rigol Inc., DSG 821) with $\omega_r$ is set to 2 GHz. The LS and MARS are connected by the front fiber sub-link with 260 km G.652 single-mode fibers (SMFs), denoted as $L_0$. The probe signal with $\omega_{c1}$ is set about 1 GHz at the MARS. The second fiber sub-link connecting the MARS and RS consists of 280 km SMFs (G.652) denoted as $L_1$. To suppress the impact of the chromatic dispersion, the proper dispersion compensating fibers (DCFs) are placed into the fiber-optic link. Table 1 elaborately indicates the length distribution of the SMF spools, the configuration of the DCFs and the attenuation of each section of the fiber link. It is noticeable that the third column in Table 1 stands for the nominal dispersion compensation length for G.652 SMF with the total length of the DCFs being approximately 54 km. We set the wavelengths of CWLs employed at the LS, MARS and RS to 1547.72nm, 1546.92 nm and 1547.72 nm, respectively. This scheme occupies only two International Telecommunication Standardization (ITU) channels (C37, C38) to get rid of the backscattering noise with the assistance of wavelength division multiplexers (WDMs). Each transmitted RF signal is modulated on the corresponding optical carrier by a LiNbO3 MZM (iXblue Inc., MXAN-LN-10) biased at the quadrature point and detected by the PD with 2 GHz bandwidth at each site. A few home-made bidirectional erbium-doped fiber amplifiers (Bi-EDFAs) are placed into the fiber-optic link, in order to boost the fading bidirectional optical signals. The gain configuration of each Bi-EDFA is less than 25 dB to relieve the influence of the amplified spontaneous emission (ASE) noise and stimulated Brillouin scattering. The structure of the Bi-EDFA is similar with Ref \cite{18}, as shown in Fig. 2(a), which employs one unidirectional EDFA to complete the amplification of the bidirectional optical signals. We adopt seven home-made Bi-EDFAs in the transmission link, not only greatly simplifying the number of unidirectional EDFAs but also improving the symmetry of the single-fiber bidirectional transfer link in comparison with the Ref \cite{12}. Moreover, we select a PI controller (Newport Inc., LB1005) as the loop filter in the PLL unit. To suppress phase noise caused by the nonlinear-effect and RF leakage during the frequency mixing stage, the DFMs are adopted at the LS and MARS as illustrated in Fig. 2(b). In order to evaluate the performance of the proposed scheme, the frequency standard is divided by 2 at the LS and the duplicated 1 GHz signals at the RS (MARS) are converted to 10 MHz signals by a dual-mixer time difference method \cite{19}. The output signals are imported into the phase noise measurement instrument (Symmetricom Inc., TSC5120A) for the fractional frequency instability evaluation. \begin{table}[htbp] \centering \begin{scriptsize} \captionsetup{labelfont=bf} \caption{\label{tab1}\textbf{Specific configuration of the optical fiber link}} \begin{tabular}{cccc} \hline Number & Length (km) & DCF (km) & Attenuation (dB)\\ \hline 1 & 80.8 & 80 & 22.1 \\ 2 & 78.2 & 80 & 19.9 \\ 3 & 50.1 & 40 & 12.7 \\ 4 & 50.1 & 60 & 14.9 \\ 5 & 50.4 & 60 & 13.4 \\ 6 & 51 & 40 & 14.1 \\ 7 & 80 & 80 & 20.6 \\ 8 & 49.2 & 60 & 14.1 \\ 9 & 50.1 & 40 & 12.9 \\\hline \end{tabular} \end{scriptsize} \end{table} \begin{figure}[htbp] \centering\includegraphics[width=12cm]{styles/Figure2.jpg} \captionsetup{labelfont=bf} \caption{Detailed configuration of the (a) Bi-EDFA and (b) DFM. Bi-EDFA: bidirectional erbium-doped fiber amplifier, DFM: dual frequency mixer, WDM: wavelength division multiplexer, AS: auxiliary source, MIX: frequency mixer, Uni-EDFA: unidirectional erbium-doped fiber amplifier, BPF: band-pass filter.} \end{figure} \subsection{Long-haul radio frequency transfer} \begin{figure}[htbp] \centering\includegraphics[width=10.5cm]{styles/Figure3.jpg} \captionsetup{labelfont=bf} \caption{Measured phase noise PSDs for the different system configurations: the system noise floor RS output (red curve), the system noise floor MARS output (blue curve), compensated 260+280 km RS output (yellow curve), MARS output with the 260+280 km fiber link (green curve), compensated 540+0 km RS output (pink curve), 540 km free running link (black curve). RS: remote site, MARS: multiple-access relay station.} \end{figure} Figure 3 illustrates the measured single-sideband (SSB) phase noise power spectral densities (PSDs) of the system under different configurations. The RS and MARS back-to-back noise floors are measured by replacing $L_0$ and $L_1$ in the proposed scheme with short fiber patch cords. As a comparison, we also measure the long-haul RF transfer with the single-stage configuration as similar in Ref \cite{12,13}, by replacing $L_0$ and $L_1$ with 540 km SMFs and short fiber patch cord in the proposed scheme. The 540 km free running link is evaluated by transferring a 1 GHz signal to the RS without adding MARS and round-trip phase correction. As shown in Fig. 3, the SSB phase noise of the 540 km free running link is obviously higher than the compensated 260+280 km for RS output (about -68 dBc at 0.1 Hz, -74 dBc at 1 Hz) and MARS output (about -69 dBc at 0.1 Hz, -75 dBc at 1 Hz) at the offset frequency of less than 10 Hz, due to fiber delay fluctuations caused by the temperature variations. In comparison with the 540+0 km transfer for RS output, the SSB phase noise of the compensated 260+280 km for RS output is lower within 0.1-50 Hz, demonstrating that the proposed RF transfer scheme relieves the limitation of system's SNR over long-haul distribution. Moreover, the 540+0 km transfer for RS output has a smaller compensation bandwidth, which can be observed from the position of the bump in Fig. 3. In the range of 0.001-0.003 Hz, all the measurements have the sharp spikes, which are mainly determined by impact of the environmental temperature fluctuations on outside loop devices \cite{21}. The SSB phase noise of all compensation configurations has a bump observed at about 40, 60 or 1000 Hz. This part noise is mainly determined by the phase noise of the RF signal, the PLL parameters and the propagation delay from the fiber and so on \cite{20}. \begin{figure}[htbp!] \centering\includegraphics[width=10.5cm]{styles/Figure4.jpg} \captionsetup{labelfont=bf} \caption{Measured Allan deviations for the different transfer configurations: the system noise floor RS output (red curve), the system noise floor MARS output (blue curve), compensated 260+280 km RS output (yellow curve), MARS output with the 260+280 km fiber link (green curve), compensated 540+0 km RS output (pink curve), 540 km free running link (black curve). RS: remote site, MARS: multiple-access relay station.} \end{figure} The measured fractional frequency instability in terms of Allan deviations (ADEVs) for different system configurations are illustrated in Fig. 4. It can be observed that with the implementation of 260+280 km fiber noise compensation for the RS (MARS) output, the proposed RF transfer scheme achieves a fractional frequency instability of $5.9\times10^{-14}$ ($5.6\times10^{-14}$) at 1 s and reaches $8.5\times10^{-17}$ ($6.6\times10^{-17}$) at 10,000 s. In our experiment, we observe that the long-term stability of 260+280 km transfer for RS output is improved by approximately four orders of magnitude in contrast with 540 km free running link. Compared with the 540+0 km RF transfer for RS output, the ADEV of the compensated 260+280 km configuration for the RS output is improved from $7.3\times10^{-14}$ to $5.9\times10^{-14}$ at the averaging time of 1 s, indicating that the proposed scheme with the assistance of MARS can effectively improve the system’s SNR. The ADEV of the compensated 260+280 km for RS output is clearly higher than the system noise floor for the RS output ($1\times10^{-14}$ at 1 s, $5\times10^{-17}$ at 10,000 s), which is mainly attributed to the non-reciprocal noise in the fiber link and ASE noise introduced by the Bi-EDFAs \cite{13}. As the outside loop of the system is easily susceptible to the temperature fluctuations, the ADEVs of the different system configurations decrease slowly within 40-200 s, which correspond to the sharp spikes at the range of $0.001-0.003\ \rm{Hz}$ in Fig. 3. \section{Discussion} \subsection{The impact of MARS on the system in different positions} Since the positions of stations in optical fiber communication network are usually not uniformly distributed \cite{OFT}, whether the MARS position will affect the transfer system needs to be carefully investigated. Here, we theoretically model the effect of the MARS position on the fractional frequency instability of the fiber-optic RF transfer system with two fiber sub-links. Based on the PLL theory and fiber-induced noise model \cite{23,24,25,26,Dong, hu2020passive}, the residual phase noise PSD of the compensation system can be obtained by extracting the phase of the beat note between the frequency standard and the remote signal, which can be denoted as, \begin{equation} \begin{aligned} {S_{Residual}}(\omega ) =& {\left| {\frac{{{G_1}{e^{ - j\omega {\tau _1}}}\sqrt {2\left[ {1 - \rm{sinc}\left( {2\omega {\tau _0}} \right)} \right]} }}{{1 + {G_1}{e^{ - j2\omega {\tau _0}}} + {G_1}{e^{ - j2\omega {\tau _1}}}}}} \right|^2}{S_{p0}}(\omega )\\& {\rm{+ }}{\left| {1 - \frac{{{G_1}{e^{ - j\omega {\tau _1}}}\sqrt {2\left[ {1 + \rm{sinc}\left( {2\omega {\tau _1}} \right)} \right]} }}{{1 + {G_1}{e^{ - j2\omega {\tau _0}}} + {G_1}{e^{ - j2\omega {\tau _1}}}}}} \right|^2}{S_{p1}}(\omega )\\& {\rm{+ }}{\left| {1-\frac{{{2G_1}{e^{ - j\omega {\tau _0}}}{e^{ - j\omega {\tau _1}}}}}{{1 + {G_1}{e^{ - j2\omega {\tau _0}}} + {G_1}{e^{ - j2\omega {\tau _1}}}}}} \right|^2}{S_{RF}}(\omega ) + {S_{noise\_floor}}(\omega )\label{11}. \end{aligned} \end{equation} where $\tau_0$ and $\tau_1$ are propagation delays of the front and rear fiber sub-links, $G_1=(K_P+K_I/{j\omega})\cdot K_{PFD}\cdot K_{VCO}/j\omega$ is the transfer function of PLL unit, $S_{p0} (\omega)$, $S_{p1} (\omega)$, $S_{RF} (\omega)$ and $S_{noise\_floor} (\omega)$ are the SSB phase noise induced by the front fiber sub-link, the rear fiber sub-link, frequency standard and back-to-back system. Furthermore, the SSB phase noise caused by the fiber link has been experimentally verified to be denoted in the form of a Power-laws spectrum, i.e., $S_{p} (\omega)={\omega_r}^{2}L\sum_{\alpha=-3}^{0}{h_{\alpha}(\omega/{2\pi})^\alpha}$, where $h_{\alpha}$ holds for the coefficient of the corresponding $\alpha$-order of noise \cite{23}. As the back-to-back system noise floor contains a part of the noise introduced by the RF signal, and this noise has little influence on the system. Therefore, we ignore the influence of this item in the simulation. \begin{figure}[htbp] \centering\includegraphics[width=10.5cm]{styles/Figure5.jpg} \captionsetup{labelfont=bf} \caption{Measured phase noise PSD for the compensated 260+280 km RS output (black curve) and simulated phase noise PSD for the compensated 260+280 km RS output (dashed red curve).} \end{figure} To verify the effectiveness of the simulation model, we compare the measured and simulated results for the compensated 260+280 km RS output with the help of the Eq. \ref{11}. As several Bi-EDFAs are adopted to boost the attenuation of the long fiber link \cite{12,13,22}, we add the ASE noise coming from the Bi-EDFAs to the system noise floor $S_{noise\_floor} (\omega)$ in the simulation model. According to the PLL theory, the ASE noise can be equivalently regarded as the additive white noise \cite{13,22} superimposed onto the phase detector in PLL unit. This part of the noise can be multiplied by the corresponding transfer function. Here we set the white noise introduced by the ASE to -78 dBc/Hz with the assistance of the model reported in Ref. \cite{22,EDFA}. As can be seen from Fig. 5 that the measured result is close to the simulated result at the high frequency range ( > 50 Hz) and the slight difference between the measured and simulated at low frequency range ( < 50 Hz) could be caused by the deviation of the ASE noise model, the non-reciprocal noise and the noise introduced by polarization mode dispersion and so on. \begin{table}[!h] \centering \begin{scriptsize} \captionsetup{labelfont=bf} \caption{\label{Table2}\textbf{Relevant parameters used in the simulation of the compensation system }} \begin{tabular}{ccc} \hline Parameter & Symbol & Value \\ \hline Proportion coefficient of loop filter in PLL unit & $K_P$ & $800$ \\ Integral coefficient of loop filter in PLL unit & $K_I$ & $25\times10^{4}\ \rm{rad/s}$ \\ Gain coefficient of phase frequency detector in PLL unit & $K_{PFD}$ & $6\times10^{-2}\ \rm{V/rad}$ \\ Tuning sensitivity of VCO in PLL unit & $K_{VCO}$ & $32\ \rm{rad/(s\cdot V)}$ \\ Propagation velocity in optical fiber & $c_n$ & $2\times10^8 \ \rm{m/s}$ \\ Corresponding -3-order coefficient to the fiber-induced noise & $h_{-3}$ & $1\times10^{-34}\ \rm{km^{-1}}$ \\ Corresponding -2-order coefficient to the fiber-induced noise & $h_{-2}$ & $2\times10^{-34}\ \rm{km^{-1}Hz^{-1}}$ \\ Corresponding -1-order coefficient to the fiber-induced noise & $h_{-1}$ & $6\times10^{-33}\ \rm{km^{-1}Hz^{-2}}$\\ Corresponding 0-order coefficient to the fiber-induced noise & $h_{0}$ & $5\times10^{-37}\ \rm{km^{-1}Hz^{-3}}$ \\\hline \end{tabular} \end{scriptsize} \end{table} \begin{figure}[!ht] \centering\includegraphics[width=13cm]{styles/Figure6.jpg} \captionsetup{labelfont=bf} \caption{(a) The simulated phase noise PSDs of the RF transfer systems over different link configurations with a total length of 200 km. The inset shows the position of the bumps in different fiber link configurations. (b) The simulated Allan deviations of the RF transfer systems over different link configurations with a total length of 200 km. (c) Total fiber length vs fiber link length ratio for different ADEVs at the averaging time of 1 s. (d) Total fiber length vs fiber link length ratio for different Allan deviations at the averaging time of 10,000 s.} \end{figure} Based on the aftermentioned model, we evaluate the impact of MARS location on the RF transfer system. The relevant parameters used for the calculation are listed in Table 2. It can be seen from Fig. 6(a) that, the fiber-induced phase noise at low frequency band is effectively suppressed by the compensation system, so the phase noise PSDs of different link configurations within 10 Hz are limited by the system noise floor. In the range of 10-100 Hz, as the length of a certain fiber sub-link increases, the compensation system gradually deteriorates the fiber-induced noise suppression capability at the mid-band frequency due to the decrease of the compensation bandwidth (the position of the bump is shifted towards low frequency range). At the high frequency range ( >$10^3$ Hz), with the distance of a certain fiber sub-link increases, the compensation system has more significant effect on high frequency link noise suppression. The trends of these simulated results are consistent with the experimental measured results in Fig. 3. According to the conversion relationship between phase noise PSD and ADEV \cite{27}, the ADEV results under different link configurations can be obtained, as shown in Fig. 6(b). The short-term stabilities of the 100+100 km and 120+80 km fiber links are $2.7\times10^{-14}$ and $2.9\times10^{-14}$ at the averaging time of 1 s, indicating that the MARS position has little effect on the system's performance when the ratio of the front and rear fiber sub-links is around $1:1$. The difference in long-term stabilities of the system (at the integration time of 10,000 s) become smaller under different fiber link configurations, due to the fact that the system noise floor is dominant in the low frequency range. Additionally, it is observed from Fig. 6(c) and Fig. 6(d) that with the increase of the total fiber length, the influence of the link length ratio (the position of the MARS) on the system stability also gradually increases. When the total distribution distance is 300 km, the ADEV at the averaging time of 1 s (10,000 s) deteriorates from $2.7\times10^{-14}$ ($4.4\times10^{-18}$) to $6.6\times10^{-14}$ ($7.3\times10^{-18}$) for the 1:1 link length configuration compared to the 9:1 link configuration. Therefore, it is obviously found that when the total transfer distance is less than 250 km, the MARS at different positions has little effect on the system, that is, the sensitivity of the MARS to position is not strong. However, when faced with the application requirements of ultra-long-haul RF distribution, the MARS can be placed close to the middle of the front and rear fiber sub-links. \subsection {Ultra-long-haul RF transfer by adopting N MARSs} \begin{figure}[htbp] \centering\includegraphics[width=10.5cm]{styles/Figure7.jpg} \captionsetup{labelfont=bf} \caption{Simulated Allan deviation results of the proposed system with 29 MARSs over 3000 km distribution link (blue curve) and the cascaded scheme with 30 stages over 3000 km distribution link (red curve). MARS: multiple-access relay station.} \end{figure} For ultra-long-haul RF transfer via fiber-optic link, it is indispensable to introduce more MARSs. Here, we theoretically analyze the potential of this proposed scheme with the assistance of $N$ MARSs by modeling the residual phase noise PSD of the RF transfer system. The idea of modeling is to bring the phase relationship obtained by the first $N-1$ MARSs into the $N$th MARS through $N-1$ iterations, that is, substituting Eq. \ref{12}-\ref{14} into Eq. \ref{15}. The subscript $k$ in Eq. \ref{13} represents arbitrary MARS except for the first and last MARSs. $S_{noise\_floor\_N}$ stands for the back-to-back noise floor of the system with $N$ MARSs. Based on the residual noise model of $N$ MARSs, we simulate the ultra-long-haul RF transfer via 3000 km fiber-optic link. Assuming that there are 29 MARSs placed at equal distances on the transmission link, that is, each short fiber sub-link is 100 km. At the same, we keep the PLL parameters of each MARS consistent. It can be observed from Fig. 7 that the proposed scheme with 29 MARSs is expected to achieve short-term stability less than $1.5\times10^{-13}$ at the integration time of 1 s and long-term stability less than $1.9\times10^{-17}$ at the integration time of 10,000 s via 3000 km fiber-optic link, which is far better than that of rubidium clocks \cite{12}. As a comparison, we evaluate performance of the conventional 30-stages cascaded scheme over 3000 km fiber link with the help of phase noise model reported in Ref. \cite{Dong}. It can be seen from the simulated results that the proposed scheme can obtain slight better stability than that of the conventional cascaded scheme in the 3000 km link. More importantly, our proposed technique can largely simplify the configuration at each repeater station. \begin{equation} {\varphi _{c1}}\left( \omega \right) = \frac{{ - {G_1}}}{{1 + {G_1}{e^{ - j2\omega {\tau _0}}}}}\left[ \begin{array}{l} {\varphi _{c2}}\left( \omega \right){e^{ - j\omega {\tau _1}}} + {\varphi _{p1}}\left( \omega \right) - {\varphi _{RF}}\left( \omega \right){e^{ - j\omega {\tau _0}}}\\ - \sqrt {2\left[ {1 - \rm{sinc}\left( {2\omega {\tau _0}} \right)} \right]} {\varphi _{p0}}\left( \omega \right) \end{array} \right]\label{12}. \end{equation} \begin{equation} {\varphi _{ck}}\left( \omega \right) = {-G_k}\left[ \begin{array}{l} {\varphi _{ck + 1}}\left( \omega \right){e^{ - j\omega {\tau _k}}} + {\varphi _{pk}}\left( \omega \right)\\ - {\varphi _{ck - 1}}\left( \omega \right){e^{ - j\omega {\tau _{k - 1}}}} - {\varphi _{pk - 1}}\left( \omega \right) \end{array} \right]\label{13}. \end{equation} \begin{equation} {\varphi _{cN}}\left( \omega \right) = \frac{{ - {G_N}}}{{1{\rm{ + }}{G_N}{e^{ - j2\omega {\tau_{N}}}}}}\left[ \begin{array}{l} \sqrt {2\left[ {1 + {\rm{sinc}}\left( {2\omega {\tau_{N}}} \right)} \right]} {\varphi _{pN}}\left( \omega \right)\\ - {\varphi _{cN - 1}}\left( \omega \right){e^{ - j\omega {\tau _{N - 1}}}} - {\varphi _{pN-1}}\left( \omega \right) \end{array} \right]\label{14}. \end{equation} \begin{equation} {S_{Residual}}(\omega ) = \left\langle {{{\left| {{\varphi _{cN}}\left( \omega \right){e^{ - j\omega {\tau _N}}} + {\varphi _{pN}}\left( \omega \right)} \right|}^2}} \right\rangle + {S_{noise\_floor\_N}}(\omega )\label{15}. \end{equation} \section{Conclusions} In conclusion, we present a long-haul RF transfer scheme by adopting MARSs. The proposed scheme has the capability to independently compensate the fiber-induced noise of each fiber sub-link, which effectively solves the limitation of compensation bandwidth for long-haul transfer. This MARS shares the same modulated optical signal for the front and rear fiber sub-links, which can not only simplify the configuration of RF transfer configuration but also provide the multiple-access capability. Experimentally, we demonstrate a 1 GHz signal transfer based on the proposed scheme by adopting one MARS via 260+280 km SMFs. The stable 1 GHz signal transferred to the RS has the fractional frequency instability of less than $5.9\times10^{-14}$ at the integration time of 1 s and $8.5\times10^{-17}$ at 10,000 s. At the MARS, the stable 1 GHz signal with the stabilities of less than $5.6\times10^{-14}$ and $6.6\times10^{-17}$ at 1 s and 10,000 s can also be obtained. Moreover, we for the first time theoretically model the effect of the MARS position on the fractional frequency instability of the fiber-optic RF transfer system with two fiber sub-links, demonstrating that the MARS position has little effect on system's performance when the ratio of the front and rear fiber sub-links is around $1:1$. Promisingly, the proposed scheme with great scalability are potential for ultra-long-haul RF transfer by arbitrarily adding the same MARSs on the main fiber link. \begin{backmatter} \bmsection{Funding} This work was supported by the National Natural Science Foundation of China (NSFC) (62120106010, 61905143), the Zhejiang provincial Key Research and Development Program of China (2022C01156) and the National Science Foundation of Shanghai (22ZR1430200). \bmsection{Disclosures} The authors declare no conflicts of interest. \bmsection{Data availability} Data underlying the results presented in this paper are not publicly available at this time but may be obtained from the authors upon reasonable request. \end{backmatter}
\section{Introduction} As robots become more and more ubiquitous in industrial environments, we also start to see them being deployed in other settings, such as homes \cite{IOCCHI2015258} and hospitals \cite{Tasaki2015Robot}. In tasks that require cooperation, robots should coordinate to achieve a common goal. However, achieving efficient cooperation may be a complex endeavor when robots come from different origins. One way to address this problem is to endow a robot with the ability to learn \emph{on the fly} how to cooperate by observing their teammates and environment. Ad hoc teamwork \cite{stone2010ad} aims to address the problem above and thus design an agent that learns on the fly to adapt to unknown teammates in order to complete teamwork tasks. Furthermore, these agents must be robust to changes, such as adapting to new teammates and different environments. Several algorithms for ad hoc teamwork have been proposed over the past few years. The state-of-the-art methods assume an agent has a library of teammate models and/or tasks and propose algorithms that choose on the fly the most appropriate models/tasks to cooperate with the unknown team (e.g., \cite{ribeiro21}, \cite{santos21}, and \cite{ribeiro22}). Other notable examples are the ad hoc agent in \cite{melo2016ad}, where each task within the library is represented as a fully cooperative matrix game, and AATEAM \cite{chen2020ad} which has a library of teammate models that are learned with attention networks. Probably the most famous algorithm for ad hoc teamwork is PLASTIC-Policy \cite{BARRETT2017132}, which also resorts to a library of learned policies and teammate models. However, all these algorithms fail to adapt efficiently when an unknown team is very different from the models/tasks within the library. The main contribution of this work is to address this gap in the ad hoc teamwork literature by combining a transfer learning strategy and PLASTIC-Policy, whereby we use the parameter sharing strategy. Hence, we create a novel ad hoc agent that can efficiently cooperate with an unknown team that differs significantly from the models/tasks within its library. We also conducted an empirical evaluation in the Half Field Offense simulation domain \cite{Kalyanakrishnan07}, a modified version of the RoboCup Soccer Simulation 2D sub-league. The results show that an ad hoc agent can indeed take advantage of PLASTIC-Policy combined with a transfer learning method. In our experiments, the ad hoc agent quickly adapts to unknown teammates, exhibiting close-to-optimal behavior from the start. \section{Background} \label{sec:background} A Markov decision process (MDP) is a mathematical framework for building sequential decision-making algorithms for agents. Formally, an MDP is a 5-tuple $(S, A, p, R, \gamma)$, where $S$ is a set of states, $A$ is a set of actions, $p$ is the transition probability function for reaching a state $s'$ given that the previous state was $s$ and the action taken was $a$, $R: S \times A \rightarrow \mathbb{R}$ is the reward received by the agent upon taking an action $a$ from state $s$, and $\gamma$ is the discount factor. Reinforcement Learning (RL) \cite{SUTTON} is a subarea of machine learning that aims to learn an optimal policy of an MDP, when the agent does not know the transition probability function and reward function. The most famous RL method is Q-learning \cite{watkins1992qlearning}. This RL method learns the action-value function directly, $Q_\pi: S \times A \rightarrow \mathbb{R}$, which corresponds to the discounted reward of taking a given action in a given state then following policy $\pi$. Q-learning updates its estimate of the $Q$-value in the following way: $$ Q(S_t, A_t) \gets (1 - \alpha) Q(S_t, A_t) + \alpha (R_{t+1} + \gamma \max_a Q(S_{t+1}, a)) $$ where $\alpha$ is the learning rate. Hence, the method interpolates, by a factor of $\alpha$, the current estimate for a given state-action pair with the reward received by taking the given action in the given state added to the best expected discounted reward possible from the next state onward. With a discrete action space and state space, Q-learning converges to the optimal $Q$-values (i.e., the $Q$-values of the optimal policy, $Q_{\pi^*}(s,a)$ or $Q^*(s,a)$) if all actions are sampled a large number of times in all states. An optimal policy is then derived by simply querying which action maximizes the optimal $Q$-value for a given state: $\pi^*(s) = \argmax_a Q^*(s, a)$. Deep Q-Network (DQN) \cite{mnih2015human} is a popular RL method for estimating the optimal $Q$-values with a neural network. An advantage of this approach is that it can handle continuous state spaces in complex environments. DQN approximates the optimal $Q$-values, $Q^*$, by using a neural network of parameters $\theta$: $Q(s,a;\theta) \approx Q^*(s,a)$. At each step, the agent adds a transition $(s,a,r,s')$ to a replay memory buffer, from which batches of transitions are sampled in order to optimize the parameters of the network by minimizing the following loss: $$ L(\theta_t) = \mathbb{E}_{s,a,r,s' \sim \rho (.)}\left[ (y_t - Q(s,a;\theta_t))^2 \right] \textrm{where}\,\, y_t = r + \gamma \max_{a'}Q(s',a'; \theta_{t-1}) $$ Here, $y_t$ is called the temporal difference target, and $y_t - Q$ is called the temporal difference error. $\rho$ represents the behavior distribution, the distribution over transitions $(s,a,r,s')$ collected from the environment. The input to a DQN is a state, $s$, where each feature of the state space corresponds to an input node, and the output are the various values of $Q(s,a)$ where each output node corresponds to a different action $a$. DQNs also resort to \textit{experience replay} to make their updates more stable, by storing each transition $(s,a,r,s')$ in a circular buffer called \textit{the replay buffer} at every time step. Then, instead of using a single transition to compute the loss and back-propagate, a mini-batch of past transitions (randomly sampled) is used instead. This improves the stability of the updates by using uncorrelated transitions in a batch and is called batch learning. \section{OTLPP - Online Transfer Learning for Plastic Policy} In this section, we present our algorithm OTLPP that builds on PLASTIC-Policy \cite{BARRETT2017132}. The key aim of this algorithm is to learn to collaborate quickly with unknown teammates that are significantly different from previously encountered teams. PLASTIC (Planning and Learning to Adapt Swiftly to Teammates to Improve Cooperation) is an algorithm described in \cite{BARRETT2017132}. When an ad hoc agent uses PLASTIC, it observes how its team acts and models that behavior to predict the optimal action to take. PLASTIC-Policy is the policy-based version of PLASTIC, which allows it to work in complex and continuous state space domains. PLASTIC-Policy maintains a probability distribution over all team policies within its library, representing how likely the current team is to its library's team model/policies. The ad hoc agent builds this library from the previous interaction with teammates. To update the distribution, the agent observes the team while it acts and determines which past team is most likely to be the current one. A limitation of PLASTIC-Policy is that it is only effective on a team that resembles a team within its library, meaning the current team must be similar to one of the previously encountered teams so that it can cooperate adequately. To solve this problem, Section \ref{subsection:OTLPP} presents an algorithm that combines a transfer learning algorithm with PLASTIC-Policy, which is the key contribution of our work. In Section \ref{subsection:plasticmethods}, we present the methods from PLASTIC-Policy that have been adapted to use a DQN. \subsection{PLASTIC-Policy Methods} \label{subsection:plasticmethods} PLASTIC-Policy relies on the \texttt{LearnAboutPriorTeammates} function (Line 1) to build a team model and policy regarding a previously encountered team. In Fig. \ref{alg:LAPT}, the agent gathers data in the form of the tuple $(s,a,r,s')$\footnote{Where $s$ is the original state, $a$ the action taken, $r$ the reward received and $s'$ the resulting state.} as it plays with a given team. With these tuples, it obtains a policy by using a Deep Q-Network, which is an RL algorithm that uses samples from the transitions to approximate the values of the state-action pairs. It also learns a nearest neighbors model from the same gathered data, to be used later by the PLASTIC-Policy algorithm when making predictions about the new team's behavior. \begin{figure}[ht] \fbox{\begin{minipage}{\textwidth} \begin{algorithmic}[1] \Function{LearnAboutPriorTeammate}{$t$} \Comment $t$: the prior teammate \State DQN $\gets$ a newly initialized Deep Q-Network \State Data $\gets \emptyset$ \State $s$ $\gets$ the initial state \Repeat \State $a$ $\gets$ DQN($s$) \State Take action $a$ and collect $(s,a,r,s')$ \State Data $\gets$ Data $\cup \{(s,a,r,s')\}$ \State Add $(s,a,r,s')$ to DQN's replay buffer and perform batch learning on DQN \State $s$ $\gets$ $s'$ \Until{no more transitions are needed} \State Derive a policy $\pi$ for $t$ from DQN \State Learn a nearest neighbors model $m$ of $t$ using Data \State \Return $(\pi, m)$ \EndFunction\\ \Function{UpdateBeliefs}{$BehaviorDistr$, $s$, $s'$} \Comment $BehaviorDistr$: probability distribution over possible teammate behaviors, $s$: the previous environment state, $s'$: the new environment state \For{$(\pi, m) \in$ BehaviorDistr} \State loss $\gets 1 - P(s'|m, s)$ \State BehaviorDistr($m$) $\gets $BehaviorDistr($m$)$ * (1 - \eta loss)$ \EndFor \State Normalize BehaviorDistr \State \Return BehaviorDistr \EndFunction\\ \Function{SelectAction}{$BehaviorDistr$, $s$} \Comment $BehaviorDistr$: probability distribution over possible teammate behaviors, $s$: the current environment state \State $(\pi, m) = \textrm{argmax}$ BehaviorDistr \Comment select the most likely policy \State \Return $\pi(s)$ \Comment return the action for the given state according to that policy \EndFunction \end{algorithmic} \end{minipage}} \fbox{\begin{minipage}{\textwidth} \abovecaptionskip=0pt \caption{Pseudocode for the policy based implementation of the methods \texttt{LearnAboutPriorTeammate}, \texttt{UpdateBeliefs}, and \texttt{SelectAction} (methods taken from \cite{BARRETT2017132} and adapted to use a DQN).} \label{alg:LAPT} \end{minipage}} \end{figure} In \texttt{LearnAboutPriorTeammates}, a Deep Q-Network is initialized in Line 2 and the algorithm queries the DQN for which action it should take next (Line 6) and executes it, collecting the tuple $(s,a,r,s')$ in Line 7. Line 10 adds the tuple to \texttt{Data} so that the tuples can be used to build the nearest neighbors model in Line 13. In Line 9, the tuple is also added to the DQN's replay buffer, and the DQN then proceeds to perform batch learning, as described in Section \ref{sec:background}. Once no more transitions are deemed necessary, the agent derives a policy from the Deep Q-Network (Line 12), which can be done by simply saving a snapshot of the network's weights and later using \texttt{DQN}($s$) to select an action, just like Line 6. PLASTIC-Policy keeps a probability distribution over all previously encountered teams within its library. These beliefs are updated at each timestep as the agent gathers more data regarding the current team. The function \texttt{UpdateBeliefs}, in Line 17 of Fig. \ref{alg:LAPT}, presents the pseudocode for updating the beliefs. Line 18 iterates through all team models (i.e., nearest neighbors models) so that, in line 19, it can use the model, along with the original state $s$, to calculate the probability that the resulting state $s'$ is consistent with the current team. This is done by getting $\hat{s} = m(s)$, where $\hat{s}$ is the closest state in $m$ to $s$, for some distance measure\footnote{The only requirement for the distance measure is it to be 0 when $\hat{s} = s$ and close to 0 when $\hat{s}$ and $s$ are considered "similar".}. Then, the corresponding resulting state, $\hat{s'}$ is obtained from $\hat{s}$\footnote{Such association was recorded in \texttt{LearnAboutPriorTeammates} (Fig. \ref{alg:LAPT}, line 10).}. Furthurmore, each state feature is compared between $s'$ and $\hat{s'}$ to calculate the probability, where the difference between the two is due to a noise drawn from a normal distribution. These probabilities are then multiplied together to obtain $P(s'|m,s)$. In line 20, the probability distribution is updated for the current team model by a factor of $1-\eta \textrm{loss}$. The $\eta$ factor is used to attenuate sporadically incorrect predictions that would otherwise bring the probability of the potentially correct team close to 0. Once all beliefs have been updated, the distribution is normalized (Line 22). While the agent updates its beliefs, it must also act in the environment to gather further data about the current team. Therefore, it must use one of the policies at its disposal to do so. Choosing which policy to use comes down to simply choosing the team that has the highest belief, according to what the agent has seen so far, as shown in function \texttt{SelectAction} (Line 26 of Fig. \ref{alg:LAPT}). \begin{figure}[t] \fbox{\begin{minipage}{\textwidth} \tiny \begin{algorithmic}[1] \Function{TransferKnowledge}{$BehaviorDistr$} \Comment $BehaviorDistr$: probability distribution over all known teams regarding which one is most similar to the current one. \State $(\pi, m) \gets$ argmax BehaviorDistr \Comment get the best policy \State DQN$_{source} \gets$ the Deep Q-Network associated with $\pi$ \State DQN$_{target} \gets$ a new Deep Q-Network \State Use Parameter Sharing between DQN$_{source}$ and DQN$_{target}$ \State \Return DQN$_{target}$ \EndFunction \end{algorithmic} \end{minipage}} \fbox{\begin{minipage}{\textwidth} \abovecaptionskip=0pt \caption{Pseudocode for the transfer learning algorithm used in this article.} \label{alg:TK} \end{minipage}} \end{figure} \subsection{Combining Transfer Learning and PLASTIC-Policy} \label{subsection:OTLPP} Online Transfer Learning for PLASTIC-Policy (OTLPP) is the key contribution of this work, where the ad hoc agent can collaborate with a new team that is significantly different from the team models and policies within its library. OTLPP can effectively leverage the ad hoc agent's past experiences with different teams to quickly adapt to a new one by combining PLASTIC-Policy with Transfer Learning. One common technique for transferring knowledge between two neural networks is to share the parameters (or part of them) between the source network and the target network \cite{zhuang2020comprehensive}. This technique is known as Parameter Sharing, and we used it to transfer knowledge between DQNs. There are several strategies in Parameter Sharing, such as transferring the weights of all layers or just the weights from the shallower (closer to the input) layers. Also, the shallower weights may be frozen, which implies learning will only occur in the deeper layers\footnote{This is done for learning stability reasons.}. The transfer learning algorithm, represented by the function \texttt{TransferKnowledge} in Fig. \ref{alg:TK}, begins by obtaining the policy that corresponds to the team with the highest probability value, in Line 2. Then, in the following line, it derives a Deep Q-Network from that policy\footnote{The policy is actually computed via a Deep Q-Network, so this derivation is straightforward.}, which will be used as the source for the transfer learning algorithm. The target is a newly initialized Deep Q-Network. The final step is to use Parameter Sharing from the source DQN to the target DQN. As mentioned above, all or just a subset of the weights may be transferred, and weight freezing may occur. \begin{figure}[t] \fbox{\begin{minipage}{\textwidth} \tiny \begin{algorithmic}[1] \Function{OTLPP}{$PriorTeammates$, $HandCodedKnowledge$, $BehaviorPrior$} \Comment $PriorTeammates$: past teammates the agent has encountered, $HandCodedKnowledge$: prior knowledge coded by hand, $BehaviorPrior$: prior distribution over the prior knowledge. \State \State PriorKnowledge $\gets$ HandCodedKnowledge \Comment initialize knowledge from prior teammates \For{$t \in$ PriorTeammates} \State PriorKnowledge $\gets$ PriorKnowledge $\cup$ \Call{LearnAboutPriorTeammate}{t} \EndFor \State BehaviorDistr $\gets$ BehaviorPrior \Comment initialize beliefs \State \State Initialize $s$ \Repeat \Comment see which team is the most similar to the current one \State $a \gets $ \Call{SelectAction}{BehaviorDistr, $s$} \State Take action $a$ and observe $r$, $s'$ \State BehaviorDistr = \Call{UpdateBeliefs}{BehaviorDistr, $s$, $s'$} \State $s \gets s'$ \Until{one team has high enough probability} \State \State DQN $\gets$ \Call{TransferKnowledge}{BehaviorDistr} \Comment use Transfer Learning to adapt to the new team \State \State Initialize $s$ once again \Repeat \Comment begin learning with the jump start from the transferred knowledge \State $a$ $\gets$ DQN($s$) \State Take action $a$ and collect $(s,a,r,s')$ \State Add $(s,a,r,s')$ to DQN's replay buffer and perform batch learning on DQN \State $s$ $\gets$ $s'$ \Until{the agent has learned} \EndFunction \end{algorithmic} \end{minipage}} \fbox{\begin{minipage}{\textwidth} \abovecaptionskip=0pt \caption{Pseudocode for OTLPP algorithm, which combines transfer learning with the PLASTIC-Policy algorithm from \cite{BARRETT2017132}.} \label{alg:OTLPP} \end{minipage}} \end{figure} In Fig. \ref{alg:OTLPP}, we present the OTLPP algorithm, which combines transfer learning with PLASTIC-Policy. In Lines 3-7, and much like the original PLASTIC-Policy algorithm, the agent begins by combining some knowledge that may have been hand-coded with knowledge gathered from previously encountered teams by using the \texttt{LearnAboutPriorTeammate} function (see Fig. \ref{alg:LAPT}). At this point, the ad hoc agent has compiled a library of policies and team models. Therefore, it can reason about the similarities between the current team and each of these past teams. In Lines 9-15, the ad hoc agent continuously updates its behavior distribution over the past teams with \texttt{UpdateBeliefs} (Fig. \ref{alg:LAPT}), while also selecting the next action to take based on the current values of the distribution with \texttt{SelectAction} (Fig. \ref{alg:LAPT}). Once a certain team reaches some probability threshold of acceptability, indicating that it is indeed the right team, the agent can move on to transferring knowledge (Line 17) from its prior experiences and begin learning a new policy for the new team. In other words, Line 17, obtains a Deep Q-Network whose parameters have been initialized by \texttt{TransferKnowledge} (Fig. \ref{alg:TK}). It can then begin to learn the new policy for the new team, in lines 19-25, with the advantage of not having to start learning from scratch due to the Transfer Learning algorithm. \section{Experimental Setup} This section describes our experimental setup to test the OTLPP algorithm within an agent. We used the Half Field Offense (HFO) simulator \cite{Kalyanakrishnan07}, a modified version of the RoboCup Soccer Simulation 2D sub-league. In HFO, an offense team tries to score a goal and the defense team tries to prevent it. In addition, only half of the original field is playable, and a defending agent cannot attack nor vice-versa. In following paragraphs, we present the experimental setup in detail. \textbf{Test Setting and Agents:} All tests were conducted in a 2 vs 2 matches in the HFO, where the ad hoc agent plays with one teammate against two opponents. The opponents are two instances of the \texttt{agent2d} and the teammate can be one of the following: \texttt{agent2d}, \texttt{aut}, \texttt{gliders}, \texttt{helios}, from 2013, and \texttt{receptivity}, from the 2019 RoboCup Soccer Simulation 2D sub-league competition\footnote{Agent binaries were downloaded from the following page:\\ https://archive.robocup.info/Soccer/Simulation/2D/binaries/RoboCup/}. What this means is that the opponents will always act according to the \texttt{agent2d} strategy, whereas the teammate can display one of 5 behaviors, according to each of the 5 different types of teammates mentioned above. No behavioral variability was allowed for the opponents, since \textit{ad hoc teamwork} is not concerned with changes in the task (which includes besting the opponents), hence their singular strategy. \textbf{State Space:} HFO provides two state spaces on the fly: a low-level one and a high-level one. The low-level state space provides $59 + 9T + 9O$ features, where $T$ is the number of teammates (excluding the agent) and $O$ is the number of opponents. These features include the positions and velocities of all agents on the field and of the ball, the sines and cosines of various angles (e.g., goal opening, agent orientation, velocity vector orientation), and other game state variables. The high-level state space provides a higher-level view of the match, which combines the lower-level features into more meaningful ones, exposing only $12 + 6T + 3O$ features. Of these, the following 12 features were selected as the state space for our agent: X position (the agent's X-position on the field); Y position (the agent's Y-position on the field); orientation; ball X (the ball's X-position on the field); ball Y (the ball's Y-position on the field); goal opening angle; proximity to opponent; teammate's goal opening Angle; proximity from the teammate to opponent; pass opening angle; teammate's X (the X-position of the teammate; teammate's Y (the Y-position of the teammate). We included the agent's position, along with its orientation and the ball's position, for obvious reasons: the agent cannot make the simplest of decisions if it does not know its position and the ball's location. The goal opening angle feature is present so that the agent may decide whether it is worth shooting toward the goal or pass to a teammate, among other scenarios. This is also why we include the proximity to the opponent, the teammate's goal opening and pass angles, and the teammate's position. \textbf{Action Space:} Although HFO offers action spaces of different levels of abstraction. We decided to use a new action space that resorted almost entirely to delegating to the high-level actions already provided by HFO and preventing some unintended behavior, as explained below. As a result, the following 11 actions were made available to the agent: shoot; short-dribble; long-dribble; pass-to; no-op (the agent takes no action for 4 time-steps); go-to-ball; go-to-goal; go-to-teammate; go-away-from-teammate; go-to-nearest-opponent; go-away-from-opponent. \textbf{Reward Function:} To create a reward function, we use the status of the game after an action has been taken. The following statuses are available to the agent: in-game (the game is still ongoing); goal; captured-by-defense; out-of-bounds; out-of-time; server-Down. Hence, we use PLASTIC-Policy's reward function \cite{BARRETT2017132}, which also used the HFO to evaluate the agent's performance. The reward function is the following: \begin{equation*} R(status) = \left\{ \begin{array}{ll} 1000 & \quad \textrm{if $status$ is \texttt{Goal}} \\ -1 & \quad \textrm{if $status$ is \texttt{In-Game}} \\ -1000 & \quad \textrm{otherwise}\\ \end{array} \right. \end{equation*} \textbf{Deep Q-Network Parameters:} The ad hoc agent was first trained using a Deep Q-Network against all 5 different teammate types from scratch. This allowed the agent to have a library of approximately optimal policies for each teammate type. The network has an input layer of $12$ nodes to accommodate each of the $12$ features from the state space, $3$ hidden layers of $512$ nodes, an output layer of $11$ nodes to indicate the estimated q-value of each of the $11$ actions, Rectified linear unit activation functions between all layers, a learning rate of $0.00025$, a replay memory capacity of $2.5 \times 10^5$ transitions (beginning its use when it has at least $12500$ transitions stored), a learning batch size of $64$ transitions, an $\epsilon$-greedy action selection (with $\epsilon$ having a linear decay that begins at $0.8$ and decays to $0.05$ after $100000$ time-steps), a discount factor, $\gamma$, of 0.995, an Adam optimizer \cite{adam}, a transfer rate of $500$ time-steps, and a weight initialization sampled uniformly from $[-\frac{1}{\sqrt{n}}, \frac{1}{\sqrt{n}}]$, where $n$ is the amount of nodes in a given layer. \textbf{OTLPP Parameters:} Like PLASTIC-Policy, our algorithm relies on a parameter, $\eta$, to attenuate sporadic losses on the correct team model. Also, the noise distribution used to compute $P(s'|m,s)$ is a normal distribution of mean 0 and variance $\sigma^2$, so $\sigma$ is also another parameter. The following values were used in our code: $\eta = 0.10$, and $\sigma = 4.0$. The condition \texttt{one team has high enough probability} in Line 15 of Fig. \ref{alg:OTLPP} is true at the end of the 25th game, given that at this stage, the agent almost always makes the correct decision regarding its current team. In the \texttt{UpdateBeliefs} function (Fig. \ref{alg:LAPT}), the probability $P(s'|m,s)$ is calculated by first obtaining the state $\hat{s}$ that is closest to $s$ via the nearest-neighbor model $m$, obtaining that state's corresponding next state, $\hat{s}'$, and then calculating the distance between the next state and the predicted next state, $d = \texttt{Distance}(s', \hat{s}')$. \texttt{Distance} can be defined in several different ways, but fundamentally it should be $0$ if $\hat{s}' = s'$ and close to $0$ if $\hat{s}'$ and $s'$ are considered similar. For this work, and since the intent is to identify which teammate the agent is playing with, the features of the state space that do not pertain to the teammate, such as the opponents' movements or the agent's own movements, should not be considered. Therefore, the only features considered are the teammate's coordinates. Hence, let $s_x$ be the teammate's $x$-position in a given state $s$, and $s_y$ its $y$-position analog. Then, \texttt{Distance} is defined as $\texttt{Distance}(s', \hat{s}') = \prod_{c \in \{x, y\}} \texttt{ProbFromNoise}(s'_c - \hat{s}'_c) $ and $ \texttt{ProbFromNoise}(\Delta) = 1 - 2 \cdot |F_{N(0, \sigma^2)}(\Delta) - \frac{1}{2}| $, where $F_{N(0, \sigma^2)}$ denotes the cumulative distribution function for a normal distribution of mean $\mu = 0$ and a variance of $\sigma^2$. Therefore, \texttt{ProbFromNoise} returns the probability that a given value was drawn from a normal distribution. As mentioned before, we use a normal distribution in the equation above because we assume that every transition is affected by the noise of the normal distribution. \textbf{Parameter Sharing:} During the Transfer Learning stage of the OTLPP algorithm (Fig. \ref{alg:OTLPP}), the agent uses Parameter Sharing to transfer knowledge between a single source Deep Q-Network and the target Deep Q-Network that will later learn the new policy. We decided to transfer all weights, including those from deeper layers, because the environment and the task remain the same. Therefore, a lot of commonality is expected between how the ad hoc agent should behave when paired with the old teammate and with the new one. However, if the change in teams represents a higher change in the overall problem, perhaps transferring only the shallower layers, which correspond to broader abstractions, could also be used. \section{Results} In our empirical evaluation, the task consists of having our ad hoc agent (with the OTLPP algorithm) cooperate with one of 5 different teammates, namely (\texttt{agent2d}, \texttt{aut}, \texttt{gliders}, \texttt{helios}, and \texttt{receptivity}). Each teammate was designed independently by developers from different countries for the 2013 and 2019 RoboCup Soccer Simulation 2D sub-league competition. Furthermore, the goal is to score as many goals as possible against a defense team made up of two agents of the type \texttt{agent2d}. Given that our agent uses a DQN, one way to evaluate the learning procedure at a given point in time is to take a snapshot of its network's parameters at that time and use them to obtain the goal fraction (i.e., the number of goals divided by the number of games). In our experiments, all goal fractions were obtained by running 200 games for the same network parameters and dividing the number of goals scored by that amount. Other metrics may be used, such as the sum of the rewards or the average time to score. However, since the task is ultimately to score a goal, the goal fraction is probably the best metric. \begin{figure}[h] \centering \includegraphics[width=1.0\textwidth]{oltp_learning.pdf} \caption{Comparison between the average goal fraction when the agent uses OTLPP (in red) compared to an RL agent (in green), while playing with each teammate. The vertical bars represent one standard deviation.} \label{fig:results-learning} \end{figure} To test the algorithm against each teammate available, we excluded the policy of the teammate from the library, which is the equivalent to calling \texttt{LearnAboutPriorTeammates} (Fig. \ref{alg:LAPT}) on all teammates except for the particular one during the execution of OTLPP (Fig. \ref{alg:OTLPP}). Hence, the ad hoc agent learns the policy of 4 teammates and then uses that knowledge, along with the behavior distribution it maintains over them, to transfer knowledge to a new Deep Q-Network for the 5\textsuperscript{th} teammate. In Fig. \ref{fig:results-learning}, we start showing the ad hoc agent's performance during the learning process, when it resorts to the OTLPP algorithm (red line) with each teammate: \texttt{agent2d}, \texttt{aut}, \texttt{gliders}, \texttt{helios}, and \texttt{receptivity}. We also include the performance of an RL agent (green line), which depicts the performance of an agent that learns from scratch. From the plots, we can notice that our ad hoc agent with the the OTLPP algorithm benefits from a significant boost, when transfer learning takes place at the beginning of learning. In other words, our agent is able to exhibit close-to-optimal behavior from the start. \begin{table}[h] \centering \small \begin{tabular}{|l|l|l|} \hline Team & PLASTIC-Policy & OTLPP \\ \hline \hline \texttt{agent2d} & 0.37 & \textbf{0.40} \\ \texttt{helios} & 0.61 & \textbf{0.62} \\ \texttt{aut} & 0.55 & \textbf{0.58} \\ \texttt{gliders} & \textbf{0.53} & 0.51 \\ \texttt{receptivity} & 0.47 & \textbf{0.52} \\ \hline \end{tabular} \caption{Comparison between the average goal fraction over 100000 episodes when the agent uses PLASTIC-Policy and when it uses OTLPP, for each team.} \label{fig:table} \end{table} Finally, Table \ref{fig:table} compares OTLPP's performance with PLASTIC-Policy during run time. In particular, Table \ref{fig:table} compares the average score of an ad hoc agent using PLASTIC-Policy with an ad hoc agent using OTLPP, over 100000 episodes. Each ad hoc agent has 4 policies within its library, and we exclude the policy that corresponds to the current teammate of the ad hoc agent. This evaluation enables us to test the performance of the ad hoc agent with a completely unknown teammate. In bold, we highlight the maximum score between both alternatives. The results show that OTLPP can outperform or perform close to PLASTIC-Policy in every test, showcasing the advantage of our OTLPP algorithm. Hence, OTLPP almost always means an improvement over PLASTIC-Policy. \section{Concluding Remarks} Our paper is the first work to combine a transfer learning method with PLASTIC-Policy in order to create an ad hoc agent that learns to cooperate with a completely unknown teammate. In our empirical evaluation, we show that the combination of a transfer learning method with PLASTIC-Policy can serve as a powerful tool for ad hoc agents. In particular, the results show that OTLPP can outperform or perform close to PLASTIC-Policy. Hence, the ad hoc agent quickly adapts to completely unknown teammates, exhibiting close-to-optimal behavior from the start. As future work, other transfer learning methods may be explored, such as transferring knowledge from multiple sources \cite{10.1145/2505515.2505603}, meaning multiple teams would be a source of transferred knowledge. \bibliographystyle{splncs04}
\section{Introduction} The ability to safely and intelligently navigate through different traffic scenarios is an important aspect of Autonomous Vehicles (AVs). Such navigation is relatively easy for human drivers because they can interpret and predict how the surrounding environment will evolve. However, performing a similar prediction task is quite difficult for AVs especially under different traffic conditions. Predictions in the 3D world coordinates require the entire pipeline starting from the detection of the 3D object in the LiDAR point cloud along with the association of agents from the previous frames to finally performing predictions using the previous sequence to work accurately. Through this prediction pipeline, error can creep in from any of the modules and can affect the final results. In this paper, we tackle the challenge of performing long-term future predictions for AVs with Occupancy Grid Maps (OGMs). OGMs are widely used in the industry as they capture the local environment and dynamic agents into discrete spatial cells. Each cell is classified as static, dynamic, unknown, or free space. OGMs are probabilistic representations, integrating uncertainties from sensors, and temporal analysis. They provide a dense representation as each portion of the space is analyzed and not limited to objects of a given type or size. \begin{figure}[!t] \centering \includegraphics[width=.5\textwidth]{images/teaser.png} \caption{Generated OGMs from nuScenes dataset are coupled with corresponding ground truth 3D labels and fed into an spatio-temporal prediction network pipeline. Network learns from past 4 sec contextual information and predicts 3 sec into the future. } \label{fig:teaser} \end{figure} Future frame prediction of the OGMs is equivalent to a video prediction task with certain domain-specific knowledge and modifications in the design of the model to capture the discretized spatial information of agents and environments in a normal driving scenario. Accordingly, recent works have considered deep learning-based models for predicting future video frames with OGMs \cite{ Mohajerin2019MultiStepPO, itkina2019dynamic}. The existing works usually separate the static and dynamic part for prediction \cite{toyungyernsub2020double}. However, in our work, we propose a semantic scheme that can better represent the different dynamics of specific agents compared to a dynamic cell that may contain multiple agents such as pedestrians, cyclists or a vehicle. Main contributions of this work are: \begin{itemize} \item A Spatio-Temporal Network Pipeline for long-term future occupancy grid prediction. Our approach uses semantic labels of the vehicle in OGMs to model the specific motion type of agents in the prediction rather than using a generic combined prediction of static and dynamic cells that contains the environment and various types of agents such as cars, pedestrians, cyclists, etc. \item Publicly releasing an OGMs dataset consisting of static environment and semantic labels for ease in long-term prediction. Presenting the results for this dataset with state-of-art video prediction models shows that under this training scheme the models have consistent performance even for long-term predictions. The code and dataset are available at \cite{dataset}. \item Evaluate the effectiveness of a spatio-temporal module in comparison to ConvLSTM for modelling the spatial and temporal nature of future prediction in OGMs. \end{itemize} \section{Related work} \subsection{ Video prediction task} In recent years, deep learning based video prediction has emerged as a promising research direction with applications in future sequence prediction to restore a high-resolution video from its corresponding low-resolution frames. Video prediction is defined as a self-supervised learning task to extract meaningful temporal and spatial patterns in natural videos \cite{oprea2020review}. Within the video-prediction framework, sequence-to-sequence architecture that takes in a sequence of images and predicts future frames is a suitable model for our task. Developments in the video-prediction task have been adapted in the autonomous vehicle domain to predict future trajectories of agents and RGB frames to predict future occupancy grids. In the sequence-to-sequence architectures, CNNs are used to model spatial information, while RNN is used to incorporate the temporal information from the sequence. The combination of an CNN and RNN can handle the dynamic agents in the environment and extract the necessary spatial relations for per-pixel prediction of both static and dynamic objects in the environment \cite{zhou2020deep}. In this work, we compare the performance of two video prediction approaches, a ConvLSTM \cite{xingjian2015convolutional} and a PredRNN \cite{wang2021predrnn} based network architecture, over the OGMs dataset. ConvLSTM is based on prediction networks for language and speech modelling tasks. In this, LSTM is used to preserve the long-term temporal dynamics and non-markovian properties in a network structure called a memory cell and the convolutional layers act as filters to extract important features from images. PredRNN builds upon this to include spatial correlation and temporal dynamics in future image prediction with the help of novel Spatio-Temporal LSTM (ST-LSTM) blocks. In PredRNN, a new memory bank is added that takes as input the memory flow from the output of the previous frame ST-LSTM layer in the sequence. This enables the module to learn complex spatial relations of the transition between consecutive frames. \subsection{ Occupancy grid prediction} Path prediction in the occupancy grid offers the benefit of reducing the computational complexity of path association through tracking of individual subjects and prediction of individual agents in large and cluttered driving scenarios. Also, the interaction with other agents and the static environment is implicitly captured by the occupancy grid prediction models. The first end-to-end object tracking approach to directly map raw sensor input to track objects in an indoor environment with occlusion was presented in \cite{ondruska2016deep}. Building upon this, authors proposed an end-to-end trainable framework that was able to track a range of objects, including buses, cars, cyclists and pedestrians through occlusion by predicting a fully non-occluded occupancy grid from raw laser input recorded from a stationary or moving vehicle with RNN for capturing the temporal evolution of the state of the environment \cite{dequaire2016deep} \cite{dequaire2018deep}. \begin{figure}[t] \subfigure[]{ \includegraphics[width=.17\textwidth]{images/4_crossing_juction.png}} \subfigure[]{ \includegraphics[width=.17\textwidth]{images/4_croospoint_junction.png}} \subfigure[]{ \includegraphics[width=.17\textwidth]{images/3_crosspoint_junction.png} } \subfigure[]{ \includegraphics[width=.17\textwidth]{images/straight_road.png} } \centering \caption{Occupancy grid maps generated from the nuScenes dataset. Agents belonging to the 'Vehicles' category are of interest and being marked by 'green' semantic pixel labels using the projections of ground truth 3D bounding boxes. Objects of any other type including the static environment are marked in 'blue'. Different road crossing motion scenarios from the dataset are presented.} \label{fig:OGMs_dataset} \end{figure} \begin{figure*}[t] \centering {\includegraphics[width = \textwidth, height = 0.25\textwidth]{images/architecture.png}} \caption{Semantic occupancy grids consisting of environment and vehicles over the time frames of 0.5 sec. Grids are converted into binary images and separately fed to spatio-temporal networks. We evaluate two spatio-temporal networks: PredRNN and ConvLSTM.} \label{fig:model_architecture} \end{figure*} A multi-step prediction using RNN was proposed in \cite{Mohajerin2019MultiStepPO} so that an accurate prediction of the drivable space was extracted for efficient planning and navigation. The method uses motion-related features between consecutive frames to enhance the prediction of dynamic objects to account for the dataset bias towards static objects. In subsequent studies, separate predictions of the static and dynamic cells were explored. A double-prong network architecture with a separate stream for predicting static and dynamic objects was proposed in \cite{toyungyernsub2020double} to retain dynamic objects and reduce blurriness in long-term prediction. In \cite{schreiber2019long}, the static and dynamic cells are predicted separately, however, the input to the network is the entire OGM along with the velocity of each cell obtained through DOGMA \cite{hoermann2018dynamic}. The proposed model uses an encoder-decoder type architecture with ConvLSTM modules along with skip connections to extract Spatio-temporal correlations. \section{Dataset} \subsection{Generating occupancy grid maps} \label{generated_OGMs} NuScenes dataset \cite{caesar2020nuscenes} contains recordings of 1000 scenes recorded in Boston and Singapore. Each scene is 20s long and collected at 20Hz. Annotations with 3D bounding boxes are provided at 2Hz for 23 classes. NuScenes dataset contains recordings from a camera, radar, and LiDAR for environment perception along with high-quality manually annotated vectorized maps with GPU/IMU measurements. A large number of annotations and environment maps along with track id's enable research on multiple tasks such as object detection, tracking, and behavior modeling. We generate the OGMs from NuScenes LiDAR point clouds by considering a distance of 30m in cardinal directions from the centric ego-vehicle. We followed this scheme with regards to different traffic scenarios and to capture as many dynamic objects approaching towards or receding from the ego-vehicle from all directions. To obtain the OGMs, we adopt the Conditional Monte-Carlo Dense Occupancy Tracker (CMCDOT) \cite{rummelhard2015conditional} with a resolution of 0.1m, that eventually generates a $600\times600$ grid size. This is a spatial occupancy tracker that infers the dynamic of a scene by discrete classification of pixels as static, dynamic, unknown, or free space. Accordingly, we eliminate the unknown and free occupancies and project the ground truth 3D boxes onto the OGMs to obtain our experimental dataset shown in Figure \ref{fig:OGMs_dataset}. \subsection{3D to 2D projection of ground truth bounding boxes over nuScenes dataset} Existing occupancy grid generators lack semantic information about the detected objects in the environment. However, the nuScenes dataset contains annotation of the 3D bounding boxes of objects in the LiDAR point cloud at 2Hz which can be utilized as semantic information in the occupancy grid. The occupancy grids are generated with a resolution such that each pixel in the occupancy grid map corresponds to 0.1m in the LiDAR point cloud. Corresponding to annotated frames in the dataset, the generated grids are matched using their timestamps, and the top corners of the bounding box of object class `vehicle' are transformed and plotted to the grid. \section{Model Architecture} We consider spatio-temporal learning networks for performing the prediction task. Accordingly, we implemented state-of-art PredRNN architecture\cite{wang2021predrnn}. We use the ST-LSTM building blocks for PredRNN and include ConvLSTM architecture for baseline comparison. ST-LSTM unit is represented by ($\rchi_{t}$, \textit{$H^{l}_{t-1}$}, \textit{$C^{l}_{t-1}$}, \textit{$M^{l-1}_{t}$}), where \textit{l} $\in$ \{1, . . , \textit{L}\} and \textit{L} is the maximum number of recurrent units. At a time instant \textit{t}, $\rchi_{t}$ is the input state, \textit{$H^{l}_{t-1}$} is the output hidden state from the previous unit, \textit{$C^{l}_{t-1}$} is the memory state and \textit{$M^{l-1}_{t}$} is the saptio-temporal memory bank jointly maintained by all nodes for learning unified representations in the recurrent network. The inclusion of this memory bank is the key difference as compared to ConvLSTM unit. We consider four recurrent ST-LSTM and standard LSTM units (\textit{L}=4) in PredRNN and ConvLSTM networks respectively. Each hidden state has 64 channels. Past time frames from \textit{t} - 4s to \textit{t}, where \textit{t} indicates the current time, over the interval of \textit{$\Delta$t} = 0.5s are considered as inputs and future predictions are done for \textit{t} + 0.5s to \textit{t} + 3s considering the same time interval as demonstrated in Figure \ref{fig:model_architecture}. We adopt the reverse scheduled sampling scheme (RSS) for the inputs during training the networks. Introduced in \cite{wang2021predrnn}, RSS is a curriculum learning strategy that forces sequence-to-sequence models for learning long-term dynamics. A gradual change in the encoder training process accomplishes this by replacing previously generated frames with previous ground truth frames. Following the previous work \cite{denton2018stochastic, finn2016unsupervised}, we denote a unified predictive model \textit{f$_\theta$(.)} for sequence encoding. We denote the input context frames up to time \textit{T} as \textit{$ \rchi_{input}$} = \{\textit{$ \rchi_1$}, . . ,\textit{$ \rchi_T$}\} and predicted time frames under the RSS scheme are given by: \begin{equation}{\label{eq:rss_equation}} \hat{\rchi}_{t+1} = f_\theta\left( \hat{\rchi}_{t} \xmapsto{RSS} \textit{$\rchi_t$}, \textit{$H_{t-1}$}, \textit{$C_{t-1}$}, \textit{$M_{t-1}$}\right) \quad \text{for} \quad \textit{t} \leq \textit{T} \end{equation} where, $ \xmapsto{RSS}$ denotes the gradual change in training process by considering ground truth frame \textit{$\rchi_t$} instead of generated frame $\hat{\rchi}_{t}$. Under the RSS scheme, there exists a probability $ \epsilon_k$ $ \in$ [0,1] for sampling true frames \textit{$\rchi_t$} $ \in$ \textit{$\rchi_{input}$} or a probability (1 - $ \epsilon_k$) of sampling $ \hat{\rchi}_{t}$. $\epsilon_k$ changes with number of training iterations \textit{k}, having an initial and end values as $\epsilon_s$ and $\epsilon_e$ respectively. We formulate this increase with an exponential equation as: \begin{equation}{\label{eq:epsilon_enq}} \epsilon_k = \epsilon_e - (\epsilon_e - \epsilon_s) \times exp\left(-\frac{k}{\alpha_e}\right) \end{equation} Our model architecture consists of two training paths to explicitly learn the dynamics of the static environment and semantic vehicle objects as visible in Figure \ref{fig:model_architecture}. Accordingly, the overall loss function \textit{L}$_o$ is a weighted sum of static environment loss \textit{L}$_{static}$ and semantic loss \textit{L}$_{semantic}$: \begin{equation}{\label{eq:overall_loss}} L_{0} = L_{static} + k_{0} L_{semantic} \end{equation} where \textit{k}$_o$ is the weight factor for balancing the two loss terms. The static and semantic loss functions \begin{equation}{\label{eq:static_loss}} L_{static} = \frac{1}{W \times H} \sum_{c=1}^{W \times H} |y_{static}^{*}(c) - y_{static}(c)| \end{equation} \begin{equation}{\label{eq:semantic_loss}} L_{semantic} = \frac{1}{W \times H} \sum_{c=1}^{W \times H} \lambda_{c} (y_{semantic}^{*}(c) - y_{semantic}(c))^{2} \end{equation} are the mean of absolute differences of each cell \textit{c} between the ground truth labels \textit{y$^*(c)$} and predicted labels \textit{y(c)}. $\lambda_{c}$ is a weighting factor for balancing the semantic cells against the background. For each cell this factor is given by: \begin{equation}{\label{eq:lambda}} \lambda_{c} = 1 + k_{s}*y_{semantic}^{*}(c) \end{equation} such that $\lambda_{c}=1+k_{s}$ for semantic cells and $\lambda_{c}=1$ elsewhere. \section{Training and Experimentation} The experimental dataset is described in section \ref{generated_OGMs}. We consider 80\% of the dataset for training and 20\% for testing. Original OGMs provided in $\mathbb{R}^{600\times600\times3}$ are reduced in spatial size to $\mathbb{R}^{256\times256\times1}$. The convolutional kernel size is set to $5\times5$ inside ST-LSTM and LSTM units. Networks are trained using the Adam optimizer \cite{kingma2014adam} with a starting learning rate of $3\times10^{-4}$ with a batch size of 8 sequences. We set $\epsilon_e$ = 1.0, $\epsilon_s$ = 0.5, and $\alpha_e$ = $5\times10^3$ in equation (\ref{eq:epsilon_enq}). We perform training for 25 epochs on 6109 sequences. The models are tested on 1200 test sequences considering the same input and prediction scheme. We set \textit{k}$_o$ = 10 in eqn. (\ref{eq:overall_loss}) and \textit{k}$_s$ = 2 in eqn. (\ref{eq:lambda}) based on the validation performance. We also compare the results of semantic MSE between the spatio-temporal networks and linear projection model \cite{patil:hal-03416222}. Linear projection assumes constant instantaneous velocity and uses it to evaluate the future position. \section{Results} \subsection{Qualitative results} We consider a threshold of P$_{o}$ $>$ 0.6 for classifying the cells as occupied or not occupied. We use the same threshold for the vehicles and the rest of the environment predictions. The output of the model is a black and white image with a value of either 0 or 1 to indicate an empty or occupied state in the OGM. For representative purposes, in figure \ref{fig:reverse_motion} and \ref{fig:static_obj}, the cells with vehicle objects are represented by 'green' colour while static environment and objects other than vehicles are assigned `blue' colour. Figure \ref{fig:reverse_motion} illustrates a sample driving scenario with few static vehicles and a vehicle moving in reverse direction on a straight road. The future predictions from our proposed pipeline using PredRNN and ConvLSTM are compared. The top row depicts ground truth OGMs at specific prediction times. The ego vehicle is fixed at the center and is traveling in the forward direction in the OGMs. The motion of the entire scene is relative to the ego vehicle. The cells with the vehicles are depicted in green and the rest of the static environment with other agents is represented in blue. In this scenario, four vehicles are static and there is a lone vehicle moving in the reverse direction with respect to the ego-vehicle. The reverse-moving vehicle is marked with dashed red lines for comparison across models. In figure \ref{fig:reverse_motion}(c), it can be seen that the network with ConvLSTM as backbone fails to predict the vehicle even 2 sec into the future whereas the PredRNN based network shows the vehicle in the environment for the entire 3 sec prediction horizon. However, it is to be noted that at 3 sec the predicted position of the vehicle lags in comparison to the actual position shown in the ground truth. This could be attributed to the high speed of the vehicle and a bias in the dataset with a large number of forward-moving vehicles and their motion. Figure \ref{fig:static_obj} is an example scenario of a double-lane road with static objects detected in the middle of the road. Apart from correctly predicting vehicles, it is crucial that the model has an accurate representation of free space in the drivable area. In figure \ref{fig:static_obj}(b), it can be seen that the PredRNN-based network can retain those small obstacles in the drivable area (circled with dashed red lines) up to 2 sec into the future, while ConvLSTM network fail to retain these crucial smaller things. Also, for multiple vehicles moving in the forward direction, the prediction from the ConvLSTM model gets blurry and smaller for the vehicle at the front towards the end of 3 sec as highlighted in the figure. Certain scenarios where the ego-vehicle turns and the entire scene rotates in the OGM are difficult to model and this would require further studies where the static environment of the future scenes or stored environment map with static objects can be provided to the networks. Certain situations are inherently difficult to account for such as a new vehicle appearing in the scene for a few frames before $t=0$ or a vehicle tuning scenario at an intersection. However, in certain situations, using the information from the structure of free space, the network was able to correctly predict a vehicle's turning. \begin{figure}[!t] \subfigure[Ground truth]{ \includegraphics[width=.475\textwidth]{results_images/gt_reverse.pdf}} \subfigure[PredRNN predictions]{ \includegraphics[width=.475\textwidth]{results_images/PredRNN_reverse.pdf}} \subfigure[ConvLSTM predictions]{ \includegraphics[width=.475\textwidth]{results_images/ConvLSTM_reverse.pdf}} \centering \caption{A scene depicting few static vehicles and a vehicle going in reverse direction. Comparison between two spatio-temporal learning networks over the future predictions of 1 sec, 2 sec and 3 sec.} \label{fig:reverse_motion} \end{figure} \begin{figure}[!t] \subfigure[Ground truth ]{ \includegraphics[width=.475\textwidth]{results_images/forward_gt.pdf}} \subfigure[PredRNN predictions]{ \includegraphics[width=.475\textwidth]{results_images/predrnn_forward.pdf}} \subfigure[ConvLSTM predictions]{ \includegraphics[width=.475\textwidth]{results_images/convlstm_forward.pdf}} \centering \caption{A scene describing three vehicles moving in forward direction along with the static environment. Predictions with spatio-temporal networks are presented over the future time horizon of 3 sec.} \label{fig:static_obj} \end{figure} \begin{figure*}[t] \subfigure[]{ \includegraphics[width=.33\textwidth]{images/psnr_score.pdf}} \subfigure[]{ \includegraphics[width=.33\textwidth]{images/ssim_score.pdf}} \subfigure[ ]{ \includegraphics[width=.33\textwidth]{images/mse_static.pdf}} \subfigure[]{ \includegraphics[width=.33\textwidth]{images/mse_semantic.pdf} } \centering \caption{Frame-wise PSNR($\uparrow$), SSIM($\uparrow$), Static MSE ($\downarrow$), and Semantic MSE ($\downarrow$) results on the generated OGM dataset. The prediction horizon is 3 sec during training and testing phases. Note that PredRNN (combined) and ConvLSTM (combined) predict an entire OGM, thus separate Static and Semantic MSE cannot be reported for these cases. The Semantic MSE result from the linear projection of vehicle's bounding boxes is also presented in (d). } \label{fig:evaluation_metrics} \end{figure*} \subsection{Quantitative results} We quantitatively measure the prediction performance of the networks between the ground truth and predicted frames based on metrics like F1 score, Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index Measure (SSIM) \cite{wang2004image}, and Mean Squared Error (MSE). For each specific future time instance, we report mean values of 1200 test scenarios. These scenarios represent various urban traffic conditions and navigation challenges. \begin{table}[t] \setlength{\tabcolsep}{4.5pt} \begin{tabularx}{1\linewidth}{c c c c} & & Prediction time \\ \hline Trained networks & \textbf{1 sec} & \textbf{2 sec} & \textbf{3 sec}\\ \hline PredRNN {\scriptsize (separate)} & 85.32 $\pm$ 4.31 & 83.87 $\pm$ 4.87 & 82.92 $\pm$ 4.92 \\ PredRNN {\scriptsize (combined)} & 84.21 $\pm$ 4.26 & 82.84 $\pm$ 4.69 & 81.61 $\pm$ 5.04 \\ ConvLSTM {\scriptsize (separate)} & 82.39 $\pm$ 4.85 & 81.83 $\pm$ 5.00 & 81.07 $\pm$ 5.01\\ ConvLSTM {\scriptsize (combined)} & 81.44 $\pm$ 4.96 & 81.27 $\pm$ 5.02 & 80.62 $\pm$ 5.00\\ \hline \end{tabularx} \caption{Mean F1 scores (\%) corresponding to 1200 test scenarios subjected to individual time frames.} \label{table:F1_scores} \end{table} Table \ref{table:F1_scores} shows the F1 score comparisons between two variants of PredRNN and ConvLSTM models over the future prediction for 3 secs. Here, separate prediction imply separately predicting static and semantic objects as described in the model architecture (Figure \ref{fig:model_architecture}). While combined prediction implies predicting the entire OGM as shown in figure \ref{fig:teaser}. It is evident that for both models, separate prediction yields slightly better results as compared to combined prediction. Moreover, PredRNN performs better than ConvLSTM across all time frames. As expected, a performance drop is observed with increasing prediction steps but still, the obtained scores are comparable to environment prediction with static ego-vehicle\cite{schreiber2019long}. Figures \ref{fig:evaluation_metrics}(a) and (b) present the OGM prediction plots of PSNR and SSIM for two networks up to future 3 secs respectively. While PSNR estimates the pixel-level similarity between two images, SSIM measures the perceived changes in structural information for the pixel that are spatially close to each other. We set the sliding window size as 11 for SSIM evaluation. PredRNN outperforms ConvLSTM implying that the predicted frames from the former are more structurally similar compared to later. Also, for each of these networks the separate prediction scheme is better than combined predictions. As we report the mean of several test scenarios, a trend in performance drop is visible with prediction time. This is addressed to the fact that certain scenarios wherein the ego vehicle suddenly makes turns are difficult to predict and reconstruct at longer time horizons. Figures \ref{fig:evaluation_metrics}(c) and (d) show the computed pixel-level MSE for grid cells corresponding to static and semantic objects separately. MSE values are expected to increase with time due to the accumulation of prediction errors. At each time step, PredRNN outperforms the ConvLSTM and linear projection methods, exhibiting performance consistency as observed in Figures \ref{fig:reverse_motion} and \ref{fig:static_obj}. In general, the metrics across different datasets cannot be compared. However, the scale of MSE metric is comparable. Accordingly, the scale of both static and semantic MSE is in the range of $10^{-2}$, both are comparable to the previous literature \cite{itkina2019dynamic,toyungyernsub2020double}. This range is attributed to the fact that MSE is calculated over the entire image dominated by free space which the model is able to predict easily. \section{Conclusion and future work} We presented a pipeline for producing long-time (future 3 secs) OGM predictions of the urban environment in the case of dynamic ego-vehicle. These predictions were done separately for static and semantic obstacles with spatio-temporal networks. Accordingly, the networks were able to forecast the position of dynamic objects under different traffic scenarios and overcome the challenge of vanishing surrounding objects. We also showed that networks perform slightly better while separately predicting the static and semantic objects as compared to their combined predictions. Our OGMs are based on nuScenes dataset and include several real-world urban traffic conditions. We believe that it is vital for current techniques in AVs to model and predict these kinds of real-world scenarios and thus, we publicly release this dataset for further enhancement in OGM based research domain. For the future work, the current pipeline can be extended for performing multi-modal predictions. \section{Acknowledgement} This research work has been supported by the French Government in the scope of the FUI STAR and ES3CAP projects. Authors would like to thank Unmesh Patil for conducting experiments with linear projection model. \bibliographystyle{IEEEtran}